From 88039cd8f51169a4011d72a90fc2bcf43f11c2e6 Mon Sep 17 00:00:00 2001 From: Frede Hundewadt Date: Mon, 5 Dec 2022 06:55:50 +0100 Subject: [PATCH] wip - move loading to bottom of page - added missing lib ref --- .../HttpInterceptorService.cs | 17 ++-- .../ICrmHistoryHttpRepository.cs | 8 +- .../CrmHistoryHttpRepository.cs | 6 +- Wonky.Client/Pages/CatalogPage.razor | 6 +- Wonky.Client/Pages/CatalogPage.razor.cs | 20 ++--- Wonky.Client/Pages/CatalogPrintPage.razor | 7 +- Wonky.Client/Pages/CrmActivityTodayPage.razor | 8 +- Wonky.Client/Pages/CrmActivityViewPage.razor | 12 +-- .../Pages/CrmCompanyActivityListPage.razor | 8 +- .../Pages/CrmCompanyInventoryPage.razor | 9 +- .../Pages/CrmCompanyInvoiceListPage.razor | 10 +-- .../Pages/CrmCompanyInvoiceListPage.razor.cs | 12 +-- Wonky.Client/Pages/CrmCompanyListPage.razor | 7 +- Wonky.Client/Pages/CrmCompanyNewPage.razor | 13 +-- Wonky.Client/Pages/CrmCompanyViewPage.razor | 11 +-- .../Pages/CrmCompanyViewPage.razor.cs | 87 ++++++++++--------- Wonky.Client/Pages/CrmReportListPage.razor | 10 ++- Wonky.Client/Pages/CrmReportNewPage.razor | 13 +-- Wonky.Client/Pages/CrmReportViewPage.razor | 12 +-- Wonky.Client/Pages/CrmTaskItemListPage.razor | 12 +-- Wonky.Client/Pages/CrmTaskItemViewPage.razor | 13 +-- .../Pages/CrmWorkplaceDocumentListPage.razor | 1 + Wonky.Client/Pages/CrmWorkplaceListPage.razor | 12 +-- Wonky.Client/Pages/CrmWorkplaceViewPage.razor | 13 +-- Wonky.Client/Pages/Logout.razor.cs | 2 +- .../Pages/OfficeCustomerListPage.razor | 3 +- .../OfficeCustomerSalesRepListPage.razor | 4 +- Wonky.Client/Pages/OfficeOrderNewPage.razor | 27 +++--- Wonky.Client/Pages/OfficeOrderViewPage.razor | 12 +-- Wonky.Client/Pages/OfficeReportListPage.razor | 10 ++- Wonky.Client/Pages/OfficeReportViewPage.razor | 13 +-- Wonky.Client/Pages/OfficeUserListPage.razor | 12 +-- Wonky.Client/Pages/OfficeUserViewPage.razor | 12 +-- .../Pages/WarehouseOrderViewPage.razor | 10 ++- .../Services/AuthenticationService.cs | 11 ++- Wonky.Client/wwwroot/appsettings.json | 2 +- Wonky.Entity/DTO/CompanyDto.cs | 2 +- 37 files changed, 237 insertions(+), 210 deletions(-) diff --git a/Wonky.Client/HttpInterceptors/HttpInterceptorService.cs b/Wonky.Client/HttpInterceptors/HttpInterceptorService.cs index 45bae165..f6f8500f 100644 --- a/Wonky.Client/HttpInterceptors/HttpInterceptorService.cs +++ b/Wonky.Client/HttpInterceptors/HttpInterceptorService.cs @@ -32,12 +32,13 @@ namespace Wonky.Client.HttpInterceptors private readonly IToastService _toast; private readonly RefreshTokenService _refreshTokenService; private ILogger _logger; - private ILocalStorageService _storage; + private readonly ILocalStorageService _storage; + private IAuthenticationService _authenticationService; public HttpInterceptorService(HttpClientInterceptor interceptor, NavigationManager navigation, IToastService toast, RefreshTokenService refreshTokenService, ILogger logger, - ILocalStorageService storage) + ILocalStorageService storage, IAuthenticationService authenticationService) { _interceptor = interceptor; _navigation = navigation; @@ -45,6 +46,7 @@ namespace Wonky.Client.HttpInterceptors _refreshTokenService = refreshTokenService; _logger = logger; _storage = storage; + _authenticationService = authenticationService; } public void RegisterEvent() @@ -75,8 +77,8 @@ namespace Wonky.Client.HttpInterceptors // set new token e.Request.Headers.Authorization = new AuthenticationHeaderValue("bearer", token); } - } + } private void AfterSend (object sender, HttpClientInterceptorEventArgs e) @@ -100,11 +102,13 @@ namespace Wonky.Client.HttpInterceptors // _toast.ShowWarning(message); break; case HttpStatusCode.Unauthorized: - ClearInfo(); + _authenticationService.Logout(); _navigation.NavigateTo($"/login/{currDoc}"); message = "Venligst login ..."; _toast.ShowWarning(message); break; + case HttpStatusCode.Conflict: + break; case HttpStatusCode.InternalServerError: message = "Der er interne problemer på serveren ..."; _toast.ShowError(message); @@ -115,11 +119,6 @@ namespace Wonky.Client.HttpInterceptors } // throw new HttpResponseException(message); } - - private async void ClearInfo() - { - await _storage.ClearAsync(); - } } } diff --git a/Wonky.Client/HttpInterfaces/ICrmHistoryHttpRepository.cs b/Wonky.Client/HttpInterfaces/ICrmHistoryHttpRepository.cs index e7b16bf9..b76a8e0d 100644 --- a/Wonky.Client/HttpInterfaces/ICrmHistoryHttpRepository.cs +++ b/Wonky.Client/HttpInterfaces/ICrmHistoryHttpRepository.cs @@ -22,8 +22,8 @@ public interface ICrmHistoryHttpRepository { Task FetchInvoiceList(string companyId); Task FetchInvoice(string companyId, string invoiceId); - Task?> FetchInventory(string companyId); - Task?> FetchHistory(string companyId); - Task?> FetchHistory(string companyId, string sku); - Task RpcSyncErpToCrm(string companyId, string syncDate); + Task> FetchInventory(string companyId); + Task> FetchHistory(string companyId); + Task> FetchHistory(string companyId, string sku); + Task RpcSyncErpToCrm(string companyId, string syncDate, string etag); } \ No newline at end of file diff --git a/Wonky.Client/HttpRepository/CrmHistoryHttpRepository.cs b/Wonky.Client/HttpRepository/CrmHistoryHttpRepository.cs index 5fc71e73..d91c6e32 100644 --- a/Wonky.Client/HttpRepository/CrmHistoryHttpRepository.cs +++ b/Wonky.Client/HttpRepository/CrmHistoryHttpRepository.cs @@ -108,14 +108,16 @@ public class CrmHistoryHttpRepository : ICrmHistoryHttpRepository return await _client.GetFromJsonAsync>( $"{_api.CrmCustomers}/{companyId}/{_api.CrmProductExt}/{sku}", _options); } + /// /// execute a remote procedure designed to update crm database from erp system based on a date string /// /// /// + /// /// date string - public async Task RpcSyncErpToCrm(string companyId, string syncDate) + public async Task RpcSyncErpToCrm(string companyId, string syncDate, string etag) { - return await _client.GetStringAsync($"{_api.CrmCustomers}/{companyId}/{_api.CrmRpcSyncExt}/{syncDate}"); + return await _client.GetStringAsync($"{_api.CrmCustomers}/{companyId}/{_api.CrmRpcSyncExt}/{syncDate}?etag={etag}"); } } \ No newline at end of file diff --git a/Wonky.Client/Pages/CatalogPage.razor b/Wonky.Client/Pages/CatalogPage.razor index 1e02a8eb..7aeccee0 100644 --- a/Wonky.Client/Pages/CatalogPage.razor +++ b/Wonky.Client/Pages/CatalogPage.razor @@ -24,7 +24,7 @@
- +
@@ -39,15 +39,15 @@
- +
+ @if (Working) { } - \ No newline at end of file diff --git a/Wonky.Client/Pages/CatalogPage.razor.cs b/Wonky.Client/Pages/CatalogPage.razor.cs index aefd4d59..5b959fb4 100644 --- a/Wonky.Client/Pages/CatalogPage.razor.cs +++ b/Wonky.Client/Pages/CatalogPage.razor.cs @@ -55,7 +55,7 @@ public partial class CatalogPage : IDisposable Interceptor.RegisterEvent(); Interceptor.RegisterBeforeSendEvent(); - await GetSalesItems(); + await FetchSalesItems(); } private async Task SetSearchPhrase(string searchTerm) @@ -63,7 +63,7 @@ public partial class CatalogPage : IDisposable _items = new List(); _paging.PageNumber = 1; _paging.SearchTerm = searchTerm; - await GetSalesItems(); + await FetchSalesItems(); } private async Task SetPageSize(string pageSize) @@ -71,7 +71,7 @@ public partial class CatalogPage : IDisposable _items = new List(); _paging.PageSize = Convert.ToInt32(pageSize); _paging.PageNumber = 1; - await GetSalesItems(); + await FetchSalesItems(); } private async Task SetSearchCol(string columnName) @@ -79,32 +79,32 @@ public partial class CatalogPage : IDisposable _items = new List(); _paging.PageNumber = 1; _paging.SearchColumn = columnName; - await GetSalesItems(); + await FetchSalesItems(); } private async Task SetSortCol(string orderBy) { _items = new List(); _paging.OrderBy = orderBy; - await GetSalesItems(); + await FetchSalesItems(); } - private async Task SelectedPage(int page) + private async Task SetSelectedPage(int page) { _items = new List(); _paging.PageNumber = page; - await GetSalesItems(); + await FetchSalesItems(); } - private async Task SetItemGroup(string groupFilter) + private async Task SetGroupCol(string groupFilter) { _items = new List(); _paging.PageNumber = 1; _paging.SelectGroup = groupFilter; - await GetSalesItems(); + await FetchSalesItems(); } - private async Task GetSalesItems() + private async Task FetchSalesItems() { Working = true; var pagingResponse = await ItemRepo.GetSalesItemsPaged(_paging); diff --git a/Wonky.Client/Pages/CatalogPrintPage.razor b/Wonky.Client/Pages/CatalogPrintPage.razor index 93e391c8..3b5e3f14 100644 --- a/Wonky.Client/Pages/CatalogPrintPage.razor +++ b/Wonky.Client/Pages/CatalogPrintPage.razor @@ -21,12 +21,9 @@ @attribute [Authorize(Roles = "Admin,Advisor,Office,Warehouse")] + @if (Working) { - -} -else -{ - + } diff --git a/Wonky.Client/Pages/CrmActivityTodayPage.razor b/Wonky.Client/Pages/CrmActivityTodayPage.razor index f7e2306e..a2c0a44f 100644 --- a/Wonky.Client/Pages/CrmActivityTodayPage.razor +++ b/Wonky.Client/Pages/CrmActivityTodayPage.razor @@ -38,11 +38,11 @@ } -@if (Working) -{ - -} @if (ReportStatusView.ReportItems.Any()) { } +@if (Working) +{ + +} diff --git a/Wonky.Client/Pages/CrmActivityViewPage.razor b/Wonky.Client/Pages/CrmActivityViewPage.razor index ddb5520b..4fb0394e 100644 --- a/Wonky.Client/Pages/CrmActivityViewPage.razor +++ b/Wonky.Client/Pages/CrmActivityViewPage.razor @@ -16,17 +16,13 @@ *@ @using Microsoft.AspNetCore.Authorization -@using System.Security.Claims +@using Wonky.Client.Components @attribute [Authorize(Roles = "Admin,Office,Warehouse,Advisor")] @page "/companies/{CompanyId}/orders/{OrderId}" @* *@ -@if (Working) -{ - -} @@ -157,4 +153,8 @@ else

@ReportItem.OfficeNote

} -} \ No newline at end of file +} +@if (Working) +{ + +} diff --git a/Wonky.Client/Pages/CrmCompanyActivityListPage.razor b/Wonky.Client/Pages/CrmCompanyActivityListPage.razor index 1fa32082..b103eb59 100644 --- a/Wonky.Client/Pages/CrmCompanyActivityListPage.razor +++ b/Wonky.Client/Pages/CrmCompanyActivityListPage.razor @@ -20,10 +20,6 @@ @page "/companies/{CompanyId}/activities" @attribute [Authorize(Roles = "Advisor")] -@if (Working) -{ - -} @if (!string.IsNullOrWhiteSpace(Company.Name)) {
@@ -96,3 +92,7 @@ }
} +@if (Working) +{ + +} diff --git a/Wonky.Client/Pages/CrmCompanyInventoryPage.razor b/Wonky.Client/Pages/CrmCompanyInventoryPage.razor index e18a4a95..92da5b26 100644 --- a/Wonky.Client/Pages/CrmCompanyInventoryPage.razor +++ b/Wonky.Client/Pages/CrmCompanyInventoryPage.razor @@ -19,10 +19,6 @@ @using Microsoft.AspNetCore.Authorization @page "/companies/{CompanyId}/h/i" @attribute [Authorize(Roles = "Advisor")] -@if (Working) -{ - -}

@Company.Name

@@ -35,3 +31,8 @@
+ +@if (Working) +{ + +} diff --git a/Wonky.Client/Pages/CrmCompanyInvoiceListPage.razor b/Wonky.Client/Pages/CrmCompanyInvoiceListPage.razor index 538e4e04..acf3ae97 100644 --- a/Wonky.Client/Pages/CrmCompanyInvoiceListPage.razor +++ b/Wonky.Client/Pages/CrmCompanyInvoiceListPage.razor @@ -1,11 +1,6 @@ @page "/companies/{CompanyId}/invoices" @using Wonky.Client.Components -@if (Working) -{ - -} - @if (!string.IsNullOrWhiteSpace(Company.Name)) {
@@ -21,3 +16,8 @@
} + +@if (Working) +{ + +} diff --git a/Wonky.Client/Pages/CrmCompanyInvoiceListPage.razor.cs b/Wonky.Client/Pages/CrmCompanyInvoiceListPage.razor.cs index dbed8165..50595f05 100644 --- a/Wonky.Client/Pages/CrmCompanyInvoiceListPage.razor.cs +++ b/Wonky.Client/Pages/CrmCompanyInvoiceListPage.razor.cs @@ -28,19 +28,11 @@ public partial class CrmCompanyInvoiceListPage : IDisposable Company = await CompanyRepo.GetCompanyById(CompanyId); - await FetchInvoices(); + History = await HistoryRepo.FetchInvoiceList(CompanyId); + Working = false; } - private async Task FetchInvoices() - { - Working = true; - Toaster.ShowInfo("Arbejder på sagen ...", "Vent venligst"); - History = await HistoryRepo.FetchInvoiceList(CompanyId); - Working = false; - Toaster.ClearAll(); - } - public void Dispose() { Interceptor.DisposeEvent(); diff --git a/Wonky.Client/Pages/CrmCompanyListPage.razor b/Wonky.Client/Pages/CrmCompanyListPage.razor index 491024d4..c9144a45 100644 --- a/Wonky.Client/Pages/CrmCompanyListPage.razor +++ b/Wonky.Client/Pages/CrmCompanyListPage.razor @@ -49,12 +49,11 @@ + + + @if (Working) { } -else -{ - -} diff --git a/Wonky.Client/Pages/CrmCompanyNewPage.razor b/Wonky.Client/Pages/CrmCompanyNewPage.razor index 38d66ffa..fbf7f30c 100644 --- a/Wonky.Client/Pages/CrmCompanyNewPage.razor +++ b/Wonky.Client/Pages/CrmCompanyNewPage.razor @@ -23,10 +23,6 @@

Opret kunde

-@if (Working) -{ - -} @@ -135,4 +131,11 @@ \ No newline at end of file + @ref="VatLookupPopup" OnSelectedCompany="SelectCompanyCallback"/> + +@if (Working) +{ + +} + + \ No newline at end of file diff --git a/Wonky.Client/Pages/CrmCompanyViewPage.razor b/Wonky.Client/Pages/CrmCompanyViewPage.razor index 294080d1..b404cfa7 100644 --- a/Wonky.Client/Pages/CrmCompanyViewPage.razor +++ b/Wonky.Client/Pages/CrmCompanyViewPage.razor @@ -21,10 +21,6 @@ @attribute [Authorize(Roles = "Advisor")] @page "/companies/{CompanyId}" -@if (Working) -{ - -} @if (!string.IsNullOrWhiteSpace(Company.Account)) { @if (!string.IsNullOrWhiteSpace(Company.Blocked)) @@ -236,4 +232,9 @@ \ No newline at end of file + @ref="ContactPopup" OnSaveClicked="WriteContactCallback" OnDeleteClicked="DeleteContactCallback"/> + +@if (Working) +{ + +} diff --git a/Wonky.Client/Pages/CrmCompanyViewPage.razor.cs b/Wonky.Client/Pages/CrmCompanyViewPage.razor.cs index 2a26da24..acb53085 100644 --- a/Wonky.Client/Pages/CrmCompanyViewPage.razor.cs +++ b/Wonky.Client/Pages/CrmCompanyViewPage.razor.cs @@ -13,6 +13,7 @@ // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html] // +using System.Runtime.CompilerServices; using System.Text.Json; using System.Text.RegularExpressions; using Blazored.LocalStorage; @@ -48,10 +49,10 @@ public partial class CrmCompanyViewPage : IDisposable private EditContext ErpContext { get; set; } private DateTime LastVisit { get; set; } private DateTime NextVisit { get; set; } - private VatAddress CompanyVatAddress = new(); + private VatAddress CompanyVatAddress { get; set; } = new(); private string VatState { get; set; } = "the-ugly"; - private bool ValidVat; - private bool HasFolded; + private bool ValidVat { get; set; } + private bool HasFolded { get; set; } private string CurrentVat { get; set; } = ""; private string CountryCode { get; set; } = "dk"; private string VisitState { get; set; } = "the-ugly"; @@ -65,41 +66,48 @@ public partial class CrmCompanyViewPage : IDisposable private ContactDto DefaultContact { get; set; } = new(); private ContactModal ContactPopup { get; set; } = new(); private UserInfoView UserInfo { get; set; } = new(); - + private string Etag { get; set; } = ""; + + private string _getServerData { get; set; } = ""; + [Parameter] + public string RpcDone + { + get => _getServerData; + set + { + if (_getServerData == value) + return; + _getServerData = value; + var x = PrepareCompanyDate().Result; + } + } + + private async Task PrepareCompanyDate() + { + // call background task to fetch contacts + await FetchContacts(CompanyId); + return await HistoryRepo.RpcSyncErpToCrm(Company.CompanyId, Company.HistorySync, Etag); + } protected override async Task OnInitializedAsync() { // fetch user info from local storage UserInfo = await Storage.GetItemAsync("_xu"); CountryCode = UserInfo.CountryCode.ToLower(); CountryIsDk = CountryCode == "dk"; + // setup interceptor Interceptor.RegisterEvent(); Interceptor.RegisterBeforeSendEvent(); - // fetch company from backend - await FetchCompany(CompanyId); - // initialize default contact - DefaultContact = new ContactDto { CompanyId = CompanyId, ContactId = "", FirstName = ""}; - // setup form context - ErpContext = new EditContext(Company); - // assign event handlers to context - ErpContext.OnFieldChanged += HandleFieldChanged; - ErpContext.OnValidationStateChanged += ValidationChanged; - // call background task to sync backend with erp - await SyncCompanyHistory(CompanyId, Company.HistorySync); - // call background task to fetch contacts - await FetchContacts(CompanyId); - // remove loading image - Working = false; - } - /// - /// Get company by id - /// - /// - private async Task FetchCompany(string companyId) - { - Company = await CompanyRepo.GetCompanyById(companyId); + Company = await CompanyRepo.GetCompanyById(CompanyId); + Etag = Company.Etag; + Company.Etag = Guid.NewGuid().ToString(); + + if (!string.IsNullOrWhiteSpace(CompanyId)) + RpcDone = CompanyId; + CurrentVat = Company.VatNumber; + Company.CountryCode = UserInfo.CountryCode.ToLower(); // internal flag EnableActivity = Company.ValidVat; @@ -142,6 +150,16 @@ public partial class CrmCompanyViewPage : IDisposable // create search address from address if (CountryIsDk) CompanyVatAddress = PrepareVatAddress(Company); + + // initialize default contact + DefaultContact = new ContactDto { CompanyId = CompanyId, ContactId = "", FirstName = ""}; + // setup form context + ErpContext = new EditContext(Company); + // assign event handlers to context + ErpContext.OnFieldChanged += HandleFieldChanged; + ErpContext.OnValidationStateChanged += ValidationChanged; + + // remove loading image Working = false; } @@ -151,11 +169,9 @@ public partial class CrmCompanyViewPage : IDisposable /// private async Task FetchContacts(string companyId) { - Working = true; // load contacts Contacts = await ContactRepo.GetContacts(companyId); Contacts = Contacts.OrderBy(x => x.FirstName).ToList(); - Working = false; } /// @@ -296,7 +312,7 @@ public partial class CrmCompanyViewPage : IDisposable /// true/false private async Task UpdateVatNumber() { - // simple format validation if CRM indicates invalid vatNumber + // VAT format validation if (!VatUtils.ValidateFormat(Company.CountryCode, Company.VatNumber)) { Toaster.ShowError($"Moms Nummer ugyldigt"); @@ -348,17 +364,6 @@ public partial class CrmCompanyViewPage : IDisposable return new VatAddress(); } - /// - /// Rpc call to sync backend with ERP system - /// - private async Task SyncCompanyHistory(string companyId, string syncDate) - { - Working = true; - // send rpc request to backend - await HistoryRepo.RpcSyncErpToCrm(companyId, syncDate); - Working = false; - } - /// /// Change activity enabled state /// diff --git a/Wonky.Client/Pages/CrmReportListPage.razor b/Wonky.Client/Pages/CrmReportListPage.razor index 3286a9f5..14e316dd 100644 --- a/Wonky.Client/Pages/CrmReportListPage.razor +++ b/Wonky.Client/Pages/CrmReportListPage.razor @@ -18,13 +18,15 @@ @using Wonky.Client.Components @page "/sales-reports" -@if (Working) -{ - -}

Rapport Arkiv

+ + +@if (Working) +{ + +} diff --git a/Wonky.Client/Pages/CrmReportNewPage.razor b/Wonky.Client/Pages/CrmReportNewPage.razor index 9d557565..c455a629 100644 --- a/Wonky.Client/Pages/CrmReportNewPage.razor +++ b/Wonky.Client/Pages/CrmReportNewPage.razor @@ -20,11 +20,6 @@ @attribute [Authorize(Roles = "Advisor")] @page "/sales-reports/new" -@if (Working) -{ - -} - @* report header *@
@@ -302,4 +297,10 @@
- \ No newline at end of file + + + +@if (Working) +{ + +} diff --git a/Wonky.Client/Pages/CrmReportViewPage.razor b/Wonky.Client/Pages/CrmReportViewPage.razor index 6129c0af..a4926e4a 100644 --- a/Wonky.Client/Pages/CrmReportViewPage.razor +++ b/Wonky.Client/Pages/CrmReportViewPage.razor @@ -20,10 +20,6 @@ @page "/sales-reports/view/{ReportDate}" @attribute [Authorize(Roles = "Advisor,Admin,Supervisor")] -@if (Working) -{ - -}
@@ -70,4 +66,10 @@ { } -} \ No newline at end of file +} + + +@if (Working) +{ + +} diff --git a/Wonky.Client/Pages/CrmTaskItemListPage.razor b/Wonky.Client/Pages/CrmTaskItemListPage.razor index 3e598aa4..69ec18fa 100644 --- a/Wonky.Client/Pages/CrmTaskItemListPage.razor +++ b/Wonky.Client/Pages/CrmTaskItemListPage.razor @@ -20,10 +20,6 @@ @attribute [Authorize(Roles = "Advisor")] @page "/task-items" -@if (Working) -{ - -}
@@ -41,4 +37,10 @@
-
\ No newline at end of file +
+ + +@if (Working) +{ + +} diff --git a/Wonky.Client/Pages/CrmTaskItemViewPage.razor b/Wonky.Client/Pages/CrmTaskItemViewPage.razor index 47b4304a..2f26a641 100644 --- a/Wonky.Client/Pages/CrmTaskItemViewPage.razor +++ b/Wonky.Client/Pages/CrmTaskItemViewPage.razor @@ -16,13 +16,10 @@ *@ @using Microsoft.AspNetCore.Authorization +@using Wonky.Client.Components @attribute [Authorize(Roles = "Advisor")] @page "/tasks/{TaskItemId}" -@if (Working) -{ - -}

Opgave

@@ -104,4 +101,10 @@ -
\ No newline at end of file +
+ + +@if (Working) +{ + +} diff --git a/Wonky.Client/Pages/CrmWorkplaceDocumentListPage.razor b/Wonky.Client/Pages/CrmWorkplaceDocumentListPage.razor index 65fd9c5f..37db7090 100644 --- a/Wonky.Client/Pages/CrmWorkplaceDocumentListPage.razor +++ b/Wonky.Client/Pages/CrmWorkplaceDocumentListPage.razor @@ -21,6 +21,7 @@ @page "/companies/{CompanyId}/workplaces/{WorkplaceId}/documents"

Dokumenter

+ @if (Working) { diff --git a/Wonky.Client/Pages/CrmWorkplaceListPage.razor b/Wonky.Client/Pages/CrmWorkplaceListPage.razor index 6f7b70c4..c31ee858 100644 --- a/Wonky.Client/Pages/CrmWorkplaceListPage.razor +++ b/Wonky.Client/Pages/CrmWorkplaceListPage.razor @@ -25,10 +25,12 @@

@_company.Name

-@if (Working) -{ - -}
-
\ No newline at end of file +
+ + +@if (Working) +{ + +} diff --git a/Wonky.Client/Pages/CrmWorkplaceViewPage.razor b/Wonky.Client/Pages/CrmWorkplaceViewPage.razor index 37610dfe..d95453d3 100644 --- a/Wonky.Client/Pages/CrmWorkplaceViewPage.razor +++ b/Wonky.Client/Pages/CrmWorkplaceViewPage.razor @@ -17,13 +17,10 @@ @using Microsoft.AspNetCore.Authorization +@using Wonky.Client.Components @attribute [Authorize(Roles = "Advisor")] @page "/companies/{CompanyId}/workplaces/{WorkplaceId}" -@if (Working) -{ - -}
@@ -122,4 +119,10 @@
-
\ No newline at end of file + + + +@if (Working) +{ + +} diff --git a/Wonky.Client/Pages/Logout.razor.cs b/Wonky.Client/Pages/Logout.razor.cs index a3ff9894..a855c368 100644 --- a/Wonky.Client/Pages/Logout.razor.cs +++ b/Wonky.Client/Pages/Logout.razor.cs @@ -30,6 +30,6 @@ public partial class Logout { await AuthenticationService.Logout(); - NavigationManager.NavigateTo("/"); + NavigationManager.NavigateTo("/login"); } } \ No newline at end of file diff --git a/Wonky.Client/Pages/OfficeCustomerListPage.razor b/Wonky.Client/Pages/OfficeCustomerListPage.razor index 0b59e722..b84981ef 100644 --- a/Wonky.Client/Pages/OfficeCustomerListPage.razor +++ b/Wonky.Client/Pages/OfficeCustomerListPage.razor @@ -53,8 +53,9 @@ + + @if (Working) { } - \ No newline at end of file diff --git a/Wonky.Client/Pages/OfficeCustomerSalesRepListPage.razor b/Wonky.Client/Pages/OfficeCustomerSalesRepListPage.razor index eea04402..ef18369c 100644 --- a/Wonky.Client/Pages/OfficeCustomerSalesRepListPage.razor +++ b/Wonky.Client/Pages/OfficeCustomerSalesRepListPage.razor @@ -52,8 +52,10 @@ + + + @if (Working) { } - \ No newline at end of file diff --git a/Wonky.Client/Pages/OfficeOrderNewPage.razor b/Wonky.Client/Pages/OfficeOrderNewPage.razor index 7e2f10a4..30036b66 100644 --- a/Wonky.Client/Pages/OfficeOrderNewPage.razor +++ b/Wonky.Client/Pages/OfficeOrderNewPage.razor @@ -20,10 +20,6 @@ @attribute [Authorize(Roles = "Admin,Office,Warehouse")] @page "/office/customers/{CompanyId}/orders/new" -@if (Working) -{ - -}
@@ -188,16 +184,15 @@ + + +@if (Working) +{ + +} diff --git a/Wonky.Client/Pages/OfficeOrderViewPage.razor b/Wonky.Client/Pages/OfficeOrderViewPage.razor index 53e477da..415dc641 100644 --- a/Wonky.Client/Pages/OfficeOrderViewPage.razor +++ b/Wonky.Client/Pages/OfficeOrderViewPage.razor @@ -20,10 +20,6 @@ @attribute [Authorize(Roles = "Admin,Office,Warehouse,Advisor")] @page "/office/customers/{CompanyId}/orders/{OrderId}" -@if (Working) -{ - -} @@ -154,4 +150,10 @@

@_reportItem.OfficeNote

-} \ No newline at end of file +} + + +@if (Working) +{ + +} diff --git a/Wonky.Client/Pages/OfficeReportListPage.razor b/Wonky.Client/Pages/OfficeReportListPage.razor index caa6678c..7caa6c9d 100644 --- a/Wonky.Client/Pages/OfficeReportListPage.razor +++ b/Wonky.Client/Pages/OfficeReportListPage.razor @@ -20,10 +20,6 @@ @attribute [Authorize(Roles = "Admin")] @page "/office/users/advisors/{CountryCode}/{UserId}/reports" -@if (Working) -{ - -}
@@ -36,3 +32,9 @@
+ + +@if (Working) +{ + +} diff --git a/Wonky.Client/Pages/OfficeReportViewPage.razor b/Wonky.Client/Pages/OfficeReportViewPage.razor index e4fd8716..588e745e 100644 --- a/Wonky.Client/Pages/OfficeReportViewPage.razor +++ b/Wonky.Client/Pages/OfficeReportViewPage.razor @@ -20,11 +20,6 @@ @page "/office/users/advisors/{CountryCode}/{UserId}/reports/{ReportDate}" @attribute [Authorize(Roles = "Admin")] -@if (Working) -{ - -} -
@*
*@ @@ -74,4 +69,10 @@ { } -} \ No newline at end of file +} + + +@if (Working) +{ + +} diff --git a/Wonky.Client/Pages/OfficeUserListPage.razor b/Wonky.Client/Pages/OfficeUserListPage.razor index 91744341..2c97f745 100644 --- a/Wonky.Client/Pages/OfficeUserListPage.razor +++ b/Wonky.Client/Pages/OfficeUserListPage.razor @@ -20,10 +20,6 @@ @attribute [Authorize(Roles = "Admin,Office")] @page "/office/users/advisors/{CountryCode}" -@if (Working) -{ - -}

Sælgere

@@ -31,4 +27,10 @@
-
\ No newline at end of file +
+ + +@if (Working) +{ + +} diff --git a/Wonky.Client/Pages/OfficeUserViewPage.razor b/Wonky.Client/Pages/OfficeUserViewPage.razor index b6c510b5..39432332 100644 --- a/Wonky.Client/Pages/OfficeUserViewPage.razor +++ b/Wonky.Client/Pages/OfficeUserViewPage.razor @@ -20,10 +20,6 @@ @using Wonky.Client.Components @attribute [Authorize(Roles = "Admin")] -@if (Working) -{ - -}

Bruger info

@@ -133,4 +129,10 @@ }
-
\ No newline at end of file +
+ + +@if (Working) +{ + +} diff --git a/Wonky.Client/Pages/WarehouseOrderViewPage.razor b/Wonky.Client/Pages/WarehouseOrderViewPage.razor index 7d2c9958..135c3642 100644 --- a/Wonky.Client/Pages/WarehouseOrderViewPage.razor +++ b/Wonky.Client/Pages/WarehouseOrderViewPage.razor @@ -20,10 +20,6 @@ @attribute [Authorize(Roles = "Admin,Warehouse,Office")] @page "/warehouse/orders/process/{OrderId}" -@if (Working) -{ - -} @if (!string.IsNullOrWhiteSpace(_order.OrderDate)) {
@@ -125,3 +121,9 @@ } + + +@if (Working) +{ + +} diff --git a/Wonky.Client/Services/AuthenticationService.cs b/Wonky.Client/Services/AuthenticationService.cs index 6edc770f..4b835a68 100644 --- a/Wonky.Client/Services/AuthenticationService.cs +++ b/Wonky.Client/Services/AuthenticationService.cs @@ -35,9 +35,13 @@ namespace Wonky.Client.Services private readonly IOptions _apiConfig; private readonly ILogger _logger; - public AuthenticationService(HttpClient client, + public AuthenticationService( + HttpClient client, AuthenticationStateProvider authStateProvider, - ILocalStorageService localStorage, IOptions apiConfig, ILogger logger) + ILocalStorageService localStorage, + IOptions apiConfig, + ILogger logger + ) { _client = client; _authStateProvider = authStateProvider; @@ -66,7 +70,7 @@ namespace Wonky.Client.Services IsSuccess = false, ErrorMessage = $"Kontroller indtastning" }; - Console.WriteLine(resContent); + _logger.LogDebug("response {}", resContent); // process response content var data = JsonSerializer.Deserialize(resContent, _options); @@ -117,7 +121,6 @@ namespace Wonky.Client.Services ((AuthStateProvider)_authStateProvider).NotifyUserLogout(); _client.DefaultRequestHeaders.Authorization = null; await _localStorage.RemoveItemsAsync(new List {"_xa", "_xe", "_xr", "_xu"}); - } public async Task UserInfo(bool write = false) diff --git a/Wonky.Client/wwwroot/appsettings.json b/Wonky.Client/wwwroot/appsettings.json index 17138fa7..4af67858 100644 --- a/Wonky.Client/wwwroot/appsettings.json +++ b/Wonky.Client/wwwroot/appsettings.json @@ -1,7 +1,7 @@ { "appInfo": { "name": "Wonky Client", - "version": "0.75.1", + "version": "0.77.1", "rc": true, "sandBox": false, "image": "grumpy-coder.png" diff --git a/Wonky.Entity/DTO/CompanyDto.cs b/Wonky.Entity/DTO/CompanyDto.cs index 5056eb10..6dc855d5 100644 --- a/Wonky.Entity/DTO/CompanyDto.cs +++ b/Wonky.Entity/DTO/CompanyDto.cs @@ -177,7 +177,7 @@ public class CompanyDto public string HistorySync { get; set; } = ""; public int IsDirty { get; set; } = 0; - + public string Etag { get; set; } = ""; /// /// Virtual property indicating if timespan is within the defined interval ///