Modifica gestione edit timbrature x non fare reload
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
<div class="row p-2 m-2">
|
||||
<div class="col-12 text-center mt-2 py-2 alert alert-primary">
|
||||
<b>loading data</b>
|
||||
<i class="fas fa-spinner fa-spin fa-2x"></i>
|
||||
</div>
|
||||
</div>
|
||||
@@ -50,34 +50,18 @@
|
||||
public List<TimbratureModel> ListTimb { get; set; } = new List<TimbratureModel>();
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<bool> ItemUpdated { get; set; }
|
||||
public EventCallback<TimbratureModel> ReqDelete { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<TimbratureModel> ReqUpdate { get; set; }
|
||||
|
||||
protected async void Delete(TimbratureModel currRecord)
|
||||
{
|
||||
// chiedo verifica
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sicuro di voler eliminare la richiesta selezionata??"))
|
||||
return;
|
||||
|
||||
// aggiorno
|
||||
await GDataServ.TimbratureDelete(currRecord);
|
||||
|
||||
#if false
|
||||
// elimino dalla lista...
|
||||
ListTimb.Remove(currRecord);
|
||||
#endif
|
||||
|
||||
// registro fatto
|
||||
await ItemUpdated.InvokeAsync(true);
|
||||
await ReqDelete.InvokeAsync(currRecord);
|
||||
}
|
||||
|
||||
protected async void ScambioInOut(TimbratureModel currRecord)
|
||||
{
|
||||
currRecord.Entrata = !currRecord.Entrata;
|
||||
|
||||
// aggiorno
|
||||
await GDataServ.TimbratureUpdate(currRecord);
|
||||
|
||||
// registro fatto
|
||||
await ItemUpdated.InvokeAsync(true);
|
||||
await ReqUpdate.InvokeAsync(currRecord);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,14 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body p-0">
|
||||
<TimbList ListTimb="@ListTimbAppr" ItemUpdated="ReportUpdated"></TimbList>
|
||||
@if (ListTimbAppr != null)
|
||||
{
|
||||
<TimbList ListTimb="@ListTimbAppr" ReqDelete="DoDelete" ReqUpdate="DoUpdate"></TimbList>
|
||||
}
|
||||
else
|
||||
{
|
||||
<LoadingDataSmall></LoadingDataSmall>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -42,12 +49,11 @@
|
||||
</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>
|
||||
<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>
|
||||
<button @onclick="DoAdd" class="btn btn-block btn-sm btn-primary"><i class="fas fa-calendar-plus"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -61,7 +67,14 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body p-0">
|
||||
<TimbList ListTimb="@ListTimbRich" ItemUpdated="ReportUpdated"></TimbList>
|
||||
@if (ListTimbRich != null)
|
||||
{
|
||||
<TimbList ListTimb="@ListTimbRich" ReqDelete="DoDelete" ReqUpdate="DoUpdate"></TimbList>
|
||||
}
|
||||
else
|
||||
{
|
||||
<LoadingDataSmall></LoadingDataSmall>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,111 +1,107 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using System.Net.Http;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Components.Authorization;
|
||||
using Microsoft.AspNetCore.Components.Forms;
|
||||
using Microsoft.AspNetCore.Components.Routing;
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
using Microsoft.AspNetCore.Components.Web.Virtualization;
|
||||
using Microsoft.JSInterop;
|
||||
using GPW.CORE.UI;
|
||||
using GPW.CORE.UI.Shared;
|
||||
using GPW.CORE.Data.DbModels;
|
||||
using GPW.CORE.UI.Data;
|
||||
using System.Net;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.JSInterop;
|
||||
|
||||
namespace GPW.CORE.UI.Components
|
||||
{
|
||||
public partial class TimbrEditor
|
||||
{
|
||||
#region Protected Fields
|
||||
|
||||
protected bool vetoUpd = false;
|
||||
|
||||
[Inject]
|
||||
private IJSRuntime JSRuntime { get; set; }
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
[Inject]
|
||||
private MessageService AppMServ { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public List<TimbratureModel> ListTimb { get; set; } = new List<TimbratureModel>();
|
||||
[Inject]
|
||||
private IHttpContextAccessor httpContextAccessor { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public DateTime DataRif { get; set; }
|
||||
[Inject]
|
||||
private IJSRuntime JSRuntime { get; set; }
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected List<TimbratureModel> _ListTimb { get; set; } = new List<TimbratureModel>();
|
||||
|
||||
[Inject]
|
||||
protected GpwDataService GDataServ { get; set; }
|
||||
|
||||
protected bool IsUscita { get; set; } = false;
|
||||
|
||||
protected List<TimbratureModel> ListTimbAppr { get; set; }
|
||||
|
||||
protected List<TimbratureModel> ListTimbRich { get; set; }
|
||||
|
||||
protected string txtMsgInOut
|
||||
{
|
||||
get => IsUscita ? "Uscita" : "Entrata";
|
||||
}
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<bool> CloseReq { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public DateTime DataRif { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<bool> ItemReset { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<bool> ItemUpdated { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected GpwDataService GDataServ { get; set; }
|
||||
|
||||
|
||||
protected List<TimbratureModel> ListTimbAppr
|
||||
[Parameter]
|
||||
public List<TimbratureModel> ListTimb
|
||||
{
|
||||
get => ListTimb.Where(x => x.Approv == true).ToList();
|
||||
}
|
||||
protected List<TimbratureModel> ListTimbRich
|
||||
{
|
||||
get => ListTimb.Where(x => x.Approv == false).ToList();
|
||||
get
|
||||
{
|
||||
return _ListTimb;
|
||||
}
|
||||
set
|
||||
{
|
||||
_ListTimb = value;
|
||||
}
|
||||
}
|
||||
|
||||
protected bool IsUscita { get; set; } = false;
|
||||
#endregion Public Properties
|
||||
|
||||
protected string txtMsgInOut
|
||||
{
|
||||
get => IsUscita ? "Uscita" : "Entrata";
|
||||
}
|
||||
#region Private Methods
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
private async Task ReloadData()
|
||||
{
|
||||
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);
|
||||
{
|
||||
DataRif = DateTime.Today.AddHours(adesso.Hour).AddMinutes(Math.Ceiling((double)adesso.Minute / 5) * 5);
|
||||
}
|
||||
await Task.Delay(1);
|
||||
if (ListTimb != null)
|
||||
{
|
||||
ListTimbAppr = ListTimb.Where(x => x.Approv == true).ToList();
|
||||
ListTimbRich = ListTimb.Where(x => x.Approv == false).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indico item selezionato
|
||||
/// </summary>
|
||||
protected async void DoReset()
|
||||
{
|
||||
await ItemReset.InvokeAsync(true);
|
||||
}
|
||||
#endregion Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Aggiorno e riporto update
|
||||
/// </summary>
|
||||
protected async void DoUpdate()
|
||||
{
|
||||
#if false
|
||||
// aggiorno
|
||||
await GDataServ.RegAttUpdate(currRecord);
|
||||
// resetto clone e record corrente...
|
||||
AppMServ.clonedRA = null;
|
||||
#endif
|
||||
// registro fatto
|
||||
await ItemUpdated.InvokeAsync(true);
|
||||
}
|
||||
#region Protected Methods
|
||||
|
||||
[Inject]
|
||||
private IHttpContextAccessor httpContextAccessor { get; set; }
|
||||
|
||||
protected async void AddRequest()
|
||||
protected async void DoAdd()
|
||||
{
|
||||
//var remoteIp = httpContextAccessor.HttpContext.Connection?.RemoteIpAddress.ToString();
|
||||
TimbratureModel currRecord = new TimbratureModel()
|
||||
@@ -121,17 +117,15 @@ namespace GPW.CORE.UI.Components
|
||||
// aggiorno
|
||||
await GDataServ.TimbratureUpdate(currRecord);
|
||||
|
||||
// registro fatto
|
||||
await ItemUpdated.InvokeAsync(true);
|
||||
}
|
||||
// elimino dalla lista...
|
||||
ListTimb.Add(currRecord);
|
||||
|
||||
/// <summary>
|
||||
/// Elimino record
|
||||
/// </summary>
|
||||
protected async void ReportUpdated()
|
||||
{
|
||||
await ReloadData();
|
||||
|
||||
#if false
|
||||
// registro fatto
|
||||
await ItemUpdated.InvokeAsync(true);
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -141,5 +135,55 @@ namespace GPW.CORE.UI.Components
|
||||
{
|
||||
await CloseReq.InvokeAsync(true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Aggiorno e riporto update
|
||||
/// </summary>
|
||||
protected async void DoDelete(TimbratureModel currRecord)
|
||||
{
|
||||
// chiedo verifica
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sicuro di voler eliminare la richiesta selezionata??"))
|
||||
return;
|
||||
|
||||
// aggiorno
|
||||
await GDataServ.TimbratureDelete(currRecord);
|
||||
|
||||
// elimino dalla lista...
|
||||
ListTimb.Remove(currRecord);
|
||||
|
||||
await ReloadData();
|
||||
|
||||
#if false
|
||||
// registro fatto
|
||||
await ItemUpdated.InvokeAsync(true);
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Aggiorno e riporto update
|
||||
/// </summary>
|
||||
protected async void DoUpdate(TimbratureModel currRecord)
|
||||
{
|
||||
// elimino da lista
|
||||
ListTimb.Remove(currRecord);
|
||||
|
||||
// scambio
|
||||
currRecord.Entrata = !currRecord.Entrata;
|
||||
|
||||
// aggiorno
|
||||
await GDataServ.TimbratureUpdate(currRecord);
|
||||
|
||||
// ri-aggiungo in lista...
|
||||
ListTimb.Add(currRecord);
|
||||
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Version>3.0.2201.1019</Version>
|
||||
<Version>3.0.2201.1108</Version>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>GPW - Gestione Presenze Web</i>
|
||||
<h4>Versione: 3.0.2201.1019</h4>
|
||||
<h4>Versione: 3.0.2201.1108</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
3.0.2201.1019
|
||||
3.0.2201.1108
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>3.0.2201.1019</version>
|
||||
<version>3.0.2201.1108</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