wip - show process status

This commit is contained in:
Frede Hundewadt 2022-08-30 15:21:39 +02:00
parent f1812527a8
commit 07c5268325
15 changed files with 70 additions and 36 deletions

View file

@ -1,7 +1,7 @@
@using Wonky.Client.Services @using Wonky.Client.Services
<div class="input-group"> <div class="input-group">
<label class="col-form-label me-2" for="kmMorning">Morgen</label> <label class="col-form-label me-2" for="kmMorning">KmStart</label>
<input type="number" id="kmMorning" class="form-control" @bind-Value="KmMorning" @bind-Value:event="oninput" @onchange="OnKmChanged"/> <input type="number" id="kmMorning" class="form-control" @bind-Value="KmMorning" @bind-Value:event="oninput" @onchange="OnKmChanged"/>
</div> </div>

View file

@ -20,6 +20,7 @@
<table class="table table-bordered d-print-table table-striped"> <table class="table table-bordered d-print-table table-striped">
<thead> <thead>
<tr class="bg-dark text-white opacity-75 border-bottom"> <tr class="bg-dark text-white opacity-75 border-bottom">
<th></th>
<th scope="col">Kunde</th> <th scope="col">Kunde</th>
<th scope="col">Bynavn</th> <th scope="col">Bynavn</th>
<th scope="col">Demo</th> <th scope="col">Demo</th>
@ -36,6 +37,10 @@
@foreach (var activity in Activities) @foreach (var activity in Activities)
{ {
<tr> <tr>
<td class="state align-middle">
@activity.ProcessStatusEnum
@* <DisplayStateComponent StateClass="@(GetProcessStatus(activity.ProcessStatusEnum))" /> *@
</td>
<td>@activity.Company.Name</td> <td>@activity.Company.Name</td>
<td>@activity.Company.City</td> <td>@activity.Company.City</td>
<td>@activity.Demo</td> <td>@activity.Demo</td>
@ -43,9 +48,18 @@
<td>@activity.OfficeNote</td> <td>@activity.OfficeNote</td>
<td class="text-end">@($"{activity.SasAmount:N2}")</td> <td class="text-end">@($"{activity.SasAmount:N2}")</td>
<td class="text-end">@(activity.StatusTypeEnum == "Quote" ? $"{0:N2}" : $"{activity.OrderAmount:N2}")</td> <td class="text-end">@(activity.StatusTypeEnum == "Quote" ? $"{0:N2}" : $"{activity.OrderAmount:N2}")</td>
<td class="text-center">@if(activity.OurRef.Contains("T:")){<i class="oi oi-phone"></i>}</td> <td class="text-center">
<td class="text-center">@if(activity.Express){<i class="oi oi-flash"></i>}</td> @if (activity.OurRef.Contains("T:"))
<td class="text-end">@if(activity.StatusTypeEnum == "Quote"){<i class="oi oi-calculator"></i>}</td> {<i class="oi oi-phone"></i>}
</td>
<td class="text-center">
@if (activity.Express)
{<i class="oi oi-flash"></i>}
</td>
<td class="text-end">
@if (activity.StatusTypeEnum == "Quote")
{<i class="oi oi-calculator"></i>}
</td>
</tr> </tr>
} }
<tr> <tr>

View file

@ -21,4 +21,16 @@ namespace Wonky.Client.Components;
public partial class ActivityTableComponent public partial class ActivityTableComponent
{ {
[Parameter] public List<ReportItemView> Activities { get; set; } [Parameter] public List<ReportItemView> Activities { get; set; }
private static string GetProcessStatus(string processStatus)
{
return processStatus.ToLower() switch
{
"none" => "the-draw",
"picked" => "the-good",
"packed" => "the-bad",
"shipped" => "the-ugly",
_ => "the-dead"
};
}
} }

View file

@ -17,7 +17,7 @@
@using Wonky.Entity.Views @using Wonky.Entity.Views
<div class="report-page-item d-block"> <div class="report-visit d-block">
<table class="table table-sm table-striped d-print-table"> <table class="table table-sm table-striped d-print-table">
<thead> <thead>
<tr> <tr>

View file

@ -28,7 +28,7 @@
<WorkDateComponent OnChanged="GetActivities" /> <WorkDateComponent OnChanged="GetActivities" />
</div> </div>
<div class="col-md-3"> <div class="col-md-3">
<KmMorningComponent /> <ActivityKmStartComponent />
</div> </div>
<div class="col-md-2"> <div class="col-md-2">
@if (_reportExist) @if (_reportExist)

View file

@ -13,6 +13,7 @@
// along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html] // along with this program. If not, see [https://www.gnu.org/licenses/agpl-3.0.en.html]
// //
using System.Text.Json;
using Blazored.Toast.Services; using Blazored.Toast.Services;
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
using Wonky.Client.Components; using Wonky.Client.Components;
@ -58,6 +59,7 @@ public partial class ActivityTodayListPage : IDisposable
_workDate = workDate; _workDate = workDate;
ReportItemListView = new ReportItemListView(); ReportItemListView = new ReportItemListView();
ReportItemListView = await _activityRepo.GetActivities(workDate); ReportItemListView = await _activityRepo.GetActivities(workDate);
_logger.LogDebug("Activities => {}", JsonSerializer.Serialize(ReportItemListView));
Loading = false; Loading = false;
} }

View file

@ -30,7 +30,7 @@
@if (_dk) @if (_dk)
{ {
<div class="card-body"> <div class="card-body">
<VatAddressInputComponent Address="vatAddress" OnValidSubmit="GetInfoFromAddress"/> <VatAddressInputComponent Address="_vatAddress" OnValidSubmit="GetInfoFromAddress"/>
</div> </div>
@if (_vInfos.Any()) @if (_vInfos.Any())
{ {

View file

@ -51,12 +51,12 @@ public partial class CustomerViewPage : IDisposable
private DateTime _lastVisit { get; set; } private DateTime _lastVisit { get; set; }
private DateTime _nextVisit { get; set; } private DateTime _nextVisit { get; set; }
private string _vatState { get; set; } = "the-ugly"; private string _vatState { get; set; } = "the-ugly";
private VatAddress vatAddress = new(); private VatAddress _vatAddress = new();
private bool _validVat; private bool _validVat;
private bool _hasFolded; private bool _hasFolded;
private bool _formInvalid = true; private bool _formInvalid = true;
private string _orgVat; private string _orgVat;
private string countryCode = "dk"; private string _countryCode = "dk";
private string _visitState = "the-ugly"; private string _visitState = "the-ugly";
private int _enableActivity = 1; private int _enableActivity = 1;
private bool _hideButtons = false; private bool _hideButtons = false;
@ -64,6 +64,8 @@ public partial class CustomerViewPage : IDisposable
private bool _working; private bool _working;
private string _btnUpdateText = "Opdater"; private string _btnUpdateText = "Opdater";
private bool _dk { get; set; } = true; private bool _dk { get; set; } = true;
private int _isDirty { get; set; }
private int _vatUpdated { get; set; }
private readonly JsonSerializerOptions _options = new () private readonly JsonSerializerOptions _options = new ()
{ {
@ -73,7 +75,7 @@ public partial class CustomerViewPage : IDisposable
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
var ux = await _storage.GetItemAsync<UserInfoView>("_xu"); var ux = await _storage.GetItemAsync<UserInfoView>("_xu");
countryCode = ux.CountryCode; _countryCode = ux.CountryCode;
_dk = ux.CountryCode.ToLower() == "dk"; _dk = ux.CountryCode.ToLower() == "dk";
_interceptor.RegisterEvent(); _interceptor.RegisterEvent();
@ -88,7 +90,7 @@ public partial class CustomerViewPage : IDisposable
_enableActivity = 1; _enableActivity = 1;
if (_dk) if (_dk)
vatAddress = PrepareVatAddress(_company); _vatAddress = PrepareVatAddress(_company);
if (_company.Interval == 0) if (_company.Interval == 0)
_company.Interval = 8; _company.Interval = 8;
@ -129,7 +131,7 @@ public partial class CustomerViewPage : IDisposable
{ {
_nextVisit = _lastVisit.AddDays(_company.Interval * 7); _nextVisit = _lastVisit.AddDays(_company.Interval * 7);
// simple format validation if CRM indicates invalid vatNumber // simple validation of VAT format
if (!VatUtils.ValidateFormat(_company.CountryCode, _company.VatNumber)) if (!VatUtils.ValidateFormat(_company.CountryCode, _company.VatNumber))
{ {
_formInvalid = true; _formInvalid = true;
@ -138,6 +140,9 @@ public partial class CustomerViewPage : IDisposable
{ {
_formInvalid = !_editContext.Validate(); _formInvalid = !_editContext.Validate();
} }
if(_vatUpdated == 0)
_isDirty = 1;
StateHasChanged(); StateHasChanged();
} }
@ -164,14 +169,17 @@ public partial class CustomerViewPage : IDisposable
StateHasChanged(); StateHasChanged();
return; return;
} }
_toast.ShowInfo("Vent venligst ....");
_hideButtons = true; _hideButtons = true;
_company.LastVisit = $"{_lastVisit:yyyy-MM-dd}"; _company.LastVisit = $"{_lastVisit:yyyy-MM-dd}";
_company.NextVisit = $"{_nextVisit:yyyy-MM-dd}"; _company.NextVisit = $"{_nextVisit:yyyy-MM-dd}";
_company.IsHidden = 0; _company.IsHidden = 0;
// flag if backend should update ERP system // flag if backend should update ERP system
if (_company.VatNumber != _orgVat) _company.UpdateErpVat = _vatUpdated;
_company.UpdateErpVat = 1;
// flag base info has changed
_company.IsDirty = _isDirty;
var success = await _companyRepo.UpdateCompany(CompanyId, _company ); var success = await _companyRepo.UpdateCompany(CompanyId, _company );
if (success) if (success)
@ -209,10 +217,12 @@ public partial class CustomerViewPage : IDisposable
_company.Address2 = _virkRegInfo.CoName; _company.Address2 = _virkRegInfo.CoName;
_company.ZipCode = _virkRegInfo.ZipCode; _company.ZipCode = _virkRegInfo.ZipCode;
_company.City = _virkRegInfo.City; _company.City = _virkRegInfo.City;
_isDirty = 1;
} }
else else
{ {
_company.VatNumber = _virkRegInfo.VatNumber; _company.VatNumber = _virkRegInfo.VatNumber;
_vatUpdated = 1;
} }
// empty list // empty list
_vInfos = new List<VirkRegInfo>(); _vInfos = new List<VirkRegInfo>();

View file

@ -20,7 +20,7 @@
@page "/sales-reports/view/{ReportDate}" @page "/sales-reports/view/{ReportDate}"
@attribute [Authorize(Roles = "Advisor,Admin,Supervisor")] @attribute [Authorize(Roles = "Advisor,Admin,Supervisor")]
<div class="report-page"> <div class="report-main">
<div class="row mb-3 d-print-none"> <div class="row mb-3 d-print-none">
<div class="col-md-6 align-content-center"> <div class="col-md-6 align-content-center">
<h3 class="workDate">@DateTime.Parse(ReportDate).ToLongDateString()</h3> <h3 class="workDate">@DateTime.Parse(ReportDate).ToLongDateString()</h3>
@ -58,7 +58,7 @@
} }
</div> </div>
<div class="report-page"> <div class="report-main">
&nbsp; &nbsp;
</div> </div>

View file

@ -20,8 +20,7 @@
@page "/admin/users/advisors/{CountryCode}/{UserId}/reports/{ReportDate}" @page "/admin/users/advisors/{CountryCode}/{UserId}/reports/{ReportDate}"
@attribute [Authorize(Roles = "Admin")] @attribute [Authorize(Roles = "Admin")]
<div class="report-page"> <div class="report-main">
<div class="row mb-3 d-print-none"> <div class="row mb-3 d-print-none">
<div class="col-md-6 align-content-center"> <div class="col-md-6 align-content-center">
<h3 class="workDate">@DateTime.Parse(ReportDate).ToLongDateString()</h3> <h3 class="workDate">@DateTime.Parse(ReportDate).ToLongDateString()</h3>
@ -33,7 +32,6 @@
<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>
</div> </div>
@if (!string.IsNullOrWhiteSpace(Report.ReportData.DayTypeEnum)) @if (!string.IsNullOrWhiteSpace(Report.ReportData.DayTypeEnum))
{ {
<PageTitle>@Report.ReportData.Name</PageTitle> <PageTitle>@Report.ReportData.Name</PageTitle>
@ -59,11 +57,6 @@
<div class="col">Ingen data</div> <div class="col">Ingen data</div>
</div> </div>
} }
</div>
<div class="report-page">
&nbsp;
</div> </div>
@if (_items.Any()) @if (_items.Any())

View file

@ -1,13 +1,13 @@
{ {
"appInfo": { "appInfo": {
"name": "Wonky Client", "name": "Wonky Client",
"version": "0.11.122", "version": "0.12.1",
"rc": false, "rc": false,
"sandBox": false, "sandBox": false,
"image": "grumpy-coder.png" "image": "grumpy-coder.png"
}, },
"apiConfig": { "apiConfig": {
"innoBaseUrl": "https://eta.innotec.dk", "innoBaseUrl": "https://dev.innotec.dk",
"glsTrackUrl": "https://www.gls-group.eu/276-I-PORTAL-WEB/content/GLS/DK01/DA/5004.htm?txtAction=71000&txtRefNo=", "glsTrackUrl": "https://www.gls-group.eu/276-I-PORTAL-WEB/content/GLS/DK01/DA/5004.htm?txtAction=71000&txtRefNo=",
"glsId": "", "glsId": "",
"serviceVirk": "api/v2/services/virk", "serviceVirk": "api/v2/services/virk",

View file

@ -148,12 +148,10 @@ footer.version {
-webkit-print-color-adjust: exact; -webkit-print-color-adjust: exact;
color-adjust: exact; color-adjust: exact;
} }
.report-page { .report-main {
font-size: 10px;
break-after: page; break-after: page;
/*break-before: page;*/
height: initial; height: initial;
border: initial; border: initial;
border-radius: initial; border-radius: initial;
box-shadow: initial; box-shadow: initial;
@ -162,10 +160,9 @@ footer.version {
-webkit-print-color-adjust: exact; -webkit-print-color-adjust: exact;
color-adjust: exact; color-adjust: exact;
} }
.report-page-item { .report-visit {
break-after: page; break-before: page;
break-inside: avoid-page; break-inside: avoid-page;
height: initial; height: initial;
border: initial; border: initial;
border-radius: initial; border-radius: initial;

View file

@ -17,7 +17,7 @@
<base href="/" /> <base href="/" />
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" /> <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" />
<link href="flag-icons/flag-icons.css" rel="stylesheet" /> <link href="flag-icons/flag-icons.css" rel="stylesheet" />
<link href="css/app-v0.10.101.css" rel="stylesheet" /> <link href="css/app-v0.12.0.css" rel="stylesheet" />
<link href="Wonky.Client.styles.css" rel="stylesheet" /> <link href="Wonky.Client.styles.css" rel="stylesheet" />
<link href="_content/Blazored.Toast/blazored-toast.min.css" rel="stylesheet" /> <link href="_content/Blazored.Toast/blazored-toast.min.css" rel="stylesheet" />
</head> </head>

View file

@ -155,6 +155,8 @@ public class CompanyDto
/// </summary> /// </summary>
public string HistorySync { get; set; } = ""; public string HistorySync { get; set; } = "";
public int IsDirty { get; set; } = 0;
/// <summary> /// <summary>
/// Virtual property indicating if timespan is within the defined interval /// Virtual property indicating if timespan is within the defined interval
/// </summary> /// </summary>

View file

@ -30,6 +30,10 @@ public class ReportItemView
/// </summary> /// </summary>
public bool Closed { get; set; } public bool Closed { get; set; }
/// <summary> /// <summary>
/// ProcessStatus as string
/// </summary>
public string ProcessStatusEnum { get; set; } = "";
/// <summary>
/// express flag /// express flag
/// </summary> /// </summary>
public bool Express { get; set; } public bool Express { get; set; }