diff --git a/Wonky.Client/HttpRepository/AdvisorWorkplaceRepository.cs b/Wonky.Client/HttpRepository/AdvisorWorkplaceRepository.cs index edfb1558..f546373e 100644 --- a/Wonky.Client/HttpRepository/AdvisorWorkplaceRepository.cs +++ b/Wonky.Client/HttpRepository/AdvisorWorkplaceRepository.cs @@ -35,6 +35,7 @@ public class AdvisorWorkplaceRepository : IAdvisorWorkplaceRepository private readonly HttpClient _client; private readonly ApiConfig _api; + public AdvisorWorkplaceRepository(HttpClient client, ILogger logger, NavigationManager navigation, @@ -46,6 +47,7 @@ public class AdvisorWorkplaceRepository : IAdvisorWorkplaceRepository _api = configuration.Value; } + public async Task> GetWorkplaces(string companyId) { var result = await _client.GetAsync( @@ -58,6 +60,7 @@ public class AdvisorWorkplaceRepository : IAdvisorWorkplaceRepository return JsonSerializer.Deserialize>(content, _options) ?? new List(); } + public async Task GetWorkplace(string companyId, string workplaceId) { var result = await _client.GetAsync( @@ -70,6 +73,7 @@ public class AdvisorWorkplaceRepository : IAdvisorWorkplaceRepository return JsonSerializer.Deserialize(content, _options) ?? new WorkplaceDto(); } + public async Task GetWorkplaceInventory(string companyId, string workplaceId) { var result = await _client.GetAsync( @@ -82,6 +86,7 @@ public class AdvisorWorkplaceRepository : IAdvisorWorkplaceRepository return JsonSerializer.Deserialize(content, _options) ?? new WorkplaceInventory(); } + public async Task CreateWorkplace(string companyId, WorkplaceDto workplace) { var result = await _client.PostAsJsonAsync( @@ -94,18 +99,28 @@ public class AdvisorWorkplaceRepository : IAdvisorWorkplaceRepository return content; } + public async Task UpdateWorkplace(string companyId, WorkplaceDto workplace) { await _client.PutAsJsonAsync( $"{_api.CrmCustomers}/{companyId}/{_api.CrmWorkplaceExt}/{workplace.WorkplaceId}", workplace, _options); } + public async Task DeleteWorkplace(string companyId, string workplaceId) { await _client.DeleteAsync( $"{_api.CrmCustomers}/{companyId}/{_api.CrmWorkplaceExt}/{workplaceId}"); } + + public async Task DeleteWorkplaceDocuments(string companyId, string workplaceId, string documentId) + { + await _client.DeleteAsync( + $"{_api.CrmCustomers}/{companyId}/{_api.CrmWorkplaceExt}/{workplaceId}/documents/{documentId}"); + } + + public async Task DeleteWorkplaceDocuments(string companyId, string workplaceId, string apbDocumentId, string apvDocumentId) { await _client.DeleteAsync( diff --git a/Wonky.Client/HttpRepository/IAdvisorWorkplaceRepository.cs b/Wonky.Client/HttpRepository/IAdvisorWorkplaceRepository.cs index 5876ec75..f376da68 100644 --- a/Wonky.Client/HttpRepository/IAdvisorWorkplaceRepository.cs +++ b/Wonky.Client/HttpRepository/IAdvisorWorkplaceRepository.cs @@ -79,4 +79,6 @@ public interface IAdvisorWorkplaceRepository /// /// Task DeleteWorkplaceDocuments(string companyId, string workplaceId, string apbDocumentId, string apvDocumentId); + + Task DeleteWorkplaceDocuments(string companyId, string workplaceId, string documentId); } \ No newline at end of file diff --git a/Wonky.Client/Models/DocView.cs b/Wonky.Client/Models/DocView.cs new file mode 100644 index 00000000..d7c39a48 --- /dev/null +++ b/Wonky.Client/Models/DocView.cs @@ -0,0 +1,15 @@ +using System.ComponentModel.DataAnnotations; + +namespace Wonky.Client.Models; + +public class DocView +{ + public string ApbDocId { get; set; } = ""; + public string ApbDocLink { get; set; } = ""; + public string ApvDocId { get; set; } = ""; + public string ApvDocLink { get; set; } = ""; + public string DocumentDate { get; set; } = ""; + public string ProductId { get; set; } = ""; + public string VariantId { get; set; } = ""; + public string VariantName { get; set; } = ""; +} \ No newline at end of file diff --git a/Wonky.Client/Pages/AdvisorActivityCreatePage.razor b/Wonky.Client/Pages/AdvisorActivityCreatePage.razor index f7702754..8cb1e2d9 100644 --- a/Wonky.Client/Pages/AdvisorActivityCreatePage.razor +++ b/Wonky.Client/Pages/AdvisorActivityCreatePage.razor @@ -53,14 +53,13 @@ else { -
@if (Kanvas) { - + } else { @@ -131,7 +130,7 @@ else
- } + } else { @@ -191,204 +190,204 @@ else @if (!Kanvas) { -
-
- @* +
+
+ @* ***************** Invoice history overlay ***************************** *@ - -
-
- @* + +
+
+ @* ***************** Visit hisotry overlay ***************************** *@ - -
-
- @* + +
+
+ @* ***************** Product Inventory overlay ***************************** *@ - -
-
- -
- @* Draft lines in draft -----------------------------------------------------*@ -
-
- - - - - - - - - - - - - - - - - - - @if (DraftProvider.Draft.Items.Count > 0) - { - @foreach (var cartItem in DraftProvider.Draft.Items) - { - - - - - - - - - - - } - } - - - - - - - - -
- Ordrekladde Global kladde (udløber efter @(DraftProvider.Draft.TimeToLiveInSeconds / 60)m inaktivitet) - - @* - ***************** Reset draft ***************************** - *@ - -
NavnVarenrAntalEnhedspris%LinjesumSAS
@cartItem.Item.Name@cartItem.Item.Sku@cartItem.Quantity@($"{cartItem.Price:N2}")@($"{cartItem.Discount:N2}")@($"{cartItem.LineTotal:N2}") - - - @* - ***************** Remove item ***************************** - *@ - -
Total@($"{DraftProvider.Draft.Total:N2}") - @* - ***************** Price catalog overlay button ***************************** - *@ - -
+
- @* Create Draft line ----------------------------------------------------- *@ -
-
- @if (!string.IsNullOrWhiteSpace(SelectedItem.Name) && ShowItem) - { - + +
+ @* Draft lines in draft -----------------------------------------------------*@ +
+
+
- + + - - - - - - + + + + + + + + - - - + + + + + + + + - - - - + + } + } + + + + + +
Kladdelinje + Ordrekladde Global kladde (udløber efter @(DraftProvider.Draft.TimeToLiveInSeconds / 60)m inaktivitet) + + @* + ***************** Reset draft ***************************** + *@ + +
AntalPrisRabatSASVarenr.
NavnVarenrAntalEnhedspris%LinjesumSAS
- - -
- - @* - ***************** Product Price history overlay button ********************* + @if (DraftProvider.Draft.Items.Count > 0) + { + @foreach (var cartItem in DraftProvider.Draft.Items) + { +
@cartItem.Item.Name@cartItem.Item.Sku@cartItem.Quantity@($"{cartItem.Price:N2}")@($"{cartItem.Discount:N2}")@($"{cartItem.LineTotal:N2}") + + + @* + ***************** Remove item ***************************** *@ - - - - - - - @SelectedItem.Sku + +
Total@($"{DraftProvider.Draft.Total:N2}") @* - ***************** Add item button ***************************** - *@ - + ***************** Price catalog overlay button ***************************** + *@ +
- } +
+ @* Create Draft line ----------------------------------------------------- *@ +
+
+ @if (!string.IsNullOrWhiteSpace(SelectedItem.Name) && ShowItem) + { + + + + + + + + + + + + + + + + + + + + + + + + +
Kladdelinje
AntalPrisRabatSASVarenr.
+ + +
+ + @* + ***************** Product Price history overlay button ********************* + *@ + +
+
+ + + + @SelectedItem.Sku + @* + ***************** Add item button ***************************** + *@ + +
+ } +
+
+ @* end draft line ------------------------------------------------- *@
- @* end draft line ------------------------------------------------- *@ -
-
- @* Delivery address *@ -
-

- -

-
-
-
- -
- +
+ @* Delivery address *@ +
+

+ +

+
+
+
+ +
+ +
-
-
- -
- +
+ +
+ +
-
-
- -
- +
+ +
+ +
-
-
- -
- +
+ +
+ +
-
-
- -
- +
+ +
+ +
-
} - -
+ +
@* diff --git a/Wonky.Client/Pages/AdvisorCustomerViewEditPage.razor b/Wonky.Client/Pages/AdvisorCustomerViewEditPage.razor index 3c125e97..af02ab6c 100644 --- a/Wonky.Client/Pages/AdvisorCustomerViewEditPage.razor +++ b/Wonky.Client/Pages/AdvisorCustomerViewEditPage.razor @@ -52,7 +52,7 @@ }
- @Company.Name (@Company.Account) + @Company.Name (@Company.Account)
// erp context @@ -128,7 +128,7 @@ @* *@
-
+
@@ -139,7 +139,7 @@ @* placeholder *@
} - + @* Enable edit/save *@
@@ -305,19 +305,19 @@
-
-
- -
-
- @if (AppInfo.Value.Rc) - { - Kemi Dokumentation - } -
-
} +
+
+ +
+
+ @if (AppInfo.Value.Rc) + { + Kemi Dokumentation + } +
+
} @if (Working) diff --git a/Wonky.Client/Pages/AdvisorCustomerWorkplaceDocumentListPage.razor b/Wonky.Client/Pages/AdvisorCustomerWorkplaceDocumentListPage.razor deleted file mode 100644 index e9f14861..00000000 --- a/Wonky.Client/Pages/AdvisorCustomerWorkplaceDocumentListPage.razor +++ /dev/null @@ -1,85 +0,0 @@ -@* 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 Wonky.Client.Components -@attribute [Authorize(Roles = "Advisor")] -@page "/advisor/customers/{CompanyId}/workplaces/{WorkplaceId}/documents" - -Dokumenter - @WorkplaceInventory.CompanyName - @WorkplaceInventory.WorkplaceName -
-
-

@WorkplaceInventory.CompanyName

-
-
-
-

@WorkplaceInventory.WorkplaceName Produkt Dokumentation

-
-
- -@if (WorkplaceInventory.Products.Any()) -{ -
    -
  1. -
    -
    - Produkt -
    -
    - APB -
    -
    - KAPV -
    -
    - Oprettet -
    -
    - -
    -
    -
  2. - @foreach (var document in Documents) - { -
  3. -
    - @document.ProductName -
    -
    - Vis APB -
    -
    - Vis KAPV -
    -
    - @document.DocumentDate -
    -
    - -
    -
  4. - } -
-} - - - -@if (Working) -{ - -} \ No newline at end of file diff --git a/Wonky.Client/Pages/AdvisorCustomerWorkplaceDocumentListPage.razor.cs b/Wonky.Client/Pages/AdvisorCustomerWorkplaceDocumentListPage.razor.cs deleted file mode 100644 index 9687e355..00000000 --- a/Wonky.Client/Pages/AdvisorCustomerWorkplaceDocumentListPage.razor.cs +++ /dev/null @@ -1,104 +0,0 @@ -// 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.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 AdvisorCustomerWorkplaceDocumentListPage : IDisposable -{ - // ################################################################## - [Inject] public HttpInterceptorService Interceptor { get; set; } - [Inject] public IAdvisorWorkplaceRepository WorkplaceRepo { get; set; } - - // ################################################################## - [Parameter] public string CompanyId { get; set; } = ""; - [Parameter] public string WorkplaceId { get; set; } = ""; - - // ################################################################## - private bool Working { get; set; } = true; - private WorkplaceInventory WorkplaceInventory { get; set; } = new(); - private List Documents { get; set; } = new(); - - - protected override async Task OnParametersSetAsync() - { - Interceptor.RegisterEvent(); - Interceptor.RegisterBeforeSendEvent(); - - Documents = await FetchDocuments(); - - Working = false; - } - - private async Task RemoveDocument(string apbId, string apvId) - { - await WorkplaceRepo.DeleteWorkplaceDocuments(CompanyId, WorkplaceId, apbId, apvId); - Documents = await FetchDocuments(); - } - - private async Task> FetchDocuments() - { - Documents = new List(); - WorkplaceInventory = await WorkplaceRepo.GetWorkplaceInventory(CompanyId, WorkplaceId); - foreach (var product in WorkplaceInventory.Products) - { - var newDoc = new Document(); - foreach (var variant in product.Variants) - { - newDoc.ProductName = variant.VariantName; - foreach (var doc in variant.Docs) - { - if (doc.DocumentTypeEnum == "Apb") - { - newDoc.ApbLink = doc.DocumentLink; - newDoc.ApbId = doc.DocumentId; - } - else - { - newDoc.ApvLink = doc.DocumentLink; - newDoc.ApvId = doc.DocumentId; - } - newDoc.DocumentDate = doc.DocumentDate; - - } - Documents.Add(newDoc); - } - } - - return Documents; - } - - public void Dispose() - { - Interceptor.DisposeEvent(); - } -} - -internal sealed class Document -{ - public string ProductName { get; set; } - public string ApbLink { get; set; } - public string ApvLink { get; set; } - public string DocumentDate { get; set; } - public string ApvId { get; set; } - public string ApbId { get; set; } -} \ No newline at end of file diff --git a/Wonky.Client/Pages/AdvisorCustomerWorkplaceListPage.razor b/Wonky.Client/Pages/AdvisorCustomerWorkplaceListPage.razor index 98883283..1499ebc4 100644 --- a/Wonky.Client/Pages/AdvisorCustomerWorkplaceListPage.razor +++ b/Wonky.Client/Pages/AdvisorCustomerWorkplaceListPage.razor @@ -24,13 +24,13 @@
-

@Company.Name

+

@Company.Name

- diff --git a/Wonky.Client/Pages/AdvisorCustomerWorkplaceNew.razor b/Wonky.Client/Pages/AdvisorCustomerWorkplaceNew.razor index 01be7c33..093f5e09 100644 --- a/Wonky.Client/Pages/AdvisorCustomerWorkplaceNew.razor +++ b/Wonky.Client/Pages/AdvisorCustomerWorkplaceNew.razor @@ -17,98 +17,92 @@ @page "/advisor/customers/{CompanyId}/workplaces/new" @using Microsoft.AspNetCore.Authorization -Opret arbejdssted - @Company.Name -
-
-
-
-

Opret arbejdssted for @Company.Name

-
-
+@Company.Name - Opret Arbejdssted +
+
+

@Company.Name Opret Arbejdssted

+
+ + +
+ + +
+
+
+ + + +
+
+
+
+ + + +
+
+
+
+ + + +
+
+
+
+ + + +
+
+
+
+ + + +
+
+
+
+ + + +
+
+
+
+ + + +
+
+
+
+ + + +
+
+
+
+ + +
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

Stamdata

-
Navn - - - Beskrivelse - - -
-

Placering og Opbevaring

-
Produkter - - - Øjenskylleflaske - - -
Masker - - - Førstehjælp - - -
Handsker - - -
Sikkerhedsbriller - - - Affald - - -
-
-
- -
-
-
+
+ +
+ +
-
\ No newline at end of file +
\ No newline at end of file diff --git a/Wonky.Client/Pages/AdvisorCustomerWorkplaceViewEditPage.razor b/Wonky.Client/Pages/AdvisorCustomerWorkplaceViewEditPage.razor index a1406bd2..0ad594a8 100644 --- a/Wonky.Client/Pages/AdvisorCustomerWorkplaceViewEditPage.razor +++ b/Wonky.Client/Pages/AdvisorCustomerWorkplaceViewEditPage.razor @@ -18,105 +18,139 @@ @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

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

Stamdata

-
Navn - - - Beskrivelse - - -
-

Placering og Opbevaring

-
Produkter - - - Øjenskylleflaske - - -
Masker - - - Førstehjælp - - -
Handsker - - -
Sikkerhedsbriller - - - Affald - - -
-
-
- -
-
- -
- -
-
+
+

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

+
+ +
+ +
+
+
+ + + +
+
+
+
+ + + +
+
+
+
+ + + +
+
+
+
+ + + +
+
+
+
+ + + +
+
+
+
+ + + +
+
+
+
+ + + +
+
+
+
+ + + +
+
+
+
+ + + +
+
+
+ +
+
+ +
+
+
+ +
    +
  1. +
    +
    + Produkt Liste +
    +
    + +
    +
    +
  2. + + @if (WorkplaceInventory.Products.Any()) + { + @foreach (var docView in DocViews) + { +
  3. +
    +
    @docView.VariantName.ToUpperInvariant()
    +
    + + +
    + @docView.DocumentDate +
    +
    + +
    +
    +
    +
  4. + } + } +
@if (Working) { - + } + + \ No newline at end of file diff --git a/Wonky.Client/Pages/AdvisorCustomerWorkplaceViewEditPage.razor.cs b/Wonky.Client/Pages/AdvisorCustomerWorkplaceViewEditPage.razor.cs index 9b5c9722..ab2d4156 100644 --- a/Wonky.Client/Pages/AdvisorCustomerWorkplaceViewEditPage.razor.cs +++ b/Wonky.Client/Pages/AdvisorCustomerWorkplaceViewEditPage.razor.cs @@ -13,12 +13,15 @@ // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html] // - +using System.Text.Json; using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Forms; using Wonky.Client.HttpInterceptors; using Wonky.Client.HttpRepository; +using Wonky.Client.Models; +using Wonky.Client.Shared; using Wonky.Entity.DTO; +using Wonky.Entity.Views; #pragma warning disable CS8618 namespace Wonky.Client.Pages; @@ -28,8 +31,10 @@ public partial class AdvisorCustomerWorkplaceViewEditPage : IDisposable // ############################################################# [Inject] public IAdvisorWorkplaceRepository Workplaces { get; set; } [Inject] public IAdvisorCustomerRepository CustomerRepo { get; set; } + [Inject] public IAdvisorWorkplaceRepository WorkplaceRepo { get; set; } [Inject] public HttpInterceptorService Interceptor { get; set; } [Inject] public NavigationManager Navigator { get; set; } + [Inject] public ILogger Logger { get; set; } // ############################################################# [Parameter] public string CompanyId { get; set; } = ""; @@ -39,37 +44,108 @@ public partial class AdvisorCustomerWorkplaceViewEditPage : IDisposable private WorkplaceDto Workplace { get; set; } = new(); private EditContext WorkplaceContext { get; set; } private bool Working { get; set; } = true; + private WorkplaceInventory WorkplaceInventory { get; set; } = new(); + private List DocViews { get; set; } = new(); + private ConfirmDeleteModal ConfirmDelete { get; set; } + private string DeleteMessage { get; set; } = ""; protected override async Task OnInitializedAsync() { WorkplaceContext = new EditContext(Workplace); - WorkplaceContext.OnFieldChanged += HandleFieldChanged; - WorkplaceContext.OnValidationStateChanged += ValidationChanged; + WorkplaceContext.OnFieldChanged += HandleFieldChanged!; + WorkplaceContext.OnValidationStateChanged += ValidationChanged!; Interceptor.RegisterEvent(); Interceptor.RegisterBeforeSendEvent(); Workplace = await Workplaces.GetWorkplace(CompanyId, WorkplaceId); - + WorkplaceInventory = await WorkplaceRepo.GetWorkplaceInventory(CompanyId, WorkplaceId); + + DocViews = GenerateDocumentListView(); Working = false; - StateHasChanged(); + DeleteMessage = $"Bekræft at du sletter
{Workplace.Name} fra {Workplace.CompanyName}?
AL INFORMATION slettes og handlingen er uigenkaldelig."; } - private async Task SubmitUpdate() + + private async Task OnSubmitUpdate() { Working = true; await Workplaces.UpdateWorkplace(CompanyId, Workplace); Working = false; } - - private async Task DeleteWorkplace() + + private void OnConfirmDeleteWorkplace() { + Logger.LogDebug("ConfirmDeleteWorkplace"); + ConfirmDelete.Show(); + } + + private async Task OnDeleteWorkplace() + { + Logger.LogDebug("DeleteWorkplace"); Working = true; - await Workplaces.DeleteWorkplace(CompanyId, Workplace.WorkplaceId); + await Workplaces.DeleteWorkplace(CompanyId, WorkplaceId); Navigator.NavigateTo($"/advisor/customers/{CompanyId}/workplaces"); } + + private async Task OnRemoveDocument(string productId, string variantId) + { + // delete the apb and apv + var product = WorkplaceInventory + .Products.First(x => x.ProductId == productId); + var variant = product.Variants.First(x => x.VariantId == variantId); + Logger.LogDebug("variant => {}", JsonSerializer.Serialize(variant, new JsonSerializerOptions(JsonSerializerDefaults.Web))); + foreach (var doc in variant.Docs) + { + await WorkplaceRepo.DeleteWorkplaceDocuments(CompanyId, WorkplaceId, doc.DocumentId); + } + + WorkplaceInventory.Products.Remove(product); + DocViews = GenerateDocumentListView(); + } + + + private List GenerateDocumentListView() + { + var docViews = new List(); + var docProducts = WorkplaceInventory.Products.OrderBy(x => x.TradingName).ToList(); + + foreach (var product in docProducts) + { + foreach (var variant in product.Variants) + { + var newDoc = new DocView + { + ProductId = product.ProductId, + VariantId = variant.VariantId, + VariantName = variant.VariantName, + DocumentDate = variant.Docs[0].DocumentDate + }; + + var docs = variant.Docs.OrderBy(x => x.DocumentTypeEnum).ToList(); + foreach (var doc in docs) + { + switch (doc.DocumentTypeEnum.ToLower()) + { + case "apb": + newDoc.ApbDocLink = doc.DocumentLink; + newDoc.ApbDocId = doc.DocumentId; + break; + case "apv": + newDoc.ApvDocLink = doc.DocumentLink; + newDoc.ApvDocId = doc.DocumentId; + break; + } + } + docViews.Add(newDoc); + } + } + return docViews.OrderBy(x => x.VariantName).ToList(); + } + + private void HandleFieldChanged(object sender, FieldChangedEventArgs e) { @@ -78,22 +154,23 @@ public partial class AdvisorCustomerWorkplaceViewEditPage : IDisposable StateHasChanged(); } + private void ValidationChanged(object sender, ValidationStateChangedEventArgs e) { - WorkplaceContext.OnFieldChanged -= HandleFieldChanged; - WorkplaceContext.OnValidationStateChanged -= ValidationChanged; + WorkplaceContext.OnFieldChanged -= HandleFieldChanged!; + WorkplaceContext.OnValidationStateChanged -= ValidationChanged!; WorkplaceContext = new EditContext(Workplace); - WorkplaceContext.OnFieldChanged += HandleFieldChanged; - WorkplaceContext.OnValidationStateChanged += ValidationChanged; + WorkplaceContext.OnFieldChanged += HandleFieldChanged!; + WorkplaceContext.OnValidationStateChanged += ValidationChanged!; } public void Dispose() { - WorkplaceContext.OnFieldChanged += HandleFieldChanged; - WorkplaceContext.OnValidationStateChanged += ValidationChanged; + WorkplaceContext.OnFieldChanged += HandleFieldChanged!; + WorkplaceContext.OnValidationStateChanged += ValidationChanged!; Interceptor.DisposeEvent(); } -} \ No newline at end of file +} diff --git a/Wonky.Client/Shared/ConfirmDeleteModal.razor b/Wonky.Client/Shared/ConfirmDeleteModal.razor new file mode 100644 index 00000000..f3bfea8e --- /dev/null +++ b/Wonky.Client/Shared/ConfirmDeleteModal.razor @@ -0,0 +1,37 @@ +@* 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] +*@ + + + +@if (_showBackdrop) +{ + +} \ No newline at end of file diff --git a/Wonky.Client/Shared/ConfirmDeleteModal.razor.cs b/Wonky.Client/Shared/ConfirmDeleteModal.razor.cs new file mode 100644 index 00000000..1d0bde1c --- /dev/null +++ b/Wonky.Client/Shared/ConfirmDeleteModal.razor.cs @@ -0,0 +1,57 @@ +// 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.Components; + +namespace Wonky.Client.Shared; + +public partial class ConfirmDeleteModal +{ + private string _modalDisplay = ""; + private bool _showBackdrop; + [Parameter] public string BodyMessage { get; set; } = ""; + [Parameter] public EventCallback OnOkClicked { get; set; } + [Parameter] public EventCallback OnCancelClicked { get; set; } + + private void OkSelected() + { + OnOkClicked.InvokeAsync(); + Hide(); + } + + private void CancelSelected() + { + if (OnCancelClicked.HasDelegate) + { + OnCancelClicked.InvokeAsync(); + } + Hide(); + } + + public void Show() + { + _modalDisplay = "block;"; + _showBackdrop = true; + StateHasChanged(); + } + + public void Hide() + { + _modalDisplay = "none;"; + _showBackdrop = false; + StateHasChanged(); + } +} \ No newline at end of file diff --git a/Wonky.Client/wwwroot/appsettings.release.json b/Wonky.Client/wwwroot/appsettings.release.json deleted file mode 100644 index d50b7b50..00000000 --- a/Wonky.Client/wwwroot/appsettings.release.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "appInfo": { - "name": "Wonky Online", - "version": "138.15", - "rc": false, - "sandBox": false, - "image": "grumpy-coder.png" - }, - "Logging": { - "LogLevel": { - "Default": "None", - "System": "None", - "Microsoft": "None" - }, - "Debug": { - "LogLevel": { - "Default": "Critical" - } - } - }, - "apiConfig": { - "baseUrl": "https://zeta.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", - "officeCustomers": "api/v2/office/customers", - "officeReports": "api/v2/office/reports", - "officeUsers": "api/v2/office/users/admin", - "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", - "serviceVatEu": "api/v2/services/vies", - "servicesVatNo": "api/v2/services/brReg", - "servicesAuth": "v2/token", - "syncRpc": "api/v2/rpc", - "syncRpcInvoiceExt": "invoices", - "systemDocStringUrl": "api/v2/admin/doc", - "systemLabels": "api/v2/admin/doc/labels", - "systemTexts": "api/v2/admin/doc/texts", - "userInfoClient": "/api/v2/client/users", - "userInfoAuth": "api/v2/auth/userinfo", - "userManager": "api/v2/app/manage/users", - "userManagerSetPasswd": "api/v2/app/manage/passwd", - "userRoles": "api/v2/app/manage/roles", - "userSupport": "/api/v2/app/manage/support", - "warehouse": "api/v2/warehouse/packages" - } -} diff --git a/Wonky.Client/wwwroot/css/app.css b/Wonky.Client/wwwroot/css/app.css index dffd0ce8..d9aaf0e8 100644 --- a/Wonky.Client/wwwroot/css/app.css +++ b/Wonky.Client/wwwroot/css/app.css @@ -43,6 +43,14 @@ a, .btn-link { color: #ffaa00; } +.inno-display { + display: block; +} + +.inno-hidden { + display: none; +} + .content { padding-top: 1.1rem; }