import { generateUrl } from "@nextcloud/router"; import { baseUrl, LoadDT, showDone } from "../modules/mainFunction.mjs"; import { showError } from "@nextcloud/dialogs"; export class Trajet { /** * Trajet object * @param myresp instantiate trajet object */ constructor(myresp) { this.id = myresp.id; this.user_id = myresp.user_id; this.id_nextcloud = myresp.id_nextcloud; this.date = ((myresp.date == null || myresp.date.length === 0) ? '-' : myresp.date); this.did = ((myresp.id_depart == null || myresp.id_depart.length === 0) ? '-' : myresp.id_depart); this.aid = ((myresp.id_arrivee == null || myresp.id_arrivee.length === 0) ? '-' : myresp.id_arrivee); this.nom_lieu_depart = ((myresp.nom_lieu_depart == null || myresp.nom_lieu_depart.length === 0) ? '-' : myresp.nom_lieu_depart); this.nom_lieu_arrivee = ((myresp.nom_lieu_arrivee == null || myresp.nom_lieu_arrivee.length === 0) ? '-' : myresp.nom_lieu_arrivee); this.depart_cnom = ((myresp.depart_cnom == null || myresp.depart_cnom.length === 0) ? '-' : myresp.depart_cnom); this.depart_cprenoms = ((myresp.depart_cprenoms == null || myresp.depart_cprenoms.length === 0) ? '-' : myresp.depart_cprenoms); this.arrivee_cnom = ((myresp.arrivee_cnom == null || myresp.arrivee_cnom.length === 0) ? '-' : myresp.arrivee_cnom); this.arrivee_cprenoms = ((myresp.arrivee_cprenoms == null || myresp.arrivee_cprenoms.length === 0) ? '-' : myresp.arrivee_cprenoms); this.distance = ((myresp.distance == null) ? '-' : myresp.distance); this.annee = ((myresp.annee == null || myresp.annee.length === 0) ? '-' : myresp.annee); this.mois = ((myresp.mois == null || myresp.mois.length === 0) ? '-' : Trajet.monthToText(myresp.mois)); this.baseUrl = generateUrl(`/apps/gestion/trajet/${this.id}/details`); this.thanato = ((myresp.nom_thanato == null && myresp.prenom_thanato == null) ? '-' : myresp.nom_thanato+' '+myresp.prenom_thanato); } /**undefined * Get datatable row for a trajet */ getDTRow() { let myrow = [ '