mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-12 03:50:22 +00:00
Set default billing address and shipping address
This commit is contained in:
@@ -14,6 +14,14 @@ Darkswarm.controller "CheckoutCtrl", ($scope, storage, Checkout, CurrentUser, Cu
|
||||
storeName: "#{prefix}_sameasbilling"
|
||||
defaultValue: 'YES'
|
||||
|
||||
storage.bind $scope, "Checkout.default_bill_address",
|
||||
storeName: "#{prefix}_defaultasbilladdress"
|
||||
defaultValue: 'NO'
|
||||
|
||||
storage.bind $scope, "Checkout.default_ship_address",
|
||||
storeName: "#{prefix}_defaultasshipaddress"
|
||||
defaultValue: 'NO'
|
||||
|
||||
$scope.order = Checkout.order # Ordering is important
|
||||
$scope.secrets = Checkout.secrets
|
||||
|
||||
|
||||
@@ -4,6 +4,9 @@ Darkswarm.factory 'Checkout', (CurrentOrder, ShippingMethods, PaymentMethods, $h
|
||||
secrets: {}
|
||||
order: CurrentOrder.order
|
||||
ship_address_same_as_billing: 'YES'
|
||||
default_bill_address: 'NO'
|
||||
default_ship_address: 'NO'
|
||||
|
||||
|
||||
submit: ->
|
||||
Loading.message = t 'submitting_order'
|
||||
@@ -19,7 +22,10 @@ Darkswarm.factory 'Checkout', (CurrentOrder, ShippingMethods, PaymentMethods, $h
|
||||
|
||||
# Rails wants our Spree::Address data to be provided with _attributes
|
||||
preprocess: ->
|
||||
munged_order = {}
|
||||
munged_order =
|
||||
default_bill_address: @default_bill_address
|
||||
default_ship_address: @default_ship_address
|
||||
|
||||
for name, value of @order # Clone all data from the order JSON object
|
||||
switch name
|
||||
when "bill_address"
|
||||
|
||||
Reference in New Issue
Block a user