cosmetic update of company list

add history reload to activity page
allow km morning to be edited
This commit is contained in:
Frede Hundewadt 2023-06-28 11:20:08 +02:00
parent cb00711bbc
commit 5258adfa07
10 changed files with 93 additions and 288 deletions

View file

@ -17,6 +17,7 @@
@using Wonky.Client.Components;
@using Wonky.Client.Helpers;
@using Wonky.Client.OverlayOffice
@if (CompanyList.Any())
{
<div class="row mt-2 d-flex g-3">
@ -24,8 +25,8 @@
{
<div class="col-sm-6">
<div class="card">
<div class="card-header">
@company.Name
<div class="card-header fw-bold @(company.HasFolded == 1 ? "alert alert-dark" : "alert alert-success")">
@company.Name @(company.HasFolded == 1 ? "(OPHØRT)" : "")
</div>
<div class="card-body">
<table class="table">
@ -33,7 +34,7 @@
<th scope="row">Konto</th>
<td>@company.Account</td>
<th scope="row">Org Nr.</th>
<td>@(string.IsNullOrWhiteSpace(@company.VatNumber) ? "~/~" : @company.VatNumber) </td>
<td>@(string.IsNullOrWhiteSpace(@company.VatNumber) ? "mangler" : @company.VatNumber) </td>
</tr>
<tr>
<th scope="row">Telefon</th>
@ -58,13 +59,13 @@
<tr>
<th scope="row">Sidst besøgt</th>
<td>
@company.LastVisit <DisplayStateComponent StateClass="@(company.HasFolded == 1 ? "the-dead" : Utils.MapVisitState(company.NextVisit))"/>
@(Utils.MapVisitState(company.LastVisit) == "the-draw" ? "?" : company.LastVisit)
</td>
</tr>
<tr>
<th scope="row">Næste besøg</th>
<td>
@company.NextVisit <DisplayStateComponent StateClass="@(company.HasFolded == 1 ? "the-dead" : Utils.MapVisitState(company.NextVisit))"/>
@(Utils.MapVisitState(company.LastVisit) == "the-draw" ? "?" : company.NextVisit)
</td>
</tr>
</table>

View file

@ -48,9 +48,12 @@ else
</div>
}
<div class="row mb-2 bg-dark text-white rounded-3 p-3">
<div class="col">
<div class="col-sm-9">
<span class="h3">@_activity.Name</span> <span>(@_activity.Account)</span>
</div>
<div class="col-sm-3 text-end">
<button type="button" class="btn btn-sm btn-secondary" disabled="@(_company.Account.StartsWith("NY") || _disableButtons)" @onclick="@(() => ReloadHistory(true))"><i class="bi-repeat"></i> Historik</button>
</div>
</div>
<EditForm EditContext="_formContext">
@ -204,19 +207,19 @@ else
@*
***************** Invoice history overlay *****************************
*@
<button class="btn btn-danger" disabled="@string.IsNullOrWhiteSpace(_activity.ActivityTypeEnum)" @onclick="@ShowInvoiceOverlay">Faktura</button>
<button class="btn btn-danger" disabled="@(string.IsNullOrWhiteSpace(_activity.ActivityTypeEnum) || _disableButtons)" @onclick="@ShowInvoiceOverlay">Faktura</button>
</div>
<div class="col-sm-3 d-grid mx-auto">
@*
***************** Visit hisotry overlay *****************************
*@
<button class="btn btn-warning" disabled="@string.IsNullOrWhiteSpace(_activity.ActivityTypeEnum)" @onclick="@ShowActivitiesOverlay">Tidl. besøg</button>
<button class="btn btn-warning" disabled="@(string.IsNullOrWhiteSpace(_activity.ActivityTypeEnum) || _disableButtons)" @onclick="@ShowActivitiesOverlay">Tidl. besøg</button>
</div>
<div class="col-sm-3 d-grid mx-auto">
@*
***************** Product Inventory overlay *****************************
*@
<button class="btn btn-success" disabled="@string.IsNullOrWhiteSpace(_activity.ActivityTypeEnum)" @onclick="@ShowInventoryOverlay">Produkter</button>
<button class="btn btn-success" disabled="@(string.IsNullOrWhiteSpace(_activity.ActivityTypeEnum) || _disableButtons)" @onclick="@ShowInventoryOverlay">Produkter</button>
</div>
</div>

View file

@ -84,7 +84,6 @@ public partial class AdvisorActivityCreatePage : IDisposable
private CompanyDto _company = new();
private bool _kanvas;
private bool _hideDeliveryAddress = true;
private InfoDrawer _infoDrawer = new();
private ActivityDrawer _activityDrawer = new();
private InventoryDrawer _inventoryDrawer = new();
private InvoiceDrawer _invoiceDrawer = new();
@ -94,6 +93,7 @@ public partial class AdvisorActivityCreatePage : IDisposable
private EditContext _formContext;
private UserManagerEditView _salesRep = new();
private bool _formInvalid = true;
private bool _disableButtons = true;
protected override async Task OnInitializedAsync()
@ -110,18 +110,6 @@ public partial class AdvisorActivityCreatePage : IDisposable
_company = await CompanyRepo.GetCompanyById(CompanyId);
if (!_company.Account.StartsWith("NY"))
{
_inventoryDrawer = await DrawerService.GetInventoryDrawerAsync(CompanyId, true);
_invoiceDrawer = await DrawerService.GetInvoiceDrawerAsync(CompanyId, true);
}
_infoDrawer.Content = _company;
_infoDrawer.LastDateModified = DateTime.Today;
await DrawerService.StoreInfoDrawerAsync(CompanyId, _infoDrawer);
_activityDrawer = await DrawerService.GetActivityDrawerAsync(CompanyId, true);
if (_company.Account.StartsWith("KANVAS"))
{
_kanvas = true;
@ -221,6 +209,51 @@ public partial class AdvisorActivityCreatePage : IDisposable
StateHasChanged();
}
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
if (!_company.Account.StartsWith("NY"))
{
_inventoryDrawer = await DrawerService.GetInventoryDrawerAsync(CompanyId, true);
_invoiceDrawer = await DrawerService.GetInvoiceDrawerAsync(CompanyId, true);
}
_activityDrawer = await DrawerService.GetActivityDrawerAsync(CompanyId, true);
}
if (!_company.Account.StartsWith("NY"))
{
_disableButtons = false;
}
}
private async Task ReloadHistory(bool force = false)
{
if (force)
{
Toaster.ShowInfo("Afventer svar fra tjenester ...");
}
_disableButtons = true;
var newSync = await HistoryRepo.RequestErpSync(CompanyId, _company.HistorySync, force);
await Task.Delay(500);
if (!string.IsNullOrWhiteSpace(newSync))
{
_company.HistorySync = newSync;
_invoiceDrawer = await DrawerService.GetInvoiceDrawerAsync(CompanyId, force);
_inventoryDrawer = await DrawerService.GetInventoryDrawerAsync(CompanyId, force);
_activityDrawer = await DrawerService.GetActivityDrawerAsync(CompanyId, force);
}
StateHasChanged();
if (force)
{
Toaster.ShowSuccess("Alle tjenester har svaret.");
}
_disableButtons = false;
}
private async Task TestOrgNumber()
{

View file

@ -247,6 +247,7 @@ public partial class AdvisorCustomerViewEditPage : IDisposable
await Task.Delay(500);
if (!string.IsNullOrWhiteSpace(newSync))
{
_company.HistorySync = newSync;
if (!_company.Account.StartsWith("NY"))
{
_ = await DrawerService.GetInvoiceDrawerAsync(CompanyId, force);

View file

@ -149,7 +149,7 @@
</td>
<td>
<InputNumber class="form-control" @bind-Value="@Report.Figures.KmMorning"
disabled="@(NoFigures)" readonly/>
disabled="@(NoFigures)"/>
</td>
<td>
<InputNumber class="form-control" @bind-Value="@Report.Figures.Distance"

View file

@ -82,6 +82,7 @@ public partial class AdvisorReportCreatePage : IDisposable
PreferenceService.OnChange += ProfileServiceOnOnChange;
Preference = await PreferenceService.GetProfile();
KmMorning = await PreferenceService.GetKmMorning();
Logger.LogDebug("{}", JsonSerializer.Serialize(Preference));
@ -145,6 +146,7 @@ public partial class AdvisorReportCreatePage : IDisposable
Activities = data.ReportItems;
CurrKmMonth = data.ReportData.DistanceMonth;
CurrKmPrivate = data.ReportData.DistancePrivate;
if (Report.DayTypeEnum.ToLower().Contains("leave"))
{
// ensure no distances in calculation
@ -154,12 +156,12 @@ public partial class AdvisorReportCreatePage : IDisposable
}
else
{
Report.Figures.KmMorning = KmMorning;
Report.Figures.KmMorning = KmMorning;
}
NoFigures = false;
Working = false;
}
}
/// <summary>
/// Field data change event
/// </summary>
@ -169,10 +171,14 @@ public partial class AdvisorReportCreatePage : IDisposable
{
// Console.WriteLine($"e FieldName => {e.FieldIdentifier.FieldName}");
FormInvalid = !ReportContext.Validate();
if (KmMorning == 0)
{
KmMorning = Report.Figures.KmMorning;
}
Report.Figures.Distance = Report.Figures.KmEvening - Report.Figures.KmMorning;
Report.Figures.DistanceMonth = Report.Figures.Distance + CurrKmMonth;
Report.Figures.DistancePrivateMonth = Report.Figures.DistancePrivate + CurrKmPrivate;
if (Report.Figures.Distance is > 1000 or < 0)
if (Report.Figures.Distance is > 1000 or < 0 && Report.Figures.KmMorning > 0)
{
Toaster.ShowError($"Kørte km for rapporten er '{Report.Figures.Distance}'. Er du sikker på at det er rigtigt?");
}
@ -268,8 +274,8 @@ public partial class AdvisorReportCreatePage : IDisposable
// pop confirmation
// create a prompt for popup confirmation
var warning = Report.Figures.KmEvening - Report.Figures.KmMorning > 1000
? $"Kørte km for rapporten er '{Report.Figures.KmEvening - Report.Figures.KmMorning}'. Er du sikker på at det er rigtigt?<br/>"
var warning = Report.Figures.KmEvening - Report.Figures.KmMorning is > 1000 or < 0
? $"Kørte km for rapporten er <strong>'{Report.Figures.KmEvening - Report.Figures.KmMorning}'</strong>. Er du sikker på at det er rigtigt?<br/>"
: "";
Prompt = $"{warning}<br/>Gem rapport for {ThisWorkDate.ToLongDateString()}?";

View file

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

View file

@ -1,252 +0,0 @@
body {
font-size: 16px;
}
.draft-expires-msg {
font-size: 0.8em;
}
.busy-signal {
float: right;
z-index: 100;
position: relative;
top: 1px;
right: 10px;
}
.workDate {
font-variant: small-caps;
}
.action-link-element {
cursor: pointer;
}
.i-larger {
font-size: 1.3rem;
}
.btn.btn-edit {
color: #030303;
background-color: #a2a2ec;
}
html, body {
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
h1,h2:focus {
outline: none;
}
a, .btn-link {
color: #0071c1;
}
/*.btn-primary {*/
/* color: #fff;*/
/* background-color: #1b6ec2;*/
/* border-color: #1861ac;*/
/*}*/
.inno {
color: #ffaa00;
}
.inno-display {
display: block;
}
.inno-hidden {
display: none;
}
.content {
padding-top: 1.1rem;
}
.valid.modified:not([type=checkbox]) {
outline: 1px solid #26b050;
}
.invalid {
outline: 1px solid red;
}
.validation-message {
color: red;
}
/* begin state elements */
.state {
width: 16px;
height: 16px;
min-width: 16px;
min-height: 16px;
}
.the-good {
color: green;
}
.the-bad {
color: orange;
}
.the-ugly {
color: red;
}
.the-dead {
color: black;
}
.the-fast {
color: orange;
}
.the-draw {
color: mediumpurple;
}
.the-good-bg {
background-color: green;
}
.the-bad-bg {
background-color: orange;
}
.the-ugly-bg {
background-color: red;
}
.the-draw-bg {
background-color: mediumpurple;
}
.no-vat-bg {
background-color: lightskyblue;
}
.the-dead-bg {
background-color: black;
}
/* end state elements */
/* led elements */
.led-box {
height: 24px;
width: 24px;
margin: auto;
float: left;
}
.led-red {
margin: 5px;
width: 24px;
height: 24px;
background-color: #F00;
border-radius: 50%;
box-shadow: rgba(0, 0, 0, 0.2) 0 -1px 7px 1px, inset #441313 0 -1px 9px, rgba(255, 0, 0, 0.5) 0 2px 12px;
-webkit-animation: blinkRed 0.5s infinite;
-moz-animation: blinkRed 0.5s infinite;
-ms-animation: blinkRed 0.5s infinite;
-o-animation: blinkRed 0.5s infinite;
animation: blinkRed 0.5s infinite;
animation-iteration-count: infinite;
}
@-webkit-keyframes blinkRed {
from { background-color: #F00; }
50% { background-color: #A00; box-shadow: rgba(0, 0, 0, 0.2) 0 -1px 7px 1px, inset #441313 0 -1px 9px, rgba(255, 0, 0, 0.5) 0 2px 0;}
to { background-color: #F00; }
}
@-moz-keyframes blinkRed {
from { background-color: #F00; }
50% { background-color: #A00; box-shadow: rgba(0, 0, 0, 0.2) 0 -1px 7px 1px, inset #441313 0 -1px 9px, rgba(255, 0, 0, 0.5) 0 2px 0;}
to { background-color: #F00; }
}
@-ms-keyframes blinkRed {
from { background-color: #F00; }
50% { background-color: #A00; box-shadow: rgba(0, 0, 0, 0.2) 0 -1px 7px 1px, inset #441313 0 -1px 9px, rgba(255, 0, 0, 0.5) 0 2px 0;}
to { background-color: #F00; }
}
@-o-keyframes blinkRed {
from { background-color: #F00; }
50% { background-color: #A00; box-shadow: rgba(0, 0, 0, 0.2) 0 -1px 7px 1px, inset #441313 0 -1px 9px, rgba(255, 0, 0, 0.5) 0 2px 0;}
to { background-color: #F00; }
}
@keyframes blinkRed {
from { background-color: #F00; }
50% { background-color: #A00; box-shadow: rgba(0, 0, 0, 0.2) 0 -1px 7px 1px, inset #441313 0 -1px 9px, rgba(255, 0, 0, 0.5) 0 2px 0;}
to { background-color: #F00; }
}
.led-yellow {
margin: 0 auto;
width: 24px;
height: 24px;
background-color: #FF0;
border-radius: 50%;
box-shadow: rgba(0, 0, 0, 0.2) 0 -1px 7px 1px, inset #808002 0 -1px 9px, #FF0 0 2px 12px;
-webkit-animation: blinkYellow 1s infinite;
-moz-animation: blinkYellow 1s infinite;
-ms-animation: blinkYellow 1s infinite;
-o-animation: blinkYellow 1s infinite;
animation: blinkYellow 1s infinite;
}
@-webkit-keyframes blinkYellow {
from { background-color: #FF0; }
50% { background-color: #AA0; box-shadow: rgba(0, 0, 0, 0.2) 0 -1px 7px 1px, inset #808002 0 -1px 9px, #FF0 0 2px 0; }
to { background-color: #FF0; }
}
@-moz-keyframes blinkYellow {
from { background-color: #FF0; }
50% { background-color: #AA0; box-shadow: rgba(0, 0, 0, 0.2) 0 -1px 7px 1px, inset #808002 0 -1px 9px, #FF0 0 2px 0; }
to { background-color: #FF0; }
}
@-ms-keyframes blinkYellow {
from { background-color: #FF0; }
50% { background-color: #AA0; box-shadow: rgba(0, 0, 0, 0.2) 0 -1px 7px 1px, inset #808002 0 -1px 9px, #FF0 0 2px 0; }
to { background-color: #FF0; }
}
@-o-keyframes blinkYellow {
from { background-color: #FF0; }
50% { background-color: #AA0; box-shadow: rgba(0, 0, 0, 0.2) 0 -1px 7px 1px, inset #808002 0 -1px 9px, #FF0 0 2px 0; }
to { background-color: #FF0; }
}
@keyframes blinkYellow {
from { background-color: #FF0; }
50% { background-color: #AA0; box-shadow: rgba(0, 0, 0, 0.2) 0 -1px 7px 1px, inset #808002 0 -1px 9px, #FF0 0 2px 0; }
to { background-color: #FF0; }
}
.led-green {
margin: 0 auto;
width: 24px;
height: 24px;
background-color: #ABFF00;
border-radius: 50%;
box-shadow: rgba(0, 0, 0, 0.2) 0 -1px 7px 1px, inset #304701 0 -1px 9px, #89FF00 0 2px 12px;
}
.led-blue {
margin: 0 auto;
width: 24px;
height: 24px;
background-color: #24E0FF;
border-radius: 50%;
box-shadow: rgba(0, 0, 0, 0.2) 0 -1px 7px 1px, inset #006 0 -1px 9px, #3F8CFF 0 2px 14px;
}
/* end led elements */
.footer {
border-top: 2px solid orange;
position: relative;
margin-top: -150px;
height: 150px;
width: 100%;
clear: both;
padding-top: 20px;
}
footer.version {
display: block;
font-weight: bold;
padding: 0 10px 0 0;
}
.back-to-top {
position: fixed;
bottom: 25px;
right: 25px;
display: none;
}

View file

@ -83,39 +83,52 @@ a, .btn-link {
min-height: 16px;
}
.the-good {
color: green;
color: white;
background-color: green;;
}
.the-bad {
color: orange;
color: black;
background-color: orange;
}
.the-ugly {
color: red;
color: black;
background-color: red;
}
.the-dead {
color: black;
color: white;
background-color: black;
}
.the-fast {
color: orange;
color: black;
background-color: orange;
}
.the-draw {
color: mediumpurple;
color: black;
background-color: mediumpurple;
}
.the-good-bg {
color: white;
background-color: green;
}
.the-bad-bg {
color: black;
background-color: orange;
}
.the-ugly-bg {
color: black;
background-color: red;
}
.the-draw-bg {
color: white;
background-color: mediumpurple;
}
.no-vat-bg {
color: black;
background-color: lightskyblue;
}
.the-dead-bg {
color: white;
background-color: black;
}
/* end state elements */

View file

@ -14,7 +14,7 @@
<link href="/bootstrap/css/bootstrap.min.css" rel="stylesheet" >
<link href="/bootstrap/css/bootstrap-icons.min.css" rel="stylesheet" >
<link href="/flag-icons/flag-icons.css" rel="stylesheet" >
<link href="/css/20230614.css" rel="stylesheet" >
<link href="/css/app.css" rel="stylesheet" >
<link href="/css/print.css" rel="stylesheet" >
<link href="/Wonky.Client.styles.css" rel="stylesheet" >
<link href="/_content/Blazored.Toast/Blazored.Toast.bundle.scp.css" rel="stylesheet" >