From 2e8deb6bb6e4b72e06b161647c6f77650db4c6e8 Mon Sep 17 00:00:00 2001 From: Frede Hundewadt Date: Wed, 14 Sep 2022 13:45:55 +0200 Subject: [PATCH] refactor vat lookup --- ...azor => OfficeAdvisorTableComponent.razor} | 0 ...s => OfficeAdvisorTableComponent.razor.cs} | 2 +- .../Components/ReportItemComponent.razor | 9 +- .../VatEntityNameInputComponent.razor | 30 +++++ .../VatEntityNameInputComponent.razor.cs | 47 +++++++ .../Components/VatInfoComponent.razor | 35 ------ .../Components/VatInfoComponent.razor.cs | 45 ------- .../Pages/CrmNewActivityPage.razor.cs | 15 ++- Wonky.Client/Pages/CrmViewCompanyPage.razor | 12 +- .../Pages/CrmViewCompanyPage.razor.cs | 115 ++++++++++-------- .../Pages/OfficeListCrmUserPage.razor | 2 +- .../Pages/OfficeListCustomerPage.razor | 2 +- .../Pages/OfficeNewOrderPage.razor.cs | 9 +- .../Pages/WarehouseOrderViewPage.razor | 2 +- Wonky.Client/Shared/VatLookupDkModal.razor | 67 ++++++++++ Wonky.Client/Shared/VatLookupDkModal.razor.cs | 98 +++++++++++++++ Wonky.Client/wwwroot/appsettings.json | 4 +- Wonky.Entity/DTO/ActivityDto.cs | 11 +- Wonky.Entity/DTO/CompanyDto.cs | 6 + Wonky.Entity/Models/VirkRegInfo.cs | 2 + 20 files changed, 357 insertions(+), 156 deletions(-) rename Wonky.Client/Components/{OfficeAvisorTableComponent.razor => OfficeAdvisorTableComponent.razor} (100%) rename Wonky.Client/Components/{OfficeAvisorTableComponent.razor.cs => OfficeAdvisorTableComponent.razor.cs} (95%) create mode 100644 Wonky.Client/Components/VatEntityNameInputComponent.razor create mode 100644 Wonky.Client/Components/VatEntityNameInputComponent.razor.cs delete mode 100644 Wonky.Client/Components/VatInfoComponent.razor delete mode 100644 Wonky.Client/Components/VatInfoComponent.razor.cs create mode 100644 Wonky.Client/Shared/VatLookupDkModal.razor create mode 100644 Wonky.Client/Shared/VatLookupDkModal.razor.cs diff --git a/Wonky.Client/Components/OfficeAvisorTableComponent.razor b/Wonky.Client/Components/OfficeAdvisorTableComponent.razor similarity index 100% rename from Wonky.Client/Components/OfficeAvisorTableComponent.razor rename to Wonky.Client/Components/OfficeAdvisorTableComponent.razor diff --git a/Wonky.Client/Components/OfficeAvisorTableComponent.razor.cs b/Wonky.Client/Components/OfficeAdvisorTableComponent.razor.cs similarity index 95% rename from Wonky.Client/Components/OfficeAvisorTableComponent.razor.cs rename to Wonky.Client/Components/OfficeAdvisorTableComponent.razor.cs index 1c1cebf8..4d6d221f 100644 --- a/Wonky.Client/Components/OfficeAvisorTableComponent.razor.cs +++ b/Wonky.Client/Components/OfficeAdvisorTableComponent.razor.cs @@ -19,7 +19,7 @@ using Wonky.Entity.Views; namespace Wonky.Client.Components; -public partial class OfficeAvisorTableComponent +public partial class OfficeAdvisorTableComponent { [Parameter] public List UserList { get; set; } } \ No newline at end of file diff --git a/Wonky.Client/Components/ReportItemComponent.razor b/Wonky.Client/Components/ReportItemComponent.razor index 030a8707..a2e99d61 100644 --- a/Wonky.Client/Components/ReportItemComponent.razor +++ b/Wonky.Client/Components/ReportItemComponent.razor @@ -111,7 +111,7 @@ } - + Ordresum @ReportItem.OrderAmount @@ -129,4 +129,11 @@ @code{ [Parameter] public ReportItemView ReportItem { get; set; } = new(); + + protected override void OnParametersSet() + { + var lines = ReportItem.Lines.OrderBy(x => x.Location).ToList(); + ReportItem.Lines = lines; + } + } \ No newline at end of file diff --git a/Wonky.Client/Components/VatEntityNameInputComponent.razor b/Wonky.Client/Components/VatEntityNameInputComponent.razor new file mode 100644 index 00000000..cc5e063c --- /dev/null +++ b/Wonky.Client/Components/VatEntityNameInputComponent.razor @@ -0,0 +1,30 @@ +@* +// 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] +// +*@ + + + +
+
+ + +
+
+ +
+
+
\ No newline at end of file diff --git a/Wonky.Client/Components/VatEntityNameInputComponent.razor.cs b/Wonky.Client/Components/VatEntityNameInputComponent.razor.cs new file mode 100644 index 00000000..00bddf3e --- /dev/null +++ b/Wonky.Client/Components/VatEntityNameInputComponent.razor.cs @@ -0,0 +1,47 @@ +// 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.ComponentModel.DataAnnotations; +using Microsoft.AspNetCore.Components; +using Microsoft.AspNetCore.Components.Forms; +using Wonky.Client.Models; + +namespace Wonky.Client.Components; +public partial class VatEntityNameInputComponent : IDisposable +{ + [Parameter] public string EntityName { get; set; } = ""; + private EditContext _editName { get; set; } + private bool _formInvalid = true; + [Parameter] public EventCallback OnValidSubmit { get; set; } + + protected override void OnInitialized() + { + _editName = new EditContext(EntityName); + _editName.OnFieldChanged += HandleFieldChanged; + } + private async Task SubmitForm() + { + await OnValidSubmit.InvokeAsync(EntityName); + } + private void HandleFieldChanged(object? sender, FieldChangedEventArgs e) + { + _formInvalid = !_editName.Validate(); + StateHasChanged(); + } + public void Dispose() + { + _editName!.OnFieldChanged -= HandleFieldChanged; + } +} \ No newline at end of file diff --git a/Wonky.Client/Components/VatInfoComponent.razor b/Wonky.Client/Components/VatInfoComponent.razor deleted file mode 100644 index 9e8803cd..00000000 --- a/Wonky.Client/Components/VatInfoComponent.razor +++ /dev/null @@ -1,35 +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] -// -*@ - -
-
- -
-
-
-
- CVR status @_currentState -
-
    -
  • @VirkRegInfo.Name
  • -
  • @VirkRegInfo.CoName
  • -
  • @VirkRegInfo.Address
  • -
  • @VirkRegInfo.ZipCode @VirkRegInfo.City
  • -
-
-
-
\ No newline at end of file diff --git a/Wonky.Client/Components/VatInfoComponent.razor.cs b/Wonky.Client/Components/VatInfoComponent.razor.cs deleted file mode 100644 index 23b3eef1..00000000 --- a/Wonky.Client/Components/VatInfoComponent.razor.cs +++ /dev/null @@ -1,45 +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.Services; -using Wonky.Entity.Models; -using Wonky.Entity.Requests; - -namespace Wonky.Client.Components; - -public partial class VatInfoComponent -{ - [Inject] public VatInfoLookupService VatInfoLookupService { get; set; } = null!; - [Parameter] public string VatNumber { get; set; } = ""; - private VirkRegInfo VirkRegInfo { get; set; } = new(); - private bool _hideMe = true; - private bool CvrInvalid => string.IsNullOrEmpty(VatNumber); - private readonly VirkParams _virkParams = new(); - private string _currentState = ""; - private async Task GetCvrData() - { - _virkParams.VatNumber = VatNumber; - if (string.IsNullOrWhiteSpace(VirkRegInfo.VatNumber)) - { - var result = await VatInfoLookupService.QueryVirkRegistry(_virkParams); - if (result.Any()) - { - _currentState = VirkRegInfo.States[^1].State; - } - } - _hideMe = !_hideMe; - } -} \ No newline at end of file diff --git a/Wonky.Client/Pages/CrmNewActivityPage.razor.cs b/Wonky.Client/Pages/CrmNewActivityPage.razor.cs index fc6e5ad0..fb36966c 100644 --- a/Wonky.Client/Pages/CrmNewActivityPage.razor.cs +++ b/Wonky.Client/Pages/CrmNewActivityPage.razor.cs @@ -111,12 +111,7 @@ public partial class CrmNewActivityPage : IDisposable _company.Phone = _company.Account[..8]; } - // set up identification - _draft.CompanyId = _company.CompanyId; _draft.BcId = _company.BcId; - _draft.SalesRepId = _ux.Id; - _draft.SalesRep = _ux.Advisor; - _draft.ActivityStatusEnum = "noSale"; _draft.VisitTypeEnum = _company.Account is "" or "NY" ? "new" : "recall"; @@ -124,7 +119,11 @@ public partial class CrmNewActivityPage : IDisposable _draft.OrderMessage = "Virksomheden er ophørt."; // permanent identifications - _draft.SalesRep = _ux.Advisor; + _draft.CompanyId = _company.CompanyId; + _draft.SalesRepId = _company.SalesRepId; + _draft.SalesRep = _company.SalesRep; + _draft.CountryCode = _company.CountryCode; + _draft.Account = _company.Account; _draft.VatNumber = _company.VatNumber; _draft.Email = _company.Email; @@ -142,7 +141,7 @@ public partial class CrmNewActivityPage : IDisposable _draft.DlvAddress2 = _company.Address2; _draft.DlvZipCode = _company.ZipCode; _draft.DlvCity = _company.City; - + } private void CallPriceListModal() { @@ -244,8 +243,8 @@ public partial class CrmNewActivityPage : IDisposable if (_phone != _draft.Phone) { _company.Phone = _draft.Phone; + // update company phone record await _companyRepo.UpdateCompany(_company.CompanyId, _company); - // _toast.ShowInfo("Kunde telefon nummer er opdateret."); } // post to api var result = await CrmActivityRepo.CreateActivity(_draft); diff --git a/Wonky.Client/Pages/CrmViewCompanyPage.razor b/Wonky.Client/Pages/CrmViewCompanyPage.razor index 298e361a..dd8d1950 100644 --- a/Wonky.Client/Pages/CrmViewCompanyPage.razor +++ b/Wonky.Client/Pages/CrmViewCompanyPage.razor @@ -27,10 +27,14 @@

@_company.Account - @_company.Name

+ @* @if (_dk) {
+
+
+
@if (_vInfos.Any()) { @@ -63,10 +67,11 @@ } } + *@
- +
@@ -78,6 +83,7 @@ + Telefon @@ -223,4 +229,6 @@ else { -} \ No newline at end of file +} + + \ No newline at end of file diff --git a/Wonky.Client/Pages/CrmViewCompanyPage.razor.cs b/Wonky.Client/Pages/CrmViewCompanyPage.razor.cs index dc4398cd..0770cdc6 100644 --- a/Wonky.Client/Pages/CrmViewCompanyPage.razor.cs +++ b/Wonky.Client/Pages/CrmViewCompanyPage.razor.cs @@ -27,6 +27,7 @@ using Wonky.Client.Helpers; using Wonky.Client.HttpInterfaces; using Wonky.Client.Models; using Wonky.Client.Services; +using Wonky.Client.Shared; using Wonky.Entity.DTO; using Wonky.Entity.Models; using Wonky.Entity.Requests; @@ -67,6 +68,7 @@ public partial class CrmViewCompanyPage : IDisposable private bool _dk { get; set; } = true; private int _isDirty { get; set; } private int _vatUpdated { get; set; } + private VatLookupDkModal _vatLookupModal { get; set; } = new(); private readonly JsonSerializerOptions _options = new () { @@ -200,55 +202,6 @@ public partial class CrmViewCompanyPage : IDisposable } _hideButtons = false; } - - private async Task GetInfoFromAddress(VatAddress address) - { - _vInfos = await _vatService.QueryVirkRegistry( - new VirkParams - { - StreetName = address.StreetName.Trim(), - HouseNumber = address.HouseNumber.Trim(), - ZipCode = address.ZipCode.Trim() - }); - - if (!_vInfos.Any()) - _toast.ShowError($"Ingen virksomheder fundet."); - } - - private void SelectCompany(string vatNumber, bool syncAll) - { - _virkRegInfo = (from x in _vInfos where x.VatNumber == vatNumber select x).First(); - _validVat = _virkRegInfo.States[0].State.ToLower() == "normal"; - _company.HasFolded = _validVat ? 1 : 0; - _enableActivity = _validVat ? 1 : 0; - _vatState = _virkRegInfo.States[0].State.ToLower() == "normal" ? "the-good" : "the-dead"; - - if (syncAll) - { - _company.VatNumber = _virkRegInfo.VatNumber; - _company.Name = _virkRegInfo.Name; - _company.Address1 = _virkRegInfo.Address; - _company.Address2 = _virkRegInfo.CoName; - _company.ZipCode = _virkRegInfo.ZipCode; - _company.City = _virkRegInfo.City; - _isDirty = 1; - } - else - { - _company.VatNumber = _virkRegInfo.VatNumber; - _vatUpdated = 1; - } - // empty list - _vInfos = new List(); - StateHasChanged(); - } - - public void Dispose() - { - _interceptor.DisposeEvent(); - _editContext.OnFieldChanged -= HandleFieldChanged; - _editContext.OnValidationStateChanged -= ValidationChanged; - } private static VatAddress PrepareVatAddress(CompanyDto model) { @@ -278,4 +231,68 @@ public partial class CrmViewCompanyPage : IDisposable // return empty model return new VatAddress(); } + + private void CallVatLookupModal() + { + _vatLookupModal.Show(); + } + private void OnSelectedCompany(VirkRegInfo regInfo) + { + _validVat = regInfo.States[0].State.ToLower() == "normal"; + _company.HasFolded = _validVat ? 1 : 0; + _enableActivity = _validVat ? 1 : 0; + _vatState = regInfo.States[0].State.ToLower() == "normal" ? "the-good" : "the-dead"; + + if (regInfo.SyncAll) + { + _company.VatNumber = this._virkRegInfo.VatNumber; + _company.Name = this._virkRegInfo.Name; + _company.Address1 = this._virkRegInfo.Address; + _company.Address2 = this._virkRegInfo.CoName; + _company.ZipCode = this._virkRegInfo.ZipCode; + _company.City = this._virkRegInfo.City; + _isDirty = 1; + } + else + { + _company.VatNumber = this._virkRegInfo.VatNumber; + _vatUpdated = 1; + } + StateHasChanged(); + } + + // private void SelectCompany(string vatNumber, bool syncAll) + // { + // _virkRegInfo = (from x in _vInfos where x.VatNumber == vatNumber select x).First(); + // _validVat = _virkRegInfo.States[0].State.ToLower() == "normal"; + // _company.HasFolded = _validVat ? 1 : 0; + // _enableActivity = _validVat ? 1 : 0; + // _vatState = _virkRegInfo.States[0].State.ToLower() == "normal" ? "the-good" : "the-dead"; + // + // if (syncAll) + // { + // _company.VatNumber = _virkRegInfo.VatNumber; + // _company.Name = _virkRegInfo.Name; + // _company.Address1 = _virkRegInfo.Address; + // _company.Address2 = _virkRegInfo.CoName; + // _company.ZipCode = _virkRegInfo.ZipCode; + // _company.City = _virkRegInfo.City; + // _isDirty = 1; + // } + // else + // { + // _company.VatNumber = _virkRegInfo.VatNumber; + // _vatUpdated = 1; + // } + // // empty list + // _vInfos = new List(); + // StateHasChanged(); + // } + + public void Dispose() + { + _interceptor.DisposeEvent(); + _editContext.OnFieldChanged -= HandleFieldChanged; + _editContext.OnValidationStateChanged -= ValidationChanged; + } } \ No newline at end of file diff --git a/Wonky.Client/Pages/OfficeListCrmUserPage.razor b/Wonky.Client/Pages/OfficeListCrmUserPage.razor index e2e42580..cc4ad208 100644 --- a/Wonky.Client/Pages/OfficeListCrmUserPage.razor +++ b/Wonky.Client/Pages/OfficeListCrmUserPage.razor @@ -25,6 +25,6 @@

Sælgere

- +
\ No newline at end of file diff --git a/Wonky.Client/Pages/OfficeListCustomerPage.razor b/Wonky.Client/Pages/OfficeListCustomerPage.razor index 3c37c5b0..4e6d3572 100644 --- a/Wonky.Client/Pages/OfficeListCustomerPage.razor +++ b/Wonky.Client/Pages/OfficeListCustomerPage.razor @@ -24,6 +24,6 @@
- +
\ No newline at end of file diff --git a/Wonky.Client/Pages/OfficeNewOrderPage.razor.cs b/Wonky.Client/Pages/OfficeNewOrderPage.razor.cs index 03f920ed..c920d201 100644 --- a/Wonky.Client/Pages/OfficeNewOrderPage.razor.cs +++ b/Wonky.Client/Pages/OfficeNewOrderPage.razor.cs @@ -72,13 +72,8 @@ public partial class OfficeNewOrderPage : IDisposable // set up identification _draft.CompanyId = _company.CompanyId; _draft.BcId = _company.BcId; - _draft.SalesRepId = _userInfo.UserId; - - _draft.ActivityStatusEnum = "noSale"; - _draft.VisitTypeEnum = _company.Account is "" or "NY" ? "new" : "recall"; - - // permanent identifications - _draft.SalesRep = _userInfo.Advisor; + _draft.SalesRepId = _company.SalesRepId; + _draft.SalesRep = _company.SalesRep; _draft.Account = _company.Account; _draft.VatNumber = _company.VatNumber; _draft.Email = _company.Email; diff --git a/Wonky.Client/Pages/WarehouseOrderViewPage.razor b/Wonky.Client/Pages/WarehouseOrderViewPage.razor index a4ff6a38..b13f4491 100644 --- a/Wonky.Client/Pages/WarehouseOrderViewPage.razor +++ b/Wonky.Client/Pages/WarehouseOrderViewPage.razor @@ -101,7 +101,7 @@ }
diff --git a/Wonky.Client/Shared/VatLookupDkModal.razor b/Wonky.Client/Shared/VatLookupDkModal.razor new file mode 100644 index 00000000..13a76f56 --- /dev/null +++ b/Wonky.Client/Shared/VatLookupDkModal.razor @@ -0,0 +1,67 @@ +@* +// 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 + +@if (_showBackdrop) +{ + +} \ No newline at end of file diff --git a/Wonky.Client/Shared/VatLookupDkModal.razor.cs b/Wonky.Client/Shared/VatLookupDkModal.razor.cs new file mode 100644 index 00000000..fe91b8e8 --- /dev/null +++ b/Wonky.Client/Shared/VatLookupDkModal.razor.cs @@ -0,0 +1,98 @@ +// 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 Blazored.Toast.Services; +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.Models; +using Wonky.Entity.Requests; +using Wonky.Entity.Views; + +namespace Wonky.Client.Shared; + +public partial class VatLookupDkModal +{ + private string _modalDisplay = ""; + private bool _showBackdrop; + [Parameter] public VatAddress VatAddress { get; set; } = new(); + [Parameter] public EventCallback OnSelectedCompany { get; set; } + [Inject] private VatInfoLookupService _vatService { get; set; } + [Inject] private IToastService _toast { get; set; } + private VirkRegInfo _virkRegInfo { get; set; } = new(); + private List _vInfos { get; set; } = new(); + + private async Task SelectCompany(string vatNumber, bool syncAll) + { + _virkRegInfo = _vInfos.First(x => x.VatNumber == vatNumber); + _virkRegInfo.SyncAll = syncAll; + await OnSelectedCompany.InvokeAsync(_virkRegInfo); + } + + private async Task GetInfoFromAddress(VatAddress address) + { + _toast.ShowInfo("Vent for adresse info ..."); + _vInfos = await _vatService.QueryVirkRegistry( + new VirkParams + { + StreetName = address.StreetName, + HouseNumber = address.HouseNumber, + ZipCode = address.ZipCode + }); + if (!_vInfos.Any()) + { + _toast.ShowWarning($"Ingen data fundet ..."); + } + } + + private async Task GetInfoFromVat(string vatNumber) + { + _toast.ShowInfo("Vent for firma info ..."); + _vInfos = await _vatService + .QueryVirkRegistry(new VirkParams {VatNumber = vatNumber}); + if (!_vInfos.Any()) + { + _toast.ShowError($"Firma med CVR '{vatNumber}' findes ikke."); + } + } + + private async Task GetInfoFromName(string entityName) + { + _toast.ShowInfo("Vent for firma info ..."); + _vInfos = await _vatService + .QueryVirkRegistry(new VirkParams {EntityName = entityName}); + if (!_vInfos.Any()) + { + _toast.ShowError($"Firma med nav '{entityName}' findes ikke."); + } + } + + public void Show() + { + _modalDisplay = "block;"; + _showBackdrop = true; + StateHasChanged(); + } + + private void Hide() + { + _modalDisplay = "none;"; + _showBackdrop = false; + StateHasChanged(); + } +} \ No newline at end of file diff --git a/Wonky.Client/wwwroot/appsettings.json b/Wonky.Client/wwwroot/appsettings.json index f576b6c1..e3057b83 100644 --- a/Wonky.Client/wwwroot/appsettings.json +++ b/Wonky.Client/wwwroot/appsettings.json @@ -1,7 +1,7 @@ { "appInfo": { "name": "Wonky Client", - "version": "0.16.1", + "version": "0.19.1", "rc": true, "sandBox": true, "image": "grumpy-coder.png" @@ -29,7 +29,7 @@ "officeUserPasswd": "api/v2/office/users/passwd", "officeCustomers": "api/v2/office/customers", "officeReports": "api/v2/office/reports", - "warehouse": "api/v2/warehouse/orders" + "warehouse": "api/v2/warehouse/packages" }, "Logging": { "LogLevel": { diff --git a/Wonky.Entity/DTO/ActivityDto.cs b/Wonky.Entity/DTO/ActivityDto.cs index ceba70ad..aa532016 100644 --- a/Wonky.Entity/DTO/ActivityDto.cs +++ b/Wonky.Entity/DTO/ActivityDto.cs @@ -23,18 +23,23 @@ public class ActivityDto /// Activity entity id /// public string ActivityId { get; set; } = ""; + /// /// Sales representative identification /// - public string SalesRep { get; set; } = ""; + [Required] public string SalesRep { get; set; } = ""; /// /// Sales representative entity Id /// - public string SalesRepId { get; set; } = ""; + [Required] public string SalesRepId { get; set; } = ""; + /// + /// Company countryCode (ensure correct code when office create ordre) + /// + [Required] public string CountryCode { get; set; } = ""; /// /// Company entity Id /// - public string CompanyId { get; set; } = ""; + [Required] public string CompanyId { get; set; } = ""; /// /// Business Central entity Id /// diff --git a/Wonky.Entity/DTO/CompanyDto.cs b/Wonky.Entity/DTO/CompanyDto.cs index c867c406..cba7132d 100644 --- a/Wonky.Entity/DTO/CompanyDto.cs +++ b/Wonky.Entity/DTO/CompanyDto.cs @@ -57,6 +57,12 @@ public class CompanyDto /// Sales representative entity Id /// public string SalesRepId { get; set; } = ""; + + /// + /// SalesRep ERP identifier + /// + public string SalesRep { get; set; } = ""; + /// /// Business Central entity Id /// diff --git a/Wonky.Entity/Models/VirkRegInfo.cs b/Wonky.Entity/Models/VirkRegInfo.cs index e7fda919..ea973ebb 100644 --- a/Wonky.Entity/Models/VirkRegInfo.cs +++ b/Wonky.Entity/Models/VirkRegInfo.cs @@ -60,4 +60,6 @@ public class VirkRegInfo /// Date for last request of entity VAT state /// public string RequestDate { get; set; } = "" ; + + public bool SyncAll { get; set; } } \ No newline at end of file