mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-02 21:57:17 +00:00
24 lines
549 B
JavaScript
24 lines
549 B
JavaScript
import { Controller } from "stimulus";
|
|
|
|
// Handles form elements for selecting previously saved Stripe cards from a list of cards
|
|
|
|
export default class extends Controller {
|
|
static targets = ["stripeelements", "select"];
|
|
|
|
connect() {
|
|
this.selectCard(this.selectTarget.value);
|
|
}
|
|
|
|
onSelectCard(event) {
|
|
this.selectCard(event.target.value);
|
|
}
|
|
|
|
selectCard(cardValue) {
|
|
if (cardValue == "") {
|
|
this.stripeelementsTarget.style.display = "block";
|
|
} else {
|
|
this.stripeelementsTarget.style.display = "none";
|
|
}
|
|
}
|
|
}
|