From 7572127425ac46441a609eacb8277dc098625804 Mon Sep 17 00:00:00 2001 From: Frede Hundewadt Date: Thu, 6 Apr 2023 13:22:02 +0200 Subject: [PATCH] FEAT: KANVAS customer --- .../Pages/AdvisorActivityCreatePage.razor | 58 ++-- .../Pages/AdvisorActivityCreatePage.razor.cs | 275 +++++++++-------- .../Pages/AdvisorCustomerViewEditPage.razor | 279 ++++++++++-------- .../AdvisorCustomerViewEditPage.razor.cs | 97 +++--- .../Pages/OfficeOrderCreatePage.razor.cs | 2 +- Wonky.Client/wwwroot/appsettings.json | 8 +- Wonky.Entity/DTO/ActivityDto.cs | 108 ++++--- 7 files changed, 477 insertions(+), 350 deletions(-) diff --git a/Wonky.Client/Pages/AdvisorActivityCreatePage.razor b/Wonky.Client/Pages/AdvisorActivityCreatePage.razor index 32581e0d..56589c9c 100644 --- a/Wonky.Client/Pages/AdvisorActivityCreatePage.razor +++ b/Wonky.Client/Pages/AdvisorActivityCreatePage.razor @@ -37,7 +37,7 @@ }
-

@Activity.Name - @Activity.Account

+ @Activity.Name (@Activity.Account)
@@ -58,9 +58,16 @@ else
- - - + @if (Kanvas) + { + + } + else + { + + + + }
@@ -68,25 +75,32 @@ else
- - @if (!string.IsNullOrEmpty(Activity.VatNumber) && !string.IsNullOrWhiteSpace(Activity.Address1) && Company.HasFolded == 0) + @if (Kanvas) { - @if (DraftProvider.Draft.DraftType == "order") + + } + else + { + + @if (!string.IsNullOrEmpty(Activity.VatNumber) && !string.IsNullOrWhiteSpace(Activity.Address1) && Company.HasFolded == 0) { - - } - else - { - - } + @if (DraftProvider.Draft.DraftType == "order") + { + + } + else + { + + } - @if (DraftProvider.Draft.DraftType == "offer") - { - - } - else - { - + @if (DraftProvider.Draft.DraftType == "offer") + { + + } + else + { + + } } } @@ -156,6 +170,8 @@ else
+ @if (!Kanvas) + {
@* @@ -348,7 +364,9 @@ else
+ } +
Kundekort diff --git a/Wonky.Client/Pages/AdvisorActivityCreatePage.razor.cs b/Wonky.Client/Pages/AdvisorActivityCreatePage.razor.cs index 741430e3..624a2c3d 100644 --- a/Wonky.Client/Pages/AdvisorActivityCreatePage.razor.cs +++ b/Wonky.Client/Pages/AdvisorActivityCreatePage.razor.cs @@ -96,6 +96,7 @@ public partial class AdvisorActivityCreatePage : IDisposable private List CheckList { get; set; } = new(); private InvoiceListView CompanyInvoices { get; set; } = new(); private List Activities { get; set; } = new(); + private bool Kanvas { get; set; } /// /// Page initialization @@ -114,23 +115,35 @@ public partial class AdvisorActivityCreatePage : IDisposable SalesRep = await UserInfo.GetUserInfo(); // Fetch Customer from http Company = await CompanyRepo.GetCompanyById(CompanyId); - if (Company.HasFolded == 1) - // Company has shut down - Activity.OrderMessage = "BEMÆRK: CVR nummer er ophørt."; - - // variable to validate if customer needs phone number update - OldPhone = Company.Phone; - if (string.IsNullOrWhiteSpace(Company.Phone) - && !string.IsNullOrWhiteSpace(Company.Account) - && Company.Account != "NY" && Company.Account.Length > 7) + if (Company.Account.StartsWith("KANVAS")) { - Company.Phone = Company.Account[..8]; + Kanvas = true; + + Activity.ActivityStatusEnum = "canvas"; + Activity.ActivityTypeEnum = "canvas"; + Activity.ActivityVisitEnum = "new"; + PoFormInvalid = false; } + else + { + if (Company.HasFolded == 1) + // Company has shut down + Activity.OrderMessage = "BEMÆRK: CVR nummer er ophørt."; + // variable to validate if customer needs phone number update + OldPhone = Company.Phone; + if (string.IsNullOrWhiteSpace(Company.Phone) + && !string.IsNullOrWhiteSpace(Company.Account) + && Company.Account != "NY" && Company.Account.Length > 7) + { + Company.Phone = Company.Account[..8]; + } + Activity.ActivityStatusEnum = "noSale"; + Activity.ActivityVisitEnum = Company.Account is "" or "NY" ? "new" : "recall"; + } + // Populate base activity information Activity.BcId = Company.BcId; - Activity.ActivityStatusEnum = "noSale"; - Activity.VisitTypeEnum = Company.Account is "" or "NY" ? "new" : "recall"; Activity.CompanyId = Company.CompanyId; Activity.SalesRepId = SalesRep.UserId; Activity.SalesRep = SalesRep.SalesRep; @@ -164,12 +177,14 @@ public partial class AdvisorActivityCreatePage : IDisposable PromptDateConfirm = $"Aktiviteter oprettes med dato {SelectedDate.ToShortDateString()}. Er dette OK?"; ConfirmWorkDate.Show(); } - + // Lines may already have been added from the company inventory page if (DraftProvider.Draft.DraftType == "order") { // set dropdown selection accordingly - Activity.ActivityTypeEnum = "onSite"; + if(Activity.ActivityTypeEnum != "phone") + Activity.ActivityTypeEnum = "onSite"; + Activity.ActivityStatusEnum = "order"; PoFormInvalid = false; } @@ -177,91 +192,50 @@ public partial class AdvisorActivityCreatePage : IDisposable Working = false; } + + // ############################################################# + // overlays private async Task ShowVisitOverlay() { Logger.LogDebug("ShowInventoryOverlay - wait for visits"); - ActivityListOverlay.Show(); - Activities = await ActivityRepo.GetCustomerActivities(CompanyId); - await Task.Delay(500); } + private async Task ShowInventoryOverlay() { Logger.LogDebug("ShowInventoryOverlay - wait for inventory"); - InventoryListOverlay.Show(); - Inventory = await HistoryRepo.FetchInventory(CompanyId); Inventory = Inventory.OrderBy(x => x.Description).ToList(); await Task.Delay(500); } - private async Task OnInventoryCallback(DraftItem item) - { - Activity.ActivityStatusEnum = "order"; - DraftProvider.Draft.DraftType = "order"; - DraftProvider.Draft.Items.Add(item); - StateHasChanged(); - } private async Task ShowInvoiceOverlay() { Logger.LogDebug("ShowInvoiceOverlay - wait for invoices"); - InvoiceListOverlay.Show(); CompanyInvoices = await FetchCompanyInvoices(); await Task.Delay(500); } - private async Task FetchCompanyInvoices() + + private void ShowPriceListOverlay() { - // fetch from storage - var storage = await Storage.GetItemAsStringAsync($"{CompanyId}-invoices"); - await Task.Delay(500); - var iDate = await Storage.GetItemAsStringAsync($"{CompanyId}-iDate"); - - // if we have a list and iDate was today return the list - if (!string.IsNullOrWhiteSpace(storage) && (!string.IsNullOrWhiteSpace(iDate) && - DateTime.Parse(iDate.Replace("\"", "")) >= DateTime.Now)) - { - Logger.LogDebug("fetching invoices from storage"); - Logger.LogDebug("storage contains <= {}", storage); - return JsonSerializer.Deserialize(storage); - } - - Logger.LogDebug("pulling invoices from backend"); - // pull invoices - var companyInvoices = await HistoryRepo.FetchInvoiceList(CompanyId); - // send invoices to storage - await Storage.SetItemAsync($"{CompanyId}-invoices", companyInvoices); - await Storage.SetItemAsync($"{CompanyId}-iDate", $"{DateTime.Now:yyyy-MM-dd}"); - Logger.LogDebug(" --> return invoices from backend"); - Working = false; - Logger.LogDebug("backend contains <= {}", JsonSerializer.Serialize(companyInvoices)); - return companyInvoices; - } - - private void ShowOrgWarning() - { - if (OrgWarning) - return; - OrgWarning = true; - if (Company.CountryCode.ToLower() == "se" && Utils.StringToDigits(Activity.VatNumber).Length < 10 && - Activity.ActivityStatusEnum == "order") - { - Toaster.ShowWarning("Org nummer er ufuldstændig. Skal opdateres før bestilling kan sendes. ", "ADVARSEL"); - } + CatalogOverlay.Show(); } + private async Task CallConfirmCheckOverlay() { // check if new account if (string.IsNullOrWhiteSpace(Company.Account) || Company.Account.ToLower() == "ny" - || Activity.ActivityStatusEnum.ToLower() == "quote") + || Activity.ActivityStatusEnum.ToLower() == "quote" + || Activity.ActivityStatusEnum.ToLower() == "canvas") { // proceed to create activity - as there is no product check to be done await CreateActivity(); @@ -316,38 +290,16 @@ public partial class AdvisorActivityCreatePage : IDisposable ConfirmationCheckOverlay.Show(); } - private async Task ConfirmProductCheckCallback() - { - ConfirmationCheckOverlay.Hide(); - await CreateActivity(); - foreach (var item in CheckList) - { - item.Check = false; - } - await Storage.SetItemAsync($"{CompanyId}-products", CheckList); - } - - private async Task WorkDateConfirmCallback() - { - await PreferenceService.SetDateConfirmed(true); - Activity.ActivityDate = $"{SelectedDate:yyyy-MM-dd}"; - ConfirmWorkDate.Hide(); - StateHasChanged(); - } - - private async Task WorkDateComponentCallback(string workDate) - { - ReportClosed = await ReportRepo.ReportExist(workDate); - SelectedDate = DateTime.Parse(workDate); - Activity.ActivityDate = workDate; - } - - private void ShowPriceListOverlay() - { - CatalogOverlay.Show(); + private void ShowPriceHistoryOverlay() + { + if (ShowItem) + PriceOverlay.Show(); } + + // ############################################################# + // callbacks private async Task PriceListCallback(SelectedSku sku) { // get selected item @@ -360,12 +312,7 @@ public partial class AdvisorActivityCreatePage : IDisposable StateHasChanged(); } - private void ShowPriceHistoryOverlay() - { - if (ShowItem) - PriceOverlay.Show(); - } - + private void PriceHistoryCallback(decimal price) { if (price == 0) @@ -374,26 +321,99 @@ public partial class AdvisorActivityCreatePage : IDisposable StateHasChanged(); } + + private void OnInventoryCallback(DraftItem item) + { + Activity.ActivityStatusEnum = "order"; + DraftProvider.Draft.DraftType = "order"; + DraftProvider.Draft.Items.Add(item); + StateHasChanged(); + } + + + private async Task ConfirmProductCheckCallback() + { + ConfirmationCheckOverlay.Hide(); + await CreateActivity(); + foreach (var item in CheckList) + { + item.Check = false; + } + + await Storage.SetItemAsync($"{CompanyId}-products", CheckList); + } + + + private async Task WorkDateConfirmCallback() + { + await PreferenceService.SetDateConfirmed(true); + Activity.ActivityDate = $"{SelectedDate:yyyy-MM-dd}"; + ConfirmWorkDate.Hide(); + StateHasChanged(); + } + + + private async Task WorkDateComponentCallback(string workDate) + { + ReportClosed = await ReportRepo.ReportExist(workDate); + SelectedDate = DateTime.Parse(workDate); + Activity.ActivityDate = workDate; + } + + + // ################################################################################################ + // fetch invoices for customer + private async Task FetchCompanyInvoices() + { + // no need to do for kanvas entry + if (Kanvas) return new InvoiceListView(); + // fetch from storage + var storage = await Storage.GetItemAsStringAsync($"{CompanyId}-invoices"); + await Task.Delay(500); + var iDate = await Storage.GetItemAsStringAsync($"{CompanyId}-iDate"); + // if we have a list and iDate was today return the list + if (!string.IsNullOrWhiteSpace(storage) && (!string.IsNullOrWhiteSpace(iDate) && + DateTime.Parse(iDate.Replace("\"", "")) >= DateTime.Now)) + { + Logger.LogDebug("fetching invoices from storage"); + Logger.LogDebug("storage contains <= {}", storage); + return JsonSerializer.Deserialize(storage); + } + Logger.LogDebug("pulling invoices from backend"); + // pull invoices + var companyInvoices = await HistoryRepo.FetchInvoiceList(CompanyId); + // send invoices to storage + await Storage.SetItemAsync($"{CompanyId}-invoices", companyInvoices); + await Storage.SetItemAsync($"{CompanyId}-iDate", $"{DateTime.Now:yyyy-MM-dd}"); + Logger.LogDebug(" --> return invoices from backend"); + Working = false; + Logger.LogDebug("backend contains <= {}", JsonSerializer.Serialize(companyInvoices)); + return companyInvoices; + } + + + // ################################################################################################## + // create activity private async Task CreateActivity() { // avoid duplication if (Working) return; - // validate customer address1 - // - this is a required input - if (string.IsNullOrWhiteSpace(Activity.Address1)) + + Logger.LogDebug("view kanvas activity => {}", JsonSerializer.Serialize(Activity)); + switch (Kanvas) { - Toaster.ShowError("Kunde adresse er ufuldstændig."); - return; - } - - // validate org number - // - this is a required input - // - must validate according to country rules. - if (!VatUtils.ValidateFormat(Company.CountryCode, Activity.VatNumber)) - { - Toaster.ShowError("Firma registreringsnummer er ikke korrekt."); - return; + // validate customer address1 + // - this is a required input + case false when string.IsNullOrWhiteSpace(Activity.Address1): + Toaster.ShowError("Kunde adresse er ufuldstændig."); + return; + // validate org number + // - this is a required input + // - must validate according to country rules. + case false when !VatUtils.ValidateFormat(Company.CountryCode, Activity.VatNumber): + Toaster.ShowError("Firma registreringsnummer er ikke korrekt."); + return; } // validate input according to status @@ -419,7 +439,7 @@ public partial class AdvisorActivityCreatePage : IDisposable // reset selected item SelectedItem = new SalesItemView(); // check if phone number need to be updated - if (OldPhone != Activity.Phone) + if (!Kanvas && OldPhone != Activity.Phone) { Company.Phone = Activity.Phone; Activity.OrderMessage = $"BEMÆRK: {Activity.Phone}\n{Activity.OrderMessage}"; @@ -482,12 +502,29 @@ public partial class AdvisorActivityCreatePage : IDisposable Toaster.ShowError(result.Message, "ORDRE FEJL"); } + + private void ShowOrgWarning() + { + if (Kanvas) return; + if (OrgWarning) return; + OrgWarning = true; + if (Company.CountryCode.ToLower() == "se" && Utils.StringToDigits(Activity.VatNumber).Length < 10 && + Activity.ActivityStatusEnum == "order") + { + Toaster.ShowWarning("Org nummer er ufuldstændig. Skal opdateres før bestilling kan sendes. ", "ADVARSEL"); + } + } + + + // ############################################################################### + // draft functions private async Task DeleteDraft() { await DraftProvider.DeleteDraftAsync(); Activity.ActivityStatusEnum = "noSale"; } + private async Task AddItem(SalesItemView salesItem) { ShowItem = false; @@ -513,6 +550,7 @@ public partial class AdvisorActivityCreatePage : IDisposable await DraftProvider.SaveChangesAsync(); } + private async Task RemoveItem(DraftItem item) { // remove item @@ -523,6 +561,9 @@ public partial class AdvisorActivityCreatePage : IDisposable Activity.ActivityStatusEnum = "noSale"; } + + // ################################################################################################## + // form validation private void HandleFieldChanged(object sender, FieldChangedEventArgs e) { Logger.LogDebug("ActivityNewPage => HandleFieldChanged => ActivityStatusEnum <= '{}'", @@ -556,6 +597,7 @@ public partial class AdvisorActivityCreatePage : IDisposable StateHasChanged(); } + private void ValidationChanged(object sender, ValidationStateChangedEventArgs e) { if (string.IsNullOrEmpty(Activity.ActivityTypeEnum) && !ReportClosed) @@ -582,6 +624,9 @@ public partial class AdvisorActivityCreatePage : IDisposable ActivityContext.OnValidationStateChanged += ValidationChanged; } + + // ######################################################################################################### + // dispose public void Dispose() { Interceptor.DisposeEvent(); diff --git a/Wonky.Client/Pages/AdvisorCustomerViewEditPage.razor b/Wonky.Client/Pages/AdvisorCustomerViewEditPage.razor index d786c8b4..7246519f 100644 --- a/Wonky.Client/Pages/AdvisorCustomerViewEditPage.razor +++ b/Wonky.Client/Pages/AdvisorCustomerViewEditPage.razor @@ -29,7 +29,9 @@
}
-

@Company.Name @(string.IsNullOrWhiteSpace(Company.Account) ? "" : "- ")@Company.Account

+
+ @Company.Name (@Company.Account) +
// erp context @@ -89,65 +91,81 @@
-
@* ---- placeholder --- *@
- @* Force enable visit *@ -
- -
+ + @if (!Kanvas) + { +
@* ---- placeholder --- *@
+ @* Enable edit/save *@ -
- -
-
- -
- @* vat number*@ - -
-
- - - - - +
+ +
+ @* Force enable visit *@ +
+ +
+ @* Save erp data *@ +
+ +
+ @* vat number*@ + +
+
+ + + + + +
+
+ @* Enable edit/save vatnumber *@ +
+
-
@* vat lookup *@ -
- @switch (CountryCode) - { - case "dk": - - break; - case "no": - brreg.no - break; - case "se": - allabolag.se - break; - } -
- @* Enable edit/save *@ -
- -
+
+ @switch (CountryCode) + { + case "dk": + + break; + case "no": + brreg.no + break; + case "se": + allabolag.se + break; + } +
@* save vat number *@ -
- -
+
+ +
+ } +

@* activity buttons *@
- Faktura + @if (!Kanvas) + { + Faktura + }
- Tidl. Besøg + @if (!Kanvas) + { + Tidl. Besøg + }
- Produkter + @if (!Kanvas) + { + Produkter + }
-
+ @if (!Kanvas) + { +
@* crm context - OBS note *@ -
- -
- @if (string.IsNullOrWhiteSpace(Company.Note)) - { - - } - else - { - - } - -
- @* Save CRM data button *@ -
- -
-
- @* crm context - contacts *@ -
- -
-
-
-
-
Stilling
-
Navn
-
Direkte
-
- -
-
-
- @if (Contacts.Any()) +
+ +
+ @if (string.IsNullOrWhiteSpace(Company.Note)) { - @foreach (var contact in Contacts) - { -
-
-
@contact.JobTitle
-
@contact.FirstName @contact.LastName
-
- @contact.PhoneDirect -
-
- -
+ + } + else + { + + } + +
+ @* Save CRM data button *@ +
+ +
+
+ @* crm context - contacts *@ +
+ +
+
+
+
+
Stilling
+
Navn
+
Direkte
+
+
+
+ @if (Contacts.Any()) + { + @foreach (var contact in Contacts) + { +
+
+
@contact.JobTitle
+
@contact.FirstName @contact.LastName
+
+ @contact.PhoneDirect +
+
+ +
+
+
+ } } - } +
-
@* crm context - dates and interval *@ -
- -
-
- - - - +
+ +
+
+ + + + +
+
+ +
+ +
+ +
+ +
- -
- +
+ +
+ +
- -
- - +
+
+ +
-
-
- -
- + @* + -
-
-
- -
-
+ *@ + } - - -
- -
- - } @if (Working) diff --git a/Wonky.Client/Pages/AdvisorCustomerViewEditPage.razor.cs b/Wonky.Client/Pages/AdvisorCustomerViewEditPage.razor.cs index 99a1a30a..3c9fb10e 100644 --- a/Wonky.Client/Pages/AdvisorCustomerViewEditPage.razor.cs +++ b/Wonky.Client/Pages/AdvisorCustomerViewEditPage.razor.cs @@ -71,6 +71,7 @@ public partial class AdvisorCustomerViewEditPage : IDisposable private ContactModal ContactPopup { get; set; } = new(); private UserManagerEditView UserInfo { get; set; } = new(); private string ToggleButtonText { get; set; } = ""; + private bool Kanvas { get; set; } protected override async Task OnInitializedAsync() { @@ -96,60 +97,67 @@ public partial class AdvisorCustomerViewEditPage : IDisposable Company = await CustomerRepo.GetCompanyById(CompanyId); - 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(); + if (Company.Account.StartsWith("KANVAS")) + Kanvas = true; + // internal flag EnableActivity = Company.ValidVat; // override if canvas which has account property as empty string or "NY" - if (Company.Account == "NY" || string.IsNullOrWhiteSpace(Company.Account)) + if (Company.Account == "NY" || Company.Account.StartsWith("KANVAS") || string.IsNullOrWhiteSpace(Company.Account)) EnableActivity = 1; - // visit interval init - if (Company.Interval == 0) - Company.Interval = 8; - // visit date init - LastVisit = DateTime.Parse(Company.LastVisit); - NextVisit = DateTime.Parse(Company.NextVisit); - // if no previous visit is registered - force last visit date to 2020 - if (LastVisit.Year < 2020) - LastVisit = DateTime.Parse("2020-01-01"); - // set next visit according to last visit and interval - if (!Company.ValidDateSpan()) - NextVisit = LastVisit.AddDays(Company.Interval * 7); - // display urgency of next visit - VisitState = Utils.GetVisitState($"{NextVisit:yyyy-MM-dd}"); // action link passed to activity button component ActionLink = $"/advisor/customers/{CompanyId}/activities/new"; // used when drawing visit button - // handle company out of business case - if (Company.HasFolded == 1) + // only execute if the company a 'real' customer + if (!Kanvas) { - // this is only used if user has selected to show closed companies - HasFolded = true; - VatState = "the-dead"; - VisitState = "the-dead"; + 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); + // if no previous visit is registered - force last visit date to 2020 + if (LastVisit.Year < 2020) + LastVisit = DateTime.Parse("2020-01-01"); + // set next visit according to last visit and interval + if (!Company.ValidDateSpan()) + NextVisit = LastVisit.AddDays(Company.Interval * 7); + // display urgency of next visit + VisitState = Utils.GetVisitState($"{NextVisit:yyyy-MM-dd}"); + // handle company out of business case + if (Company.HasFolded == 1) + { + // this is only used if user has selected to show closed companies + HasFolded = true; + VatState = "the-dead"; + VisitState = "the-dead"; + } + else + { + // valid vat enum + Company.ValidVat = VatUtils.ValidateFormat(Company.CountryCode, Company.VatNumber) ? 1 : 0; + // valid vat flag + ValidVat = Company.ValidVat == 1; // true/false flag set if company has a valid vatNumber + // vat state css class + VatState = Company.ValidVat == 1 ? "the-good" : "no-vat"; // assign css class + } + + // create search address from address + if (CountryIsDk) + CompanyVatAddress = PrepareVatAddress(Company); + + await FetchContacts(CompanyId); + await Task.Delay(100); + await RequestErpUpdate(); } - else - { - // valid vat enum - Company.ValidVat = VatUtils.ValidateFormat(Company.CountryCode, Company.VatNumber) ? 1 : 0; - // valid vat flag - ValidVat = Company.ValidVat == 1; // true/false flag set if company has a valid vatNumber - // vat state css class - VatState = Company.ValidVat == 1 ? "the-good" : "no-vat"; // assign css class - } - - // create search address from address - if (CountryIsDk) - CompanyVatAddress = PrepareVatAddress(Company); - - await FetchContacts(CompanyId); - + // remove loading image Working = false; - await Task.Delay(100); - await RequestErpUpdate(); } private void ToggleErpEdit() @@ -414,6 +422,7 @@ public partial class AdvisorCustomerViewEditPage : IDisposable /// private void HandleFieldChanged(object? sender, FieldChangedEventArgs? e) { + NextVisit = LastVisit.AddDays(Company.Interval * 7); // avoid nesting if by assuming ValidVat is false ValidVat = false; diff --git a/Wonky.Client/Pages/OfficeOrderCreatePage.razor.cs b/Wonky.Client/Pages/OfficeOrderCreatePage.razor.cs index c4c9f5b1..4b3207c7 100644 --- a/Wonky.Client/Pages/OfficeOrderCreatePage.razor.cs +++ b/Wonky.Client/Pages/OfficeOrderCreatePage.razor.cs @@ -153,7 +153,7 @@ public partial class OfficeOrderCreatePage : IDisposable // setting up activity properties Activity.ActivityStatusEnum = "noSale"; - Activity.VisitTypeEnum = "recall"; + Activity.ActivityVisitEnum = "recall"; Activity.ActivityTypeEnum = "phone"; Activity.ActivityStatusEnum = "order"; Activity.OurRef = $"T:{UserInfo.FirstName}"; diff --git a/Wonky.Client/wwwroot/appsettings.json b/Wonky.Client/wwwroot/appsettings.json index 8642f165..b4cdc992 100644 --- a/Wonky.Client/wwwroot/appsettings.json +++ b/Wonky.Client/wwwroot/appsettings.json @@ -1,15 +1,15 @@ { "appInfo": { "name": "Wonky Online", - "version": "0.131.0", + "version": "0.132.1", "rc": true, "sandBox": false, "image": "grumpy-coder.png" }, "Logging": { "LogLevel": { - "Default": "Debug", - "System": "Debug", + "Default": "Information", + "System": "Information", "Microsoft": "Information" }, "Debug": { @@ -19,7 +19,7 @@ } }, "apiConfig": { - "baseUrl": "https://dev.innotec.dk", + "baseUrl": "https://zeta.innotec.dk", "catalog": "api/v2/catalog/country", "crmCustomers": "api/v2/crm/companies", "crmInventoryExt": "history/inventory", diff --git a/Wonky.Entity/DTO/ActivityDto.cs b/Wonky.Entity/DTO/ActivityDto.cs index 3c938a19..f8a18ec6 100644 --- a/Wonky.Entity/DTO/ActivityDto.cs +++ b/Wonky.Entity/DTO/ActivityDto.cs @@ -24,164 +24,200 @@ public class ActivityDto /// Activity entity id /// public string SalesHeadId { get; set; } = ""; - + /// /// Sales representative identification /// - [Required] public string SalesRep { get; set; } = ""; + [Required] + public string SalesRep { get; set; } = ""; + /// /// Sales representative entity Id /// - [Required] 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; } = ""; + [Required] + public string CountryCode { get; set; } = ""; + /// /// Company entity Id /// - [Required] public string CompanyId { get; set; } = ""; + [Required] + public string CompanyId { get; set; } = ""; + /// /// Business Central entity Id /// public string BcId { get; set; } = ""; + /// /// Customer account /// public string Account { get; set; } = ""; + /// /// VAT number /// - [MaxLength(20, ErrorMessage = "Du kan højst bruge 20 tegn")] + [MaxLength(20, ErrorMessage = "Du kan højst bruge 20 tegn")] public string VatNumber { get; set; } = ""; + /// /// Customer name /// [Required(ErrorMessage = "Navn skal udfyldes")] - [MaxLength(100, ErrorMessage = "Du kan højst bruge 100 tegn")] + [MaxLength(100, ErrorMessage = "Du kan højst bruge 100 tegn")] public string Name { get; set; } = ""; + /// /// Customer address city name /// [Required(ErrorMessage = "Byanvn skal udfyldes")] - [MaxLength(30, ErrorMessage = "Du kan højst bruge 30 tegn")] - public string City { get; set; }= ""; + [MaxLength(30, ErrorMessage = "Du kan højst bruge 30 tegn")] + public string City { get; set; } = ""; + /// /// Customer address postal code /// [Required(ErrorMessage = "Postnr. skal udfyldes")] - [MaxLength(20, ErrorMessage = "Du kan højst bruge 20 tegn")] + [MaxLength(20, ErrorMessage = "Du kan højst bruge 20 tegn")] public string ZipCode { get; set; } = ""; + /// /// Customer address line 1 /// - [MaxLength(100, ErrorMessage = "Du kan højst bruge 100 tegn")] + [MaxLength(100, ErrorMessage = "Du kan højst bruge 100 tegn")] public string Address1 { get; set; } = ""; + /// /// Customer address line 2 /// - [MaxLength(50, ErrorMessage = "Du kan højst bruge 50 tegn")] + [MaxLength(50, ErrorMessage = "Du kan højst bruge 50 tegn")] public string Address2 { get; set; } = ""; + /// /// Customer office phone /// - [MaxLength(20, ErrorMessage = "Du kan højst bruge 20 tegn")] + [MaxLength(20, ErrorMessage = "Du kan højst bruge 20 tegn")] public string Phone { get; set; } = ""; + /// /// Customer mobile phone /// - [MaxLength(20, ErrorMessage = "Du kan højst bruge 20 tegn")] + [MaxLength(20, ErrorMessage = "Du kan højst bruge 20 tegn")] public string Mobile { get; set; } = ""; + /// /// Customer office email /// - [MaxLength(80, ErrorMessage = "Du kan højst bruge 80 tegn")] + [MaxLength(80, ErrorMessage = "Du kan højst bruge 80 tegn")] public string Email { get; set; } = ""; + /// /// Customer attention description /// - [MaxLength(100, ErrorMessage = "Du kan højst bruge 100 tegn")] + [MaxLength(100, ErrorMessage = "Du kan højst bruge 100 tegn")] public string Attention { get; set; } = ""; - // Form entries - /// - /// Activity type enum as string - /// - [Required(ErrorMessage = "Vælg aktivitetstype")] - public string ActivityTypeEnum { get; set; } = ""; + /// /// Flag express order /// public bool Express { get; set; } + + // Form entries /// /// Activity status enum as string /// - [Required(ErrorMessage = "Vælg status for besøg ")] + [Required(ErrorMessage = "Vælg status for besøg ")] public string ActivityStatusEnum { get; set; } = ""; + + /// + /// Activity type enum as string + /// + [Required(ErrorMessage = "Vælg aktivitetstype")] + public string ActivityTypeEnum { get; set; } = ""; + /// /// Visit type enum as string /// - public string VisitTypeEnum { get; set; } = "recall"; + public string ActivityVisitEnum { get; set; } = "recall"; + /// /// Activity date /// - [Required(ErrorMessage = "Dato skal angives")] + [Required(ErrorMessage = "Dato skal angives")] public string ActivityDate { get; set; } = ""; + /// /// Product demonstration /// - [MaxLength(50, ErrorMessage = "Du kan højst bruge 50 tegn")] + [MaxLength(50, ErrorMessage = "Du kan højst bruge 50 tegn")] public string Demo { get; set; } = ""; + /// /// Our reference - system generated /// - [MaxLength(20, ErrorMessage = "Du kan højst bruge 20 tegn")] + [MaxLength(20, ErrorMessage = "Du kan højst bruge 20 tegn")] public string OurRef { get; set; } = ""; + /// /// Customer reference number /// - [MaxLength(20, ErrorMessage = "Du kan højst bruge 20 tegn")] + [MaxLength(20, ErrorMessage = "Du kan højst bruge 20 tegn")] public string ReferenceNumber { get; set; } = ""; + /// /// Customer reference description /// - [MaxLength(35, ErrorMessage = "Du kan højst bruge 35 tegn")] + [MaxLength(35, ErrorMessage = "Du kan højst bruge 35 tegn")] public string YourRef { get; set; } = ""; + /// /// Processing note to office /// - [MaxLength(255, ErrorMessage = "Du kan højst bruge 255 tegn")] + [MaxLength(255, ErrorMessage = "Du kan højst bruge 255 tegn")] public string OrderMessage { get; set; } = ""; + /// /// CRM note for future reference /// - [MaxLength(255, ErrorMessage = "Du kan højst bruge 255 tegn")] + [MaxLength(255, ErrorMessage = "Du kan højst bruge 255 tegn")] public string CrmNote { get; set; } = ""; + // Delivery address form entries /// /// Customer delivery name /// - [MaxLength(100, ErrorMessage = "Du kan højst bruge 100 tegn")] + [MaxLength(100, ErrorMessage = "Du kan højst bruge 100 tegn")] public string DlvName { get; set; } = ""; + /// /// Customer delivery address line 1 /// - [MaxLength(100, ErrorMessage = "Du kan højst bruge 100 tegn")] + [MaxLength(100, ErrorMessage = "Du kan højst bruge 100 tegn")] public string DlvAddress1 { get; set; } = ""; + /// /// Customer delivery address line 2 /// - [MaxLength(50, ErrorMessage = "Du kan højst bruge 50 tegn")] + [MaxLength(50, ErrorMessage = "Du kan højst bruge 50 tegn")] public string DlvAddress2 { get; set; } = ""; + /// /// Customer delivery postal code /// - [MaxLength(20, ErrorMessage = "Du kan højst bruge 20 tegn")] + [MaxLength(20, ErrorMessage = "Du kan højst bruge 20 tegn")] public string DlvZipCode { get; set; } = ""; + /// /// Customer delivery city name /// - [MaxLength(30, ErrorMessage = "Du kan højst bruge 30 tegn")] + [MaxLength(30, ErrorMessage = "Du kan højst bruge 30 tegn")] public string DlvCity { get; set; } = ""; + // Lines /// /// Order lines