FEAT: Adding ESalesNumber on activity list. Formatted timestamp on visit

This commit is contained in:
Frede Hundewadt 2023-05-31 07:26:46 +02:00
parent 4d7d7faa01
commit f2f3458373
7 changed files with 24 additions and 14 deletions

View file

@ -31,6 +31,7 @@
<th class="text-center" scope="col"><i class="bi-lightning"></i></th> <th class="text-center" scope="col"><i class="bi-lightning"></i></th>
<th class="text-center" scope="col"><i class="bi-calculator"></i></th> <th class="text-center" scope="col"><i class="bi-calculator"></i></th>
<th class="text-center" scope="col"><i class="bi-truck"></i></th> <th class="text-center" scope="col"><i class="bi-truck"></i></th>
<th scope="col">E Nr.</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -43,7 +44,7 @@
<td class="align-middle">@activity.Sales</td> <td class="align-middle">@activity.Sales</td>
<td class="align-middle">@activity.OfficeNote</td> <td class="align-middle">@activity.OfficeNote</td>
<td class="align-middle text-end">@($"{activity.SasAmount:N2}")</td> <td class="align-middle text-end">@($"{activity.SasAmount:N2}")</td>
<td class="align-middle text-end">@(activity.StatusTypeEnum == "Quote" ? $"{0:N2}" : $"{activity.OrderAmount:N2}")</td> <td class="align-middle text-end">@(activity.StatusTypeEnum == "Quote" ? "{0:N2}" : $"{activity.OrderAmount:N2}")</td>
<td class="align-middle text-center"> <td class="align-middle text-center">
@if (activity.OurRef.Contains("T:")) @if (activity.OurRef.Contains("T:"))
{<i style="font-size:1.3em;" class="bi-phone"></i>} {<i style="font-size:1.3em;" class="bi-phone"></i>}
@ -62,6 +63,7 @@
<ProcessStateComponent StateClass="@Utils.GetProcessStatus(activity.ProcessStatusEnum)"/> <ProcessStateComponent StateClass="@Utils.GetProcessStatus(activity.ProcessStatusEnum)"/>
} }
</td> </td>
<td class="align-middle font-monospace text-sm-start">@activity.ESalesNumber</td>
</tr> </tr>
} }
<tr> <tr>

View file

@ -28,7 +28,7 @@
<div class="row g-3"> <div class="row g-3">
<label for="date" class="col-form-label-sm col-sm-1">Dato</label> <label for="date" class="col-form-label-sm col-sm-1">Dato</label>
<div class="col-sm-3"> <div class="col-sm-3">
<input id="date" class="form-control" type="text" value="@ReportItem.CreateTimestamp" readonly/> <input id="date" class="form-control" type="text" value="@($"{DateTime.Parse(ReportItem.CreateTimestamp):yyyy-MM-dd hh:mm:ss}")" readonly/>
</div> </div>
<label for="account" class="col-form-label-sm col-sm-1">Konto</label> <label for="account" class="col-form-label-sm col-sm-1">Konto</label>

View file

@ -259,7 +259,7 @@ public partial class AdvisorActivityCreatePage : IDisposable
await CreateActivity(); await CreateActivity();
return; return;
} }
// check if product has been checked // check if product has been checked
// fetch products from storage // fetch products from storage
var pStorage = await Storage.GetItemAsStringAsync($"{CompanyId}-products"); var pStorage = await Storage.GetItemAsStringAsync($"{CompanyId}-products");
@ -267,7 +267,9 @@ public partial class AdvisorActivityCreatePage : IDisposable
// fetch pDate from storage // fetch pDate from storage
var pDate = await Storage.GetItemAsync<string>($"{CompanyId}-pDate"); var pDate = await Storage.GetItemAsync<string>($"{CompanyId}-pDate");
if (string.IsNullOrWhiteSpace(pDate)) if (string.IsNullOrWhiteSpace(pDate))
{
pDate = $"{DateTime.Now.AddDays(-1):yyyy-MM-dd}"; pDate = $"{DateTime.Now.AddDays(-1):yyyy-MM-dd}";
}
Logger.LogDebug("pDate => {}", pDate); Logger.LogDebug("pDate => {}", pDate);
// check if product data is valid and updated today // check if product data is valid and updated today
@ -275,14 +277,13 @@ public partial class AdvisorActivityCreatePage : IDisposable
{ {
Working = true; Working = true;
// pop a message // pop a message
Toaster.ShowError( Toaster.ShowInfo(
"Produkt gennemgang mangler. Vent mens produkt oversigt indlæses. Gå ikke væk fra siden!"); "Produkt gennemgang mangler. Vent mens produkt oversigt indlæses. Gå ikke væk fra siden!");
// product inventory has not been updated // product inventory has not been updated
// send rpc call to sync ERP to CRM // request backend to sync ERP to CRM
Toaster.ShowInfo("Vent mens data synkroniseres ..."); Toaster.ShowInfo("Vent mens data synkroniseres ...");
var ts = await HistoryRepo.InvoiceErpToCrmRpc(CompanyId, Company.HistorySync); var ts = await HistoryRepo.InvoiceErpToCrmRpc(CompanyId, Company.HistorySync);
while (string.IsNullOrWhiteSpace(ts)) await Task.Delay(250);
await Task.Delay(250);
// save pDate // save pDate
await Storage.SetItemAsync($"{CompanyId}-pDate", ts); await Storage.SetItemAsync($"{CompanyId}-pDate", ts);
// request products from backend // request products from backend
@ -290,8 +291,9 @@ public partial class AdvisorActivityCreatePage : IDisposable
CheckList = await HistoryRepo.FetchInventory(CompanyId); CheckList = await HistoryRepo.FetchInventory(CompanyId);
if (CheckList.Any()) if (CheckList.Any())
{
CheckList = CheckList.OrderBy(x => x.Description).ToList(); CheckList = CheckList.OrderBy(x => x.Description).ToList();
}
await Storage.SetItemAsync($"{CompanyId}-products", CheckList); await Storage.SetItemAsync($"{CompanyId}-products", CheckList);
Working = false; Working = false;
} }
@ -300,7 +302,9 @@ public partial class AdvisorActivityCreatePage : IDisposable
// deserialize storage data // deserialize storage data
CheckList = JsonSerializer.Deserialize<List<ProductInventoryItemView>>(pStorage) ?? new List<ProductInventoryItemView>(); CheckList = JsonSerializer.Deserialize<List<ProductInventoryItemView>>(pStorage) ?? new List<ProductInventoryItemView>();
if (CheckList.Any()) if (CheckList.Any())
{
CheckList = CheckList.OrderBy(x => x.Description).ToList(); CheckList = CheckList.OrderBy(x => x.Description).ToList();
}
} }
// Show CheckList modal // Show CheckList modal
@ -311,7 +315,9 @@ public partial class AdvisorActivityCreatePage : IDisposable
private void ShowPriceHistoryOverlay() private void ShowPriceHistoryOverlay()
{ {
if (ShowItem) if (ShowItem)
{
PriceOverlay.Show(); PriceOverlay.Show();
}
} }
@ -356,12 +362,12 @@ public partial class AdvisorActivityCreatePage : IDisposable
private async Task ConfirmProductCheckCallback() private async Task ConfirmProductCheckCallback()
{ {
ConfirmationCheckOverlay.Hide(); ConfirmationCheckOverlay.Hide();
await CreateActivity();
foreach (var item in CheckList) foreach (var item in CheckList)
{ {
item.Check = false; item.Check = false;
} }
await Storage.SetItemAsync($"{CompanyId}-products", CheckList); await Storage.SetItemAsync($"{CompanyId}-products", CheckList);
await CreateActivity();
} }
// workdate confirm callback // workdate confirm callback
@ -427,7 +433,7 @@ public partial class AdvisorActivityCreatePage : IDisposable
{ {
return; return;
} }
// working flag is raised after the following validations
Logger.LogDebug("view kanvas activity => {}", JsonSerializer.Serialize(Activity)); Logger.LogDebug("view kanvas activity => {}", JsonSerializer.Serialize(Activity));
switch (Kanvas) switch (Kanvas)
{ {
@ -460,6 +466,7 @@ public partial class AdvisorActivityCreatePage : IDisposable
Toaster.ShowError("Ved tilbud skal en gyldig email adresse angives."); Toaster.ShowError("Ved tilbud skal en gyldig email adresse angives.");
return; return;
} }
// every checks
// raise working flag // raise working flag
Working = true; Working = true;
// reset selected item // reset selected item

View file

@ -29,9 +29,10 @@
<th class="p-0" colspan="4"> <th class="p-0" colspan="4">
<div class="bg-light text-dark border border-1 rounded-3 pt-3 mb-2"> <div class="bg-light text-dark border border-1 rounded-3 pt-3 mb-2">
<h2 class="fw-bold text-center">@ReportItem.Company.Name</h2> <h2 class="fw-bold text-center">@ReportItem.Company.Name</h2>
<h3 class="text-center font-monospace">@ReportItem.ESalesNumber</h3>
@if (ReportItem.StatusTypeEnum.ToLower() is "quote") @if (ReportItem.StatusTypeEnum.ToLower() is "quote")
{ {
<h3 class="text-center">TILBUD <span style="font-family: monospace;">@ReportItem.ESalesNumber</span></h3> <h3 class="text-center">TILBUD</h3>
} }
@if (ReportItem.VisitTypeEnum.ToLower() == "phone" || ReportItem.OurRef.Contains("T:")) @if (ReportItem.VisitTypeEnum.ToLower() == "phone" || ReportItem.OurRef.Contains("T:"))
{ {

View file

@ -17,7 +17,7 @@
@using Wonky.Client.Components @using Wonky.Client.Components
@using Wonky.Client.OverlayCustomer @using Wonky.Client.OverlayCustomer
@using Microsoft.AspNetCore.Authorization @using Microsoft.AspNetCore.Authorization
@page "/advisor/customers/{CompanyId}/h/i" @page "/advisor/customers/{CompanyId}/history/inventory"
@attribute [Authorize(Roles = "Advisor")] @attribute [Authorize(Roles = "Advisor")]
<PageTitle>Produkt oversigt for @Company.Name</PageTitle> <PageTitle>Produkt oversigt for @Company.Name</PageTitle>
<div class="row ps-3 pt-2 pb-1 rounded-2 bg-dark text-white"> <div class="row ps-3 pt-2 pb-1 rounded-2 bg-dark text-white">

View file

@ -207,7 +207,7 @@
<div class="col-sm-3"> <div class="col-sm-3">
@if (!Kanvas) @if (!Kanvas)
{ {
<a class="btn btn-success d-block" href="/advisor/customers/@Company.CompanyId/h/i">Produkter</a> <a class="btn btn-success d-block" href="/advisor/customers/@Company.CompanyId/history/inventory">Produkter</a>
} }
</div> </div>
<div class="col-sm-3"> <div class="col-sm-3">

View file

@ -1,7 +1,7 @@
{ {
"appInfo": { "appInfo": {
"name": "Wonky Online", "name": "Wonky Online",
"version": "152.0", "version": "153.0",
"rc": true, "rc": true,
"sandBox": true, "sandBox": true,
"image": "grumpy-coder.png" "image": "grumpy-coder.png"