class EvidenceRooms{ constructor(){ this.name = "evidencerooms"; } static allowAddNew(){ return userrights.has("evidencerooms.edit"); } static allowEdit(){ return userrights.has("evidencerooms.edit"); } static allowDelete(){ return userrights.has("evidencerooms.delete"); } static isCustom(){ return true; } static CreateCustom(data, isEditMode = false){ let retval = ``; if(!isEditMode){ document.getElementById("currentpage-content").innerHTML = Form.overviewHeadline(this.name.toLowerCase() + ".add", false, this.allowAddNew()); } for(let i=0; i${getTranslation("add_entry")}`; } if(this.allowEdit()){ buttons += ``; } if(this.allowDelete()){ buttons += ``; } if(this.allowEdit()){ bottomButton += ``; } if(buttons != ""){ mbClass = "mb-2"; } if(bottomButton != ""){ mtClass = "mt-2"; } if(!isEditMode || row.laws.length > 0){ retval += `
${row.name}
${buttons}
${System.GetTable(System.getClassByName("evidenceroomarticles"), row.articles)}
${bottomButton}
`; } } document.getElementById("currentpage-content").innerHTML += retval; Form.initTableButtons(); Array.from(document.querySelectorAll(".evidencerooms-add-entry")).forEach(function(button){ button.onclick = function(){ let staticData = { data:{ evidenceroom_id:this.getAttribute("data-parentID") } } loadPage("evidenceroomarticles.add",this.getAttribute("data-parentID"),"false", staticData) } }); Array.from(document.querySelectorAll(".evidencerooms-edit")).forEach(function(button){ button.onclick = function(){ loadPage("evidencerooms.edit",this.getAttribute("data-parentID"),"true", {}) } }); Array.from(document.querySelectorAll(".evidencerooms-history")).forEach(function(button){ button.onclick = function(){ loadPage("evidenceroomarticlesdestroyed.dataload",this.getAttribute("data-parentID"),"true", {}) } }); } static GetEdit(data={}){ return { "name": { "val" : data.name ?? "" ,"type" : "text" ,"mandatory":true ,"isRow":true } } } }