From 949d27b9031d26099ab639ad15097eea2f535826 Mon Sep 17 00:00:00 2001 From: Frede Hundewadt Date: Mon, 14 Nov 2022 17:06:43 +0100 Subject: [PATCH] Invoice content display - fixed loader --- .../Components/InvoiceTableComponent.razor | 18 +-- .../Components/InvoiceTableComponent.razor.cs | 20 ++++ Wonky.Client/Components/LoaderThreeDots.razor | 2 +- .../Components/LoaderThreeDots.razor.cs | 14 +-- .../Components/WarehouseListComponent.razor | 2 +- .../ICrmContactHttpRepository.cs | 8 ++ .../CrmHistoryHttpRepository.cs | 6 +- Wonky.Client/Pages/CrmActivityTodayPage.razor | 2 +- .../Pages/CrmActivityTodayPage.razor.cs | 5 +- .../Pages/CrmCompanyActivityListPage.razor | 2 +- .../Pages/CrmCompanyContactNewPage.razor | 59 ++++++++++ .../Pages/CrmCompanyContactNewPage.razor.cs | 19 ++++ .../Pages/CrmCompanyInventoryPage.razor | 2 +- .../Pages/CrmCompanyInventoryPage.razor.cs | 7 +- .../Pages/CrmCompanyInvoiceListPage.razor | 29 ++--- .../Pages/CrmCompanyInvoiceListPage.razor.cs | 13 ++- Wonky.Client/Pages/CrmCompanyViewPage.razor | 2 +- .../Pages/CrmCompanyViewPage.razor.cs | 34 +++--- .../Pages/CrmTaskItemListPage.razor.cs | 3 + Wonky.Client/Shared/InvoiceViewModal.razor | 103 ++++++++++++++++++ Wonky.Client/Shared/InvoiceViewModal.razor.cs | 66 +++++++++++ Wonky.Client/wwwroot/appsettings.json | 6 +- .../css/{app-v0.26.css => app-v0.38.css} | 7 ++ Wonky.Client/wwwroot/index.html | 4 +- Wonky.Entity/DTO/ContactDto.cs | 29 +++++ Wonky.Entity/Views/InvoiceLineView.cs | 6 +- Wonky.Entity/Views/InvoiceListItemView.cs | 2 +- Wonky.Entity/Views/InvoiceListView.cs | 2 +- Wonky.Entity/Views/InvoiceView.cs | 2 +- 29 files changed, 392 insertions(+), 82 deletions(-) create mode 100644 Wonky.Client/Components/InvoiceTableComponent.razor.cs create mode 100644 Wonky.Client/HttpInterfaces/ICrmContactHttpRepository.cs create mode 100644 Wonky.Client/Pages/CrmCompanyContactNewPage.razor create mode 100644 Wonky.Client/Pages/CrmCompanyContactNewPage.razor.cs create mode 100644 Wonky.Client/Shared/InvoiceViewModal.razor create mode 100644 Wonky.Client/Shared/InvoiceViewModal.razor.cs rename Wonky.Client/wwwroot/css/{app-v0.26.css => app-v0.38.css} (92%) create mode 100644 Wonky.Entity/DTO/ContactDto.cs diff --git a/Wonky.Client/Components/InvoiceTableComponent.razor b/Wonky.Client/Components/InvoiceTableComponent.razor index 42927901..1e6034b1 100644 --- a/Wonky.Client/Components/InvoiceTableComponent.razor +++ b/Wonky.Client/Components/InvoiceTableComponent.razor @@ -15,23 +15,23 @@

Rekvisition

-
+

Reference

-
+

Beløb

@foreach (var invoice in InvoiceList) { -
+
@invoice.DocumentDate
@invoice.DocumentNumber
@invoice.ReferenceNumber
-
@invoice.YourRef
-
@invoice.InvoiceAmount
+
@invoice.YourRef
+
@invoice.InvoiceAmount
@if (!string.IsNullOrWhiteSpace(invoice.OrderNote)) { @@ -49,10 +49,4 @@ else { Ingen data } - -@code{ - - [Parameter] - public List InvoiceList { get; set; } - -} \ No newline at end of file + \ No newline at end of file diff --git a/Wonky.Client/Components/InvoiceTableComponent.razor.cs b/Wonky.Client/Components/InvoiceTableComponent.razor.cs new file mode 100644 index 00000000..e9e8c622 --- /dev/null +++ b/Wonky.Client/Components/InvoiceTableComponent.razor.cs @@ -0,0 +1,20 @@ +using Microsoft.AspNetCore.Components; +using Wonky.Client.Shared; +using Wonky.Entity.Views; + +namespace Wonky.Client.Components; + +public partial class InvoiceTableComponent +{ + [Parameter] public List InvoiceList { get; set; } = new(); + [Parameter] public string CompanyId { get; set; } = ""; + private InvoiceViewModal InvoiceView { get; set; } + private string InvoiceId { get; set; } = ""; + private void ShowInvoice(string invoiceId) + { + Console.WriteLine($"invoiceId => {invoiceId}"); + Console.WriteLine($"companyId => {CompanyId}"); + InvoiceId = invoiceId; + InvoiceView.Show(); + } +} \ No newline at end of file diff --git a/Wonky.Client/Components/LoaderThreeDots.razor b/Wonky.Client/Components/LoaderThreeDots.razor index 94d159e2..f5859436 100644 --- a/Wonky.Client/Components/LoaderThreeDots.razor +++ b/Wonky.Client/Components/LoaderThreeDots.razor @@ -22,5 +22,5 @@ loading ...
-
+ } diff --git a/Wonky.Client/Components/LoaderThreeDots.razor.cs b/Wonky.Client/Components/LoaderThreeDots.razor.cs index 55981a5d..23b0ce0f 100644 --- a/Wonky.Client/Components/LoaderThreeDots.razor.cs +++ b/Wonky.Client/Components/LoaderThreeDots.razor.cs @@ -5,18 +5,10 @@ namespace Wonky.Client.Components; public partial class LoaderThreeDots { - [Parameter] public bool Loading { get; set; } = true; - [Parameter] public int Timeout { get; set; } = 30000; - private bool ShowMe { get; set; } - - protected override void OnParametersSet() - { - ShowMe = Loading; - } - + private bool ShowMe { get; set; } = true; protected override async Task OnInitializedAsync() { - await Task.Delay(Timeout); - ShowMe = false; + await Task.Delay(15000); + ShowMe = false; } } \ No newline at end of file diff --git a/Wonky.Client/Components/WarehouseListComponent.razor b/Wonky.Client/Components/WarehouseListComponent.razor index c0481601..97e3d72e 100644 --- a/Wonky.Client/Components/WarehouseListComponent.razor +++ b/Wonky.Client/Components/WarehouseListComponent.razor @@ -109,5 +109,5 @@ } else { - + } diff --git a/Wonky.Client/HttpInterfaces/ICrmContactHttpRepository.cs b/Wonky.Client/HttpInterfaces/ICrmContactHttpRepository.cs new file mode 100644 index 00000000..64148918 --- /dev/null +++ b/Wonky.Client/HttpInterfaces/ICrmContactHttpRepository.cs @@ -0,0 +1,8 @@ +using Wonky.Entity.DTO; + +namespace Wonky.Client.HttpInterfaces; + +public interface ICrmContactHttpRepository +{ + Task CreateContact(ContactDto contact); +} \ No newline at end of file diff --git a/Wonky.Client/HttpRepository/CrmHistoryHttpRepository.cs b/Wonky.Client/HttpRepository/CrmHistoryHttpRepository.cs index aecb95fe..77529134 100644 --- a/Wonky.Client/HttpRepository/CrmHistoryHttpRepository.cs +++ b/Wonky.Client/HttpRepository/CrmHistoryHttpRepository.cs @@ -69,7 +69,7 @@ public class CrmHistoryHttpRepository : ICrmHistoryHttpRepository public async Task FetchInvoice(string companyId, string invoiceId) { return await _client - .GetFromJsonAsync($"{_api.CrmCustomers}/{companyId}/invoices/{invoiceId}"); + .GetFromJsonAsync($"{_api.CrmCustomers}/{companyId}/invoices/{invoiceId}", _options); } /// @@ -94,7 +94,7 @@ public class CrmHistoryHttpRepository : ICrmHistoryHttpRepository public async Task> FetchHistory(string companyId) { return await _client.GetFromJsonAsync>( - $"{_api.CrmCustomers}/{companyId}/{_api.CrmProducts}"); + $"{_api.CrmCustomers}/{companyId}/{_api.CrmProducts}", _options); } /// @@ -106,7 +106,7 @@ public class CrmHistoryHttpRepository : ICrmHistoryHttpRepository public async Task> FetchHistory(string companyId, string sku) { return await _client.GetFromJsonAsync>( - $"{_api.CrmCustomers}/{companyId}/{_api.CrmProducts}/{sku}"); + $"{_api.CrmCustomers}/{companyId}/{_api.CrmProducts}/{sku}", _options); } /// /// execute a remote procedure designed to update crm database from erp system based on a date string diff --git a/Wonky.Client/Pages/CrmActivityTodayPage.razor b/Wonky.Client/Pages/CrmActivityTodayPage.razor index 3b9f8067..d6a71750 100644 --- a/Wonky.Client/Pages/CrmActivityTodayPage.razor +++ b/Wonky.Client/Pages/CrmActivityTodayPage.razor @@ -45,6 +45,6 @@ } else { - + } diff --git a/Wonky.Client/Pages/CrmActivityTodayPage.razor.cs b/Wonky.Client/Pages/CrmActivityTodayPage.razor.cs index 10d55cf0..41c18b6a 100644 --- a/Wonky.Client/Pages/CrmActivityTodayPage.razor.cs +++ b/Wonky.Client/Pages/CrmActivityTodayPage.razor.cs @@ -33,7 +33,7 @@ public partial class CrmActivityTodayPage : IDisposable [Inject] public NavigationManager _navigator { get; set; } [Inject] public ICrmActivityHttpRepository CrmActivityRepo { get; set; } [Inject] public ICrmReportHttpRepository CrmReportRepo { get; set; } - [Inject] public IToastService _toast { get; set; } + [Inject] public IToastService Toaster { get; set; } private ReportStatusView? ReportStatusView { get; set; } = new(); private Preferences _prefs { get; set; } = new(); private DateTime SelectedDate { get; set; } @@ -54,12 +54,13 @@ public partial class CrmActivityTodayPage : IDisposable private async Task GetActivities(string workDate) { - _toast.ShowInfo("Vent nogle sekunder for data"); + Toaster.ShowInfo("Vent nogle sekunder for data"); SelectedDate = DateTime.Parse(workDate); ReportStatusView = new ReportStatusView(); ReportStatusView = await CrmActivityRepo.GetActivities($"{SelectedDate:yyyy-MM-dd}"); _logger.LogDebug("Activities => {}", JsonSerializer.Serialize(ReportStatusView)); Loading = false; + Toaster.ClearAll(); } public void Dispose() diff --git a/Wonky.Client/Pages/CrmCompanyActivityListPage.razor b/Wonky.Client/Pages/CrmCompanyActivityListPage.razor index 819238e8..164ee779 100644 --- a/Wonky.Client/Pages/CrmCompanyActivityListPage.razor +++ b/Wonky.Client/Pages/CrmCompanyActivityListPage.razor @@ -83,5 +83,5 @@ @if (Working) { - + } diff --git a/Wonky.Client/Pages/CrmCompanyContactNewPage.razor b/Wonky.Client/Pages/CrmCompanyContactNewPage.razor new file mode 100644 index 00000000..cee04f98 --- /dev/null +++ b/Wonky.Client/Pages/CrmCompanyContactNewPage.razor @@ -0,0 +1,59 @@ +@page "/companies/{CompanyId}/contacts/new" +

Ny kontakt

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ JobTitel + + + + + Email + + + +
Fornavn + + + Efternavn + + +
Mobile + + + Telefon + + +
+
+
+
+ +
+
+
\ No newline at end of file diff --git a/Wonky.Client/Pages/CrmCompanyContactNewPage.razor.cs b/Wonky.Client/Pages/CrmCompanyContactNewPage.razor.cs new file mode 100644 index 00000000..a8ccecae --- /dev/null +++ b/Wonky.Client/Pages/CrmCompanyContactNewPage.razor.cs @@ -0,0 +1,19 @@ +using Microsoft.AspNetCore.Components; +using Microsoft.AspNetCore.Components.Forms; +using Wonky.Entity.DTO; + +namespace Wonky.Client.Pages; + +public partial class CrmCompanyContactNewPage +{ + [Parameter] public string CompanyId { get; set; } = ""; + + private EditContext ContactContext { get; set; } + private ContactDto Contact { get; set; } = new(); + private bool FormInvalid { get; set; } = true; + + private async Task SubmitContactForm() + { + + } +} \ No newline at end of file diff --git a/Wonky.Client/Pages/CrmCompanyInventoryPage.razor b/Wonky.Client/Pages/CrmCompanyInventoryPage.razor index 535b8756..b543a6e1 100644 --- a/Wonky.Client/Pages/CrmCompanyInventoryPage.razor +++ b/Wonky.Client/Pages/CrmCompanyInventoryPage.razor @@ -30,7 +30,7 @@ @if (Loading) { - + } else { diff --git a/Wonky.Client/Pages/CrmCompanyInventoryPage.razor.cs b/Wonky.Client/Pages/CrmCompanyInventoryPage.razor.cs index a016ebda..df06ded6 100644 --- a/Wonky.Client/Pages/CrmCompanyInventoryPage.razor.cs +++ b/Wonky.Client/Pages/CrmCompanyInventoryPage.razor.cs @@ -36,8 +36,8 @@ public partial class CrmCompanyInventoryPage : IDisposable private CompanyDto Company { get; set; } = new(); private List? Inventory { get; set; } private bool Loading { get; set; } = true; - - protected override async Task OnInitializedAsync() + + protected override async Task OnParametersSetAsync() { Interceptor.RegisterEvent(); Interceptor.RegisterBeforeSendEvent(); @@ -46,10 +46,9 @@ public partial class CrmCompanyInventoryPage : IDisposable await RefreshHistory(); } - + private async Task RefreshHistory() { - await CrmHistoryRepo.RpcSyncErpToCrm(CompanyId, Company.HistorySync); Toaster.ShowInfo("Arbejder på sagen ...", "Vent venligst"); Inventory = await CrmHistoryRepo.FetchInventory(CompanyId); Inventory = Inventory?.OrderBy(x => x.Description).ToList(); diff --git a/Wonky.Client/Pages/CrmCompanyInvoiceListPage.razor b/Wonky.Client/Pages/CrmCompanyInvoiceListPage.razor index 9e87756a..34129ad5 100644 --- a/Wonky.Client/Pages/CrmCompanyInvoiceListPage.razor +++ b/Wonky.Client/Pages/CrmCompanyInvoiceListPage.razor @@ -1,19 +1,22 @@ @page "/companies/{CompanyId}/invoices" @using Wonky.Client.Components -
-
-

@Company.Name

-
- -
-@if (Loading) +@if (!string.IsNullOrWhiteSpace(Company.Name)) { - +
+
+

@Company.Name

+
+ +
+ } else { - -} + @if (Loading) + { + + } +} \ No newline at end of file diff --git a/Wonky.Client/Pages/CrmCompanyInvoiceListPage.razor.cs b/Wonky.Client/Pages/CrmCompanyInvoiceListPage.razor.cs index d33b30df..281a84f5 100644 --- a/Wonky.Client/Pages/CrmCompanyInvoiceListPage.razor.cs +++ b/Wonky.Client/Pages/CrmCompanyInvoiceListPage.razor.cs @@ -18,26 +18,27 @@ public partial class CrmCompanyInvoiceListPage : IDisposable [Inject] public IToastService Toaster { get; set; } private InvoiceListView History { get; set; } = new(); - private CompanyDto Company { get; set; } + private CompanyDto Company { get; set; } = new(); private bool Loading { get; set; } = true; - protected override async Task OnInitializedAsync() + protected override async Task OnParametersSetAsync() { Interceptor.RegisterEvent(); Interceptor.RegisterBeforeSendEvent(); Company = await CompanyRepo.GetCompanyById(CompanyId); - await RefreshHistory(); - } - private async Task RefreshHistory() + await GetInvoices(); + } + + private async Task GetInvoices() { Toaster.ShowInfo("Arbejder på sagen ...", "Vent venligst"); - await HistoryRepo.RpcSyncErpToCrm(CompanyId, Company.HistorySync); History = await HistoryRepo.FetchInvoiceList(CompanyId); Loading = false; Toaster.ClearAll(); } + public void Dispose() { Interceptor.DisposeEvent(); diff --git a/Wonky.Client/Pages/CrmCompanyViewPage.razor b/Wonky.Client/Pages/CrmCompanyViewPage.razor index a6ea3382..3a3dfa89 100644 --- a/Wonky.Client/Pages/CrmCompanyViewPage.razor +++ b/Wonky.Client/Pages/CrmCompanyViewPage.razor @@ -247,7 +247,7 @@ } else { - + } \ No newline at end of file diff --git a/Wonky.Client/Pages/CrmCompanyViewPage.razor.cs b/Wonky.Client/Pages/CrmCompanyViewPage.razor.cs index a6a96e1e..910ded38 100644 --- a/Wonky.Client/Pages/CrmCompanyViewPage.razor.cs +++ b/Wonky.Client/Pages/CrmCompanyViewPage.razor.cs @@ -38,11 +38,11 @@ namespace Wonky.Client.Pages; public partial class CrmCompanyViewPage : IDisposable { [Parameter] public string CompanyId { get; set; } = ""; - [Inject] public IToastService _toast { get; set; } + [Inject] public IToastService Toaster { get; set; } [Inject] public ILogger _logger { get; set; } [Inject] public NavigationManager _navigator { get; set; } [Inject] public ICrmCompanyHttpRepository _companyRepo { get; set; } - [Inject] public ICrmHistoryHttpRepository CrmHistoryRepo { get; set; } + [Inject] public ICrmHistoryHttpRepository HistoryRepo { get; set; } [Inject] public HttpInterceptorService _interceptor { get; set; } [Inject] public VatInfoLookupService _vatService { get; set; } [Inject] public ILocalStorageService _storage { get; set; } @@ -68,25 +68,22 @@ public partial class CrmCompanyViewPage : IDisposable private bool _dk { get; set; } = true; private int _isDirty { get; set; } private int _vatUpdated { get; set; } - private bool _blocked { get; set; } = true; + private bool Loading { get; set; } = true; private VatLookupDkModal _vatLookupModal { get; set; } = new(); - private readonly JsonSerializerOptions _options = new () - { - PropertyNameCaseInsensitive = true - }; + private readonly JsonSerializerOptions _options = new () { PropertyNameCaseInsensitive = true }; protected override async Task OnInitializedAsync() { var ux = await _storage.GetItemAsync("_xu"); _countryCode = ux.CountryCode; _dk = ux.CountryCode.ToLower() == "dk"; - + Company = await _companyRepo.GetCompanyById(CompanyId); _interceptor.RegisterEvent(); _interceptor.RegisterBeforeSendEvent(); - Company = await _companyRepo.GetCompanyById(CompanyId); + // Company = await _companyRepo.GetCompanyById(CompanyId); _orgVat = Company.VatNumber; Company.CountryCode = ux.CountryCode.ToLower(); _enableActivity = Company.ValidVat; @@ -130,12 +127,20 @@ public partial class CrmCompanyViewPage : IDisposable _editContext = new EditContext(Company); _editContext.OnFieldChanged += HandleFieldChanged; _editContext.OnValidationStateChanged += ValidationChanged; + + await SyncCompanyHistory(); } private void ForceActivity() { _enableActivity = _enableActivity == 0 ? 1 : 0; } + + private async Task SyncCompanyHistory() + { + await HistoryRepo.RpcSyncErpToCrm(CompanyId, Company.HistorySync); + } + private void HandleFieldChanged(object sender, FieldChangedEventArgs e) { _nextVisit = _lastVisit.AddDays(Company.Interval * 7); @@ -174,11 +179,11 @@ public partial class CrmCompanyViewPage : IDisposable // simple format validation if CRM indicates invalid vatNumber if (!VatUtils.ValidateFormat(Company.CountryCode, Company.VatNumber)) { - _toast.ShowError($"CVR/VAT/ORG nummer mangler eller er ugyldig."); + Toaster.ShowError($"CVR/VAT/ORG nummer mangler eller er ugyldig."); StateHasChanged(); return; } - _toast.ShowInfo("Vent venligst ...."); + Toaster.ShowInfo("Vent venligst ...."); //_hideButtons = true; Company.LastVisit = $"{_lastVisit:yyyy-MM-dd}"; Company.NextVisit = $"{_nextVisit:yyyy-MM-dd}"; @@ -191,7 +196,7 @@ public partial class CrmCompanyViewPage : IDisposable Company.IsDirty = _isDirty; var success = await _companyRepo.UpdateCompany(CompanyId, Company ); - _toast.ShowSuccess("Opdatering er afsendt. Der går nogle minutter inden data er opdateret."); + Toaster.ShowSuccess("Opdatering er afsendt. Der går nogle minutter inden data er opdateret."); Company = await _companyRepo.GetCompanyById(Company.CompanyId); Company.ValidVat = 1; _enableActivity = 1; @@ -201,11 +206,12 @@ public partial class CrmCompanyViewPage : IDisposable } StateHasChanged(); _working = false; + Toaster.ClearAll(); } private async Task GetInfoFromAddress(VatAddress address) { - _toast.ShowInfo("Vent for adresse info ..."); + Toaster.ShowInfo("Vent for adresse info ..."); _vInfos = await _vatService.QueryVirkRegistry( new VirkParams { @@ -215,7 +221,7 @@ public partial class CrmCompanyViewPage : IDisposable }); if (!_vInfos.Any()) { - _toast.ShowWarning($"Ingen data fundet ..."); + Toaster.ShowWarning($"Ingen data fundet ..."); } } diff --git a/Wonky.Client/Pages/CrmTaskItemListPage.razor.cs b/Wonky.Client/Pages/CrmTaskItemListPage.razor.cs index b100f79a..ec1c1b1f 100644 --- a/Wonky.Client/Pages/CrmTaskItemListPage.razor.cs +++ b/Wonky.Client/Pages/CrmTaskItemListPage.razor.cs @@ -53,6 +53,9 @@ public partial class CrmTaskItemListPage : IDisposable { Toaster.ShowInfo("Vent nogle sekunder for data"); TaskItems = await TaskItemRepo.GetTaskList(workDate); + + Toaster.ClearAll(); + } public void Dispose() { diff --git a/Wonky.Client/Shared/InvoiceViewModal.razor b/Wonky.Client/Shared/InvoiceViewModal.razor new file mode 100644 index 00000000..2b9addc4 --- /dev/null +++ b/Wonky.Client/Shared/InvoiceViewModal.razor @@ -0,0 +1,103 @@ +@* +// 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 Wonky.Client.Components +@using Wonky.Client.Helpers + +@if (_showBackdrop) +{ + +} \ No newline at end of file diff --git a/Wonky.Client/Shared/InvoiceViewModal.razor.cs b/Wonky.Client/Shared/InvoiceViewModal.razor.cs new file mode 100644 index 00000000..d1da3e93 --- /dev/null +++ b/Wonky.Client/Shared/InvoiceViewModal.razor.cs @@ -0,0 +1,66 @@ +// 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 System.Text.Json; +using Microsoft.AspNetCore.Components; +using Wonky.Client.HttpInterceptors; +using Wonky.Client.HttpInterfaces; +using Wonky.Client.HttpRepository; +using Wonky.Client.Models; +using Wonky.Client.Services; +using Wonky.Entity.Requests; +using Wonky.Entity.Views; + +namespace Wonky.Client.Shared; + +public partial class InvoiceViewModal : IDisposable +{ + [Parameter] public string CompanyId { get; set; } = ""; + [Parameter] public string InvoiceId { get; set; } = ""; + [Inject] public HttpInterceptorService Interceptor { get; set; } + [Inject] public ICrmHistoryHttpRepository HistoryRepo { get; set; } + private string _modalDisplay = ""; + private bool _showBackdrop; + private InvoiceView Invoice { get; set; } = new(); + + protected override async Task OnParametersSetAsync() + { + Console.WriteLine($"CompanyId => {CompanyId}"); + Console.WriteLine($"InvoiceId => {InvoiceId}"); + Interceptor.RegisterEvent(); + Interceptor.RegisterBeforeSendEvent(); + + Console.WriteLine("Getting invoice"); + Invoice = await HistoryRepo.FetchInvoice(CompanyId, InvoiceId); + Console.WriteLine($"Invoice => {JsonSerializer.Serialize(Invoice)}"); + } + + + public void Show() + { + _modalDisplay = "block;"; + _showBackdrop = true; + StateHasChanged(); + } + + private void Hide() + { + _modalDisplay = "none;"; + _showBackdrop = false; + StateHasChanged(); + } + + public void Dispose() => Interceptor.DisposeEvent(); +} \ No newline at end of file diff --git a/Wonky.Client/wwwroot/appsettings.json b/Wonky.Client/wwwroot/appsettings.json index 93cec4fc..fa994d90 100644 --- a/Wonky.Client/wwwroot/appsettings.json +++ b/Wonky.Client/wwwroot/appsettings.json @@ -1,13 +1,13 @@ { "appInfo": { "name": "Wonky Client", - "version": "0.38.3", + "version": "0.41.1", "rc": true, "sandBox": false, "image": "grumpy-coder.png" }, "apiConfig": { - "innoBaseUrl": "https://zeta.innotec.dk", + "innoBaseUrl": "https://eta.innotec.dk", "glsTrackUrl": "https://www.gls-group.eu/276-I-PORTAL-WEB/content/GLS/DK01/DA/5004.htm?txtAction=71000&txtRefNo=", "glsId": "", "serviceVirk": "api/v2/services/virk", @@ -22,7 +22,7 @@ "crmCustomers": "api/v2/crm/companies", "crmInventory": "history/inventory", "crmProducts": "history/products", - "crmSync": "history/sync", + "crmSync": "invoices/sync", "crmWorkplaces": "workplaces", "officeAdvisors": "api/v2/office/users/advisors", "officeUsers": "api/v2/office/users/admin", diff --git a/Wonky.Client/wwwroot/css/app-v0.26.css b/Wonky.Client/wwwroot/css/app-v0.38.css similarity index 92% rename from Wonky.Client/wwwroot/css/app-v0.26.css rename to Wonky.Client/wwwroot/css/app-v0.38.css index 9e29185b..d04a5d2e 100644 --- a/Wonky.Client/wwwroot/css/app-v0.26.css +++ b/Wonky.Client/wwwroot/css/app-v0.38.css @@ -170,7 +170,9 @@ footer.version { } .report-main { font-size: 10px; + break-before: page; break-after: page; + page-break-after: always; height: initial; border: initial; border-radius: initial; @@ -181,6 +183,8 @@ footer.version { color-adjust: exact; } .report-visit { + page-break-before: always; + break-after: page; break-before: page; break-inside: avoid-page; height: initial; @@ -195,5 +199,8 @@ footer.version { .distance-ledger {} .report-ledger { page-break-inside: avoid; + page-break-after: always; + break-after: recto; + min-height: 300px; } } \ No newline at end of file diff --git a/Wonky.Client/wwwroot/index.html b/Wonky.Client/wwwroot/index.html index e8b29108..db9415af 100644 --- a/Wonky.Client/wwwroot/index.html +++ b/Wonky.Client/wwwroot/index.html @@ -2,7 +2,7 @@ - Inno Web CRM + Innotec WWO @@ -17,7 +17,7 @@ - + diff --git a/Wonky.Entity/DTO/ContactDto.cs b/Wonky.Entity/DTO/ContactDto.cs new file mode 100644 index 00000000..5ac75f3a --- /dev/null +++ b/Wonky.Entity/DTO/ContactDto.cs @@ -0,0 +1,29 @@ +using System.ComponentModel.DataAnnotations; + +namespace Wonky.Entity.DTO; + +public class ContactDto +{ + [Required(ErrorMessage = "CompanyId")] + [MaxLength(128, ErrorMessage = "CompanyId mangler")] + public string CompanyId { get; set; } = ""; + + [Required(ErrorMessage = "Fornavn skal udfyldes.")] + [MaxLength(30, ErrorMessage = "Du kan højst bruge 30 tegn")] + public string FirstName { get; set; } = ""; + + [MaxLength(50, ErrorMessage = "Du kan højst bruge 50 tegn.")] + public string JobTitle { get; set; } = ""; + + [MaxLength(30, ErrorMessage = "Du kan højst bruge 30 tegn.")] + public string LastName { get; set; } = ""; + + [MaxLength(80, ErrorMessage = "Du kan højst bruge 80 tegn.")] + public string Email { get; set; } = ""; + + [MaxLength(30, ErrorMessage = "Du kan højst bruge 30 tegn.")] + public string Phone { get; set; } = ""; + + [MaxLength(30, ErrorMessage = "Du kan højst bruge 30 tegn.")] + public string Mobile { get; set; } = ""; +} \ No newline at end of file diff --git a/Wonky.Entity/Views/InvoiceLineView.cs b/Wonky.Entity/Views/InvoiceLineView.cs index c295b40a..53d19e27 100644 --- a/Wonky.Entity/Views/InvoiceLineView.cs +++ b/Wonky.Entity/Views/InvoiceLineView.cs @@ -4,7 +4,7 @@ public class InvoiceLineView { public string Sku { get; set; } = ""; public string Text { get; set; } = ""; - public int Qty { get; set; } - public decimal Price { get; set; } - public decimal Discount { get; set; } + public string Qty { get; set; } = ""; + public string Price { get; set; } = ""; + public string Discount { get; set; } = ""; } \ No newline at end of file diff --git a/Wonky.Entity/Views/InvoiceListItemView.cs b/Wonky.Entity/Views/InvoiceListItemView.cs index c0cc728d..df1e487f 100644 --- a/Wonky.Entity/Views/InvoiceListItemView.cs +++ b/Wonky.Entity/Views/InvoiceListItemView.cs @@ -10,5 +10,5 @@ public class InvoiceListItemView public string OrderNote { get; set; } = ""; public string TrackingNumber { get; set; } = ""; public string DocumentDate { get; set; } = ""; - public decimal InvoiceAmount { get; set; } + public string InvoiceAmount { get; set; } = ""; } \ No newline at end of file diff --git a/Wonky.Entity/Views/InvoiceListView.cs b/Wonky.Entity/Views/InvoiceListView.cs index 4e7e2a55..8e9bea7a 100644 --- a/Wonky.Entity/Views/InvoiceListView.cs +++ b/Wonky.Entity/Views/InvoiceListView.cs @@ -3,5 +3,5 @@ namespace Wonky.Entity.Views; public class InvoiceListView { public InvoiceCompanyView Company { get; set; } = new(); - public List InvoiceList { get; set; } = new(); + public List Invoices { get; set; } = new(); } \ No newline at end of file diff --git a/Wonky.Entity/Views/InvoiceView.cs b/Wonky.Entity/Views/InvoiceView.cs index 4de3cabb..d9230a29 100644 --- a/Wonky.Entity/Views/InvoiceView.cs +++ b/Wonky.Entity/Views/InvoiceView.cs @@ -8,7 +8,7 @@ public class InvoiceView public string DocumentDate { get; set; } = ""; public string DocumentNumber { get; set; } = ""; public string ESalesNumber { get; set; } = ""; - public decimal InvoiceAmount { get; set; } + public string InvoiceAmount { get; set; } = ""; public string OrderNote { get; set; } = ""; public string OurRef { get; set; } = ""; public string ReferenceNumber { get; set; } = "";