Update payment methods form

This commit is contained in:
Matt-Yorkley
2021-08-10 15:38:35 +01:00
parent 8f7c3a9369
commit a631d057f1
2 changed files with 6 additions and 2 deletions

View File

@@ -81,7 +81,8 @@ class SplitCheckoutController < ::BaseController
params.require(:order).permit(
:email, :shipping_method_id, :special_instructions,
bill_address_attributes: PermittedAttributes::Address.attributes,
ship_address_attributes: PermittedAttributes::Address.attributes
ship_address_attributes: PermittedAttributes::Address.attributes,
payments_attributes: [:payment_method_id]
)
end

View File

@@ -1,11 +1,14 @@
%div.checkout-substep{"data": {"controller": "paymentmethod"}}
%div.checkout-substep{"data-controller": "paymentmethod"}
%div.checkout-title
= t("split_checkout.step2.payment_method.title")
- selected_payment_method = @order.payments&.with_state(:checkout)&.first&.payment_method_id
- available_payment_methods.each do |payment_method|
%div.checkout-input
= f.radio_button :payment_method_id, payment_method.id,
name: "order[payments_attributes][][payment_method_id]",
id: "payment_method_#{payment_method.id}",
name: "order[payments_attributes][][payment_method_id]",
checked: (payment_method.id == selected_payment_method),
"data-action": "paymentmethod#selectPaymentMethod",
"data-paymentmethod-description": "#{payment_method.description}"
= f.label payment_method.id, "#{payment_method.name} (#{payment_method_price(payment_method, @order)})", {for: "payment_method_" + payment_method.id.to_s }