mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-25 20:46:48 +00:00
26 lines
604 B
JavaScript
26 lines
604 B
JavaScript
import { Controller } from "stimulus";
|
|
export default class extends Controller {
|
|
static targets = ["paymentMethod"];
|
|
|
|
connect() {
|
|
this.hideAll();
|
|
}
|
|
|
|
selectPaymentMethod(event) {
|
|
this.hideAll();
|
|
const paymentMethodContainerId = event.target.dataset.paymentmethodId;
|
|
const paymentMethodContainer = document.getElementById(
|
|
paymentMethodContainerId
|
|
);
|
|
paymentMethodContainer.style.display = "block";
|
|
}
|
|
|
|
hideAll() {
|
|
Array.from(
|
|
document.getElementsByClassName("paymentmethod-container")
|
|
).forEach((e) => {
|
|
e.style.display = "none";
|
|
});
|
|
}
|
|
}
|