class Notes{ constructor(){ this.name = "notes"; } static allowAddNew(){ return userrights.has("notes.edit"); } static allowEdit(){ return userrights.has("notes.edit"); } static allowDelete(){ return userrights.has("notes.delete"); } static isCustom(){ return true; } static GetEdit(data={}){ return { "note_headline": { "val" : data.note_headline ?? "" ,"type" : "text" ,"mandatory":true ,"isRow":true }, "note": { "val" : data.note ?? "" ,"type" : "textarea" ,"isRow": true ,"mandatory":true ,autogrow: true ,rows:3 } ,"is_important_note": { "val" : data.is_important_note ?? "" ,"type" : "dropdown" ,"isRow": true ,"mandatory":true ,"options":System.GetBooleanOptions() } } } static CreateCustom(data){ document.getElementById("currentpage-content").innerHTML = Form.overviewHeadline(this.name.toLowerCase() + ".add", false, this.allowAddNew()); let statsHTML = ``; if(data.data.important_notes.length > 0 || data.data.notes.length > 0){ let badges = ``; if(data.data.important_notes.length > 0){ let gridCols = data.data.important_notes.length; if(data.data.important_notes.length > 4){ gridCols = 4; } statsHTML += `
` for(let i = 0; i${getTranslation("stat.is_important_note")}
`; let buttons = ``; if(this.allowEdit()){ buttons += ``; } if(this.allowDelete()){ buttons += ``; } statsHTML += `

${row.note_headline}

${badges}

${System.buildEmployeeName(row.creator)} - ${System.formatTimestamp(row.creationdate)}

${row.note.replace(/\n/g, "
")}

${buttons}
`; } statsHTML += ``; } if(data.data.notes.length > 0){ statsHTML += `
` for(let i = 0; i${getTranslation("edit")}`; } if(this.allowDelete()){ buttons += ``; } statsHTML += `

${row.note_headline}

${System.buildEmployeeName(row.creator)} - ${System.formatTimestamp(row.creationdate)}

${row.note.replace(/\n/g, "
")}

${buttons}
`; } statsHTML += `
`; } document.getElementById("currentpage-content").innerHTML += statsHTML; } Form.initTableButtons(); } }