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,119 @@
|
|||
class CriminalComplaint{
|
||||
constructor(){
|
||||
this.name = "criminalcomplaint";
|
||||
}
|
||||
|
||||
static allowAddNew(){
|
||||
return userrights.has("criminalcomplaint.edit")
|
||||
}
|
||||
static allowEdit(){
|
||||
return userrights.has("criminalcomplaint.edit")
|
||||
}
|
||||
static allowDelete(){
|
||||
return userrights.has("criminalcomplaint.delete")
|
||||
}
|
||||
|
||||
static GetColumns(){
|
||||
return ["charge_from","perpetrator","state","id"]
|
||||
}
|
||||
|
||||
static TableDataCreate(row, key){
|
||||
if(key == "id"){
|
||||
return `
|
||||
<td>
|
||||
${Form.getViewButtonIcon(row[key], this.name + ".view")}
|
||||
${Form.getEditButtonIcon(row[key] , this.name + ".edit", this.allowEdit())}
|
||||
${Form.getDeleteButtonIcon(row[key], this.name, this.allowDelete())}
|
||||
</td>`;
|
||||
}
|
||||
else if(key == "state"){
|
||||
|
||||
let complaint = System.GetComplaintByID(row[key]);
|
||||
|
||||
return `
|
||||
<td>
|
||||
<div class="badge font-bold ${complaint.color ?? ""}">${complaint.name ?? ""}</div>
|
||||
</td>`;
|
||||
}
|
||||
else if(key == "charge_from" || key == "perpetrator"){
|
||||
|
||||
let val = row[key];
|
||||
if(val == ""){
|
||||
val = getTranslation("unknown");
|
||||
}
|
||||
|
||||
|
||||
return `
|
||||
<td>
|
||||
${val}
|
||||
</td>`;
|
||||
}
|
||||
else{
|
||||
return `<td>${row[key]}</td>`;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static GetEdit(data={}){
|
||||
|
||||
let filesOptions = [
|
||||
{"id":-1, "name":getTranslation("unknown")}
|
||||
,{"id":-2, "name":getTranslation("new_file"), "show_extra_field":true}
|
||||
];
|
||||
|
||||
if(sync.isActive("files")){
|
||||
filesOptions = [
|
||||
{"id":-1, "name":getTranslation("unknown")}
|
||||
];
|
||||
}
|
||||
|
||||
let perpetrators = [...filesOptions, ...data.extraData.perpetrators];
|
||||
let charge_froms = [...filesOptions, ...data.extraData.charge_froms];
|
||||
|
||||
return {
|
||||
"charge_from": {
|
||||
"val" : data.charge_from_id ?? "-1"
|
||||
,"type" : "searchdropdown"
|
||||
,"mandatory":true
|
||||
,options:charge_froms
|
||||
}
|
||||
,"perpetrator": {
|
||||
"val" : data.perpetrator_id ?? "-1"
|
||||
,"type" : "searchdropdown"
|
||||
,"mandatory":true
|
||||
,options:perpetrators
|
||||
}
|
||||
,"perpetrator_description":{
|
||||
"val" : data.perpetrator_description ?? ""
|
||||
,"type" : "textarea"
|
||||
,"isRow": true
|
||||
,"mandatory":true
|
||||
,autogrow: false
|
||||
,rows:3
|
||||
}
|
||||
,"state": {
|
||||
"val" : data.state ?? ""
|
||||
,"type" : "dropdown"
|
||||
,"mandatory":true
|
||||
,"isRow":true
|
||||
,options:System.GetCompaintStateOptions()
|
||||
}
|
||||
,"act_of_crime":{
|
||||
"val" : data.act_of_crime ?? ""
|
||||
,"type" : "textarea"
|
||||
,"isRow": true
|
||||
,"mandatory":false
|
||||
,autogrow: false
|
||||
,rows:3
|
||||
}
|
||||
,"notes":{
|
||||
"val" : data.notes ?? ""
|
||||
,"type" : "textarea"
|
||||
,"isRow": true
|
||||
,"mandatory":false
|
||||
,autogrow: false
|
||||
,rows:3
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue