class Trainings{
constructor(){
this.name = "trainings";
}
static allowAddNew(){
return userrights.has("trainings.edit")
}
static allowEdit(){
return userrights.has("trainings.edit")
}
static allowDelete(){
return userrights.has("trainings.delete")
}
static allowViewEmployeeTrainings(){
return userrights.has("trainingsemployees.view")
}
static GetExtraForView(data){
let retval = {
top:"",
bottom:""
}
if(this.allowViewEmployeeTrainings){
retval.bottom += `
${getTranslation("trainingsparticipants.overview")}
${System.GetTable(TrainingsParticipants, data.extraData.participants)}
`;
}
return retval;
}
static GetColumns(){
return ["name","short_name","action","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 == "action"){
let content = "";
if(row.allow_self_entry){
let disabled = "";
if(row.entered > 0){
disabled = " disabled"
}
content = ``
}
return `
${content}
| `;
}
else{
return `${row[key]} | `;
}
}
static GetEdit(data={}){
for(let i=0; i