forked from Simnation/Main
ed
This commit is contained in:
parent
48a36209b5
commit
884f3df7cf
262 changed files with 223207 additions and 2 deletions
116
resources/[jobs]/[mdt]/myEmergency/html/js/modules/Manhunt.js
Normal file
116
resources/[jobs]/[mdt]/myEmergency/html/js/modules/Manhunt.js
Normal file
|
@ -0,0 +1,116 @@
|
|||
class Manhunt{
|
||||
constructor(){
|
||||
this.name = "manhunt";
|
||||
}
|
||||
static isCustom(){
|
||||
return true;
|
||||
}
|
||||
|
||||
static CreateCustom(data){
|
||||
document.getElementById("currentpage-content").innerHTML = `
|
||||
<div class="card w-full p-2 bg-base-100 shadow-xl mt-2 mb-6">
|
||||
<div class="h-full w-full bg-base-100">
|
||||
<div class="overflow-x-auto w-full">
|
||||
${System.GetTable(Manhunt, data.data)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
||||
|
||||
static GetColumns(){
|
||||
return ["type","last_changed","info","id"]
|
||||
}
|
||||
|
||||
static TableDataCreate(row, key){
|
||||
if(key == "id"){
|
||||
let destination = ""
|
||||
let destinationID = row[key]
|
||||
let allowed = false;
|
||||
|
||||
if(row.type == "files"){
|
||||
destination = "files.view"
|
||||
allowed = userrights.has(destination);
|
||||
}
|
||||
else if(row.type == "vehicle"){
|
||||
destination = "regvehicle.view"
|
||||
allowed = userrights.has("regvehicles.view");
|
||||
|
||||
}
|
||||
else if(row.type == "weapon"){
|
||||
destination = "regweapons.view"
|
||||
allowed = userrights.has(destination);
|
||||
}
|
||||
|
||||
if(allowed){
|
||||
return `
|
||||
<td>
|
||||
<button type="button" class="btn btn-sm btn-primary" onclick="loadPage('${destination}','${destinationID}')">${getTranslation(destination)}</button>
|
||||
</td>`
|
||||
}
|
||||
else{
|
||||
return `<td></td>`
|
||||
}
|
||||
}
|
||||
else if(key == "last_changed"){
|
||||
return `
|
||||
<td>
|
||||
${System.formatTimestamp(row[key])}
|
||||
</td>`;
|
||||
}
|
||||
else if(key == "type"){
|
||||
return `
|
||||
<td>
|
||||
${getTranslation("type_" + row[key])}
|
||||
</td>`;
|
||||
}
|
||||
else if(key == "info"){
|
||||
if(row.type == "files"){
|
||||
let displayValue = "";
|
||||
|
||||
if(row[key]){
|
||||
let tmp = row[key].split("\n");
|
||||
|
||||
for(let i=0; i<tmp.length;i++){
|
||||
let breaked = tmp[i].match(/.{1,75}/g) ?? [];
|
||||
displayValue += (displayValue=="" ? "" : "<br>") + breaked.join("<br>");
|
||||
}
|
||||
}
|
||||
|
||||
return `
|
||||
<td>
|
||||
<p><strong>${getTranslation("name")}: </strong>${row.name}</p>
|
||||
<br>
|
||||
<p class="max-w-xs break-all">${displayValue}</p>
|
||||
</td>`
|
||||
;
|
||||
|
||||
}
|
||||
else if(row.type=="vehicle"){
|
||||
return `
|
||||
<td>
|
||||
<p><strong>${getTranslation("plate")}: </strong>${row.plate}</p>
|
||||
<p><strong>${getTranslation("owner")}: </strong>${row.owner}</p>
|
||||
<p><strong>${getTranslation("veh_type")}: </strong>${row.veh_type}</p>
|
||||
<p><strong>${getTranslation("veh_model")}: </strong>${row.veh_model}</p>
|
||||
</td>`
|
||||
;
|
||||
}
|
||||
else if(row.type == "weapon"){
|
||||
return `
|
||||
<td>
|
||||
<p><strong>${getTranslation("serialno")}: </strong>${row.serialno}</p>
|
||||
<p><strong>${getTranslation("owner")}: </strong>${row.owner}</p>
|
||||
<p><strong>${getTranslation("weapontype")}: </strong>${row.weapontype}</p>
|
||||
<p><strong>${getTranslation("weaponmodel")}: </strong>${row.weaponmodel}</p>
|
||||
</td>`
|
||||
;
|
||||
}
|
||||
|
||||
}
|
||||
else{
|
||||
return `<td>${row[key]}</td>`;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue