forked from openfoodfoundation/openfoodnetwork
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cut form object and remove dependency of form fields on the form obje…
…ct (f).
- Loading branch information
1 parent
3056389
commit 52b4dc1
Showing
1 changed file
with
18 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,20 @@ | ||
%div#voucher-section | ||
= form_with url: checkout_update_path(:payment), model: order, method: :put, data: { remote: "true" } do |f| | ||
- if order.distributor.vouchers.present? | ||
.checkout-title | ||
= t("split_checkout.step2.voucher.apply_voucher") | ||
- if order.distributor.vouchers.present? | ||
.checkout-title | ||
= t("split_checkout.step2.voucher.apply_voucher") | ||
|
||
.checkout-input | ||
.two-columns-inputs.voucher{"data-controller": "toggle-button-disabled"} | ||
- if voucher_adjustment.present? | ||
%span.button.voucher-added | ||
%i.ofn-i_051-check-big | ||
= t("split_checkout.step2.voucher.voucher", voucher_amount: voucher_adjustment.originator.display_value) | ||
= link_to t("split_checkout.step2.voucher.remove_code"), voucher_adjustment_path(id: voucher_adjustment.id), method: "delete", data: { confirm: t("split_checkout.step2.voucher.confirm_delete") } | ||
- # This might not be true, ie payment method including a fee which wouldn't be covered by voucher or tax implication raising total to be bigger than the voucher amount ? | ||
- if voucher_adjustment.originator.value > order.total | ||
.checkout-input | ||
%span.formError.standalone | ||
= t("split_checkout.step2.voucher.warning_forfeit_remaining_amount") | ||
- else | ||
= f.text_field :voucher_code, data: { action: "input->toggle-button-disabled#inputIsChanged", }, placeholder: t("split_checkout.step2.voucher.placeholder") , class: "voucher" | ||
= f.submit t("split_checkout.step2.voucher.apply"), disabled: true, class: "button cancel voucher", data: { "toggle-button-disabled-target": "button" }, id: "testdisable" | ||
.checkout-input | ||
.two-columns-inputs.voucher{"data-controller": "toggle-button-disabled"} | ||
- if voucher_adjustment.present? | ||
%span.button.voucher-added | ||
%i.ofn-i_051-check-big | ||
= t("split_checkout.step2.voucher.voucher", voucher_amount: voucher_adjustment.originator.display_value) | ||
= link_to t("split_checkout.step2.voucher.remove_code"), voucher_adjustment_path(id: voucher_adjustment.id), method: "delete", data: { confirm: t("split_checkout.step2.voucher.confirm_delete") } | ||
- # This might not be true, ie payment method including a fee which wouldn't be covered by voucher or tax implication raising total to be bigger than the voucher amount ? | ||
- if voucher_adjustment.originator.value > order.total | ||
.checkout-input | ||
%span.formError.standalone | ||
= t("split_checkout.step2.voucher.warning_forfeit_remaining_amount") | ||
- else | ||
= text_field_tag "[order][voucher_code]", params.dig(:order, :voucher_code), data: { action: "input->toggle-button-disabled#inputIsChanged", }, placeholder: t("split_checkout.step2.voucher.placeholder") , class: "voucher" | ||
= submit_tag t("split_checkout.step2.voucher.apply"), disabled: true, class: "button cancel voucher", data: { "toggle-button-disabled-target": "button" }, id: "testdisable" |