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,88 @@
|
|||
class EmployeesTraining{
|
||||
constructor(){
|
||||
this.name = "employeestraining";
|
||||
}
|
||||
|
||||
|
||||
static GetCustomDestination(data, dest){
|
||||
return (data.employee_id ?? "" != "" ? "employees.view" : "employees.overview");
|
||||
}
|
||||
|
||||
static GetCustomDestID(data, destID){
|
||||
return data.employee_id ?? destID;
|
||||
}
|
||||
|
||||
static isCustom(){
|
||||
return true;
|
||||
}
|
||||
|
||||
static GetColumns(){
|
||||
return ["name","action","passed","id"]
|
||||
}
|
||||
|
||||
|
||||
static CreateCustom(data){
|
||||
document.getElementById("currentpage-content").innerHTML=Form.BackEditBtn("employees.view", "", -1, false, data.data.employee_id);
|
||||
document.getElementById("currentpage-content").innerHTML+=System.GetTable(this, data.data.trainings);
|
||||
Form.initViewModeTopButtons();
|
||||
}
|
||||
|
||||
|
||||
|
||||
static TableDataCreate(row, key){
|
||||
if(key == "id"){
|
||||
if(row.passed > -1){
|
||||
return `
|
||||
<td>
|
||||
<button type="button" class="btn btn-sm btn-error" onclick="trainingPassed(-1, '${row["employee_id"]}', '${row["id"]}', true)">
|
||||
<i class="fa-solid fa-delete-left"></i>
|
||||
</button>
|
||||
</td>`;
|
||||
}
|
||||
else{
|
||||
return `<td></td>`;
|
||||
}
|
||||
|
||||
}
|
||||
else if(key == "action"){
|
||||
let disabled = "";
|
||||
if(row.entered > 0){
|
||||
disabled = " disabled"
|
||||
}
|
||||
let content = `<button type="button" class="btn btn-sm btn-primary" onclick="participateForTraining(${row["id"]}, '${row["employee_id"]}', true)" ${disabled}>${getTranslation("participate")}</button>`
|
||||
|
||||
return `
|
||||
<td>
|
||||
${content}
|
||||
</td>`;
|
||||
}
|
||||
else if(key == "passed"){
|
||||
let content = "";
|
||||
|
||||
if(row[key] == -1){
|
||||
content = `
|
||||
<button type="button" class="btn btn-sm btn-error" onclick="trainingPassed(0, '${row["employee_id"]}', '${row["id"]}', true)">
|
||||
<i class="fa-solid fa-xmark"></i>
|
||||
</button>
|
||||
<button type="button" class="btn btn-sm btn-success" onclick="trainingPassed(1, '${row["employee_id"]}', '${row["id"]}', true)">
|
||||
<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{
|
||||
return `<td>${row[key]}</td>`;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue