From 7317fa58b46b5a7832d54b8a85c7a706e31f9b92 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Tue, 13 Sep 2022 10:26:04 +0200 Subject: [PATCH] Inizio inserimento pagina PODL --- MP.SPEC/Components/ListODL.razor.cs | 33 +++-- MP.SPEC/Components/ListPODL.razor.cs | 33 +++-- MP.SPEC/Pages/ODL.razor | 200 +++++++++++++++++++++++++-- MP.SPEC/Pages/ODL.razor.cs | 76 +++++++++- MP.SPEC/Pages/PODL.razor | 8 ++ 5 files changed, 318 insertions(+), 32 deletions(-) create mode 100644 MP.SPEC/Pages/PODL.razor diff --git a/MP.SPEC/Components/ListODL.razor.cs b/MP.SPEC/Components/ListODL.razor.cs index 7aef6ace..8c235c41 100644 --- a/MP.SPEC/Components/ListODL.razor.cs +++ b/MP.SPEC/Components/ListODL.razor.cs @@ -9,6 +9,12 @@ namespace MP.SPEC.Components { #region Public Properties + [Parameter] + public bool isActive { get; set; } = false; + + [Parameter] + public EventCallback PagerResetReq { get; set; } + [Parameter] public string StatoSel { @@ -18,8 +24,11 @@ namespace MP.SPEC.Components if (_statoSel != value) { _statoSel = value; - var pUpd = Task.Run(async () => await reloadData()); - pUpd.Wait(); + if (isActive) + { + var pUpd = Task.Run(async () => await reloadData()); + pUpd.Wait(); + } } } } @@ -88,9 +97,6 @@ namespace MP.SPEC.Components #region Private Fields - [Parameter] - public EventCallback PagerResetReq { get; set; } - private string _statoSel = "*"; private ODLModel? currRecord = null; @@ -140,11 +146,18 @@ namespace MP.SPEC.Components private async Task reloadData() { isLoading = true; - SearchRecords = await MDService.ListODLFilt(true, SearchVal, StatoSel); - totalCount = SearchRecords.Count; - ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); - await Task.Delay(1); - await InvokeAsync(() => StateHasChanged()); + if (isActive) + { + SearchRecords = await MDService.ListODLFilt(true, SearchVal, StatoSel); + totalCount = SearchRecords.Count; + ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); + await Task.Delay(1); + await InvokeAsync(() => StateHasChanged()); + } + else + { + await Task.Delay(1); + } isLoading = false; } diff --git a/MP.SPEC/Components/ListPODL.razor.cs b/MP.SPEC/Components/ListPODL.razor.cs index c72bfd60..30914afe 100644 --- a/MP.SPEC/Components/ListPODL.razor.cs +++ b/MP.SPEC/Components/ListPODL.razor.cs @@ -9,6 +9,12 @@ namespace MP.SPEC.Components { #region Public Properties + [Parameter] + public bool isActive { get; set; } = false; + + [Parameter] + public EventCallback PagerResetReq { get; set; } + [Parameter] public string StatoSel { @@ -18,8 +24,11 @@ namespace MP.SPEC.Components if (_statoSel != value) { _statoSel = value; - var pUpd = Task.Run(async () => await reloadData()); - pUpd.Wait(); + if (isActive) + { + var pUpd = Task.Run(async () => await reloadData()); + pUpd.Wait(); + } } } } @@ -88,9 +97,6 @@ namespace MP.SPEC.Components #region Private Fields - [Parameter] - public EventCallback PagerResetReq { get; set; } - private string _statoSel = "*"; private PODLModel? currRecord = null; @@ -140,11 +146,18 @@ namespace MP.SPEC.Components private async Task reloadData() { isLoading = true; - SearchRecords = await MDService.ListPODLFilt(SearchVal, StatoSel); - totalCount = SearchRecords.Count; - ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); - await Task.Delay(1); - await InvokeAsync(() => StateHasChanged()); + if (isActive) + { + SearchRecords = await MDService.ListPODLFilt(SearchVal, StatoSel); + totalCount = SearchRecords.Count; + ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); + await Task.Delay(1); + await InvokeAsync(() => StateHasChanged()); + } + else + { + await Task.Delay(1); + } isLoading = false; } diff --git a/MP.SPEC/Pages/ODL.razor b/MP.SPEC/Pages/ODL.razor index 196dd078..5dd65167 100644 --- a/MP.SPEC/Pages/ODL.razor +++ b/MP.SPEC/Pages/ODL.razor @@ -2,11 +2,20 @@
-
-
-

Ordini Di Lavoro

+
+
+
+
+

Ordini Di Lavoro

+
+
+ +
+
-
+
+
+
ODL Programmati / In Corso @@ -30,19 +39,194 @@
+ + @if (reqNew) + { +
+
+
+ Azienda + + Art Search + +
+
+
+
+
+
+ Articolo + +
+
+
+ } + else if (currRecordOdl != null) + { +
+
+
+
Modifica ODL
+
+ @*
+
+
+ Codice + +
+
+
+
+ Disegno + +
+
+
+
+ +
+
+
+
+ + +
+
+
+
+
+ +
+
+
+ +
+
+
+
+ +
+
+
*@ +
+
+
+
+ } + else if (currRecordPOdl != null) + { +
+
+
+
Modifica PODL
+
+ + @*
+
+
+ Codice + +
+
+
+
+ Disegno + +
+
+
+
+ +
+
+
+
+ + +
+
+
+
+
+ +
+
+
+ +
+
+
+
+ +
+
+
*@ +
+
+
+
+ }
- @if (showCurrent) + @if (showODL) { - + } else { - + }
diff --git a/MP.SPEC/Pages/ODL.razor.cs b/MP.SPEC/Pages/ODL.razor.cs index 8c94f98f..70f1f4d4 100644 --- a/MP.SPEC/Pages/ODL.razor.cs +++ b/MP.SPEC/Pages/ODL.razor.cs @@ -43,16 +43,60 @@ namespace MP.SPEC.Pages } } + + private MP.Data.DatabaseModels.ODLModel? currRecordOdl = null; + private MP.Data.DatabaseModels.PODLModel? currRecordPOdl = null; + + /// + /// Crea nuovo record e va in editing... + /// + /// + protected async Task addNew() + { + currRecordPOdl = new MP.Data.DatabaseModels.PODLModel() + { + CodArticolo = $"_NEW_{DateTime.Now:yyyyMMdd.HHmmss}" + }; + await Task.Delay(1); + } + + protected async Task cancel() + { + currRecordOdl = null; + currRecordPOdl = null; + await reloadData(); + await Task.Delay(1); + } + protected DataPager pagerODL; + protected bool reqNew = false; + + + /// + /// Crea nuovo record e va in editing... + /// + /// + protected async Task reqNewPODL() + { + reqNew = !reqNew; + await Task.Delay(1); + } + protected override async Task OnInitializedAsync() { // abilito ricerca... MessageService.ShowSearch = true; + ListAziende = await MDService.ElencoAziende(); + ListStati = await MDService.AnagStatiComm(); // carico dati await reloadData(); } + private string currAzienda { get; set; } = "*"; + + private List? ListAziende; + #endregion Protected Methods #region Private Fields @@ -78,12 +122,36 @@ namespace MP.SPEC.Pages } private string selStato { get; set; } = "*"; +#if false + private string selStato + { + get => _selStato; + set + { + if (!_selStato.Equals(value)) + { + _selStato = value; + addEnabled = selStato != "*"; + ////StateHasChanged(); + //var pUpd = Task.Run(async () => + //{ + // //await reloadData(); + // await Task.Delay(1); + // await InvokeAsync(() => StateHasChanged()); + //}); + //pUpd.Wait(); + } + } + } +#endif - private bool showCurrent { get; set; } = false; + private bool showODL { get; set; } = false; + + private bool addEnabled = false; private string textToggle { - get => showCurrent ? "In Corso" : "Programmati"; + get => showODL ? "In Corso" : "Programmati"; } private int totalCount @@ -99,13 +167,13 @@ namespace MP.SPEC.Pages private async Task reloadData() { isLoading = true; - ListStati = await MDService.AnagStatiComm(); + await Task.Delay(1); isLoading = false; } private async Task toggleCurrent() { - showCurrent = !showCurrent; + showODL = !showODL; await Task.Delay(1); } diff --git a/MP.SPEC/Pages/PODL.razor b/MP.SPEC/Pages/PODL.razor new file mode 100644 index 00000000..2e664511 --- /dev/null +++ b/MP.SPEC/Pages/PODL.razor @@ -0,0 +1,8 @@ +@page "/PODL" + + +

PODL

+ +@code { + +}