diff --git a/.gitignore b/.gitignore index 92a6e2f14..9fee9bdd0 100644 --- a/.gitignore +++ b/.gitignore @@ -8,7 +8,8 @@ public/css/vendor *.iml public/css/app/style.css public/css/app/style.css.map -public/js/app/shared/app-config.js +public/js/app/shared/app-config. +public/js/app/shared/i18n/lang/*.json .idea coverage/ config/config.js diff --git a/Readme.md b/Readme.md index 46802fc53..6ef587419 100644 --- a/Readme.md +++ b/Readme.md @@ -50,7 +50,17 @@ This will launch a storefront for an existing project against the "prod" environ Now, let's create a new project for your specific site so that you can modify your store and product offering as you see fit. ### 1. Sign up for your a new store and configure it -If you haven't done so already, create a new storefront project and obtain subscriptions for the services. +If you haven't done so already, create a new storefront project and obtain subscriptions to all the commerce packages in order to enable and ensure that the storefront works end to end. +The commerce packages are: + +- **Cart** +- **Checkout** +- **Coupon Management** +- **Customer Accounts** +- **Order Management** +- **Product Content** +- **Site Management** + Follow the steps outlined in the [Dev Portal](https://devportal.yaas.io/gettingstarted/setupastorefront/index.html). ### 2. Replace the default project id in the code base with your own (see project adminstration settings in the Builder). diff --git a/bower.json b/bower.json index 58e39a400..7db45b86d 100644 --- a/bower.json +++ b/bower.json @@ -31,11 +31,12 @@ "angular-bootstrap": "~0.11.0", "angular-xeditable": "~0.1.8", "angular-directive.g-signin": "~0.1.2", - "angular-ui-select": "~0.8.2", + "angular-ui-select": "~0.13.2", "angular-sanitize": "~1.3.0", "angular-touch": "~1.3.0", "algoliasearch": "2.9.2", - "yamm3": "1.1.0" + "yamm3": "1.1.0", + "angular-ui-notification": "^0.2.0" }, "install": { "path": { diff --git a/config/karma.conf.js b/config/karma.conf.js index d9fe4e23f..e0b16c08d 100644 --- a/config/karma.conf.js +++ b/config/karma.conf.js @@ -27,6 +27,7 @@ module.exports = function(config){ 'public/js/vendor/angular-xeditable/dist/js/xeditable.js', 'public/js/vendor/angular-sanitize/angular-sanitize.js', 'public/js/vendor/angular-ui-select/dist/select.min.js', + 'public/js/vendor/angular-ui-notification/dist/angular-ui-notification.min.js', 'public/js/vendor/angular-directive.g-signin/google-plus-signin.js', 'public/js/vendor/algoliasearch/dist/algoliasearch.angular.js', @@ -65,6 +66,9 @@ module.exports = function(config){ 'public/js/app/shared/directives/y-inputs-dir.js', 'public/js/app/shared/directives/force-scroll.js', + 'public/js/app/shared/media/main-media-extractor.js', + 'public/js/app/shared/media/committed-media-filter.js', + 'public/js/app/home/home-index.js', 'public/js/app/home/controllers/home-ctrl.js', 'public/js/app/home/services/home-svc.js', @@ -83,9 +87,11 @@ module.exports = function(config){ 'public/js/app/cart/cart-index.js', 'public/js/app/cart/controllers/cart-ctrl.js', + 'public/js/app/cart/controllers/cart-note-mixin-ctrl.js', 'public/js/app/cart/directives/cart-auto-toggle.js', 'public/js/app/cart/services/cart-service.js', 'public/js/app/cart/services/cart-rest.js', + 'public/js/app/cart/services/cart-note-mixin-service.js', 'public/js/app/checkout/checkout-index.js', 'public/js/app/checkout/controllers/checkout-ctrl.js', diff --git a/manifest-demo.yml b/manifest-demo.yml index 5522f2cca..aae24ca10 100644 --- a/manifest-demo.yml +++ b/manifest-demo.yml @@ -2,7 +2,9 @@ applications: - name: teststore command: npm run-script multiProd - buildpack: https://github.com/ddollar/heroku-buildpack-multi.git + buildpack: https://github.com/heroku/heroku-buildpack-nodejs.git memory: 1024M + disk_quota: 1024M + disk: 1024M instances: 1 path: dist/ \ No newline at end of file diff --git a/manifest-dev.yml b/manifest-dev.yml index 89e9a1401..d994aa05d 100644 --- a/manifest-dev.yml +++ b/manifest-dev.yml @@ -2,8 +2,10 @@ applications: - name: shops command: npm run-script multiTest - buildpack: https://github.com/ddollar/heroku-buildpack-multi.git + buildpack: https://github.com/heroku/heroku-buildpack-nodejs.git memory: 1024M + disk_quota: 1024M + disk: 1024M host: shops domain: dev.cf.hybris.com instances: 1 diff --git a/manifest-stage.yml b/manifest-stage.yml index 8a32a237f..19864c78a 100644 --- a/manifest-stage.yml +++ b/manifest-stage.yml @@ -2,8 +2,10 @@ applications: - name: shops command: npm run-script multiStage - buildpack: https://github.com/ddollar/heroku-buildpack-multi.git + buildpack: https://github.com/heroku/heroku-buildpack-nodejs.git memory: 1024M + disk_quota: 1024M + disk: 1024M host: shops domain: stage.yaas.io instances: 1 diff --git a/manifest-test.yml b/manifest-test.yml index 6b3c69b81..cb39ade35 100644 --- a/manifest-test.yml +++ b/manifest-test.yml @@ -2,7 +2,9 @@ applications: - name: bsdtestproject command: npm run-script startServer - buildpack: https://github.com/ddollar/heroku-buildpack-multi.git + buildpack: https://github.com/heroku/heroku-buildpack-nodejs.git memory: 1024M + disk_quota: 1024M + disk: 1024M instances: 1 path: dist/ \ No newline at end of file diff --git a/manifest.yml b/manifest.yml index 5b1c91165..75482a442 100644 --- a/manifest.yml +++ b/manifest.yml @@ -2,7 +2,9 @@ applications: - name: shops-green command: npm run-script multiProd - buildpack: https://github.com/ddollar/heroku-buildpack-multi.git + buildpack: https://github.com/heroku/heroku-buildpack-nodejs.git memory: 1024M + disk_quota: 1024M + disk: 1024M instances: 1 path: dist \ No newline at end of file diff --git a/package.json b/package.json index 8e0abb2b4..140c957e4 100644 --- a/package.json +++ b/package.json @@ -28,9 +28,9 @@ "bower": "latest", "compression": "1.4.1", "express": "~4.4.2", - "grunt": "latest", + "grunt": "0.4.5", "grunt-angular-templates": "0.5.7", - "grunt-cli": "latest", + "grunt-cli": "1.2.0", "grunt-concurrent": "~0.4.3", "grunt-contrib-clean": "~0.5.0", "grunt-contrib-compass": "~0.7.2", @@ -53,7 +53,6 @@ "jade": "~1.3.1", "load-grunt-tasks": "~0.2.0", "request": "~2.36.0" - }, "devDependencies": { "grunt-contrib-watch": "^0.5.3", diff --git a/public/img/fb_signInLogo-mobile.png b/public/img/fb_signInLogo-mobile.png new file mode 100644 index 000000000..e62e6b33e Binary files /dev/null and b/public/img/fb_signInLogo-mobile.png differ diff --git a/public/img/g_signInLogo-mobile.png b/public/img/g_signInLogo-mobile.png new file mode 100644 index 000000000..0cdc9a506 Binary files /dev/null and b/public/img/g_signInLogo-mobile.png differ diff --git a/public/img/g+_signInLogo.png b/public/img/g_signInLogo.png similarity index 100% rename from public/img/g+_signInLogo.png rename to public/img/g_signInLogo.png diff --git a/public/index.html b/public/index.html index 1ba5ce836..38d07e4dd 100644 --- a/public/index.html +++ b/public/index.html @@ -10,6 +10,7 @@ + @@ -56,6 +57,7 @@ + @@ -63,6 +65,7 @@ + @@ -95,6 +98,10 @@ + + + + @@ -116,9 +123,11 @@ + + @@ -146,6 +155,7 @@ + diff --git a/public/js/app/account/controllers/change-email-confirmation-ctrl.js b/public/js/app/account/controllers/change-email-confirmation-ctrl.js new file mode 100644 index 000000000..c76e2eaf2 --- /dev/null +++ b/public/js/app/account/controllers/change-email-confirmation-ctrl.js @@ -0,0 +1,35 @@ +/** + * [y] hybris Platform + * + * Copyright (c) 2000-2016 hybris AG + * All rights reserved. + * + * This software is the confidential and proprietary information of hybris + * ("Confidential Information"). You shall not disclose such Confidential + * Information and shall use it only in accordance with the terms of the + * license agreement you entered into with hybris. + */ + +'use strict'; + +angular.module('ds.account') + .controller('ChangeEmailConfirmationCtrl', ['$scope', '$stateParams', 'AccountSvc', 'AuthSvc', '$translate', + function ($scope, $stateParams, AccountSvc, AuthSvc, $translate) { + + $scope.token = $stateParams.token; + $scope.confirmed = false; + + AccountSvc.confirmEmailUpdate($scope.token) + .then(function () { + + //Sign out user + AuthSvc.signOut(); + + //Message that email is changed successfully + $scope.confirmed = true; + }, function (error) { + console.log(error); + //Message that there is error, and to try again or etc? + $scope.error = $translate.instant('EDIT_EMAIL_SOMETHING_WENT_WRONG'); + }); + }]); \ No newline at end of file diff --git a/public/js/app/account/controllers/modals/edit-user-email-dialog-ctrl.js b/public/js/app/account/controllers/modals/edit-user-email-dialog-ctrl.js index 6544bbe17..42f16a4b9 100644 --- a/public/js/app/account/controllers/modals/edit-user-email-dialog-ctrl.js +++ b/public/js/app/account/controllers/modals/edit-user-email-dialog-ctrl.js @@ -14,22 +14,40 @@ 'use strict'; angular.module('ds.account') - .controller('EditUserEmailDialogCtrl', ['$scope', 'account', 'AccountSvc', '$modalInstance', - function ($scope, account, AccountSvc, $modalInstance) { + .controller('EditUserEmailDialogCtrl', ['$scope', 'account', 'AccountSvc', '$modalInstance', '$translate', + function ($scope, account, AccountSvc, $modalInstance, $translate) { - $scope.account = angular.copy(account); + $scope.account = account; + $scope.error = ''; + $scope.step = 1; $scope.closeEditUserDialog = function () { $modalInstance.dismiss('cancel'); }; $scope.updateUserInfo = function () { - var account = angular.copy($scope.account); + + //Force sync of email address + $scope.account.syncContactEmail = true; - AccountSvc.updateAccount(account).then(function () { - $modalInstance.close(account); + AccountSvc.updateEmail($scope.account).then(function () { + $scope.step = 2; + }, function (error) { + if (error.status === 401) { + $scope.error = $translate.instant('EDIT_EMAIL_PASSWORD_NOT_CORRECT'); + } + else if(error.status === 409) { + $scope.error = $translate.instant('EDIT_EMAIL_ALREADY_IN_USE'); + } + else { + $scope.error = $translate.instant('EDIT_EMAIL_SOMETHING_WENT_WRONG'); + } }); }; + $scope.confirm = function () { + $modalInstance.close($scope.account); + }; + }]); })(); \ No newline at end of file diff --git a/public/js/app/account/directives/customer-details/customer-details-ctrl.js b/public/js/app/account/directives/customer-details/customer-details-ctrl.js index defd727e5..3acdfc05e 100644 --- a/public/js/app/account/directives/customer-details/customer-details-ctrl.js +++ b/public/js/app/account/directives/customer-details/customer-details-ctrl.js @@ -37,19 +37,17 @@ }; $scope.editUserEmail = function (account) { - $scope.modalInstance = $modal.open({ + + $modal.open({ templateUrl: 'js/app/account/templates/modals/edit-user-email-dialog.html', controller: 'EditUserEmailDialogCtrl', resolve: { account: function () { - return account; + return { + email: account.contactEmail + }; } - }, - backdrop: 'static' - }); - - $scope.modalInstance.result.then(function (result) { - $scope.account = result; + } }); }; diff --git a/public/js/app/account/directives/customer-details/customer-details.html b/public/js/app/account/directives/customer-details/customer-details.html index d8c47f7e1..c1ad122d8 100644 --- a/public/js/app/account/directives/customer-details/customer-details.html +++ b/public/js/app/account/directives/customer-details/customer-details.html @@ -31,7 +31,7 @@

{{account.title|translate}} {{account.firstName}} {{account.middleName}} {{account.lastName}}
{{'EMAIL' | translate}} diff --git a/public/js/app/account/services/account-service.js b/public/js/app/account/services/account-service.js index c9eae97df..f6bec57e3 100644 --- a/public/js/app/account/services/account-service.js +++ b/public/js/app/account/services/account-service.js @@ -113,6 +113,27 @@ angular.module('ds.account') } return defAccount.promise; + }, + + /** + * Expected attribute is account containing email, password and newEmail fields. + * Creates POST request to customer service that will initiate change of email. + * Returns a promise of the result. + */ + updateEmail: function (account) { + return AuthREST.Customers.all('me').all('accounts').all('internal').all('email').customPOST(account, 'change'); + }, + + /** + * Expected attribute is token. + * Creates POST request to customer service that will confirm change of email. + * Returns a promise of the result. + */ + confirmEmailUpdate: function (token) { + var data = { + token: token + }; + return AuthREST.Customers.all('me').all('accounts').all('internal').all('email').all('change').customPOST(data, 'confirm'); } }; diff --git a/public/js/app/account/templates/addresses.html b/public/js/app/account/templates/addresses.html index f749ffb85..a22b37b5f 100644 --- a/public/js/app/account/templates/addresses.html +++ b/public/js/app/account/templates/addresses.html @@ -1,5 +1,5 @@
-
+
@@ -32,7 +32,7 @@ {{address.city}}, {{address.state}} {{address.zipCode}}
{{address.country}}
{{address.contactPhone}}
- {{'CANT_BE_SHIPPED' | translate}}
+ {{'CANT_BE_SHIPPED' | translate}}
diff --git a/public/js/app/account/templates/change-email-confirmation.html b/public/js/app/account/templates/change-email-confirmation.html new file mode 100644 index 000000000..97e68cf61 --- /dev/null +++ b/public/js/app/account/templates/change-email-confirmation.html @@ -0,0 +1,34 @@ +
+
+

{{'EDIT_EMAIL_UPDATED'|translate}}

+
+ +
+
+

{{'EDIT_EMAIL_SUCESSFULLY_UPDATED'|translate}}

+

{{'EDIT_EMAIL_CHANGED_MSG'|translate}}

+ +
+ +
+ +
+
+ +
+ +
+
+

{{'OOPS_MSG'|translate}}

+

+ {{'EDIT_EMAIL_CHANGE_FAILED'|translate}} +

+
+ +
+
+
\ No newline at end of file diff --git a/public/js/app/account/templates/modals/edit-user-email-dialog.html b/public/js/app/account/templates/modals/edit-user-email-dialog.html index 566448385..cc3cd9006 100644 --- a/public/js/app/account/templates/modals/edit-user-email-dialog.html +++ b/public/js/app/account/templates/modals/edit-user-email-dialog.html @@ -1,27 +1,55 @@ - + +
+ -
-
@@ -84,7 +76,7 @@ ng-class="{'has-error': billToForm.state.$invalid && (billToForm.state.$dirty || showPristineErrors) }"> + ng-model="order.billTo.state" ng-change="$root.closeCartOnCheckout()" placeholder="({{'OPTIONAL' | translate}})">
@@ -94,7 +86,7 @@ ng-class="{'has-error': billToForm.postal.$invalid && (billToForm.postal.$dirty || showPristineErrors) }">
@@ -104,7 +96,10 @@
+ autocomplete="on" placeholder="({{'OPTIONAL' | translate}})" ng-change="$root.closeCartOnCheckout()">
+ + + \ No newline at end of file diff --git a/public/js/app/addresses/templates/billingGB.html b/public/js/app/addresses/templates/billingGB.html index dd419307a..9b425d047 100644 --- a/public/js/app/addresses/templates/billingGB.html +++ b/public/js/app/addresses/templates/billingGB.html @@ -1,41 +1,32 @@
- - -
- {{'BILLING_ADDRESS' | translate}} -
- - -
-
- -
-
- - -
- -
-
- - -
-
+
-
+
- + + + {{$select.selected.name}} + + + {{item.name}} + + +
+
+ + +
+
+ +
@@ -44,7 +35,7 @@
+ autocomplete="on" placeholder="({{'OPTIONAL' | translate}})" ng-change="$root.closeCartOnCheckout()">
--> @@ -55,7 +46,7 @@ + ng-required="!shipToSameAsBillTo" autocomplete="on" ng-change="$root.closeCartOnCheckout()">
@@ -63,7 +54,7 @@
-
@@ -74,7 +65,7 @@ ng-class="{'has-error': billToForm.city.$invalid && (billToForm.city.$dirty || showPristineErrors) }"> @@ -85,7 +76,7 @@ ng-class="{'has-error': billToForm.postal.$invalid && (billToForm.postal.$dirty || showPristineErrors) }"> @@ -95,7 +86,10 @@
+ autocomplete="on" placeholder="({{'OPTIONAL' | translate}})" ng-change="$root.closeCartOnCheckout()">
+ + + \ No newline at end of file diff --git a/public/js/app/addresses/templates/billingJP.html b/public/js/app/addresses/templates/billingJP.html index 8ecf415ee..45d9e647f 100644 --- a/public/js/app/addresses/templates/billingJP.html +++ b/public/js/app/addresses/templates/billingJP.html @@ -1,41 +1,32 @@
- -
- {{'BILLING_ADDRESS' | translate}} -
+
- -
-
- + +
+
+ + + + {{$select.selected.name}} + + + {{item.name}} + +
-
- - -
+
- +
- - -
-
- - -
-
- - + +
@@ -43,7 +34,7 @@ @@ -54,7 +45,7 @@ ng-class="{'has-error': billToForm.postal.$invalid && (billToForm.postal.$dirty || showPristineErrors) }">
@@ -65,7 +56,7 @@ ng-class="{'has-error': billToForm.province.$invalid && (billToForm.province.$dirty || showPristineErrors) }">
@@ -76,7 +67,7 @@ ng-class="{'has-error': billToForm.city.$invalid && (billToForm.city.$dirty || showPristineErrors) }"> @@ -88,7 +79,7 @@ + ng-model="order.billTo.address2" ng-required="!shipToSameAsBillTo" autocomplete="on" ng-change="$root.closeCartOnCheckout()"> @@ -99,7 +90,7 @@ + ng-required="!shipToSameAsBillTo" autocomplete="on" ng-change="$root.closeCartOnCheckout()"> @@ -107,8 +98,11 @@
-
+ + + \ No newline at end of file diff --git a/public/js/app/addresses/templates/billingUS.html b/public/js/app/addresses/templates/billingUS.html index 6673cbfad..b37be240c 100644 --- a/public/js/app/addresses/templates/billingUS.html +++ b/public/js/app/addresses/templates/billingUS.html @@ -1,49 +1,41 @@
- -
- {{'BILLING_ADDRESS' | translate}} -
- -
-
- -
-
- - -
- - -
-
- - -
-
+
-
+
- + + + {{$select.selected.name}} + + + {{item.name}} + +
+ +
+
+ + +
+
+ @@ -54,7 +46,7 @@ + ng-required="!shipToSameAsBillTo" autocomplete="on" ng-change="$root.closeCartOnCheckout()">
@@ -62,7 +54,7 @@
-
@@ -73,72 +65,24 @@ ng-class="{'has-error': billToForm.city.$invalid && (billToForm.city.$dirty || showPristineErrors) }">
-
+
- + + + {{$select.selected.name}} + + + {{item.name}} + +
@@ -148,7 +92,7 @@ ng-class="{'has-error': billToForm.postal.$invalid && (billToForm.postal.$dirty || showPristineErrors) }">
@@ -158,7 +102,10 @@
+ autocomplete="on" placeholder="({{'OPTIONAL' | translate}})" ng-change="$root.closeCartOnCheckout()">
+ + + \ No newline at end of file diff --git a/public/js/app/addresses/templates/shippingCA.html b/public/js/app/addresses/templates/shippingCA.html index 7a5bc16f0..e613bd65f 100644 --- a/public/js/app/addresses/templates/shippingCA.html +++ b/public/js/app/addresses/templates/shippingCA.html @@ -1,35 +1,40 @@
-
- - -
-
- - -
-
+
-
+
- + + + {{$select.selected.name}} + + + {{item.name}} + +
+ +
+
+ + +
+
+
+ autocomplete="on" placeholder="({{'OPTIONAL' | translate}})" ng-change="$root.closeCartOnCheckout()">
@@ -40,7 +45,7 @@ + ng-required="true" autocomplete="on" ng-change="$root.closeCartOnCheckout()">
@@ -48,7 +53,7 @@
-
@@ -58,40 +63,32 @@
- +
-
+
+ ng-class="{'has-error': shipToForm.state.$invalid && (shipToForm.state.$dirty || showPristineErrors) }"> - + + + {{$select.selected.name}} + + + {{item.name}} + +
+ ng-class="{'has-error': shipToForm.zip.$invalid && ( shipToForm.zip.$dirty || showPristineErrors) }"> - +
@@ -99,7 +96,7 @@
- +
diff --git a/public/js/app/addresses/templates/shippingCN.html b/public/js/app/addresses/templates/shippingCN.html index fd9f547bc..bf3d22d2a 100644 --- a/public/js/app/addresses/templates/shippingCN.html +++ b/public/js/app/addresses/templates/shippingCN.html @@ -1,15 +1,20 @@
-
- +
+ -
+
- + + + {{$select.selected.name}} + + + {{item.name}} + +
@@ -18,7 +23,7 @@
- +
@@ -28,7 +33,7 @@ ng-class="{'has-error': shipToForm.state.$invalid && (shipToForm.state.$dirty || showPristineErrors) }"> + id="stateShip" name="state" ng-required="true" ng-model="order.shipTo.state" autocomplete="on" ng-change="$root.closeCartOnCheckout()">
@@ -38,7 +43,7 @@ ng-class="{'has-error': shipToForm.city.$invalid && (shipToForm.city.$dirty || showPristineErrors) }"> + id="cityShip" name="city" ng-required="true" ng-model="order.shipTo.city" autocomplete="on" ng-change="$root.closeCartOnCheckout()">
@@ -48,8 +53,8 @@ ng-class="{'has-error': shipToForm.streetShip.$invalid && (shipToForm.streetShip$dirty || showPristineErrors) }"> + class="form-control" id="address3Ship" name="streetShip" autocomplete="on" + ng-model="order.shipTo.address1" ng-required="true" ng-change="$root.closeCartOnCheckout()">
@@ -57,19 +62,19 @@
-
- +
- - + ng-class="{'has-error': shipToForm.contactName.$invalid && (shipToForm.contactName.$dirty || showPristineErrors) }"> + +
@@ -78,7 +83,7 @@
+ autocomplete="on" placeholder="({{'OPTIONAL' | translate}})" ng-change="$root.closeCartOnCheckout()">
@@ -87,7 +92,7 @@
+ placeholder="({{'OPTIONAL' | translate}})" ng-change="$root.closeCartOnCheckout()">
diff --git a/public/js/app/addresses/templates/shippingDE.html b/public/js/app/addresses/templates/shippingDE.html index 701f434ee..c266d2d4a 100644 --- a/public/js/app/addresses/templates/shippingDE.html +++ b/public/js/app/addresses/templates/shippingDE.html @@ -1,26 +1,31 @@
-
+
- -
-
- - -
-
- -
+
- + + + {{$select.selected.name}} + + + {{item.name}} + + +
+
+ + +
+
+ +
@@ -29,7 +34,7 @@
+ autocomplete="on" placeholder="({{'OPTIONAL' | translate}})" ng-change="$root.closeCartOnCheckout()">
@@ -40,7 +45,7 @@ + ng-required="true" autocomplete="on" ng-change="$root.closeCartOnCheckout()">
@@ -48,7 +53,7 @@
-
@@ -58,7 +63,7 @@
- +
@@ -67,7 +72,7 @@
- +
@@ -75,7 +80,7 @@
-
diff --git a/public/js/app/addresses/templates/shippingDefault.html b/public/js/app/addresses/templates/shippingDefault.html index 113909545..dfb0dd6c2 100644 --- a/public/js/app/addresses/templates/shippingDefault.html +++ b/public/js/app/addresses/templates/shippingDefault.html @@ -1,28 +1,32 @@
-
+
- -
+ +
- - + ng-class="{'has-error': !shipToForm.country.$viewValue.id && ( shipToForm.country.$dirty || showPristineErrors) }"> + + + + {{$select.selected.name}} + + + {{item.name}} + +
- -
+ +
- - + ng-class="{'has-error': shipToForm.contactName.$invalid && (shipToForm.contactName.$dirty || showPristineErrors) }"> + +
@@ -31,7 +35,7 @@
+ autocomplete="on" placeholder="({{'OPTIONAL' | translate}})" ng-change="$root.closeCartOnCheckout()">
@@ -42,7 +46,7 @@ + ng-required="true" autocomplete="on" ng-change="$root.closeCartOnCheckout()">
@@ -50,7 +54,7 @@
-
@@ -60,16 +64,15 @@
- +
-
+
- +
@@ -79,7 +82,7 @@ ng-class="{'has-error': shipToForm.zip.$invalid && ( shipToForm.zip.$dirty || showPristineErrors) }">
@@ -88,7 +91,7 @@
-
diff --git a/public/js/app/addresses/templates/shippingGB.html b/public/js/app/addresses/templates/shippingGB.html index ab51d26a3..36acc6325 100644 --- a/public/js/app/addresses/templates/shippingGB.html +++ b/public/js/app/addresses/templates/shippingGB.html @@ -1,35 +1,40 @@
-
- - -
-
- - -
-
+
-
+
- + + + {{$select.selected.name}} + + + {{item.name}} + +
+ +
+
+ + +
+
+
+ autocomplete="on" placeholder="({{'OPTIONAL' | translate}})" ng-change="$root.closeCartOnCheckout()">
@@ -40,7 +45,7 @@ + ng-required="true" autocomplete="on" ng-change="$root.closeCartOnCheckout()">
@@ -48,7 +53,7 @@
-
@@ -59,7 +64,7 @@ ng-class="{'has-error': shipToForm.city.$invalid && (shipToForm.city.$dirty || showPristineErrors) }"> + id="cityShip" name="city" ng-required="true" ng-model="order.shipTo.city" autocomplete="on" ng-change="$root.closeCartOnCheckout()">
@@ -69,7 +74,7 @@ ng-class="{'has-error': shipToForm.zip.$invalid && (shipToForm.zip.$dirty || showPristineErrors) }"> @@ -79,7 +84,7 @@
+ placeholder="({{'OPTIONAL' | translate}})" ng-change="$root.closeCartOnCheckout()">
diff --git a/public/js/app/addresses/templates/shippingJP.html b/public/js/app/addresses/templates/shippingJP.html index 48b072f8c..e65dcc08d 100644 --- a/public/js/app/addresses/templates/shippingJP.html +++ b/public/js/app/addresses/templates/shippingJP.html @@ -1,26 +1,31 @@
-
+
- -
-
- - + +
+
+ + + + {{$select.selected.name}} + + + {{item.name}} + +
- -
-
- - + +
+
+ +
@@ -29,7 +34,7 @@
+ autocomplete="on" placeholder="({{'OPTIONAL' | translate}})" ng-change="$root.closeCartOnCheckout()">
@@ -38,7 +43,7 @@
- +
@@ -47,7 +52,7 @@
- +
@@ -56,7 +61,7 @@
- +
@@ -67,7 +72,7 @@ + ng-model="order.shipTo.address2" autocomplete="on" ng-change="$root.closeCartOnCheckout()">
@@ -78,7 +83,7 @@ + autocomplete="on" ng-change="$root.closeCartOnCheckout()">
@@ -86,7 +91,7 @@
-
diff --git a/public/js/app/addresses/templates/shippingUS.html b/public/js/app/addresses/templates/shippingUS.html index b21ff4498..91b56fa68 100644 --- a/public/js/app/addresses/templates/shippingUS.html +++ b/public/js/app/addresses/templates/shippingUS.html @@ -1,28 +1,32 @@
-
+
- -
+ +
- - + ng-class="{'has-error': shipToForm.country.$invalid && ( shipToForm.country.$dirty || showPristineErrors) }"> + + + + {{$select.selected.name}} + + + {{item.name}} + +
- -
+ +
- - + ng-class="{'has-error': shipToForm.contactName.$invalid && (shipToForm.contactName.$dirty || showPristineErrors) }"> + +
@@ -31,7 +35,7 @@
+ autocomplete="on" placeholder="({{'OPTIONAL' | translate}})" ng-change="$root.closeCartOnCheckout()">
@@ -42,7 +46,7 @@ + ng-required="true" autocomplete="on" ng-change="$root.closeCartOnCheckout()">
@@ -50,7 +54,7 @@
-
@@ -60,70 +64,23 @@
- +
-
+
- + + + {{$select.selected.name}} + + + {{item.name}} + +
@@ -133,7 +90,7 @@ ng-class="{'has-error': shipToForm.zip.$invalid && ( shipToForm.zip.$dirty || showPristineErrors) }">
@@ -142,7 +99,7 @@
-
diff --git a/public/js/app/app.js b/public/js/app/app.js index 0bd56e3f7..18582b6ff 100644 --- a/public/js/app/app.js +++ b/public/js/app/app.js @@ -37,6 +37,7 @@ window.app = angular.module('ds.app', [ 'xeditable', 'ngSanitize', 'ui.select', + 'ui-notification', 'ds.ybreadcrumb', 'ds.ytracking', 'ds.localstorage', diff --git a/public/js/app/auth/templates/auth.html b/public/js/app/auth/templates/auth.html index e38bfcb2b..c44bd6766 100644 --- a/public/js/app/auth/templates/auth.html +++ b/public/js/app/auth/templates/auth.html @@ -1,49 +1,78 @@ +
+
+ + +
+
+
+ +
+
-
-

Or

-
- -
-
-
-
{{'SIGN_IN_WITH_FACEBOOK' | translate}}
+ +
+ + +
+
+
+
+
{{'SIGN_IN_WITH_FACEBOOK' | translate}}
+
+
-
-
-
-
+ + +
+
+
+
{{'LOG_IN_WITH_GOOGLE_PLUS' | translate}}
+
+
+
+
+
+ +
+ + +
+

Or

+
+ + + {{'CONTINUE_AS_GUEST' | translate}} + +
diff --git a/public/js/app/cart/controllers/cart-ctrl.js b/public/js/app/cart/controllers/cart-ctrl.js index 833da7291..8ea9a9c08 100644 --- a/public/js/app/cart/controllers/cart-ctrl.js +++ b/public/js/app/cart/controllers/cart-ctrl.js @@ -24,11 +24,12 @@ angular.module('ds.cart') $scope.showTaxEstimation = false; $scope.taxConfiguration = GlobalData.getCurrentTaxConfiguration(); - + $scope.couponCollapsed = true; $scope.taxType = GlobalData.getTaxType(); $scope.calculateTax = CartSvc.getCalculateTax(); + $scope.taxableCountries = GlobalData.getTaxableCountries(); var unbind = $rootScope.$on('cart:updated', function(eve, eveObj){ $scope.cart = eveObj.cart; @@ -103,4 +104,4 @@ angular.module('ds.cart') }; - }]); + }]); \ No newline at end of file diff --git a/public/js/app/cart/controllers/cart-note-mixin-ctrl.js b/public/js/app/cart/controllers/cart-note-mixin-ctrl.js new file mode 100644 index 000000000..7468a7131 --- /dev/null +++ b/public/js/app/cart/controllers/cart-note-mixin-ctrl.js @@ -0,0 +1,64 @@ +/** + * [y] hybris Platform + * + * Copyright (c) 2000-2016 hybris AG + * All rights reserved. + * + * This software is the confidential and proprietary information of hybris + * ("Confidential Information"). You shall not disclose such Confidential + * Information and shall use it only in accordance with the terms of the + * license agreement you entered into with hybris. + */ + +'use strict'; + +angular.module('ds.cart') + .controller('CartNoteMixinCtrl', ['$scope', '$state', 'CartSvc', 'CartNoteMixinSvc', + function($scope, $state, CartSvc, CartNoteMixinSvc) { + + // NOTE mixin + $scope.note = { + noteCollapsed: true, + saveFailed: false, + removeNoteFailed: false, + oldContent: '', + content: '', + + collapseNote: function() { + // reset the variable, if user tries again + this.saveFailed = false; + this.noteCollapsed = true; + }, + + expandNote: function(comment) { + this.content = comment; + this.noteCollapsed = false; + }, + + removeNote: function(item) { + var self = this; + CartNoteMixinSvc.removeNote(item).then(function() { + self.content = ''; + }, function() { + self.removeNoteFailed = true; + }); + }, + + submit: function(item) { + var self = this; + + // Saving a blank comment is equivalent to removing the comment + if (self.content === ''){ + self.removeNote(item); + } else { + CartNoteMixinSvc.updateNote(item, self.content) + .then(function() { + self.collapseNote(); + }, function() { + self.saveFailed = true; + }); + } + } + }; + } + ]); \ No newline at end of file diff --git a/public/js/app/cart/directives/cart-auto-toggle.js b/public/js/app/cart/directives/cart-auto-toggle.js index 9e21d5a82..c16a10fd5 100644 --- a/public/js/app/cart/directives/cart-auto-toggle.js +++ b/public/js/app/cart/directives/cart-auto-toggle.js @@ -1,7 +1,7 @@ /** * [y] hybris Platform * - * Copyright (c) 2000-2015 hybris AG + * Copyright (c) 2000-2016 hybris AG * All rights reserved. * * This software is the confidential and proprietary information of hybris diff --git a/public/js/app/cart/services/cart-note-mixin-service.js b/public/js/app/cart/services/cart-note-mixin-service.js new file mode 100644 index 000000000..3c2ea00b0 --- /dev/null +++ b/public/js/app/cart/services/cart-note-mixin-service.js @@ -0,0 +1,71 @@ +/** + * [y] hybris Platform + * + * Copyright (c) 2000-2016 hybris AG + * All rights reserved. + * + * This software is the confidential and proprietary information of hybris + * ("Confidential Information"). You shall not disclose such Confidential + * Information and shall use it only in accordance with the terms of the + * license agreement you entered into with hybris. + */ + +'use strict'; + +angular.module('ds.cart') +.factory('CartNoteMixinSvc', ['CartSvc', 'CartREST', '$q', 'SiteConfigSvc', + function (CartSvc, CartREST, $q, siteConfigSvc) { + + return { + updateNote: function(cartItem, noteContent) { + var updatePromise = $q.defer(); + var noteMixin = { + metadata: { + mixins: { + note: siteConfigSvc.schemas.noteMixinMetadata + } + }, + mixins: { + note: { + comment: noteContent + } + } + }; + + // Get cart info from CartSvc + var cart = CartSvc.getLocalCart(); + + CartREST.Cart.one('carts', cart.id).all('items').customPUT(noteMixin, cartItem.id + '?partial=true').then(function () { + CartSvc.refreshCart(cart.id, 'auto'); + updatePromise.resolve(); + }, function () { + updatePromise.reject(); + }); + + return updatePromise.promise; + }, + + removeNote: function(cartItem) { + var removeNotePromise = $q.defer(); + var nulledNoteMixin = { + metadata: { + mixins: null + }, + mixins: { + note: null + } + }; + // Get cart info from CartSvc + var cart = CartSvc.getLocalCart(); + + CartREST.Cart.one('carts', cart.id).all('items').customPUT(nulledNoteMixin, cartItem.id + '?partial=true').then(function () { + CartSvc.refreshCart(cart.id, 'auto'); + removeNotePromise.resolve(); + }, function () { + removeNotePromise.reject(); + }); + + return removeNotePromise.promise; + } + }; +}]); diff --git a/public/js/app/cart/services/cart-service.js b/public/js/app/cart/services/cart-service.js index 0323130cd..d62d34342 100644 --- a/public/js/app/cart/services/cart-service.js +++ b/public/js/app/cart/services/cart-service.js @@ -1,7 +1,7 @@ /** * [y] hybris Platform * - * Copyright (c) 2000-2015 hybris AG + * Copyright (c) 2000-2016 hybris AG * All rights reserved. * * This software is the confidential and proprietary information of hybris @@ -85,7 +85,6 @@ angular.module('ds.cart') /** Retrieves the current cart state from the service, updates the local instance * and fires the 'cart:updated' event.*/ function refreshCart(cartId, updateSource, closeCartAfterTimeout) { - var defCart = $q.defer(); var defCartTemp = $q.defer(); @@ -286,6 +285,9 @@ angular.module('ds.cart') } }); }, + + // Exposed for use in mixin services, like cart-note-mixin-service.js + refreshCart: refreshCart, /** Persists the cart instance via PUT request (if qty > 0). Then, reloads that cart * from the API for consistency and in order to display the updated calculations (line item totals, etc). @@ -329,7 +331,7 @@ angular.module('ds.cart') }); }); }, - + /* * Adds a product to the cart, updates the cart (PUT) and then retrieves the updated * cart information (GET). @@ -367,6 +369,12 @@ angular.module('ds.cart') }); }, + removeCoupon: function (cartId, couponId) { + return CartREST.Cart.one('carts', cartId).one('discounts', couponId).remove().then(function () { + refreshCart(cartId, 'manual'); + }); + }, + getCalculateTax: function () { if (!!cart && !!cart.countryCode && !!cart.zipCode) { return { diff --git a/public/js/app/cart/templates/cart-costs.html b/public/js/app/cart/templates/cart-costs.html index 7b69c93bf..34f03f3c2 100644 --- a/public/js/app/cart/templates/cart-costs.html +++ b/public/js/app/cart/templates/cart-costs.html @@ -57,14 +57,17 @@
-
+
- + + + {{$select.selected.name}} + + + {{taxCountry.name}} + +
diff --git a/public/js/app/cart/templates/cart.html b/public/js/app/cart/templates/cart.html index 206d3ace1..61851285d 100644 --- a/public/js/app/cart/templates/cart.html +++ b/public/js/app/cart/templates/cart.html @@ -10,29 +10,29 @@ ~ license agreement you entered into with hybris. -->
- - -
- - -
- -
- - -
- - + + +
+ + +
+ +
+ + +
+ + +
+
- -
- +
{{'CART_EMPTY' | translate}} @@ -45,78 +45,117 @@
-
- - -
- - -
- -
- -
- - -
- - -
- {{'CART_ITEM_UPDATE_ERROR' | translate}} -
- -
- - -
- -
- - -
-
-
- - -
{{item.product.name}}
- - -
{{'ITEM_PRICE' | translate}}: {{item.price.effectiveAmount | currency: currencySymbol}}
- - -
-
- -
- -
+
+ + +
+ + +
+ +
+ +
+ + +
+ + +
+ {{'CART_ITEM_UPDATE_ERROR' | translate}} +
+ +
+ + +
+
-
- -
{{'TOTAL_PRICE' | translate}}: {{ item.itemPrice.amount || 0 | currency: currencySymbol}}
+ +
+
+
+ + +
{{item.product.name}}
+ + +
+ {{'ITEM_PRICE' | translate}}: {{item.price.effectiveAmount | currency: currencySymbol}} +
+ + +
+
+ +
+ +
+
+
+ + +
{{'TOTAL_PRICE' | translate}}: {{ item.itemPrice.amount || 0 | currency: currencySymbol}}
+ + + + +
+ + +
+ +
+ +
+
+ +
+ + +
+
+
+ + + + + +

{{'UNABLE_TO_SAVE_NOTE' | translate}}

+ + + + +
+
+ +
+ +
- - -
- -
- -
-
-
-
- -
-
+
+ +
+
+ diff --git a/public/js/app/checkout/controllers/checkout-ctrl.js b/public/js/app/checkout/controllers/checkout-ctrl.js index b07f7679e..87ef02b79 100644 --- a/public/js/app/checkout/controllers/checkout-ctrl.js +++ b/public/js/app/checkout/controllers/checkout-ctrl.js @@ -33,8 +33,8 @@ angular.module('ds.checkout') * is re-enabled so that the user can make changes and resubmit if needed. * * */ - .controller('CheckoutCtrl', ['$rootScope', '$scope', '$location', '$anchorScroll', 'CheckoutSvc','cart', 'order', '$state', '$modal', 'AuthSvc', 'AccountSvc', 'AuthDialogManager', 'GlobalData', 'ShippingSvc', 'shippingCountries', '$q', 'CartSvc', '$timeout', - function ($rootScope, $scope, $location, $anchorScroll, CheckoutSvc, cart, order, $state, $modal, AuthSvc, AccountSvc, AuthDialogManager, GlobalData, ShippingSvc, shippingCountries, $q, CartSvc, $timeout) { + .controller('CheckoutCtrl', ['$rootScope', '$scope', '$location', '$anchorScroll', 'CheckoutSvc','cart', 'order', '$state', '$modal', 'AuthSvc', 'AccountSvc', 'AuthDialogManager', 'GlobalData', 'ShippingSvc', 'shippingZones', 'shippingCountries', '$q', 'CartSvc', '$timeout', + function ($rootScope, $scope, $location, $anchorScroll, CheckoutSvc, cart, order, $state, $modal, AuthSvc, AccountSvc, AuthDialogManager, GlobalData, ShippingSvc, shippingZones, shippingCountries, $q, CartSvc, $timeout) { $scope.order = order; $scope.displayCart = false; @@ -44,6 +44,7 @@ angular.module('ds.checkout') //Then in the configuration service the CartSvc.refreshCartAfterLogin(account.id); is called, and //this method changes cart. That is the reason cart was empty on refresh //With this implementation we are getting the cart object from service after it is loaded + $scope.shippingZones = shippingZones || []; $scope.currencySymbol = GlobalData.getCurrencySymbol(cart.currency); $scope.user = GlobalData.user; $scope.addresses = []; @@ -77,6 +78,7 @@ angular.module('ds.checkout') var unbind = $rootScope.$on('cart:updated', function (eve, eveObj) { $scope.cart = eveObj.cart; $scope.currencySymbol = GlobalData.getCurrencySymbol($scope.cart.currency); + updateShippingCost($scope.order.shipTo); }); $scope.$on('$destroy', unbind); @@ -89,23 +91,23 @@ angular.module('ds.checkout') }; var populateBillTo = function(address){ - $scope.order.billTo.id = address.id; - $scope.order.billTo.contactName = address.contactName; - $scope.order.billTo.companyName = address.companyName; - $scope.order.billTo.address1 = address.street; - $scope.order.billTo.address2 = address.streetAppendix; + $scope.order.shipTo.id = address.id; + $scope.order.shipTo.contactName = address.contactName; + $scope.order.shipTo.companyName = address.companyName; + $scope.order.shipTo.address1 = address.street; + $scope.order.shipTo.address2 = address.streetAppendix; //checkout requires 2 character country codes if (address.country === 'USA') { address.country = 'US'; } - $scope.order.billTo.country = address.country; - $scope.order.billTo.city = address.city; - $scope.order.billTo.state = address.state; - $scope.order.billTo.zipCode = address.zipCode; - $scope.order.billTo.contactPhone = address.contactPhone; + $scope.order.shipTo.country = address.country; + $scope.order.shipTo.city = address.city; + $scope.order.shipTo.state = address.state; + $scope.order.shipTo.zipCode = address.zipCode; + $scope.order.shipTo.contactPhone = address.contactPhone; - $scope.$emit('localizedAddress:updated', address.country, 'billing'); + $scope.$emit('localizedAddress:updated', address.country, 'shipping'); }; var getAddresses = function() { @@ -117,7 +119,7 @@ angular.module('ds.checkout') $scope.addresses = response; selectedBillingAddress = defaultAddress; selectedShippingAddress = defaultAddress; - if ($scope.isShipToCountry(defaultAddress.country)) { + if ($scope.isShipToCountry(defaultAddress.country) || !$scope.shippingConfigured) { populateBillTo(defaultAddress); } updateShippingCost(defaultAddress); @@ -174,6 +176,8 @@ angular.module('ds.checkout') $scope.submitIsDisabled = false; + $scope.shippingConfigured = ShippingSvc.isShippingConfigured($scope.shippingZones); + // Configure modal "spinner" to block input during checkout processing var ssClass = 'order-processing-dialog', modal = { @@ -257,37 +261,28 @@ angular.module('ds.checkout') }; /** Copy bill-to information to the ship-to properties.*/ - var setShipToSameAsBillTo = function (updateCost) { - if (updateCost) { - if (!$scope.order.billTo.zipCode) { - $scope.order.billTo.zipCode = ''; - } - updateShippingCost($scope.order.billTo); - } - angular.copy($scope.order.billTo, $scope.order.shipTo); - selectedShippingAddress = $scope.order.shipTo; - $scope.$emit('localizedAddress:updated', selectedShippingAddress.country, 'shipping'); + var setBillToSameAsShipTo = function () { + angular.copy($scope.order.shipTo, $scope.order.billTo); + selectedBillingAddress = $scope.order.billTo; + $scope.$emit('localizedAddress:updated', selectedBillingAddress.country, 'billing'); }; - var clearShipTo = function(){ - selectedShippingAddress = {}; - $scope.order.shipTo = {}; - if ($scope.order.billTo.country) { - $scope.order.shipTo.country = $scope.order.billTo.country; + var clearBillTo = function(){ + selectedBillingAddress = {}; + $scope.order.billTo = {}; + if ($scope.order.shipTo.country) { + $scope.order.billTo.country = $scope.order.shipTo.country; } - //$scope.order.shipTo.zipCode = ''; - selectedShippingAddress = $scope.order.shipTo; - $scope.$emit('localizedAddress:updated', selectedShippingAddress.country, 'shipping'); + selectedBillingAddress = $scope.order.billTo; + $scope.$emit('localizedAddress:updated', selectedBillingAddress.country, 'billing'); $scope.shipToSameAsBillTo = false; }; - $scope.toggleShipToSameAsBillTo = function(){ + $scope.toggleBillToSameAsShipTo = function(){ if($scope.shipToSameAsBillTo){ - setShipToSameAsBillTo(true); - $rootScope.shipActive = false; + setBillToSameAsShipTo(); } else { - clearShipTo(); - $rootScope.shipActive = true; + clearBillTo(); } $rootScope.closeCartOnCheckout(); }; @@ -425,7 +420,7 @@ angular.module('ds.checkout') $scope.submitIsDisabled = true; if ($scope.shipToSameAsBillTo) { - setShipToSameAsBillTo(false); + setBillToSameAsShipTo(); } $scope.order.cart = $scope.cart; $scope.order.shipping = angular.fromJson($scope.shippingCost); @@ -448,8 +443,8 @@ angular.module('ds.checkout') } else if (target === $scope.order.shipTo) { selectedShippingAddress = address; - $rootScope.shipActive = true; $scope.$emit('localizedAddress:updated', address.country, 'shipping'); + updateShippingCost($scope.order.shipTo); } addressModalInstance.close(); @@ -463,15 +458,13 @@ angular.module('ds.checkout') target.state = address.state; target.zipCode = address.zipCode; target.contactPhone = address.contactPhone; - if(target === $scope.order.billTo && ($scope.shipToSameAsBillTo === true || _.isEmpty($scope.order.shipTo))){ - setShipToSameAsBillTo(true); + if(target === $scope.order.shipTo && ($scope.shipToSameAsBillTo === true || _.isEmpty($scope.order.billTo))){ + setBillToSameAsShipTo(); } - $scope.shipToSameAsBillTo = _.isEqual($scope.order.billTo, $scope.order.shipTo); - var addressToShip = $rootScope.shipActive ? $scope.order.shipTo : $scope.order.billTo; - updateShippingCost(addressToShip); + $scope.shipToSameAsBillTo = _.isEqual($scope.order.shipTo, $scope.order.billTo); }; - $scope.openAddressDialog = function(target) { + $scope.openAddressDialog = function(target, addType) { addressModalInstance = $modal.open({ templateUrl: './js/app/account/templates/addresses-dialog.html', windowClass: 'addressBookModal', @@ -483,6 +476,7 @@ angular.module('ds.checkout') $scope.showAddressDefault = 6; $scope.showAddressFilter = $scope.showAddressDefault; $scope.target = target; + $scope.addType = addType; }); }] } @@ -503,7 +497,7 @@ angular.module('ds.checkout') }); $scope.updateAddressName = function () { - $scope.$broadcast('myDetails:change', $scope.billToForm); + $scope.$broadcast('myDetails:change', $scope.shipToForm); if (shouldAutoUpdateName) { var fullName = ''; if ($scope.order.account.firstName) { @@ -516,7 +510,15 @@ angular.module('ds.checkout') fullName = fullName + $scope.order.account.lastName; } - $scope.order.billTo.contactName = fullName; + $scope.order.shipTo.contactName = fullName; + } + }; + + $scope.disableAddress = function (country) { + if (!$scope.isShipToCountry(country) && $scope.shippingConfigured && $scope.isDialog && $scope.addType !== 'billing') { + return true; + } else { + return false; } }; @@ -525,9 +527,12 @@ angular.module('ds.checkout') }; $scope.ifShipAddressApplicable = function (address, target) { - var condition = $scope.isShipToCountry(address.country); - if (condition) { - return $scope.selectAddress(address, target); + if ($scope.shippingConfigured && $scope.addType !== 'billing') { + if ($scope.isShipToCountry(address.country)) { + $scope.selectAddress(address, target); + } + } else { + $scope.selectAddress(address, target); } }; @@ -535,7 +540,7 @@ angular.module('ds.checkout') $scope.displayCart = false; }; - $rootScope.$on('preview:order', function (eve, eveObj) { + var unbindPreviewOrder = $rootScope.$on('preview:order', function (eve, eveObj) { previewOrder(eveObj.shipToDone, eveObj.billToDone); }); @@ -544,10 +549,11 @@ angular.module('ds.checkout') }); $rootScope.$on('language:updated', function () { - var addressToShip = $rootScope.shipActive ? $scope.order.shipTo : $scope.order.billTo; - updateShippingCost(addressToShip); + updateShippingCost($scope.order.shipTo); }); + $scope.$on('$destroy', unbindPreviewOrder); + $scope.scrollTo = function (id, yOffset) { $anchorScroll.yOffset = yOffset; var old = $location.hash(); @@ -569,8 +575,7 @@ angular.module('ds.checkout') $scope.messagePreviewOrder = null; if (shipToFormValid && billToFormValid) { var shippingCostObject = angular.fromJson($scope.shippingCost); - var addressToShip = $rootScope.shipActive ? $scope.order.shipTo : $scope.order.billTo; - CartSvc.recalculateCart($scope.cart, addressToShip, shippingCostObject).then( + CartSvc.recalculateCart($scope.cart, $scope.order.shipTo, shippingCostObject).then( function (calculatedCart) { $scope.cart.currency = calculatedCart.currency; $scope.cart.totalTax = calculatedCart.totalTax; @@ -613,6 +618,9 @@ angular.module('ds.checkout') shipToAddress.zipCode = ''; } var address = shipToAddress; + if (!address.zipCode) { + address.zipCode = ''; + } var cart = $scope.cart; if ($scope.isShipToCountry(shipToAddress.country)) { @@ -640,6 +648,7 @@ angular.module('ds.checkout') var shippingCosts = data[0]; $scope.shippingCosts = []; $scope.shippingCost = data[1]; + $scope.currencySymbol = GlobalData.getCurrencySymbol(); for(var j = 0; j < shippingCosts.length; j++){ for (var i = 0; i < shippingCosts[j].methods.length; i++) { var shippingCostObject = {}; @@ -657,4 +666,4 @@ angular.module('ds.checkout') } }; - }]); \ No newline at end of file + }]); diff --git a/public/js/app/checkout/directives/mobile-checkout-wizard.js b/public/js/app/checkout/directives/mobile-checkout-wizard.js index 50a87c186..ac077b719 100644 --- a/public/js/app/checkout/directives/mobile-checkout-wizard.js +++ b/public/js/app/checkout/directives/mobile-checkout-wizard.js @@ -44,9 +44,9 @@ angular.module('ds.checkout') scope.wiz = new Wiz(); /** Mark mobile wizard step 1 "done" - bill-to address information has been entered.*/ - scope.billToDone = function (billToFormValid, form) { + scope.shipToDone = function (shipToFormValid, form, shipToCountry) { scope.$broadcast('submitting:form', form); - if (billToFormValid) { + if (shipToFormValid && shipToCountry) { scope.wiz.step1Done = true; scope.showPristineErrors = false; // guarantee correct scrolling for mobile @@ -58,10 +58,10 @@ angular.module('ds.checkout') }; /** Mark mobile wizard step 2 "done" - the ship-to address has been entered.*/ - scope.shipToDone = function (shipToFormValid, form) { + scope.billToDone = function (billToFormValid, form) { scope.$broadcast('submitting:form', form); // if the ship to form fields are hidden, angular considers them empty - work around that: - if (shipToFormValid || scope.shipToSameAsBillTo) { + if (billToFormValid || scope.shipToSameAsBillTo) { scope.wiz.step2Done = true; scope.showPristineErrors = false; // guarantee correct scrolling for mobile diff --git a/public/js/app/checkout/templates/checkout-form.html b/public/js/app/checkout/templates/checkout-form.html index f974a563a..07110985a 100644 --- a/public/js/app/checkout/templates/checkout-form.html +++ b/public/js/app/checkout/templates/checkout-form.html @@ -1,25 +1,32 @@

{{'SIMPLE_3_STEP_CHECKOUT' | translate}} {{'SIMPLE_4_STEP_CHECKOUT' | translate}} -{{'SECURE_CHECKOUT' | translate}} +{{'SECURE_CHECKOUT' | translate}}

- +

{{'STEP_1_MY_DETAILS' | translate}}

-
+
- + + + {{$select.selected}} + + + {{title}} + +
+ ng-class="{'has-error': shipToForm.firstNameAccount.$invalid && (shipToForm.firstNameAccount.$dirty || showPristineErrors)}"> {{'STEP_1_MY_DETAILS' | translate}}
+ ng-class="{'has-error': shipToForm.middleNameAccount.$invalid && (shipToForm.middleNameAccount.$dirty || showPristineErrors)}"> @@ -36,7 +43,7 @@

{{'STEP_1_MY_DETAILS' | translate}}
+ ng-class="{'has-error': shipToForm.lastNameAccount.$invalid && (shipToForm.lastNameAccount.$dirty || showPristineErrors) }"> {{'STEP_1_MY_DETAILS' | translate}} -
+
{{'PLEASE_ENTER_VALID_EMAIL' | translate}}
+ ng-class="{ 'has-error': !shipToForm.email.focused && shipToForm.email.$invalid && ( shipToForm.email.$dirty || showPristineErrors) }"> - + ng-focus="shipToForm.email.focused=true" + ng-blur="shipToForm.email.focused=false">
- + +
+ {{'SHIPPING_ADDRESS' | translate}} +
+ + +
+
+ +
+
+ +
+ +

- +
-

{{'STEP_2_SHIPPING_INFORMATION' | translate}}

+

{{'STEP_2_BILLING_INFORMATION' | translate}}

- {{'SHIPPING_ADDRESS' | translate}} + {{'BILLING_ADDRESS' | translate}}
- +
- + -
+
{{'DELIVERY_METHOD' | translate}}
-
+
- + + + {{$select.selected.name}} - {{'COST' | translate}}: {{$select.selected.fee.amount | currency : currencySymbol}} + + + {{cost.name}} - {{'COST' | translate}}: {{cost.fee.amount | currency : currencySymbol}} + +
-
@@ -182,22 +206,30 @@

{{'STEP_3_PAYMENT' | translate}} +
- + + + {{$select.selected}} + + + {{month}} + +
-
+
- + + + {{$select.selected}} + + + {{year}} + +
diff --git a/public/js/app/confirmation/templates/confirmation.html b/public/js/app/confirmation/templates/confirmation.html index 507feae60..d70e8d755 100644 --- a/public/js/app/confirmation/templates/confirmation.html +++ b/public/js/app/confirmation/templates/confirmation.html @@ -1,7 +1,10 @@
+ +
{{'ACCOUNT_SUCCESS' | translate}}
+

@@ -9,13 +12,17 @@

+ +
+

{{'ORDER' | translate}} # {{ orderInfo.orderId }}

+

{{'ORDER' | translate}}# {{ orderInfo.orderId }}

-
+

{{'THE_SHIPMENT_IS_SCHEDULED_TO_ARRIVE_AT_THE_FOLLOWING_LOCATION' | translate}}:

@@ -31,6 +38,8 @@

{{'ORDER' | translate}}# {{ ord

+ +
@@ -42,53 +51,86 @@

{{'ORDER' | translate}}# {{ ord

-