forked from Simnation/Main
57 lines
No EOL
1.7 KiB
JavaScript
57 lines
No EOL
1.7 KiB
JavaScript
class ControlCentreEmergancyVehicles{
|
|
constructor(){
|
|
this.name = "controlcentreemployees";
|
|
}
|
|
|
|
static allowEdit(){
|
|
return userrights.has("controlcentre.take");
|
|
}
|
|
|
|
static isCustom(){
|
|
return true;
|
|
}
|
|
|
|
static GetColumns(){
|
|
return ["short_name","name","employees","radio_short_name","id"]
|
|
}
|
|
|
|
static TableDataCreate(row, key){
|
|
let FgColor = System.GetFgColorByBgColor(row["radio_color"]);
|
|
|
|
if(row["radio_color"] == ""){
|
|
row["radio_color"] = "#FFFFFF";
|
|
}
|
|
|
|
if(key == "id"){
|
|
if(this.allowEdit()){
|
|
return `
|
|
<td style="color:${FgColor}; background:${row["radio_color"]}">
|
|
<button type="button" class="btn btn-sm btn-primary" onclick="resetVehicle('${row["id"]}')">
|
|
<i class="fa-solid fa-delete-left"></i>
|
|
</button>
|
|
<button type="button" class="btn btn-sm btn-warning" onclick="loadPage('emergencyvehicleradio.edit','${row["id"]}')">
|
|
<i class="fa-solid fa-tower-broadcast"></i>
|
|
</button>
|
|
</td>`;
|
|
}
|
|
else{
|
|
return ``;
|
|
}
|
|
}
|
|
else if(key == "radio_short_name"){
|
|
return `
|
|
<td style="color:${FgColor}; background:${row["radio_color"]}">
|
|
${row[key] == "" ? getTranslation("emergency_vehicles_no_radio") : row[key]}
|
|
</td>`;
|
|
}
|
|
else if(key == "employees"){
|
|
return `
|
|
<td style="color:${FgColor}; background:${row["radio_color"]}">
|
|
${System.buildEmployeeName(row[key])}
|
|
</td>`;
|
|
}
|
|
else {
|
|
return `<td style="color:${FgColor}; background:${row["radio_color"]}">${row[key]}</td>`;
|
|
}
|
|
}
|
|
}
|