OK edit timbrature (ma le chiude...)
This commit is contained in:
@@ -369,6 +369,43 @@ namespace GPW.CORE.Data.Controllers
|
||||
return answ;
|
||||
}
|
||||
|
||||
public bool TimbratureUpdate(TimbratureModel currItem)
|
||||
{
|
||||
bool answ = false;
|
||||
using (GPWContext localDbCtx = new GPWContext(_configuration))
|
||||
{
|
||||
try
|
||||
{
|
||||
var currRec = localDbCtx
|
||||
.DbSetTimbrature
|
||||
.FirstOrDefault(x => x.IdxDipendente == currItem.IdxDipendente && x.DataOra==currItem.DataOra);
|
||||
if (currRec != null)
|
||||
{
|
||||
// aggiorno solo entrata/uscita
|
||||
currRec.Entrata = currItem.Entrata;
|
||||
|
||||
localDbCtx
|
||||
.DbSetTimbrature
|
||||
.Update(currRec);
|
||||
}
|
||||
// altrimenti aggiungo
|
||||
else
|
||||
{
|
||||
localDbCtx
|
||||
.DbSetTimbrature
|
||||
.Add(currItem);
|
||||
}
|
||||
localDbCtx.SaveChanges();
|
||||
answ = true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione in TimbratureUpdate{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupera overview di un periodo settimanale x dipendente, data riferimento, numero settimane precedenti
|
||||
/// </summary>
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
}
|
||||
</td>
|
||||
<td>
|
||||
<button class="btn btn-sm btn-primary" title="Scambio IN/OUT"><i class="fas fa-exchange-alt"></i></button>
|
||||
<button class="btn btn-sm btn-primary" title="Scambio IN/OUT" @onclick="() => ScambioInOut(item)"><i class="fas fa-exchange-alt"></i></button>
|
||||
</td>
|
||||
<td title="Uscita">
|
||||
@if (@item.Entrata == false)
|
||||
@@ -61,8 +61,21 @@
|
||||
// aggiorno
|
||||
await GDataServ.TimbratureDelete(currRecord);
|
||||
|
||||
// elimino dalla lista...
|
||||
ListTimb.Remove(currRecord);
|
||||
#if false
|
||||
// elimino dalla lista...
|
||||
ListTimb.Remove(currRecord);
|
||||
#endif
|
||||
|
||||
// registro fatto
|
||||
await ItemUpdated.InvokeAsync(true);
|
||||
}
|
||||
|
||||
protected async void ScambioInOut(TimbratureModel currRecord)
|
||||
{
|
||||
currRecord.Entrata = !currRecord.Entrata;
|
||||
|
||||
// aggiorno
|
||||
await GDataServ.TimbratureUpdate(currRecord);
|
||||
|
||||
// registro fatto
|
||||
await ItemUpdated.InvokeAsync(true);
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body p-0">
|
||||
<TimbList ListTimb="@ListTimbAppr"></TimbList>
|
||||
<TimbList ListTimb="@ListTimbAppr" ItemUpdated="ReportUpdated"></TimbList>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -35,7 +35,22 @@
|
||||
Mancate timbrature
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">Content</div>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-12 py-2">
|
||||
<input type="datetime-local" @bind="@DataRif"></input>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<div class="custom-control custom-switch">
|
||||
<input type="checkbox" class="custom-control-input" id="switchEntrata" checked="@IsUscita" title="Ingresso /Uscrita" @bind-value="@IsUscita">|
|
||||
<label class="custom-control-label small" for="switchEntrata">@txtMsgInOut</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<button @onclick="AddRequest" class="btn btn-block btn-sm btn-primary"><i class="fas fa-calendar-plus"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
@@ -46,7 +61,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body p-0">
|
||||
<TimbList ListTimb="@ListTimbRich"></TimbList>
|
||||
<TimbList ListTimb="@ListTimbRich" ItemUpdated="ReportUpdated"></TimbList>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -15,6 +15,7 @@ using GPW.CORE.UI;
|
||||
using GPW.CORE.UI.Shared;
|
||||
using GPW.CORE.Data.DbModels;
|
||||
using GPW.CORE.UI.Data;
|
||||
using System.Net;
|
||||
|
||||
namespace GPW.CORE.UI.Components
|
||||
{
|
||||
@@ -31,6 +32,9 @@ namespace GPW.CORE.UI.Components
|
||||
[Parameter]
|
||||
public List<TimbratureModel> ListTimb { get; set; } = new List<TimbratureModel>();
|
||||
|
||||
[Parameter]
|
||||
public DateTime DataRif { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<bool> CloseReq { get; set; }
|
||||
|
||||
@@ -43,16 +47,6 @@ namespace GPW.CORE.UI.Components
|
||||
[Inject]
|
||||
protected GpwDataService GDataServ { get; set; }
|
||||
|
||||
protected async Task ReloadData()
|
||||
{
|
||||
#if false
|
||||
gruppiList = await GDataServ.AnagGruppiAll();
|
||||
var allProj = await GDataServ.AnagProjAll();
|
||||
projList = allProj.Where(x => x.Attivo == true && x.Gruppo == gruppoSel).OrderBy(x => x.ClienteNav.RagSociale).ThenBy(x => x.NomeProj).ToList();
|
||||
var allFasi = await GDataServ.AnagFasiAll();
|
||||
fasiList = allFasi.Where(x => x.IdxProgetto == idxProj).ToList();
|
||||
#endif
|
||||
}
|
||||
|
||||
protected List<TimbratureModel> ListTimbAppr
|
||||
{
|
||||
@@ -63,6 +57,28 @@ namespace GPW.CORE.UI.Components
|
||||
get => ListTimb.Where(x => x.Approv == false).ToList();
|
||||
}
|
||||
|
||||
protected bool IsUscita { get; set; } = false;
|
||||
|
||||
protected string txtMsgInOut
|
||||
{
|
||||
get => IsUscita ? "Uscita" : "Entrata";
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
DateTime adesso = DateTime.Now;
|
||||
// prendo primo record timbrature o oggi...
|
||||
if (ListTimb != null && ListTimb.Count > 0)
|
||||
{
|
||||
DataRif = ListTimb.FirstOrDefault().DataOra.Date.AddHours(adesso.Hour).AddMinutes(Math.Ceiling((double)adesso.Minute / 5) * 5);
|
||||
}
|
||||
else
|
||||
{
|
||||
DataRif = DateTime.Today.AddHours(adesso.Hour).AddMinutes(Math.Ceiling((double)adesso.Minute / 5) * 5);
|
||||
}
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indico item selezionato
|
||||
/// </summary>
|
||||
@@ -86,19 +102,34 @@ namespace GPW.CORE.UI.Components
|
||||
await ItemUpdated.InvokeAsync(true);
|
||||
}
|
||||
|
||||
|
||||
[Inject]
|
||||
private IHttpContextAccessor httpContextAccessor { get; set; }
|
||||
|
||||
protected async void AddRequest()
|
||||
{
|
||||
//var remoteIp = httpContextAccessor.HttpContext.Connection?.RemoteIpAddress.ToString();
|
||||
TimbratureModel currRecord = new TimbratureModel()
|
||||
{
|
||||
Entrata = !IsUscita,
|
||||
Approv = false,
|
||||
CodTipoTimb = "NoTim",
|
||||
DataOra = DataRif,
|
||||
IdxDipendente = AppMServ.IdxDipendente,
|
||||
Ipv4 = ""//$"{remoteIp}"
|
||||
};
|
||||
|
||||
// aggiorno
|
||||
await GDataServ.TimbratureUpdate(currRecord);
|
||||
|
||||
// registro fatto
|
||||
await ItemUpdated.InvokeAsync(true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elimino record
|
||||
/// </summary>
|
||||
protected async void DoDelete()
|
||||
protected async void ReportUpdated()
|
||||
{
|
||||
// chiedo verifica
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sicuro di voler eliminare il record selezionato??"))
|
||||
return;
|
||||
#if false
|
||||
// aggiorno
|
||||
await GDataServ.RegAttDelete(currRecord);
|
||||
#endif
|
||||
// registro fatto
|
||||
await ItemUpdated.InvokeAsync(true);
|
||||
}
|
||||
|
||||
@@ -615,7 +615,22 @@ namespace GPW.CORE.UI.Data
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
|
||||
|
||||
public async Task<bool> TimbratureUpdate(TimbratureModel currItem)
|
||||
{
|
||||
bool answ = false;
|
||||
try
|
||||
{
|
||||
dbController.TimbratureUpdate(currItem);
|
||||
// invalido la cache...
|
||||
await InvalidateAllCache();
|
||||
answ = true;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Version>3.0.2201.1018</Version>
|
||||
<Version>3.0.2201.1019</Version>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -16,7 +16,7 @@ else if (ListTimbr != null)
|
||||
<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">
|
||||
<div class="modal-content">
|
||||
<TimbrEditor ListTimb="@ListTimbr" CloseReq="UpdateData"></TimbrEditor>
|
||||
<TimbrEditor ListTimb="@ListTimbr" CloseReq="UpdateData" ItemUpdated="UpdateData"></TimbrEditor>
|
||||
</div>
|
||||
</div>
|
||||
</dialog>
|
||||
|
||||
@@ -25,6 +25,7 @@ builder.Services.AddRazorPages();
|
||||
builder.Services.AddServerSideBlazor();
|
||||
builder.Services.AddSingleton<GpwDataService>();
|
||||
builder.Services.AddScoped<MessageService>();
|
||||
builder.Services.AddHttpContextAccessor();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>GPW - Gestione Presenze Web</i>
|
||||
<h4>Versione: 3.0.2201.1018</h4>
|
||||
<h4>Versione: 3.0.2201.1019</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
3.0.2201.1018
|
||||
3.0.2201.1019
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>3.0.2201.1018</version>
|
||||
<version>3.0.2201.1019</version>
|
||||
<url>http://nexus.steamware.net/repository/SWS/GWMS/stable/0/GWMS.UI.zip</url>
|
||||
<changelog>http://nexus.steamware.net/repository/SWS/GWMS/stable/0/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
Reference in New Issue
Block a user