2020-12-08 21:40:41 +01:00
|
|
|
import { Misc } from "./misc.js";
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Extend the base Dialog entity by defining a custom window to perform roll.
|
|
|
|
* @extends {Dialog}
|
|
|
|
*/
|
|
|
|
export class RdDCalendrierEditeur extends Dialog {
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
constructor(html, calendrier, calendrierData) {
|
2022-11-17 01:23:53 +01:00
|
|
|
let dialogConf = {
|
|
|
|
content: html,
|
|
|
|
title: "Editeur de date/heure",
|
|
|
|
buttons: {
|
2022-11-25 03:17:07 +01:00
|
|
|
save: { label: "Enregistrer", callback: html => this.fillData() }
|
|
|
|
},
|
2022-11-17 01:23:53 +01:00
|
|
|
default: "save"
|
|
|
|
};
|
2022-11-25 03:17:07 +01:00
|
|
|
let dialogOptions = { classes: ["rdd-dialog-calendar-editor"], width: 400, height: 'fit-content', 'z-index': 99999 }
|
2020-12-08 21:40:41 +01:00
|
|
|
super(dialogConf, dialogOptions)
|
2022-11-25 03:17:07 +01:00
|
|
|
|
2020-12-08 21:40:41 +01:00
|
|
|
this.calendrier = calendrier;
|
2022-11-17 01:23:53 +01:00
|
|
|
this.calendrierData = calendrierData;
|
2020-12-08 21:40:41 +01:00
|
|
|
}
|
|
|
|
|
2022-12-09 02:00:31 +01:00
|
|
|
activateListeners(html) {
|
|
|
|
super.activateListeners(html);
|
|
|
|
this.html = html;
|
|
|
|
this.html.find("input[name='nomMois']").val(this.calendrierData.moisKey);
|
|
|
|
this.html.find("select[name='nomHeure']").val(this.calendrierData.heureKey);
|
|
|
|
this.html.find("select[name='jourMois']").val(this.calendrierData.jourMois);
|
2022-12-20 00:52:32 +01:00
|
|
|
this.html.find("select[name='minutesRelative']").val(this.calendrierData.minutesRelative);
|
2022-12-09 02:00:31 +01:00
|
|
|
this.html.find("select[name='annee']").val(this.calendrierData.annee);
|
|
|
|
}
|
|
|
|
|
2020-12-08 21:40:41 +01:00
|
|
|
/* -------------------------------------------- */
|
2022-11-25 03:17:07 +01:00
|
|
|
fillData() {
|
2022-12-09 02:00:31 +01:00
|
|
|
this.calendrierData.annee = this.html.find("input[name='annee']").val();
|
|
|
|
this.calendrierData.moisKey = this.html.find("select[name='nomMois']").val();
|
|
|
|
this.calendrierData.heureKey = this.html.find("select[name='nomHeure']").val();
|
|
|
|
this.calendrierData.jourMois = this.html.find("select[name='jourMois']").val();
|
|
|
|
this.calendrierData.minutesRelative = this.html.find("select[name='minutesRelative']").val();
|
2022-11-25 03:17:07 +01:00
|
|
|
|
|
|
|
this.calendrier.saveEditeur(this.calendrierData)
|
2020-12-08 21:40:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
2022-11-25 03:17:07 +01:00
|
|
|
updateData(calendrierData) {
|
2020-12-08 21:40:41 +01:00
|
|
|
this.calendrierData = duplicate(calendrierData);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|