forked from Simnation/Main
ed
This commit is contained in:
parent
48a36209b5
commit
884f3df7cf
262 changed files with 223207 additions and 2 deletions
|
@ -0,0 +1,90 @@
|
|||
class TrainingsParticipants{
|
||||
constructor(){
|
||||
this.name = "trainingsparticipants";
|
||||
}
|
||||
|
||||
static allowEditEmployeeTrainings(){
|
||||
return userrights.has("trainingsemployees.edit")
|
||||
}
|
||||
|
||||
static GetColumns(){
|
||||
return ["name","action","passed","id"]
|
||||
}
|
||||
|
||||
static TableDataCreate(row, key){
|
||||
|
||||
if(key == "id"){
|
||||
if(row.passed > -1){
|
||||
|
||||
let btn = ``;
|
||||
if(this.allowEditEmployeeTrainings()){
|
||||
btn = `
|
||||
<button type="button" class="btn btn-sm btn-error" onclick="trainingPassed(-1, '${row["employee_id"]}', '${row["training_id"]}')">
|
||||
<i class="fa-solid fa-delete-left"></i>
|
||||
</button>
|
||||
`;
|
||||
}
|
||||
|
||||
return `
|
||||
<td>
|
||||
${btn}
|
||||
</td>`;
|
||||
}
|
||||
else{
|
||||
return `<td></td>`;
|
||||
}
|
||||
|
||||
}
|
||||
else if(key == "action"){
|
||||
let disabled = "";
|
||||
let content = ``;
|
||||
|
||||
if(row.participate > 0){
|
||||
disabled = " disabled"
|
||||
}
|
||||
|
||||
if(this.allowEditEmployeeTrainings()){
|
||||
content = `<button type="button" class="btn btn-sm btn-primary" onclick="participateForTraining(${row["training_id"]}, '${row["employee_id"]}')" ${disabled}>${getTranslation("participate")}</button>`
|
||||
}
|
||||
|
||||
return `
|
||||
<td>
|
||||
${content}
|
||||
</td>`;
|
||||
}
|
||||
else if(key == "passed"){
|
||||
let content = "";
|
||||
|
||||
if(row[key] == -1 && this.allowEditEmployeeTrainings()){
|
||||
content = `
|
||||
<button type="button" class="btn btn-sm btn-error" onclick="trainingPassed(0, '${row["employee_id"]}', '${row["training_id"]}')">
|
||||
<i class="fa-solid fa-xmark"></i>
|
||||
</button>
|
||||
<button type="button" class="btn btn-sm btn-success" onclick="trainingPassed(1, '${row["employee_id"]}', '${row["training_id"]}')">
|
||||
<i class="fa-solid fa-check"></i>
|
||||
</button>`
|
||||
;
|
||||
}
|
||||
else if(row[key] == 0){
|
||||
content = `<i class="fa-solid fa-xmark text-error"></i>`;
|
||||
}
|
||||
else if(row[key] == 1){
|
||||
content = `<i class="fa-solid fa-check text-success"></i>`;
|
||||
}
|
||||
|
||||
return `
|
||||
<td>
|
||||
${content}
|
||||
</td>`;
|
||||
}
|
||||
else if(key == "name"){
|
||||
return `
|
||||
<td>
|
||||
${System.buildEmployeeName(row[key])}
|
||||
</td>`;
|
||||
}
|
||||
else{
|
||||
return `<td>${row[key]}</td>`;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue