app/assets/javascripts/sprangular/controllers/checkout.coffee in sprangular-0.0.1 vs app/assets/javascripts/sprangular/controllers/checkout.coffee in sprangular-0.1.0

- old
+ new

@@ -1,31 +1,37 @@ -Sprangular.controller 'CheckoutCtrl', ($scope, $location, countries, order, Status, Account, Cart, Checkout, Angularytics) -> - Status.pageTitle = 'Checkout' +Sprangular.controller 'CheckoutCtrl', ( + $scope, + $location, + countries, + order, + Status, + Account, + Cart, + Checkout, + Angularytics, + Env, + $translate +) -> + Status.setPageTitle('checkout.checkout') + user = Account.user - $scope.countries = countries $scope.order = order - $scope.processing = false - $scope.user = user $scope.secure = $location.protocol() == 'https' - + $scope.currencySymbol = Env.currency.symbol + $scope.shippingAddress = {} + $scope.billingAddress = {} + $scope.shippingValid = false + $scope.billingValid = false + $scope.isValid = false Cart.lastOrder = null - order.resetAddresses(user) - order.resetCreditCard(user) + if !Account.isGuest + $scope.user = user = Account.user + order.resetAddresses(user) + order.resetCreditCard(user) + else + $scope.user = user = {} $scope.removeAdjustment = (adjustment) -> Angularytics.trackEvent("Cart", "Coupon removed", adjustment.promoCode()) Cart.removeAdjustment(adjustment) - - $scope.submit = -> - $scope.processing = true - - if $scope.order.isInvalid() - $scope.processing = false - return - - Checkout.update() - .success -> - $location.path('/checkout/confirm') - .error -> - $scope.processing = false