From 77506300681a012fd44c8727cdef713a933b7ae3 Mon Sep 17 00:00:00 2001 From: Frede Hundewadt Date: Thu, 3 Aug 2023 06:50:21 +0200 Subject: [PATCH] working update --- .../CustomerInventoryListComponent.razor | 5 +++-- Wonky.Client/Helpers/Utils.cs | 6 ++--- .../AdvisorCustomerHistoryRepository.cs | 8 +++---- .../AdvisorWorkplaceRepository.cs | 22 +++++++++---------- ...isorCustomerWorkplaceRevisionPage.razor.cs | 1 + Wonky.Client/wwwroot/appsettings.json | 5 +---- Wonky.Entity/Configuration/ApiConfig.cs | 15 ------------- 7 files changed, 23 insertions(+), 39 deletions(-) diff --git a/Wonky.Client/Components/CustomerInventoryListComponent.razor b/Wonky.Client/Components/CustomerInventoryListComponent.razor index 4153de9e..e51c443f 100644 --- a/Wonky.Client/Components/CustomerInventoryListComponent.razor +++ b/Wonky.Client/Components/CustomerInventoryListComponent.razor @@ -58,7 +58,7 @@
- @product.Description
@@ -87,7 +87,8 @@ @product.Description
- @product.Sku + + Hyldekant @product.Sku
@product.Quantity diff --git a/Wonky.Client/Helpers/Utils.cs b/Wonky.Client/Helpers/Utils.cs index a2048001..7ffd286f 100644 --- a/Wonky.Client/Helpers/Utils.cs +++ b/Wonky.Client/Helpers/Utils.cs @@ -51,8 +51,8 @@ public static class Utils { return items.Select(item => new ProductVariant { - VariantId = item.VariantId, - S5A = item.S5A, + VariantId = item.VariantId, + S5A = item.S5A, S9A = item.S9A }) .ToList(); @@ -159,7 +159,7 @@ public static class Utils }).ToList(); } - + public static string StringToDigits(string digitString) { if (string.IsNullOrWhiteSpace(digitString)) diff --git a/Wonky.Client/HttpRepository/AdvisorCustomerHistoryRepository.cs b/Wonky.Client/HttpRepository/AdvisorCustomerHistoryRepository.cs index b5a98f76..85a533f0 100644 --- a/Wonky.Client/HttpRepository/AdvisorCustomerHistoryRepository.cs +++ b/Wonky.Client/HttpRepository/AdvisorCustomerHistoryRepository.cs @@ -80,7 +80,7 @@ public class AdvisorCustomerHistoryRepository : IAdvisorCustomerHistoryRepositor public async Task> GetInventory(string companyId) { - var response = await _client.GetAsync($"{_api.CrmCustomers}/{companyId}/{_api.CrmInventoryExt}"); + var response = await _client.GetAsync($"{_api.CrmCustomers}/{companyId}/history/inventory"); var content = await response.Content.ReadAsStringAsync(); if (!response.IsSuccessStatusCode || string.IsNullOrWhiteSpace(content)) return new List(); @@ -90,7 +90,7 @@ public class AdvisorCustomerHistoryRepository : IAdvisorCustomerHistoryRepositor public async Task> GetProductInvoiceLines(string companyId) { - var response = await _client.GetAsync($"{_api.CrmCustomers}/{companyId}/{_api.CrmProductExt}"); + var response = await _client.GetAsync($"{_api.CrmCustomers}/{companyId}/history/products"); var content = await response.Content.ReadAsStringAsync(); if (!response.IsSuccessStatusCode || string.IsNullOrWhiteSpace(content)) { @@ -102,7 +102,7 @@ public class AdvisorCustomerHistoryRepository : IAdvisorCustomerHistoryRepositor public async Task> GetProductInvoiceLines(string companyId, int months) { - var response = await _client.GetAsync($"{_api.CrmCustomers}/{companyId}/{_api.CrmProductExt}/statistic?months={months}"); + var response = await _client.GetAsync($"{_api.CrmCustomers}/{companyId}/history/products/statistic?months={months}"); var content = await response.Content.ReadAsStringAsync(); if (!response.IsSuccessStatusCode || string.IsNullOrWhiteSpace(content)) { @@ -114,7 +114,7 @@ public class AdvisorCustomerHistoryRepository : IAdvisorCustomerHistoryRepositor public async Task> GetProductInvoiceLines(string companyId, string sku) { - var response = await _client.GetAsync($"{_api.CrmCustomers}/{companyId}/{_api.CrmProductExt}/{sku}"); + var response = await _client.GetAsync($"{_api.CrmCustomers}/{companyId}/history/products/{sku}"); var content = await response.Content.ReadAsStringAsync(); if (!response.IsSuccessStatusCode || string.IsNullOrWhiteSpace(content)) { diff --git a/Wonky.Client/HttpRepository/AdvisorWorkplaceRepository.cs b/Wonky.Client/HttpRepository/AdvisorWorkplaceRepository.cs index 2002e855..6ee73bf5 100644 --- a/Wonky.Client/HttpRepository/AdvisorWorkplaceRepository.cs +++ b/Wonky.Client/HttpRepository/AdvisorWorkplaceRepository.cs @@ -51,7 +51,7 @@ public class AdvisorWorkplaceRepository : IAdvisorWorkplaceRepository public async Task> GetWorkplaces(string companyId) { var result = await _client.GetAsync( - $"{_api.CrmCustomers}/{companyId}/{_api.CrmWorkplaceExt}"); + $"{_api.CrmCustomers}/{companyId}/workplaces"); var content = await result.Content.ReadAsStringAsync(); if (!result.IsSuccessStatusCode || string.IsNullOrWhiteSpace(content)) { @@ -64,7 +64,7 @@ public class AdvisorWorkplaceRepository : IAdvisorWorkplaceRepository public async Task GetWorkplace(string companyId, string workplaceId) { var result = await _client.GetAsync( - $"{_api.CrmCustomers}/{companyId}/{_api.CrmWorkplaceExt}/{workplaceId}"); + $"{_api.CrmCustomers}/{companyId}/workplaces/{workplaceId}"); var content = await result.Content.ReadAsStringAsync(); if (!result.IsSuccessStatusCode || string.IsNullOrWhiteSpace(content)) { @@ -77,7 +77,7 @@ public class AdvisorWorkplaceRepository : IAdvisorWorkplaceRepository public async Task GetDocuments(string companyId, string workplaceId) { var result = await _client.GetAsync( - $"{_api.CrmCustomers}/{companyId}/{_api.CrmWorkplaceExt}/{workplaceId}/documents"); + $"{_api.CrmCustomers}/{companyId}/workplaces/{workplaceId}/documents"); var content = await result.Content.ReadAsStringAsync(); if (!result.IsSuccessStatusCode || string.IsNullOrWhiteSpace(content)) { @@ -90,7 +90,7 @@ public class AdvisorWorkplaceRepository : IAdvisorWorkplaceRepository public async Task GetRevisionList(string companyId, string workplaceId) { var result = await _client.GetAsync( - $"{_api.CrmCustomers}/{companyId}/{_api.CrmWorkplaceExt}/{workplaceId}/documents/revision"); + $"{_api.CrmCustomers}/{companyId}/workplaces/{workplaceId}/documents/revision"); var content = await result.Content.ReadAsStringAsync(); if (!result.IsSuccessStatusCode || string.IsNullOrWhiteSpace(content)) { @@ -103,7 +103,7 @@ public class AdvisorWorkplaceRepository : IAdvisorWorkplaceRepository public async Task PostWorkplace(string companyId, WorkplaceDto workplace) { var result = await _client.PostAsJsonAsync( - $"{_api.CrmCustomers}/{companyId}/{_api.CrmWorkplaceExt}", workplace, _options); + $"{_api.CrmCustomers}/{companyId}/workplaces", workplace, _options); var content = await result.Content.ReadAsStringAsync(); // if (!result.IsSuccessStatusCode || string.IsNullOrWhiteSpace(content)) // { @@ -116,7 +116,7 @@ public class AdvisorWorkplaceRepository : IAdvisorWorkplaceRepository public async Task PostWorkplaceDocuments(string companyId, string workplaceId, BucketDto bucketDto) { var result = await _client.PostAsJsonAsync( - $"{_api.CrmCustomers}/{companyId}/{_api.CrmWorkplaceExt}/{workplaceId}/documents/bop", bucketDto, _options); + $"{_api.CrmCustomers}/{companyId}/workplaces/{workplaceId}/documents/bop", bucketDto, _options); var content = await result.Content.ReadAsStringAsync(); if (!result.IsSuccessStatusCode || string.IsNullOrWhiteSpace(content)) { @@ -129,31 +129,31 @@ public class AdvisorWorkplaceRepository : IAdvisorWorkplaceRepository public async Task PutWorkplace(string companyId, WorkplaceDto workplace) { await _client.PutAsJsonAsync( - $"{_api.CrmCustomers}/{companyId}/{_api.CrmWorkplaceExt}/{workplace.WorkplaceId}", workplace, _options); + $"{_api.CrmCustomers}/{companyId}/workplaces/{workplace.WorkplaceId}", workplace, _options); } public async Task DeleteWorkplace(string companyId, string workplaceId) { await _client.DeleteAsync( - $"{_api.CrmCustomers}/{companyId}/{_api.CrmWorkplaceExt}/{workplaceId}"); + $"{_api.CrmCustomers}/{companyId}/workplaces/{workplaceId}"); } public async Task DeleteDocument(string companyId, string workplaceId, string documentId) { await _client.DeleteAsync( - $"{_api.CrmCustomers}/{companyId}/{_api.CrmWorkplaceExt}/{workplaceId}/documents/{documentId}"); + $"{_api.CrmCustomers}/{companyId}/workplaces/{workplaceId}/documents/{documentId}"); } public async Task DeleteVariantDocuments(string companyId, string workplaceId, string apbDocumentId, string apvDocumentId) { await _client.DeleteAsync( - $"{_api.CrmCustomers}/{companyId}/{_api.CrmWorkplaceExt}/{workplaceId}/documents/{apvDocumentId}"); + $"{_api.CrmCustomers}/{companyId}/workplaces/{workplaceId}/documents/{apvDocumentId}"); await _client.DeleteAsync( - $"{_api.CrmCustomers}/{companyId}/{_api.CrmWorkplaceExt}/{workplaceId}/documents/{apbDocumentId}"); + $"{_api.CrmCustomers}/{companyId}/workplaces/{workplaceId}/documents/{apbDocumentId}"); } } \ No newline at end of file diff --git a/Wonky.Client/Pages/AdvisorCustomerWorkplaceRevisionPage.razor.cs b/Wonky.Client/Pages/AdvisorCustomerWorkplaceRevisionPage.razor.cs index 81ccbb1d..4700f198 100644 --- a/Wonky.Client/Pages/AdvisorCustomerWorkplaceRevisionPage.razor.cs +++ b/Wonky.Client/Pages/AdvisorCustomerWorkplaceRevisionPage.razor.cs @@ -137,6 +137,7 @@ public partial class AdvisorCustomerWorkplaceRevisionPage : IDisposable Logger.LogDebug("submitRevision {}", JsonSerializer.Serialize(x)); var result = await WorkplaceRepo.PostWorkplaceDocuments(CompanyId, WorkplaceId, x); + Logger.LogDebug("result {}", JsonSerializer.Serialize(result)); Toaster.ClearAll(); Toaster.ShowInfo("Sådan!"); diff --git a/Wonky.Client/wwwroot/appsettings.json b/Wonky.Client/wwwroot/appsettings.json index ae7ba5a5..54c5adfe 100644 --- a/Wonky.Client/wwwroot/appsettings.json +++ b/Wonky.Client/wwwroot/appsettings.json @@ -1,7 +1,7 @@ { "appInfo": { "name": "Wonky Online", - "version": "197.0", + "version": "203.0", "rc": true, "sandBox": true, "image": "grumpy-coder.png", @@ -24,12 +24,9 @@ "baseUrl": "https://dev.innotec.dk", "catalog": "api/v2/catalog/country", "crmCustomers": "api/v2/crm/companies", - "crmInventoryExt": "history/inventory", - "crmProductExt": "history/products", "crmReports": "api/v2/crm/advisors/reports", "crmActivities": "api/v2/crm/advisors/activities", "crmTasks": "api/v2/crm/advisors/tasks", - "crmWorkplaceExt": "workplaces", "officeBase": "api/v2/office", "officeActivities": "api/v2/office/activities", "officeAdvisors": "api/v2/office/users/advisors", diff --git a/Wonky.Entity/Configuration/ApiConfig.cs b/Wonky.Entity/Configuration/ApiConfig.cs index 3f13ec04..887771c6 100644 --- a/Wonky.Entity/Configuration/ApiConfig.cs +++ b/Wonky.Entity/Configuration/ApiConfig.cs @@ -53,21 +53,6 @@ public class ApiConfig /// public string CrmCustomers { get; set; } = ""; - /// - /// Application uri for customer product inventory request - /// - public string CrmInventoryExt { get; set; } = ""; - - /// - /// Application uri for customer product sale request - /// - public string CrmProductExt { get; set; } = ""; - - /// - /// Application uri for getting workplace(s) - /// - public string CrmWorkplaceExt { get; set; } = ""; - /// /// Office base url ///