forked from Simnation/Main
79 lines
No EOL
2.7 KiB
JavaScript
79 lines
No EOL
2.7 KiB
JavaScript
class ControlCentre{
|
|
constructor(){
|
|
this.name = "controlcentre";
|
|
}
|
|
|
|
static isCustom(){
|
|
return true;
|
|
}
|
|
|
|
static allowTake(){
|
|
return userrights.has("controlcentre.take");
|
|
}
|
|
|
|
static CreateCustom(data){
|
|
let buttons = ``;
|
|
|
|
if(this.allowTake()){
|
|
if(data.data.control_centre.is_taken){
|
|
buttons = `<button onclick="takeControlCentre(true)" class="btn btn-sm btn-error">${getTranslation("current_control_centre_reset")}</button>`
|
|
buttons += `<button onclick="takeControlCentre(false)" class="btn btn-sm btn-primary">${getTranslation("current_control_centre_take")}</button>`
|
|
}
|
|
else{
|
|
buttons = `<button onclick="takeControlCentre(false)" class="btn btn-sm btn-primary">${getTranslation("current_control_centre_take")}</button>`
|
|
}
|
|
}
|
|
|
|
document.getElementById("currentpage-content").innerHTML = `
|
|
<div class="card w-full bg-info text-info-content">
|
|
<div class="card-body">
|
|
<h2 class="card-title uppercase font-bold">${getTranslation("current_control_centre")}</h2>
|
|
<p><strong>${data.data.control_centre.is_taken ? System.buildEmployeeName(data.data.control_centre.name) : getTranslation("no_control_centre") }</strong></p>
|
|
<p></p>
|
|
<div class="card-actions justify-start">
|
|
${buttons}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
`;
|
|
|
|
|
|
document.getElementById("currentpage-content").innerHTML += `
|
|
<div class="collapse collapse-open border border-base-300 bg-base-100 rounded-box mt-4">
|
|
<div class="collapse-title text-xl font-medium">
|
|
${getTranslation("emergencyvehicle.overview")}
|
|
</div>
|
|
<div class="collapse-content">
|
|
${System.GetTable(ControlCentreEmergancyVehicles, data.data.emergency_vehicles)}
|
|
</div>
|
|
</div>
|
|
`;
|
|
document.getElementById("currentpage-content").innerHTML += `
|
|
<div class="collapse collapse-open border border-base-300 bg-base-100 rounded-box mt-4">
|
|
<div class="collapse-title text-xl font-medium">
|
|
${getTranslation("employees.overview")}
|
|
</div>
|
|
<div class="collapse-content">
|
|
${System.GetTable(ControlCentreEmployees, data.data.employees)}
|
|
</div>
|
|
</div>
|
|
`;
|
|
}
|
|
|
|
static GetEdit(data={}){
|
|
return {
|
|
"name": {
|
|
"val" : data.name ?? ""
|
|
,"type" : "text"
|
|
,"mandatory":true
|
|
,"isRow":true
|
|
}
|
|
,"short_name": {
|
|
"val" : data.short_name ?? ""
|
|
,"type" : "text"
|
|
,"mandatory":true
|
|
,"isRow":true
|
|
}
|
|
}
|
|
}
|
|
} |