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: {
|
|
|
|
save: { label: "Enregistrer", callback: html => this.fillData() }
|
|
|
|
},
|
|
|
|
default: "save"
|
|
|
|
};
|
|
|
|
let dialogOptions = { classes: ["rdddialog"], width: 400, height: 'fit-content', 'z-index': 99999 }
|
2020-12-08 21:40:41 +01:00
|
|
|
super(dialogConf, dialogOptions)
|
|
|
|
|
|
|
|
this.calendrier = calendrier;
|
2022-11-17 01:23:53 +01:00
|
|
|
this.calendrierData = calendrierData;
|
2020-12-08 21:40:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
fillData( ) {
|
|
|
|
this.calendrierData.moisKey = $("#nomMois").val();
|
|
|
|
this.calendrierData.heureKey = $("#nomHeure").val();
|
|
|
|
this.calendrierData.jourMois = $("#jourMois").val();
|
|
|
|
this.calendrierData.minutesRelative = $("#minutesRelative").val();
|
|
|
|
|
|
|
|
console.log("UPDATE ", this.calendrierData);
|
|
|
|
this.calendrier.saveEditeur( this.calendrierData )
|
|
|
|
}
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
updateData( calendrierData ) {
|
|
|
|
this.calendrierData = duplicate(calendrierData);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* -------------------------------------------- */
|
|
|
|
activateListeners(html) {
|
|
|
|
super.activateListeners(html);
|
|
|
|
|
|
|
|
let calendrierData = this.calendrierData;
|
|
|
|
|
|
|
|
$(function () {
|
|
|
|
console.log(calendrierData);
|
|
|
|
$("#nomMois").val(calendrierData.moisKey);
|
|
|
|
$("#nomHeure").val(calendrierData.heureKey);
|
|
|
|
$("#jourMois").val(calendrierData.jourMois);
|
|
|
|
$("#minutesRelative").val(calendrierData.minutesRelative);
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|