This commit is contained in:
Frede Hundewadt 2022-11-29 08:50:21 +01:00
parent d15a4cfa9e
commit 3a51363ea4
12 changed files with 176 additions and 147 deletions

View file

@ -38,7 +38,7 @@
@foreach (var activity in Activities) @foreach (var activity in Activities)
{ {
<tr> <tr>
<td class="align-middle"><a href="/companies/@activity.Company.CompanyId/orders/@activity.ActivityId">@activity.Company.Name</a></td> <td class="align-middle"><a class="btn btn-outline-info text-black d-block" href="/companies/@activity.Company.CompanyId/orders/@activity.ActivityId">@activity.Company.Name</a></td>
<td class="align-middle">@activity.Company.City</td> <td class="align-middle">@activity.Company.City</td>
<td class="align-middle">@activity.Demo</td> <td class="align-middle">@activity.Demo</td>
<td class="align-middle">@activity.Sales</td> <td class="align-middle">@activity.Sales</td>
@ -47,15 +47,15 @@
<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 class="bi-phone"></i>} {<i style="font-size:1.3em;" class="bi-phone"></i>}
</td> </td>
<td class="align-middle text-center"> <td class="align-middle text-center">
@if (activity.Express) @if (activity.Express)
{<i class="bi-lightning"></i>} {<i style="font-size:1.3em;" class="bi-lightning"></i>}
</td> </td>
<td class="align-middle text-end"> <td class="align-middle text-end">
@if (activity.StatusTypeEnum == "Quote") @if (activity.StatusTypeEnum == "Quote")
{<i class="bi-calculator"></i>} {<i style="font-size:1.3em;" class="bi-calculator"></i>}
</td> </td>
<td class="align-middle state"> <td class="align-middle state">
@if (activity.Lines.Any() && activity.StatusTypeEnum == "Order") @if (activity.Lines.Any() && activity.StatusTypeEnum == "Order")

View file

@ -46,15 +46,15 @@
<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 class="bi-phone"></i>} {<i style="font-size:1.3em;" class="bi-phone"></i>}
</td> </td>
<td class="align-middle text-center"> <td class="align-middle text-center">
@if (activity.Express) @if (activity.Express)
{<i class="bi-lightning"></i>} {<i style="font-size:1.3em;" class="bi-lightning"></i>}
</td> </td>
<td class="align-middle text-end"> <td class="align-middle text-end">
@if (activity.StatusTypeEnum == "Quote") @if (activity.StatusTypeEnum == "Quote")
{<i class="bi-calculator"></i>} {<i style="font-size:1.3em;" class="bi-calculator"></i>}
</td> </td>
<td class="align-middle state"> <td class="align-middle state">
@if (activity.Lines.Any() && activity.StatusTypeEnum == "Order") @if (activity.Lines.Any() && activity.StatusTypeEnum == "Order")

View file

@ -15,7 +15,7 @@
// //
*@ *@
<i class="bi-@_icon @StateClass"></i> <i style="font-size:1.3em;" class="bi-@_icon @StateClass"></i>
@code{ @code{
[Parameter] public string StateClass { get; set; } = ""; [Parameter] public string StateClass { get; set; } = "";

View file

@ -30,11 +30,11 @@
} }
@if (ReportItem.VisitTypeEnum == "Phone" || ReportItem.OurRef.Contains("T:")) @if (ReportItem.VisitTypeEnum == "Phone" || ReportItem.OurRef.Contains("T:"))
{ {
<h5 class="text-center">TELEFONORDRE</h5> <h4 class="text-center">TELEFONORDRE</h4>
} }
@if (ReportItem.StatusTypeEnum is "Quote") @if (ReportItem.StatusTypeEnum is "Quote")
{ {
<h5 class="text-center">TILBUD</h5> <h4 class="text-center">TILBUD</h4>
} }
</div> </div>
</th> </th>

View file

@ -50,8 +50,8 @@ else
<div class="row mb-1"> <div class="row mb-1">
<label for="activityType" class="col-md-2 col-form-label">Ordre Type</label> <label for="activityType" class="col-md-2 col-form-label">Ordre Type</label>
<div class="col-md-4"> <div class="col-md-4">
<InputSelect id="activityType" class="form-select bg-info" @bind-Value="@Activity.ActivityTypeEnum"> <InputSelect id="activityType" class="form-select bg-primary text-bg-primary" @bind-Value="@Activity.ActivityTypeEnum">
<option value=""></option> <option value="">&rarr; TAG MIG &larr;</option>
<option value="onSite">Besøg</option> <option value="onSite">Besøg</option>
<option value="phone">Telefon</option> <option value="phone">Telefon</option>
</InputSelect> </InputSelect>
@ -60,7 +60,7 @@ else
<label for="statusType" class="col-md-2 col-form-label">Status</label> <label for="statusType" class="col-md-2 col-form-label">Status</label>
<div class="col-md-4"> <div class="col-md-4">
<InputSelect id="statusType" class="form-select bg-info" @bind-Value="@Activity.ActivityStatusEnum"> <InputSelect id="statusType" class="form-select bg-primary text-bg-primary" @bind-Value="@Activity.ActivityStatusEnum">
<option value="noSale">Ingen salg</option> <option value="noSale">Ingen salg</option>
@if (!string.IsNullOrEmpty(Activity.VatNumber) && !string.IsNullOrWhiteSpace(Activity.Address1) && Company.HasFolded == 0) @if (!string.IsNullOrEmpty(Activity.VatNumber) && !string.IsNullOrWhiteSpace(Activity.Address1) && Company.HasFolded == 0)
{ {

View file

@ -21,30 +21,29 @@
@page "/activity-today" @page "/activity-today"
<div class="row bg-dark text-white rounded-2 mb-2 py-2 align-items-center"> <div class="row bg-dark text-white rounded-2 mb-2 py-2 align-items-center">
<div class="col"> <div class="col-sm-7">
<WorkDateComponent OnChangedCallback="GetActivities" /> <WorkDateComponent OnChangedCallback="GetActivities"/>
</div> </div>
<div class="col-md-3"> <div class="col-sm-3">
<AdvisorActivityKmStartComponent /> <AdvisorActivityKmStartComponent/>
</div> </div>
<div class="col-md-2"> <div class="col-sm-2 text-end">
@if (ReportExist) @if (ReportExist)
{ {
<a class="btn btn-primary" href="/sales-reports/view/@($"{SelectedDate:yyyy-MM-dd}")">RAPPORT</a> <a class="btn btn-info" href="/sales-reports/view/@($"{SelectedDate:yyyy-MM-dd}")">Rapport <i style="font-size: 1.2em;" class="bi-info-lg"></i></a>
} }
else else
{ {
<a class="btn btn-primary" href="/sales-reports/new">RAPPORT</a> <a class="btn btn-primary" href="/sales-reports/new">Rapport <i style="font-size:1.2em;" class="bi-plus-lg"></i></a>
} }
</div> </div>
</div> </div>
@if (ReportStatusView.ReportItems.Any()) @if (ReportStatusView.ReportItems.Any())
{ {
<AdvisorActivityTableComponent Activities="ReportStatusView.ReportItems" /> <AdvisorActivityTableComponent Activities="ReportStatusView.ReportItems"/>
} }
else @if (Working)
{ {
<LoaderThreeDots /> <LoaderThreeDots/>
} }

View file

@ -38,30 +38,29 @@ public partial class CrmActivityTodayPage : IDisposable
private Preferences Preferences { get; set; } = new(); private Preferences Preferences { get; set; } = new();
private DateTime SelectedDate { get; set; } private DateTime SelectedDate { get; set; }
private bool ReportExist { get; set; } private bool ReportExist { get; set; }
private bool Loading { get; set; } = true; private bool Working { get; set; } = true;
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
Interceptor.RegisterEvent(); Interceptor.RegisterEvent();
Interceptor.RegisterBeforeSendEvent(); Interceptor.RegisterBeforeSendEvent();
Preferences = await PreferenceService.GetPreferences(); Preferences = await PreferenceService.GetPreferences();
SelectedDate = string.IsNullOrWhiteSpace(Preferences.WorkDate) ? DateTime.Now : DateTime.Parse(Preferences.WorkDate); SelectedDate = string.IsNullOrWhiteSpace(Preferences.WorkDate) ? DateTime.Now : DateTime.Parse(Preferences.WorkDate);
ReportExist = await CrmReportRepo.ReportExist($"{SelectedDate:yyyy-MM-dd}"); ReportExist = await CrmReportRepo.ReportExist($"{SelectedDate:yyyy-MM-dd}");
await GetActivities($"{SelectedDate:yyyy-MM-dd}"); await GetActivities($"{SelectedDate:yyyy-MM-dd}");
Working = false;
} }
private async Task GetActivities(string workDate) private async Task GetActivities(string workDate)
{ {
Working = true;
Toaster.ShowInfo("Vent nogle sekunder for data", "HENTER DATA"); Toaster.ShowInfo("Vent nogle sekunder for data", "HENTER DATA");
SelectedDate = DateTime.Parse(workDate); SelectedDate = DateTime.Parse(workDate);
ReportStatusView = new ReportStatusView(); ReportStatusView = new ReportStatusView();
ReportExist = await CrmReportRepo.ReportExist($"{SelectedDate:yyyy-MM-dd}");
ReportStatusView = await CrmActivityRepo.GetActivities($"{SelectedDate:yyyy-MM-dd}"); ReportStatusView = await CrmActivityRepo.GetActivities($"{SelectedDate:yyyy-MM-dd}");
Logger.LogDebug("Activities => {}", JsonSerializer.Serialize(ReportStatusView)); Logger.LogDebug("Activities => {}", JsonSerializer.Serialize(ReportStatusView));
Loading = false; Working = false;
Toaster.ClearAll(); Toaster.ClearAll();
} }

View file

@ -37,6 +37,7 @@ public partial class CrmActivityViewPage : IDisposable
[Inject] public ICrmActivityHttpRepository ActivityRepo { get; set; } [Inject] public ICrmActivityHttpRepository ActivityRepo { get; set; }
[Inject] public ILogger<CrmActivityViewPage> Logger { get; set; } [Inject] public ILogger<CrmActivityViewPage> Logger { get; set; }
[Inject] public IToastService Toaster { get; set; } [Inject] public IToastService Toaster { get; set; }
[Inject] public NavigationManager Navigator { get; set; }
private ReportItemView ReportItem { get; set; } = new(); private ReportItemView ReportItem { get; set; } = new();
private ActivityOfficeNote Note { get; set; } = new(); private ActivityOfficeNote Note { get; set; } = new();
private EditContext NoteContext { get; set; } private EditContext NoteContext { get; set; }
@ -66,6 +67,7 @@ public partial class CrmActivityViewPage : IDisposable
Logger.LogDebug("OfficeNote => \n {}", JsonSerializer.Serialize(Note)); Logger.LogDebug("OfficeNote => \n {}", JsonSerializer.Serialize(Note));
await ActivityRepo.UpdateOfficeNote(Note); await ActivityRepo.UpdateOfficeNote(Note);
Toaster.ShowInfo($"{ReportItem.ESalesNumber} - notat opdateret"); Toaster.ShowInfo($"{ReportItem.ESalesNumber} - notat opdateret");
Navigator.NavigateTo("/activity-today");
} }
private bool AllowOfficeNoteUpdate() private bool AllowOfficeNoteUpdate()

View file

@ -20,38 +20,40 @@
@attribute [Authorize(Roles = "Advisor")] @attribute [Authorize(Roles = "Advisor")]
@page "/sales-reports/new" @page "/sales-reports/new"
<div class="row bg-dark text-white rounded-2 mb-2 py-2 align-items-center"> @if (Working)
<div class="col"> {
<LoaderThreeDots/>
}
@* report header *@
<div class="row sticky-top bg-dark text-white rounded-2 mb-2 py-2 align-items-center">
<div class="col-sm-8">
<WorkDateComponent OnChangedCallback="SetWorkDate"/> <WorkDateComponent OnChangedCallback="SetWorkDate"/>
</div> </div>
<div class="col"> <div class="col-sm-4 text-end">
<AdvisorActivityKmStartComponent /> <AdvisorActivityKmStartComponent/>
</div>
<div class="col-3 justify-content-center">
@if (Working)
{
<LoaderThreeDots/>
}
</div> </div>
</div> </div>
@* report form *@
<EditForm EditContext="ReportContext"> <EditForm EditContext="ReportContext">
<div class="sticky-top bg-success bg-opacity-50 rounded-2 px-3"> @* Day info row *@
<div class="row">
<table class="table"> <table class="table">
<thead> <thead>
<tr> <tr>
<th scope="col">Dagen</th> <th scope="col">Dag / Periode</th>
<th scope="col">Begyndt</th> <th scope="col">Begyndt</th>
<th scope="col">Afsluttet</th> <th scope="col">Afsluttet</th>
<th></th> @* <th></th> *@
<th></th> <th></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<td> <td>
<select id="dayType" class="col-md-3 form-select" <select id="dayType" class="col-md-3 form-select text-bg-primary bg-primary"
@bind-Value="Report.DayTypeEnum" @bind-Value:event="oninput"> @bind-Value="Report.DayTypeEnum" @bind-Value:event="onchange">
<option value="">&rarr; TAG MIG &larr;</option> <option value="">&rarr; TAG MIG &larr;</option>
<option value="sales">Salgsdag</option> <option value="sales">Salgsdag</option>
<option value="meeting">Salgsmøde</option> <option value="meeting">Salgsmøde</option>
@ -65,10 +67,10 @@
@if (Report.DayTypeEnum.ToLower().Contains("leave")) @if (Report.DayTypeEnum.ToLower().Contains("leave"))
{ {
<td> <td>
<InputDate class="form-control" @bind-Value="_leaveBegin"/> <InputDate class="form-control" @bind-Value="BeginLeave"/>
</td> </td>
<td> <td>
<InputDate class="form-control" @bind-Value="_leaveEnd"/> <InputDate class="form-control" @bind-Value="EndLeave"/>
</td> </td>
} }
else else
@ -82,25 +84,32 @@
@bind-Value="_checkOut" @bind-Value:event="oninput" @onchange="OnTimeChanged"/> @bind-Value="_checkOut" @bind-Value:event="oninput" @onchange="OnTimeChanged"/>
</td> </td>
} }
@*
<th> <th>
<button type="button" class="btn btn-warning" <button type="button" class="btn btn-warning"
@onclick="GetKeyFigures" disabled="@(!NoFigures)"> @onclick="GetKeyFigures" disabled="@(!NoFigures)">
Nøgletal Nøgletal
</button> </button>
</th> </th>
<td> *@
<td class="text-end">
@* <div style="display:@(_working ? "none" : "block");"> *@ @* <div style="display:@(_working ? "none" : "block");"> *@
<button type="button" class="btn btn-success" <button type="button" class="btn btn-primary"
@onclick="SubmitReport" disabled="@(NoFigures || Working)"> @onclick="SubmitReport" disabled="@(NoFigures || Working)">
Gem Rapport Gem Rapport
</button> </button>
@* </div> *@ @* </div> *@
</td> </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@if (!Report.DayTypeEnum.ToLower().Contains("leave")) </div>
{
@* report details for everything but leave *@
@if (!Report.DayTypeEnum.ToLower().Contains("leave"))
{
<div class="row">
@* details input *@
<table class="table"> <table class="table">
<thead> <thead>
<tr> <tr>
@ -122,7 +131,10 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div>
<div class="row">
@* distance ledger input *@
<table class="table"> <table class="table">
<thead> <thead>
<tr> <tr>
@ -148,77 +160,11 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div>
<table class="table table-striped"> @if (Activities.Any())
<thead> {
<tr class="bg-dark text-white opacity-75"> <div class="row">
<th></th> @* Report activities *@
<th class="text-center" colspan="2" scope="col">Dagens Demo @(Report.Figures.NewDemoCount + Report.Figures.RecallDemoCount)</th>
<th class="text-center border-end" colspan="2" scope="col">Dagens Resultat</th>
<th class="text-center" colspan="4" scope="col">Måneds Resultat</th>
</tr>
</thead>
<tbody>
<tr class="bg-dark bg-opacity-50">
<td></td>
<th class="text-end text-white" scope="col">Besøg</th>
<th class="text-end text-white" scope="col">Demo</th>
<th class="text-end text-white" scope="col">Salg</th>
<th class="text-end text-white border-end" scope="col">Beløb</th>
<th class="text-end text-white" scope="col">Besøg</th>
<th class="text-end text-white" scope="col">Demo</th>
<th class="text-end text-white" scope="col">Salg</th>
<th class="text-end text-white" scope="col">Beløb</th>
</tr>
<tr>
<th scope="row">N</th>
<td class="text-end">@Report.Figures.NewVisitCount</td>
<td class="text-end">@Report.Figures.NewDemoCount</td>
<td class="text-end">@Report.Figures.NewSaleCount</td>
<td class="text-end border-end">@Report.Figures.NewTurnover</td>
<td class="text-end">@Report.Figures.NewVisitCountMonth</td>
<td class="text-end">@Report.Figures.NewDemoCountMonth</td>
<td class="text-end">@Report.Figures.NewSaleCountMonth</td>
<td class="text-end">@Report.Figures.NewTurnoverMonth</td>
</tr>
<tr>
<th scope="row">R</th>
<td class="text-end">@Report.Figures.RecallVisitCount</td>
<td class="text-end">@Report.Figures.RecallDemoCount</td>
<td class="text-end">@Report.Figures.RecallSaleCount</td>
<td class="text-end border-end">@Report.Figures.RecallTurnover</td>
<td class="text-end">@Report.Figures.RecallVisitCountMonth</td>
<td class="text-end">@Report.Figures.RecallDemoCountMonth</td>
<td class="text-end">@Report.Figures.RecallSaleCountMonth</td>
<td class="text-end">@Report.Figures.RecallTurnoverMonth</td>
</tr>
<tr>
<th scope="row">SAS</th>
<td class="bg-light"></td>
<td class="bg-light"></td>
<td class="text-end">@Report.Figures.SasCount</td>
<td class="text-end border-end">@Report.Figures.SasTurnover</td>
<td class="bg-light"></td>
<td class="bg-light"></td>
<td class="text-end">@Report.Figures.SasCountMonth</td>
<td class="text-end">@Report.Figures.SasTurnoverMonth</td>
</tr>
<tr>
<th scope="row">TOTAL</th>
<td class="text-end">@Report.Figures.TotalVisitCount</td>
<td class="text-end">@Report.Figures.TotalDemoCount</td>
<td class="text-end">@Report.Figures.TotalSaleCount</td>
<td class="text-end border-end">@Report.Figures.TotalTurnover</td>
<td class="text-end">@Report.Figures.TotalVisitCountMonth</td>
<td class="text-end">@Report.Figures.TotalDemoCountMonth</td>
<td class="text-end">@Report.Figures.TotalSaleCountMonth</td>
<td class="text-end">@Report.Figures.TotalTurnoverMonth</td>
</tr>
</tbody>
</table>
@if (Activities != null)
{
<table class="table"> <table class="table">
<thead> <thead>
<tr class="bg-black opacity-75 text-white"> <tr class="bg-black opacity-75 text-white">
@ -230,13 +176,16 @@
<th scope="col" class="text-end">sas</th> <th scope="col" class="text-end">sas</th>
<th scope="col" class="text-end">Beløb</th> <th scope="col" class="text-end">Beløb</th>
<th scope="col" class="text-center"> <th scope="col" class="text-center">
<i class="oi oi-phone"></i> <i style="font-size:1.3em;" class="bi-phone"></i>
</th> </th>
<th scope="col" class="text-center"> <th scope="col" class="text-center">
<i class="oi oi-flash"></i> <i class="bi-lightning"></i>
</th> </th>
<th scope="col" class="text-center"> <th scope="col" class="text-center">
<i class="oi oi-calculator"></i> <i class="bi-calculator"></i>
</th>
<th scope="col" class="text-center">
<i class="bi-truck"></i>
</th> </th>
</tr> </tr>
</thead> </thead>
@ -254,33 +203,106 @@
<td class="text-center"> <td class="text-center">
@if (activity.OurRef.Contains("T:")) @if (activity.OurRef.Contains("T:"))
{ {
<i class="oi oi-phone"></i> <i style="font-size:1.5em;" class="bg-info bi-phone"></i>
} }
</td> </td>
<td class="text-center"> <td class="text-center">
@if (activity.Express) @if (activity.Express)
{ {
<i class="oi oi-flash"></i> <i style="font-size:1.5em;" class="bi-lightning"></i>
} }
</td> </td>
<td class="text-center"> <td class="text-center">
@if (activity.StatusTypeEnum == "Quote") @if (activity.StatusTypeEnum == "Quote")
{ {
<i class="oi oi-calculator"></i> <i style="font-size:1.5em;" class="bi-calculator"></i>
} }
</td> </td>
<td class="text-center">
<ProcessStateComponent StateClass="@activity.ProcessStatusEnum"/>
</td>
</tr> </tr>
} }
<tr> <tr>
<td colspan="5"></td> <td colspan="5"></td>
<td class="text-end">Total</td> <td class="text-end">Total</td>
<td class="text-end">@Activities.Where(x => x.StatusTypeEnum != "Quote").Sum(x => x.OrderAmount)</td> <td class="text-end">@Activities.Where(x => x.StatusTypeEnum != "Quote").Sum(x => x.OrderAmount)</td>
<td colspan="2"></td> <td colspan="4"></td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
} </div>
} }
}
<div class="row">
@* ledger summaries calculated *@
<table class="table table-striped table-bordered">
<thead>
<tr class="bg-dark text-white opacity-75">
<th></th>
<th class="text-center" colspan="2" scope="col">Dagens Demo @(Report.Figures.NewDemoCount + Report.Figures.RecallDemoCount)</th>
<th class="text-center border-end" colspan="2" scope="col">Dagens Resultat</th>
<th class="text-center" colspan="4" scope="col">Måneds Resultat</th>
</tr>
</thead>
<tbody>
<tr class="bg-dark bg-opacity-50">
<td></td>
<th class="text-end text-white" scope="col">Besøg</th>
<th class="text-end text-white" scope="col">Demo</th>
<th class="text-end text-white" scope="col">Salg</th>
<th class="text-end text-white border-end" scope="col">Beløb</th>
<th class="text-end text-white" scope="col">Besøg</th>
<th class="text-end text-white" scope="col">Demo</th>
<th class="text-end text-white" scope="col">Salg</th>
<th class="text-end text-white" scope="col">Beløb</th>
</tr>
<tr>
<th scope="row">N</th>
<td class="text-end">@Report.Figures.NewVisitCount</td>
<td class="text-end">@Report.Figures.NewDemoCount</td>
<td class="text-end">@Report.Figures.NewSaleCount</td>
<td class="text-end border-end">@Report.Figures.NewTurnover</td>
<td class="text-end">@Report.Figures.NewVisitCountMonth</td>
<td class="text-end">@Report.Figures.NewDemoCountMonth</td>
<td class="text-end">@Report.Figures.NewSaleCountMonth</td>
<td class="text-end">@Report.Figures.NewTurnoverMonth</td>
</tr>
<tr>
<th scope="row">R</th>
<td class="text-end">@Report.Figures.RecallVisitCount</td>
<td class="text-end">@Report.Figures.RecallDemoCount</td>
<td class="text-end">@Report.Figures.RecallSaleCount</td>
<td class="text-end border-end">@Report.Figures.RecallTurnover</td>
<td class="text-end">@Report.Figures.RecallVisitCountMonth</td>
<td class="text-end">@Report.Figures.RecallDemoCountMonth</td>
<td class="text-end">@Report.Figures.RecallSaleCountMonth</td>
<td class="text-end">@Report.Figures.RecallTurnoverMonth</td>
</tr>
<tr>
<th scope="row">SAS</th>
<td class="bg-dark bg-opacity-25"></td>
<td class="bg-dark bg-opacity-25"></td>
<td class="text-end">@Report.Figures.SasCount</td>
<td class="text-end border-end">@Report.Figures.SasTurnover</td>
<td class="bg-dark bg-opacity-25"></td>
<td class="bg-dark bg-opacity-25"></td>
<td class="text-end">@Report.Figures.SasCountMonth</td>
<td class="text-end">@Report.Figures.SasTurnoverMonth</td>
</tr>
<tr>
<th scope="row">TOTAL</th>
<td class="text-end">@Report.Figures.TotalVisitCount</td>
<td class="text-end">@Report.Figures.TotalDemoCount</td>
<td class="text-end">@Report.Figures.TotalSaleCount</td>
<td class="text-end border-end">@Report.Figures.TotalTurnover</td>
<td class="text-end">@Report.Figures.TotalVisitCountMonth</td>
<td class="text-end">@Report.Figures.TotalDemoCountMonth</td>
<td class="text-end">@Report.Figures.TotalSaleCountMonth</td>
<td class="text-end">@Report.Figures.TotalTurnoverMonth</td>
</tr>
</tbody>
</table>
</div> </div>
</EditForm> </EditForm>>
<ConfirmationModal BodyMessage="@Prompt" OnOkClicked="ReportSaveConfirmed" @ref="ConfirmReportModal"/> <ConfirmationModal BodyMessage="@Prompt" OnOkClicked="ReportSaveConfirmed" @ref="ConfirmReportModal"/>

View file

@ -52,8 +52,8 @@ public partial class CrmReportNewPage : IDisposable
private DateTime _workDate { get; set; } = DateTime.Now; private DateTime _workDate { get; set; } = DateTime.Now;
private TimeOnly _checkIn { get; set; } = new(12, 0); private TimeOnly _checkIn { get; set; } = new(12, 0);
private TimeOnly _checkOut { get; set; } = new(12, 0); private TimeOnly _checkOut { get; set; } = new(12, 0);
private DateTime _leaveBegin { get; set; } = DateTime.Now; private DateTime BeginLeave { get; set; } = DateTime.Now;
private DateTime _leaveEnd { get; set; } = DateTime.Now; private DateTime EndLeave { get; set; } = DateTime.Now;
private ConfirmationModal ConfirmReportModal { get; set; } private ConfirmationModal ConfirmReportModal { get; set; }
private string Prompt { get; set; } = ""; private string Prompt { get; set; } = "";
@ -72,18 +72,21 @@ public partial class CrmReportNewPage : IDisposable
if(await CrmReportRepo.ReportExist(Preferences.WorkDate)) if(await CrmReportRepo.ReportExist(Preferences.WorkDate))
Navigator.NavigateTo($"/sales-reports/view/{Preferences.WorkDate}"); Navigator.NavigateTo($"/sales-reports/view/{Preferences.WorkDate}");
_leaveBegin = _workDate; BeginLeave = _workDate;
_leaveEnd = _workDate; EndLeave = _workDate;
Report.FromDateTime = $"{_workDate:yyyy-MM-dd'T'12:00:00}"; Report.FromDateTime = $"{_workDate:yyyy-MM-dd'T'12:00:00}";
Report.ToDateTime = $"{_workDate:yyyy-MM-dd'T'12:00:00}"; Report.ToDateTime = $"{_workDate:yyyy-MM-dd'T'12:00:00}";
Report.Figures.Distance = 0; Report.Figures.Distance = 0;
Report.Figures.DistancePrivateMonth = 0; Report.Figures.DistancePrivateMonth = 0;
await GetKeyFigures();
} }
private void HandleFieldChanged(object sender, FieldChangedEventArgs e) private void HandleFieldChanged(object sender, FieldChangedEventArgs e)
{ {
Console.WriteLine($"e Model => {e.FieldIdentifier.Model}");
Console.WriteLine($"e FieldName => {e.FieldIdentifier.FieldName}");
FormInvalid = !ReportContext.Validate(); FormInvalid = !ReportContext.Validate();
StateHasChanged(); StateHasChanged();
} }
@ -120,13 +123,13 @@ public partial class CrmReportNewPage : IDisposable
if (string.IsNullOrWhiteSpace(Report.DayTypeEnum)) if (string.IsNullOrWhiteSpace(Report.DayTypeEnum))
{ {
Toaster.ShowError("Dagtype skal vælges"); Toaster.ShowError("Dagtype skal vælges", "Dag type skal angives");
return; return;
} }
if (Report.Figures.KmMorning > Report.Figures.KmEvening) if (Report.Figures.KmMorning > Report.Figures.KmEvening)
{ {
Toaster.ShowError("Km udregning er negativ - kontroller venligst km tal"); Toaster.ShowError("Km udregning er negativ - kontroller venligst km tal", "Kontroller km tal");
return; return;
} }
@ -134,8 +137,8 @@ public partial class CrmReportNewPage : IDisposable
DateTime checkOut; DateTime checkOut;
if (Report.DayTypeEnum.ToLower().Contains("leave")) if (Report.DayTypeEnum.ToLower().Contains("leave"))
{ {
checkIn = new DateTime(_leaveBegin.Year, _leaveBegin.Month, _leaveBegin.Day, 0, 0, 0); checkIn = new DateTime(BeginLeave.Year, BeginLeave.Month, BeginLeave.Day, 0, 0, 0);
checkOut = new DateTime(_leaveEnd.Year, _leaveEnd.Month, _leaveEnd.Day, 0, 0, 0); checkOut = new DateTime(EndLeave.Year, EndLeave.Month, EndLeave.Day, 0, 0, 0);
} }
else else
{ {
@ -154,7 +157,7 @@ public partial class CrmReportNewPage : IDisposable
Logger.LogDebug("_workDate => {workDate}", $"{_workDate:yyyy-MM-dd}"); Logger.LogDebug("_workDate => {workDate}", $"{_workDate:yyyy-MM-dd}");
Logger.LogDebug("_report => {report}", JsonSerializer.Serialize(Report)); Logger.LogDebug("_report => {report}", JsonSerializer.Serialize(Report));
Prompt = Report.Figures.Distance > 1000 ? $"'{Report.Figures.Distance}'km er meget højt. Er du sikker på at det er rigtigt? Gem rapport for {_workDate.ToLongDateString()}?" : $"Rapport for {_workDate.ToLongDateString()}?"; Prompt = Report.Figures.Distance > 1000 ? $"'{Report.Figures.Distance}'KM tal er meget højt. Er du sikker på at det er rigtigt? Gem rapport for {_workDate.ToLongDateString()}?" : $"Gem Rapport for {_workDate.ToLongDateString()}?";
ConfirmReportModal.Show(); ConfirmReportModal.Show();
} }

View file

@ -31,6 +31,9 @@
<div class="col col-md-6 align-content-center"> <div class="col col-md-6 align-content-center">
<button class="btn btn-warning" type="button" onclick="window.print();">Print</button> <button class="btn btn-warning" type="button" onclick="window.print();">Print</button>
</div> </div>
@* todo
option wo print only report
*@
</div> </div>
@if (!string.IsNullOrWhiteSpace(Report.ReportData.DayTypeEnum)) @if (!string.IsNullOrWhiteSpace(Report.ReportData.DayTypeEnum))
{ {
@ -59,6 +62,7 @@
} }
</div> </div>
@* todo - add flag for printing only report *@
@if (_items.Any()) @if (_items.Any())
{ {
@foreach (var item in _items.Where(item => item.StatusTypeEnum.ToLower() == "order" && item.ProcessStatusEnum.ToLower() == "none")) @foreach (var item in _items.Where(item => item.StatusTypeEnum.ToLower() == "order" && item.ProcessStatusEnum.ToLower() == "none"))

View file

@ -1,7 +1,7 @@
{ {
"appInfo": { "appInfo": {
"name": "Wonky Client", "name": "Wonky Client",
"version": "0.70.1", "version": "0.71.1",
"rc": true, "rc": true,
"sandBox": false, "sandBox": false,
"image": "grumpy-coder.png" "image": "grumpy-coder.png"