From 289da3d42d21e6fc93f3b21eaac33869a5fb3031 Mon Sep 17 00:00:00 2001 From: Konstantin Savosteev Date: Fri, 10 May 2024 10:08:09 +0200 Subject: [PATCH] VCST-509: optional modules (#207) --- module.keep | 2 + .../VirtoCommerce.PricingModule.Core.csproj | 2 +- ...merce.PricingModule.Data.PostgreSql.csproj | 2 +- .../VirtoCommerce.PricingModule.Data.csproj | 4 +- src/VirtoCommerce.PricingModule.Web/Module.cs | 58 ++-- .../Scripts/blades/assignment-list.js | 20 +- .../Scripts/blades/assignment-list.tpl.html | 6 +- .../Scripts/blades/pricelist-item-list.js | 14 +- .../Scripts/blades/pricelist-list.js | 20 +- .../Scripts/blades/pricelist-list.tpl.html | 6 +- .../Scripts/pricing.js | 276 +++++++++--------- .../module.manifest | 4 +- 12 files changed, 217 insertions(+), 197 deletions(-) create mode 100644 module.keep diff --git a/module.keep b/module.keep new file mode 100644 index 00000000..0e0ea8ae --- /dev/null +++ b/module.keep @@ -0,0 +1,2 @@ +VirtoCommerce.ExportModule.Core.dll +VirtoCommerce.ExportModule.Data.dll diff --git a/src/VirtoCommerce.PricingModule.Core/VirtoCommerce.PricingModule.Core.csproj b/src/VirtoCommerce.PricingModule.Core/VirtoCommerce.PricingModule.Core.csproj index 02774106..695ace31 100644 --- a/src/VirtoCommerce.PricingModule.Core/VirtoCommerce.PricingModule.Core.csproj +++ b/src/VirtoCommerce.PricingModule.Core/VirtoCommerce.PricingModule.Core.csproj @@ -17,6 +17,6 @@ - + \ No newline at end of file diff --git a/src/VirtoCommerce.PricingModule.Data.PostgreSql/VirtoCommerce.PricingModule.Data.PostgreSql.csproj b/src/VirtoCommerce.PricingModule.Data.PostgreSql/VirtoCommerce.PricingModule.Data.PostgreSql.csproj index 8ba99172..7094cdb0 100644 --- a/src/VirtoCommerce.PricingModule.Data.PostgreSql/VirtoCommerce.PricingModule.Data.PostgreSql.csproj +++ b/src/VirtoCommerce.PricingModule.Data.PostgreSql/VirtoCommerce.PricingModule.Data.PostgreSql.csproj @@ -5,7 +5,7 @@ enable - + all diff --git a/src/VirtoCommerce.PricingModule.Data/VirtoCommerce.PricingModule.Data.csproj b/src/VirtoCommerce.PricingModule.Data/VirtoCommerce.PricingModule.Data.csproj index ff53fc56..ac29e369 100644 --- a/src/VirtoCommerce.PricingModule.Data/VirtoCommerce.PricingModule.Data.csproj +++ b/src/VirtoCommerce.PricingModule.Data/VirtoCommerce.PricingModule.Data.csproj @@ -16,8 +16,8 @@ - - + + diff --git a/src/VirtoCommerce.PricingModule.Web/Module.cs b/src/VirtoCommerce.PricingModule.Web/Module.cs index 5a5250e8..65ae6702 100644 --- a/src/VirtoCommerce.PricingModule.Web/Module.cs +++ b/src/VirtoCommerce.PricingModule.Web/Module.cs @@ -13,9 +13,10 @@ using VirtoCommerce.ExportModule.Core.Services; using VirtoCommerce.ExportModule.Data.Extensions; using VirtoCommerce.ExportModule.Data.Services; -using VirtoCommerce.Platform.Core.Bus; using VirtoCommerce.Platform.Core.Common; +using VirtoCommerce.Platform.Core.Events; using VirtoCommerce.Platform.Core.ExportImport; +using VirtoCommerce.Platform.Core.Extensions; using VirtoCommerce.Platform.Core.Modularity; using VirtoCommerce.Platform.Core.Security; using VirtoCommerce.Platform.Core.Settings; @@ -40,12 +41,15 @@ namespace VirtoCommerce.PricingModule.Web { - public class Module : IModule, IExportSupport, IImportSupport, IHasConfiguration + public class Module : IModule, IExportSupport, IImportSupport, IHasConfiguration, IHasModuleCatalog { private IApplicationBuilder _applicationBuilder; public ManifestModuleInfo ModuleInfo { get; set; } public IConfiguration Configuration { get; set; } + public IModuleCatalog ModuleCatalog { get; set; } + + private const string GenericExportModuleId = "VirtoCommerce.Export"; public void Initialize(IServiceCollection serviceCollection) { @@ -131,41 +135,43 @@ public void PostInitialize(IApplicationBuilder appBuilder) } //Subscribe for Search configuration changes - var handlerRegistrar = appBuilder.ApplicationServices.GetService(); - handlerRegistrar.RegisterHandler(async (message, _) => await appBuilder.ApplicationServices.GetService().Handle(message)); + appBuilder.RegisterEventHandler(); //Configure Search var moduleConfigurator = appBuilder.ApplicationServices.GetService(); moduleConfigurator.ConfigureSearchAsync().GetAwaiter().GetResult(); - handlerRegistrar.RegisterHandler(async (message, _) => await appBuilder.ApplicationServices.GetService().Handle(message)); - handlerRegistrar.RegisterHandler(async (message, _) => await appBuilder.ApplicationServices.GetService().Handle(message)); - handlerRegistrar.RegisterHandler(async (message, _) => await appBuilder.ApplicationServices.GetService().Handle(message)); + appBuilder.RegisterEventHandler(); + appBuilder.RegisterEventHandler(); + appBuilder.RegisterEventHandler(); foreach (var conditionTree in AbstractTypeFactory.TryCreateInstance().Traverse(x => x.AvailableChildren)) { AbstractTypeFactory.RegisterType(conditionTree.GetType()); } - var exportTypesRegistrar = appBuilder.ApplicationServices.GetService(); - - exportTypesRegistrar.RegisterType( - ExportedTypeDefinitionBuilder.Build() - .WithDataSourceFactory(appBuilder.ApplicationServices.GetService()) - .WithMetadata(typeof(ExportablePrice).GetPropertyNames()) - .WithTabularMetadata(typeof(TabularPrice).GetPropertyNames())); - - exportTypesRegistrar.RegisterType( - ExportedTypeDefinitionBuilder.Build() - .WithDataSourceFactory(appBuilder.ApplicationServices.GetService()) - .WithMetadata(typeof(ExportablePricelist).GetPropertyNames()) - .WithTabularMetadata(typeof(TabularPricelist).GetPropertyNames())); - - exportTypesRegistrar.RegisterType( - ExportedTypeDefinitionBuilder.Build() - .WithDataSourceFactory(appBuilder.ApplicationServices.GetService()) - .WithMetadata(typeof(ExportablePricelistAssignment).GetPropertyNames()) - .WithTabularMetadata(typeof(TabularPricelistAssignment).GetPropertyNames())); + if (ModuleCatalog.IsModuleInstalled(GenericExportModuleId)) + { + var exportTypesRegistrar = appBuilder.ApplicationServices.GetService(); + + exportTypesRegistrar.RegisterType( + ExportedTypeDefinitionBuilder.Build() + .WithDataSourceFactory(appBuilder.ApplicationServices.GetService()) + .WithMetadata(typeof(ExportablePrice).GetPropertyNames()) + .WithTabularMetadata(typeof(TabularPrice).GetPropertyNames())); + + exportTypesRegistrar.RegisterType( + ExportedTypeDefinitionBuilder.Build() + .WithDataSourceFactory(appBuilder.ApplicationServices.GetService()) + .WithMetadata(typeof(ExportablePricelist).GetPropertyNames()) + .WithTabularMetadata(typeof(TabularPricelist).GetPropertyNames())); + + exportTypesRegistrar.RegisterType( + ExportedTypeDefinitionBuilder.Build() + .WithDataSourceFactory(appBuilder.ApplicationServices.GetService()) + .WithMetadata(typeof(ExportablePricelistAssignment).GetPropertyNames()) + .WithTabularMetadata(typeof(TabularPricelistAssignment).GetPropertyNames())); + } } public void Uninstall() diff --git a/src/VirtoCommerce.PricingModule.Web/Scripts/blades/assignment-list.js b/src/VirtoCommerce.PricingModule.Web/Scripts/blades/assignment-list.js index 189bbc37..d4d24ba8 100644 --- a/src/VirtoCommerce.PricingModule.Web/Scripts/blades/assignment-list.js +++ b/src/VirtoCommerce.PricingModule.Web/Scripts/blades/assignment-list.js @@ -1,6 +1,6 @@ angular.module('virtoCommerce.pricingModule') - .controller('virtoCommerce.pricingModule.assignmentListController', ['$scope', 'virtoCommerce.pricingModule.pricelistAssignments', 'platformWebApp.dialogService', 'platformWebApp.uiGridHelper', 'platformWebApp.bladeUtils', 'virtoCommerce.catalogModule.catalogs', '$localStorage', - function ($scope, assignments, dialogService, uiGridHelper, bladeUtils, catalogs, $localStorage) { + .controller('virtoCommerce.pricingModule.assignmentListController', ['$scope', '$injector', 'virtoCommerce.pricingModule.pricelistAssignments', 'platformWebApp.dialogService', 'platformWebApp.uiGridHelper', 'platformWebApp.bladeUtils', 'virtoCommerce.catalogModule.catalogs', '$localStorage', + function ($scope, $injector, assignments, dialogService, uiGridHelper, bladeUtils, catalogs, $localStorage) { $scope.uiGridConstants = uiGridHelper.uiGridConstants; var blade = $scope.blade; var bladeNavigationService = bladeUtils.bladeNavigationService; @@ -12,6 +12,7 @@ angular.module('virtoCommerce.pricingModule') }; var exportDataRequest = angular.copy(defaultDataRequest); var filter = blade.filter = $scope.filter = {}; + blade.exportFeaturesEnabled = $injector.modules['virtoCommerce.exportModule']; blade.refresh = function () { @@ -159,8 +160,11 @@ angular.module('virtoCommerce.pricingModule') return blade.currentEntities && blade.currentEntities.length > 0; }, permission: 'pricing:delete' - }, - { + } + ]; + + if (blade.exportFeaturesEnabled) { + blade.toolbarCommands.push({ name: "platform.commands.export", icon: 'fa fa-upload', canExecuteMethod: function () { @@ -193,11 +197,10 @@ angular.module('virtoCommerce.pricingModule') }; bladeNavigationService.showBlade(newBlade, blade); } - } - ]; + }); + } filter.criteriaChanged = function () { - if ($scope.pageSettings.currentPage > 1) { blade.refresh(); $scope.pageSettings.currentPage = 1; @@ -205,6 +208,7 @@ angular.module('virtoCommerce.pricingModule') blade.refresh(); } }; + // ui-grid $scope.setGridOptions = function (gridOptions) { $scope.gridOptions = gridOptions; @@ -250,7 +254,7 @@ angular.module('virtoCommerce.pricingModule') $scope.exportSearchFilterId = $localStorage.exportSearchFilterIds[exportDataRequest.exportTypeName]; - if ($scope.exportSearchFilterId) { + if ($scope.exportSearchFilterId && blade.exportFeaturesEnabled) { filter.current = _.findWhere($scope.exportSearchFilters, { id: $scope.exportSearchFilterId }); } diff --git a/src/VirtoCommerce.PricingModule.Web/Scripts/blades/assignment-list.tpl.html b/src/VirtoCommerce.PricingModule.Web/Scripts/blades/assignment-list.tpl.html index 90e5ff72..39f4c761 100644 --- a/src/VirtoCommerce.PricingModule.Web/Scripts/blades/assignment-list.tpl.html +++ b/src/VirtoCommerce.PricingModule.Web/Scripts/blades/assignment-list.tpl.html @@ -1,16 +1,16 @@
-
+
- + {{$select.selected.name | translate}} - +
diff --git a/src/VirtoCommerce.PricingModule.Web/Scripts/blades/pricelist-item-list.js b/src/VirtoCommerce.PricingModule.Web/Scripts/blades/pricelist-item-list.js index 2a41b615..7512f1b4 100644 --- a/src/VirtoCommerce.PricingModule.Web/Scripts/blades/pricelist-item-list.js +++ b/src/VirtoCommerce.PricingModule.Web/Scripts/blades/pricelist-item-list.js @@ -1,5 +1,5 @@ angular.module('virtoCommerce.pricingModule') - .controller('virtoCommerce.pricingModule.pricelistItemListController', ['$scope', 'virtoCommerce.pricingModule.prices', '$filter', 'platformWebApp.bladeNavigationService', 'uiGridConstants', 'platformWebApp.uiGridHelper', 'platformWebApp.bladeUtils', 'platformWebApp.dialogService', '$translate', function ($scope, prices, $filter, bladeNavigationService, uiGridConstants, uiGridHelper, bladeUtils, dialogService, $translate) { + .controller('virtoCommerce.pricingModule.pricelistItemListController', ['$scope', '$injector', 'virtoCommerce.pricingModule.prices', '$filter', 'platformWebApp.bladeNavigationService', 'uiGridConstants', 'platformWebApp.uiGridHelper', 'platformWebApp.bladeUtils', 'platformWebApp.dialogService', '$translate', function ($scope, $injector, prices, $filter, bladeNavigationService, uiGridConstants, uiGridHelper, bladeUtils, dialogService, $translate) { $scope.uiGridConstants = uiGridConstants; $scope.noProductRowName = $translate.instant('pricing.blades.pricelist-item-list.labels.no-product-row-name'); var blade = $scope.blade; @@ -9,6 +9,7 @@ angular.module('virtoCommerce.pricingModule') exportTypeName: 'PriceExportDataQuery' } }; + blade.exportFeaturesEnabled = $injector.modules['virtoCommerce.exportModule']; blade.getSearchCriteria = function() { var result = { @@ -217,8 +218,11 @@ angular.module('virtoCommerce.pricingModule') return $scope.gridApi && _.any($scope.gridApi.selection.getSelectedRows()); }, permission: blade.updatePermission - }, - { + } + ]; + + if (blade.exportFeaturesEnabled) { + blade.toolbarCommands.push({ name: "platform.commands.export", icon: 'fa fa-upload', canExecuteMethod: function () { @@ -227,8 +231,8 @@ angular.module('virtoCommerce.pricingModule') executeMethod: function () { blade.exportPrices(); } - } - ]; + }); + } $scope.getPriceRange = function (priceGroup) { var retVal; diff --git a/src/VirtoCommerce.PricingModule.Web/Scripts/blades/pricelist-list.js b/src/VirtoCommerce.PricingModule.Web/Scripts/blades/pricelist-list.js index 7064ebc7..07c7490c 100644 --- a/src/VirtoCommerce.PricingModule.Web/Scripts/blades/pricelist-list.js +++ b/src/VirtoCommerce.PricingModule.Web/Scripts/blades/pricelist-list.js @@ -1,6 +1,6 @@ angular.module('virtoCommerce.pricingModule') - .controller('virtoCommerce.pricingModule.pricelistListController', ['$scope', 'virtoCommerce.pricingModule.pricelists', 'platformWebApp.dialogService', 'platformWebApp.uiGridHelper', 'platformWebApp.bladeUtils', '$localStorage', - function ($scope, pricelists, dialogService, uiGridHelper, bladeUtils, $localStorage) { + .controller('virtoCommerce.pricingModule.pricelistListController', ['$scope', '$injector', 'virtoCommerce.pricingModule.pricelists', 'platformWebApp.dialogService', 'platformWebApp.uiGridHelper', 'platformWebApp.bladeUtils', '$localStorage', + function ($scope, $injector, pricelists, dialogService, uiGridHelper, bladeUtils, $localStorage) { var blade = $scope.blade; var bladeNavigationService = bladeUtils.bladeNavigationService; @@ -12,6 +12,7 @@ angular.module('virtoCommerce.pricingModule') }; var exportDataRequest = angular.copy(defaultDataRequest); var filter = blade.filter = $scope.filter = {}; + blade.exportFeaturesEnabled = $injector.modules['virtoCommerce.exportModule']; blade.refresh = function (parentRefresh) { blade.isLoading = true; @@ -110,8 +111,11 @@ angular.module('virtoCommerce.pricingModule') }, canExecuteMethod: isItemsChecked, permission: 'pricing:delete' - }, - { + } + ]; + + if ($injector.modules['virtoCommerce.exportModule']) { + blade.toolbarCommands.push({ name: "platform.commands.export", icon: 'fa fa-upload', canExecuteMethod: function () { @@ -145,8 +149,8 @@ angular.module('virtoCommerce.pricingModule') }; bladeNavigationService.showBlade(newBlade, blade); } - } - ]; + }); + } filter.criteriaChanged = function () { if ($scope.pageSettings.currentPage > 1) { @@ -169,8 +173,6 @@ angular.module('virtoCommerce.pricingModule') bladeUtils.initializePagination($scope); }; - - if (!$localStorage.exportSearchFilters) { $localStorage.exportSearchFilters = {}; } @@ -187,7 +189,7 @@ angular.module('virtoCommerce.pricingModule') $scope.exportSearchFilterId = $localStorage.exportSearchFilterIds[exportDataRequest.exportTypeName]; - if ($scope.exportSearchFilterId) { + if ($scope.exportSearchFilterId && blade.exportFeaturesEnabled) { filter.current = _.findWhere($scope.exportSearchFilters, { id: $scope.exportSearchFilterId }); } diff --git a/src/VirtoCommerce.PricingModule.Web/Scripts/blades/pricelist-list.tpl.html b/src/VirtoCommerce.PricingModule.Web/Scripts/blades/pricelist-list.tpl.html index 7ea88dc6..2780d37a 100644 --- a/src/VirtoCommerce.PricingModule.Web/Scripts/blades/pricelist-list.tpl.html +++ b/src/VirtoCommerce.PricingModule.Web/Scripts/blades/pricelist-list.tpl.html @@ -1,16 +1,16 @@
-
+
- + {{$select.selected.name | translate}} - +
diff --git a/src/VirtoCommerce.PricingModule.Web/Scripts/pricing.js b/src/VirtoCommerce.PricingModule.Web/Scripts/pricing.js index 1b2b577b..927f8476 100644 --- a/src/VirtoCommerce.PricingModule.Web/Scripts/pricing.js +++ b/src/VirtoCommerce.PricingModule.Web/Scripts/pricing.js @@ -6,153 +6,155 @@ if (AppDependencies != undefined) { } angular.module(moduleName, ['ui.grid.cellNav', 'ui.grid.edit', 'ui.grid.validate']) -.config( - ['$stateProvider', function ($stateProvider) { - $stateProvider - .state('workspace.pricingModule', { - url: '/pricing', - templateUrl: '$(Platform)/Scripts/common/templates/home.tpl.html', - controller: [ - '$scope', 'platformWebApp.bladeNavigationService', function ($scope, bladeNavigationService) { - var blade = { - id: 'pricing', - title: 'pricing.blades.pricing-main.title', - subtitle: 'pricing.blades.pricing-main.subtitle', - controller: 'virtoCommerce.pricingModule.pricingMainController', - template: 'Modules/$(VirtoCommerce.Pricing)/Scripts/blades/pricing-main.tpl.html', - isClosingDisabled: true - }; - bladeNavigationService.showBlade(blade); - //Need for isolate and prevent conflict module css to other modules - $scope.moduleName = "vc-pricing"; - } - ] - }); - }] -) -.run( - ['$http', '$compile', 'platformWebApp.mainMenuService', 'platformWebApp.widgetService', '$state', 'platformWebApp.authService', 'platformWebApp.metaFormsService', 'virtoCommerce.exportModule.genericViewerItemService', - function ($http, $compile, mainMenuService, widgetService, $state, authService, metaFormsService, genericViewerItemService) { - //Register module in main menu - var menuItem = { - path: 'browse/pricing', - icon: 'fa fa-usd', - title: 'pricing.main-menu-title', - priority: 30, - action: function () { $state.go('workspace.pricingModule'); }, - permission: 'pricing:access' - }; - mainMenuService.addMenuItem(menuItem); + .config( + ['$stateProvider', function ($stateProvider) { + $stateProvider + .state('workspace.pricingModule', { + url: '/pricing', + templateUrl: '$(Platform)/Scripts/common/templates/home.tpl.html', + controller: [ + '$scope', 'platformWebApp.bladeNavigationService', function ($scope, bladeNavigationService) { + var blade = { + id: 'pricing', + title: 'pricing.blades.pricing-main.title', + subtitle: 'pricing.blades.pricing-main.subtitle', + controller: 'virtoCommerce.pricingModule.pricingMainController', + template: 'Modules/$(VirtoCommerce.Pricing)/Scripts/blades/pricing-main.tpl.html', + isClosingDisabled: true + }; + bladeNavigationService.showBlade(blade); + //Need for isolate and prevent conflict module css to other modules + $scope.moduleName = "vc-pricing"; + } + ] + }); + }] + ) + .run( + ['$injector', '$http', '$compile', 'platformWebApp.mainMenuService', 'platformWebApp.widgetService', '$state', 'platformWebApp.authService', 'platformWebApp.metaFormsService', + function ($injector, $http, $compile, mainMenuService, widgetService, $state, authService, metaFormsService) { + //Register module in main menu + var menuItem = { + path: 'browse/pricing', + icon: 'fa fa-usd', + title: 'pricing.main-menu-title', + priority: 30, + action: function () { $state.go('workspace.pricingModule'); }, + permission: 'pricing:access' + }; + mainMenuService.addMenuItem(menuItem); - //Register item prices widget - var itemPricesWidget = { - isVisible: function (blade) { return authService.checkPermission('pricing:read'); }, - controller: 'virtoCommerce.pricingModule.itemPricesWidgetController', - size: [2, 1], - template: 'Modules/$(VirtoCommerce.Pricing)/Scripts/widgets/itemPricesWidget.tpl.html', - }; - widgetService.registerWidget(itemPricesWidget, 'itemDetail'); + //Register item prices widget + var itemPricesWidget = { + isVisible: function (blade) { return authService.checkPermission('pricing:read'); }, + controller: 'virtoCommerce.pricingModule.itemPricesWidgetController', + size: [2, 1], + template: 'Modules/$(VirtoCommerce.Pricing)/Scripts/widgets/itemPricesWidget.tpl.html', + }; + widgetService.registerWidget(itemPricesWidget, 'itemDetail'); - //Register pricelist widgets - widgetService.registerWidget({ - isVisible: function (blade) { return !blade.isNew; }, - controller: 'virtoCommerce.pricingModule.pricesWidgetController', - template: 'Modules/$(VirtoCommerce.Pricing)/Scripts/widgets/pricesWidget.tpl.html', - }, 'pricelistDetail'); - widgetService.registerWidget({ - controller: 'virtoCommerce.pricingModule.assignmentsWidgetController', - template: 'Modules/$(VirtoCommerce.Pricing)/Scripts/widgets/assignmentsWidget.tpl.html', - }, 'pricelistDetail'); + //Register pricelist widgets + widgetService.registerWidget({ + isVisible: function (blade) { return !blade.isNew; }, + controller: 'virtoCommerce.pricingModule.pricesWidgetController', + template: 'Modules/$(VirtoCommerce.Pricing)/Scripts/widgets/pricesWidget.tpl.html', + }, 'pricelistDetail'); + widgetService.registerWidget({ + controller: 'virtoCommerce.pricingModule.assignmentsWidgetController', + template: 'Modules/$(VirtoCommerce.Pricing)/Scripts/widgets/assignmentsWidget.tpl.html', + }, 'pricelistDetail'); - $http.get('Modules/$(VirtoCommerce.Pricing)/Scripts/dynamicConditions/templates.html').then(function (response) { - // compile the response, which will put stuff into the cache - $compile(response.data); - }); + $http.get('Modules/$(VirtoCommerce.Pricing)/Scripts/dynamicConditions/templates.html').then(function (response) { + // compile the response, which will put stuff into the cache + $compile(response.data); + }); - // - metaFormsService.registerMetaFields('VirtoCommerce.PricingModule.Data.ExportImport.ExportablePrice' + 'ExportFilter', [ - { - name: 'pricelistSelector', - title: "pricing.selectors.titles.price-lists", - templateUrl: 'Modules/$(VirtoCommerce.Pricing)/Scripts/selectors/pricelist-selector.tpl.html', - }, - { - name: 'productSelector', - title: "pricing.selectors.titles.products", - templateUrl: 'Modules/$(VirtoCommerce.Pricing)/Scripts/selectors/product-selector.tpl.html', - }, - { - name: 'modifiedSince', - title: "pricing.selectors.titles.modified-since", - valueType: "DateTime" - }]); + metaFormsService.registerMetaFields('VirtoCommerce.PricingModule.Data.ExportImport.ExportablePrice' + 'ExportFilter', [ + { + name: 'pricelistSelector', + title: "pricing.selectors.titles.price-lists", + templateUrl: 'Modules/$(VirtoCommerce.Pricing)/Scripts/selectors/pricelist-selector.tpl.html', + }, + { + name: 'productSelector', + title: "pricing.selectors.titles.products", + templateUrl: 'Modules/$(VirtoCommerce.Pricing)/Scripts/selectors/product-selector.tpl.html', + }, + { + name: 'modifiedSince', + title: "pricing.selectors.titles.modified-since", + valueType: "DateTime" + }]); - metaFormsService.registerMetaFields('VirtoCommerce.PricingModule.Data.ExportImport.ExportablePricelist' + 'ExportFilter', [ - { - name: 'currencySelector', - title: "pricing.selectors.titles.currencies", - templateUrl: 'Modules/$(VirtoCommerce.Pricing)/Scripts/selectors/currency-selector.tpl.html', - }]); + metaFormsService.registerMetaFields('VirtoCommerce.PricingModule.Data.ExportImport.ExportablePricelist' + 'ExportFilter', [ + { + name: 'currencySelector', + title: "pricing.selectors.titles.currencies", + templateUrl: 'Modules/$(VirtoCommerce.Pricing)/Scripts/selectors/currency-selector.tpl.html', + }]); - metaFormsService.registerMetaFields('VirtoCommerce.PricingModule.Data.ExportImport.ExportablePricelistFullData' + 'ExportFilter', [ - { - name: 'currencySelector', - title: "pricing.selectors.titles.currencies", - templateUrl: 'Modules/$(VirtoCommerce.Pricing)/Scripts/selectors/currency-selector.tpl.html', - }]); + metaFormsService.registerMetaFields('VirtoCommerce.PricingModule.Data.ExportImport.ExportablePricelistFullData' + 'ExportFilter', [ + { + name: 'currencySelector', + title: "pricing.selectors.titles.currencies", + templateUrl: 'Modules/$(VirtoCommerce.Pricing)/Scripts/selectors/currency-selector.tpl.html', + }]); - metaFormsService.registerMetaFields('VirtoCommerce.PricingModule.Data.ExportImport.ExportablePricelistAssignment' + 'ExportFilter', [ - { - name: 'pricelistAssignmentSelector', - title: "pricing.selectors.titles.price-lists", - templateUrl: 'Modules/$(VirtoCommerce.Pricing)/Scripts/selectors/pricelist-selector.tpl.html', - }, - { - name: 'catalogSelector', - title: "Select Catalog", - templateUrl: 'Modules/$(VirtoCommerce.Pricing)/Scripts/selectors/catalog-selector.tpl.html', - } - ]); + metaFormsService.registerMetaFields('VirtoCommerce.PricingModule.Data.ExportImport.ExportablePricelistAssignment' + 'ExportFilter', [ + { + name: 'pricelistAssignmentSelector', + title: "pricing.selectors.titles.price-lists", + templateUrl: 'Modules/$(VirtoCommerce.Pricing)/Scripts/selectors/pricelist-selector.tpl.html', + }, + { + name: 'catalogSelector', + title: "Select Catalog", + templateUrl: 'Modules/$(VirtoCommerce.Pricing)/Scripts/selectors/catalog-selector.tpl.html', + } + ]); - genericViewerItemService.registerViewer('Price', function (item) { - var itemCopy = angular.copy(item); + if ($injector.modules['virtoCommerce.exportModule']) { + var genericViewerItemService = $injector.get('virtoCommerce.exportModule.genericViewerItemService'); + genericViewerItemService.registerViewer('Price', function (item) { + var itemCopy = angular.copy(item); - return { - id: 'itemPrices', - itemId: itemCopy.productId, - priceListId: itemCopy.pricelistId, - data: { prices: [itemCopy] }, - currency: itemCopy.currency, - title: 'pricing.blades.prices-list.title', - titleValues: { name: itemCopy.name }, - subtitle: 'pricing.blades.prices-list.subtitle', - controller: 'virtoCommerce.pricingModule.pricesListController', - template: 'Modules/$(VirtoCommerce.Pricing)/Scripts/blades/prices-list.tpl.html' - }; - }); + return { + id: 'itemPrices', + itemId: itemCopy.productId, + priceListId: itemCopy.pricelistId, + data: { prices: [itemCopy] }, + currency: itemCopy.currency, + title: 'pricing.blades.prices-list.title', + titleValues: { name: itemCopy.name }, + subtitle: 'pricing.blades.prices-list.subtitle', + controller: 'virtoCommerce.pricingModule.pricesListController', + template: 'Modules/$(VirtoCommerce.Pricing)/Scripts/blades/prices-list.tpl.html' + }; + }); - genericViewerItemService.registerViewer('Pricelist', function (item) { - var itemCopy = angular.copy(item); + genericViewerItemService.registerViewer('Pricelist', function (item) { + var itemCopy = angular.copy(item); - return { - id: 'listItemChild', - controller: 'virtoCommerce.pricingModule.pricelistDetailController', - template: 'Modules/$(VirtoCommerce.Pricing)/Scripts/blades/pricelist-detail.tpl.html', - currentEntityId: itemCopy.id, - title: itemCopy.name - }; - }); + return { + id: 'listItemChild', + controller: 'virtoCommerce.pricingModule.pricelistDetailController', + template: 'Modules/$(VirtoCommerce.Pricing)/Scripts/blades/pricelist-detail.tpl.html', + currentEntityId: itemCopy.id, + title: itemCopy.name + }; + }); - genericViewerItemService.registerViewer('PricelistAssignment', function (item) { - var itemCopy = angular.copy(item); + genericViewerItemService.registerViewer('PricelistAssignment', function (item) { + var itemCopy = angular.copy(item); - return { - id: 'pricelistAssignmentDetail', - controller: 'virtoCommerce.pricingModule.assignmentDetailController', - template: 'Modules/$(VirtoCommerce.Pricing)/Scripts/blades/assignment-detail.tpl.html', - currentEntityId: itemCopy.id, - title: itemCopy.name, - subtitle: 'pricing.blades.assignment-detail.subtitle' - }; - }); - }]); + return { + id: 'pricelistAssignmentDetail', + controller: 'virtoCommerce.pricingModule.assignmentDetailController', + template: 'Modules/$(VirtoCommerce.Pricing)/Scripts/blades/assignment-detail.tpl.html', + currentEntityId: itemCopy.id, + title: itemCopy.name, + subtitle: 'pricing.blades.assignment-detail.subtitle' + }; + }); + } + }]); diff --git a/src/VirtoCommerce.PricingModule.Web/module.manifest b/src/VirtoCommerce.PricingModule.Web/module.manifest index afc3856b..a6b4f2a3 100644 --- a/src/VirtoCommerce.PricingModule.Web/module.manifest +++ b/src/VirtoCommerce.PricingModule.Web/module.manifest @@ -3,12 +3,12 @@ VirtoCommerce.Pricing 3.803.0 - 3.800.0 + 3.824.0 - + Pricing