diff --git a/.gitignore b/.gitignore index 9fee9bdd0..719baadc8 100644 --- a/.gitignore +++ b/.gitignore @@ -15,4 +15,5 @@ coverage/ config/config.js dist .DS_Store -.vscode \ No newline at end of file +.vscode +typings/ \ No newline at end of file diff --git a/config/karma.conf.js b/config/karma.conf.js index 320fb7b7d..8edd0d443 100644 --- a/config/karma.conf.js +++ b/config/karma.conf.js @@ -82,7 +82,12 @@ module.exports = function(config){ 'public/js/app/products/services/price-service.js', 'public/js/app/products/services/price-product-rest.js', 'public/js/app/products/services/category-service.js', - 'public/js/app/products/services/product-attribute-service.js', + 'public/js/app/products/services/product-extension-service.js', + 'public/js/app/products/utils/product-extension-helper.js', + 'public/js/app/products/utils/product-extension-item-helper.js', + 'public/js/app/products/utils/product-factory.js', + 'public/js/app/products/options/product-options-helper.js', + 'public/js/app/products/options/product-options.js', 'public/js/app/cart/cart-index.js', 'public/js/app/cart/controllers/cart-ctrl.js', @@ -123,6 +128,7 @@ module.exports = function(config){ 'public/js/app/account/controllers/account-ctrl.js', 'public/js/app/account/controllers/account-order-detail-ctrl.js', 'public/js/app/account/controllers/dialogs/address-remove-dialog-ctrl.js', + 'public/js/app/account/controllers/dialogs/order-cancel-dialog-ctrl.js', 'public/js/app/account/controllers/modals/edit-user-email-dialog-ctrl.js', 'public/js/app/account/controllers/modals/edit-user-name-dialog-ctrl.js', 'public/js/app/account/directives/customer-details/customer-details-directive.js', diff --git a/config/protractor-conf.js b/config/protractor-conf.js index 051328c0f..2d981111f 100644 --- a/config/protractor-conf.js +++ b/config/protractor-conf.js @@ -7,12 +7,12 @@ exports.config = { sauceKey: process.env.SAUCE_ACCESS_KEY, specs: [ - - '../test/e2e/cart-tests.js', - '../test/e2e/checkout-tests.js', - '../test/e2e/coupon-tests.js', - '../test/e2e/login-tests.js', - '../test/e2e/product-tests.js' + '../test/e2e/cart/cart.spec.js', + '../test/e2e/checkout/checkout.desktop.spec.js', + '../test/e2e/checkout/checkout.mobile.spec.js', + '../test/e2e/coupon/coupon.spec.js', + '../test/e2e/account/account.spec.js', + '../test/e2e/product/product.spec.js' ], @@ -56,7 +56,6 @@ exports.config = { baseUrl: 'https://storefront-demo.yaas.io/', - framework: 'jasmine', jasmineNodeOpts: { diff --git a/package.json b/package.json index 140c957e4..ad4875635 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "grunt-contrib-watch": "0.5.3", "grunt-env": "latest", "grunt-express": "~1.3.5", - "grunt-karma": "~0.8.3", + "grunt-karma": "~2.0.0", "grunt-ngmin": "~0.0.2", "grunt-rev": "~0.1.0", "grunt-text-replace": "0.4.0", @@ -59,7 +59,7 @@ "grunt-json-minify": "^0.4.0", "istanbul": "0.3.0", "jasmine-reporters": "^1.0.0", - "karma": "^0.12.31", + "karma": "~0.13.22", "karma-chrome-launcher": "~0.1.3", "karma-coffee-preprocessor": "^0.1.3", "karma-coverage": "~0.2.1", @@ -70,7 +70,8 @@ "karma-phantomjs-launcher": "^0.1.4", "karma-script-launcher": "~0.1.0", "phantomcss": "^0.4.5", - "phantomjs": "^1.9.15", + "phantomjs": "~2.1.3", + "phantomjs-prebuilt": "~2.1.4", "protractor": "^1.8.0", "protractor-screenshot-reporter": "0.0.5", "resemblejs": "^1.0.1", diff --git a/public/index.html b/public/index.html index 1e3a77bf1..2cfc4e33a 100644 --- a/public/index.html +++ b/public/index.html @@ -95,6 +95,7 @@ + @@ -116,11 +117,15 @@ - - - - + + + + + + + + @@ -158,6 +163,7 @@ + diff --git a/public/js/app/account/controllers/account-ctrl.js b/public/js/app/account/controllers/account-ctrl.js index 5d69937da..b0c9c4252 100644 --- a/public/js/app/account/controllers/account-ctrl.js +++ b/public/js/app/account/controllers/account-ctrl.js @@ -17,6 +17,8 @@ angular.module('ds.account') function ($scope, addresses, account, orders, OrderListSvc, AccountSvc, $modal, GlobalData, $translate) { + var self = this; + self.allOrdersLoaded = false; var modalInstance; var customerNumber = !!account ? account.customerNumber : null; @@ -185,30 +187,27 @@ angular.module('ds.account') $scope.showAllOrdersButton = !$scope.showAllOrdersButton; var parms = { - pageSize: 100 + pageSize: GlobalData.orders.meta.total }; - OrderListSvc.query(parms).then(function (orders) { - $scope.orders = orders; - - // show filtered list or show all orders. Hide if all data is shown within filter. + if (self.allOrdersLoaded) { $scope.showOrdersFilter = $scope.showAllOrdersButton ? $scope.showOrdersDefault : $scope.orders.length; $scope.showOrderButtons = ($scope.orders.length > $scope.showOrdersDefault); - }); + } else { + OrderListSvc.query(parms).then(function (orders) { + $scope.orders = orders; + + // show filtered list or show all orders. Hide if all data is shown within filter. + $scope.showOrdersFilter = $scope.showAllOrdersButton ? $scope.showOrdersDefault : $scope.orders.length; + $scope.showOrderButtons = ($scope.orders.length > $scope.showOrdersDefault); + self.allOrdersLoaded = true; + }); + } }; $scope.showAllAddresses = function () { $scope.showAllAddressButton = !$scope.showAllAddressButton; - - var parms = { - pageSize: GlobalData.addresses.meta.total - }; - AccountSvc.getAddresses(parms).then(function (addresses) { - $scope.addresses = addresses; - - // show filtered list or show all addresses. Hide if all data is shown within filter. - $scope.showAddressFilter = $scope.showAllAddressButton ? $scope.showAddressDefault : $scope.addresses.length; - $scope.showAddressButtons = ($scope.addresses.length > $scope.showAddressDefault); - }); + $scope.showAddressFilter = $scope.showAllAddressButton ? $scope.showAddressDefault : $scope.addresses.length; + $scope.showAddressButtons = ($scope.addresses.length > $scope.showAddressDefault); }; /* diff --git a/public/js/app/account/controllers/account-order-detail-ctrl.js b/public/js/app/account/controllers/account-order-detail-ctrl.js index 1579477aa..a6066ae99 100644 --- a/public/js/app/account/controllers/account-order-detail-ctrl.js +++ b/public/js/app/account/controllers/account-order-detail-ctrl.js @@ -13,7 +13,8 @@ 'use strict'; angular.module('ds.account') - .controller('AccountOrderDetailCtrl', ['$scope', 'order', '$stateParams', 'GlobalData', function($scope, order, $stateParams, GlobalData) { + .controller('AccountOrderDetailCtrl', ['$scope', 'order', '$stateParams', 'GlobalData', '$modal', + function($scope, order, $stateParams, GlobalData, $modal) { $scope.order = order; $scope.order.id = $stateParams.orderId; @@ -38,4 +39,27 @@ angular.module('ds.account') $scope.payment = getPaymentInfo(); + $scope.cancelOrder = function () { + $modal.open({ + templateUrl: 'js/app/account/templates/dialogs/order-cancel-dialog.html', + controller: 'OrderCancelDialogCtrl', + backdrop: 'static', + resolve: { + order: function () { + return order; + } + } + }).result.then(function (response) { + $scope.order.status = response.status; + }); + }; + + $scope.showCancelBtn = function (order) { + if (!!order.status && (order.status === 'CREATED' || order.status === 'CONFIRMED')) { + return true; + } else { + return false; + } + }; + }]); diff --git a/public/js/app/account/controllers/dialogs/order-cancel-dialog-ctrl.js b/public/js/app/account/controllers/dialogs/order-cancel-dialog-ctrl.js new file mode 100644 index 000000000..dbff20a84 --- /dev/null +++ b/public/js/app/account/controllers/dialogs/order-cancel-dialog-ctrl.js @@ -0,0 +1,34 @@ +/** + * [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. + */ +(function () { + 'use strict'; + + angular.module('ds.account') + .controller('OrderCancelDialogCtrl', ['$scope', '$modalInstance', 'order', 'OrderDetailSvc', '$translate', + function ($scope, $modalInstance, order, OrderDetailSvc, $translate) { + + $scope.orderCancelError = ''; + + $scope.cancelOrder = function () { + OrderDetailSvc.cancelOrder(order.id).then(function (response) { + $modalInstance.close({status: response.status}); + }, function () { + $scope.orderCancelError = $translate.instant('ORDER_CANCEL_ERROR'); + }); + }; + + $scope.closeCancelOrderDialog = function () { + $modalInstance.dismiss('cancel'); + }; + + }]); +})(); \ 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 3acdfc05e..d6b15f2e6 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 @@ -14,8 +14,8 @@ 'use strict'; angular.module('ds.account') - .controller('CustomerDetailsCtrl', ['$scope', 'AuthDialogManager', '$modal', - function ($scope, AuthDialogManager, $modal) { + .controller('CustomerDetailsCtrl', ['$scope', 'AuthDialogManager', '$modal', 'AccountSvc', + function ($scope, AuthDialogManager, $modal, AccountSvc) { $scope.modalInstance = {}; @@ -55,6 +55,8 @@ AuthDialogManager.showUpdatePassword(); }; + $scope.isItSocialAccount = AccountSvc.isItSocialAccount($scope.account); + // handle dialog dismissal if user select back button, etc $scope.$on('$destroy', function () { if ($scope.modalInstance && $scope.modalInstance.dismiss) { 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 c1ad122d8..14066ffa6 100644 --- a/public/js/app/account/directives/customer-details/customer-details.html +++ b/public/js/app/account/directives/customer-details/customer-details.html @@ -26,24 +26,25 @@
{{m_order.totalPrice | currency: m_order.currencySymbol}}
{{m_order.status}}
+{{m_order.status | translate}}
{{'THE_SHIPMENT_IS_SCHEDULED_TO_ARRIVE_AT_THE_FOLLOWING_LOCATION' | translate}}:
- + {{confirmationDetails.shippingAddressName}}