mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-23 05:28:53 +00:00
Default shipping address same as billing address, rendering data panel for pickup info
This commit is contained in:
@@ -1,14 +1,12 @@
|
||||
angular.module("Checkout").controller "CheckoutCtrl", ($scope, $rootScope, order) ->
|
||||
$scope.require_ship_address = false
|
||||
$scope.shipping_method = -1
|
||||
$scope.payment_method = -1
|
||||
$scope.same_as_billing = true
|
||||
$scope.order = order
|
||||
|
||||
|
||||
# Our shipping_methods comes through as a hash like so: {id: requires_shipping_address}
|
||||
# Here we default to the first shipping method if none is selected
|
||||
$scope.order.shipping_method_id ||= Object.keys(order.shipping_methods)[0]
|
||||
$scope.order.ship_address_same_as_billing ||= true
|
||||
$scope.require_ship_address = $scope.order.shipping_methods[$scope.order.shipping_method_id]
|
||||
|
||||
$scope.shippingMethodChanged = ->
|
||||
|
||||
@@ -57,11 +57,16 @@
|
||||
"ng-change" => "shippingMethodChanged()",
|
||||
"ng-model" => "order.shipping_method_id"
|
||||
|
||||
#distributor_address.panel{"ng-show" => "!require_ship_address"}
|
||||
= @order.distributor.distributor_info.andand.html_safe
|
||||
= @order.order_cycle.pickup_time_for(@order.distributor)
|
||||
= @order.order_cycle.pickup_instructions_for(@order.distributor)
|
||||
|
||||
= f.fields_for :ship_address, @order.ship_address do |sa|
|
||||
|
||||
#ship_address{"ng-show" => "require_ship_address"}
|
||||
%label
|
||||
= check_box_tag "order[ship_address_same_as_billing]", true, @order.ship_address_same_as_billing,
|
||||
"ng-checked" => "order.ship_address_same_as_billing == 'true'",
|
||||
"ng-model" => "order.ship_address_same_as_billing"
|
||||
Shipping address same as billing address?
|
||||
|
||||
|
||||
Reference in New Issue
Block a user