From 100778377b16dd8dd19a38cf6f921b66abf26032 Mon Sep 17 00:00:00 2001 From: Oleg Zhuk Date: Fri, 15 Dec 2023 11:51:33 +0200 Subject: [PATCH] PT-14655: Organization Name is empty (#393) fix: Organization Name is empty --- .../VirtoCommerce.OrdersModule.Core.csproj | 2 +- .../Services/CustomerOrderBuilder.cs | 1 + .../de.VirtoCommerce.Orders.json | 1 + .../en.VirtoCommerce.Orders.json | 1 + .../ru.VirtoCommerce.Orders.json | 1 + .../Scripts/blades/customerOrder-detail.js | 29 ++++++++--- .../blades/customerOrder-detail.tpl.html | 8 +++ .../Scripts/order.js | 49 ++++++++++--------- .../module.manifest | 2 +- 9 files changed, 63 insertions(+), 31 deletions(-) diff --git a/src/VirtoCommerce.OrdersModule.Core/VirtoCommerce.OrdersModule.Core.csproj b/src/VirtoCommerce.OrdersModule.Core/VirtoCommerce.OrdersModule.Core.csproj index 6f64400f..b6e1ba10 100644 --- a/src/VirtoCommerce.OrdersModule.Core/VirtoCommerce.OrdersModule.Core.csproj +++ b/src/VirtoCommerce.OrdersModule.Core/VirtoCommerce.OrdersModule.Core.csproj @@ -15,7 +15,7 @@ - + diff --git a/src/VirtoCommerce.OrdersModule.Data/Services/CustomerOrderBuilder.cs b/src/VirtoCommerce.OrdersModule.Data/Services/CustomerOrderBuilder.cs index d4bb269f..d457791f 100644 --- a/src/VirtoCommerce.OrdersModule.Data/Services/CustomerOrderBuilder.cs +++ b/src/VirtoCommerce.OrdersModule.Data/Services/CustomerOrderBuilder.cs @@ -128,6 +128,7 @@ protected virtual CustomerOrder ToOrderModel(ShoppingCart cart) order.CustomerName = cart.CustomerName; order.DiscountAmount = cart.DiscountAmount; order.OrganizationId = cart.OrganizationId; + order.OrganizationName = cart.OrganizationName; order.StoreId = cart.StoreId; order.TaxPercentRate = cart.TaxPercentRate; order.TaxType = cart.TaxType; diff --git a/src/VirtoCommerce.OrdersModule.Web/Localizations/de.VirtoCommerce.Orders.json b/src/VirtoCommerce.OrdersModule.Web/Localizations/de.VirtoCommerce.Orders.json index e93993ae..363cd980 100644 --- a/src/VirtoCommerce.OrdersModule.Web/Localizations/de.VirtoCommerce.Orders.json +++ b/src/VirtoCommerce.OrdersModule.Web/Localizations/de.VirtoCommerce.Orders.json @@ -14,6 +14,7 @@ "from": "Von", "channel": "Kanal", "customer": "Kunde", + "organization": "Organisation", "invoice": "Erhalten Sie die Rechnung als PDF", "withPrototypes": "Mit vorlagen" }, diff --git a/src/VirtoCommerce.OrdersModule.Web/Localizations/en.VirtoCommerce.Orders.json b/src/VirtoCommerce.OrdersModule.Web/Localizations/en.VirtoCommerce.Orders.json index f2488325..ec50a99a 100644 --- a/src/VirtoCommerce.OrdersModule.Web/Localizations/en.VirtoCommerce.Orders.json +++ b/src/VirtoCommerce.OrdersModule.Web/Localizations/en.VirtoCommerce.Orders.json @@ -14,6 +14,7 @@ "from": "Created at", "channel": "Channel", "customer": "Customer", + "organization": "Organization", "invoice": "Get invoice PDF", "withPrototypes": "With templates" }, diff --git a/src/VirtoCommerce.OrdersModule.Web/Localizations/ru.VirtoCommerce.Orders.json b/src/VirtoCommerce.OrdersModule.Web/Localizations/ru.VirtoCommerce.Orders.json index c8f13cd0..1cc8d7fa 100644 --- a/src/VirtoCommerce.OrdersModule.Web/Localizations/ru.VirtoCommerce.Orders.json +++ b/src/VirtoCommerce.OrdersModule.Web/Localizations/ru.VirtoCommerce.Orders.json @@ -14,6 +14,7 @@ "from": "Из", "channel": "Канал", "customer": "Покупатель", + "organization": "Организация", "invoice": "Получить счет в PDF", "withPrototypes": "Показать шаблоны" }, diff --git a/src/VirtoCommerce.OrdersModule.Web/Scripts/blades/customerOrder-detail.js b/src/VirtoCommerce.OrdersModule.Web/Scripts/blades/customerOrder-detail.js index 167b4189..5c653f47 100644 --- a/src/VirtoCommerce.OrdersModule.Web/Scripts/blades/customerOrder-detail.js +++ b/src/VirtoCommerce.OrdersModule.Web/Scripts/blades/customerOrder-detail.js @@ -41,14 +41,29 @@ angular.module('virtoCommerce.orderModule') } blade.openCustomerDetails = function () { - securityAccounts.get({ id: blade.customerOrder.customerId }, function (account) { - var contactId = (account && account.memberId) ? account.memberId : blade.customerOrder.customerId; - members.get({ id: contactId }, function (member) { - if (member && member.id) { - showCustomerDetailBlade(member); - } + if (blade.customerOrder.customerId) { + securityAccounts.get({ id: blade.customerOrder.customerId }, function (account) { + var contactId = (account && account.memberId) ? account.memberId : blade.customerOrder.customerId; + members.get({ id: contactId }, function (member) { + if (member && member.id) { + showCustomerDetailBlade(member); + } + }); }); - }); + } + }; + + blade.openOrganizationDetails = function () { + if (blade.customerOrder.organizationId) { + securityAccounts.get({ id: blade.customerOrder.organizationId }, function (account) { + var organizationId = (account && account.memberId) ? account.memberId : blade.customerOrder.organizationId; + members.get({ id: organizationId }, function (member) { + if (member && member.id) { + showCustomerDetailBlade(member); + } + }); + }); + } }; blade.fetchEmployees = function (criteria) { diff --git a/src/VirtoCommerce.OrdersModule.Web/Scripts/blades/customerOrder-detail.tpl.html b/src/VirtoCommerce.OrdersModule.Web/Scripts/blades/customerOrder-detail.tpl.html index 3bebef62..ab677358 100644 --- a/src/VirtoCommerce.OrdersModule.Web/Scripts/blades/customerOrder-detail.tpl.html +++ b/src/VirtoCommerce.OrdersModule.Web/Scripts/blades/customerOrder-detail.tpl.html @@ -45,6 +45,14 @@ + +