From 1184247c4db380d86f68f9f37fb917b578e34edc Mon Sep 17 00:00:00 2001 From: Frede Hundewadt Date: Tue, 22 Nov 2022 08:30:15 +0100 Subject: [PATCH] client v.0.48.1 --- .../VatAddressInputComponent.razor.cs | 2 +- .../VatCompanyNameInputComponent.razor.cs | 2 +- .../VatNumberInputComponent.razor.cs | 2 +- Wonky.Client/Pages/CrmCompanyNewPage.razor | 286 +++++++----------- Wonky.Client/Pages/CrmCompanyNewPage.razor.cs | 34 +++ Wonky.Client/Pages/CrmCompanyViewPage.razor | 2 +- .../Pages/CrmCompanyViewPage.razor.cs | 49 +-- Wonky.Client/Pages/Login.razor | 43 +-- Wonky.Client/Services/VatInfoLookupService.cs | 3 + Wonky.Client/Shared/VatLookupDkModal.razor.cs | 7 +- Wonky.Client/wwwroot/appsettings.json | 2 +- 11 files changed, 181 insertions(+), 251 deletions(-) diff --git a/Wonky.Client/Components/VatAddressInputComponent.razor.cs b/Wonky.Client/Components/VatAddressInputComponent.razor.cs index a137e226..e2daca0d 100644 --- a/Wonky.Client/Components/VatAddressInputComponent.razor.cs +++ b/Wonky.Client/Components/VatAddressInputComponent.razor.cs @@ -32,7 +32,7 @@ public partial class VatAddressInputComponent } private async Task SubmitForm() { - await OnValidSubmit.InvokeAsync(Address); + await OnValidSubmit.InvokeAsync(_address); } } \ No newline at end of file diff --git a/Wonky.Client/Components/VatCompanyNameInputComponent.razor.cs b/Wonky.Client/Components/VatCompanyNameInputComponent.razor.cs index 06046779..6613c0ad 100644 --- a/Wonky.Client/Components/VatCompanyNameInputComponent.razor.cs +++ b/Wonky.Client/Components/VatCompanyNameInputComponent.razor.cs @@ -31,6 +31,6 @@ public partial class VatCompanyNameInputComponent } private async Task SubmitForm() { - await OnValidSubmit.InvokeAsync(CompanyName); + await OnValidSubmit.InvokeAsync(_companyName); } } \ No newline at end of file diff --git a/Wonky.Client/Components/VatNumberInputComponent.razor.cs b/Wonky.Client/Components/VatNumberInputComponent.razor.cs index e1451abb..dea3afdd 100644 --- a/Wonky.Client/Components/VatNumberInputComponent.razor.cs +++ b/Wonky.Client/Components/VatNumberInputComponent.razor.cs @@ -33,6 +33,6 @@ public partial class VatNumberInputComponent private async Task SubmitForm() { - await OnValidSubmit.InvokeAsync(VatNumber); + await OnValidSubmit.InvokeAsync(_vatNumber); } } \ No newline at end of file diff --git a/Wonky.Client/Pages/CrmCompanyNewPage.razor b/Wonky.Client/Pages/CrmCompanyNewPage.razor index 24d7f591..9ba01c67 100644 --- a/Wonky.Client/Pages/CrmCompanyNewPage.razor +++ b/Wonky.Client/Pages/CrmCompanyNewPage.razor @@ -23,197 +23,113 @@

Opret kunde

- - - - - - - - @if (Dk) - { - - - - } - - - - @if (Dk) - { - - - - } - - @if (VatInfos.Any() && ShowInfos) - { - - - - } - -
Virksomhedsopslag
- -
- -
- -
- - - - - - - - - - - - @foreach (var info in VatInfos) - { - - - - - - - - } - -
CVR ORGNavnStatus
@info.VatNumber@info.Name@info.States[^1].State - -
-
- - - - - - - - - - - - - - - -
- Besøg dato - - Næste besøg - - Interval (uger) -
- - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Stamdata -
Moms/Org Reg. - - + +
+ @* vat lookup *@ +
+ +
+ @* entity name *@ + +
+ + +
+ @* entity attention *@ + +
+ + +
+ @* entity address 1 *@ + +
+ + +
+ @* entity address 2 *@ + +
+ + +
+ @* entity postal code *@ + +
+ + +
+ @* entity city name *@ + +
+ + +
+ @* entity vat number *@ + +
+
+ + + -
Telefon - - -
Firmanavn - - - Attention - - -
Adresse1 - - - Adresse2 - - -
Postnr - - - Bynavn - - -
Mobil - - - Email - - -
OBS - - -
Notater - -
-
-
-
+
+
+ @* entity phone *@ + +
+ + +
+ @* entity mobile *@ + +
+ + +
+ @* entity email *@ + +
+ + +
+ +
+
+ +
+ + +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ + +
+
+
+
-
\ No newline at end of file + + + \ No newline at end of file diff --git a/Wonky.Client/Pages/CrmCompanyNewPage.razor.cs b/Wonky.Client/Pages/CrmCompanyNewPage.razor.cs index bbcebda4..85272ea0 100644 --- a/Wonky.Client/Pages/CrmCompanyNewPage.razor.cs +++ b/Wonky.Client/Pages/CrmCompanyNewPage.razor.cs @@ -16,6 +16,7 @@ using System; using System.ComponentModel.DataAnnotations; using System.Linq; +using System.Text.Json; using System.Threading.Tasks; using Blazored.LocalStorage; using Blazored.Toast.Services; @@ -50,6 +51,8 @@ namespace Wonky.Client.Pages private VirkRegInfo CompanyRegInfo { get; set; } = new(); private List VatInfos { get; set; } = new(); private VatAddress CompanyVatAddress { get; set; } = new(); + private VatLookupDkModal VatLookupPopup { get; set; } = new(); + private bool FormInvalid = true; private string RegState = ""; private DateTime LastVisit { get; set; } @@ -80,6 +83,13 @@ namespace Wonky.Client.Pages } + /// + /// Show Vat Lookup modal + /// + private void CallVatLookupModal() + { + VatLookupPopup.Show(); + } private async Task GetInfoFromName(string entityName) { Toaster.ShowInfo("Vent for firma info ..."); @@ -118,6 +128,30 @@ namespace Wonky.Client.Pages Toaster.ShowError($"Firma med CVR '{vatNumber}' findes ikke."); } } + + /// + /// Modal callback to update company properties + /// + /// + private void SelectCompanyCallback(VirkRegInfo regInfo) + { + Logger.LogDebug($"CrmCompanyView => SelectCompanyCallback => {JsonSerializer.Serialize(regInfo)}"); + + // this can be removed in favor of the new data returned from updating the VatNumber + RegState = regInfo.States[0].State.ToLower() == "normal" ? "the-good" : "the-dead"; + + if (regInfo.SyncAll) + { + + Company.Name = regInfo.Name; + Company.Address1 = regInfo.Address; + Company.Address2 = regInfo.CoName; + Company.ZipCode = regInfo.ZipCode; + Company.City = regInfo.City; + } + Company.VatNumber = regInfo.VatNumber; + } + private void SelectCompany(string vatNumber) { ShowInfos = false; diff --git a/Wonky.Client/Pages/CrmCompanyViewPage.razor b/Wonky.Client/Pages/CrmCompanyViewPage.razor index 92703d73..b660e7be 100644 --- a/Wonky.Client/Pages/CrmCompanyViewPage.razor +++ b/Wonky.Client/Pages/CrmCompanyViewPage.razor @@ -21,7 +21,7 @@ @attribute [Authorize(Roles = "Advisor")] @page "/companies/{CompanyId}" -@if (!string.IsNullOrWhiteSpace(Company.Name)) +@if (!string.IsNullOrWhiteSpace(Company.Account)) { @if (!string.IsNullOrWhiteSpace(Company.Blocked)) { diff --git a/Wonky.Client/Pages/CrmCompanyViewPage.razor.cs b/Wonky.Client/Pages/CrmCompanyViewPage.razor.cs index f50c7398..166de1c6 100644 --- a/Wonky.Client/Pages/CrmCompanyViewPage.razor.cs +++ b/Wonky.Client/Pages/CrmCompanyViewPage.razor.cs @@ -27,7 +27,6 @@ using Wonky.Client.Services; using Wonky.Client.Shared; using Wonky.Entity.DTO; using Wonky.Entity.Models; -using Wonky.Entity.Requests; using Wonky.Entity.Views; namespace Wonky.Client.Pages; @@ -47,12 +46,10 @@ public partial class CrmCompanyViewPage : IDisposable private readonly JsonSerializerOptions _options = new () { PropertyNameCaseInsensitive = true }; private CompanyDto Company { get; set; } = new(); private EditContext ErpContext { get; set; } - private List VatInfos { get; set; } = new(); - private VirkRegInfo CompanyRegInfo { get; set; } = new(); private DateTime LastVisit { get; set; } private DateTime NextVisit { get; set; } - private string VatState { get; set; } = "the-ugly"; private VatAddress CompanyVatAddress = new(); + private string VatState { get; set; } = "the-ugly"; private bool ValidVat; private bool HasFolded; private string CurrentVat { get; set; } = ""; @@ -237,7 +234,7 @@ public partial class CrmCompanyViewPage : IDisposable { Toaster.ShowError($"Moms Nummer ugyldigt"); } - Toaster.ShowInfo("Vent venligst ...", "Opdaterer Moms Nr"); + Toaster.ShowInfo("Vent venligst ...", "OPDATERER MOMS NUMMER"); var result = await CompanyRepo.UpdateCompanyVat(CompanyId, Company.VatNumber); if (!string.IsNullOrWhiteSpace(result.Name)) { @@ -245,26 +242,6 @@ public partial class CrmCompanyViewPage : IDisposable } } - /// - /// Get vat info from known address - /// - /// - private async Task GetInfoFromAddress(VatAddress address) - { - Toaster.ShowInfo("Vent for adresse info ..."); - VatInfos = await VatService.QueryVirkRegistry( - new VirkParams - { - StreetName = address.StreetName, - HouseNumber = address.HouseNumber, - ZipCode = address.ZipCode - }); - if (!VatInfos.Any()) - { - Toaster.ShowWarning($"Ingen data fundet ..."); - } - } - /// /// Prepare vat address from company model /// @@ -311,9 +288,9 @@ public partial class CrmCompanyViewPage : IDisposable /// Modal callback to update company properties /// /// - private async Task SelectCompanyCallback(VirkRegInfo regInfo) + private void SelectCompanyCallback(VirkRegInfo regInfo) { - Console.WriteLine(JsonSerializer.Serialize(regInfo)); + Logger.LogDebug($"CrmCompanyView => SelectCompanyCallback => {JsonSerializer.Serialize(regInfo)}"); // this can be removed in favor of the new data returned from updating the VatNumber ValidVat = regInfo.States[0].State.ToLower() == "normal"; @@ -323,18 +300,14 @@ public partial class CrmCompanyViewPage : IDisposable if (regInfo.SyncAll) { - Company.VatNumber = CompanyRegInfo.VatNumber; - Company.Name = CompanyRegInfo.Name; - Company.Address1 = CompanyRegInfo.Address; - Company.Address2 = CompanyRegInfo.CoName; - Company.ZipCode = CompanyRegInfo.ZipCode; - Company.City = CompanyRegInfo.City; + + Company.Name = regInfo.Name; + Company.Address1 = regInfo.Address; + Company.Address2 = regInfo.CoName; + Company.ZipCode = regInfo.ZipCode; + Company.City = regInfo.City; } - else - { - Company.VatNumber = CompanyRegInfo.VatNumber; - } - // await UpdateVatNumber(); + Company.VatNumber = regInfo.VatNumber; } /// diff --git a/Wonky.Client/Pages/Login.razor b/Wonky.Client/Pages/Login.razor index 7081635a..a3948fc3 100644 --- a/Wonky.Client/Pages/Login.razor +++ b/Wonky.Client/Pages/Login.razor @@ -28,7 +28,7 @@ } } - +
@@ -39,37 +39,40 @@
+ @* username *@
- - + + +
- + @* current-password *@
- - + + + -
+ @* submit button *@
- +
-
-
- @if (execLogin) - { - - } -
-
-
+ @* loader animation *@ +
+
+ @if (execLogin) + { + + } +
+
- + \ No newline at end of file diff --git a/Wonky.Client/Services/VatInfoLookupService.cs b/Wonky.Client/Services/VatInfoLookupService.cs index 19c44691..1a943760 100644 --- a/Wonky.Client/Services/VatInfoLookupService.cs +++ b/Wonky.Client/Services/VatInfoLookupService.cs @@ -121,6 +121,9 @@ public class VatInfoLookupService { if (!string.IsNullOrWhiteSpace(query.VatNumber)) return true; + + if (!string.IsNullOrWhiteSpace(query.EntityName)) + return true; return !string.IsNullOrWhiteSpace(query.HouseNumber) && !string.IsNullOrWhiteSpace(query.StreetName) diff --git a/Wonky.Client/Shared/VatLookupDkModal.razor.cs b/Wonky.Client/Shared/VatLookupDkModal.razor.cs index 87ed58df..46b5731d 100644 --- a/Wonky.Client/Shared/VatLookupDkModal.razor.cs +++ b/Wonky.Client/Shared/VatLookupDkModal.razor.cs @@ -37,6 +37,7 @@ public partial class VatLookupDkModal [Parameter] public EventCallback OnSelectedCompany { get; set; } [Inject] public VatInfoLookupService VatService { get; set; } [Inject] public IToastService Toaster { get; set; } + [Inject] public ILogger Logger { get; set; } private VirkRegInfo CompanyRegInfo { get; set; } = new(); private List VatInfos { get; set; } = new(); private VatAddress _vatAddress { get; set; } = new(); @@ -50,12 +51,12 @@ public partial class VatLookupDkModal return base.OnParametersSetAsync(); } - private async Task SelectCompany(string vatNumber, bool syncAll) + private void SelectCompany(string vatNumber, bool syncAll) { CompanyRegInfo = VatInfos.First(x => x.VatNumber == vatNumber); CompanyRegInfo.SyncAll = syncAll; - Console.WriteLine($"SelectCompany => {JsonSerializer.Serialize(CompanyRegInfo)}"); - await OnSelectedCompany.InvokeAsync(CompanyRegInfo); + Logger.LogDebug($"VatLookupModal => SelectCompany => {JsonSerializer.Serialize(CompanyRegInfo)}"); + OnSelectedCompany.InvokeAsync(CompanyRegInfo); Hide(); } diff --git a/Wonky.Client/wwwroot/appsettings.json b/Wonky.Client/wwwroot/appsettings.json index 0b219720..4fd52ca6 100644 --- a/Wonky.Client/wwwroot/appsettings.json +++ b/Wonky.Client/wwwroot/appsettings.json @@ -1,7 +1,7 @@ { "appInfo": { "name": "Wonky Client", - "version": "0.47.4", + "version": "0.48.1", "rc": true, "sandBox": false, "image": "grumpy-coder.png"