Update con toast post timbrature
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
</div>
|
||||
|
||||
|
||||
@if (isRecording)
|
||||
@if (isRecording && false)
|
||||
{
|
||||
<dialog class="modal fade show" tabindex="-1" style="display:block; background-color: rgba(10,10,10,.6);" aria-modal="true" role="dialog">
|
||||
<div class="modal-dialog modal-xl">
|
||||
@@ -43,4 +43,19 @@
|
||||
</div>
|
||||
</div>
|
||||
</dialog>
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
<div class="toast-container p-3 bottom-0 start-50 translate-middle-x">
|
||||
<div class="toast bg-light fade @toastCss" id="LiveToast2" role="alert" aria-live="assertive" aria-atomic="true">
|
||||
<div class="toast-header">
|
||||
<span class="bg-primary px-2 text-light rounded me-2"><i class="fa-solid fa-clock"></i></span>
|
||||
<strong class="me-auto">Timbratura</strong>
|
||||
<small>@textDtAct</small>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="toast-body">
|
||||
@lastAction
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -4,6 +4,7 @@ using GPW.CORE.Data.DTO;
|
||||
using GPW.CORE.Smart.Data;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
using Org.BouncyCastle.Security;
|
||||
using System.Data;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
@@ -183,18 +184,26 @@ namespace GPW.CORE.Smart.Components
|
||||
private async Task registraTimbratura(bool isEntrata)
|
||||
{
|
||||
DateTime adesso = DateTime.Now;
|
||||
string lastAct = isEntrata ? "Entrata" : "Uscita";
|
||||
lastAction = $"Registrato {lastAct} alle ore {adesso:HH:mm}";
|
||||
textDtAct=$"{adesso:dddd dd.MM.yyyy}";
|
||||
string lastAct = isEntrata ? "INGRESSO" : "USCITA";
|
||||
lastAction = $"Registrato evento {lastAct} alle {adesso:HH:mm}";
|
||||
// inidico inizio update
|
||||
isRecording = true;
|
||||
DoAdd(!isEntrata);
|
||||
nextIsEntrata = !isEntrata;
|
||||
MService.ReportTimbratura();
|
||||
// chiudo visualizzazione stato update
|
||||
await Task.Delay(1500);
|
||||
await Task.Delay(3000);
|
||||
isRecording = false;
|
||||
}
|
||||
|
||||
private string textDtAct = "";
|
||||
|
||||
private string toastCss
|
||||
{
|
||||
get => isRecording ? "show" : "";
|
||||
}
|
||||
|
||||
private async Task doRichiesta(bool isEntrata)
|
||||
{
|
||||
TimbratureModel currRecord = new TimbratureModel();
|
||||
|
||||
@@ -1,43 +1,50 @@
|
||||
@page "/TestCal"
|
||||
|
||||
|
||||
<h3>TestCal</h3>
|
||||
|
||||
<div class="row bg-dark text-light">
|
||||
<div class="col text-center">
|
||||
<h3>Test Page</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row bg-dark">
|
||||
<div class="col">
|
||||
<CircleGauge maxVal="480" currVal="120" Titolo="2:00" Testo="Lavorate"></CircleGauge>
|
||||
</div>
|
||||
<div class="col">
|
||||
<CircleGauge maxVal="480" currVal="240" Titolo="4:00" Testo="Lavorate"></CircleGauge>
|
||||
</div>
|
||||
<div class="col">
|
||||
<CircleGauge maxVal="480" currVal="360" Titolo="6:00" Testo="Lavorate"></CircleGauge>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row bg-dark">
|
||||
<div class="col">
|
||||
<CircleGauge maxVal="480" currVal="480" Titolo="8:00" Testo="Lavorate"></CircleGauge>
|
||||
</div>
|
||||
<div class="col">
|
||||
<CircleGauge maxVal="480" currVal="600" Titolo="10:00" Testo="Lavorate"></CircleGauge>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@*
|
||||
<div class="row bg-dark py-3">
|
||||
<div class="col">
|
||||
<CalendarMonth DtRif="@dtCurr" MainCss="table table-dark table-borderless" DateSelected="DisplayDate" DateCheck="@DateCheck" SingleWeek="@singleWeek"></CalendarMonth>
|
||||
<CircleGauge maxVal="480" currVal="720" Titolo="12:00" Testo="Lavorate"></CircleGauge>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="d-flex justify-content-between">
|
||||
<div>
|
||||
<b>@($"{dtCurr:ddd dd.MM.yyyy}")</b>
|
||||
</div>
|
||||
<div>
|
||||
<button class="btn btn-primary" @onclick="() => resetCal()">Reset</button>
|
||||
</div>
|
||||
<div>
|
||||
single: <b>@singleWeek</b>
|
||||
<div class="row bg-dark">
|
||||
<div class="col text-center">
|
||||
<button id="ToastBtn2" class="btn btn-success" @onclick="toggleShow">Mostra toast</button>
|
||||
</div>
|
||||
</div>
|
||||
*@
|
||||
|
||||
<div class="toast-container p-3 bottom-0 start-50 translate-middle-x">
|
||||
<div class="toast bg-light fade @toastCss" id="LiveToast2" role="alert" aria-live="assertive" aria-atomic="true">
|
||||
<div class="toast-header">
|
||||
<span class="bg-primary px-2 text-light rounded me-2"><i class="fa-solid fa-clock"></i></span>
|
||||
<strong class="me-auto">Timbratura</strong>
|
||||
<small>@dtAction</small>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="toast-body">
|
||||
@messaggio
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -7,29 +7,13 @@ namespace GPW.CORE.Smart.Pages
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
dtCurr = DateTime.Today;
|
||||
await Task.Delay(1);
|
||||
DateCheck = new Dictionary<DateTime, string>();
|
||||
Random rnd = new Random();
|
||||
// random colorate...
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
DateTime newDate = dtCurr.AddDays(rnd.Next(-5, 10)).Date;
|
||||
if (!DateCheck.ContainsKey(newDate))
|
||||
{
|
||||
DateCheck.Add(newDate, "bg-success text-light rounded-circle p-2");
|
||||
}
|
||||
else
|
||||
{
|
||||
DateCheck[newDate] = "bg-warning text-light rounded-circle p-2";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private Dictionary<DateTime, string> DateCheck = new Dictionary<DateTime, string>();
|
||||
private bool showToast = false;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
@@ -37,22 +21,25 @@ namespace GPW.CORE.Smart.Pages
|
||||
|
||||
private DateTime dtCurr { get; set; } = DateTime.Today;
|
||||
|
||||
private bool singleWeek = false;
|
||||
private string toastCss
|
||||
{
|
||||
get => showToast ? "show" : "";
|
||||
}
|
||||
|
||||
protected string dtAction = "";
|
||||
protected string messaggio = "";
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private void DisplayDate(DateTime dtSel)
|
||||
private void toggleShow()
|
||||
{
|
||||
dtCurr = dtSel;
|
||||
singleWeek = true;
|
||||
}
|
||||
|
||||
private async Task resetCal()
|
||||
{
|
||||
singleWeek = false;
|
||||
await Task.Delay(1);
|
||||
DateTime adesso = DateTime.Now;
|
||||
dtAction = $"{adesso:dddd dd.MM.yyyy}";
|
||||
string tipo = adesso.Second % 2 == 0 ? "INGRESSO" : "USCITA";
|
||||
messaggio = $"Registrato evento {tipo} alle {adesso:HH:mm}";
|
||||
showToast = !showToast;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
Reference in New Issue
Block a user