class PersonalPage extends Page
{
static routes = {
"Personal": {needRead: true, needWrite: false}
}
static route = "Personal";
static array = {};
static groups = {};
static subs = {
"Abteilungen": {color: "purple", icon: "department.png", entries: []},
"Gruppen": {color: "olive", icon: "group.png", entries: []},
"Lehrgänge": {color: "teal", icon: "skill.png", entries: []},
"Einweisungen": {color: "chocolate", icon: "person.png", entries: []}
};
static selects = {
"Kategorie" : [],
"Funktion" : []
};
static admin = true; // global page admin rights
static prints = [];
static filter = [];
//static selected = [];
//static dropzones = {};
static visible = false;
constructor(groupName, json) {
super(
groupName,
json,
Personal.route,
Personal.array,
Personal.groups,
Personal.subs,
Personal.selects,
Personal.admin/*,
Personal.prints,
Personal.filter,
Personal.selected,
Personal.dropzones*/
);
}
init(json) {
this.OFNr = json.MAIN.OFNR;
this.PNr = json.MAIN.PNR;
this.Nr = json.MAIN.NR;
this.Login = json.MAIN.LOGIN;
this.Email = json.MAIN.EMAIL;
this.Vornamen = json.MAIN.VORNAMEN;
this.Nachnamen = json.MAIN.NACHNAMEN;
this.Name = json.MAIN.NAME;
this.Bild = json.MAIN.BILD;
this.Kategorie = json.MAIN.KATEGORIE;
this.Funktion = json.MAIN.FUNKTION;
}
renderEntry(drawEdit) {
let html = "
";
if (this.Bild.EXISTIERT) {
html+= "

";
if (drawEdit) {
html+= "
";
}
} else {
html+= "

";
}
if (drawEdit) {
html+= "
";
}
html += "
";
// TODO: Draw selectbox
if (drawEdit) {
html+= this.renderField("number.png", this.renderInput("OFNr", this.OFNr, 1.5, 2) + "-" + this.renderInput("PNr", this.PNr, 2, 3))
+ this.renderField("person.png", this.renderInput("Nachnamen", this.Nachnamen) + ", " + this.renderInput("Vornamen", this.Vornamen))
+ this.renderField("type.png", this.renderSelect("Kategorie", this.Kategorie.ID))
+ this.renderField("note.png", this.renderInput("Login", this.Login) + "@feuerwehr-bs.net")
+ this.renderField("star.png", this.renderSelect("Funktion", this.Funktion.ID, 2.5))
+ this.renderButton("save.png", "Save", "Speichern")
+ this.renderButton("delete.png", "Delete", "Löschen")
+ this.renderButton("cancel.png", "Reset", "Zurücksetzen");
} else {
html+= this.renderField("number.png", this.Nr)
+ this.renderField("person.png", "" + this.Nachnamen + ", " + this.Vornamen + "")
+ (this.Login=="" || this.Login===null ? this.renderField("note.png", "Kein Login!") : "")
+ this.renderField("star.png", this.Funktion!==null ? this.Funktion.KÜRZEL : "-");
if (this.admin) {
html += this.renderButton("edit.png", "Edit", "Bearbeiten");
}
}
html+= "
";
document.getElementById(this.marker("Main")).innerHTML = html;
}
static RenderAdd() {
let html = "Fahrzeug hinzufügen
"
+ "";
return html;
}
renderGroup() {
return Personal.RenderGroup(this.groupName);
}
static RenderGroup(groupName) {
return {
begin: "" + groupName + "
",
end: ""
};
}
static New(groupName, json) {
return new Personal(groupName, json);
}
collect() {
return Personal.Collect(this.ID);
}
static Collect(id, contextId = null) {
return {
ID: id,
OFNR: this.Value(id, "OFNr"),
PNR: this.Value(id, "PNr"),
NACHNAMEN: this.Value(id, "Nachnamen"),
VORNAMEN: this.Value(id, "Vornamen"),
KATEGORIE: this.Value(id, "Kategorie"),
LOGIN: this.Value(id, "Login"),
FUNKTION: this.Value(id, "Funktion")
};
}
static RenderSelect(selectId, fahrzeugId, nullable = true) {
let html = "";
return html;
}
}