Default shipping address same as billing address, rendering data panel for pickup info

This commit is contained in:
Will Marshall
2014-03-12 13:20:50 +11:00
parent 3ec80aaaa3
commit a1ed951931
2 changed files with 7 additions and 4 deletions

View File

@@ -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 = ->

View File

@@ -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?