Set purchase date and price

This commit is contained in:
2025-02-04 17:03:39 +01:00
parent 195f18f141
commit f0cec23da9
17 changed files with 228 additions and 16 deletions

View File

@@ -1,5 +1,6 @@
// Generic state changer with visual feedback
// Tooltips require boostrap.Tooltip
// Tooltips requires boostrap.Tooltip
// Date requires vanillajs-datepicker
class BrickChanger {
constructor(prefix, id, url, parent = undefined) {
this.prefix = prefix
@@ -51,6 +52,20 @@ class BrickChanger {
changer.change();
})(this));
}
// Date picker
this.picker = undefined;
if (this.html_element.dataset.changerDate == "true") {
this.picker = new Datepicker(this.html_element, {
buttonClass: 'btn',
format: 'yyyy/mm/dd',
});
// Picker fires a custom "changeDate" event
this.html_element.addEventListener("changeDate", ((changer) => (e) => {
changer.change();
})(this));
}
}
// Clean the status