forked from Simnation/Main
59 lines
No EOL
1.9 KiB
JavaScript
59 lines
No EOL
1.9 KiB
JavaScript
class ControlCentreEmployees{
|
|
constructor(){
|
|
this.name = "controlcentreemployees";
|
|
}
|
|
|
|
static allowEdit(){
|
|
return userrights.has("controlcentre.take");
|
|
}
|
|
|
|
static isCustom(){
|
|
return true;
|
|
}
|
|
|
|
static GetColumns(){
|
|
return ["name","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></td>`
|
|
}
|
|
return `
|
|
<td style="color:${FgColor}; background:${row["radio_color"]}">
|
|
<button type="button" class="btn btn-sm btn-primary" onclick="resetEmployeeRadio('${row["id"]}')">
|
|
<i class="fa-solid fa-delete-left"></i>
|
|
</button>
|
|
<button type="button" class="btn btn-sm btn-warning" onclick="loadPage('employeevehicle.edit', '${row["id"]}')">
|
|
<i class="fa-solid fa-car-on"></i>
|
|
</button>
|
|
<button type="button" class="btn btn-sm btn-warning" onclick="loadPage('employeeradio.edit', '${row["id"]}')">
|
|
<i class="fa-solid fa-tower-broadcast"></i>
|
|
</button>
|
|
</td>`;
|
|
}
|
|
|
|
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 == "name"){
|
|
return `
|
|
<td style="color:${FgColor}; background:${row["radio_color"]}">
|
|
${row["serviceno"] ?? System.getServiceNo(row.id)} - ${System.buildEmployeeName(row[key])}
|
|
</td>`;
|
|
}
|
|
else {
|
|
return `<td style="color:${FgColor}; background:${row["radio_color"]}">${row[key]}</td>`;
|
|
}
|
|
}
|
|
} |