forked from Simnation/Main
59 lines
No EOL
1.6 KiB
JavaScript
59 lines
No EOL
1.6 KiB
JavaScript
class SpeedcamsProfit{
|
|
constructor(){
|
|
this.name = "speedcamsprofit";
|
|
}
|
|
|
|
static allowAddNew(){
|
|
return false;
|
|
}
|
|
|
|
static GetColumns(){
|
|
return ["state", "type", "name", "totalProfit", "lastTime", "lastProfit", "id"]
|
|
}
|
|
|
|
static TableDataCreate(row, key){
|
|
if(key == "id"){
|
|
|
|
if(row.allowRoute){
|
|
let coords = {}
|
|
coords.x = row.positionX;
|
|
coords.y = row.positionY;
|
|
|
|
coords = JSON.stringify(coords);
|
|
|
|
return `
|
|
<td>
|
|
<button type="button" class="btn btn-primary btn-sm" data-entering='${coords}' onclick="GenerateRoute(this, false)">
|
|
<i class="fa-solid fa-location-dot"></i>
|
|
<button>
|
|
</td>`;
|
|
}
|
|
else{
|
|
return `<td></td>`;
|
|
}
|
|
}
|
|
else if(key == "type"){
|
|
|
|
let text = getTranslation("speedcamtype." + row[key]);
|
|
let badge = `<div class="badge badge-warning font-bold">${text}</div>`;
|
|
if(row[key] == "mobile"){
|
|
badge = `<div class="badge badge-primary font-bold">${text}</div>`;
|
|
}
|
|
|
|
return `<td>${badge}</td>`;
|
|
}
|
|
else if(key == "state"){
|
|
|
|
let text = getTranslation("speedcam_active." + row[key]);
|
|
let badge = `<div class="badge badge-error font-bold">${text}</div>`;
|
|
if(row[key] == 1){
|
|
badge = `<div class="badge badge-success font-bold">${text}</div>`;
|
|
}
|
|
|
|
return `<td>${badge}</td>`;
|
|
}
|
|
else{
|
|
return `<td>${row[key]}</td>`;
|
|
}
|
|
}
|
|
} |