forked from Simnation/Main
68 lines
No EOL
1.8 KiB
JavaScript
68 lines
No EOL
1.8 KiB
JavaScript
class InvestigationEntry{
|
|
constructor(){
|
|
this.name = "investigationentry";
|
|
}
|
|
|
|
static GetCustomDestination(data, dest){
|
|
return data.investigation_id > 0 ? "investigation.view" : dest;
|
|
}
|
|
static GetCustomDestID(data, destID){
|
|
return data.investigation_id ?? destID;
|
|
}
|
|
|
|
static TableDataCreate(row, key){
|
|
if(key == "is_important_entry"){
|
|
if(row[key]){
|
|
return `
|
|
<td class="font-bold">
|
|
<i class="fa-solid fa-check"></i>
|
|
</td>`
|
|
;
|
|
}
|
|
else{
|
|
return "<td></td>"
|
|
}
|
|
}
|
|
else if(key == "creator"){
|
|
return `<td>${System.buildEmployeeName(row[key])}</td>`;
|
|
}
|
|
else{
|
|
if(row[key].includes(" ")){
|
|
//todo everywhere
|
|
return `<td class="whitespace-normal break-normal">${row[key].replace(/\n/g,"<br>")}</td>`;
|
|
}
|
|
else{
|
|
return `<td class="whitespace-normal break-all">${row[key].replace(/\n/g,"<br>")}</td>`;
|
|
}
|
|
}
|
|
}
|
|
|
|
static GetColumns(){
|
|
return ["creator","content","is_important_entry"]
|
|
}
|
|
static GetEdit(data={}){
|
|
return {
|
|
"investigation_id": {
|
|
"val" : data.investigation_id ?? "-1"
|
|
,"type" : "hidden"
|
|
,"isRow": true
|
|
,"mandatory":true
|
|
},
|
|
"content": {
|
|
"val" : data.content ?? ""
|
|
,"type" : "textarea"
|
|
,"isRow": true
|
|
,"mandatory":true
|
|
,autogrow: true
|
|
,rows:3
|
|
}
|
|
,"is_important_entry": {
|
|
"val" : data.is_important_entry ?? ""
|
|
,"type" : "dropdown"
|
|
,"isRow": true
|
|
,"mandatory":true
|
|
,"options":System.GetBooleanOptions()
|
|
}
|
|
}
|
|
}
|
|
} |