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
<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"/>
</div>

View file

@ -20,6 +20,7 @@
<table class="table table-bordered d-print-table table-striped">
<thead>
<tr class="bg-dark text-white opacity-75 border-bottom">
<th></th>
<th scope="col">Kunde</th>
<th scope="col">Bynavn</th>
<th scope="col">Demo</th>
@ -36,6 +37,10 @@
@foreach (var activity in Activities)
{
<tr>
<td class="state align-middle">
@activity.ProcessStatusEnum
@* <DisplayStateComponent StateClass="@(GetProcessStatus(activity.ProcessStatusEnum))" /> *@
</td>
<td>@activity.Company.Name</td>
<td>@activity.Company.City</td>
<td>@activity.Demo</td>
@ -43,9 +48,18 @@
<td>@activity.OfficeNote</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-center">@if(activity.OurRef.Contains("T:")){<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>
<td class="text-center">
@if (activity.OurRef.Contains("T:"))
{<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>

View file

@ -21,4 +21,16 @@ namespace Wonky.Client.Components;
public partial class ActivityTableComponent
{
[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
<div class="report-page-item d-block">
<div class="report-visit d-block">
<table class="table table-sm table-striped d-print-table">
<thead>
<tr>

View file

@ -28,7 +28,7 @@
<WorkDateComponent OnChanged="GetActivities" />
</div>
<div class="col-md-3">
<KmMorningComponent />
<ActivityKmStartComponent />
</div>
<div class="col-md-2">
@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]
//
using System.Text.Json;
using Blazored.Toast.Services;
using Microsoft.AspNetCore.Components;
using Wonky.Client.Components;
@ -58,6 +59,7 @@ public partial class ActivityTodayListPage : IDisposable
_workDate = workDate;
ReportItemListView = new ReportItemListView();
ReportItemListView = await _activityRepo.GetActivities(workDate);
_logger.LogDebug("Activities => {}", JsonSerializer.Serialize(ReportItemListView));
Loading = false;
}

View file

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

View file

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

View file

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

View file

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

View file

@ -1,13 +1,13 @@
{
"appInfo": {
"name": "Wonky Client",
"version": "0.11.122",
"version": "0.12.1",
"rc": false,
"sandBox": false,
"image": "grumpy-coder.png"
},
"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=",
"glsId": "",
"serviceVirk": "api/v2/services/virk",

View file

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

View file

@ -17,7 +17,7 @@
<base href="/" />
<link href="bootstrap/css/bootstrap.min.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="_content/Blazored.Toast/blazored-toast.min.css" rel="stylesheet" />
</head>

View file

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

View file

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