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 += `
${System.buildEmployeeName(row.creator)} - ${System.formatTimestamp(row.creationdate)}
${row.note.replace(/\n/g, "
")}
${System.buildEmployeeName(row.creator)} - ${System.formatTimestamp(row.creationdate)}
${row.note.replace(/\n/g, "
")}