diff --git a/Wonky.Client/HttpRepository/AdvisorCustomerHistoryRepository.cs b/Wonky.Client/HttpRepository/AdvisorCustomerHistoryRepository.cs index 367b8130..84f2c6ae 100644 --- a/Wonky.Client/HttpRepository/AdvisorCustomerHistoryRepository.cs +++ b/Wonky.Client/HttpRepository/AdvisorCustomerHistoryRepository.cs @@ -60,7 +60,7 @@ public class AdvisorCustomerHistoryRepository : IAdvisorCustomerHistoryRepositor public async Task GetInvoiceListHeader(string companyId) { - var response = await _client.GetAsync($"{_api.CrmCustomers}/{companyId}/invoices/head"); + var response = await _client.GetAsync($"{_api.CrmCustomers}/{companyId}/invoices"); var content = await response.Content.ReadAsStringAsync(); if (!response.IsSuccessStatusCode || string.IsNullOrWhiteSpace(content)) { diff --git a/Wonky.Client/Pages/AdvisorActivityCreatePage.razor b/Wonky.Client/Pages/AdvisorActivityCreatePage.razor index ad1c7198..e118212c 100644 --- a/Wonky.Client/Pages/AdvisorActivityCreatePage.razor +++ b/Wonky.Client/Pages/AdvisorActivityCreatePage.razor @@ -26,7 +26,12 @@ - +@if (_invalidDate) +{ +
+

Arbejdsdato er ændret til '@($"{SelectedDate:D}")'

+
+} @if (ReportClosed) {
diff --git a/Wonky.Client/Pages/AdvisorActivityCreatePage.razor.cs b/Wonky.Client/Pages/AdvisorActivityCreatePage.razor.cs index 961d17e6..83678349 100644 --- a/Wonky.Client/Pages/AdvisorActivityCreatePage.razor.cs +++ b/Wonky.Client/Pages/AdvisorActivityCreatePage.razor.cs @@ -94,7 +94,7 @@ public partial class AdvisorActivityCreatePage : IDisposable private UserManagerEditView _salesRep = new(); private bool _formInvalid = true; private bool _disableButtons = true; - private bool _invalidDate = false; + private bool _invalidDate; protected override async Task OnInitializedAsync() { @@ -168,27 +168,27 @@ public partial class AdvisorActivityCreatePage : IDisposable SelectedDate = string.IsNullOrWhiteSpace(_userPref.WorkDate) ? DateTime.Now : DateTime.Parse(_userPref.WorkDate); - // 2023-11-08 - reject dates more than a week old + // 2023-11-08 - reject dates going back more than a week if (SelectedDate < DateTime.Now.AddDays(-7)) { - Toaster.ShowError($"Aktivitetsdato ligger for lang tilbage. Dato ændres til {DateTime.Now.Date}"); + _invalidDate = true; + Toaster.ShowError($"Aktivitetsdato kan ikke anvendes. Dato ændres til {DateTime.Now.Date}"); SelectedDate = DateTime.Now; await PreferenceService.SetWorkDate(SelectedDate); } // 2023-08-14 - reject orders for future dates if (SelectedDate.Date > DateTime.Now.Date) { - Toaster.ShowError($"Aktivitetsdato er fremtidig. Dato ændres til {DateTime.Now.Date}"); + _invalidDate = true; + Toaster.ShowWarning($"Aktivitetsdato er fremtidig. Dato ændres til {DateTime.Now.Date}"); SelectedDate = DateTime.Now; await PreferenceService.SetWorkDate(SelectedDate); } - // raise flag if report is closed - // the flag cause a message instead of order entry + ReportClosed = await ReportRepo.ReportExist($"{SelectedDate:yyyy-MM-dd}"); - // Lines may already have been added from the company inventory page + if (DraftProvider.Draft.DraftType == "order") { - // set dropdown selection accordingly if (_activity.ActivityTypeEnum != "phone") { _activity.ActivityTypeEnum = "onSite"; @@ -201,7 +201,7 @@ public partial class AdvisorActivityCreatePage : IDisposable await TestOrgNumber(); } Working = false; - // Ask for confirmation of date + Logger.LogDebug("Preferences.DateConfirmed => {}", _userPref.DateConfirmed); if (!_userPref.DateConfirmed) { diff --git a/Wonky.Client/Pages/AdvisorCustomerViewEditPage.razor.cs b/Wonky.Client/Pages/AdvisorCustomerViewEditPage.razor.cs index 55245cdb..444bb1df 100644 --- a/Wonky.Client/Pages/AdvisorCustomerViewEditPage.razor.cs +++ b/Wonky.Client/Pages/AdvisorCustomerViewEditPage.razor.cs @@ -99,9 +99,6 @@ public partial class AdvisorCustomerViewEditPage : IDisposable protected override async Task OnInitializedAsync() { - /* - * setup interceptor - */ Interceptor.RegisterEvent(); Interceptor.RegisterBeforeSendEvent(); /* @@ -153,28 +150,15 @@ public partial class AdvisorCustomerViewEditPage : IDisposable { _enableActivity = 1; } - - /* - * only execute if the InfoDrawer.Company is not KANVAS - */ - Logger.LogDebug("_company => {}", JsonSerializer.Serialize(_company)); /* * toggle view button text */ _toggleButtonText = _company.IsHidden == 0 ? "Udelad kunde i oversigt" : "Brug Normal Visning"; - // _currentVat = _company.VatNumber; _company.CountryCode = _userInfo.CountryCode.ToLower(); - /* - * visit interval init - */ if (_company.Interval == 0) { _company.Interval = 8; } - - /* - * visit date init - */ _lastVisit = DateTime.Parse(_company.LastVisit); _nextVisit = DateTime.Parse(_company.NextVisit); /* @@ -183,16 +167,14 @@ public partial class AdvisorCustomerViewEditPage : IDisposable if (_lastVisit.Year < 2020) { _lastVisit = DateTime.Parse("2020-01-01"); + _nextVisit = DateTime.Now; } - - /* - * set next visit according to last visit and interval - */ - if (!_company.ValidDateSpan()) - { - _nextVisit = _lastVisit.AddDays(_company.Interval * 7); - } - + // 2023-11-20 - remove - possibly creates an invalid _nextVisit + // enable if invalid _nextVisit continue + // if (!_company.ValidDateSpan()) + // { + // _nextVisit = _lastVisit.AddDays(_company.Interval * 7); + // } /* * display urgency of next visit */ diff --git a/Wonky.Client/Wonky.Client.csproj b/Wonky.Client/Wonky.Client.csproj index 5edc6d0e..ce46834f 100644 --- a/Wonky.Client/Wonky.Client.csproj +++ b/Wonky.Client/Wonky.Client.csproj @@ -9,16 +9,16 @@ - + - - - - - - - - + + + + + + + + diff --git a/Wonky.Entity/Views/WorkplaceProductVariantDoc.cs b/Wonky.Entity/Views/WorkplaceProductVariantDoc.cs index 12c4758c..498632a2 100644 --- a/Wonky.Entity/Views/WorkplaceProductVariantDoc.cs +++ b/Wonky.Entity/Views/WorkplaceProductVariantDoc.cs @@ -2,11 +2,12 @@ namespace Wonky.Entity.Views; public class WorkplaceProductVariantDoc { - public string DocumentId { get; set; } = ""; - public string DocumentTypeEnum { get; set; } = ""; + public string ApprovedBy { get; set; } = ""; public string DocumentDescription { get; set; } = ""; public string DocumentDate { get; set; } = ""; + public string DocumentId { get; set; } = ""; public string DocumentLink { get; set; } = ""; + public string DocumentTypeEnum { get; set; } = ""; public string S5A { get; set; } = ""; public string S9A { get; set; } = ""; } \ No newline at end of file