From 54be34cc2e83e02ef7ea98474bbc687bd6f5319a Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Thu, 28 Sep 2023 11:38:50 +0200 Subject: [PATCH] Abbozzato comportamento selezione filtro TC --- .../MP-TAB.Client/Components/HistTCFilt.razor | 174 ++++++++++++++++++ MP-TAB/MP-TAB.Client/Pages/TCHistory.razor | 88 +++++++++ .../MP-TAB/Components/Pages/TCHistory.razor | 106 +---------- .../Components/Pages/TCHistory.razor.cs | 92 +++++++++ 4 files changed, 356 insertions(+), 104 deletions(-) create mode 100644 MP-TAB/MP-TAB.Client/Components/HistTCFilt.razor create mode 100644 MP-TAB/MP-TAB.Client/Pages/TCHistory.razor create mode 100644 MP-TAB/MP-TAB/Components/Pages/TCHistory.razor.cs diff --git a/MP-TAB/MP-TAB.Client/Components/HistTCFilt.razor b/MP-TAB/MP-TAB.Client/Components/HistTCFilt.razor new file mode 100644 index 00000000..119171dc --- /dev/null +++ b/MP-TAB/MP-TAB.Client/Components/HistTCFilt.razor @@ -0,0 +1,174 @@ + + +
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+ +@*
+
+

@Title

+
+
+
+
+ + +
+
+
+
+ + + +
+
+
+
*@ + +@code { + + + protected bool ListArtDisabled + { + get => string.IsNullOrEmpty(SearchVal) || SearchVal.Length < 3;// ? "disabled" : ""; + } + + protected async Task FixDisplay() + { + await InvokeAsync(StateHasChanged); + } + + + + protected string SearchVal + { + get => searchVal; + set + { + if (searchVal != value) + { + searchVal = value; + // InvokeAsync(StateHasChanged).ConfigureAwait(false); + } + } + } + + + private string searchVal { get; set; } = ""; + + + + + + + + + [Parameter] + public List ListMacchineAll { get; set; } = new List(); + + [Parameter] + public List ListArticoliAll { get; set; } = new List(); + + [Parameter] + public EventCallback E_FiltUpdated { get; set; } + + [Parameter] + public int MatrOpr { get; set; } = 102; + [Parameter] + public string Title { get; set; } = "TC History"; + + public class TcFilt + { + public string SearchVal { get; set; } = ""; + public string Azienda { get; set; } = "*"; + } + + protected int MaxRec { get; set; } = 100000; + protected int Num2Displ { get; set; } = 10; + protected int TotalCount { get; set; } = 0; + + + + protected List? ListArticoli { get; set; } = null; + protected TcFilt CurrFilt { get; set; } = new TcFilt(); + + protected void LoadMore() + { + ListArticoli = null; + // await Task.Delay(1); + Num2Displ += 10; + Num2Displ = Num2Displ < TotalCount ? Num2Displ : TotalCount; + ListArticoli = ListArticoliAll.Take(Num2Displ).ToList(); + } + + + protected async Task ReloadAllData() + { + TotalCount = ListArticoliAll.Count; + ListArticoli = ListArticoliAll.Take(Num2Displ).ToList(); + await Task.Delay(1); + } + + + protected override async Task OnParametersSetAsync() + { + // await ReloadAllData(); + } + + +} diff --git a/MP-TAB/MP-TAB.Client/Pages/TCHistory.razor b/MP-TAB/MP-TAB.Client/Pages/TCHistory.razor new file mode 100644 index 00000000..29d5b00e --- /dev/null +++ b/MP-TAB/MP-TAB.Client/Pages/TCHistory.razor @@ -0,0 +1,88 @@ +@* @attribute [RenderModeAuto] *@ +@attribute [RenderModeServer] + +
+
+ + + + @* *@ + + + @*
+
+

Storico Tempi Ciclo

+
+
+
+
+ + +
+
+
+
+ + + +
+
+
+
*@ +
+
+ @if (ListArticoli != null) + { + griglia risultati + @*
+ + +

@context.CodArticolo | @context.DescArticolo

+
+ +

Loading...

+
+ +

+ There are no strings to display. +

+
+
+
*@ + } +
+
+ +@code { + [Parameter] + public List? ListArticoli { get; set; } +} diff --git a/MP-TAB/MP-TAB/Components/Pages/TCHistory.razor b/MP-TAB/MP-TAB/Components/Pages/TCHistory.razor index 48cb2086..0a3e0bd8 100644 --- a/MP-TAB/MP-TAB/Components/Pages/TCHistory.razor +++ b/MP-TAB/MP-TAB/Components/Pages/TCHistory.razor @@ -1,113 +1,11 @@ @page "/tc-history" -@inject OprFiltData MDataService - -
-
-
-
-

Storico Tempi Ciclo

-
-
-
-
- - -
-
-
-
- - - -
-
-
-
-
-
- @if (ListArticoli != null) - { - griglia risultati - @*
- - -

@context.CodArticolo | @context.DescArticolo

-
- -

Loading...

-
- -

- There are no strings to display. -

-
-
-
*@ - } -
-
-@code { - /// - /// Matricola operatore corrente (da rendere parametrico con gest operatore) - /// - protected int MatrOpr { get; set; } = 102; - protected int NumRec { get; set; } = 100000; - protected string azienda { get; set; } = "*"; - protected string searchVal { get; set; } = ""; - protected int num2Displ { get; set; } = 10; - protected List? ListMacchine { get; set; } = null; - protected List? SearchArticoli { get; set; } = null; - protected List? ListArticoli { get; set; } = null; + + - protected async override Task OnInitializedAsync() - { - SearchArticoli = await MDataService.ArticoliGetSearch(NumRec, azienda, searchVal); - TotalCount = SearchArticoli.Count; - ListArticoli = SearchArticoli.Take(num2Displ).ToList(); - ListMacchine = await MDataService.MacchineByMatrOper(MatrOpr); - } - protected int TotalCount { get; set; } = 0; - protected void LoadMore() - { - ListArticoli = null; - // await Task.Delay(1); - num2Displ += 10; - num2Displ = num2Displ < TotalCount ? num2Displ : TotalCount; - ListArticoli = SearchArticoli?.Take(num2Displ).ToList(); - } -} diff --git a/MP-TAB/MP-TAB/Components/Pages/TCHistory.razor.cs b/MP-TAB/MP-TAB/Components/Pages/TCHistory.razor.cs new file mode 100644 index 00000000..dcdb818f --- /dev/null +++ b/MP-TAB/MP-TAB/Components/Pages/TCHistory.razor.cs @@ -0,0 +1,92 @@ +using global::System; +using global::System.Collections.Generic; +using global::System.Linq; +using global::System.Threading.Tasks; +using global::Microsoft.AspNetCore.Components; +using System.Net.Http; +using System.Net.Http.Json; +using Microsoft.AspNetCore.Components.Forms; +using Microsoft.AspNetCore.Components.Routing; +using Microsoft.AspNetCore.Components.Sections; +using Microsoft.AspNetCore.Components.Web; +using Microsoft.AspNetCore.Components.Web.Virtualization; +using Microsoft.JSInterop; +using MP.Data; +using MP.Data.DatabaseModels; +using MP.Data.DTO; +using MP.Data.Services; +using MP_TAB; +using MP_TAB.Components; +using static System.Runtime.InteropServices.JavaScript.JSType; + +namespace MP_TAB.Components.Pages +{ + public partial class TCHistory + { + #region Protected Properties + + protected string azienda { get; set; } = "*"; + + protected List? ListArticoli { get; set; } = null; + + protected List? ListMacchine { get; set; } = null; + + /// + /// Matricola operatore corrente (da rendere parametrico con gest operatore) + /// + protected int MatrOpr { get; set; } = 102; + + [Inject] + protected OprFiltData MDataService { get; set; } = null!; + + protected int num2Displ { get; set; } = 10; + protected int NumRec { get; set; } = 100000; + protected List? SearchArticoli { get; set; } = null; + protected string SearchVal { get; set; } = ""; + protected int TotalCount { get; set; } = 0; + + #endregion Protected Properties + + #region Protected Methods + + protected void LoadMore() + { + ListArticoli = null; + // await Task.Delay(1); + num2Displ += 10; + num2Displ = num2Displ < TotalCount ? num2Displ : TotalCount; + ListArticoli = SearchArticoli?.Take(num2Displ).ToList(); + } + + protected override async Task OnInitializedAsync() + { + await ReloadAllData(); + } + + protected override async Task OnParametersSetAsync() + { + await ReloadAllData(); + // return base.OnParametersSetAsync(); + } + + protected async Task ReloadAllData() + { + await ReloadFiltData(); + TotalCount = SearchArticoli.Count; + ListArticoli = SearchArticoli.Take(num2Displ).ToList(); + } + + protected async Task ReloadFiltData() + { + SearchArticoli = await MDataService.ArticoliGetSearch(NumRec, azienda, SearchVal); + ListMacchine = await MDataService.MacchineByMatrOper(MatrOpr); + } + + protected async void UpdatedFilt() + { + await ReloadFiltData(); + } + + #endregion Protected Methods + } +} \ No newline at end of file