v2 update

This commit is contained in:
2018-11-28 20:04:01 +01:00
parent 096eea3a55
commit 1536f70d35
6 changed files with 106 additions and 480 deletions

View File

@@ -81,23 +81,23 @@ class AutomaticDispose {
ADisMissionsVerbandEvent: "++missionID,type,name,last_check,next_check,available,done",
});
this.ADisDB.on("populate", function () {
ADisDB.ADisSettings.add({
that.ADisDB.ADisSettings.add({
name: "Krankentransport-Automatic",
value: 'true'
});
ADisDB.ADisSettings.add({
that.ADisDB.ADisSettings.add({
name: "Sprechwunsch-Automatic",
value: 'true'
});
ADisDB.ADisSettings.add({
that.ADisDB.ADisSettings.add({
name: "MissionsOwn-Automatic",
value: 'true'
});
ADisDB.ADisSettings.add({
that.ADisDB.ADisSettings.add({
name: "Alliance-Automatic",
value: 'false'
});
ADisDB.ADisSettings.add({
that.ADisDB.ADisSettings.add({
name: "AllianceEvent-Automatic",
value: 'false'
});
@@ -332,6 +332,7 @@ class AutomaticDispose {
// - Index Page Loader
// -
IndexPage() {
let that = this;
// -
// - Google Font
// -
@@ -360,194 +361,11 @@ class AutomaticDispose {
// Create Dashboard
$('#news_li').before('<li id="adis-nav-item"></li>');
$('#adis-nav-item').html(`<a id="adis-open-button" href="#">
<span class="glyphicon glyphicon-fire"></span>
</a>
<div id="adis-dashboard">
<header>
Autom. Disposition (ADis)
<a id="adis-dashboard-close-button">
<i class="fas fa-times"></i>
</a>
</header>
<section id="adis-dashboard-settings">
<div title="Arbeitet die ausgewählten Einsätze automatisch ab">
<a id="adis-setting-krankentransport-automatic" class="adis-setting-switch"></a>
Krankentransporte-Automatik
</div>
<div title="Arbeitet alle Einsätze automatisch ab">
<a id="adis-setting-full-automatic" class="adis-setting-switch"></a>
Eigene Einsätze-Automatik
</div>
<div title="Arbeitet die Sprechwünsche automatisch ab">
<a id="adis-setting-sprechwunsch-automatic" class="adis-setting-switch"></a>
Sprechwunsch-Automatik
</div>
<div title="Sendet automatisch Fahrzeuge zu Verbandseinsätzen, welche gerade abgearbeitet werden">
<a id="adis-setting-alliance-automatic" class="adis-setting-switch"></a>
Verbands-Automatik
</div>
<div title="Sendet automatisch Fahrzeuge zu Verband-Event Einsätzen, welche gerade abgearbeitet werden">
<a id="adis-setting-allianceevents-automatic" class="adis-setting-switch"></a>
VerbandsEvents-Automatik
</div>
</section>
</div>
<style>
#adis-nav-item {
position: relative;
}
#adis-dashboard {
width: 364px;
overflow: hidden;
position: absolute;
top: calc(100% + 16px);
left: 50%;
z-index: 1000;
transform: translateX(-50%);
display: flex;
flex-flow: column nowrap;
justify-content: center;
align-items: center;
font-family: "Open Sans";
font-size: 14px;
font-weight: 400;
background: rgba(250, 250, 250, 1);
border-radius: 4px;
box-shadow: 0px 0px 6px 0px rgba(0, 0, 0, 0.48);
}
#adis-dashboard>header {
width: 100%;
height: 48px;
padding: 8px 24px;
margin: 0px;
position: relative;
display: flex;
justify-content: flex-start;
align-items: center;
line-height: 1;
font-size: 18px;
font-weight: 400;
}
#adis-dashboard-close-button {
width: 48px;
height: 48px;
position: absolute;
top: 0px;
right: 0px;
display: flex;
justify-content: center;
align-items: center;
cursor: pointer;
}
#adis-dashboard-close-button img {
width: 12px;
height: 12px;
}
#adis-dashboard>section {
width: 100%;
padding: 16px 24px;
margin: 0px;
display: flex;
flex-flow: column nowrap;
justify-content: center;
align-items: center;
}
#adis-dashboard-switch-mode-button,
#adis-dashboard-open-dispatcher-button {
width: 80%;
height: 40px;
margin: 4px 0px;
display: flex;
justify-content: center;
align-items: center;
text-decoration: none;
color: #fafafa;
cursor: pointer;
background: #43a047;
border-radius: 4px;
border-bottom: 3px solid rgba(0, 0, 0, 0.32);
}
#adis-dashboard-settings {
background: #e0e0e0;
border-top: 1px solid #757575;
}
#adis-dashboard-settings>div {
width: 100%;
height: 32px;
display: flex;
flex-flow: row nowrap;
justify-content: flex-start;
align-items: center;
}
.adis-setting-switch {
width: 40px;
height: 16px;
margin-right: 16px;
background: #9e9e9e;
border-radius: 12px;
box-shadow: inset 0px 0px 3px 0px rgba(0, 0, 0, 0.20);
}
.adis-setting-switch.active {
background: #8bc34a;
}
.adis-setting-switch::after {
width: 22px;
height: 22px;
margin-top: -3px;
margin-left: -3px;
content: "";
display: block;
background: #fafafa;
border-radius: 12px;
box-shadow: 0px 0px 3px 0px rgba(0, 0, 0, 0.24);
transition: all 200ms;
}
.adis-setting-switch.active::after {
margin-left: calc(100% - 22px + 3px);
background: #5a9216;
box-shadow: 0px 0px 3px 0px rgba(0, 0, 0, 0.32);
transition: all 200ms;
}
</style>
<script>
//
// Setting-Events
//
$(document).ready(function () {
$('#adis-nav-item').html(`/***ADis_Navbar***/0`)
$("#adis-dashboard").css({
display: "none",
opacity: "0"
});
//
// Click Events
@@ -556,54 +374,54 @@ class AutomaticDispose {
$("#adis-setting-krankentransport-automatic").click(function () {
var tf = $(this).hasClass("active");
console.log(tf);
ADisDB.ADisSettings.put({
that.ADisDB.ADisSettings.put({
name: "Krankentransport-Automatic",
value: !tf ? 'true' : 'false'
}).then((res) => {
console.log(res);
ADis_UpdateSettings();
that.UIUpdateSettings();
});
});
$("#adis-setting-full-automatic").click(function () {
var tf = $(this).hasClass("active");
console.log(tf);
ADisDB.ADisSettings.put({
that.ADisDB.ADisSettings.put({
name: "MissionsOwn-Automatic",
value: !tf ? 'true' : 'false'
}).then(() => {
ADis_UpdateSettings();
that.UIUpdateSettings();
});
});
$("#adis-setting-sprechwunsch-automatic").click(function () {
var tf = $(this).hasClass("active");
console.log(tf);
ADisDB.ADisSettings.put({
that.ADisDB.ADisSettings.put({
name: "Sprechwunsch-Automatic",
value: !tf ? 'true' : 'false'
}).then(() => {
ADis_UpdateSettings();
that.UIUpdateSettings();
});
});
$("#adis-setting-alliance-automatic").click(function () {
var tf = $(this).hasClass("active");
ADisDB.ADisSettings.put({
that.ADisDB.ADisSettings.put({
name: "Alliance-Automatic",
value: !tf ? 'true' : 'false'
}).then(() => {
ADis_UpdateSettings();
that.UIUpdateSettings();
});
});
$("#adis-setting-alliance-automatic").click(function () {
var tf = $(this).hasClass("active");
ADisDB.ADisSettings.put({
that.ADisDB.ADisSettings.put({
name: "AllianceEvent-Automatic",
value: !tf ? 'true' : 'false'
}).then(() => {
ADis_UpdateSettings();
that.UIUpdateSettings();
});
});
@@ -626,15 +444,23 @@ class AutomaticDispose {
});
// initial call to load the current setting state
ADis_UpdateSettings();
});
that.UIUpdateSettings();
// Create Iframes
$("body").append('<div id="adis-frame-container"></div>');
$("#adis-frame-container").html(`/***ADis_Iframes***/0`);
$("#adis-frame-container").css({
display: "none",
opacity: "0"
});
}
//
// Display Settings
//
function ADis_UpdateSettings() {
ADisDB.ADisSettings.each((setting) => {
UIUpdateSettings() {
this.ADisDB.ADisSettings.each((setting) => {
if (setting.name == "Krankentransport-Automatic") {
if (setting.value == "true") {
$("#adis-setting-krankentransport-automatic").addClass("active");
@@ -668,75 +494,6 @@ class AutomaticDispose {
}
});
}
</script>`)
$("#adis-dashboard").css({
display: "none",
opacity: "0"
});
// Create Iframes
$("body").append('<div id="adis-frame-container"></div>');
$("#adis-frame-container").html(`<div id="adis-frame-wrapper" style="display: none; opacity: 0">
<iframe id="adis-ownmissions-frame" name="adis-ownmissions" mission_id="empty" src=""></iframe>
<iframe id="adis-plannedevents-frame" name="adis-plannedevents" mission_id="empty" src=""></iframe>
<iframe id="adis-verbandmission-frame" name="adis-verbandmission" mission_id="empty" src=""></iframe>
<iframe id="adis-verbandmission-event-frame" name="adis-verbandmission-event" mission_id="empty" src=""></iframe>
<iframe id="adis-krankentransporte-frame" name="adis-krankentransporte" mission_id="empty" src=""></iframe>
<iframe id="adis-sprechwunsch-rescue-frame" name="adis-sprechwunsch-rescue" vehicle_id="empty" src=""></iframe>
<iframe id="adis-sprechwunsch-police-frame" name="adis-sprechwunsch-police" mission_id="empty" src=""></iframe>
</div>
<style>
#adis-frame-container {
width: 100%;
height: 100vh;
padding: 4% 10%;
position: fixed;
top: 0px;
left: 0px;
right: 0px;
z-index: 2010;
display: flex;
justify-content: center;
align-items: center;
background: rgba(0, 0, 0, 0.48);
}
#adis-frame-wrapper {
width: 100%;
height: 100%;
padding: 32px;
position: relative;
display: flex;
flex-flow: column nowrap;
justify-content: center;
align-items: center;
background: #eeeeee;
border-radius: 4px;
box-shadow: 0px 0px 6px 0px rgba(0, 0, 0, 0.32);
}
#adis-frame-wrapper>iframe {
width: 100%;
height: 50%;
border: 0px;
}
</style>`);
$("#adis-frame-container").css({
display: "none",
opacity: "0"
});
}
}