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 ` ${Form.getViewButtonIcon(row[key], this.name + ".view")} ${Form.getEditButtonIcon(row[key] , this.name + ".edit", this.allowEdit())} ${Form.getDeleteButtonIcon(row[key], this.name, this.allowDelete())} `; } else if(key == "mission_date"){ return ` ${System.formatDate(row[key])} `; } else if(key == "name"){ return ` ${row[key]} `; } else if(key == "createddate" || key == "changeddate"){ return ` ${System.formatTimestamp(row[key])} `; } else if(key == "createdby" || key == "changedby"){ return ` ${System.buildEmployeeName(row[key])} `; } else{ return `${row[key]}`; } } 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 } } } }