mirror of
https://github.com/we-promise/sure.git
synced 2026-04-20 12:34:12 +00:00
* feat: add currency management for families with enabled currencies * feat: update currency selection logic and improve accessibility * feat: update currency preferences to use group moniker in titles --------- Signed-off-by: Ang Wei Feng (Ted) <hello@tedawf.com> Signed-off-by: Juan José Mata <juanjo.mata@gmail.com> Co-authored-by: Juan José Mata <juanjo.mata@gmail.com>
32 lines
643 B
JavaScript
32 lines
643 B
JavaScript
import { Controller } from "@hotwired/stimulus";
|
|
|
|
export default class extends Controller {
|
|
static targets = ["dialog", "checkbox"];
|
|
static values = {
|
|
baseCurrency: String,
|
|
};
|
|
|
|
open() {
|
|
this.dialogTarget.showModal();
|
|
}
|
|
|
|
selectAll() {
|
|
this.checkboxTargets.forEach((checkbox) => {
|
|
checkbox.checked = true;
|
|
});
|
|
}
|
|
|
|
selectBaseOnly() {
|
|
this.checkboxTargets.forEach((checkbox) => {
|
|
checkbox.checked = checkbox.value === this.baseCurrencyValue;
|
|
});
|
|
}
|
|
|
|
handleSubmitEnd(event) {
|
|
if (!event.detail.success) return;
|
|
if (!this.dialogTarget.open) return;
|
|
|
|
this.dialogTarget.close();
|
|
}
|
|
}
|