Plan UI: confirm on unsaved changes (#12797)
This commit is contained in:
parent
b88c310142
commit
82aa5d9598
3 changed files with 12 additions and 0 deletions
|
|
@ -224,12 +224,22 @@ export default {
|
|||
this.modal = Modal.getOrCreateInstance(this.$refs.modal);
|
||||
this.$refs.modal.addEventListener("show.bs.modal", this.modalVisible);
|
||||
this.$refs.modal.addEventListener("hidden.bs.modal", this.modalInvisible);
|
||||
this.$refs.modal.addEventListener("hide.bs.modal", this.checkUnsavedOnClose);
|
||||
},
|
||||
unmounted() {
|
||||
this.$refs.modal?.removeEventListener("show.bs.modal", this.modalVisible);
|
||||
this.$refs.modal?.removeEventListener("hidden.bs.modal", this.modalInvisible);
|
||||
this.$refs.modal?.removeEventListener("hide.bs.modal", this.checkUnsavedOnClose);
|
||||
},
|
||||
methods: {
|
||||
checkUnsavedOnClose: function () {
|
||||
const $applyButton = this.$refs.modal.querySelector("[data-testid=plan-apply]");
|
||||
if ($applyButton) {
|
||||
if (confirm(this.$t("main.chargingPlan.unsavedChanges"))) {
|
||||
$applyButton.click();
|
||||
}
|
||||
}
|
||||
},
|
||||
modalVisible: function () {
|
||||
this.isModalVisible = true;
|
||||
},
|
||||
|
|
|
|||
|
|
@ -208,6 +208,7 @@ time = "Zeit"
|
|||
title = "Plan"
|
||||
titleMinSoc = "Min. Ladung"
|
||||
titleTargetCharge = "Abfahrt"
|
||||
unsavedChanges = "Ungespeicherte Änderungen vorhanden. Jetzt anwenden?"
|
||||
update = "Anwenden"
|
||||
|
||||
[main.energyflow]
|
||||
|
|
|
|||
|
|
@ -205,6 +205,7 @@ time = "Time"
|
|||
title = "Plan"
|
||||
titleMinSoc = "Min charge"
|
||||
titleTargetCharge = "Departure"
|
||||
unsavedChanges = "There are unsaved changes. Apply now?"
|
||||
update = "Apply"
|
||||
|
||||
[main.energyflow]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue