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-calculator"></i></th>
<th class="text-center" scope="col"><i class="bi-truck"></i></th>
<th scope="col">E Nr.</th>
</tr>
</thead>
<tbody>
@ -43,7 +44,7 @@
<td class="align-middle">@activity.Sales</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.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">
@if (activity.OurRef.Contains("T:"))
{<i style="font-size:1.3em;" class="bi-phone"></i>}
@ -62,6 +63,7 @@
<ProcessStateComponent StateClass="@Utils.GetProcessStatus(activity.ProcessStatusEnum)"/>
}
</td>
<td class="align-middle font-monospace text-sm-start">@activity.ESalesNumber</td>
</tr>
}
<tr>

View file

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

View file

@ -29,9 +29,10 @@
<th class="p-0" colspan="4">
<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>
<h3 class="text-center font-monospace">@ReportItem.ESalesNumber</h3>
@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:"))
{

View file

@ -17,7 +17,7 @@
@using Wonky.Client.Components
@using Wonky.Client.OverlayCustomer
@using Microsoft.AspNetCore.Authorization
@page "/advisor/customers/{CompanyId}/h/i"
@page "/advisor/customers/{CompanyId}/history/inventory"
@attribute [Authorize(Roles = "Advisor")]
<PageTitle>Produkt oversigt for @Company.Name</PageTitle>
<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">
@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 class="col-sm-3">

View file

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