diff --git a/GPW.CORE.SMART/Components/CompProj.razor b/GPW.CORE.SMART/Components/CompProj.razor new file mode 100644 index 0000000..c16dc24 --- /dev/null +++ b/GPW.CORE.SMART/Components/CompProj.razor @@ -0,0 +1,15 @@ +@if (ListProgetti == null) +{ + +} +else if (ListProgetti.Count == 0) +{ +
+

Timbrature da Approvare

+ Nessun record trovato +
+} +else +{ + +} \ No newline at end of file diff --git a/GPW.CORE.SMART/Components/CompProj.razor.cs b/GPW.CORE.SMART/Components/CompProj.razor.cs new file mode 100644 index 0000000..9ae434f --- /dev/null +++ b/GPW.CORE.SMART/Components/CompProj.razor.cs @@ -0,0 +1,62 @@ +using GPW.CORE.Data.DbModels; +using GPW.CORE.Data.DTO; +using GPW.CORE.Smart.Data; +using Microsoft.AspNetCore.Components; + +namespace GPW.CORE.Smart.Components +{ + public partial class CompProj + { + #region Public Properties + + [Parameter] + public int IdxDipCurr { get; set; } = 0; + + [Parameter] + public List? ListProgetti { get; set; } = null; + + #endregion Public Properties + + #region Protected Methods + + /// + /// Aggiorno e riporto update + /// + protected async void DoUpdate(bool forceReload) + { + if (forceReload) + { + await ReloadData(); + await Task.Delay(1); + await InvokeAsync(StateHasChanged); + } + } + + protected override async Task OnParametersSetAsync() + { + await ReloadData(); + } + + #endregion Protected Methods + + #region Private Properties + + [Inject] + private CoreSmartDataService CDService { get; set; } = null!; + + private bool isLoading { get; set; } = false; + + #endregion Private Properties + + #region Private Methods + + private async Task ReloadData() + { + isLoading = true; + await Task.Delay(1); + isLoading = true; + } + + #endregion Private Methods + } +} \ No newline at end of file diff --git a/GPW.CORE.SMART/Components/ProjectsList.razor b/GPW.CORE.SMART/Components/ProjectsList.razor new file mode 100644 index 0000000..ba42498 --- /dev/null +++ b/GPW.CORE.SMART/Components/ProjectsList.razor @@ -0,0 +1,13 @@ +@using GPW.CORE.Data.DbModels +@using GPW.CORE.Smart.Data + +@if (ListProj != null) +{ + @foreach (var item in ListProj) + { +
+ @item.Descrizione +
+ } +} + diff --git a/GPW.CORE.SMART/Components/ProjectsList.razor.cs b/GPW.CORE.SMART/Components/ProjectsList.razor.cs new file mode 100644 index 0000000..2c5c1ab --- /dev/null +++ b/GPW.CORE.SMART/Components/ProjectsList.razor.cs @@ -0,0 +1,93 @@ +using GPW.CORE.Data.DbModels; +using GPW.CORE.Data.DTO; +using GPW.CORE.Smart.Data; +using Microsoft.AspNetCore.Components; +using Microsoft.JSInterop; + +namespace GPW.CORE.Smart.Components +{ + public partial class ProjectsList + { + #region Public Properties + + [Parameter] + public bool EnableAdmin { get; set; } = false; + + [Parameter] + public bool EnableEdit { get; set; } = false; + + + [Parameter] + public string TextCss { get; set; } = "text-dark"; + + private bool isLoading { get; set; } = false; + + [Parameter] + public List ListProj { get; set; } = null!; + //{ + // get + // { + + // return _ListProj.Select(x => x.ListRA); + // } + + // set + // { + // _ListProj = value; + // } + //} + public List ListRegAtt { get; set; } = null!; + protected override Task OnParametersSetAsync() + { + ListRegAtt = ListProj.Select(x=>x.ListRA).ToList(); + } + + private bool canDelete(TimbratureModel currRec) + { + bool answ = false; + if (currRec.Approv != null) + { + answ = !(bool)currRec.Approv; + } + return answ; + } + + [Parameter] + public EventCallback ReqUpdate { get; set; } + + #endregion Public Properties + + #region Protected Methods + + + protected async void Delete(TimbratureModel currRecord) + { + string message = "Sicuro di voler eliminare/rifiutare la richiesta selezionata?"; + if (!await JSRuntime.InvokeAsync("confirm", message)) + return; + + isLoading = true; + await Task.Delay(1); + await InvokeAsync(StateHasChanged); + // elimino + await CDService.TimbratureDelete(currRecord); + await Task.Delay(1); + isLoading = false; + await ReqUpdate.InvokeAsync(true); + } + + #endregion Protected Methods + + #region Private Properties + + private List _ListProj { get; set; } = new List(); + + [Inject] + private CoreSmartDataService CDService { get; set; } = null!; + + [Inject] + private IJSRuntime JSRuntime { get; set; } = null!; + + #endregion Private Properties + } +} \ No newline at end of file