diff --git a/src/VirtoCommerce.OrdersModule.Web/Localizations/de.VirtoCommerce.Orders.json b/src/VirtoCommerce.OrdersModule.Web/Localizations/de.VirtoCommerce.Orders.json index 0e1e890b..ca49e970 100644 --- a/src/VirtoCommerce.OrdersModule.Web/Localizations/de.VirtoCommerce.Orders.json +++ b/src/VirtoCommerce.OrdersModule.Web/Localizations/de.VirtoCommerce.Orders.json @@ -230,6 +230,9 @@ "items-purchased": "Die Anzahl der gekauften Artikel", "lines-per-order": "Zeilen pro Bestellung", "revenue-per-customer": "Umsatz pro Kunde" + }, + "configuration": { + "title": "Konfiguration" } }, "dialogs": { diff --git a/src/VirtoCommerce.OrdersModule.Web/Localizations/en.VirtoCommerce.Orders.json b/src/VirtoCommerce.OrdersModule.Web/Localizations/en.VirtoCommerce.Orders.json index e839dc62..601e2d07 100644 --- a/src/VirtoCommerce.OrdersModule.Web/Localizations/en.VirtoCommerce.Orders.json +++ b/src/VirtoCommerce.OrdersModule.Web/Localizations/en.VirtoCommerce.Orders.json @@ -44,6 +44,11 @@ "fee-total": "Total fee" } }, + "customerOrder-item-detail": { + "labels": { + "product": "Product name" + } + }, "customerOrder-list": { "title": "Customer orders", "labels": { @@ -194,74 +199,98 @@ "labels": { "transactionId": "Transaction Id", "outerId": "Outer Id" - } - }, - "transactions-list": { - "title": "Payment gateway transactions", - "subtitle": "List of all payment gateway interactions" - }, - "transaction-detail": { - "title": "Transaction details", - "subtitle": "Raw transaction data " - }, - "shipment-detail": { - "title": "Shipment #{{number}}", - "title-new": "New shipment", - "subtitle": "Edit shipment details", - "labels": { - "shipment-method": "Shipment method", - "approved": "Approved", - "shipment-number": "Shipment ID", - "status": "Status", - "fulfillment-center": "Fulfillment center", - "from": "Date and time", - "employee": "Assigned to", - "price": "Shipment amount", - "price-with-tax": "Shipment amount with tax", - "shipment-method-option": "Shipment method", - "tracking-number": "Tracking number", - "tracking-url": "Tracking URL", - "delivery-date": "Delivery date", - "vendor": "Vendor" - }, - "placeholders": { - "status": "Select...", - "shipment-method": "Select...", - "fulfillment-center": "Select or search a center...", - "shipment-method-option": "Default shipment method", - "vendor": "Select..." - } - }, - "shipment-items": { - "title": "{{title}} line items", - "subtitle": "Edit shipment items", - "labels": { - "item": "Item", - "status": "Status", - "quantity": "Qty", - "price": "Price", - "total": "Total" - } - }, - "catalog-items-select": { - "title": "Add item to order" - }, - "newOperation-wizard": { - "title": "New operation", - "subtitle": "Select operation type", - "menu": { - "shipment-operation": { - "description": "Shipment document" + } + }, + "transactions-list": { + "title": "Payment gateway transactions", + "subtitle": "List of all payment gateway interactions" + }, + "transaction-detail": { + "title": "Transaction details", + "subtitle": "Raw transaction data " + }, + "shipment-detail": { + "title": "Shipment #{{number}}", + "title-new": "New shipment", + "subtitle": "Edit shipment details", + "labels": { + "shipment-method": "Shipment method", + "approved": "Approved", + "shipment-number": "Shipment ID", + "status": "Status", + "fulfillment-center": "Fulfillment center", + "from": "Date and time", + "employee": "Assigned to", + "price": "Shipment amount", + "price-with-tax": "Shipment amount with tax", + "shipment-method-option": "Shipment method", + "tracking-number": "Tracking number", + "tracking-url": "Tracking URL", + "delivery-date": "Delivery date", + "vendor": "Vendor" + }, + "placeholders": { + "status": "Select...", + "shipment-method": "Select...", + "fulfillment-center": "Select or search a center...", + "shipment-method-option": "Default shipment method", + "vendor": "Select..." + } + }, + "shipment-items": { + "title": "{{title}} line items", + "subtitle": "Edit shipment items", + "labels": { + "item": "Item", + "status": "Status", + "quantity": "Qty", + "price": "Price", + "total": "Total" + } + }, + "catalog-items-select": { + "title": "Add item to order" + }, + "newOperation-wizard": { + "title": "New operation", + "subtitle": "Select operation type", + "menu": { + "shipment-operation": { + "description": "Shipment document" + }, + "payment-operation": { + "description": "Incoming payment document" + }, + "refund-operation": { + "description": "Refund document" + } + } + }, + "configuration": { + "title": "Configuration", + "labels": { + "picture": "Image", + "quantity": "Quantity", + "product-name": "Product name" }, - "payment-operation": { - "description": "Incoming payment document" + "descr": { + "no-configuration": "This product does not support configuration." + } + }, + "customerOrder-item-discounts": { + "title": "Discounts", + "labels": { + "name": "Name", + "coupon": "Coupon", + "discountAmount": "Discount amount", + "discountAmountWithTax": "Discount amount with tax", + "currency": "Currency" }, - "refund-operation": { - "description": "Refund document" + "descr": { + "no-discounts": "This entity doesn't have any discounts yet." } } - } - }, + }, "widgets": { "notifications": { "title": "Notification feed", @@ -330,6 +359,12 @@ }, "customerOrder-list": { "title": "Orders" + }, + "configuration": { + "title": "Configuration" + }, + "customerOrder-item-discounts": { + "title": "Discounts" } }, "dialogs": { diff --git a/src/VirtoCommerce.OrdersModule.Web/Localizations/ru.VirtoCommerce.Orders.json b/src/VirtoCommerce.OrdersModule.Web/Localizations/ru.VirtoCommerce.Orders.json index 3bb739b4..bc9510dd 100644 --- a/src/VirtoCommerce.OrdersModule.Web/Localizations/ru.VirtoCommerce.Orders.json +++ b/src/VirtoCommerce.OrdersModule.Web/Localizations/ru.VirtoCommerce.Orders.json @@ -239,6 +239,9 @@ "revenue-per-customer": "Доход от одного клиента", "title": "Статистика по заказам", "not-authorized": "Нет доступа. У вас нет доступа к этой функции. Свяжитесь с администратором своей учетной записи для получения доступа." + }, + "configuration": { + "title": "Конфигурация" } }, "dialogs": { diff --git a/src/VirtoCommerce.OrdersModule.Web/Scripts/blades/customerOrder-item-configuration.js b/src/VirtoCommerce.OrdersModule.Web/Scripts/blades/customerOrder-item-configuration.js new file mode 100644 index 00000000..b1cd69fc --- /dev/null +++ b/src/VirtoCommerce.OrdersModule.Web/Scripts/blades/customerOrder-item-configuration.js @@ -0,0 +1,33 @@ +angular.module('virtoCommerce.orderModule') + .controller('virtoCommerce.orderModule.customerOrderItemConfigurationController', [ + '$scope', 'platformWebApp.uiGridHelper', 'platformWebApp.bladeNavigationService', + function ($scope, uiGridHelper, bladeNavigationService) { + var blade = $scope.blade; + blade.title = 'orders.blades.configuration.title'; + blade.headIcon = 'fas fa-sliders'; + + $scope.setGridOptions = function (gridOptions) { + uiGridHelper.initialize($scope, gridOptions, function (gridApi) { + $scope.gridApi = gridApi; + }); + }; + + $scope.selectNode = function (item) { + $scope.selectedNodeId = item.id; + + var newBlade = { + id: "listItemDetail", + controller: 'virtoCommerce.catalogModule.itemDetailController', + template: 'Modules/$(VirtoCommerce.Catalog)/Scripts/blades/item-detail.tpl.html', + title: item.name, + itemId: item.productId + }; + bladeNavigationService.showBlade(newBlade, blade); + } + + function initialize() { + blade.isLoading = false; + } + + initialize(); + }]); diff --git a/src/VirtoCommerce.OrdersModule.Web/Scripts/blades/customerOrder-item-configuration.tpl.html b/src/VirtoCommerce.OrdersModule.Web/Scripts/blades/customerOrder-item-configuration.tpl.html new file mode 100644 index 00000000..d5c41dad --- /dev/null +++ b/src/VirtoCommerce.OrdersModule.Web/Scripts/blades/customerOrder-item-configuration.tpl.html @@ -0,0 +1,35 @@ +
+
+
+
+
+
+
{{ 'orders.blades.configuration.descr.no-configuration' | translate }}
+
+
+
+ + + + \ No newline at end of file diff --git a/src/VirtoCommerce.OrdersModule.Web/Scripts/blades/customerOrder-item-detail.js b/src/VirtoCommerce.OrdersModule.Web/Scripts/blades/customerOrder-item-detail.js new file mode 100644 index 00000000..8e9fd25c --- /dev/null +++ b/src/VirtoCommerce.OrdersModule.Web/Scripts/blades/customerOrder-item-detail.js @@ -0,0 +1,88 @@ +angular.module('virtoCommerce.orderModule') + .controller('virtoCommerce.orderModule.customerOrderItemDetailController', [ + '$scope', 'platformWebApp.bladeNavigationService', 'platformWebApp.authService', + function ($scope, bladeNavigationService, authService) { + var blade = $scope.blade; + blade.updatePermission = 'order:update'; + blade.isVisiblePrices = authService.checkPermission('order:read_prices'); + blade.formScope = null; + blade.metaFields = [ + { + title: "orders.blades.customerOrder-item-detail.labels.product", + colSpan: 2, + templateUrl: "name.html" + }, + { + templateUrl: "status.html" + }, + { + title: "orders.blades.customerOrder-items.labels.quantity", + templateUrl: "quantity.html" + }, + { + title: "orders.blades.customerOrder-items.labels.price", + templateUrl: "price.html" + }, + { + title: "orders.blades.customerOrder-items.labels.priceWithTax", + templateUrl: "priceWithTax.html" + }, + { + title: "orders.blades.customerOrder-items.labels.discount", + templateUrl: "discountAmount.html" + }, + { + title: "orders.blades.customerOrder-items.labels.discountWithTax", + templateUrl: "discountAmountWithTax.html" + }, + { + title: "orders.blades.customerOrder-items.labels.tax", + templateUrl: "taxTotal.html" + }, + { + title: "orders.blades.customerOrder-items.labels.total", + templateUrl: "extendedPriceWithTax.html" + } + ]; + + blade.refresh = function () { + blade.isLoading = false; + }; + + blade.openStatusSettingManagement = function () { + var newBlade = { + id: 'settingDetailChild', + controller: 'platformWebApp.settingDictionaryController', + template: '$(Platform)/Scripts/app/settings/blades/setting-dictionary.tpl.html', + currentEntityId: 'OrderLineItem.Statuses', + isApiSave: true, + }; + bladeNavigationService.showBlade(newBlade, blade); + }; + + blade.recalculate = function() { + if (blade.formScope && blade.formScope.$valid && angular.isFunction(blade.recalculateFn)) { + blade.recalculateFn(); + } + } + + blade.setForm = function (form) { blade.formScope = form; } + + blade.openItemDetail = function () { + var newBlade = { + id: "listItemDetail", + controller: 'virtoCommerce.catalogModule.itemDetailController', + template: 'Modules/$(VirtoCommerce.Catalog)/Scripts/blades/item-detail.tpl.html', + title: blade.currentEntity.name, + itemId: blade.currentEntity.productId, + productType: blade.currentEntity.productType + }; + bladeNavigationService.showBlade(newBlade, blade); + }; + + $scope.$watch("blade.order", function (order) { + blade.currentEntity = _.filter(order.items, function (item) { return item.id === blade.currentEntityId })[0]; + }, true); + + blade.refresh(); + }]); diff --git a/src/VirtoCommerce.OrdersModule.Web/Scripts/blades/customerOrder-item-detail.tpl.html b/src/VirtoCommerce.OrdersModule.Web/Scripts/blades/customerOrder-item-detail.tpl.html new file mode 100644 index 00000000..3d601a2a --- /dev/null +++ b/src/VirtoCommerce.OrdersModule.Web/Scripts/blades/customerOrder-item-detail.tpl.html @@ -0,0 +1,70 @@ +
+
+
+
+
+ +
+
+ +
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/src/VirtoCommerce.OrdersModule.Web/Scripts/blades/customerOrder-item-dicsounts.js b/src/VirtoCommerce.OrdersModule.Web/Scripts/blades/customerOrder-item-dicsounts.js new file mode 100644 index 00000000..1d119b3c --- /dev/null +++ b/src/VirtoCommerce.OrdersModule.Web/Scripts/blades/customerOrder-item-dicsounts.js @@ -0,0 +1,20 @@ +angular.module('virtoCommerce.orderModule') + .controller('virtoCommerce.orderModule.customerOrderItemDiscountController', [ + '$scope', 'platformWebApp.uiGridHelper', + function ($scope, uiGridHelper) { + var blade = $scope.blade; + blade.title = 'orders.blades.customerOrder-item-discounts.title'; + blade.headIcon = 'fa fa-area-chart'; + + $scope.setGridOptions = function (gridOptions) { + uiGridHelper.initialize($scope, gridOptions, function (gridApi) { + $scope.gridApi = gridApi; + }); + }; + + function initialize() { + blade.isLoading = false; + } + + initialize(); + }]); diff --git a/src/VirtoCommerce.OrdersModule.Web/Scripts/blades/customerOrder-item-dicsounts.tpl.html b/src/VirtoCommerce.OrdersModule.Web/Scripts/blades/customerOrder-item-dicsounts.tpl.html new file mode 100644 index 00000000..1f5d946c --- /dev/null +++ b/src/VirtoCommerce.OrdersModule.Web/Scripts/blades/customerOrder-item-dicsounts.tpl.html @@ -0,0 +1,24 @@ +
+
+
+
+
+
+
{{ 'orders.blades.customerOrder-item-discounts.descr.no-discounts' | translate }}
+
+
+
+ + \ No newline at end of file diff --git a/src/VirtoCommerce.OrdersModule.Web/Scripts/blades/customerOrder-items.js b/src/VirtoCommerce.OrdersModule.Web/Scripts/blades/customerOrder-items.js index 24b0ce04..73d8ce1b 100644 --- a/src/VirtoCommerce.OrdersModule.Web/Scripts/blades/customerOrder-items.js +++ b/src/VirtoCommerce.OrdersModule.Web/Scripts/blades/customerOrder-items.js @@ -79,24 +79,16 @@ angular.module('virtoCommerce.orderModule') }); }; - $scope.openItemDynamicProperties = function (item) { - var blade = { - id: "dynamicPropertiesList", - controller: 'platformWebApp.propertyValueListController', - template: '$(Platform)/Scripts/app/dynamicProperties/blades/propertyValue-list.tpl.html', - currentEntity: item, - }; - bladeNavigationService.showBlade(blade, $scope.blade); - }; - - $scope.openItemDetail = function (item) { + $scope.openLineItemDetail = function (item, index) { + blade.selectedNodeId = index; var newBlade = { - id: "listItemDetail", - controller: 'virtoCommerce.catalogModule.itemDetailController', - template: 'Modules/$(VirtoCommerce.Catalog)/Scripts/blades/item-detail.tpl.html', + id: "listLineItemDetail", + controller: 'virtoCommerce.orderModule.customerOrderItemDetailController', + template: 'Modules/$(VirtoCommerce.Orders)/Scripts/blades/customerOrder-item-detail.tpl.html', title: item.name, - itemId: item.productId, - productType: item.productType, + currentEntityId: item.id, + order: blade.currentEntity, + recalculateFn: blade.recalculateFn, }; bladeNavigationService.showBlade(newBlade, $scope.blade); }; @@ -153,7 +145,17 @@ angular.module('virtoCommerce.orderModule') name: "platform.commands.remove", icon: 'fas fa-trash-alt', executeMethod: function () { var lineItems = blade.currentEntity.items; - blade.currentEntity.items = _.difference(lineItems, _.filter(lineItems, function (x) { return x.selected })); + var selectedLineItems = _.filter(lineItems, function (x) { return x.selected; }); + + if (blade.selectedNodeId >= 0) { + var selectedNode = lineItems[blade.selectedNodeId]; + if (selectedNode && _.some(selectedLineItems, lineItem => selectedNode.id === lineItem.id)) { + bladeNavigationService.closeChildrenBlades(blade); + } + } + + blade.currentEntity.items = _.difference(lineItems, selectedLineItems); + blade.selectedAll = false; blade.recalculateFn(); }, canExecuteMethod: function () { @@ -169,5 +171,9 @@ angular.module('virtoCommerce.orderModule') }); }; + $scope.updateSelectedAll = function () { + blade.selectedAll = _.every(blade.currentEntity.items, item => item.selected); + }; + blade.refresh(); }]); diff --git a/src/VirtoCommerce.OrdersModule.Web/Scripts/blades/customerOrder-items.tpl.html b/src/VirtoCommerce.OrdersModule.Web/Scripts/blades/customerOrder-items.tpl.html index a5c3ee88..e49b99a1 100644 --- a/src/VirtoCommerce.OrdersModule.Web/Scripts/blades/customerOrder-items.tpl.html +++ b/src/VirtoCommerce.OrdersModule.Web/Scripts/blades/customerOrder-items.tpl.html @@ -25,23 +25,21 @@ - + -