class EmergencyVehicle{ constructor(){ this.name = "emergencyvehicle"; } static allowAddNew(){ return userrights.has("emergencyvehicle.edit") } static allowEdit(){ return userrights.has("emergencyvehicle.edit") } static allowDelete(){ return userrights.has("emergencyvehicle.delete") } static GetExtraForOverview(data){ let retval = { top:"", bottom:"" } let buttons = ``; let currentVehicle = getTranslation("no_current_vehicle"); if(data.current_vehicle!== undefined && data.current_vehicle.length > 0 && data.current_vehicle[0].id !== undefined && data.current_vehicle[0].id > -1){ currentVehicle = data.current_vehicle[0].short_name + " - " + data.current_vehicle[0].name buttons = ` ` } retval.top = `
${getTranslation("current_vehicle")}: ${currentVehicle}
${buttons}
`; return retval; } static GetColumns(){ return ["name","short_name","vehicle","action","id"] } static TableDataCreate(row, key){ if(key == "id"){ return ` ${Form.getEditButtonIcon(row[key] , this.name + ".edit", this.allowEdit())} ${Form.getDeleteButtonIcon(row[key], this.name, this.allowDelete())} `; } else if(key == "action"){ return ` `; } else{ return `${row[key]}`; } } static GetEdit(data = {}){ return { "name": { "val" : data.name ?? "" ,"type" : "text" ,"isRow": true ,"mandatory":true } ,"short_name": { "val" : data.short_name ?? "" ,"type" : "text" ,"isRow": true ,"mandatory":true } ,"vehicle": { "val" : data.vehicle ?? "" ,"type" : "text" ,"isRow": true ,"mandatory":true } } } }