forked from Simnation/Main
ed
This commit is contained in:
parent
48a36209b5
commit
884f3df7cf
262 changed files with 223207 additions and 2 deletions
|
@ -0,0 +1,92 @@
|
|||
class MissionReport{
|
||||
constructor(){
|
||||
this.name = "missionreport";
|
||||
}
|
||||
|
||||
static allowAddNew(){
|
||||
return userrights.has("missionreport.edit");
|
||||
}
|
||||
static allowEdit(){
|
||||
return userrights.has("missionreport.edit");
|
||||
}
|
||||
static allowDelete(){
|
||||
return userrights.has("missionreport.delete");
|
||||
}
|
||||
|
||||
static GetColumns(){
|
||||
return ["name","mission_date","createddate","createdby","changeddate","changedby","id"]
|
||||
}
|
||||
|
||||
static TableDataCreate(row, key){
|
||||
if(key == "id"){
|
||||
return `
|
||||
<td>
|
||||
${Form.getViewButtonIcon(row[key], this.name + ".view")}
|
||||
${Form.getEditButtonIcon(row[key] , this.name + ".edit", this.allowEdit())}
|
||||
${Form.getDeleteButtonIcon(row[key], this.name, this.allowDelete())}
|
||||
</td>`;
|
||||
}
|
||||
else if(key == "mission_date"){
|
||||
return `
|
||||
<td>
|
||||
${System.formatDate(row[key])}
|
||||
|
||||
</td>`;
|
||||
}
|
||||
else if(key == "name"){
|
||||
return `
|
||||
<td class="whitespace-normal">
|
||||
${row[key]}
|
||||
</td>`;
|
||||
}
|
||||
else if(key == "createddate" || key == "changeddate"){
|
||||
return `
|
||||
<td>
|
||||
${System.formatTimestamp(row[key])}
|
||||
</td>`;
|
||||
}
|
||||
else if(key == "createdby" || key == "changedby"){
|
||||
return `
|
||||
<td>
|
||||
${System.buildEmployeeName(row[key])}
|
||||
</td>`;
|
||||
}
|
||||
else{
|
||||
return `<td>${row[key]}</td>`;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static GetEdit(data={}){
|
||||
return {
|
||||
"name": {
|
||||
"val" : data.name ?? ""
|
||||
,"type" : "text"
|
||||
,"mandatory":true
|
||||
}
|
||||
,"mission_date": {
|
||||
"val" : data.mission_date ?? new Date().toISOString().split('T')[0]
|
||||
,"type" : "date"
|
||||
,"mandatory":true
|
||||
}
|
||||
,"mission_location":{
|
||||
"val" : data.mission_location ?? ""
|
||||
,"type" : "text"
|
||||
,"mandatory":true
|
||||
}
|
||||
,"involved_forces": {
|
||||
"val" : data.involved_forces ?? ""
|
||||
,"type" : "text"
|
||||
,"mandatory":true
|
||||
}
|
||||
,"report":{
|
||||
"val" : data.report ?? ""
|
||||
,"type" : "textarea"
|
||||
,"isRow": true
|
||||
,"mandatory":true
|
||||
,autogrow: true
|
||||
,rows:3
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue