diff --git a/GWMS.UI/Extensions/NavigationManagerExtension.cs b/GWMS.UI/Extensions/NavigationManagerExtension.cs new file mode 100644 index 0000000..befd252 --- /dev/null +++ b/GWMS.UI/Extensions/NavigationManagerExtension.cs @@ -0,0 +1,39 @@ +using Microsoft.AspNetCore.Components; +using Microsoft.AspNetCore.WebUtilities; + +namespace GWMS.UI.Extensions +{ + public static class NavigationManagerExtension + { + #region Public Methods + + /// + /// Estensione metodo NavigationManager + /// + /// https://code-maze.com/query-strings-blazor-webassembly/ + /// + /// + /// + /// + /// + public static T ExtractQueryStringByKey(this NavigationManager navManager, string key) + { + var uri = navManager.ToAbsoluteUri(navManager.Uri); + QueryHelpers.ParseQuery(uri.Query) + .TryGetValue(key, out var queryValue); + + if (typeof(T).Equals(typeof(int))) + { + int.TryParse(queryValue, out int result); + return (T)(object)result; + } + + if (typeof(T).Equals(typeof(string))) + return (T)(object)queryValue.ToString(); + + return default; + } + + #endregion Public Methods + } +} \ No newline at end of file diff --git a/GWMS.UI/GWMS.UI.csproj b/GWMS.UI/GWMS.UI.csproj index f40c8ac..e3a02f9 100644 --- a/GWMS.UI/GWMS.UI.csproj +++ b/GWMS.UI/GWMS.UI.csproj @@ -2,7 +2,7 @@ net5.0 - 1.0.2108.2319 + 1.0.2108.2409 95c9f021-52d1-4390-a670-5810b7b777b0 diff --git a/GWMS.UI/Pages/Orders.razor b/GWMS.UI/Pages/Orders.razor index f4930b7..459205b 100644 --- a/GWMS.UI/Pages/Orders.razor +++ b/GWMS.UI/Pages/Orders.razor @@ -6,11 +6,16 @@
-
+
Elenco Ordini
-
+
+
+
+ +
+
@@ -21,6 +26,16 @@
+
+ @if (ShowAddNew) + { + + } +
+
+
+
+
@@ -37,6 +52,10 @@
+
+
+
+
@@ -75,17 +94,6 @@
-
-
- -
-
-
- @if (ShowAddNew) - { - - } -
@@ -107,7 +115,7 @@ {
- +
diff --git a/GWMS.UI/Pages/Suppliers.razor b/GWMS.UI/Pages/Suppliers.razor index 498c11c..c244503 100644 --- a/GWMS.UI/Pages/Suppliers.razor +++ b/GWMS.UI/Pages/Suppliers.razor @@ -7,10 +7,10 @@
-
+
Ordini Fornitore
-
+
@@ -28,6 +28,10 @@
+
+
+
+
@@ -86,7 +90,7 @@ {
-
+
diff --git a/GWMS.UI/Pages/Transporters.razor b/GWMS.UI/Pages/Transporters.razor index 9fe09fc..aa19632 100644 --- a/GWMS.UI/Pages/Transporters.razor +++ b/GWMS.UI/Pages/Transporters.razor @@ -1,5 +1,4 @@ @page "/Transporters" -@page "/Transporters/{TransporterIdReq}" @using Blazorise.Components @using GWMS.UI.Components @@ -12,11 +11,18 @@
Consegne
-
- -
-
- +
+
+
+ +
+ @*
+ +
*@ +
+ +
+
@@ -36,7 +42,6 @@ } - @if (showFiltDest) {
@@ -61,6 +66,27 @@
} +
+
+
+
+ + + +
+ +
+
+
diff --git a/GWMS.UI/Pages/Transporters.razor.cs b/GWMS.UI/Pages/Transporters.razor.cs index 5963a17..2e34be2 100644 --- a/GWMS.UI/Pages/Transporters.razor.cs +++ b/GWMS.UI/Pages/Transporters.razor.cs @@ -19,6 +19,7 @@ namespace GWMS.UI.Pages private List ListRecords; private List PlantsList; private List SearchRecords; + private List TransportersList; #endregion Private Fields @@ -59,6 +60,14 @@ namespace GWMS.UI.Pages } } + private string icnFiltTran + { + get + { + return showFiltTrasp ? "fas fa-chevron-up" : "fas fa-chevron-down"; + } + } + private bool isLoading { get; set; } = false; private int numRecord @@ -113,6 +122,7 @@ namespace GWMS.UI.Pages { if (!MessageService.Order_Filter.TransporterId.Equals(value)) { + currRecord = null; MessageService.Order_Filter.TransporterId = value; var pUpd = Task.Run(async () => await ReloadData()); pUpd.Wait(); @@ -183,39 +193,23 @@ namespace GWMS.UI.Pages protected bool showFiltDest { get; set; } = false; protected bool showFiltTime { get; set; } = false; + protected bool showFiltTrasp { get; set; } = false; protected int totalCount { get { int answ = 0; - if (SearchRecords != null) + if (ListRecords != null) { - answ = SearchRecords.Count; + answ = ListRecords.Count; } return answ; } } - protected int TransporterIdFilt - { - get - { - int answ = 0; - int.TryParse(TransporterIdReq, out answ); - return answ; - } - } - #endregion Protected Properties - #region Public Properties - - [Parameter] - public string TransporterIdReq { get; set; } = ""; - - #endregion Public Properties - #region Private Methods private void OnDateEndChanged(DateTime? date) @@ -234,7 +228,8 @@ namespace GWMS.UI.Pages { isLoading = true; SearchRecords = await DataService.OrdersGetFilt(MessageService.Order_Filter); - ListRecords = SearchRecords.Where(x => x.TransporterId == TransporterIdFilt).Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); + ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); + //ListRecords = SearchRecords.Where(x => x.TransporterId == TransporterIdFilt).Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); isLoading = false; } @@ -260,6 +255,7 @@ namespace GWMS.UI.Pages protected override async Task OnInitializedAsync() { SelPlantId = 0; + SelTranspId = 0; MessageService.ShowSearch = false; MessageService.PageName = "Fornitore"; MessageService.PageIcon = "fas fa-industry pr-2"; @@ -298,7 +294,6 @@ namespace GWMS.UI.Pages protected void ToggleFiltDest() { showFiltDest = !showFiltDest; - // se nascosto --> reset if (!showFiltDest) { SelPlantId = 0; @@ -310,6 +305,11 @@ namespace GWMS.UI.Pages showFiltTime = !showFiltTime; } + protected void ToggleFiltTransp() + { + showFiltTrasp = !showFiltTrasp; + } + protected async Task UpdateData() { currRecord = null; diff --git a/GWMS.UI/Shared/NavMenu.razor b/GWMS.UI/Shared/NavMenu.razor index 0def308..cca5606 100644 --- a/GWMS.UI/Shared/NavMenu.razor +++ b/GWMS.UI/Shared/NavMenu.razor @@ -1,15 +1,23 @@ -