Aggiunta sel data riferimento

This commit is contained in:
Samuele Locatelli
2022-01-11 13:00:22 +01:00
parent d5c69c559a
commit 9a1ec4fc48
4 changed files with 174 additions and 47 deletions
+75
View File
@@ -0,0 +1,75 @@
@using CORE.Data.DbModels
@using UI.Data
@inject MessageService AppMServ
<div class="card">
<div class="card-header bg-dark text-light py-1">
<div class="row">
<div class="col-6">
<h4>Selezione Data Riferimento</h4>
</div>
<div class="col-6 text-right">
Selezionare la data desiderata
</div>
</div>
</div>
<div class="card-body text-center">
<div class="row">
<div class="col-6">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text">Data Target</span>
</div>
<input type="date" class="form-control" placeholder="Data ultima" @bind-value="@TargetDate">
</div>
</div>
<div class="col-3">
<button type="button" class="btn btn-sm btn-block btn-success py-1" @onclick="DoSelection"><i class="fas fa-check"></i> Conferma</button>
</div>
<div class="col-3">
<button type="button" class="btn btn-sm btn-block btn-warning py-1" @onclick="DoClose"><i class="fas fa-times"></i> Chiudi</button>
</div>
</div>
</div>
</div>
@code {
[Parameter]
public EventCallback<bool> CloseReq { get; set; }
[Parameter]
public EventCallback<bool> WeekSelected { get; set; }
//private int Anno = DateTime.Today.Year;
//private int Week = 1;
/// <summary>
/// Indico item selezionato
/// </summary>
protected async void DoClose()
{
await CloseReq.InvokeAsync(true);
}
/// <summary>
/// Indico item selezionato
/// </summary>
protected async void DoSelection()
{
await WeekSelected.InvokeAsync(true);
}
protected DateTime TargetDate
{
get
{
return AppMServ.targetDate;
}
set
{
AppMServ.targetDate = value;
}
}
}
+9 -1
View File
@@ -1,4 +1,5 @@
using GPW.CORE.Data.DbModels;
using GPW.CORE.Data;
using GPW.CORE.Data.DbModels;
namespace GPW.CORE.UI.Data
{
@@ -135,6 +136,13 @@ namespace GPW.CORE.UI.Data
public RegAttivitaModel? recordRA { get; set; } = null;
public RegAttivitaModel? clonedRA { get; set; } = null;
public int selWeekNum { get; set; } = 0;
public int selYear { get; set; } = DateTime.Today.Year;
public DateTime targetDate { get; set; } = DateTime.Today;
#endregion Public Properties
#region Private Methods
+13 -1
View File
@@ -1,7 +1,17 @@
@page "/Planner"
@using GPW.CORE.UI.Components
@if (currRecord != null)
@if (selPeriod)
{
<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">
<WeekSelector CloseReq="ResetSelPeriodo" WeekSelected="ReloadPeriodo"></WeekSelector>
</div>
</div>
</dialog>
}
else if (currRecord != 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">
@@ -32,7 +42,9 @@ else if (ListTimbr != null)
<sub>@currWeekSel.inizio.ToString("ddd dd.MM")</sub>
</div>
<div class="py-0 px-1">
<button class="btn btn-sm btn-primary" @onclick="() => ShowSelPeriodo()">
W <b>@currWeekNum.ToString("00")</b><sub>/@currYear</sub>
</button>
</div>
<div class="py-0 px-1">
<sub>@currWeekSel.fine.ToString("ddd dd.MM")</sub>
+77 -45
View File
@@ -31,6 +31,8 @@ namespace GPW.CORE.UI.Pages
private int _endHour = 21;
private int _startHour = 7;
private bool selPeriod = false;
private RegAttivitaModel currRecord = null;
private List<TimbratureModel> ListTimbr = null;
@@ -106,46 +108,6 @@ namespace GPW.CORE.UI.Pages
}
}
private int SelPlantId
{
get => _selPlantId;
set
{
if (_selPlantId != value)
{
_selPlantId = value;
var pUpd = Task.Run(async () => await ReloadData());
pUpd.Wait();
}
}
}
private int SelSupplierId
{
get => _selSuppId;
set
{
if (_selSuppId != value)
{
_selSuppId = value;
checkHourRange();
}
}
}
private int SelTransporterId
{
get => _selTraspId;
set
{
if (_selTraspId != value)
{
_selTraspId = value;
checkHourRange();
}
}
}
private int startHour
{
get => _startHour;
@@ -200,8 +162,32 @@ namespace GPW.CORE.UI.Pages
}
}
#if false
protected int currWeekNum { get; set; } = 0;
protected int currYear { get; set; } = DateTime.Today.Year;
protected int currYear { get; set; } = DateTime.Today.Year;
#endif
protected int currWeekNum
{
get
{
return AppMServ.selWeekNum;
}
set
{
AppMServ.selWeekNum = value;
}
}
protected int currYear
{
get
{
return AppMServ.selYear;
}
set
{
AppMServ.selYear = value;
}
}
protected async Task setWeekNumber(WeekData wData)
{
@@ -247,10 +233,31 @@ namespace GPW.CORE.UI.Pages
}
}
private async Task InitData()
protected DateTime TargetDate
{
get
{
return AppMServ.targetDate;
}
set
{
AppMServ.targetDate = value;
}
}
/// <summary>
/// Reinit dei dati
/// </summary>
/// <param name="dateReset"></param>
/// <returns></returns>
private async Task InitData(bool dateReset)
{
isLoading = true;
weekStatList = await DataService.LastWeeks(IdxDipendente, DateTime.Today, 4);
if (dateReset)
{
TargetDate = DateTime.Today;
}
weekStatList = await DataService.LastWeeks(IdxDipendente, TargetDate, 4);
currWeekNum = weekStatList.Last().WeekNumber;
isLoading = false;
}
@@ -267,7 +274,7 @@ namespace GPW.CORE.UI.Pages
protected override async Task OnInitializedAsync()
{
await InitData();
await InitData(true);
await ReloadAllData();
}
@@ -280,10 +287,35 @@ namespace GPW.CORE.UI.Pages
{
currRecord = null;
ListTimbr = null;
await InitData();
await InitData(true);
await ReloadData();
}
protected async Task ReloadPeriodo()
{
selPeriod = false;
currRecord = null;
ListTimbr = null;
await InitData(false);
await ReloadData();
}
protected async Task ResetSelPeriodo()
{
selPeriod = false;
currRecord = null;
ListTimbr = null;
await InitData(true);
await ReloadData();
}
protected async Task ShowSelPeriodo()
{
selPeriod = true;
}
protected async Task UpdRegAttData()
{
currRecord = null;