Main/resources/[jobs]/[mdt]/myMechanicMDT/html/js/modules/TuningOptions.js
2025-08-14 13:21:51 +02:00

53 lines
No EOL
1.2 KiB
JavaScript

class TuningOptions{
constructor(){
this.name = "tuningoptions";
}
static GetColumns(){
return ["name","price","id"]
}
static allowAddNew(){
return userrights.has("parts_acceptance.edit")
}
static allowEdit(){
return userrights.has("parts_acceptance.edit")
}
static allowDelete(){
return userrights.has("parts_acceptance.delete")
}
static TableDataCreate(row, key){
if(key == "id"){
return `
<td>
${Form.getEditButtonIcon(row[key] , this.name + ".edit", this.allowEdit())}
${Form.getDeleteButtonIcon(row[key], this.name, this.allowDelete())}
</td>`;
}
else if(key == "price"){
return `
<td>
${System.FormatNumber(row[key])}
</td>`;
}
else{
return `<td>${row[key]}</td>`;
}
}
static GetEdit(data={}){
return {
"name": {
"val" : data.name ?? ""
,"type" : "text"
,"isRow": true
,"mandatory":true
},
"price": {
"val" : data.price ?? ""
,"type" : "number"
,"isRow": true
,"mandatory":true
}
}
}
}