commit 04/11/2025

This commit is contained in:
2025-11-04 17:02:53 +07:00
parent fc1291dcd5
commit 72c509feec
16 changed files with 18196 additions and 172 deletions

View File

@@ -1,6 +1,6 @@
<component name="libraryTable"> <component name="libraryTable">
<library name="io.javalin" type="repository"> <library name="io.javalin" type="repository">
<properties maven-id="io.javalin:javalin:LATEST" /> <properties maven-id="io.javalin:javalin:6.7.0" />
<CLASSES> <CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/io/javalin/javalin/6.7.0/javalin-6.7.0.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/io/javalin/javalin/6.7.0/javalin-6.7.0.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/slf4j/slf4j-api/2.0.17/slf4j-api-2.0.17.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/org/slf4j/slf4j-api/2.0.17/slf4j-api-2.0.17.jar!/" />

6
.idea/sqldialects.xml generated
View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="SqlDialectMappings">
<file url="file://$PROJECT_DIR$/src/database/MariaDB.kt" dialect="MySQL" />
</component>
</project>

15860
html/semiauto/assets/css/bootstrap.min.css vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,516 @@
/* !
* Select2 Bootstrap Theme v0.1.0-beta.10 (https://select2.github.io/select2-bootstrap-theme)
* Copyright 2015-2017 Florian Kissling and contributors (https://github.com/select2/select2-bootstrap-theme/graphs/contributors)
* Licensed under MIT (https://github.com/select2/select2-bootstrap-theme/blob/master/LICENSE) */
.select2-container--bootstrap {
display: block;
}
.select2-container--bootstrap .select2-selection {
-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
background-color: #fff;
border: 1px solid #ccc;
border-radius: 4px;
color: #555;
font-size: 14px;
outline: 0;
}
.select2-container--bootstrap .select2-selection.form-control {
border-radius: 4px;
}
.select2-container--bootstrap .select2-search--dropdown .select2-search__field {
-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
background-color: #fff;
border: 1px solid #ccc;
border-radius: 4px;
color: #555;
font-size: 14px;
}
.select2-container--bootstrap .select2-search__field {
outline: 0;
}
.select2-container--bootstrap .select2-search__field::-webkit-input-placeholder {
color: #999;
}
.select2-container--bootstrap .select2-search__field:-moz-placeholder {
color: #999;
}
.select2-container--bootstrap .select2-search__field::-moz-placeholder {
color: #999;
opacity: 1;
}
.select2-container--bootstrap .select2-search__field:-ms-input-placeholder {
color: #999;
}
.select2-container--bootstrap .select2-results__option {
padding: 6px 12px;
}
.select2-container--bootstrap .select2-results__option[role=group] {
padding: 0;
}
.select2-container--bootstrap .select2-results__option[aria-disabled=true] {
color: #777;
cursor: not-allowed;
}
.select2-container--bootstrap .select2-results__option[aria-selected=true] {
background-color: #f5f5f5;
color: #262626;
}
.select2-container--bootstrap .select2-results__option--highlighted[aria-selected] {
background-color: #337ab7;
color: #fff;
}
.select2-container--bootstrap .select2-results__option .select2-results__option {
padding: 6px 12px;
}
.select2-container--bootstrap .select2-results__option .select2-results__option .select2-results__group {
padding-left: 0;
}
.select2-container--bootstrap .select2-results__option .select2-results__option .select2-results__option {
margin-left: -12px;
padding-left: 24px;
}
.select2-container--bootstrap .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
margin-left: -24px;
padding-left: 36px;
}
.select2-container--bootstrap .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
margin-left: -36px;
padding-left: 48px;
}
.select2-container--bootstrap .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
margin-left: -48px;
padding-left: 60px;
}
.select2-container--bootstrap .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
margin-left: -60px;
padding-left: 72px;
}
.select2-container--bootstrap .select2-results__group {
color: #777;
display: block;
padding: 6px 12px;
font-size: 12px;
line-height: 1.42857143;
white-space: nowrap;
}
.select2-container--bootstrap.select2-container--focus .select2-selection, .select2-container--bootstrap.select2-container--open .select2-selection {
-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);
box-shadow: inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);
-o-transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
-webkit-transition: border-color ease-in-out .15s,-webkit-box-shadow ease-in-out .15s;
transition: border-color ease-in-out .15s,-webkit-box-shadow ease-in-out .15s;
transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s,-webkit-box-shadow ease-in-out .15s;
border-color: #66afe9;
}
.select2-container--bootstrap.select2-container--open .select2-selection .select2-selection__arrow b {
border-color: transparent transparent #999;
border-width: 0 4px 4px;
}
.select2-container--bootstrap.select2-container--open.select2-container--below .select2-selection {
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
border-bottom-color: transparent;
}
.select2-container--bootstrap.select2-container--open.select2-container--above .select2-selection {
border-top-right-radius: 0;
border-top-left-radius: 0;
border-top-color: transparent;
}
.select2-container--bootstrap .select2-selection__clear {
color: #999;
cursor: pointer;
float: right;
font-weight: 700;
margin-right: 10px;
}
.select2-container--bootstrap .select2-selection__clear:hover {
color: #333;
}
.select2-container--bootstrap.select2-container--disabled .select2-selection {
border-color: #ccc;
-webkit-box-shadow: none;
box-shadow: none;
}
.select2-container--bootstrap.select2-container--disabled .select2-search__field, .select2-container--bootstrap.select2-container--disabled .select2-selection {
cursor: not-allowed;
}
.select2-container--bootstrap.select2-container--disabled .select2-selection, .select2-container--bootstrap.select2-container--disabled .select2-selection--multiple .select2-selection__choice {
background-color: #eee;
}
.select2-container--bootstrap.select2-container--disabled .select2-selection--multiple .select2-selection__choice__remove, .select2-container--bootstrap.select2-container--disabled .select2-selection__clear {
display: none;
}
.select2-container--bootstrap .select2-dropdown {
-webkit-box-shadow: 0 6px 12px rgba(0,0,0,.175);
box-shadow: 0 6px 12px rgba(0,0,0,.175);
border-color: #66afe9;
overflow-x: hidden;
margin-top: -1px;
}
.select2-container--bootstrap .select2-dropdown--above {
-webkit-box-shadow: 0 -6px 12px rgba(0,0,0,.175);
box-shadow: 0 -6px 12px rgba(0,0,0,.175);
margin-top: 1px;
}
.select2-container--bootstrap .select2-results > .select2-results__options {
max-height: 200px;
overflow-y: auto;
}
.select2-container--bootstrap .select2-selection--single {
height: 34px;
line-height: 1.42857143;
padding: 6px 24px 6px 12px;
}
.select2-container--bootstrap .select2-selection--single .select2-selection__arrow {
position: absolute;
bottom: 0;
right: 12px;
top: 0;
width: 4px;
}
.select2-container--bootstrap .select2-selection--single .select2-selection__arrow b {
border-color: #999 transparent transparent;
border-style: solid;
border-width: 4px 4px 0;
height: 0;
left: 0;
margin-left: -4px;
margin-top: -2px;
position: absolute;
top: 50%;
width: 0;
}
.select2-container--bootstrap .select2-selection--single .select2-selection__rendered {
color: #555;
padding: 0;
}
.select2-container--bootstrap .select2-selection--single .select2-selection__placeholder {
color: #999;
}
.select2-container--bootstrap .select2-selection--multiple {
min-height: 34px;
padding: 0;
height: auto;
}
.select2-container--bootstrap .select2-selection--multiple .select2-selection__rendered {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
display: block;
line-height: 1.42857143;
list-style: none;
margin: 0;
overflow: hidden;
padding: 0;
width: 100%;
text-overflow: ellipsis;
white-space: nowrap;
}
.select2-container--bootstrap .select2-selection--multiple .select2-selection__placeholder {
color: #999;
float: left;
margin-top: 5px;
}
.select2-container--bootstrap .select2-selection--multiple .select2-selection__choice {
color: #555;
background: #fff;
border: 1px solid #ccc;
border-radius: 4px;
cursor: default;
float: left;
margin: 5px 0 0 6px;
padding: 0 6px;
}
.select2-container--bootstrap .select2-selection--multiple .select2-search--inline .select2-search__field {
background: 0 0;
padding: 0 12px;
height: 32px;
line-height: 1.42857143;
margin-top: 0;
min-width: 5em;
}
.select2-container--bootstrap .select2-selection--multiple .select2-selection__choice__remove {
color: #999;
cursor: pointer;
display: inline-block;
font-weight: 700;
margin-right: 3px;
}
.select2-container--bootstrap .select2-selection--multiple .select2-selection__choice__remove:hover {
color: #333;
}
.select2-container--bootstrap .select2-selection--multiple .select2-selection__clear {
margin-top: 6px;
}
.form-group-sm .select2-container--bootstrap .select2-selection--single, .input-group-sm .select2-container--bootstrap .select2-selection--single, .select2-container--bootstrap .select2-selection--single.input-sm {
border-radius: 3px;
font-size: 12px;
height: 30px;
line-height: 1.5;
padding: 5px 22px 5px 10px;
}
.form-group-sm .select2-container--bootstrap .select2-selection--single .select2-selection__arrow b, .input-group-sm .select2-container--bootstrap .select2-selection--single .select2-selection__arrow b, .select2-container--bootstrap .select2-selection--single.input-sm .select2-selection__arrow b {
margin-left: -5px;
}
.form-group-sm .select2-container--bootstrap .select2-selection--multiple, .input-group-sm .select2-container--bootstrap .select2-selection--multiple, .select2-container--bootstrap .select2-selection--multiple.input-sm {
min-height: 30px;
border-radius: 3px;
}
.form-group-sm .select2-container--bootstrap .select2-selection--multiple .select2-selection__choice, .input-group-sm .select2-container--bootstrap .select2-selection--multiple .select2-selection__choice, .select2-container--bootstrap .select2-selection--multiple.input-sm .select2-selection__choice {
font-size: 12px;
line-height: 1.5;
margin: 4px 0 0 5px;
padding: 0 5px;
}
.form-group-sm .select2-container--bootstrap .select2-selection--multiple .select2-search--inline .select2-search__field, .input-group-sm .select2-container--bootstrap .select2-selection--multiple .select2-search--inline .select2-search__field, .select2-container--bootstrap .select2-selection--multiple.input-sm .select2-search--inline .select2-search__field {
padding: 0 10px;
font-size: 12px;
height: 28px;
line-height: 1.5;
}
.form-group-sm .select2-container--bootstrap .select2-selection--multiple .select2-selection__clear, .input-group-sm .select2-container--bootstrap .select2-selection--multiple .select2-selection__clear, .select2-container--bootstrap .select2-selection--multiple.input-sm .select2-selection__clear {
margin-top: 5px;
}
.form-group-lg .select2-container--bootstrap .select2-selection--single, .input-group-lg .select2-container--bootstrap .select2-selection--single, .select2-container--bootstrap .select2-selection--single.input-lg {
border-radius: 6px;
font-size: 18px;
height: 46px;
line-height: 1.3333333;
padding: 10px 31px 10px 16px;
}
.form-group-lg .select2-container--bootstrap .select2-selection--single .select2-selection__arrow, .input-group-lg .select2-container--bootstrap .select2-selection--single .select2-selection__arrow, .select2-container--bootstrap .select2-selection--single.input-lg .select2-selection__arrow {
width: 5px;
}
.form-group-lg .select2-container--bootstrap .select2-selection--single .select2-selection__arrow b, .input-group-lg .select2-container--bootstrap .select2-selection--single .select2-selection__arrow b, .select2-container--bootstrap .select2-selection--single.input-lg .select2-selection__arrow b {
border-width: 5px 5px 0;
margin-left: -10px;
margin-top: -2.5px;
}
.form-group-lg .select2-container--bootstrap .select2-selection--multiple, .input-group-lg .select2-container--bootstrap .select2-selection--multiple, .select2-container--bootstrap .select2-selection--multiple.input-lg {
min-height: 46px;
border-radius: 6px;
}
.form-group-lg .select2-container--bootstrap .select2-selection--multiple .select2-selection__choice, .input-group-lg .select2-container--bootstrap .select2-selection--multiple .select2-selection__choice, .select2-container--bootstrap .select2-selection--multiple.input-lg .select2-selection__choice {
font-size: 18px;
line-height: 1.3333333;
border-radius: 4px;
margin: 9px 0 0 8px;
padding: 0 10px;
}
.form-group-lg .select2-container--bootstrap .select2-selection--multiple .select2-search--inline .select2-search__field, .input-group-lg .select2-container--bootstrap .select2-selection--multiple .select2-search--inline .select2-search__field, .select2-container--bootstrap .select2-selection--multiple.input-lg .select2-search--inline .select2-search__field {
padding: 0 16px;
font-size: 18px;
height: 44px;
line-height: 1.3333333;
}
.form-group-lg .select2-container--bootstrap .select2-selection--multiple .select2-selection__clear, .input-group-lg .select2-container--bootstrap .select2-selection--multiple .select2-selection__clear, .select2-container--bootstrap .select2-selection--multiple.input-lg .select2-selection__clear {
margin-top: 10px;
}
.input-group-lg .select2-container--bootstrap .select2-selection.select2-container--open .select2-selection--single .select2-selection__arrow b, .select2-container--bootstrap .select2-selection.input-lg.select2-container--open .select2-selection--single .select2-selection__arrow b {
border-color: transparent transparent #999;
border-width: 0 5px 5px;
}
.select2-container--bootstrap[dir=rtl] .select2-selection--single {
padding-left: 24px;
padding-right: 12px;
}
.select2-container--bootstrap[dir=rtl] .select2-selection--single .select2-selection__rendered {
padding-right: 0;
padding-left: 0;
text-align: right;
}
.select2-container--bootstrap[dir=rtl] .select2-selection--single .select2-selection__clear {
float: left;
}
.select2-container--bootstrap[dir=rtl] .select2-selection--single .select2-selection__arrow {
left: 12px;
right: auto;
}
.select2-container--bootstrap[dir=rtl] .select2-selection--single .select2-selection__arrow b {
margin-left: 0;
}
.select2-container--bootstrap[dir=rtl] .select2-selection--multiple .select2-search--inline, .select2-container--bootstrap[dir=rtl] .select2-selection--multiple .select2-selection__choice, .select2-container--bootstrap[dir=rtl] .select2-selection--multiple .select2-selection__placeholder {
float: right;
}
.select2-container--bootstrap[dir=rtl] .select2-selection--multiple .select2-selection__choice {
margin-left: 0;
margin-right: 6px;
}
.select2-container--bootstrap[dir=rtl] .select2-selection--multiple .select2-selection__choice__remove {
margin-left: 2px;
margin-right: auto;
}
.has-warning .select2-dropdown, .has-warning .select2-selection {
border-color: #8a6d3b;
}
.has-warning .select2-container--focus .select2-selection, .has-warning .select2-container--open .select2-selection {
-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #c0a16b;
box-shadow: inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #c0a16b;
border-color: #66512c;
}
.has-warning.select2-drop-active {
border-color: #66512c;
}
.has-warning.select2-drop-active.select2-drop.select2-drop-above {
border-top-color: #66512c;
}
.has-error .select2-dropdown, .has-error .select2-selection {
border-color: #a94442;
}
.has-error .select2-container--focus .select2-selection, .has-error .select2-container--open .select2-selection {
-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #ce8483;
box-shadow: inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #ce8483;
border-color: #843534;
}
.has-error.select2-drop-active {
border-color: #843534;
}
.has-error.select2-drop-active.select2-drop.select2-drop-above {
border-top-color: #843534;
}
.has-success .select2-dropdown, .has-success .select2-selection {
border-color: #3c763d;
}
.has-success .select2-container--focus .select2-selection, .has-success .select2-container--open .select2-selection {
-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #67b168;
box-shadow: inset 0 1px 1px rgba(0,0,0,.075),0 0 6px #67b168;
border-color: #2b542c;
}
.has-success.select2-drop-active {
border-color: #2b542c;
}
.has-success.select2-drop-active.select2-drop.select2-drop-above {
border-top-color: #2b542c;
}
.input-group > .select2-hidden-accessible:first-child + .select2-container--bootstrap > .selection > .select2-selection, .input-group > .select2-hidden-accessible:first-child + .select2-container--bootstrap > .selection > .select2-selection.form-control {
border-bottom-right-radius: 0;
border-top-right-radius: 0;
}
.input-group > .select2-hidden-accessible:not(:first-child) + .select2-container--bootstrap:not(:last-child) > .selection > .select2-selection, .input-group > .select2-hidden-accessible:not(:first-child) + .select2-container--bootstrap:not(:last-child) > .selection > .select2-selection.form-control {
border-radius: 0;
}
.input-group > .select2-hidden-accessible:not(:first-child):not(:last-child) + .select2-container--bootstrap:last-child > .selection > .select2-selection, .input-group > .select2-hidden-accessible:not(:first-child):not(:last-child) + .select2-container--bootstrap:last-child > .selection > .select2-selection.form-control {
border-bottom-left-radius: 0;
border-top-left-radius: 0;
}
.input-group > .select2-container--bootstrap {
display: table;
table-layout: fixed;
position: relative;
z-index: 2;
width: 100%;
margin-bottom: 0;
}
.input-group > .select2-container--bootstrap > .selection > .select2-selection.form-control {
float: none;
}
.input-group > .select2-container--bootstrap.select2-container--focus, .input-group > .select2-container--bootstrap.select2-container--open {
z-index: 3;
}
.input-group > .select2-container--bootstrap, .input-group > .select2-container--bootstrap .input-group-btn, .input-group > .select2-container--bootstrap .input-group-btn .btn {
vertical-align: top;
}
.form-control.select2-hidden-accessible {
position: absolute!important;
width: 1px!important;
}
@media (min-width:768px) {
.form-inline .select2-container--bootstrap {
display: inline-block;
}
}

629
html/semiauto/assets/css/select2.min.css vendored Normal file
View File

@@ -0,0 +1,629 @@
.select2-container {
box-sizing: border-box;
display: inline-block;
margin: 0;
position: relative;
vertical-align: middle;
}
.select2-container .select2-selection--single {
box-sizing: border-box;
cursor: pointer;
display: block;
height: 28px;
user-select: none;
-webkit-user-select: none;
}
.select2-container .select2-selection--single .select2-selection__rendered {
display: block;
padding-left: 8px;
padding-right: 20px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.select2-container .select2-selection--single .select2-selection__clear {
position: relative;
}
.select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered {
padding-right: 8px;
padding-left: 20px;
}
.select2-container .select2-selection--multiple {
box-sizing: border-box;
cursor: pointer;
display: block;
min-height: 32px;
user-select: none;
-webkit-user-select: none;
}
.select2-container .select2-selection--multiple .select2-selection__rendered {
display: inline-block;
overflow: hidden;
padding-left: 8px;
text-overflow: ellipsis;
white-space: nowrap;
}
.select2-container .select2-search--inline {
float: left;
}
.select2-container .select2-search--inline .select2-search__field {
box-sizing: border-box;
border: none;
font-size: 100%;
margin-top: 5px;
padding: 0;
}
.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button {
-webkit-appearance: none;
}
.select2-dropdown {
background-color: white;
border: 1px solid #aaa;
border-radius: 4px;
box-sizing: border-box;
display: block;
position: absolute;
left: -100000px;
width: 100%;
z-index: 1051;
}
.select2-results {
display: block;
}
.select2-results__options {
list-style: none;
margin: 0;
padding: 0;
}
.select2-results__option {
padding: 6px;
user-select: none;
-webkit-user-select: none;
}
.select2-results__option[aria-selected] {
cursor: pointer;
}
.select2-container--open .select2-dropdown {
left: 0;
}
.select2-container--open .select2-dropdown--above {
border-bottom: none;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
}
.select2-container--open .select2-dropdown--below {
border-top: none;
border-top-left-radius: 0;
border-top-right-radius: 0;
}
.select2-search--dropdown {
display: block;
padding: 4px;
}
.select2-search--dropdown .select2-search__field {
padding: 4px;
width: 100%;
box-sizing: border-box;
}
.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button {
-webkit-appearance: none;
}
.select2-search--dropdown.select2-search--hide {
display: none;
}
.select2-close-mask {
border: 0;
margin: 0;
padding: 0;
display: block;
position: fixed;
left: 0;
top: 0;
min-height: 100%;
min-width: 100%;
height: auto;
width: auto;
opacity: 0;
z-index: 99;
background-color: #fff;
filter: alpha(opacity=0);
}
.select2-hidden-accessible {
border: 0 !important;
clip: rect(0 0 0 0) !important;
-webkit-clip-path: inset(50%) !important;
clip-path: inset(50%) !important;
height: 1px !important;
overflow: hidden !important;
padding: 0 !important;
position: absolute !important;
width: 1px !important;
white-space: nowrap !important;
}
.select2-container--default .select2-selection--single {
background-color: #fff;
border: 1px solid #aaa;
border-radius: 4px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
color: #444;
line-height: 28px;
}
.select2-container--default .select2-selection--single .select2-selection__clear {
cursor: pointer;
float: right;
font-weight: bold;
}
.select2-container--default .select2-selection--single .select2-selection__placeholder {
color: #999;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
height: 26px;
position: absolute;
top: 1px;
right: 1px;
width: 20px;
}
.select2-container--default .select2-selection--single .select2-selection__arrow b {
border-color: #888 transparent transparent transparent;
border-style: solid;
border-width: 5px 4px 0 4px;
height: 0;
left: 50%;
margin-left: -4px;
margin-top: -2px;
position: absolute;
top: 50%;
width: 0;
}
.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear {
float: left;
}
.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow {
left: 1px;
right: auto;
}
.select2-container--default.select2-container--disabled .select2-selection--single {
background-color: #eee;
cursor: default;
}
.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear {
display: none;
}
.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
border-color: transparent transparent #888 transparent;
border-width: 0 4px 5px 4px;
}
.select2-container--default .select2-selection--multiple {
background-color: white;
border: 1px solid #aaa;
border-radius: 4px;
cursor: text;
}
.select2-container--default .select2-selection--multiple .select2-selection__rendered {
box-sizing: border-box;
list-style: none;
margin: 0;
padding: 0 5px;
width: 100%;
}
.select2-container--default .select2-selection--multiple .select2-selection__rendered li {
list-style: none;
}
.select2-container--default .select2-selection--multiple .select2-selection__clear {
cursor: pointer;
float: right;
font-weight: bold;
margin-top: 5px;
margin-right: 10px;
padding: 1px;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice {
background-color: #e4e4e4;
border: 1px solid #aaa;
border-radius: 4px;
cursor: default;
float: left;
margin-right: 5px;
margin-top: 5px;
padding: 0 5px;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
color: #999;
cursor: pointer;
display: inline-block;
font-weight: bold;
margin-right: 2px;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
color: #333;
}
.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice, .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-search--inline {
float: right;
}
.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
margin-left: 5px;
margin-right: auto;
}
.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove {
margin-left: 2px;
margin-right: auto;
}
.select2-container--default.select2-container--focus .select2-selection--multiple {
border: solid black 1px;
outline: 0;
}
.select2-container--default.select2-container--disabled .select2-selection--multiple {
background-color: #eee;
cursor: default;
}
.select2-container--default.select2-container--disabled .select2-selection__choice__remove {
display: none;
}
.select2-container--default.select2-container--open.select2-container--above .select2-selection--single, .select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple {
border-top-left-radius: 0;
border-top-right-radius: 0;
}
.select2-container--default.select2-container--open.select2-container--below .select2-selection--single, .select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple {
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
}
.select2-container--default .select2-search--dropdown .select2-search__field {
border: 1px solid #aaa;
}
.select2-container--default .select2-search--inline .select2-search__field {
background: transparent;
border: none;
outline: 0;
box-shadow: none;
-webkit-appearance: textfield;
}
.select2-container--default .select2-results > .select2-results__options {
max-height: 200px;
overflow-y: auto;
}
.select2-container--default .select2-results__option[role=group] {
padding: 0;
}
.select2-container--default .select2-results__option[aria-disabled=true] {
color: #999;
}
.select2-container--default .select2-results__option[aria-selected=true] {
background-color: #ddd;
}
.select2-container--default .select2-results__option .select2-results__option {
padding-left: 1em;
}
.select2-container--default .select2-results__option .select2-results__option .select2-results__group {
padding-left: 0;
}
.select2-container--default .select2-results__option .select2-results__option .select2-results__option {
margin-left: -1em;
padding-left: 2em;
}
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
margin-left: -2em;
padding-left: 3em;
}
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
margin-left: -3em;
padding-left: 4em;
}
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
margin-left: -4em;
padding-left: 5em;
}
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
margin-left: -5em;
padding-left: 6em;
}
.select2-container--default .select2-results__option--highlighted[aria-selected] {
background-color: #5897fb;
color: white;
}
.select2-container--default .select2-results__group {
cursor: default;
display: block;
padding: 6px;
}
.select2-container--classic .select2-selection--single {
background-color: #f7f7f7;
border: 1px solid #aaa;
border-radius: 4px;
outline: 0;
background-image: -webkit-linear-gradient(top, #fff 50%, #eee 100%);
background-image: -o-linear-gradient(top, #fff 50%, #eee 100%);
background-image: linear-gradient(to bottom, #fff 50%, #eee 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0);
}
.select2-container--classic .select2-selection--single:focus {
border: 1px solid #5897fb;
}
.select2-container--classic .select2-selection--single .select2-selection__rendered {
color: #444;
line-height: 28px;
}
.select2-container--classic .select2-selection--single .select2-selection__clear {
cursor: pointer;
float: right;
font-weight: bold;
margin-right: 10px;
}
.select2-container--classic .select2-selection--single .select2-selection__placeholder {
color: #999;
}
.select2-container--classic .select2-selection--single .select2-selection__arrow {
background-color: #ddd;
border: none;
border-left: 1px solid #aaa;
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
height: 26px;
position: absolute;
top: 1px;
right: 1px;
width: 20px;
background-image: -webkit-linear-gradient(top, #eee 50%, #ccc 100%);
background-image: -o-linear-gradient(top, #eee 50%, #ccc 100%);
background-image: linear-gradient(to bottom, #eee 50%, #ccc 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFCCCCCC', GradientType=0);
}
.select2-container--classic .select2-selection--single .select2-selection__arrow b {
border-color: #888 transparent transparent transparent;
border-style: solid;
border-width: 5px 4px 0 4px;
height: 0;
left: 50%;
margin-left: -4px;
margin-top: -2px;
position: absolute;
top: 50%;
width: 0;
}
.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear {
float: left;
}
.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow {
border: none;
border-right: 1px solid #aaa;
border-radius: 0;
border-top-left-radius: 4px;
border-bottom-left-radius: 4px;
left: 1px;
right: auto;
}
.select2-container--classic.select2-container--open .select2-selection--single {
border: 1px solid #5897fb;
}
.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow {
background: transparent;
border: none;
}
.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b {
border-color: transparent transparent #888 transparent;
border-width: 0 4px 5px 4px;
}
.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single {
border-top: none;
border-top-left-radius: 0;
border-top-right-radius: 0;
background-image: -webkit-linear-gradient(top, #fff 0%, #eee 50%);
background-image: -o-linear-gradient(top, #fff 0%, #eee 50%);
background-image: linear-gradient(to bottom, #fff 0%, #eee 50%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0);
}
.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single {
border-bottom: none;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
background-image: -webkit-linear-gradient(top, #eee 50%, #fff 100%);
background-image: -o-linear-gradient(top, #eee 50%, #fff 100%);
background-image: linear-gradient(to bottom, #eee 50%, #fff 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFFFFFFF', GradientType=0);
}
.select2-container--classic .select2-selection--multiple {
background-color: white;
border: 1px solid #aaa;
border-radius: 4px;
cursor: text;
outline: 0;
}
.select2-container--classic .select2-selection--multiple:focus {
border: 1px solid #5897fb;
}
.select2-container--classic .select2-selection--multiple .select2-selection__rendered {
list-style: none;
margin: 0;
padding: 0 5px;
}
.select2-container--classic .select2-selection--multiple .select2-selection__clear {
display: none;
}
.select2-container--classic .select2-selection--multiple .select2-selection__choice {
background-color: #e4e4e4;
border: 1px solid #aaa;
border-radius: 4px;
cursor: default;
float: left;
margin-right: 5px;
margin-top: 5px;
padding: 0 5px;
}
.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove {
color: #888;
cursor: pointer;
display: inline-block;
font-weight: bold;
margin-right: 2px;
}
.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover {
color: #555;
}
.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
float: right;
margin-left: 5px;
margin-right: auto;
}
.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove {
margin-left: 2px;
margin-right: auto;
}
.select2-container--classic.select2-container--open .select2-selection--multiple {
border: 1px solid #5897fb;
}
.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple {
border-top: none;
border-top-left-radius: 0;
border-top-right-radius: 0;
}
.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple {
border-bottom: none;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
}
.select2-container--classic .select2-search--dropdown .select2-search__field {
border: 1px solid #aaa;
outline: 0;
}
.select2-container--classic .select2-search--inline .select2-search__field {
outline: 0;
box-shadow: none;
}
.select2-container--classic .select2-dropdown {
background-color: #fff;
border: 1px solid transparent;
}
.select2-container--classic .select2-dropdown--above {
border-bottom: none;
}
.select2-container--classic .select2-dropdown--below {
border-top: none;
}
.select2-container--classic .select2-results > .select2-results__options {
max-height: 200px;
overflow-y: auto;
}
.select2-container--classic .select2-results__option[role=group] {
padding: 0;
}
.select2-container--classic .select2-results__option[aria-disabled=true] {
color: grey;
}
.select2-container--classic .select2-results__option--highlighted[aria-selected] {
background-color: #3875d7;
color: #fff;
}
.select2-container--classic .select2-results__group {
cursor: default;
display: block;
padding: 6px;
}
.select2-container--classic.select2-container--open .select2-dropdown {
border-color: #5897fb;
}

View File

@@ -97,9 +97,11 @@ input {
} }
.navbar-bg { .navbar-bg {
background-color: #1e293b!important; /*background-color: #1e293b!important;*/
color: white !important; /*color: white !important;*/
/*background-color: #f0f2ff !important;*/ /*background-color: #f0f2ff !important;*/
color: white !important;
background-color: #29587a !important;
} }
.navbar-bg2 { .navbar-bg2 {
@@ -138,7 +140,7 @@ input {
.div-broadcast { .div-broadcast {
width: 100%; width: 100%;
max-height: 115px; max-height: 135px;
overflow-y: auto; overflow-y: auto;
overflow-x: hidden; overflow-x: hidden;
padding: 10px; padding: 10px;
@@ -315,12 +317,16 @@ th, td {
} }
.btn-reload { .btn-reload {
background-color: #084ed5; /*background-color: #084ed5;*/
/*color: #fff;*/
background-color: #3e6fcd;
color: #fff; color: #fff;
} }
.btn-reload:hover { .btn-reload:hover {
background-color: #053185; /*background-color: #053185;*/
/*color: #fff;*/
background-color: #5080d9;
color: #fff; color: #fff;
} }
@@ -339,7 +345,7 @@ th, td {
} }
.btn-logout { .btn-logout {
background-color: #366396; background-color: #4280ab;
color: #fff; color: #fff;
} }
@@ -416,12 +422,18 @@ input#dt-search-0 {
} }
.btn-broadcast { .btn-broadcast {
background-color: #0d6efd; /*background-color: #0d6efd;*/
/*color: white;*/
background-color: #437a9e;
/*background-color: #0a3349;*/
color: white; color: white;
border: none;
} }
.btn-broadcast:hover { .btn-broadcast:hover {
background-color: #3b5bdb; /*background-color: #3b5bdb;*/
/*color: white;*/
background-color: #5088ab;
color: white; color: white;
} }
@@ -449,3 +461,7 @@ input#dt-search-0 {
margin-top: 1rem; margin-top: 1rem;
} }
.pad-left {
margin-bottom: 1rem;
}

File diff suppressed because one or more lines are too long

View File

@@ -1,3 +1,868 @@
$(document).ready(function() { let $preview_indonesia = null;
$('#logtable').DataTable(); let $preview_english = null;
let $preview_chinese = null;
let $preview_japanese = null;
let $preview_arabic = null;
let $preview_local = null;
let $enable_indonesia = null;
let $enable_english = null;
let $enable_chinese = null;
let $enable_japanese = null;
let $enable_arabic = null;
let $enable_local = null;
let $tbody_message = null;
let $tbody_broadcastzones = null;
let $select_airline = null;
let $select_city = null;
let $select_places = null;
let $select_shalat = null;
let $select_reason = null;
let $select_conveyorbelt = null;
let $select_procedure = null;
let $select_compensation = null;
let $input_gatenumber = null;
let $input_flightnumber = null;
let $input_licenseplate = null;
let $input_conveyorbelt = null;
let $input_hours = null;
let $input_minutes = null;
let $row_airplane = null;
let $row_city = null;
let $row_gatenumber = null;
let $row_time = null;
let $col_reason = null;
let $col_places = null;
let $col_shalat = null;
let $col_conveyorbelt = null;
let $col_procedure = null;
let $col_licenseplate = null;
/**
* @typedef {Object} message
* @property {number} id - The ID of the message
* @property {string} description - The description of the message
* @property {string} language - The language of the message
* @property {string} message_details - The detailed message content
*/
/**
* @typedef {Object} variabledata
* @property {string} tag - The tag of the variable
* @property {string} value - The value of the variable
*/
/**
* Fetch API helper function
* @param {string} endpoint Endpoint URL
* @param {string} method Method (GET, POST, etc.)
* @param {Object} headers Headers to include in the request
* @param {Object} body Body of the request
* @param {Function} cbOK Callback function for successful response
* @param {Function} cbError Callback function for error response
*/
function fetchAPI(endpoint, method, headers = {}, body = null, cbOK, cbError) {
let url = window.location.origin + "/api/" + endpoint;
let options = {
method: method,
headers: headers
}
if (body !== null) {
options.body = JSON.stringify(body);
if (!options.headers['Content-Type']) {
options.headers['Content-Type'] = 'application/json';
}
}
fetch(url, options)
.then(async (response) => {
if (!response.ok) {
let msg;
try {
let _xxx = await response.json();
msg = _xxx.message || response.statusText;
} catch {
msg = await response.statusText;
}
throw new Error(msg);
}
return response.json();
})
.then(data => {
cbOK(data);
})
.catch(error => {
cbError(error);
});
}
window.semiautodata = {
/** @type {message[]} */
messages: null,
/** @type {variabledata[]} */
airlines: null,
/** @type {variabledata[]} */
cities: null,
/** @type {variabledata[]} */
places: null,
/** @type {variabledata[]} */
shalat: null,
/** @type {variabledata[]} */
sequences: null,
/** @type {variabledata[]} */
reasons: null,
/** @type {variabledata[]} */
procedures: null,
/** @type {variabledata[]} */
gates: null,
/** @type {variabledata[]} */
compensation: null,
/** @type {variabledata[]} */
greetings: null,
/** @type {string[]} */
broadcastzones: null,
Clear: () => {
window.semiautodata.messages = [];
window.semiautodata.airlines = [];
window.semiautodata.cities = [];
window.semiautodata.places = [];
window.semiautodata.shalat = [];
window.semiautodata.sequences = [];
window.semiautodata.reasons = [];
window.semiautodata.procedures = [];
window.semiautodata.gates = [];
window.semiautodata.compensation = [];
window.semiautodata.greetings = [];
window.semiautodata.broadcastzones = [];
},
Add_Message: (str) => {
if (str == null || typeof str !== 'string' || str.trim().length === 0) {
console.warn("Add_Message: input must be a non-empty string");
return false;
}
const parts = str.split(';');
if (!Array.isArray(parts) || parts.length !== 4) {
console.warn("Add_Message: input must contain exactly 4 semicolon-separated parts");
return false;
}
const [idPart, description, language, message_details] = parts.map(p => p.trim());
const id = Number(idPart);
if (!Number.isInteger(id)) {
console.warn("Add_Message: first part must be an integer id");
return false;
}
const duplicate = window.semiautodata.messages.some(m => {
if (!m) return false;
const mid = Number(m.id);
const mlang = (m.language || "").trim();
return Number.isInteger(mid) && mid === id && mlang === language;
});
if (duplicate) {
console.warn(`Add_Message: message with id ${id} and language "${language}" already exists`);
return false;
}
window.semiautodata.messages.push({
id: id,
description: description,
language: language,
message_details: message_details
});
return true;
},
Add_Airline: (str) => {
if (str == null || typeof str !== 'string' || str.trim().length === 0) {
console.warn("Add_Airline: input must be a non-empty string");
return false;
}
const parts = str.split(';').map(p => p.trim());
if (!Array.isArray(parts) || parts.length !== 2) {
console.warn("Add_Airline: input must contain exactly 2 semicolon-separated parts");
return false;
}
const [tag, value] = parts;
if (!tag || !value) {
console.warn("Add_Airline: both tag and value must be non-empty");
return false;
}
const duplicate = window.semiautodata.airlines.some(a => (a && (a.tag || "").trim() === tag && (a.value || "").trim() === value));
if (duplicate) {
console.warn(`Add_Airline: airline "${tag}" with value "${value}" already exists`);
return false;
}
window.semiautodata.airlines.push({ tag, value });
return true;
},
Add_City: (str) => {
if (str == null || typeof str !== 'string' || str.trim().length === 0) {
console.warn("Add_City: input must be a non-empty string");
return false;
}
const parts = str.split(';').map(p => p.trim());
if (!Array.isArray(parts) || parts.length !== 2) {
console.warn("Add_City: input must contain exactly 2 semicolon-separated parts");
return false;
}
const [tag, value] = parts;
if (!tag || !value) {
console.warn("Add_City: both tag and value must be non-empty");
return false;
}
const duplicate = window.semiautodata.cities.some(c => (c && (c.tag || "").trim() === tag && (c.value || "").trim() === value));
if (duplicate) {
console.warn(`Add_City: city "${tag}" with value "${value}" already exists`);
return false;
}
window.semiautodata.cities.push({ tag, value });
return true;
},
Add_Place: (str) => {
if (str == null || typeof str !== 'string' || str.trim().length === 0) {
console.warn("Add_Place: input must be a non-empty string");
return false;
}
const parts = str.split(';').map(p => p.trim());
if (!Array.isArray(parts) || parts.length !== 2) {
console.warn("Add_Place: input must contain exactly 2 semicolon-separated parts");
return false;
}
const [tag, value] = parts;
if (!tag || !value) {
console.warn("Add_Place: both tag and value must be non-empty");
return false;
}
const duplicate = window.semiautodata.places.some(p => (p && (p.tag || "").trim() === tag && (p.value || "").trim() === value));
if (duplicate) {
console.warn(`Add_Place: place "${tag}" with value "${value}" already exists`);
return false;
}
window.semiautodata.places.push({ tag, value });
return true;
},
Add_Shalat: (str) => {
if (str == null || typeof str !== 'string' || str.trim().length === 0) {
console.warn("Add_Shalat: input must be a non-empty string");
return false;
}
const parts = str.split(';').map(p => p.trim());
if (!Array.isArray(parts) || parts.length !== 2) {
console.warn("Add_Shalat: input must contain exactly 2 semicolon-separated parts");
return false;
}
const [tag, value] = parts;
if (!tag || !value) {
console.warn("Add_Shalat: both tag and value must be non-empty");
return false;
}
const duplicate = window.semiautodata.shalat.some(s => (s && (s.tag || "").trim() === tag && (s.value || "").trim() === value));
if (duplicate) {
console.warn(`Add_Shalat: shalat "${tag}" with value "${value}" already exists`);
return false;
}
window.semiautodata.shalat.push({ tag, value });
return true;
},
Add_Reason: (str) => {
if (str == null || typeof str !== 'string' || str.trim().length === 0) {
console.warn("Add_Reason: input must be a non-empty string");
return false;
}
const parts = str.split(';').map(p => p.trim());
if (!Array.isArray(parts) || parts.length !== 2) {
console.warn("Add_Reason: input must contain exactly 2 semicolon-separated parts");
return false;
}
const [tag, value] = parts;
if (!tag || !value) {
console.warn("Add_Reason: both tag and value must be non-empty");
return false;
}
const duplicate = window.semiautodata.reasons.some(r => (r && (r.tag || "").trim() === tag && (r.value || "").trim() === value));
if (duplicate) {
console.warn(`Add_Reason: reason "${tag}" with value "${value}" already exists`);
return false;
}
window.semiautodata.reasons.push({ tag, value });
return true;
},
Add_Procedure: (str) => {
if (str == null || typeof str !== 'string' || str.trim().length === 0) {
console.warn("Add_Procedure: input must be a non-empty string");
return false;
}
const parts = str.split(';').map(p => p.trim());
if (!Array.isArray(parts) || parts.length !== 2) {
console.warn("Add_Procedure: input must contain exactly 2 semicolon-separated parts");
return false;
}
const [tag, value] = parts;
if (!tag || !value) {
console.warn("Add_Procedure: both tag and value must be non-empty");
return false;
}
const duplicate = window.semiautodata.procedures.some(p => (p && (p.tag || "").trim() === tag && (p.value || "").trim() === value));
if (duplicate) {
console.warn(`Add_Procedure: procedure "${tag}" with value "${value}" already exists`);
return false;
}
window.semiautodata.procedures.push({ tag, value });
return true;
},
Add_Compensation: (str) => {
if (str == null || typeof str !== 'string' || str.trim().length === 0) {
console.warn("Add_Compensation: input must be a non-empty string");
return false;
}
const parts = str.split(';').map(p => p.trim());
if (!Array.isArray(parts) || parts.length !== 2) {
console.warn("Add_Compensation: input must contain exactly 2 semicolon-separated parts");
return false;
}
const [tag, value] = parts;
if (!tag || !value) {
console.warn("Add_Compensation: both tag and value must be non-empty");
return false;
}
const duplicate = window.semiautodata.compensation.some(c => (c && (c.tag || "").trim() === tag && (c.value || "").trim() === value));
if (duplicate) {
console.warn(`Add_Compensation: compensation "${tag}" with value "${value}" already exists`);
return false;
}
window.semiautodata.compensation.push({ tag, value });
return true;
},
Add_Greeting: (str) => {
if (str == null || typeof str !== 'string' || str.trim().length === 0) {
console.warn("Add_Greeting: input must be a non-empty string");
return false;
}
const parts = str.split(';').map(p => p.trim());
if (!Array.isArray(parts) || parts.length !== 2) {
console.warn("Add_Greeting: input must contain exactly 2 semicolon-separated parts");
return false;
}
const [tag, value] = parts;
if (!tag || !value) {
console.warn("Add_Greeting: both tag and value must be non-empty");
return false;
}
const duplicate = window.semiautodata.greetings.some(g => (g && (g.tag || "").trim() === tag && (g.value || "").trim() === value));
if (duplicate) {
console.warn(`Add_Greeting: greeting "${tag}" with value "${value}" already exists`);
return false;
}
window.semiautodata.greetings.push({ tag, value });
return true;
},
Add_BroadcastZone: (str) => {
if (str == null || typeof str !== 'string' || str.trim().length === 0) {
console.warn("Add_BroadcastZone: input must be a non-empty string");
return false;
}
const value = str.trim();
if (value.length === 0) {
console.warn("Add_BroadcastZone: value must be non-empty");
return false;
}
const duplicate = window.semiautodata.broadcastzones.some(b => (b || "").trim() === value);
if (duplicate) {
console.warn(`Add_BroadcastZone: broadcast zone "${value}" already exists`);
return false;
}
window.semiautodata.broadcastzones.push(value);
return true;
}
}
/**
* Reload the database by fetching data from the Initialize endpoint
*/
function reload_database() {
fetchAPI("Initialize", "GET", {}, null, (data) => {
//TODO data masih dalam bentuk array of string, mesti diubah ke array of object
window.semiautodata.Clear();
if (data.messages && Array.isArray(data.messages)) {
for (let msg of data.messages) window.semiautodata.Add_Message(msg);
}
if (data.airlines && Array.isArray(data.airlines)) {
for (let airline of data.airlines) window.semiautodata.Add_Airline(airline);
}
if (data.cities && Array.isArray(data.cities)) {
for (let city of data.cities) window.semiautodata.Add_City(city);
}
if (data.places && Array.isArray(data.places)) {
for (let place of data.places) window.semiautodata.Add_Place(place);
}
if (data.shalat && Array.isArray(data.shalat)) {
for (let shalat of data.shalat) window.semiautodata.Add_Shalat(shalat);
}
if (data.reasons && Array.isArray(data.reasons)) {
for (let reason of data.reasons) window.semiautodata.Add_Reason(reason);
}
if (data.procedures && Array.isArray(data.procedures)) {
for (let procedure of data.procedures) window.semiautodata.Add_Procedure(procedure);
}
if (data.compensation && Array.isArray(data.compensation)) {
for (let compensation of data.compensation) window.semiautodata.Add_Compensation(compensation);
}
if (data.greetings && Array.isArray(data.greetings)) {
for (let greeting of data.greetings) window.semiautodata.Add_Greeting(greeting);
}
if (data.broadcastzones && Array.isArray(data.broadcastzones)) {
for (let broadcastzone of data.broadcastzones) window.semiautodata.Add_BroadcastZone(broadcastzone);
}
fill_items();
}, (error) => {
console.error("Error:", error);
});
}
function empty_preview(){
$preview_arabic.empty();
$preview_chinese.empty();
$preview_english.empty();
$preview_indonesia.empty();
$preview_japanese.empty();
$preview_local.empty();
$enable_arabic.prop("checked", false);
$enable_chinese.prop("checked", false);
$enable_english.prop("checked", false);
$enable_indonesia.prop("checked", false);
$enable_japanese.prop("checked", false);
$enable_local.prop("checked", false);
}
function enable_disable_fields(){
$row_airplane.hide();
$row_city.hide();
$row_gatenumber.hide();
$row_time.hide();
$col_reason.hide();
$col_places.hide();
$col_shalat.hide();
$col_conveyorbelt.hide();
$col_procedure.hide();
$col_licenseplate.hide();
// show airplane row if English preview contains the placeholder
const text = $preview_english.text() || "";
if (text.indexOf('[CITY]') !== -1) $row_city.show();
if (text.indexOf('[AIRPLANE_NAME]') !== -1) $row_airplane.show();
if (text.indexOf('[FLIGHT_NUMBER]') !== -1) $row_airplane.show();
if (text.indexOf('[GATENUMBER]') !== -1) $row_gatenumber.show();
if (text.indexOf('[ETAD]') !== -1) $row_time.show();
if (text.indexOf('[REASON]') !== -1) $col_reason.show();
if (text.indexOf('[PLACES]') !== -1) $col_places.show();
if (text.indexOf('[SHALAT]') !== -1) $col_shalat.show();
if (text.indexOf('[BCB]') !== -1) $col_conveyorbelt.show();
if (text.indexOf('[PROCEDURE]') !== -1) $col_procedure.show();
if (text.indexOf('[PLATNOMOR]') !== -1) $col_licenseplate.show();
}
function update_preview(language){
let text = "";
let $preview = null;
if (language === "indonesia") {
$preview = $preview_indonesia;
} else if (language === "english") {
$preview = $preview_english;
} else if (language === "chinese") {
$preview = $preview_chinese;
} else if (language === "japanese") {
$preview = $preview_japanese;
} else if (language === "arabic") {
$preview = $preview_arabic;
} else if (language === "local") {
$preview = $preview_local;
}
if ($preview) {
text = $preview.text();
}
if (text.indexOf('[CITY]') !== -1) {
let cities = $select_city.val();
if (Array.isArray(cities)) {
text = text.replace(/\[CITY\]/g, cities.join(", "));
} else {
text = text.replace(/\[CITY\]/g, cities || "");
}
}
if (text.indexOf('[AIRPLANE_NAME]') !== -1) {
let airlineTag = $select_airline.val() || "";
let airlineObj = window.semiautodata.airlines.find(a => a.tag === airlineTag);
let airlineName = airlineObj ? airlineObj.value : "";
text = text.replace(/\[AIRPLANE_NAME\]/g, airlineName);
}
if (text.indexOf('[FLIGHT_NUMBER]') !== -1) {
let flightNumber = $input_flightnumber.val() || "";
text = text.replace(/\[FLIGHT_NUMBER\]/g, flightNumber);
}
if (text.indexOf('[GATENUMBER]') !== -1) {
let gateNumber = $input_gatenumber.val() || "";
text = text.replace(/\[GATENUMBER\]/g, gateNumber);
}
if (text.indexOf('[ETAD]') !== -1) {
let etad = $input_etad.val() || "";
text = text.replace(/\[ETAD\]/g, etad);
}
if (text.indexOf('[REASON]') !== -1) {
let reason = $select_reason.val() || "";
text = text.replace(/\[REASON\]/g, reason);
}
if (text.indexOf('[PLACES]') !== -1) {
let placeTag = $select_places.val() || "";
text = text.replace(/\[PLACES\]/g, placeTag);
}
if (text.indexOf('[SHALAT]') !== -1) {
let shalatTag = $select_shalat.val() || "";
text = text.replace(/\[SHALAT\]/g, shalatTag);
}
if (text.indexOf('[BCB]') !== -1) {
let bcbTag = $select_bcb.val() || "";
text = text.replace(/\[BCB\]/g, bcbTag);
}
if (text.indexOf('[PROCEDURE]') !== -1) {
let procedureTag = $select_procedure.val() || "";
text = text.replace(/\[PROCEDURE\]/g, procedureTag);
}
if (text.indexOf('[PLATNOMOR]') !== -1) {
let platNomorTag = $select_licenseplate.val() || "";
text = text.replace(/\[PLATNOMOR\]/g, platNomorTag);
}
if ($preview) {
$preview.text(text);
}
}
function update_all_previews(){
update_preview("indonesia");
update_preview("english");
update_preview("chinese");
update_preview("japanese");
update_preview("arabic");
update_preview("local");
}
function fill_items() {
$tbody_message.empty();
$tbody_broadcastzones.empty();
$select_airline.select2();
$select_city.select2();
$select_places.empty();
$select_shalat.empty();
$select_reason.empty();
$select_procedure.empty();
$select_compensation.empty();
$input_gatenumber.empty();
$input_flightnumber.empty();
$input_licenseplate.empty();
$input_conveyorbelt.empty();
$input_hours.empty();
$input_minutes.empty();
empty_preview();
if (window.semiautodata !== null) {
if (window.semiautodata.messages !== null && Array.isArray(window.semiautodata.messages) && window.semiautodata.messages.length > 0) {
for (let msg of window.semiautodata.messages) {
const txt = msg.description + " [" + msg.id + "]";
// check if tbody_message already has a row with the same text
let exists = false;
$("#tbody_message tr td").each(function () {
if ($(this).text() === txt) {
exists = true;
}
});
if (!exists) {
let $tr = $("<tr></tr>");
let $td = $("<td></td>").text(txt);
$tr.append($td);
$tbody_message.append($tr);
$tr.css("cursor", "pointer");
$tr.data("msgid", msg.id);
$tr.on("click", function (e) {
const $row = $(this);
const groupId = $row.data("msgid");
const willSelect = !$row.hasClass("table-active");
// helper to map language string to preview & checkbox
function applyLang(lang, value, checked) {
const l = (lang || "").toString().trim().toLowerCase();
if (l.startsWith("indonesia")) {
if (checked) $preview_indonesia.text(value); else $preview_indonesia.empty();
$enable_indonesia.prop("checked", !!checked);
return true;
}
if (l.startsWith("english") ) {
if (checked) $preview_english.text(value); else $preview_english.empty();
$enable_english.prop("checked", !!checked);
return true;
}
if (l.startsWith("chinese") ) {
if (checked) $preview_chinese.text(value); else $preview_chinese.empty();
$enable_chinese.prop("checked", !!checked);
return true;
}
if (l.startsWith("japanese") ) {
if (checked) $preview_japanese.text(value); else $preview_japanese.empty();
$enable_japanese.prop("checked", !!checked);
return true;
}
if (l.startsWith("arabic")) {
if (checked) $preview_arabic.text(value); else $preview_arabic.empty();
$enable_arabic.prop("checked", !!checked);
return true;
}
if (l.startsWith("local")) {
if (checked) $preview_local.text(value); else $preview_local.empty();
$enable_local.prop("checked", !!checked);
return true;
}
return false;
}
// helper to clear previews for a given group id
function clearGroupPreviews(gid) {
if (!window.semiautodata || !Array.isArray(window.semiautodata.messages)) return;
const sameMsgs = window.semiautodata.messages.filter(m => Number(m.id) === Number(gid));
for (let m of sameMsgs) {
applyLang(m.language, "", false);
}
}
if (willSelect) {
// unselect other selected rows and clear their previews
$tbody_message.find("tr.table-active").each(function () {
if (this === e.currentTarget) return;
const $other = $(this);
const otherId = $other.data("msgid");
$other.removeClass("table-active");
clearGroupPreviews(otherId);
});
// select this row and apply its messages to previews
$row.addClass("table-active");
if (window.semiautodata && Array.isArray(window.semiautodata.messages)) {
const sameMsgs = window.semiautodata.messages.filter(m => Number(m.id) === Number(groupId));
for (let m of sameMsgs) {
applyLang(m.language, m.message_details, true);
}
enable_disable_fields();
}
} else {
// deselect this row and clear its previews
$row.removeClass("table-active");
clearGroupPreviews(groupId);
}
});
}
}
}
if (window.semiautodata.broadcastzones !== null && Array.isArray(window.semiautodata.broadcastzones) && window.semiautodata.broadcastzones.length > 0) {
for (let zone of window.semiautodata.broadcastzones) {
{
const uid = 'bz_' + Math.random().toString(36).slice(2, 9);
let $tr = $("<tr></tr>");
let $checkbox = $("<input>").attr({ type: "checkbox", id: uid, value: zone });
let $label = $("<label></label>").attr("for", uid).text(zone);
let $td = $("<td></td>").append($checkbox).append(" ").append($label);
$tr.append($td);
$tbody_broadcastzones.append($tr);
}
}
}
if (window.semiautodata.airlines !== null && Array.isArray(window.semiautodata.airlines) && window.semiautodata.airlines.length > 0) {
const airlinedata = window.semiautodata.airlines.map(a => ({ id: a.tag, text: a.value + " [" + a.tag + "]" }));
$select_airline.select2({
data: airlinedata,
placeholder: "Select an airline",
width: '100%',
multiple: false
});
$select_airline.val(null).trigger("change");
$select_airline.on('change', function () {
update_all_previews();
});
}
if (window.semiautodata.cities !== null && Array.isArray(window.semiautodata.cities) && window.semiautodata.cities.length > 0) {
const citydata = window.semiautodata.cities.map(c => ({ id: c.tag, text: c.value + " [" + c.tag + "]" }));
$select_city.select2({
data: citydata,
placeholder: "Select a city",
width: '100%',
multiple: true
});
// disable sorting on select2 selection
$select_city.on('select2:select', function (e) {
let element = e.params.data.element;
$(this).append(element); // move selected item to the end
$(this).trigger('change'); // refresh select2 display
});
$select_city.val(null).trigger("change");
$select_city.on('change', function () {
update_all_previews();
});
}
if (window.semiautodata.places !== null && Array.isArray(window.semiautodata.places) && window.semiautodata.places.length > 0) {
$select_places.select2({
placeholder: "Select a place",
width: '100%',
multiple: false,
data: window.semiautodata.places.map(p => ({ id: p.tag, text: p.value }))
});
$select_places.val(null).trigger("change");
$select_places.on('change', function () {
update_all_previews();
});
}
if (window.semiautodata.shalat !== null && Array.isArray(window.semiautodata.shalat) && window.semiautodata.shalat.length > 0) {
$select_shalat.select2({
placeholder: "Select shalat time",
width: '100%',
multiple: false,
data: window.semiautodata.shalat.map(s => ({ id: s.tag, text: s.value }))
});
$select_shalat.val(null).trigger("change");
}
if (window.semiautodata.reasons !== null && Array.isArray(window.semiautodata.reasons) && window.semiautodata.reasons.length > 0) {
$select_reason.select2({
placeholder: "Select a reason",
width: '100%',
multiple: false,
data: window.semiautodata.reasons.map(r => ({ id: r.tag, text: r.value }))
});
$select_reason.val(null).trigger("change");
$select_reason.on('change', function () {
update_all_previews();
});
}
if (window.semiautodata.compensation !== null && Array.isArray(window.semiautodata.compensation) && window.semiautodata.compensation.length > 0) {
$select_compensation.select2({
placeholder: "Select compensation",
width: '100%',
multiple: false,
data: window.semiautodata.compensation.map(c => ({ id: c.tag, text: c.value }))
});
$select_compensation.val(null).trigger("change");
$select_compensation.on('change', function () {
update_all_previews();
});
}
if (window.semiautodata.procedures !== null && Array.isArray(window.semiautodata.procedures) && window.semiautodata.procedures.length > 0) {
$select_procedure.select2({
placeholder: "Select procedure",
width: '100%',
multiple: false,
data: window.semiautodata.procedures.map(p => ({ id: p.tag, text: p.value }))
});
$select_procedure.val(null).trigger("change");
$select_procedure.on('change', function () {
update_all_previews();
});
}
$input_conveyorbelt.on('input', function () {
update_all_previews();
});
$input_gatenumber.on('input', function () {
update_all_previews();
});
$input_flightnumber.on('input', function () {
update_all_previews();
});
$input_licenseplate.on('input', function () {
update_all_previews();
});
}
}
// App start here
$(document).ready(function () {
console.log("javascript loaded");
$preview_indonesia = $("#message_indonesia");
$preview_english = $("#message_english");
$preview_chinese = $("#message_chinese");
$preview_japanese = $("#message_japanese");
$preview_arabic = $("#message_arabic");
$preview_local = $("#message_local");
$enable_indonesia = $("#checkbox_indonesia");
$enable_english = $("#checkbox_english");
$enable_chinese = $("#checkbox_chinese");
$enable_japanese = $("#checkbox_japanese");
$enable_arabic = $("#checkbox_arabic");
$enable_local = $("#checkbox_local");
$tbody_message = $("#tbody_message");
$tbody_broadcastzones = $("#tbody_broadcastzones");
$select_airline = $("#select_airline");
$select_city = $("#select_city");
$select_places = $("#select_places");
$select_shalat = $("#select_shalat");
$select_reason = $("#select_reason");
$select_procedure = $("#select_procedure");
$select_compensation = $("#select_compensation");
$input_gatenumber = $("#input_gatenumber");
$input_flightnumber = $("#input_flightnumber");
$input_licenseplate = $("#input_licenseplate");
$input_conveyorbelt = $("#input_conveyorbelt");
$input_hours = $("#input_hours");
$input_minutes = $("#input_minutes");
$row_airplane = $("#row_airplane");
$row_city = $("#row_city");
$row_gatenumber = $("#row_gatenumber");
$row_time = $("#row_time");
$col_reason = $("#col_reason");
$col_places = $("#col_places");
$col_shalat = $("#col_shalat");
$col_conveyorbelt = $("#col_conveyorbelt");
$col_procedure = $("#col_procedure");
$col_licenseplate = $("#col_licenseplate");
reload_database();
$("#reload_database").off("click").on("click", function () {
reload_database();
});
}); });

File diff suppressed because one or more lines are too long

View File

@@ -17,16 +17,15 @@
<link rel="stylesheet" href="assets/css/FontAwesome.css"> <link rel="stylesheet" href="assets/css/FontAwesome.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Inter&amp;display=swap"> <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Inter&amp;display=swap">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Poppins:100,200,200i,300,400,600&amp;subset=latin-ext&amp;display=swap"> <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Poppins:100,200,200i,300,400,600&amp;subset=latin-ext&amp;display=swap">
<link rel="stylesheet" href="assets/fonts/fontawesome-all.min.css">
<link rel="stylesheet" href="assets/css/bss-overrides.css"> <link rel="stylesheet" href="assets/css/bss-overrides.css">
<link rel="stylesheet" href="assets/css/all.min.css"> <link rel="stylesheet" href="assets/css/all.min.css">
<link rel="stylesheet" href="https://cdn.datatables.net/2.3.4/css/dataTables.bootstrap5.css"> <link rel="stylesheet" href="assets/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.3.3/css/bootstrap.min.css"> <link rel="stylesheet" href="assets/css/select2.min.css">
<link rel="stylesheet" href="assets/css/style.css"> <link rel="stylesheet" href="assets/css/style.css">
</head> </head>
<body class="bg-body" style="font-family: Poppins, sans-serif;"> <body class="bg-body" style="font-family: Poppins, sans-serif;">
<nav class="navbar navbar-expand-lg fixed-top navbar-shrink navbar-bg" id="mainNav"> <nav class="navbar navbar-expand-lg fixed-top bg-gradient navbar-shrink navbar-bg" id="mainNav">
<div class="container-fluid container-fluid"><a class="navbar-brand d-flex align-items-center" href="/"><span class="text-white h4 pad-nav" style="font-family: Raleway, sans-serif;"><strong>Semi Automatic for AAS</strong></span></a><button data-bs-toggle="collapse" class="navbar-toggler text-bg-light pad-toggler" data-bs-target="#navcol-1"><span class="visually-hidden">Toggle navigation</span><span class="navbar-toggler-icon"></span></button> <div class="container-fluid container-fluid"><a class="navbar-brand d-flex align-items-center" href="/"><span class="text-white h4 pad-nav" style="font-family: Raleway, sans-serif;"><strong>Semi Automatic for AAS</strong></span></a><button data-bs-toggle="collapse" class="navbar-toggler text-bg-light pad-toggler" data-bs-target="#navcol-1"><span class="visually-hidden">Toggle navigation</span><span class="navbar-toggler-icon"></span></button>
<div class="collapse navbar-collapse" id="navcol-1"> <div class="collapse navbar-collapse" id="navcol-1">
<ul class="navbar-nav mx-auto"> <ul class="navbar-nav mx-auto">
@@ -45,7 +44,7 @@
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<div class="col-12 col-sm-12 col-md-12 col-lg-4 col-xl-4 col-xxl-4 border-right" id="listofmessage"> <div class="col-12 col-sm-12 col-md-12 col-lg-4 col-xl-4 col-xxl-4 border-right" id="listofmessage">
<div class="card card-border scroll"> <div class="card card-border scroll pad-left">
<div class="card-body"> <div class="card-body">
<div class="table-responsive table-message table-hover table"> <div class="table-responsive table-message table-hover table">
<table class="table table-hover" id="table_message"> <table class="table table-hover" id="table_message">
@@ -70,13 +69,7 @@
</div> </div>
</div> </div>
<div class="col-11 col-sm-12 col-md-12 col-lg-8 col-xl-8 col-xxl-8 scroll"> <div class="col-11 col-sm-12 col-md-12 col-lg-8 col-xl-8 col-xxl-8 scroll">
<div class="row py-1 pad-right"> <div class="card border-0">
<div class="col-3 col-sm-3 col-md-3 col-lg-3 col-xl-3 con-center" style="font-family: Poppins, sans-serif;"><label class="col-form-label"><strong>AAS IP Address</strong></label></div>
<div class="col-4 col-sm-3 col-md-3 col-lg-3 col-xl-3"><input type="text" id="input_ip" class="form-control pad-input"></div>
<div class="col-4 col-sm-3 col-md-3 col-lg-3 col-xl-3"><button class="btn btn-primary w-100 pad-input" id="save_ip" type="button" style="font-family: Raleway, sans-serif;"><i class="far fa-save"></i>&nbsp; Save</button></div>
<div class="col-1 col-sm-3 col-md-3 col-lg-3 text-end align-self-start" id="status_semiauto"><img id="onlineindicator" class="img-indicator" src="assets/img/red_circle.svg" width="24" height="24"></div>
</div>
<div class="card pad-card">
<div class="card-header header-broadcast header-bg" style="font-family: Poppins, sans-serif;"> <div class="card-header header-broadcast header-bg" style="font-family: Poppins, sans-serif;">
<div class="row py-1"> <div class="row py-1">
<div class="col-8 col-sm-9 col-md-9 col-lg-9 col-xl-9"> <div class="col-8 col-sm-9 col-md-9 col-lg-9 col-xl-9">
@@ -88,157 +81,96 @@
</div> </div>
</div> </div>
<div class="card-body div-broadcast"> <div class="card-body div-broadcast">
<div class="row"> <div class="table-responsive table-message table">
<div class="col-6 col-sm-4 col-md-4 col-lg-4 col-xl-4"> <table class="table table-hover" id="table_message">
<div class="form-check"><input class="form-check-input" type="checkbox" id="formCheck-16"><label class="form-check-label" for="formCheck-16">Domestic Arrival</label></div> <thead>
</div> <tr></tr>
<div class="col-6 col-sm-4 col-md-4 col-lg-4 col-xl-4"> </thead>
<div class="form-check"><input class="form-check-input" type="checkbox" id="formCheck-17"><label class="form-check-label" for="formCheck-17">Domestic Arrival</label></div> <tbody id="tbody_broadcastzones">
</div> <tr>
<div class="col-6 col-sm-4 col-md-4 col-lg-4 col-xl-4"> <td>
<div class="form-check" style="font-family: Raleway, sans-serif;"><input class="form-check-input" type="checkbox" id="formCheck-18"><label class="form-check-label" for="formCheck-18">International Arrival</label></div> <div class="form-check"><input class="form-check-input" type="checkbox" id="formCheck-16"><label class="form-check-label" for="formCheck-16">Domestic Arrival</label></div>
</div> </td>
</tr>
</tbody>
</table>
</div> </div>
</div> </div>
</div> </div>
<div class="row mt-2 py-3"> <div class="row mt-2 py-3">
<div class="col"><label class="form-label pad-flight"><strong>&nbsp;Flight Information</strong></label> <div class="col"><label class="form-label pad-flight"><strong>&nbsp;Flight Information</strong></label>
<hr> <hr>
<div class="row"> <div class="row" id="row_airplane">
<div class="col-12 col-sm-12 col-md-4 col-lg-4 col-xl-4 pad-row-input"> <div class="col-7 pad-row-input">
<div class="row"> <div class="row">
<div class="col-4 col-sm-4 col-md-4 col-lg-4 col-xl-4"><label class="col-form-label">Airline</label></div> <div class="col-3"><label class="col-form-label">Airline</label></div>
<div class="col-4 col-sm-4 col-md-4 col-lg-4 col-xl-3 pad-input-left"><input type="text" id="input_airline" class="form-control pad-input"></div> <div class="col-8 pad-select"><select id="select_airline" class="form-select pad-input" name="airline"></select></div>
<div class="col-4 col-sm-4 col-md-4 col-lg-4 col-xl-5 pad-select"><select id="select_airline" class="form-select pad-input"></select></div>
</div> </div>
</div> </div>
<div class="col-12 col-sm-12 col-md-4 col-lg-4 col-xl-4 pad-row-input"> <div class="col-5 pad-row-input">
<div class="row"> <div class="row">
<div class="col-4 col-sm-4 col-md-8 col-lg-8 col-xl-7"><label class="col-form-label">Flight Number</label></div> <div class="col-5"><label class="col-form-label">Flight Number</label></div>
<div class="col-8 col-sm-8 col-md-4 col-lg-4 col-xl-5 pad-select"><input type="text" id="input_flightnumber" class="form-control pad-input"></div> <div class="col-7 pad-select"><input type="text" id="input_flightnumber" class="form-control pad-input"></div>
</div> </div>
</div> </div>
<div class="col-12 col-sm-12 col-md-4 col-lg-4 col-xl-4 pad-row-input"> </div>
<div class="row" id="row_city">
<div class="col-4 col-sm-4 col-md-3 col-lg-3 col-xl-2 pad-row-input"><label class="col-form-label">City</label></div>
<div class="col-8 col-sm-8 col-md-9 col-lg-9 col-xl-10 pad-select pad-row-input"><select id="select_city" class="pad-input form-select" name="cities[]" multiple="multiple"></select></div>
</div>
<div class="row" id="row_gatenumber">
<div class="col-4 col-sm-4 col-md-3 col-lg-3 col-xl-2 pad-row-input"><label class="col-form-label">Gate Number</label></div>
<div class="col-8 col-sm-8 col-md-9 col-lg-9 col-xl-10 pad-input-left pad-row-input"><input type="text" id="input_gatenumber" class="pad-input form-control" placeholder="gate number"></div>
</div>
<div class="row" id="row_time">
<div class="col-12 col-sm-12 col-md-6 col-lg-6 col-xl-6 pad-row-input">
<div class="row"> <div class="row">
<div class="col-4 col-sm-4 col-md-8 col-lg-8 col-xl-7"><label class="col-form-label">License Plate</label></div> <div class="col-4 col-sm-4 col-md-6 col-lg-6 col-xl-4"><label class="col-form-label">Hours</label></div>
<div class="col-8 col-sm-8 col-md-4 col-lg-4 col-xl-5 pad-select"><input class="w-100 form-control pad-input" type="text" id="input_licenseplate"></div> <div class="col-8 col-sm-8 col-md-6 col-lg-6 col-xl-8 pad-select"><input type="number" id="input_hours" class="form-control pad-input" value="0" min="0" max="23" step="1" placeholder="hour"></div>
</div>
</div>
<div class="col-12 col-sm-12 col-md-6 col-lg-6 col-xl-6 pad-row-input">
<div class="row">
<div class="col-4 col-sm-4 col-md-6 col-lg-6 col-xl-4"><label class="col-form-label">Minutes</label></div>
<div class="col-8 col-sm-8 col-md-6 col-lg-6 col-xl-8 pad-select"><input type="number" id="input_minutes" class="form-control pad-input" value="0" min="0" max="59" step="1" placeholder="minute"></div>
</div> </div>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-12 col-sm-12 col-md-4 col-lg-4 col-xl-4 pad-row-input"> <div class="col-12 col-sm-12 col-md-6 col-lg-6 col-xl-6 pad-row-input" id="col_reason">
<div class="row"> <div class="row">
<div class="col-4 col-sm-4 col-md-4 col-lg-4 col-xl-4"><label class="col-form-label">City 1</label></div> <div class="col-4 col-sm-4 col-md-6 col-lg-6 col-xl-4"><label class="col-form-label">Reason</label></div>
<div class="col-4 col-sm-4 col-md-4 col-lg-4 col-xl-3 pad-input-left"><input type="text" id="input_city1" class="form-control pad-input"></div> <div class="col-8 col-sm-8 col-md-6 col-lg-6 col-xl-8 pad-select"><select id="select_reason" class="form-select pad-input"></select></div>
<div class="col-4 col-sm-4 col-md-4 col-lg-4 col-xl-5 pad-select"><select id="select_city1" class="form-select pad-input"></select></div>
</div> </div>
</div> </div>
<div class="col-12 col-sm-12 col-md-4 col-lg-4 col-xl-4 pad-row-input"> <div class="col-12 col-sm-12 col-md-6 col-lg-6 col-xl-6 pad-row-input" id="col_places">
<div class="row"> <div class="row">
<div class="col-4 col-sm-4 col-md-4 col-lg-4 col-xl-4"><label class="col-form-label">City 2</label></div> <div class="col-4 col-sm-4 col-md-6 col-lg-6 col-xl-4"><label class="col-form-label">Places</label></div>
<div class="col-4 col-sm-4 col-md-4 col-lg-4 col-xl-3 pad-input-left"><input type="text" id="input_city2" class="form-control pad-input"></div> <div class="col-8 col-sm-8 col-md-6 col-lg-6 col-xl-8 pad-select"><select id="select_places" class="form-select pad-input"></select></div>
<div class="col-4 col-sm-4 col-md-4 col-lg-4 col-xl-5 pad-select"><select id="select_city2" class="form-select pad-input"></select></div>
</div> </div>
</div> </div>
<div class="col-12 col-sm-12 col-md-4 col-lg-4 col-xl-4 pad-row-input"> <div class="col-12 col-sm-12 col-md-6 col-lg-6 col-xl-6 pad-row-input" id="col_shalat">
<div class="row"> <div class="row">
<div class="col-4 col-sm-4 col-md-4 col-lg-4 col-xl-4"><label class="col-form-label">City 3</label></div> <div class="col-4 col-sm-4 col-md-6 col-lg-6 col-xl-4"><label class="col-form-label">Shalat</label></div>
<div class="col-4 col-sm-4 col-md-4 col-lg-4 col-xl-3 pad-input-left"><input type="text" id="input_city3" class="form-control pad-input"></div> <div class="col-8 col-sm-8 col-md-6 col-lg-6 col-xl-8 pad-select"><select id="select_shalat" class="form-select pad-input"></select></div>
<div class="col-4 col-sm-4 col-md-4 col-lg-4 col-xl-5 pad-select"><select id="select_city3" class="form-select pad-input"></select></div>
</div> </div>
</div> </div>
<div class="col-12 col-sm-12 col-md-4 col-lg-4 col-xl-4 pad-row-input"> <div class="col-12 col-sm-12 col-md-6 col-lg-6 col-xl-6 pad-row-input" id="col_conveyorbelt">
<div class="row"> <div class="row">
<div class="col-4 col-sm-4 col-md-4 col-lg-4 col-xl-4"><label class="col-form-label">City 4</label></div> <div class="col-4 col-sm-4 col-md-6 col-lg-6 col-xl-4"><label class="col-form-label">Conveyor Belt</label></div>
<div class="col-4 col-sm-4 col-md-4 col-lg-4 col-xl-3 pad-input-left"><input type="text" id="input_city4" class="form-control pad-input"></div> <div class="col-8 col-sm-8 col-md-6 col-lg-6 col-xl-8 pad-select"><input class="w-100 form-control pad-input" type="text" id="input_conveyorbelt" placeholder="conveyor belt"></div>
<div class="col-4 col-sm-4 col-md-4 col-lg-4 col-xl-5 pad-select"><select id="select_city4" class="form-select pad-input"></select></div>
</div> </div>
</div> </div>
<div class="col-12 col-sm-12 col-md-4 col-lg-4 col-xl-4 pad-row-input"> <div class="col-12 col-sm-12 col-md-6 col-lg-6 col-xl-6 pad-row-input" id="col_procedure">
<div class="row"> <div class="row">
<div class="col-4 col-sm-4 col-md-4 col-lg-4 col-xl-4"><label class="col-form-label">City 5</label></div> <div class="col-4 col-sm-4 col-md-6 col-lg-6 col-xl-4"><label class="col-form-label">Procedure</label></div>
<div class="col-4 col-sm-4 col-md-4 col-lg-4 col-xl-3 pad-input-left"><input type="text" id="input_city5" class="form-control pad-input"></div> <div class="col-8 col-sm-8 col-md-6 col-lg-6 col-xl-8 pad-select"><select id="select_procedure" class="form-select pad-input"></select></div>
<div class="col-4 col-sm-4 col-md-4 col-lg-4 col-xl-5 pad-select"><select id="select_city5" class="form-select pad-input"></select></div>
</div> </div>
</div> </div>
<div class="col-12 col-sm-12 col-md-4 col-lg-4 col-xl-4 pad-row-input"> <div class="col-12 col-sm-12 col-md-6 col-lg-6 col-xl-6 pad-row-input" id="col_licenseplate">
<div class="row"> <div class="row">
<div class="col-4 col-sm-4 col-md-4 col-lg-4 col-xl-4"><label class="col-form-label">City 6</label></div> <div class="col-4 col-sm-4 col-md-6 col-lg-6 col-xl-4"><label class="col-form-label">License Plate</label></div>
<div class="col-4 col-sm-4 col-md-4 col-lg-4 col-xl-3 pad-input-left"><input type="text" id="input_city6" class="form-control pad-input"></div> <div class="col-8 col-sm-8 col-md-6 col-lg-6 col-xl-8 pad-select"><input class="w-100 form-control pad-input" type="text" id="input_licenseplate" placeholder="license plate"></div>
<div class="col-4 col-sm-4 col-md-4 col-lg-4 col-xl-5 pad-select"><select id="select_city6" class="form-select pad-input"></select></div>
</div>
</div>
<div class="col-12 col-sm-12 col-md-4 col-lg-4 col-xl-4 pad-row-input">
<div class="row">
<div class="col-4 col-sm-4 col-md-4 col-lg-4 col-xl-4"><label class="col-form-label">City 7</label></div>
<div class="col-4 col-sm-4 col-md-4 col-lg-4 col-xl-3 pad-input-left"><input type="text" id="input_city7" class="form-control pad-input"></div>
<div class="col-4 col-sm-4 col-md-4 col-lg-4 col-xl-5 pad-select"><select id="select_city7" class="form-select pad-input"></select></div>
</div>
</div>
<div class="col-12 col-sm-12 col-md-4 col-lg-4 col-xl-4 pad-row-input">
<div class="row">
<div class="col-4 col-sm-4 col-md-4 col-lg-4 col-xl-4"><label class="col-form-label">City 8</label></div>
<div class="col-4 col-sm-4 col-md-4 col-lg-4 col-xl-3 pad-input-left"><input type="text" id="input_city8" class="form-control pad-input"></div>
<div class="col-4 col-sm-4 col-md-4 col-lg-4 col-xl-5 pad-select"><select id="select_city8" class="form-select pad-input"></select></div>
</div>
</div>
<div class="col-12 col-sm-12 col-md-4 col-lg-4 col-xl-4 pad-row-input">
<div class="row">
<div class="col-4 col-sm-4 col-md-4 col-lg-4 col-xl-4"><label class="col-form-label">City 9</label></div>
<div class="col-4 col-sm-4 col-md-4 col-lg-4 col-xl-3 pad-input-left"><input type="text" id="input_city9" class="form-control pad-input"></div>
<div class="col-4 col-sm-4 col-md-4 col-lg-4 col-xl-5 pad-select"><select id="select_city9" class="form-select pad-input"></select></div>
</div>
</div>
</div>
<div class="row">
<div class="col-12 col-sm-12 col-md-4 col-lg-4 col-xl-4 pad-row-input">
<div class="row">
<div class="col-4 col-sm-4 col-md-8 col-lg-8 col-xl-7"><label class="col-form-label">Places</label></div>
<div class="col-8 col-sm-8 col-md-4 col-lg-4 col-xl-5 pad-select"><select id="select_places" class="form-select pad-input"></select></div>
</div>
</div>
<div class="col-12 col-sm-12 col-md-4 col-lg-4 col-xl-4 pad-row-input">
<div class="row">
<div class="col-4 col-sm-4 col-md-8 col-lg-8 col-xl-7"><label class="col-form-label">Shalat</label></div>
<div class="col-8 col-sm-8 col-md-4 col-lg-4 col-xl-5 pad-select"><select id="select_shalat" class="form-select pad-input"></select></div>
</div>
</div>
<div class="col-12 col-sm-12 col-md-4 col-lg-4 col-xl-4 pad-row-input">
<div class="row">
<div class="col-4 col-sm-4 col-md-8 col-lg-8 col-xl-7"><label class="col-form-label">Reason</label></div>
<div class="col-8 col-sm-8 col-md-4 col-lg-4 col-xl-5 pad-select"><select id="select_reason" class="form-select pad-input"></select></div>
</div>
</div>
<div class="col-12 col-sm-12 col-md-4 col-lg-4 col-xl-4 pad-row-input">
<div class="row">
<div class="col-4 col-sm-4 col-md-8 col-lg-8 col-xl-7"><label class="col-form-label">Gate Number</label></div>
<div class="col-8 col-sm-8 col-md-4 col-lg-4 col-xl-5 pad-select"><select id="select_gatenumber" class="form-select pad-input"></select></div>
</div>
</div>
<div class="col-12 col-sm-12 col-md-4 col-lg-4 col-xl-4 pad-row-input">
<div class="row">
<div class="col-4 col-sm-4 col-md-8 col-lg-8 col-xl-7"><label class="col-form-label">Conveyor Belt</label></div>
<div class="col-8 col-sm-8 col-md-4 col-lg-4 col-xl-5 pad-select"><select id="select_conveyorbelt" class="form-select pad-input"></select></div>
</div>
</div>
<div class="col-12 col-sm-12 col-md-4 col-lg-4 col-xl-4 pad-row-input">
<div class="row">
<div class="col-4 col-sm-4 col-md-8 col-lg-8 col-xl-7"><label class="col-form-label">Procedure</label></div>
<div class="col-8 col-sm-8 col-md-4 col-lg-4 col-xl-5 pad-select"><select id="select_procedure" class="form-select pad-input"></select></div>
</div>
</div>
</div>
<div class="row">
<div class="col-12 col-sm-12 col-md-4 col-lg-4 col-xl-4 pad-row-input">
<div class="row">
<div class="col-4 col-sm-4 col-md-8 col-lg-8 col-xl-7"><label class="col-form-label">Hours</label></div>
<div class="col-8 col-sm-8 col-md-4 col-lg-4 col-xl-5 pad-select"><input type="text" id="input_hours" class="form-control pad-input"></div>
</div>
</div>
<div class="col-12 col-sm-12 col-md-4 col-lg-4 col-xl-4 pad-row-input">
<div class="row">
<div class="col-4 col-sm-4 col-md-8 col-lg-8 col-xl-7"><label class="col-form-label">Minutes</label></div>
<div class="col-8 col-sm-8 col-md-4 col-lg-4 col-xl-5 pad-select"><input type="text" id="input_minutes" class="form-control pad-input"></div>
</div> </div>
</div> </div>
</div> </div>
@@ -319,10 +251,9 @@
<script src="assets/bootstrap/js/bootstrap.min.js"></script> <script src="assets/bootstrap/js/bootstrap.min.js"></script>
<script src="assets/js/bs-init.js"></script> <script src="assets/js/bs-init.js"></script>
<script src="assets/js/custom.js"></script> <script src="assets/js/custom.js"></script>
<script src="https://cdn.datatables.net/2.3.4/js/dataTables.bootstrap5.js"></script> <script src="assets/js/bootstrap.bundle.min.js"></script>
<script src="https://cdn.datatables.net/2.3.4/js/dataTables.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.3.3/js/bootstrap.bundle.min.js" type="module"></script>
<script src="assets/js/jquery-3.7.1.min.js"></script> <script src="assets/js/jquery-3.7.1.min.js"></script>
<script src="assets/js/select2.min.js"></script>
</body> </body>
</html> </html>

View File

@@ -19,13 +19,13 @@
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Poppins:100,200,200i,300,400,600&amp;subset=latin-ext&amp;display=swap"> <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Poppins:100,200,200i,300,400,600&amp;subset=latin-ext&amp;display=swap">
<link rel="stylesheet" href="assets/css/bss-overrides.css"> <link rel="stylesheet" href="assets/css/bss-overrides.css">
<link rel="stylesheet" href="assets/css/all.min.css"> <link rel="stylesheet" href="assets/css/all.min.css">
<link rel="stylesheet" href="https://cdn.datatables.net/2.3.4/css/dataTables.bootstrap5.css"> <link rel="stylesheet" href="assets/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.3.3/css/bootstrap.min.css"> <link rel="stylesheet" href="assets/css/select2.min.css">
<link rel="stylesheet" href="assets/css/style.css"> <link rel="stylesheet" href="assets/css/style.css">
</head> </head>
<body class="fw-light fst-normal" style="font-family: Poppins, sans-serif;"> <body class="fw-light fst-normal" style="font-family: Poppins, sans-serif;">
<nav class="navbar navbar-expand-lg fixed-top navbar-shrink navbar-bg" id="mainNav"> <nav class="navbar navbar-expand-lg fixed-top bg-gradient navbar-shrink navbar-bg" id="mainNav">
<div class="container-fluid container-fluid"><a class="navbar-brand d-flex align-items-center" href="/"><span class="text-white h4 pad-nav" style="font-family: Raleway, sans-serif;"><strong>Semi Automatic for AAS</strong></span></a><button data-bs-toggle="collapse" class="navbar-toggler text-bg-light pad-toggler" data-bs-target="#navcol-1"><span class="visually-hidden">Toggle navigation</span><span class="navbar-toggler-icon"></span></button> <div class="container-fluid container-fluid"><a class="navbar-brand d-flex align-items-center" href="/"><span class="text-white h4 pad-nav" style="font-family: Raleway, sans-serif;"><strong>Semi Automatic for AAS</strong></span></a><button data-bs-toggle="collapse" class="navbar-toggler text-bg-light pad-toggler" data-bs-target="#navcol-1"><span class="visually-hidden">Toggle navigation</span><span class="navbar-toggler-icon"></span></button>
<div class="collapse navbar-collapse" id="navcol-1"> <div class="collapse navbar-collapse" id="navcol-1">
<ul class="navbar-nav mx-auto"> <ul class="navbar-nav mx-auto">
@@ -100,10 +100,9 @@
<script src="assets/bootstrap/js/bootstrap.min.js"></script> <script src="assets/bootstrap/js/bootstrap.min.js"></script>
<script src="assets/js/bs-init.js"></script> <script src="assets/js/bs-init.js"></script>
<script src="assets/js/custom.js"></script> <script src="assets/js/custom.js"></script>
<script src="https://cdn.datatables.net/2.3.4/js/dataTables.bootstrap5.js"></script> <script src="assets/js/bootstrap.bundle.min.js"></script>
<script src="https://cdn.datatables.net/2.3.4/js/dataTables.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.3.3/js/bootstrap.bundle.min.js" type="module"></script>
<script src="assets/js/jquery-3.7.1.min.js"></script> <script src="assets/js/jquery-3.7.1.min.js"></script>
<script src="assets/js/select2.min.js"></script>
</body> </body>
</html> </html>

View File

@@ -19,8 +19,8 @@
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Poppins:100,200,200i,300,400,600&amp;subset=latin-ext&amp;display=swap"> <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Poppins:100,200,200i,300,400,600&amp;subset=latin-ext&amp;display=swap">
<link rel="stylesheet" href="assets/css/bss-overrides.css"> <link rel="stylesheet" href="assets/css/bss-overrides.css">
<link rel="stylesheet" href="assets/css/all.min.css"> <link rel="stylesheet" href="assets/css/all.min.css">
<link rel="stylesheet" href="https://cdn.datatables.net/2.3.4/css/dataTables.bootstrap5.css"> <link rel="stylesheet" href="assets/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.3.3/css/bootstrap.min.css"> <link rel="stylesheet" href="assets/css/select2.min.css">
<link rel="stylesheet" href="assets/css/style.css"> <link rel="stylesheet" href="assets/css/style.css">
</head> </head>
@@ -62,10 +62,9 @@
<script src="assets/bootstrap/js/bootstrap.min.js"></script> <script src="assets/bootstrap/js/bootstrap.min.js"></script>
<script src="assets/js/bs-init.js"></script> <script src="assets/js/bs-init.js"></script>
<script src="assets/js/custom.js"></script> <script src="assets/js/custom.js"></script>
<script src="https://cdn.datatables.net/2.3.4/js/dataTables.bootstrap5.js"></script> <script src="assets/js/bootstrap.bundle.min.js"></script>
<script src="https://cdn.datatables.net/2.3.4/js/dataTables.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/5.3.3/js/bootstrap.bundle.min.js" type="module"></script>
<script src="assets/js/jquery-3.7.1.min.js"></script> <script src="assets/js/jquery-3.7.1.min.js"></script>
<script src="assets/js/select2.min.js"></script>
</body> </body>
</html> </html>

View File

@@ -33,7 +33,7 @@ lateinit var audioPlayer: AudioPlayer
val StreamerOutputs: MutableMap<String, BarixConnection> = HashMap() val StreamerOutputs: MutableMap<String, BarixConnection> = HashMap()
lateinit var udpreceiver: UDPReceiver lateinit var udpreceiver: UDPReceiver
lateinit var tcpreceiver: TCPReceiver lateinit var tcpreceiver: TCPReceiver
const val version = "0.0.13 (30/10/2025)" const val version = "0.0.14 (04/11/2025)"
// AAS 64 channels // AAS 64 channels
const val max_channel = 64 const val max_channel = 64

View File

@@ -481,6 +481,10 @@ class Somecodes {
return Files.exists(value) && Files.isDirectory(value) return Files.exists(value) && Files.isDirectory(value)
} }
fun String_To_List(str: String, separator: String = ";") : MutableList<String>{
return str.split(separator).map { it.trim() }.filter { it.isNotEmpty() }.toMutableList()
}
/** /**
* Check if a string is a valid date in the format "dd/MM/yyyy". * Check if a string is a valid date in the format "dd/MM/yyyy".
* @param value The string to check. * @param value The string to check.
@@ -647,6 +651,50 @@ class Somecodes {
String.format("%02d:%02d:%02d", hours, minutes, seconds) String.format("%02d:%02d:%02d", hours, minutes, seconds)
} else "" } else ""
} }
fun Generate_WAV_Header() : ByteArray {
val sampleRate = 44100
val bitsPerSample = 16
val channels = 1
val byteRate = sampleRate * channels * (bitsPerSample / 8)
val blockAlign = channels * (bitsPerSample / 8)
val subchunk2Size = 0 // unknown / placeholder
val chunkSize = 36 + subchunk2Size
val header = ByteArray(44)
fun writeIntLE(offset: Int, value: Int) {
header[offset] = (value and 0xFF).toByte()
header[offset + 1] = ((value shr 8) and 0xFF).toByte()
header[offset + 2] = ((value shr 16) and 0xFF).toByte()
header[offset + 3] = ((value shr 24) and 0xFF).toByte()
}
fun writeShortLE(offset: Int, value: Int) {
header[offset] = (value and 0xFF).toByte()
header[offset + 1] = ((value shr 8) and 0xFF).toByte()
}
// RIFF chunk descriptor
System.arraycopy("RIFF".toByteArray(), 0, header, 0, 4)
writeIntLE(4, chunkSize)
System.arraycopy("WAVE".toByteArray(), 0, header, 8, 4)
// fmt subchunk
System.arraycopy("fmt ".toByteArray(), 0, header, 12, 4)
writeIntLE(16, 16) // Subchunk1Size for PCM
writeShortLE(20, 1) // AudioFormat = 1 (PCM)
writeShortLE(22, channels)
writeIntLE(24, sampleRate)
writeIntLE(28, byteRate)
writeShortLE(32, blockAlign)
writeShortLE(34, bitsPerSample)
// data subchunk
System.arraycopy("data".toByteArray(), 0, header, 36, 4)
writeIntLE(40, subchunk2Size)
return header
}
} }

View File

@@ -0,0 +1,29 @@
package web
class SemiAutoInitData(val username: String) {
// equal to "MSG" in android command
var messages = mutableListOf<String>()
// equal to "VARAP" in android command
var airlines = mutableListOf<String>()
// equal to "VARCITY" in android command
var cities = mutableListOf<String>()
// equal to "VARPLACES" in android command
var places = mutableListOf<String>()
// equal to "VARSHALAT" in android command
var shalat = mutableListOf<String>()
// equal to "VARSEQUENCE" in android command
var sequences = mutableListOf<String>()
// equal to "VARREASON" in android command
var reasons = mutableListOf<String>()
// equal to "VARPROCEDURE" in android command
var procedures = mutableListOf<String>()
// equal to "VARGATE" in android command
var gates = mutableListOf<String>()
// equal to "VARCOMPENSATION" in android command
var compensation = mutableListOf<String>()
// equal to "VARGREETING" in android command
var greetings = mutableListOf<String>()
// equal to "ZONE" in android command
var broadcastzones = mutableListOf<String>()
}

View File

@@ -3,10 +3,13 @@ package web
import StreamerOutputs import StreamerOutputs
import barix.BarixConnection import barix.BarixConnection
import codes.Somecodes import codes.Somecodes
import codes.Somecodes.Companion.Generate_WAV_Header
import codes.Somecodes.Companion.GetSensorsInfo import codes.Somecodes.Companion.GetSensorsInfo
import codes.Somecodes.Companion.GetUptime import codes.Somecodes.Companion.GetUptime
import codes.Somecodes.Companion.ListAudioFiles import codes.Somecodes.Companion.ListAudioFiles
import codes.Somecodes.Companion.String_To_List
import codes.Somecodes.Companion.ValiDateForLogHtml import codes.Somecodes.Companion.ValiDateForLogHtml
import codes.Somecodes.Companion.ValidDate
import codes.Somecodes.Companion.ValidDirectory import codes.Somecodes.Companion.ValidDirectory
import codes.Somecodes.Companion.ValidFile import codes.Somecodes.Companion.ValidFile
import codes.Somecodes.Companion.ValidIPV4 import codes.Somecodes.Companion.ValidIPV4
@@ -14,6 +17,7 @@ import codes.Somecodes.Companion.ValidScheduleDay
import codes.Somecodes.Companion.ValidScheduleTime import codes.Somecodes.Companion.ValidScheduleTime
import codes.Somecodes.Companion.ValidString import codes.Somecodes.Companion.ValidString
import codes.Somecodes.Companion.ValidStrings import codes.Somecodes.Companion.ValidStrings
import codes.Somecodes.Companion.datetimeformat1
import codes.configFile import codes.configFile
import com.fasterxml.jackson.databind.JsonNode import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
@@ -31,13 +35,7 @@ import database.Soundbank
import database.UserDB import database.UserDB
import db import db
import io.javalin.Javalin import io.javalin.Javalin
import io.javalin.apibuilder.ApiBuilder.before import io.javalin.apibuilder.ApiBuilder.*
import io.javalin.apibuilder.ApiBuilder.delete
import io.javalin.apibuilder.ApiBuilder.get
import io.javalin.apibuilder.ApiBuilder.patch
import io.javalin.apibuilder.ApiBuilder.path
import io.javalin.apibuilder.ApiBuilder.post
import io.javalin.apibuilder.ApiBuilder.ws
import io.javalin.http.Context import io.javalin.http.Context
import io.javalin.json.JavalinJackson import io.javalin.json.JavalinJackson
import io.javalin.websocket.WsMessageContext import io.javalin.websocket.WsMessageContext
@@ -45,6 +43,7 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook
import java.nio.file.Files import java.nio.file.Files
import java.time.LocalDateTime import java.time.LocalDateTime
import codes.configKeys import codes.configKeys
import database.QueueTable
import org.tinylog.Logger import org.tinylog.Logger
import java.io.File import java.io.File
import java.io.PipedInputStream import java.io.PipedInputStream
@@ -69,6 +68,12 @@ class WebApp(val listenPort: Int, val userlist: List<Pair<String, String>>, val
} }
fun Start() { fun Start() {
Start_WebServer()
Start_SemiAutoServer()
}
private fun Start_WebServer(){
Logger.info { "Starting Web Application on port $listenPort" } Logger.info { "Starting Web Application on port $listenPort" }
app = Javalin.create { config -> app = Javalin.create { config ->
config.useVirtualThreads = true config.useVirtualThreads = true
@@ -127,7 +132,7 @@ class WebApp(val listenPort: Int, val userlist: List<Pair<String, String>>, val
objectmapper.readValue(wsMessageContext.message(), WebsocketCommand::class.java) objectmapper.readValue(wsMessageContext.message(), WebsocketCommand::class.java)
when (cmd.command) { when (cmd.command) {
"getSystemTime" -> { "getSystemTime" -> {
val systemtime = LocalDateTime.now().format(Somecodes.datetimeformat1) val systemtime = LocalDateTime.now().format(datetimeformat1)
val uptime = GetUptime() val uptime = GetUptime()
SendReply( SendReply(
wsMessageContext, wsMessageContext,
@@ -251,6 +256,8 @@ class WebApp(val listenPort: Int, val userlist: List<Pair<String, String>>, val
val key = ctx.req().remoteAddr + ":" + ctx.req().remotePort val key = ctx.req().remoteAddr + ":" + ctx.req().remotePort
val pipeIN = PipedInputStream(8192) val pipeIN = PipedInputStream(8192)
val pipeOUT = PipedOutputStream(pipeIN) val pipeOUT = PipedOutputStream(pipeIN)
// write WAV Header 44 bytes contains samplingrate 44100 Hz, 16 bit, mono
pipeOUT.write(Generate_WAV_Header())
bc.AddPipeOut(key, pipeOUT) bc.AddPipeOut(key, pipeOUT)
ctx.contentType("audio/wav") ctx.contentType("audio/wav")
ctx.header("Cache-Control", "no-cache") ctx.header("Cache-Control", "no-cache")
@@ -2034,6 +2041,10 @@ class WebApp(val listenPort: Int, val userlist: List<Pair<String, String>>, val
} }
} }
}.start(listenPort) }.start(listenPort)
}
private fun Start_SemiAutoServer(){
Logger.info {"Starting SemiAuto web server at port ${listenPort+1}"}
semiauto = Javalin.create{ config -> semiauto = Javalin.create{ config ->
config.useVirtualThreads = true config.useVirtualThreads = true
config.staticFiles.add ("/semiauto") config.staticFiles.add ("/semiauto")
@@ -2070,11 +2081,129 @@ class WebApp(val listenPort: Int, val userlist: List<Pair<String, String>>, val
path("log.html"){ path("log.html"){
before { CheckSemiAutoUsers(it) } before { CheckSemiAutoUsers(it) }
} }
path("api"){
path("Initialize"){
get { ctx ->
val username = ctx.cookie("semiauto-user") ?: ""
if (username.isNotEmpty()){
val user = db.userDB.List.find { u -> u.username==username }
if (user!=null){
val result = SemiAutoInitData(username)
// messages
String_To_List(user.messagebank_ann_id).forEach { msg ->
db.messageDB.List.filter{it.ANN_ID==msg.toUInt()}.forEach {xx ->
result.messages.add("${xx.ANN_ID};${xx.Description};${xx.Language};${xx.Message_Detail}")
}
}
// broacdcast zones
result.broadcastzones = String_To_List(user.broadcastzones)
// cities
String_To_List(user.city_tags).forEach { ct ->
db.soundDB.List.firstOrNull { it.TAG == ct && it.Category == Category.City.name }
?.let{
result.cities.add("${it.TAG};${it.Description}")
}
}
// airplane names
String_To_List(user.airline_tags).forEach { at ->
db.soundDB.List.firstOrNull { it.TAG == at && it.Category == Category.Airplane_Name.name }
?.let{
result.airlines.add("${it.TAG};${it.Description}")
}
}
// places
db.soundDB.List.filter{it.Category==Category.Places.name}.distinctBy { it.TAG }.forEach { xx ->
result.places.add("${xx.TAG};${xx.Description}")
}
// shalat
db.soundDB.List.filter{it.Category==Category.Shalat.name}.distinctBy { it.TAG }.forEach { xx ->
result.shalat.add("${xx.TAG};${xx.Description}")
}
// sequences
db.soundDB.List.filter{it.Category==Category.Sequence.name}.distinctBy { it.TAG }.forEach { xx ->
result.sequences.add("${xx.TAG};${xx.Description}")
}
// reasons
db.soundDB.List.filter{it.Category==Category.Reason.name}.distinctBy { it.TAG }.forEach { xx ->
result.reasons.add("${xx.TAG};${xx.Description}")
}
// procedures
db.soundDB.List.filter{it.Category==Category.Procedure.name}.distinctBy { it.TAG }.forEach { xx ->
result.procedures.add("${xx.TAG};${xx.Description}")
}
// gates
db.soundDB.List.filter{it.Category==Category.Gate.name}.distinctBy { it.TAG }.forEach { xx ->
result.gates.add("${xx.TAG};${xx.Description}")
}
// compensation
db.soundDB.List.filter{it.Category==Category.Compensation.name}.distinctBy { it.TAG }.forEach { xx ->
result.compensation.add("${xx.TAG};${xx.Description}")
}
// greetings
db.soundDB.List.filter{it.Category==Category.Greeting.name}.distinctBy { it.TAG }.forEach { xx ->
result.greetings.add("${xx.TAG};${xx.Description}")
}
ctx.result(objectmapper.writeValueAsString(result))
} else ResultMessageString(ctx, 400, "User not found")
} else ResultMessageString(ctx, 400, "Username is empty")
}
}
path("SemiAuto"){
post { ctx ->
val json : JsonNode = objectmapper.readTree(ctx.body())
// butuh description, languages, tags, dan broadcastzones
val description = json.get("description").asText("")
val languages = json.get("languages").asText("")
val tags = json.get("tags").asText("")
val broadcastzones = json.get("broadcastzones").asText("")
if (description.isNotEmpty()){
if (languages.isNotEmpty()){
if (tags.isNotEmpty()){
if (broadcastzones.isNotEmpty()){
val qt = QueueTable(
0u,
LocalDateTime.now().format(datetimeformat1),
"SEMIAUTOWEB",
"SOUNDBANK",
description,
tags,
broadcastzones,
1u,
languages
)
if (db.queuetableDB.Add(qt)){
db.queuetableDB.Resort()
Logger.info{"SemiAutoWeb added to queue table: $qt" }
println("SemiAuto added to queue table: ${objectmapper.writeValueAsString(qt)}")
ctx.result(objectmapper.writeValueAsString(resultMessage("OK")))
} else ResultMessageString(ctx, 500, "Failed to add to queue table")
} else ResultMessageString(ctx, 400, "Broadcast zones cannot be empty")
} else ResultMessageString(ctx, 400, "Tags cannot be empty")
} else ResultMessageString(ctx, 400, "Languages cannot be empty")
} else ResultMessageString(ctx, 400, "Description cannot be empty")
}
}
path("Log"){
get("/{datelog}"){ ctx ->
val datelog = ctx.pathParam("datelog")
if (ValidDate(datelog)){
println("SemiAuto Get Log for date $datelog")
db.GetLogForHtml(datelog){
loghtml ->
val resultstring = objectmapper.writeValueAsString(loghtml)
println("Log HTML for date $datelog: $resultstring")
ctx.result(resultstring)
}
} else ResultMessageString(ctx, 400, "Invalid date format")
}
}
}
} }
}.start(listenPort+1) }.start(listenPort+1)
} }
fun ResultMessageString(ctx: Context, code: Int, message: String) { fun ResultMessageString(ctx: Context, code: Int, message: String) {
ctx.status(code).result(objectmapper.writeValueAsString(resultMessage(message))) ctx.status(code).result(objectmapper.writeValueAsString(resultMessage(message)))
} }