diff --git a/Wonky.Client/Components/CustomerInventoryListComponent.razor.cs b/Wonky.Client/Components/CustomerInventoryListComponent.razor.cs index febf2316..20b5df32 100644 --- a/Wonky.Client/Components/CustomerInventoryListComponent.razor.cs +++ b/Wonky.Client/Components/CustomerInventoryListComponent.razor.cs @@ -26,7 +26,7 @@ public partial class CustomerInventoryListComponent { [Inject] public ILocalStorageService Storage { get; set; } // Parameters - [Parameter] public List Inventory { get; set; } = new(); + [Parameter] public List Inventory { get; set; } = new(); [Parameter] public string CompanyId { get; set; } = ""; [Parameter] public EventCallback OnReorderSelected { get; set; } diff --git a/Wonky.Client/Components/CustomerProductCheckListComponent.razor.cs b/Wonky.Client/Components/CustomerProductCheckListComponent.razor.cs index 71f84b6f..67f31bba 100644 --- a/Wonky.Client/Components/CustomerProductCheckListComponent.razor.cs +++ b/Wonky.Client/Components/CustomerProductCheckListComponent.razor.cs @@ -23,7 +23,7 @@ using Wonky.Entity.Views; namespace Wonky.Client.Components; public partial class CustomerProductCheckListComponent { - [Parameter] public List Inventory { get; set; } = new(); + [Parameter] public List Inventory { get; set; } = new(); [Parameter] public string CompanyId { get; set; } = ""; [Inject] public ILocalStorageService Storage { get; set; } // private variables diff --git a/Wonky.Client/Components/OfficeCountryCustomerListComponent.razor.cs b/Wonky.Client/Components/OfficeCountryCustomerListComponent.razor.cs index 84792173..a01f8562 100644 --- a/Wonky.Client/Components/OfficeCountryCustomerListComponent.razor.cs +++ b/Wonky.Client/Components/OfficeCountryCustomerListComponent.razor.cs @@ -54,7 +54,7 @@ public partial class OfficeCountryCustomerListComponent // variables private InvoiceListView InvoiceList { get; set; } = new(); private List ActivityList { get; set; } = new(); - private List ProductList { get; set; } = new(); + private List ProductList { get; set; } = new(); private CompanyDto SelectedCompany { get; set; } = new(); // ****************************************************** diff --git a/Wonky.Client/Components/OfficeInventoryListComponent.razor.cs b/Wonky.Client/Components/OfficeInventoryListComponent.razor.cs index a3a81c7b..ec610356 100644 --- a/Wonky.Client/Components/OfficeInventoryListComponent.razor.cs +++ b/Wonky.Client/Components/OfficeInventoryListComponent.razor.cs @@ -29,7 +29,7 @@ public partial class OfficeInventoryListComponent [Inject] public ILocalStorageService Storage { get; set; } // ************************************************************* // Parameters - [Parameter] public List Inventory { get; set; } = new(); + [Parameter] public List Inventory { get; set; } = new(); [Parameter] public string CompanyId { get; set; } = ""; [Parameter] public EventCallback OnReorderSelected { get; set; } // ************************************************************* diff --git a/Wonky.Client/HttpRepository/CountryCustomerHistoryRepository.cs b/Wonky.Client/HttpRepository/CountryCustomerHistoryRepository.cs index 3c51ad5c..f9ed4f9a 100644 --- a/Wonky.Client/HttpRepository/CountryCustomerHistoryRepository.cs +++ b/Wonky.Client/HttpRepository/CountryCustomerHistoryRepository.cs @@ -79,7 +79,7 @@ public class CountryCustomerHistoryRepository : ICountryCustomerHistoryRepositor } - public async Task> GetInventory(string countryCode, string companyId) + public async Task> GetInventory(string countryCode, string companyId) { var response = await _client .GetAsync($"{_api.OfficeCustomers}/{countryCode}/{companyId}/history/inventory"); @@ -88,11 +88,11 @@ public class CountryCustomerHistoryRepository : ICountryCustomerHistoryRepositor if (!response.IsSuccessStatusCode || string.IsNullOrWhiteSpace(content)) { - return new List(); + return new List(); } - return JsonSerializer.Deserialize>(content, _options) - ?? new List(); + return JsonSerializer.Deserialize>(content, _options) + ?? new List(); } diff --git a/Wonky.Client/HttpRepository/CrmCustomerHistoryRepository.cs b/Wonky.Client/HttpRepository/CrmCustomerHistoryRepository.cs index 20bc2931..cd4d6711 100644 --- a/Wonky.Client/HttpRepository/CrmCustomerHistoryRepository.cs +++ b/Wonky.Client/HttpRepository/CrmCustomerHistoryRepository.cs @@ -75,15 +75,15 @@ public class CrmCustomerHistoryRepository : ICrmCustomerHistoryRepository /// /// /// - public async Task> FetchInventory(string companyId) + public async Task> FetchInventory(string companyId) { var response = await _client.GetAsync($"{_api.CrmCustomers}/{companyId}/{_api.CrmInventoryExt}"); if (!response.IsSuccessStatusCode) - return new List(); + return new List(); var content = await response.Content.ReadAsStringAsync(); return string.IsNullOrWhiteSpace(content) - ? new List() - : JsonSerializer.Deserialize>(content, _options); + ? new List() + : JsonSerializer.Deserialize>(content, _options); } /// diff --git a/Wonky.Client/HttpRepository/ICountryCustomerHistoryRepository.cs b/Wonky.Client/HttpRepository/ICountryCustomerHistoryRepository.cs index 564a8e0a..ac080859 100644 --- a/Wonky.Client/HttpRepository/ICountryCustomerHistoryRepository.cs +++ b/Wonky.Client/HttpRepository/ICountryCustomerHistoryRepository.cs @@ -23,7 +23,7 @@ public interface ICountryCustomerHistoryRepository Task GetInvoice(string countryCode, string companyId, string invoiceId); - Task> GetInventory(string countryCode, string companyId); + Task> GetInventory(string countryCode, string companyId); Task> GetHistory(string countryCode, string companyId); diff --git a/Wonky.Client/HttpRepository/ICrmCustomerHistoryRepository.cs b/Wonky.Client/HttpRepository/ICrmCustomerHistoryRepository.cs index eaabee83..e3323d02 100644 --- a/Wonky.Client/HttpRepository/ICrmCustomerHistoryRepository.cs +++ b/Wonky.Client/HttpRepository/ICrmCustomerHistoryRepository.cs @@ -42,7 +42,7 @@ public interface ICrmCustomerHistoryRepository /// /// /// - Task> FetchInventory(string companyId); + Task> FetchInventory(string companyId); /// /// Fetch History for given customer diff --git a/Wonky.Client/Models/DocRevisionDto.cs b/Wonky.Client/Models/DocRevisionDto.cs new file mode 100644 index 00000000..4a7692f9 --- /dev/null +++ b/Wonky.Client/Models/DocRevisionDto.cs @@ -0,0 +1,30 @@ +using System.ComponentModel.DataAnnotations; +using Wonky.Entity.DTO; + +namespace Wonky.Client.Models; + +public class DocRevisionDto +{ + [Required] public string EyeCleanerLocation { get; set; } = ""; + [Required]public string FirstAidLocation { get; set; } = ""; + [Required]public string GlovesStorage { get; set; } = ""; + [Required]public string GogglesStorage { get; set; } = ""; + [Required]public string MaskStorage { get; set; } = ""; + [Required]public string ProductStorage { get; set; } = ""; + [Required]public string WasteDeposit { get; set; } = ""; + [Required]public string AuthoredBy { get; set; } = ""; + [Required]public string ApprovedBy { get; set; } = ""; + [Required]public string ApprovedDate { get; set; } = ""; + [Required]public string FollowupDate { get; set; } = ""; + + public List Items { get; set; } = new(); +} + +public class DocRevisionItemDto +{ + public string VariantId { get; set; } = ""; + public string VariantName { get; set; } = ""; + public string S5A { get; set; } = ""; + public string S9A { get; set; } = ""; + public bool Selected { get; set; } = true; +} diff --git a/Wonky.Client/Models/DocSelectDisplay.cs b/Wonky.Client/Models/DocSelectDisplay.cs new file mode 100644 index 00000000..73d3e241 --- /dev/null +++ b/Wonky.Client/Models/DocSelectDisplay.cs @@ -0,0 +1,10 @@ +namespace Wonky.Client.Models; + +public class DocSelectDisplay +{ + public string S5A { get; set; } = ""; + public string S9A { get; set; } = ""; + public bool Selected { get; set; } + public string VariantId { get; set; } = ""; + public string VariantName { get; set; } = ""; +} \ No newline at end of file diff --git a/Wonky.Client/OverlayCustomer/CustomerInventoryListOverlay.razor.cs b/Wonky.Client/OverlayCustomer/CustomerInventoryListOverlay.razor.cs index 1f7b9175..b1c15dfa 100644 --- a/Wonky.Client/OverlayCustomer/CustomerInventoryListOverlay.razor.cs +++ b/Wonky.Client/OverlayCustomer/CustomerInventoryListOverlay.razor.cs @@ -32,7 +32,7 @@ public partial class CustomerInventoryListOverlay : IDisposable [Parameter] public string CompanyName { get; set; } = ""; [Parameter] public string CompanyId { get; set; } = ""; [Parameter] public string CountryCode { get; set; } = ""; - [Parameter] public List Inventory { get; set; } = new(); + [Parameter] public List Inventory { get; set; } = new(); [Parameter] public EventCallback OnSelected { get; set; } diff --git a/Wonky.Client/OverlayDocuments/ProductSelectionOverlay.razor b/Wonky.Client/OverlayDocuments/ProductSelectionOverlay.razor index 81ebe666..eac4e6c0 100644 --- a/Wonky.Client/OverlayDocuments/ProductSelectionOverlay.razor +++ b/Wonky.Client/OverlayDocuments/ProductSelectionOverlay.razor @@ -23,6 +23,44 @@ diff --git a/Wonky.Client/OverlayDocuments/ProductSelectionOverlay.razor.cs b/Wonky.Client/OverlayDocuments/ProductSelectionOverlay.razor.cs index ea8779c5..917cb4c0 100644 --- a/Wonky.Client/OverlayDocuments/ProductSelectionOverlay.razor.cs +++ b/Wonky.Client/OverlayDocuments/ProductSelectionOverlay.razor.cs @@ -14,6 +14,7 @@ // using Microsoft.AspNetCore.Components; +using Wonky.Client.Models; using Wonky.Entity.Views; namespace Wonky.Client.OverlayDocuments; @@ -21,7 +22,8 @@ namespace Wonky.Client.OverlayDocuments; public partial class ProductSelectionOverlay { //############################################################### - [Parameter] public List ProductListViews { get; set; } = new(); + [Parameter] public List CurProducts { get; set; } = new(); + [Parameter] public List NewProducts { get; set; } = new(); [Parameter] public EventCallback OnSelected { get; set; } //############################################################### diff --git a/Wonky.Client/OverlayOffice/OfficeCustomerProductListOverlay.razor.cs b/Wonky.Client/OverlayOffice/OfficeCustomerProductListOverlay.razor.cs index 695e23d0..4017113e 100644 --- a/Wonky.Client/OverlayOffice/OfficeCustomerProductListOverlay.razor.cs +++ b/Wonky.Client/OverlayOffice/OfficeCustomerProductListOverlay.razor.cs @@ -40,7 +40,7 @@ public partial class OfficeCustomerProductListOverlay : IDisposable private bool Descending { get; set; } [Parameter] public CompanyDto Company { get; set; } = new(); - [Parameter] public List Inventory { get; set; } = new(); + [Parameter] public List Inventory { get; set; } = new(); protected override void OnParametersSet() { diff --git a/Wonky.Client/OverlayOffice/OfficeOrderInventoryListOverlay.razor.cs b/Wonky.Client/OverlayOffice/OfficeOrderInventoryListOverlay.razor.cs index 6dc9db6a..a6f0c2fc 100644 --- a/Wonky.Client/OverlayOffice/OfficeOrderInventoryListOverlay.razor.cs +++ b/Wonky.Client/OverlayOffice/OfficeOrderInventoryListOverlay.razor.cs @@ -31,7 +31,7 @@ public partial class OfficeOrderInventoryListOverlay : IDisposable [Inject] public ILogger Logger { get; set; } [Parameter] public CompanyDto Company { get; set; } = new(); - [Parameter] public List Inventory { get; set; } = new(); + [Parameter] public List Inventory { get; set; } = new(); [Parameter] public EventCallback OnSelected { get; set; } private string _modalDisplay = ""; diff --git a/Wonky.Client/OverlayOrderCreate/ProductCheckConfirmationOverlay.razor.cs b/Wonky.Client/OverlayOrderCreate/ProductCheckConfirmationOverlay.razor.cs index f96e40f3..db5b8ff1 100644 --- a/Wonky.Client/OverlayOrderCreate/ProductCheckConfirmationOverlay.razor.cs +++ b/Wonky.Client/OverlayOrderCreate/ProductCheckConfirmationOverlay.razor.cs @@ -25,7 +25,7 @@ public partial class ProductCheckConfirmationOverlay private bool _showBackdrop; [Parameter] public string BodyMessage { get; set; } = ""; [Parameter] public string CompanyId { get; set; } = ""; - [Parameter] public List Products { get; set; } = new(); + [Parameter] public List Products { get; set; } = new(); [Parameter] public EventCallback OnOkClicked { get; set; } public void Show() diff --git a/Wonky.Client/Pages/AdvisorActivityCreatePage.razor.cs b/Wonky.Client/Pages/AdvisorActivityCreatePage.razor.cs index 3598d6bc..5ddf15d5 100644 --- a/Wonky.Client/Pages/AdvisorActivityCreatePage.razor.cs +++ b/Wonky.Client/Pages/AdvisorActivityCreatePage.razor.cs @@ -92,8 +92,8 @@ public partial class AdvisorActivityCreatePage : IDisposable private CustomerActivityListOverlay ActivityListOverlay { get; set; } = new(); // ############################################################# - private List Inventory { get; set; } = new(); - private List CheckList { get; set; } = new(); + private List Inventory { get; set; } = new(); + private List CheckList { get; set; } = new(); private InvoiceListView CompanyInvoices { get; set; } = new(); private List Activities { get; set; } = new(); private bool Kanvas { get; set; } @@ -144,6 +144,11 @@ public partial class AdvisorActivityCreatePage : IDisposable // decide if new or recall Activity.ActivityVisitEnum = Company.Account.StartsWith("NY") ? "new" : "recall"; + if (string.IsNullOrWhiteSpace(Company.Segment) && SalesRep.CountryCode.ToLower() == "dk") + { + Toaster.ShowError("Der mangler information om Segment. Ret kunde segment, gem erp data og prøv igen."); + Navigator.NavigateTo($"/advisor/customers/{CompanyId}"); + } } // Populate base activity information @@ -292,7 +297,7 @@ public partial class AdvisorActivityCreatePage : IDisposable else { // deserialize storage data - CheckList = JsonSerializer.Deserialize>(pStorage); + CheckList = JsonSerializer.Deserialize>(pStorage) ?? new List(); if (CheckList.Any()) CheckList = CheckList.OrderBy(x => x.Description).ToList(); } diff --git a/Wonky.Client/Pages/AdvisorCustomerCreatePage.razor b/Wonky.Client/Pages/AdvisorCustomerCreatePage.razor index 7da11f27..e32d3cfd 100644 --- a/Wonky.Client/Pages/AdvisorCustomerCreatePage.razor +++ b/Wonky.Client/Pages/AdvisorCustomerCreatePage.razor @@ -17,6 +17,7 @@ @page "/advisor/customers/new" @using Microsoft.AspNetCore.Authorization @using Wonky.Client.Components +@using System.Xml @attribute [Authorize(Roles = "Advisor")] Rådgiver Opret Kunde @@ -48,43 +49,69 @@ @* entity name *@ -
+
@* entity attention *@ -
+
@* entity address 1 *@ -
+
@* entity address 2 *@ -
+
@* entity postal code *@ -
+
@* entity city name *@ -
+
+ @* entity email *@ + +
+ + +
+ + @* entity phone *@ + +
+ + +
+ + @* entity mobile *@ + +
+ + +
+ + @* placeholder *@ +
+ @* placeholder *@ +
+ @* entity vat number *@ -
+
@@ -93,24 +120,33 @@
- @* entity phone *@ - -
- - -
+ @* entity segment *@ + @if (UserInfo.CountryCode.ToLower() == "dk") + { + +
+ + + + + + +
+ } + else + { +
+ @* placeholder *@ +
+ } @* entity mobile *@ - -
- - -
- @* entity email *@ - -
- - + +
+ +
+

diff --git a/Wonky.Client/Pages/AdvisorCustomerCreatePage.razor.cs b/Wonky.Client/Pages/AdvisorCustomerCreatePage.razor.cs index a50f758b..b00d5c18 100644 --- a/Wonky.Client/Pages/AdvisorCustomerCreatePage.razor.cs +++ b/Wonky.Client/Pages/AdvisorCustomerCreatePage.razor.cs @@ -54,6 +54,7 @@ public partial class AdvisorCustomerCreatePage : IDisposable private DateTime NextVisit { get; set; } private bool Dk { get; set; } = true; private bool Working { get; set; } + private UserManagerEditView UserInfo { get; set; } protected override async Task OnInitializedAsync() { @@ -62,11 +63,11 @@ public partial class AdvisorCustomerCreatePage : IDisposable CompanyContext.OnFieldChanged += HandleFieldChanged; CompanyContext.OnValidationStateChanged += ValidationChanged; - var xu = await UserInfoService.GetUserInfo(); - Dk = xu.CountryCode.ToLower() == "dk"; + UserInfo = await UserInfoService.GetUserInfo(); + Dk = UserInfo.CountryCode.ToLower() == "dk"; - Company.SalesRepId = xu.UserId; - Company.CountryCode = xu.CountryCode.ToLower(); + Company.SalesRepId = UserInfo.UserId; + Company.CountryCode = UserInfo.CountryCode.ToLower(); LastVisit = DateTime.Now; NextVisit = DateTime.Now.AddDays(Company.Interval * 7); @@ -161,6 +162,17 @@ public partial class AdvisorCustomerCreatePage : IDisposable FormInvalid = !CompanyContext.Validate(); } + // if dk then check content of segment + if (UserInfo.CountryCode.ToLower() == "dk") + { + if (string.IsNullOrWhiteSpace(Company.Segment)) + { + Toaster.ShowError("Segment skal vælges - AUTO eller INDUSTRI"); + FormInvalid = true; + return; + } + } + StateHasChanged(); } diff --git a/Wonky.Client/Pages/AdvisorCustomerInventoryListPage.razor.cs b/Wonky.Client/Pages/AdvisorCustomerInventoryListPage.razor.cs index faae3dd6..86795fa8 100644 --- a/Wonky.Client/Pages/AdvisorCustomerInventoryListPage.razor.cs +++ b/Wonky.Client/Pages/AdvisorCustomerInventoryListPage.razor.cs @@ -49,7 +49,7 @@ public partial class AdvisorCustomerInventoryListPage : IDisposable private bool Working { get; set; } = true; private SalesItemView SalesItem { get; set; } = new(); private CustomerInventoryReorderOverlay ReorderOverlay { get; set; } = new(); - private List Inventory { get; set; } = new(); + private List Inventory { get; set; } = new(); protected override async Task OnInitializedAsync() @@ -84,7 +84,7 @@ public partial class AdvisorCustomerInventoryListPage : IDisposable private async Task FetchProductInventory() { - Inventory = new List(); + Inventory = new List(); Inventory = await HistoryRepo.FetchInventory(CompanyId); if (Inventory.Any()) Inventory = Inventory.OrderBy(x => x.Description).ToList(); diff --git a/Wonky.Client/Pages/AdvisorCustomerPagedListPage.razor.cs b/Wonky.Client/Pages/AdvisorCustomerPagedListPage.razor.cs index ea14b873..9cde836b 100644 --- a/Wonky.Client/Pages/AdvisorCustomerPagedListPage.razor.cs +++ b/Wonky.Client/Pages/AdvisorCustomerPagedListPage.razor.cs @@ -79,7 +79,7 @@ public partial class AdvisorCustomerPagedListPage : IDisposable { Working = true; ShowFolded = !ShowFolded; - ToggleFoldedText = ShowFolded ? "Normal Visning" : "Vis Lukkede"; + ToggleFoldedText = ShowFolded ? "Normale" : "Lukkede"; CompanyList = new List(); Paging.PageNumber = 1; Paging.HasFolded = ShowFolded ? 1 : 0; @@ -90,7 +90,7 @@ public partial class AdvisorCustomerPagedListPage : IDisposable { Working = true; ShowHidden = !ShowHidden; - ToggleHiddenText = ShowHidden ? "Normal Visning" : "Inkl. Skjulte"; + ToggleHiddenText = ShowHidden ? "Aktive" : "Inaktive"; CompanyList = new List(); Paging.PageNumber = 1; Paging.IsHidden = ShowHidden ? 1 : 0; diff --git a/Wonky.Client/Pages/AdvisorCustomerViewEditPage.razor b/Wonky.Client/Pages/AdvisorCustomerViewEditPage.razor index db90f168..0e4d587d 100644 --- a/Wonky.Client/Pages/AdvisorCustomerViewEditPage.razor +++ b/Wonky.Client/Pages/AdvisorCustomerViewEditPage.razor @@ -28,11 +28,20 @@
}
-
+
@Company.Name (@Company.Account)
+
+ @if (AppInfo!.Value!.Rc) + { + @if (UserInfo.CountryCode is "DK") + { + Arbejdssted + } + } +
@@ -105,22 +114,31 @@ @if (!Kanvas) { - -
- - - - - - -
-
-
-
+ @* entity segment *@ + @if (UserInfo.CountryCode.ToLower() == "dk") + { + +
+ + + + + +
-
- +
+
+
+
+
+ } + else + { +
+ @* placeholder *@ +
+ } @* Enable edit/save *@
@@ -295,7 +313,10 @@
@if (AppInfo!.Value!.Rc) { - Kemi Dokumentation + @if (UserInfo.CountryCode is "DK") + { + Kemi Dokumentation + } }
diff --git a/Wonky.Client/Pages/AdvisorCustomerViewEditPage.razor.cs b/Wonky.Client/Pages/AdvisorCustomerViewEditPage.razor.cs index 8ee34fd0..6fc59bcb 100644 --- a/Wonky.Client/Pages/AdvisorCustomerViewEditPage.razor.cs +++ b/Wonky.Client/Pages/AdvisorCustomerViewEditPage.razor.cs @@ -94,7 +94,7 @@ public partial class AdvisorCustomerViewEditPage : IDisposable // assign event handlers to context ErpContext.OnFieldChanged += HandleFieldChanged; - ErpContext.OnValidationStateChanged += ValidationChanged; + ErpContext.OnValidationStateChanged += ValidationChanged!; // fetch user info from local storage UserInfo = await UserInfoService.GetUserInfo(); @@ -159,8 +159,10 @@ public partial class AdvisorCustomerViewEditPage : IDisposable // create search address from address if (CountryIsDk) + { CompanyVatAddress = PrepareVatAddress(Company); - + } + await FetchContacts(CompanyId); Working = false; diff --git a/Wonky.Client/Pages/CrmCustomerWorkplaceDocumentAddPage.razor b/Wonky.Client/Pages/CrmCustomerWorkplaceDocumentAddPage.razor index b4a177c5..8b825b08 100644 --- a/Wonky.Client/Pages/CrmCustomerWorkplaceDocumentAddPage.razor +++ b/Wonky.Client/Pages/CrmCustomerWorkplaceDocumentAddPage.razor @@ -18,71 +18,102 @@ @attribute [Authorize(Roles = "Advisor")] @page "/advisor/customers/{CompanyId}/workplaces/{WorkplaceId}/documents/new" @Workplace.CompanyName - @Workplace.Name -
-
-

@Workplace.CompanyName

-
-
-

@Workplace.Name @(!string.IsNullOrWhiteSpace(Workplace.Description) ? $"- {Workplace.Description}" : "")

+
+
+ @Workplace.CompanyName
+
+ @Workplace.Name@(!string.IsNullOrWhiteSpace(Workplace.Description) ? $"({Workplace.Description})" : "") +
+ @* locations *@
- + - +
- + - +
- + - +
- + - +
- + - +
- + - +
- + - + +
+
+
+
+
+
+ + + +
+
+
+
+ + + +
+
+
+
+ + + +
+
+
+
+ + +
@@ -94,8 +125,44 @@
- + @* current documents *@ +
+
+
+
+ Produkt Variant +
+
+ Opdater +
+
+
+ @foreach (var doc in DocumentsDto.Items) + { +
+
+
+ @doc.VariantName.ToUpperInvariant() +
+
+ +
+
+ @doc.S5A +
+
+ @doc.S9A +
+
+
+ } +
+
+
+
+
+ @if (Working) @@ -112,4 +179,4 @@
-*@ +*@ \ No newline at end of file diff --git a/Wonky.Client/Pages/CrmCustomerWorkplaceDocumentAddPage.razor.cs b/Wonky.Client/Pages/CrmCustomerWorkplaceDocumentAddPage.razor.cs index 6d7765e9..e64bd0ce 100644 --- a/Wonky.Client/Pages/CrmCustomerWorkplaceDocumentAddPage.razor.cs +++ b/Wonky.Client/Pages/CrmCustomerWorkplaceDocumentAddPage.razor.cs @@ -39,40 +39,74 @@ public partial class CrmCustomerWorkplaceDocumentAddPage : IDisposable [Inject] public NavigationManager Navigator { get; set; } [Inject] public ILogger Logger { get; set; } [Inject] public IToastService Toaster { get; set; } + [Inject] public IUserInfoService UserService { get; set; } // ############################################################# [Parameter] public string CompanyId { get; set; } = ""; [Parameter] public string WorkplaceId { get; set; } = ""; - + // ############################################################# + private UserManagerEditView UserInfo { get; set; } private EditContext FormContext { get; set; } private WorkplaceDto Workplace { get; set; } = new(); private WorkplaceInventory WorkplaceInventory { get; set; } = new(); private List AvailableProducts { get; set; } = new(); - private WorkplaceDocumentDto WorkplaceDocumentDto { get; set; } = new(); + private DocRevisionDto DocumentsDto { get; set; } = new(); private bool Working { get; set; } = true; private bool FormInvalid { get; set; } = true; - + private List CurDocuments { get; set; } = new(); + private List NewDocuments { get; set; } = new(); + protected override async Task OnInitializedAsync() { - FormContext = new EditContext(WorkplaceDocumentDto); + FormContext = new EditContext(DocumentsDto); Interceptor.RegisterEvent(); Interceptor.RegisterBeforeSendEvent(); - + + UserInfo = await UserService.GetUserInfo(); Workplace = await WorkplaceRepo.GetWorkplace(CompanyId, WorkplaceId); + Logger.LogDebug("Workplace {}", JsonSerializer.Serialize(Workplace, new JsonSerializerOptions(JsonSerializerDefaults.Web))); WorkplaceInventory = await WorkplaceRepo.GetWorkplaceInventory(CompanyId, WorkplaceId); AvailableProducts = await PublicProductRepo.GetProducts(); + + foreach (var variant in WorkplaceInventory.Products.SelectMany(product => product.Variants)) + { + CurDocuments.Add(new DocRevisionItemDto { VariantName = variant.VariantName, VariantId = variant.VariantId }); + } + + DocumentsDto.Items = CurDocuments; + Logger.LogDebug("Current Documents List {}", JsonSerializer.Serialize(CurDocuments, new JsonSerializerOptions(JsonSerializerDefaults.Web))); + foreach (var variant in AvailableProducts.SelectMany(product => product.Variants)) + { + var x = new DocRevisionItemDto { VariantName = variant.Name, VariantId = variant.VariantId }; + if (!CurDocuments.Contains(x)) + { + NewDocuments.Add(x); + } + } + Logger.LogDebug("New Documents List {}", JsonSerializer.Serialize(NewDocuments, new JsonSerializerOptions(JsonSerializerDefaults.Web))); + + DocumentsDto.GlovesStorage = Workplace.GlovesStorage; + DocumentsDto.GogglesStorage = Workplace.GogglesStorage; + DocumentsDto.MaskStorage = Workplace.MaskStorage; + DocumentsDto.ProductStorage = Workplace.ProductStorage; + DocumentsDto.EyeCleanerLocation = Workplace.EyeCleanerLocation; + DocumentsDto.FirstAidLocation = Workplace.FirstAidStorage; + DocumentsDto.WasteDeposit = Workplace.WasteDeposit; + + DocumentsDto.ApprovedDate = $"{DateTime.Now:yyyy-MM-dd}"; + DocumentsDto.AuthoredBy = $"{UserInfo.FirstName} {UserInfo.LastName}"; + DocumentsDto.FollowupDate = $"{DateTime.Now.AddMonths(24):yyyy-MM-dd}"; Working = false; } private void SubmitForm() { - } - + public void Dispose() { Interceptor.DisposeEvent(); - } -} + } +} \ No newline at end of file diff --git a/Wonky.Client/Pages/CrmCustomerWorkplaceListPage.razor b/Wonky.Client/Pages/CrmCustomerWorkplaceListPage.razor index 29cb075f..06e47635 100644 --- a/Wonky.Client/Pages/CrmCustomerWorkplaceListPage.razor +++ b/Wonky.Client/Pages/CrmCustomerWorkplaceListPage.razor @@ -23,13 +23,13 @@
-
-

@Company.Name

+
+ Arbejdssteder @Company.Name
-
+ - diff --git a/Wonky.Client/Pages/CrmCustomerWorkplaceListPage.razor.cs b/Wonky.Client/Pages/CrmCustomerWorkplaceListPage.razor.cs index 85bc8f49..5c9c0a35 100644 --- a/Wonky.Client/Pages/CrmCustomerWorkplaceListPage.razor.cs +++ b/Wonky.Client/Pages/CrmCustomerWorkplaceListPage.razor.cs @@ -29,7 +29,9 @@ public partial class CrmCustomerWorkplaceListPage : IDisposable // ############################################################### [Inject] public ICrmWorkplaceRepository WorkplaceRepo { get; set; } [Inject] public ICrmCustomerRepository CustomerRepo { get; set; } - [Inject] public HttpInterceptorService Interceptor { get; set; } + [Inject] public HttpInterceptorService Interceptor { get; set; } + [Inject] public NavigationManager Navigator { get; set; } + // ############################################################### [Parameter] public string CompanyId { get; set; } = ""; @@ -50,15 +52,14 @@ public partial class CrmCustomerWorkplaceListPage : IDisposable await Task.Delay(150); Workplaces = await WorkplaceRepo.GetWorkplaces(CompanyId); + if (Workplaces.Count == 1) + { + Navigator.NavigateTo($"/advisor/customers/{CompanyId}/workplaces/{Workplaces[0].WorkplaceId}"); + } Working = false; } - - private async Task> GetWorkplaces() - { - return await WorkplaceRepo.GetWorkplaces(CompanyId); - } public void Dispose() { diff --git a/Wonky.Client/Pages/CrmCustomerWorkplaceNewPage.razor b/Wonky.Client/Pages/CrmCustomerWorkplaceNewPage.razor index 12ae5944..1748458f 100644 --- a/Wonky.Client/Pages/CrmCustomerWorkplaceNewPage.razor +++ b/Wonky.Client/Pages/CrmCustomerWorkplaceNewPage.razor @@ -20,7 +20,7 @@ @Company.Name - Opret Arbejdssted
-

@Company.Name Opret Arbejdssted

+ @Company.Name - Opret Arbejdssted
Stamkort diff --git a/Wonky.Client/Pages/CrmCustomerWorkplaceNewPage.razor.cs b/Wonky.Client/Pages/CrmCustomerWorkplaceNewPage.razor.cs index a56e76d0..11842e59 100644 --- a/Wonky.Client/Pages/CrmCustomerWorkplaceNewPage.razor.cs +++ b/Wonky.Client/Pages/CrmCustomerWorkplaceNewPage.razor.cs @@ -75,7 +75,9 @@ public partial class CrmCustomerWorkplaceNewPage : IDisposable { Logger.LogDebug("CompanyId {}", JsonSerializer.Serialize(Workplace)); Logger.LogDebug("Workplace {}", JsonSerializer.Serialize(Workplace, new JsonSerializerOptions(JsonSerializerDefaults.Web))); + var result = await WorkplaceRepo.CreateWorkplace(CompanyId, Workplace); + Logger.LogDebug("HTTP result {}", result); if (!string.IsNullOrWhiteSpace(result)) { diff --git a/Wonky.Client/Pages/CrmCustomerWorkplaceViewEditPage.razor b/Wonky.Client/Pages/CrmCustomerWorkplaceViewEditPage.razor index eedebe08..769cc6a3 100644 --- a/Wonky.Client/Pages/CrmCustomerWorkplaceViewEditPage.razor +++ b/Wonky.Client/Pages/CrmCustomerWorkplaceViewEditPage.razor @@ -17,19 +17,28 @@ @using Wonky.Client.Components @attribute [Authorize(Roles = "Advisor")] @page "/advisor/customers/{CompanyId}/workplaces/{WorkplaceId}" + @Workplace.CompanyName - @Workplace.Name +
-
-

@Workplace.CompanyName

-
-
-

@Workplace.Name @(!string.IsNullOrWhiteSpace(Workplace.Description) ? $"- {Workplace.Description}" : "")

+
+ @Workplace.CompanyName
- Tilbage + @if (OnlyOne) + { + Tilbage + } + else + { + Tilbage + } +
+
+ @Workplace.Name @(!string.IsNullOrWhiteSpace(Workplace.Description) ? $" ({Workplace.Description})" : "")
@@ -114,11 +123,11 @@ Vis QR-koder
- + Opret / Ændre
-