mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-18 04:39:14 +00:00
Tweaks for laura, reworking authentication workflow, tidying up checkout
This commit is contained in:
@@ -3,4 +3,8 @@ Darkswarm.controller "BillingCtrl", ($scope) ->
|
||||
$scope.name = "billing"
|
||||
$scope.nextPanel = "shipping"
|
||||
|
||||
$scope.summary = ->
|
||||
[$scope.order.bill_address.address1,
|
||||
$scope.order.bill_address.city,
|
||||
$scope.order.bill_address.zipcode]
|
||||
|
||||
|
||||
@@ -3,6 +3,15 @@ Darkswarm.controller "DetailsCtrl", ($scope) ->
|
||||
$scope.name = "details"
|
||||
$scope.nextPanel = "billing"
|
||||
|
||||
$scope.summary = ->
|
||||
[$scope.fullName(),
|
||||
$scope.order.email,
|
||||
$scope.order.bill_address.phone]
|
||||
|
||||
$scope.fullName = ->
|
||||
[$scope.order.bill_address.firstname ? null,
|
||||
$scope.order.bill_address.lastname ? null].join(" ").trim()
|
||||
|
||||
|
||||
#$scope.$watch ->
|
||||
#$scope.detailsValid()
|
||||
|
||||
@@ -1,6 +1,13 @@
|
||||
Darkswarm.filter "printArray", ->
|
||||
Darkswarm.filter "printArrayOfObjects", ->
|
||||
(array, attr = 'name')->
|
||||
array ?= []
|
||||
array.map (a)->
|
||||
a[attr].toLowerCase()
|
||||
.join(", ")
|
||||
|
||||
Darkswarm.filter "printArray", ->
|
||||
(array)->
|
||||
array ?= []
|
||||
output = (item for item in array when item).join ", "
|
||||
output
|
||||
|
||||
|
||||
@@ -4,8 +4,6 @@ Darkswarm.factory 'Order', ($resource, Product, order, $http, CheckoutFormState,
|
||||
|
||||
constructor: ->
|
||||
@order = order
|
||||
# Default to first shipping method if none selected
|
||||
@order.shipping_method_id ||= parseInt(Object.keys(@order.shipping_methods)[0])
|
||||
|
||||
submit: ->
|
||||
$http.put('/checkout', {order: @preprocess()}).success (data, status)=>
|
||||
@@ -35,7 +33,7 @@ Darkswarm.factory 'Order', ($resource, Product, order, $http, CheckoutFormState,
|
||||
munged_order
|
||||
|
||||
shippingMethod: ->
|
||||
@order.shipping_methods[@order.shipping_method_id]
|
||||
@order.shipping_methods[@order.shipping_method_id] if @order.shipping_method_id
|
||||
|
||||
requireShipAddress: ->
|
||||
@shippingMethod()?.require_ship_address
|
||||
|
||||
Reference in New Issue
Block a user