From 8abf839d55be4381a4d72e06682a6ba54c6e73d7 Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Tue, 23 Aug 2016 13:36:54 +0100 Subject: [PATCH] Add country to the paypal form. --- services/web/app/views/subscriptions/new.jade | 8 +++++--- .../web/public/coffee/main/new-subscription.coffee | 13 ++++++++----- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/services/web/app/views/subscriptions/new.jade b/services/web/app/views/subscriptions/new.jade index b32fc05b0b..75d806eb7a 100644 --- a/services/web/app/views/subscriptions/new.jade +++ b/services/web/app/views/subscriptions/new.jade @@ -279,6 +279,8 @@ block content ) ? span.input-feedback-message {{ simpleCCForm.cvv.$error.required ? 'This field is required' : 'Please re-check the security code' }} + + div .form-group(ng-class="validation.errorFields.country || inputHasError(simpleCCForm.country) ? 'has-error' : ''") label(for="country") #{translate('country')} select#country.form-control( @@ -290,8 +292,7 @@ block content ) mixin countries_options() span.input-feedback-message {{ simpleCCForm.country.$error.required ? 'This field is required' : '' }} - - div + if (showVatField) .form-group label(for="vat-no") #{translate('vat_number')} @@ -310,6 +311,7 @@ block content ) p(ng-if="paymentMethod === 'paypal'") #{translate("paypal_upgrade")} + div.price-breakdown(ng-if="price.next.tax !== '0.00'") hr.thin span Total: @@ -326,7 +328,7 @@ block content sixpack-convert="payment-left-menu-bottom" ) span(ng-show="processing") - i.fa.fa-refresh.fa-spin + i.fa.fa-spinner.fa-spin |   | {{ paymentMethod === 'credit_card' ? '#{translate("upgrade_cc_btn")}' : '#{translate("upgrade_paypal_btn")}' }} diff --git a/services/web/public/coffee/main/new-subscription.coffee b/services/web/public/coffee/main/new-subscription.coffee index 0cd2dbf372..f5096c06ea 100644 --- a/services/web/public/coffee/main/new-subscription.coffee +++ b/services/web/public/coffee/main/new-subscription.coffee @@ -107,13 +107,16 @@ define [ return (formItem.$touched && formItem.$invalid) $scope.isFormValid = isFormValid = (form) -> - return $scope.paymentMethod == 'paypal' or - (form.$valid and - $scope.validation.correctCardNumber and - $scope.validation.correctExpiry and - $scope.validation.correctCvv) + if $scope.paymentMethod == 'paypal' + return $scope.data.country != "" + else + return (form.$valid and + $scope.validation.correctCardNumber and + $scope.validation.correctExpiry and + $scope.validation.correctCvv) $scope.updateCountry = -> + console.log $scope.data.country pricing.address({country:$scope.data.country}).done() $scope.setPaymentMethod = setPaymentMethod = (method) ->