diff --git a/Wonky.Client/Components/B2BLandingComponent.razor b/Wonky.Client/Components/B2BLandingComponent.razor new file mode 100644 index 00000000..8b948ee2 --- /dev/null +++ b/Wonky.Client/Components/B2BLandingComponent.razor @@ -0,0 +1,17 @@ +@* Copyright (C) 2022 FCS Frede's Computer Services. +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html] +*@ + +

B2B

+ diff --git a/Wonky.Client/Components/B2BLandingComponent.razor.cs b/Wonky.Client/Components/B2BLandingComponent.razor.cs new file mode 100644 index 00000000..d8f36963 --- /dev/null +++ b/Wonky.Client/Components/B2BLandingComponent.razor.cs @@ -0,0 +1,21 @@ +using Microsoft.AspNetCore.Components; +using Wonky.Client.Local.Services; + +#pragma warning disable CS8618 + +namespace Wonky.Client.Components; + +public partial class B2BLandingComponent +{ + [Inject] public NavigationManager Navigator { get; set; } + [Inject] public IUserInfoService UserInfo { get; set; } + + + protected override async Task OnInitializedAsync() + { + var userInfo = await UserInfo.GetUserInfo(); + + Navigator.NavigateTo($"/b2b/{userInfo.CountryCode.ToLower()}/{userInfo.CompanyId}"); + + } +} \ No newline at end of file diff --git a/Wonky.Client/Components/CustomerActivityListComponent.razor b/Wonky.Client/Components/CustomerActivityListComponent.razor index 5f0d2d40..02b0c7f3 100644 --- a/Wonky.Client/Components/CustomerActivityListComponent.razor +++ b/Wonky.Client/Components/CustomerActivityListComponent.razor @@ -12,6 +12,7 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html] *@ + @using Wonky.Client.OverlayCustomer
diff --git a/Wonky.Client/Components/CustomerInventoryListComponent.razor b/Wonky.Client/Components/CustomerInventoryListComponent.razor index 1a770dd7..a0720966 100644 --- a/Wonky.Client/Components/CustomerInventoryListComponent.razor +++ b/Wonky.Client/Components/CustomerInventoryListComponent.razor @@ -26,7 +26,9 @@
- +
+
+
+
+ @product.Description +
+ @if (product.Discontinued) + { + + Udgået + Produktet er udgået + + } +
+
@product.LastInvoiceDate @@ -65,17 +81,8 @@ }
-
-
+
@product.Description - @if (product.Discontinued) - { - - Udgået - Produktet er udgået - - } -
@product.Sku diff --git a/Wonky.Client/Components/CustomerInventoryListComponent.razor.cs b/Wonky.Client/Components/CustomerInventoryListComponent.razor.cs index 826c8cb8..129691b0 100644 --- a/Wonky.Client/Components/CustomerInventoryListComponent.razor.cs +++ b/Wonky.Client/Components/CustomerInventoryListComponent.razor.cs @@ -48,7 +48,6 @@ public partial class CustomerInventoryListComponent // initialize FilteredList ApplyInventoryFilter(DisplayFilter); } - private void SetSortOrder() { diff --git a/Wonky.Client/Components/CustomerInventoryListComponent.razor.css b/Wonky.Client/Components/CustomerInventoryListComponent.razor.css new file mode 100644 index 00000000..6eacd03c --- /dev/null +++ b/Wonky.Client/Components/CustomerInventoryListComponent.razor.css @@ -0,0 +1,4 @@ +.product-image { + width: 100px; + height: auto; +} \ No newline at end of file diff --git a/Wonky.Client/HttpRepository/B2BRepository.cs b/Wonky.Client/HttpRepository/B2BRepository.cs new file mode 100644 index 00000000..bde8e31d --- /dev/null +++ b/Wonky.Client/HttpRepository/B2BRepository.cs @@ -0,0 +1,105 @@ +using System.Net.Http.Json; +using System.Text.Json; +using Microsoft.AspNetCore.Components; +using Microsoft.Extensions.Options; +using Wonky.Entity.Configuration; +using Wonky.Entity.DTO; +using Wonky.Entity.Views; + +namespace Wonky.Client.HttpRepository; + +public class B2BRepository : IB2BRepository +{ + private readonly JsonSerializerOptions? _options = new JsonSerializerOptions + { + PropertyNameCaseInsensitive = true + }; + + private readonly NavigationManager _navigation; + private ILogger _logger; + private readonly HttpClient _client; + private readonly ApiConfig _api; + + public B2BRepository(HttpClient client, ILogger logger, + NavigationManager navigation, IOptions configuration) + { + _client = client; + _logger = logger; + _navigation = navigation; + _api = configuration.Value; + } + + + public async Task> GetWebShopOrderList(string companyId) + { + var result = await _client.GetFromJsonAsync>( + $"{_api.B2BCustomer}/{companyId}/sales"); + return result ?? new List(); + } + + + public async Task GetWebShopOrder(string companyId, string orderId) + { + var result = await _client.GetFromJsonAsync( + $"{_api.B2BCustomer}/{companyId}/sales/{orderId}"); + return result ?? new ESalesHeadView(); + } + + + public async Task PostWebShopOrder(string companyId, ESalesHeadCreateDto model) + { + var result = await _client.PostAsJsonAsync( + $"{_api.B2BCustomer}/{companyId}/sales", model, _options); + var content = await result.Content.ReadAsStringAsync(); + if (!result.IsSuccessStatusCode || string.IsNullOrWhiteSpace(content)) + { + return new ESalesHeadView(); + } + return JsonSerializer.Deserialize(content) ?? new ESalesHeadView(); + } + + + public async Task PutWebShopOrder(string companyId, string orderId, ESalesHeadView model) + { + await _client.PutAsJsonAsync($"{_api.B2BCustomer}/{companyId}/sales/{orderId}", model, _options); + } + + + public async Task DeleteWebShopOrder(string companyId, string orderId) + { + await _client.DeleteAsync($"{_api.B2BCustomer}/{companyId}/sales/{orderId}"); + } + + + public async Task GetAdvisorInfo(string companyId) + { + var result = await _client.GetFromJsonAsync( + $"{_api.B2BCustomer}/{companyId}/info/advisor"); + return result ?? new B2BAdvisorInfo(); + } + + + public async Task GetBusinessInfo(string companyId) + { + var result = await _client.GetFromJsonAsync( + $"{_api.B2BCustomer}/{companyId}/info/business"); + return result ?? new B2BBusinessInfo(); + } + + + public async Task> GetCustomerInventory(string companyId) + { + var result = await _client.GetFromJsonAsync>( + $"{_api.B2BCustomer}/{companyId}/info/inventory"); + return result ?? new List(); + } + + + public async Task> GetCustomerProductHistory(string companyId, string sku) + { + var result = await _client.GetFromJsonAsync>( + $"{_api.B2BCustomer}/{companyId}/info/inventory/{sku}"); + return result ?? new List(); + } + +} \ No newline at end of file diff --git a/Wonky.Client/HttpRepository/IB2BRepository.cs b/Wonky.Client/HttpRepository/IB2BRepository.cs new file mode 100644 index 00000000..329b5747 --- /dev/null +++ b/Wonky.Client/HttpRepository/IB2BRepository.cs @@ -0,0 +1,20 @@ +using Wonky.Entity.DTO; +using Wonky.Entity.Views; + +namespace Wonky.Client.HttpRepository; + +public interface IB2BRepository +{ + // sale + Task> GetWebShopOrderList(string companyId); + Task GetWebShopOrder(string companyId, string orderId); + Task PostWebShopOrder(string companyId, ESalesHeadCreateDto model); + Task PutWebShopOrder(string companyId, string orderId, ESalesHeadView model); + Task DeleteWebShopOrder(string companyId, string orderId); + + // info + Task GetAdvisorInfo(string companyId); + Task GetBusinessInfo(string companyId); + Task> GetCustomerInventory(string companyId); + Task> GetCustomerProductHistory(string companyId, string sku); +} \ No newline at end of file diff --git a/Wonky.Client/HttpRepository/SystemSendMailService.cs b/Wonky.Client/HttpRepository/SystemSendMailService.cs index a58e355c..a6c493d3 100644 --- a/Wonky.Client/HttpRepository/SystemSendMailService.cs +++ b/Wonky.Client/HttpRepository/SystemSendMailService.cs @@ -52,7 +52,7 @@ public class SystemSendMailService : ISystemSendMailService /// public async Task SendMail(string messageType, EmailMessage message) { - var response = await _client.PostAsJsonAsync($"{_api.ServicesMail}/{messageType}", message, _options); + var response = await _client.PostAsJsonAsync($"{_api.ServiceMail}/{messageType}", message, _options); if (!response.IsSuccessStatusCode) return new ApiResponseView { diff --git a/Wonky.Client/HttpRepository/SystemSendSmsService.cs b/Wonky.Client/HttpRepository/SystemSendSmsService.cs index 8ae5a48c..96255384 100644 --- a/Wonky.Client/HttpRepository/SystemSendSmsService.cs +++ b/Wonky.Client/HttpRepository/SystemSendSmsService.cs @@ -51,7 +51,7 @@ public class SystemSendSmsService : ISystemSendSmsService /// public async Task SendSms(ShortMessage message) { - var response = await _client.PostAsJsonAsync($"{_api.ServicesSms}", message, _options); + var response = await _client.PostAsJsonAsync($"{_api.ServiceSms}", message, _options); if (!response.IsSuccessStatusCode) return new ApiResponseView { diff --git a/Wonky.Client/Local.Services/AuthenticationService.cs b/Wonky.Client/Local.Services/AuthenticationService.cs index 5ed028be..11b03696 100644 --- a/Wonky.Client/Local.Services/AuthenticationService.cs +++ b/Wonky.Client/Local.Services/AuthenticationService.cs @@ -65,7 +65,7 @@ public class AuthenticationService : IAuthenticationService }; var response = await _client - .PostAsync(_apiConfig.Value.ServicesAuth, new FormUrlEncodedContent(credForm)); + .PostAsync(_apiConfig.Value.ServiceAuth, new FormUrlEncodedContent(credForm)); var resContent = await response.Content.ReadAsStringAsync(); @@ -114,7 +114,7 @@ public class AuthenticationService : IAuthenticationService ["refresh_token"] = refreshToken }; - var response = await _client.PostAsync(_apiConfig.Value.ServicesAuth, new FormUrlEncodedContent(credentials)); + var response = await _client.PostAsync(_apiConfig.Value.ServiceAuth, new FormUrlEncodedContent(credentials)); var content = await response.Content.ReadAsStringAsync(); if (!response.IsSuccessStatusCode || string.IsNullOrWhiteSpace(content)) diff --git a/Wonky.Client/Local.Services/SwedishPersonalOrgService.cs b/Wonky.Client/Local.Services/SwedishPersonalOrgService.cs index 755552bf..44166e33 100644 --- a/Wonky.Client/Local.Services/SwedishPersonalOrgService.cs +++ b/Wonky.Client/Local.Services/SwedishPersonalOrgService.cs @@ -31,7 +31,7 @@ public class SwedishPersonalOrgService : ISwedishPersonalOrgService PersonalId = "" }; - var response = await _client.GetAsync($"{_api.ServicesVatSe}?companyName={companyName}"); + var response = await _client.GetAsync($"{_api.ServiceVatSe}?companyName={companyName}"); var content = await response.Content.ReadAsStringAsync(); diff --git a/Wonky.Client/Local.Services/VatInfoLookupService.cs b/Wonky.Client/Local.Services/VatInfoLookupService.cs index 84389b73..6c32bcb6 100644 --- a/Wonky.Client/Local.Services/VatInfoLookupService.cs +++ b/Wonky.Client/Local.Services/VatInfoLookupService.cs @@ -54,7 +54,7 @@ public class VatInfoLookupService ["zipCode"] = $"{query.ZipCode}", ["entityName"] = $"{query.EntityName}" }; - var endpoint = WebUtils.QueryHelper($"{_api.ServicesVatDk}", queryDictionary); + var endpoint = WebUtils.QueryHelper($"{_api.ServiceVatDk}", queryDictionary); var response = await _client.GetAsync(endpoint.ToString()); var content = await response.Content.ReadAsStringAsync(); @@ -83,7 +83,7 @@ public class VatInfoLookupService { ["vatNumber"] = $"{vatNumber}" }; - var endpoint = WebUtils.QueryHelper($"{_api.ServicesVatNo}", queryDictionary); + var endpoint = WebUtils.QueryHelper($"{_api.ServiceVatNo}", queryDictionary); var response = await _client.GetAsync(endpoint.ToString()); var content = await response.Content.ReadAsStringAsync(); @@ -106,7 +106,7 @@ public class VatInfoLookupService { ["vatNumber"] = $"{vatNumber}" }; - var endpoint = WebUtils.QueryHelper($"{_api.ServicesVatEu}", queryDictionary); + var endpoint = WebUtils.QueryHelper($"{_api.ServiceVatEu}", queryDictionary); var response = await _client.GetAsync(endpoint.ToString()); diff --git a/Wonky.Client/Pages/AdvisorActivityCreatePage.razor b/Wonky.Client/Pages/AdvisorActivityCreatePage.razor index b1684818..73ddd64a 100644 --- a/Wonky.Client/Pages/AdvisorActivityCreatePage.razor +++ b/Wonky.Client/Pages/AdvisorActivityCreatePage.razor @@ -52,7 +52,10 @@ else @_activity.Name (@_activity.Account)
- +
@@ -86,7 +89,6 @@ else else { - /*@if (!string.IsNullOrEmpty(_activity.VatNumber) && !string.IsNullOrWhiteSpace(_activity.Address1) && _company.HasFolded == 0)*/ @if (!string.IsNullOrWhiteSpace(_activity.VatNumber) && !string.IsNullOrWhiteSpace(_activity.Address1) && _company.HasFolded == 0) { @if (DraftProvider.Draft.DraftType == "order") @@ -207,19 +209,28 @@ else @* ***************** Invoice history overlay ***************************** *@ - +
@* ***************** Visit hisotry overlay ***************************** *@ - +
@* ***************** Product Inventory overlay ***************************** *@ - +
@@ -231,13 +242,18 @@ else - Ordrekladde Global kladde (udløber efter @(DraftProvider.Draft.TimeToLiveInSeconds / 60)m inaktivitet) + Ordrekladde + Global kladde (udløber efter @(DraftProvider.Draft.TimeToLiveInSeconds / 60)m inaktivitet) + @* ***************** Reset draft ***************************** *@ - + @@ -270,7 +286,9 @@ else @* ***************** Remove item ***************************** *@ - + } @@ -339,7 +357,10 @@ else @* ***************** Add item button ***************************** *@ - + @@ -397,14 +418,17 @@ else
@* ***************** Confirm product check overlay button ***************************** ***************** Continue by submitton order to erp ***************************** *@ -
diff --git a/Wonky.Client/Pages/AdvisorActivityCreatePage.razor.cs b/Wonky.Client/Pages/AdvisorActivityCreatePage.razor.cs index adc36797..85de6b71 100644 --- a/Wonky.Client/Pages/AdvisorActivityCreatePage.razor.cs +++ b/Wonky.Client/Pages/AdvisorActivityCreatePage.razor.cs @@ -164,7 +164,7 @@ public partial class AdvisorActivityCreatePage : IDisposable _activity.ZipCode = _company.ZipCode; /* - * debug loggin + * debug logging */ // Logger.LogDebug("company.segment = {}", _company.Segment); // Logger.LogDebug("activity.segment = {}", _activity.Segment); diff --git a/Wonky.Client/Pages/BusinessCustomerLandingPage.razor b/Wonky.Client/Pages/BusinessCustomerLandingPage.razor new file mode 100644 index 00000000..7d62c5d8 --- /dev/null +++ b/Wonky.Client/Pages/BusinessCustomerLandingPage.razor @@ -0,0 +1,39 @@ +@* Copyright (C) 2022 FCS Frede's Computer Services. +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html] +*@ + +@using Microsoft.AspNetCore.Authorization +@using System.Text.Json +@attribute [Authorize(Roles = "EShop")] +@page "/b2b/{countryCode}/{companyId}" + +
+ @if (!string.IsNullOrWhiteSpace(_businessInfo.Name)) + { + @JsonSerializer.Serialize(_businessInfo) + } + +
+
+ @if (!string.IsNullOrWhiteSpace(_advisorInfo.Name)) + { + @JsonSerializer.Serialize(_advisorInfo) + } +
+
+ @if (_productInventory.Any()) + { + @JsonSerializer.Serialize(_productInventory) + } +
\ No newline at end of file diff --git a/Wonky.Client/Pages/BusinessCustomerLandingPage.razor.cs b/Wonky.Client/Pages/BusinessCustomerLandingPage.razor.cs new file mode 100644 index 00000000..68bb1930 --- /dev/null +++ b/Wonky.Client/Pages/BusinessCustomerLandingPage.razor.cs @@ -0,0 +1,42 @@ +using Microsoft.AspNetCore.Components; +using Wonky.Client.HttpInterceptors; +using Wonky.Client.HttpRepository; +using Wonky.Entity.DTO; +using Wonky.Entity.Views; + +#pragma warning disable CS8618 + +namespace Wonky.Client.Pages; + +public partial class BusinessCustomerLandingPage : IDisposable +{ + // ############################################################## + [Inject] public HttpInterceptorService Interceptor { get; set; } + [Inject] public IB2BRepository B2BRepo { get; set; } + + // ############################################################## + [Parameter] public string CountryCode { get; set; } = ""; + [Parameter] public string CompanyId { get; set; } = ""; + + // ############################################################## + private B2BBusinessInfo _businessInfo = new(); + private B2BAdvisorInfo _advisorInfo = new(); + private List _productHistory = new(); + private List _productInventory = new(); + + + protected override async Task OnInitializedAsync() + { + Interceptor.RegisterEvent(); + Interceptor.RegisterBeforeSendEvent(); + _businessInfo = await B2BRepo.GetBusinessInfo(CompanyId); + _advisorInfo = await B2BRepo.GetAdvisorInfo(CompanyId); + _productInventory = await B2BRepo.GetCustomerInventory(CompanyId); + } + + + public void Dispose() + { + Interceptor.DisposeEvent(); + } +} \ No newline at end of file diff --git a/Wonky.Client/Pages/BusinessCustomerWebShopPage.razor.cs b/Wonky.Client/Pages/BusinessCustomerWebShopPage.razor.cs new file mode 100644 index 00000000..1a412866 --- /dev/null +++ b/Wonky.Client/Pages/BusinessCustomerWebShopPage.razor.cs @@ -0,0 +1,23 @@ +// Copyright (C) 2022 FCS Frede's Computer Services. +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html] +// + +namespace Wonky.Client.Pages; + +#pragma warning disable CS8618 + +public partial class BusinessCustomerWebShopPage +{ + +} \ No newline at end of file diff --git a/Wonky.Client/Pages/BusinessCustomerWebshopPage.razor b/Wonky.Client/Pages/BusinessCustomerWebshopPage.razor new file mode 100644 index 00000000..460a870a --- /dev/null +++ b/Wonky.Client/Pages/BusinessCustomerWebshopPage.razor @@ -0,0 +1,20 @@ +@* Copyright (C) 2022 FCS Frede's Computer Services. +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html] +*@ + + +@using Microsoft.AspNetCore.Authorization +@attribute [Authorize(Roles = "EShop")] +@page "/b2b/{countryCode}/{companyId}/webshop" +

BusinessCustomerWebshopPage

diff --git a/Wonky.Client/Pages/Index.razor b/Wonky.Client/Pages/Index.razor index d00dabe2..3893777a 100644 --- a/Wonky.Client/Pages/Index.razor +++ b/Wonky.Client/Pages/Index.razor @@ -16,26 +16,37 @@ @using Wonky.Client.Components; @using Microsoft.AspNetCore.Authorization -@attribute [Authorize(Roles = "Admin,Advisor,Management,Office,Supervisor,Warehouse")] +@attribute [Authorize(Roles = "Admin,Advisor,Management,Office,Supervisor,Warehouse,EShop")] @page "/" @page "/index" @page "/home" + Innotec Danmark A/S + - + - + Innotec Danmark A/S + + Innotec Danmark A/S @* TODO Supervisor landing page *@ + Innotec Danmark A/S @* TODO Supervisor landing page *@ + + Innotec Danmark A/S + + + + @code{ } diff --git a/Wonky.Client/Pages/OfficeOrderCreatePage.razor b/Wonky.Client/Pages/OfficeOrderCreatePage.razor index f061df4f..1f470af5 100644 --- a/Wonky.Client/Pages/OfficeOrderCreatePage.razor +++ b/Wonky.Client/Pages/OfficeOrderCreatePage.razor @@ -140,6 +140,7 @@ Enhedspris % Linjesum + SAS @@ -155,6 +156,9 @@ @($"{cartItem.Price:N2}") @($"{cartItem.Discount:N2}") @($"{cartItem.LineTotal:N2}") + + + @* ***************** Remove draft line ***************************** @@ -195,6 +199,7 @@ Antal Pris Rabat + SAS Varenr. @@ -217,6 +222,9 @@ + + + @SelectedItem.Sku @* diff --git a/Wonky.Client/Pages/OfficeOrderCreatePage.razor.cs b/Wonky.Client/Pages/OfficeOrderCreatePage.razor.cs index d824ee58..3669681c 100644 --- a/Wonky.Client/Pages/OfficeOrderCreatePage.razor.cs +++ b/Wonky.Client/Pages/OfficeOrderCreatePage.razor.cs @@ -71,6 +71,7 @@ public partial class OfficeOrderCreatePage : IDisposable private string Quantity { get; set; } = "1"; private string Price { get; set; } = "0"; private string Discount { get; set; } = "0"; + private bool Sas { get; set; } // private bool ReportClosed { get; set; } private bool PoFormInvalid { get; set; } = true; private bool Working { get; set; } = true; @@ -188,8 +189,10 @@ public partial class OfficeOrderCreatePage : IDisposable Quantity = Convert.ToInt32(Quantity), Price = Convert.ToDecimal(Price, CultureInfo.InvariantCulture), Discount = Convert.ToDecimal(Discount, CultureInfo.InvariantCulture), + Sas = Sas }; // reset internals to initial state + Sas = false; Quantity = "1"; Price = "0"; Discount = "0"; diff --git a/Wonky.Client/Pages/SystemUserCreatePage.razor b/Wonky.Client/Pages/SystemUserCreatePage.razor index b8970081..b352c112 100644 --- a/Wonky.Client/Pages/SystemUserCreatePage.razor +++ b/Wonky.Client/Pages/SystemUserCreatePage.razor @@ -35,7 +35,7 @@
- +
diff --git a/Wonky.Client/Pages/SystemUserViewEditPage.razor b/Wonky.Client/Pages/SystemUserViewEditPage.razor index 3172fac1..adda0b94 100644 --- a/Wonky.Client/Pages/SystemUserViewEditPage.razor +++ b/Wonky.Client/Pages/SystemUserViewEditPage.razor @@ -116,7 +116,7 @@
- +
@@ -150,16 +150,16 @@
-
+
-
+
-
+
- diff --git a/Wonky.Client/Pages/SystemUserViewEditPage.razor.cs b/Wonky.Client/Pages/SystemUserViewEditPage.razor.cs index 12ced07c..c43f6734 100644 --- a/Wonky.Client/Pages/SystemUserViewEditPage.razor.cs +++ b/Wonky.Client/Pages/SystemUserViewEditPage.razor.cs @@ -33,6 +33,7 @@ public partial class SystemUserViewEditPage : IDisposable // ############################################################# [Inject] public HttpInterceptorService Interceptor { get; set; } [Inject] public ISystemUserRepository UserRepo { get; set; } + [Inject] public ICountryCustomerRepository CustomerRepo { get; set; } [Inject] public ILogger Logger { get; set; } [Inject] public IToastService Toaster { get; set; } [Inject] public NavigationManager Navigator { get; set; } @@ -49,6 +50,7 @@ public partial class SystemUserViewEditPage : IDisposable private bool PwInvalid { get; set; } = true; private bool Working { get; set; } = true; private bool ReadOnly { get; set; } = true; + private CompanyDto _customer = new(); private RoleAssignment AssignedRoles { get; set; } = new(); @@ -65,6 +67,11 @@ public partial class SystemUserViewEditPage : IDisposable UserInfo = await UserRepo.GetUserInfo(UserId); + if (!string.IsNullOrWhiteSpace(UserInfo.CompanyId)) + { + _customer = await CustomerRepo.GetByCustomerId(CountryCode, UserInfo.CompanyId); + } + AssignedRoles = Mapper.MapEditAssignedRoles(UserInfo); UserEditContext = new EditContext(UserInfo); diff --git a/Wonky.Client/Program.cs b/Wonky.Client/Program.cs index 2f620379..ab6f9c33 100644 --- a/Wonky.Client/Program.cs +++ b/Wonky.Client/Program.cs @@ -28,6 +28,7 @@ using Wonky.Client.HttpRepository; using Wonky.Client.Local.Services; using Wonky.Client.Shared; using Wonky.Entity.Configuration; +using Wonky.Entity.DTO; var builder = WebAssemblyHostBuilder.CreateDefault(args); builder.RootComponents.Add("#app"); @@ -105,6 +106,8 @@ builder.Services.AddScoped(); builder.Services.AddBlazoredLocalStorage(); // Swedisd Personal Company OrgNo Search builder.Services.AddScoped(); +// b2b service +builder.Services.AddScoped(); // --------------------------------------- diff --git a/Wonky.Client/Wonky.Client.csproj b/Wonky.Client/Wonky.Client.csproj index 69f4878c..13d00f92 100644 --- a/Wonky.Client/Wonky.Client.csproj +++ b/Wonky.Client/Wonky.Client.csproj @@ -11,11 +11,11 @@ - - - - - + + + + + @@ -27,13 +27,13 @@ - - PreserveNewest - + + PreserveNewest + diff --git a/Wonky.Client/wwwroot/appsettings.json b/Wonky.Client/wwwroot/appsettings.json index 2081daa1..331391b0 100644 --- a/Wonky.Client/wwwroot/appsettings.json +++ b/Wonky.Client/wwwroot/appsettings.json @@ -1,7 +1,7 @@ { "appInfo": { "name": "Wonky Online", - "version": "181.0", + "version": "183.0", "rc": true, "sandBox": true, "image": "grumpy-coder.png", @@ -20,7 +20,7 @@ } }, "apiConfig": { - "baseUrl": "https://eta.innotec.dk", + "baseUrl": "https://dev.innotec.dk", "catalog": "api/v2/catalog/country", "crmCustomers": "api/v2/crm/companies", "crmInventoryExt": "history/inventory", @@ -36,15 +36,15 @@ "officeReports": "api/v2/office/reports", "officeUsers": "api/v2/office/users/admin", "publicProducts": "api/v2/public/products", - "servicesGlsId": "", - "servicesGlsTrackUrl": "https://www.gls-group.eu/276-I-PORTAL-WEB/content/GLS/DK01/DA/5004.htm?txtAction=71000&txtRefNo=", - "servicesMail": "api/v2/services/sendmail", - "servicesSms": "api/v2/services/sms", - "servicesVatDk": "api/v2/services/virk", + "serviceAuth": "v2/token", + "serviceGlsId": "", + "serviceGlsTrack": "https://gls-group.eu/track/", + "serviceMail": "api/v2/services/sendmail", + "serviceSms": "api/v2/services/sms", + "serviceVatDk": "api/v2/services/virk", "serviceVatEu": "api/v2/services/vies", - "servicesVatNo": "api/v2/services/brReg", - "servicesVatSe": "api/v2/services/allabolag", - "servicesAuth": "v2/token", + "serviceVatNo": "api/v2/services/brReg", + "serviceVatSe": "api/v2/services/allabolag", "sync": "api/v2/sync", "syncInvoice": "api/v2/sync/invoices", "systemDocStringUrl": "api/v2/admin/doc", @@ -56,6 +56,7 @@ "userManagerSetPasswd": "api/v2/app/manage/passwd", "userRoles": "api/v2/app/manage/roles", "userSupport": "/api/v2/app/manage/support", - "warehouse": "api/v2/warehouse/packages" + "warehouse": "api/v2/warehouse/packages", + "b2bCustomer": "api/v2/b2b" } } diff --git a/Wonky.Entity/Configuration/ApiConfig.cs b/Wonky.Entity/Configuration/ApiConfig.cs index 8b920b5d..234ce52d 100644 --- a/Wonky.Entity/Configuration/ApiConfig.cs +++ b/Wonky.Entity/Configuration/ApiConfig.cs @@ -101,46 +101,46 @@ public class ApiConfig /// /// Application uri for token request /// - public string ServicesAuth { get; set; } = ""; + public string ServiceAuth { get; set; } = ""; /// /// GLS tracking url /// - public string ServicesGlsTrackUrl { get; set; } = ""; + public string ServiceGlsTrack { get; set; } = ""; /// /// GLS customer entity /// - public string ServicesGlsId { get; set; } = ""; + public string ServiceGlsId { get; set; } = ""; /// /// url for sending mail message /// - public string ServicesMail { get; set; } = ""; + public string ServiceMail { get; set; } = ""; /// /// url for sending Short Message /// - public string ServicesSms { get; set; } = ""; + public string ServiceSms { get; set; } = ""; /// /// VAT registrar url Denmark /// - public string ServicesVatDk { get; set; } = ""; + public string ServiceVatDk { get; set; } = ""; /// /// VAT registrar url Norway /// - public string ServicesVatNo { get; set; } = ""; + public string ServiceVatNo { get; set; } = ""; /// /// VAT registrar url EU /// - public string ServicesVatSe { get; set; } = ""; + public string ServiceVatSe { get; set; } = ""; /// /// VAT registrar url EU /// - public string ServicesVatEu { get; set; } = ""; + public string ServiceVatEu { get; set; } = ""; /// /// Base sync url @@ -201,4 +201,8 @@ public class ApiConfig /// public string Warehouse { get; set; } = ""; -} \ No newline at end of file + /// + /// Uri for B2BCustomer + /// + public string B2BCustomer { get; set; } = ""; +} \ No newline at end of file diff --git a/Wonky.Entity/DTO/B2BAdvisorInfo.cs b/Wonky.Entity/DTO/B2BAdvisorInfo.cs new file mode 100644 index 00000000..589ad775 --- /dev/null +++ b/Wonky.Entity/DTO/B2BAdvisorInfo.cs @@ -0,0 +1,8 @@ +namespace Wonky.Entity.DTO; + +public class B2BAdvisorInfo +{ + public string Name { get; set; } = ""; + public string Phone { get; set; } = ""; + public string Email { get; set; } = ""; +} \ No newline at end of file diff --git a/Wonky.Entity/DTO/B2BBusinessInfo.cs b/Wonky.Entity/DTO/B2BBusinessInfo.cs new file mode 100644 index 00000000..dbc7addc --- /dev/null +++ b/Wonky.Entity/DTO/B2BBusinessInfo.cs @@ -0,0 +1,13 @@ +namespace Wonky.Entity.DTO; + +public class B2BBusinessInfo +{ + public string Address1 { get; set; } = ""; + public string Address2 { get; set; } = ""; + public string City { get; set; } = ""; + public string CompanyId { get; set; } = ""; + public string Name { get; set; } = ""; + public string ZipCode { get; set; } = ""; + public string Phone { get; set; } = ""; + public string Email { get; set; } = ""; +} \ No newline at end of file diff --git a/Wonky.Entity/DTO/ESalesHeadCreateDto.cs b/Wonky.Entity/DTO/ESalesHeadCreateDto.cs new file mode 100644 index 00000000..9acbd825 --- /dev/null +++ b/Wonky.Entity/DTO/ESalesHeadCreateDto.cs @@ -0,0 +1,11 @@ +using System.ComponentModel.DataAnnotations; + +namespace Wonky.Entity.DTO; + +public class ESalesHeadCreateDto +{ + [MaxLength(20)] public string ReferenceNumber { get; set; } = ""; + [MaxLength(255)] public string OrderNote { get; set; } = ""; + [Required] public bool ConditionsAccepted { get; set; } + [Required] public List Lines { get; set; } = new(); +} \ No newline at end of file diff --git a/Wonky.Entity/DTO/ESalesHeadListView.cs b/Wonky.Entity/DTO/ESalesHeadListView.cs new file mode 100644 index 00000000..66c74757 --- /dev/null +++ b/Wonky.Entity/DTO/ESalesHeadListView.cs @@ -0,0 +1,10 @@ +namespace Wonky.Entity.DTO; + +public class ESalesHeadListView +{ + public string SalesHeadId { get; set; } = ""; + public string ReferenceNumber { get; set; } = ""; + public string YourRef { get; set; } = ""; + public bool Closed { get; set; } + public string OrderDate { get; set; } = ""; +} \ No newline at end of file diff --git a/Wonky.Entity/DTO/ESalesHeadView.cs b/Wonky.Entity/DTO/ESalesHeadView.cs new file mode 100644 index 00000000..1daf9745 --- /dev/null +++ b/Wonky.Entity/DTO/ESalesHeadView.cs @@ -0,0 +1,13 @@ +namespace Wonky.Entity.DTO; + +public class ESalesHeadView +{ + public string SalesHeadId { get; set; } = ""; + public string OurRef { get; set; } = ""; + public string ReferenceNumber { get; set; } = ""; + public string YourRef { get; set; } = ""; + public string OrderNote { get; set; } = ""; + public bool Closed { get; set; } + public string OrderDate { get; set; } = ""; + public List Lines { get; set; } = new(); +} \ No newline at end of file diff --git a/Wonky.Entity/DTO/ESalesLineCreateDto.cs b/Wonky.Entity/DTO/ESalesLineCreateDto.cs new file mode 100644 index 00000000..26b66223 --- /dev/null +++ b/Wonky.Entity/DTO/ESalesLineCreateDto.cs @@ -0,0 +1,10 @@ +using System.ComponentModel.DataAnnotations; + +namespace Wonky.Entity.DTO; + +public class ESalesLineCreateDto +{ + [Required] [MaxLength(20)] public string Sku { get; set; } = ""; + [Required] public int Qty { get; set; } + [Required] [MaxLength(40)] public string Text { get; set; } = ""; +} \ No newline at end of file diff --git a/Wonky.Entity/DTO/ESalesLineView.cs b/Wonky.Entity/DTO/ESalesLineView.cs new file mode 100644 index 00000000..868f3e44 --- /dev/null +++ b/Wonky.Entity/DTO/ESalesLineView.cs @@ -0,0 +1,9 @@ +namespace Wonky.Entity.DTO; + +public class ESalesLineView +{ + public string SalesLineId { get; set; } = ""; + public string Sku { get; set; } = ""; + public int Qty { get; set; } + public string Text { get; set; } = ""; +} \ No newline at end of file diff --git a/alpha-build.sh b/alpha-build.sh index 330178d6..0488f1df 100755 --- a/alpha-build.sh +++ b/alpha-build.sh @@ -23,6 +23,7 @@ dotnet publish -c release cp --recursive /a/projects/inno/a/Wonky.Client/Wonky.Client/bin/Release/net7.0/publish/* "/a/projects/inno/version-sync/${FOLDER}" +sed -i 's|\"baseUrl\".*|\"baseUrl\": \"https://dev.innotec.dk\",|g' "${FILE}" sed -i 's|\"rc\".*|\"rc\": true,|g' "${FILE}" printf "\n==> done building: ${FOLDER} ${1}\n" diff --git a/eta-build.sh b/eta-build.sh index 3a849a4c..5f66e1b7 100755 --- a/eta-build.sh +++ b/eta-build.sh @@ -30,6 +30,6 @@ sed -i 's|\"Default": \"None\",|\"Default": \"Debug\",|g' "${FILE}" sed -i 's|\"System": \"None\",|\"System": \"Debug\",|g' "${FILE}" sed -i 's|\"Microsoft\": \"None\",|\"Microsoft\": \"Information\",|g' "${FILE}" -sed -i 's|\"baseUrl\".*|\"baseUrl\": \"https://eta.innotec.dk\",|g' "${FILE}" +sed -i 's|\"baseUrl\".*|\"baseUrl\": \"https://dev.innotec.dk\",|g' "${FILE}" printf "\n==> done building: ${FOLDER} EDU SANDBOX\n" diff --git a/zeta-build.sh b/zeta-build.sh index 95bf5f52..1dbf5e26 100755 --- a/zeta-build.sh +++ b/zeta-build.sh @@ -30,6 +30,6 @@ sed -i 's|\"Default": \"None\",|\"Default": \"Debug\",|g' "${FILE}" sed -i 's|\"System": \"None\",|\"System": \"Debug\",|g' "${FILE}" sed -i 's|\"Microsoft\": \"None\",|\"Microsoft\": \"Information\",|g' "${FILE}" -sed -i 's|\"baseUrl\".*|\"baseUrl\": \"https://eta.innotec.dk\",|g' "${FILE}" +sed -i 's|\"baseUrl\".*|\"baseUrl\": \"https://dev.innotec.dk\",|g' "${FILE}" printf "\n==> done building: ${FOLDER} RC\n"