From bf9241aacb566ecf36ca9bb5ae93424b15986e95 Mon Sep 17 00:00:00 2001 From: "zaccaria.majid" Date: Fri, 13 Jan 2023 17:22:44 +0100 Subject: [PATCH] =?UTF-8?q?Aggiunta=20modalit=C3=A0=20calcolo=20timbratura?= =?UTF-8?q?=20approvata?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GPW.CORE.SMART/Components/Calendario.razor | 20 +++---- GPW.CORE.SMART/Components/Calendario.razor.cs | 53 ++++++++++++++++++- .../Components/Calendario.razor.css | 18 +++++++ .../Components/Calendario.razor.less | 21 ++++++++ .../Components/Calendario.razor.min.css | 2 +- 5 files changed, 103 insertions(+), 11 deletions(-) diff --git a/GPW.CORE.SMART/Components/Calendario.razor b/GPW.CORE.SMART/Components/Calendario.razor index 150a575..e328c59 100644 --- a/GPW.CORE.SMART/Components/Calendario.razor +++ b/GPW.CORE.SMART/Components/Calendario.razor @@ -17,12 +17,12 @@ else @if (timbratureOggi.TimbrExpl != null) {
-
+
Entrata @if (timbratureOggi.TimbrExpl.Entrata1 != null) { -
+
@($"{timbratureOggi.TimbrExpl.Entrata1:HH:mm}")
@@ -38,7 +38,7 @@ else Uscita @if (timbratureOggi.TimbrExpl.Uscita1 != null) { -
+
@($"{timbratureOggi.TimbrExpl.Uscita1:HH:mm}")
@@ -59,7 +59,7 @@ else Entrata @if (timbratureOggi.TimbrExpl.Entrata2 != null) { -
+
@($"{timbratureOggi.TimbrExpl.Entrata2:HH:mm}")
@@ -75,7 +75,7 @@ else Uscita @if (timbratureOggi.TimbrExpl.Uscita2 != null) { -
+
@($"{timbratureOggi.TimbrExpl.Uscita2:HH:mm}")
@@ -96,7 +96,7 @@ else Entrata @if (timbratureOggi.TimbrExpl.Entrata3 != null) { -
+
@($"{timbratureOggi.TimbrExpl.Entrata3:HH:mm}")
@@ -112,7 +112,7 @@ else Uscita @if (timbratureOggi.TimbrExpl.Uscita3 != null) { -
+
@($"{timbratureOggi.TimbrExpl.Uscita3:HH:mm}")
@@ -153,7 +153,9 @@ else } else { - +
+ +
} }
@@ -184,7 +186,7 @@ else
- +
diff --git a/GPW.CORE.SMART/Components/Calendario.razor.cs b/GPW.CORE.SMART/Components/Calendario.razor.cs index eaaaa63..902ff04 100644 --- a/GPW.CORE.SMART/Components/Calendario.razor.cs +++ b/GPW.CORE.SMART/Components/Calendario.razor.cs @@ -1,7 +1,11 @@ +using GPW.CORE.Data.DbModels; using GPW.CORE.Data.DTO; using GPW.CORE.Smart.Data; using Microsoft.AspNetCore.Components; +using Microsoft.Extensions.ObjectPool; using Microsoft.JSInterop; +using StackExchange.Redis; +using System.Text; namespace GPW.CORE.Smart.Components { @@ -17,6 +21,8 @@ namespace GPW.CORE.Smart.Components #region Protected Fields protected List? listRecords = null; + protected List? listTimb = null; + protected TimbratureModel? Timb = null; protected DailyDataDTO? timbratureOggi = null; @@ -27,7 +33,7 @@ namespace GPW.CORE.Smart.Components #region Protected Properties [Inject] - protected CoreSmartDataService CSDataService { get; set; } = null!; + protected CoreSmartDataService CSDataService { get; set; } = null!; [Inject] protected IJSRuntime JSRuntime { get; set; } = null!; @@ -59,6 +65,7 @@ namespace GPW.CORE.Smart.Components DateTime MeseStart = new DateTime(dtCurr.Year, dtCurr.Month, 1); DateTime MeseEnd = MeseStart.AddMonths(1); listRecords = await CSDataService.DailyDetails(IdxDipendente, MeseStart, MeseEnd); + DateCheck = new Dictionary(); string cssOkComm = "bg-success text-light rounded-circle p-1"; string cssOkLav = "bg-warning text-light rounded-circle p-1"; @@ -118,6 +125,50 @@ namespace GPW.CORE.Smart.Components showGauge = !showGauge; } + protected bool isApproved { get; set; } = true; + + private async void checkApp(DateTime? dtRif) + { + DateTime dtScelta = dtRif ?? DateTime.Today; + listTimb = await CSDataService.TimbratureDay(dtScelta, IdxDipendente); + if (listTimb != null) + { + if (listTimb.Count == 1) + { + Timb = listTimb.FirstOrDefault(); + if (Timb.Approv == true) + { + isApproved = false; + } + } + } + + } + private string cssChooseEntr(DateTime? dtRif) + { + checkApp(dtRif); + string answ = ""; + try + { + answ = (isApproved) ? "text-success" : "text-danger"; + } + catch + { } + return answ; + } + + private string cssChooseEsc(DateTime? dtRif) + { + checkApp(dtRif); + string answ = ""; + try + { + answ = (isApproved) ? "text-primary" : "text-danger"; + } + catch + { } + return answ; + } private async Task resetCal() { diff --git a/GPW.CORE.SMART/Components/Calendario.razor.css b/GPW.CORE.SMART/Components/Calendario.razor.css index 2cec78a..fdffe39 100644 --- a/GPW.CORE.SMART/Components/Calendario.razor.css +++ b/GPW.CORE.SMART/Components/Calendario.razor.css @@ -24,4 +24,22 @@ border-radius: 0.8rem; color: #fff; background-color: #1ABC9C; +} +.timeContainer { + width: 100%; + height: 100%; + display: flex; + justify-content: center; +} +.timeContainer input { + border: none; + border-radius: 0.8rem; + padding-left: 0.5rem; + padding-right: 0.5rem; + margin: 2rem; + background-color: #d9d9d9; + font-size: 3rem; +} +input[type="time"]::-webkit-calendar-picker-indicator { + color: #fff; } \ No newline at end of file diff --git a/GPW.CORE.SMART/Components/Calendario.razor.less b/GPW.CORE.SMART/Components/Calendario.razor.less index e097410..12e7817 100644 --- a/GPW.CORE.SMART/Components/Calendario.razor.less +++ b/GPW.CORE.SMART/Components/Calendario.razor.less @@ -23,3 +23,24 @@ background-color: #1ABC9C; } + +.timeContainer { + width: 100%; + height: 100%; + display: flex; + justify-content: center; +} +.timeContainer input { + border: none; + border-radius: 0.8rem; + padding-left: 0.5rem; + padding-right: 0.5rem; + margin: 2rem; + background-color: #d9d9d9; + font-size: 3rem; +} + +input[type="time"]::-webkit-calendar-picker-indicator { + color: #fff; +} + diff --git a/GPW.CORE.SMART/Components/Calendario.razor.min.css b/GPW.CORE.SMART/Components/Calendario.razor.min.css index ceda668..e062202 100644 --- a/GPW.CORE.SMART/Components/Calendario.razor.min.css +++ b/GPW.CORE.SMART/Components/Calendario.razor.min.css @@ -1 +1 @@ -.statsContainer{border:.3rem solid #e67e22;border-radius:.8rem;padding-bottom:10px;}.baseBtn{height:2.5rem;border:0;border-radius:.8rem;color:#fff;}.btnReset{height:2.5rem;border:0;border-radius:.8rem;color:#fff;background-color:#1ab7ea;}.btnTemp{height:2.5rem;border:0;border-radius:.8rem;color:#fff;background-color:#1abc9c;} \ No newline at end of file +.statsContainer{border:.3rem solid #e67e22;border-radius:.8rem;padding-bottom:10px;}.baseBtn{height:2.5rem;border:0;border-radius:.8rem;color:#fff;}.btnReset{height:2.5rem;border:0;border-radius:.8rem;color:#fff;background-color:#1ab7ea;}.btnTemp{height:2.5rem;border:0;border-radius:.8rem;color:#fff;background-color:#1abc9c;}.timeContainer{width:100%;height:100%;display:flex;justify-content:center;}.timeContainer input{border:0;border-radius:.8rem;padding-left:.5rem;padding-right:.5rem;margin:2rem;background-color:#d9d9d9;font-size:3rem;}input[type="time"]::-webkit-calendar-picker-indicator{color:#fff;} \ No newline at end of file