From 38b3814f223f1b57abd3817524863f3918c6ae34 Mon Sep 17 00:00:00 2001 From: "zaccaria.majid" Date: Tue, 9 May 2023 08:41:16 +0200 Subject: [PATCH 01/25] fix gestione esecuzione funzioni passate come parametro + cambio stato --- .../Components/DoorMan/DoorList.razor | 19 ++++++++--- .../Components/DoorMan/DoorList.razor.cs | 32 +++++++++++++++++-- .../Components/SvgComp/DoorSvgObj.razor | 18 +++++------ .../Components/SvgComp/DoorSvgObj.razor.cs | 13 ++++++-- 4 files changed, 63 insertions(+), 19 deletions(-) diff --git a/WebDoorCreator.UI/Components/DoorMan/DoorList.razor b/WebDoorCreator.UI/Components/DoorMan/DoorList.razor index 33df5dc..0213fad 100644 --- a/WebDoorCreator.UI/Components/DoorMan/DoorList.razor +++ b/WebDoorCreator.UI/Components/DoorMan/DoorList.razor @@ -1,8 +1,19 @@ @if (DoorsList != null) { -
- -
+ @if (orderStatus == 10) + { +
+
+ +
+
+ +
+
+ +
+
+ }
@if (DoorsList == null || DoorsList.Count == 0) { } @@ -15,7 +26,7 @@ imgPath = $"images/LogoEgw{idxCount % 5:00}.png"; idxCount++;
- +
} diff --git a/WebDoorCreator.UI/Components/DoorMan/DoorList.razor.cs b/WebDoorCreator.UI/Components/DoorMan/DoorList.razor.cs index 950d1ed..5bbd0a9 100644 --- a/WebDoorCreator.UI/Components/DoorMan/DoorList.razor.cs +++ b/WebDoorCreator.UI/Components/DoorMan/DoorList.razor.cs @@ -30,7 +30,9 @@ namespace WebDoorCreator.UI.Components.DoorMan protected int orderStatus { get; set; } = 10; - protected Dictionary baseDict { get; set; } = new Dictionary(); + protected Dictionary AddDoorDict { get; set; } = new Dictionary(); + protected Dictionary AddFromTemplDict { get; set; } = new Dictionary(); + protected Dictionary SendOrderDict { get; set; } = new Dictionary(); [Inject] protected WebDoorCreatorService WDService { get; set; } = null!; @@ -93,9 +95,17 @@ namespace WebDoorCreator.UI.Components.DoorMan protected async Task ReloadData() { - if(!baseDict.ContainsKey("ADD NEW DOOR")) + if (!AddDoorDict.ContainsKey("ADD NEW DOOR")) { - baseDict.Add("ADD NEW DOOR", ""); + AddDoorDict.Add("ADD NEW DOOR", ""); + } + if (!AddFromTemplDict.ContainsKey("ADD NEW DOOR FROM TEMPLATE")) + { + AddFromTemplDict.Add("ADD NEW DOOR FROM TEMPLATE", ""); + } + if (!SendOrderDict.ContainsKey("SEND TO ABH")) + { + SendOrderDict.Add("SEND TO ABH", ""); } if (currOrderId != -1) { @@ -151,5 +161,21 @@ namespace WebDoorCreator.UI.Components.DoorMan // rimando alla pagina... dettaglio... NavManager.NavigateTo($"/DoorDefinition?idOrd={currOrderId}&idDoor={doorId}"); } + protected async void sendToAbh(int ordId, int orderStat) + { + if (orderStat == 10) + { + + + //int doorId = await WDService.createDoor(currOrderId, userId, "mm"); + bool done = await WDService.OrderUpdate(ordId, 20); + if (done) + { + await InvokeAsync(StateHasChanged); + } + } + + await ReloadData(); + } } } \ No newline at end of file diff --git a/WebDoorCreator.UI/Components/SvgComp/DoorSvgObj.razor b/WebDoorCreator.UI/Components/SvgComp/DoorSvgObj.razor index 825b422..0668ec9 100644 --- a/WebDoorCreator.UI/Components/SvgComp/DoorSvgObj.razor +++ b/WebDoorCreator.UI/Components/SvgComp/DoorSvgObj.razor @@ -2,15 +2,15 @@
- @foreach (var item in TextData) - { -
- @item.Key -
-
- @item.Value -
- } + @foreach (var item in TextData) + { +
+ @item.Key +
+
+ @item.Value +
+ }
diff --git a/WebDoorCreator.UI/Components/SvgComp/DoorSvgObj.razor.cs b/WebDoorCreator.UI/Components/SvgComp/DoorSvgObj.razor.cs index 7555d2f..daf9c5f 100644 --- a/WebDoorCreator.UI/Components/SvgComp/DoorSvgObj.razor.cs +++ b/WebDoorCreator.UI/Components/SvgComp/DoorSvgObj.razor.cs @@ -7,7 +7,7 @@ namespace WebDoorCreator.UI.Components.SvgComp #region Public Properties [Parameter] - public EventCallback EC_ExeFunct { get; set; } + public EventCallback<(string, string)> EC_ExeFunct { get; set; } [Parameter] public string ImagePath { get; set; } = "images/LogoEgw.png"; @@ -34,7 +34,14 @@ namespace WebDoorCreator.UI.Components.SvgComp public string TextStyle { get; set; } = "font-size: 1.5em; fill: #000;"; [Parameter] - public string Message { get; set; } = ""; + public string Message1 { get; set; } = ""; + [Parameter] + public string Message2 { get; set; } = ""; + + [Parameter] + public string LeftTextClass { get; set; } = ""; + [Parameter] + public string RightTextClass { get; set; } = ""; #endregion Public Properties @@ -64,7 +71,7 @@ namespace WebDoorCreator.UI.Components.SvgComp protected void execFunc() { - EC_ExeFunct.InvokeAsync(Message); + EC_ExeFunct.InvokeAsync((Message1, Message2)); } protected override void OnParametersSet() From 97d582e73398e2e3be42ec635b70786afedc489c Mon Sep 17 00:00:00 2001 From: "zaccaria.majid" Date: Tue, 9 May 2023 09:53:25 +0200 Subject: [PATCH 02/25] OrderDetails: - SEMI_ok button cambio stato - ok paginatore - ok button add new --- Docs/ActualToDo.md | 2 +- .../Components/DoorMan/DoorList.razor | 2 +- .../Components/DoorMan/DoorList.razor.cs | 61 +++++++++++++-- .../Components/Order/OrderList.razor.cs | 30 +++---- .../Components/SvgComp/DoorSvgObj.razor.cs | 4 +- WebDoorCreator.UI/Data/DoorsSelectFilter.cs | 78 +++++++++++++++++++ WebDoorCreator.UI/Pages/OrderDetails.razor | 21 ++--- WebDoorCreator.UI/Pages/OrderDetails.razor.cs | 52 +++++++++++++ WebDoorCreator.UI/Pages/OrdersHomePage.razor | 37 +++++---- .../Pages/OrdersHomePage.razor.cs | 33 ++++---- WebDoorCreator.UI/Shared/MainLayout.razor | 22 +++--- 11 files changed, 262 insertions(+), 80 deletions(-) create mode 100644 WebDoorCreator.UI/Data/DoorsSelectFilter.cs diff --git a/Docs/ActualToDo.md b/Docs/ActualToDo.md index b822ad1..b26de8a 100644 --- a/Docs/ActualToDo.md +++ b/Docs/ActualToDo.md @@ -32,7 +32,7 @@ FORSE la Orders home Page NON VA bene x gli utenti backoffice, oppure va estesa, ### OrderDetails Per completare: -- aggiunta button x il cambio stato da end-user +- aggiunta button x il cambio stato da end-user - sistemare con paginatore max 3 righe x 4 porte - fix button verde add-new - conteggio num modifiche da salvare diff --git a/WebDoorCreator.UI/Components/DoorMan/DoorList.razor b/WebDoorCreator.UI/Components/DoorMan/DoorList.razor index 0213fad..3998f80 100644 --- a/WebDoorCreator.UI/Components/DoorMan/DoorList.razor +++ b/WebDoorCreator.UI/Components/DoorMan/DoorList.razor @@ -26,7 +26,7 @@ imgPath = $"images/LogoEgw{idxCount % 5:00}.png"; idxCount++;
- +
} diff --git a/WebDoorCreator.UI/Components/DoorMan/DoorList.razor.cs b/WebDoorCreator.UI/Components/DoorMan/DoorList.razor.cs index 5bbd0a9..8a3d739 100644 --- a/WebDoorCreator.UI/Components/DoorMan/DoorList.razor.cs +++ b/WebDoorCreator.UI/Components/DoorMan/DoorList.razor.cs @@ -15,6 +15,13 @@ namespace WebDoorCreator.UI.Components.DoorMan [Parameter] public EventCallback E_DoorChanged { get; set; } + [Parameter] + public EventCallback updateRecordCount { get; set; } + + + [Parameter] + public DoorsSelectFilter actFilter { get; set; } = new DoorsSelectFilter(); + #endregion Public Properties #region Protected Properties @@ -109,14 +116,23 @@ namespace WebDoorCreator.UI.Components.DoorMan } if (currOrderId != -1) { - DoorsList = await WDService.DoorGetByOrderId(currOrderId); - - if (DoorsList != null) + var SearchRecords = await WDService.DoorGetByOrderId(currOrderId); + if (SearchRecords != null) { - var currOrder = DoorsList.FirstOrDefault(); - if (currOrder?.OrderNav != null) + totalCount = SearchRecords.Count; + + DoorsList = SearchRecords + .Skip(numRecord * (currPage - 1)) + .Take(numRecord) + .ToList(); + + if (DoorsList != null) { - orderStatus = currOrder.OrderNav.Status; + var currOrder = DoorsList.FirstOrDefault(); + if (currOrder?.OrderNav != null) + { + orderStatus = currOrder.OrderNav.Status; + } } } } @@ -165,8 +181,6 @@ namespace WebDoorCreator.UI.Components.DoorMan { if (orderStat == 10) { - - //int doorId = await WDService.createDoor(currOrderId, userId, "mm"); bool done = await WDService.OrderUpdate(ordId, 20); if (done) @@ -177,5 +191,36 @@ namespace WebDoorCreator.UI.Components.DoorMan await ReloadData(); } + + private int currPage + { + get => actFilter.CurrPage; + set => actFilter.CurrPage = value; + } + + private int numRecord + { + get => actFilter.NumRec; + set => actFilter.NumRec = value; + } + private string searchVal + { + get => actFilter.searchValue; + set => actFilter.searchValue = value; + } + + private int _totalCount { get; set; } = 0; + private int totalCount + { + get => _totalCount; + set + { + if (_totalCount != value) + { + _totalCount = value; + updateRecordCount.InvokeAsync(value); + } + } + } } } \ No newline at end of file diff --git a/WebDoorCreator.UI/Components/Order/OrderList.razor.cs b/WebDoorCreator.UI/Components/Order/OrderList.razor.cs index ff6e4a2..4c6c3c8 100644 --- a/WebDoorCreator.UI/Components/Order/OrderList.razor.cs +++ b/WebDoorCreator.UI/Components/Order/OrderList.razor.cs @@ -89,11 +89,6 @@ namespace WebDoorCreator.UI.Components.Order #region Protected Methods - //protected override async Task OnInitializedAsync() - //{ - // //await SetSelectedData(); - //} - protected override async Task OnParametersSetAsync() { //if (B_doorChaged) @@ -166,6 +161,20 @@ namespace WebDoorCreator.UI.Components.Order var SearchRecords = await WDService.OrderStatusGetFilt(userCurrCompany, orderStatus, dateFrom, dateTo); if (SearchRecords != null) { + totalCount = SearchRecords.Count; + if (searchVal != "") + { + ListOrdersStatus = SearchRecords + .Where(x => x.OrderDescript.ToLower().Contains(searchVal.ToLower()) || x.OrderExtCode.ToLower().Contains(searchVal.ToLower())) + .Skip(numRecord * (currPage - 1)) + .Take(numRecord) + .ToList(); + } + else + { + ListOrdersStatus = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); + } + if (orderType == Core.Enum.orderTypeEnum.DateAscending) { SearchRecords = SearchRecords.OrderBy(x => x.DateIns).ToList(); @@ -183,15 +192,6 @@ namespace WebDoorCreator.UI.Components.Order SearchRecords = SearchRecords.OrderByDescending(x => x.OrderExtCode).ToList(); } - totalCount = SearchRecords.Count; - if (searchVal != "") - { - ListOrdersStatus = SearchRecords.Where(x=>x.OrderDescript.Contains(searchVal) || x.OrderExtCode.Contains(searchVal)).Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); - } - else - { - ListOrdersStatus = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); - } } } await Task.Delay(1); @@ -247,7 +247,7 @@ namespace WebDoorCreator.UI.Components.Order protected Core.Enum.orderTypeEnum orderType = Core.Enum.orderTypeEnum.none; - + #endregion Private Methods } diff --git a/WebDoorCreator.UI/Components/SvgComp/DoorSvgObj.razor.cs b/WebDoorCreator.UI/Components/SvgComp/DoorSvgObj.razor.cs index daf9c5f..b7ddb01 100644 --- a/WebDoorCreator.UI/Components/SvgComp/DoorSvgObj.razor.cs +++ b/WebDoorCreator.UI/Components/SvgComp/DoorSvgObj.razor.cs @@ -7,7 +7,7 @@ namespace WebDoorCreator.UI.Components.SvgComp #region Public Properties [Parameter] - public EventCallback<(string, string)> EC_ExeFunct { get; set; } + public EventCallback EC_ExeFunct { get; set; } [Parameter] public string ImagePath { get; set; } = "images/LogoEgw.png"; @@ -71,7 +71,7 @@ namespace WebDoorCreator.UI.Components.SvgComp protected void execFunc() { - EC_ExeFunct.InvokeAsync((Message1, Message2)); + EC_ExeFunct.InvokeAsync(true); } protected override void OnParametersSet() diff --git a/WebDoorCreator.UI/Data/DoorsSelectFilter.cs b/WebDoorCreator.UI/Data/DoorsSelectFilter.cs new file mode 100644 index 0000000..27b7d7f --- /dev/null +++ b/WebDoorCreator.UI/Data/DoorsSelectFilter.cs @@ -0,0 +1,78 @@ +namespace WebDoorCreator.UI.Data +{ + public class DoorsSelectFilter + { + #region Public Constructors + + public DoorsSelectFilter() + { } + + #endregion Public Constructors + + #region Public Properties + + public int CurrPage { get; set; } = 1; + + public string Id { get; set; } = "*"; + public string searchValue { get; set; } = ""; + public int MaxRecord { get; set; } = 100; + + public int NumRec { get; set; } = 10; + + public int TotCount { get; set; } = 0; + + #endregion Public Properties + + #region Public Methods + + public DoorsSelectFilter clone() + { + DoorsSelectFilter clonedData = new DoorsSelectFilter() + { + CurrPage = this.CurrPage, + MaxRecord = this.MaxRecord, + NumRec = this.NumRec, + searchValue = this.searchValue, + TotCount = this.TotCount, + Id = this.Id + }; + return clonedData; + } + + public override bool Equals(object? obj) + { + if (obj == null) + return false; + + if (!(obj is OrderSelectFilter item)) + return false; + + if (MaxRecord != item.MaxRecord) + return false; + + if (NumRec != item.NumRec) + return false; + + if (TotCount != item.TotCount) + return false; + + if (searchValue != item.searchValue) + return false; + + if (CurrPage != item.CurrPage) + return false; + + if (Id != item.Id) + return false; + + return true; + } + + public override int GetHashCode() + { + return base.GetHashCode(); + } + + #endregion Public Methods + } +} \ No newline at end of file diff --git a/WebDoorCreator.UI/Pages/OrderDetails.razor b/WebDoorCreator.UI/Pages/OrderDetails.razor index 5f1be2d..6ec3e55 100644 --- a/WebDoorCreator.UI/Pages/OrderDetails.razor +++ b/WebDoorCreator.UI/Pages/OrderDetails.razor @@ -25,14 +25,14 @@
 
@orderView.NumDoors
-@* -
- - -
*@ + @* +
+ + +
*@ } @@ -42,5 +42,8 @@
- + +
+ +
diff --git a/WebDoorCreator.UI/Pages/OrderDetails.razor.cs b/WebDoorCreator.UI/Pages/OrderDetails.razor.cs index 45d009c..0e6b10f 100644 --- a/WebDoorCreator.UI/Pages/OrderDetails.razor.cs +++ b/WebDoorCreator.UI/Pages/OrderDetails.razor.cs @@ -1,3 +1,4 @@ +using EgwCoreLib.Razor; using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.WebUtilities; using Newtonsoft.Json; @@ -11,6 +12,8 @@ namespace WebDoorCreator.UI.Pages { #region Public Properties + protected DataPager? pagerDoors = null!; + public string userId { get @@ -109,5 +112,54 @@ namespace WebDoorCreator.UI.Pages private List? ListOrdersStatus = null; #endregion Private Fields + + protected DoorsSelectFilter currFilter { get; set; } = new DoorsSelectFilter(); + + private int currPage + { + get => currFilter.CurrPage; + set => currFilter.CurrPage = value; + } + + private bool isLoading { get; set; } = false; + + private int numRecord + { + get => currFilter.NumRec; + set => currFilter.NumRec = value; + } + private string searchValue + { + get => currFilter.searchValue; + set => currFilter.searchValue = value; + } + + protected int totalCount { get; set; } + + protected void ForceReload(int newNum) + { + numRecord = newNum; + } + + protected void ForceReloadPage(int newNum) + { + currPage = newNum; + } + protected void UpdateTotCount(int newTotCount) + { + totalCount = newTotCount; + } + + private async Task updateFilter(DoorsSelectFilter newParams) + { + isLoading = true; + await Task.Delay(1); + currPage = 1; + searchValue = newParams.searchValue; + await Task.Delay(1); + await InvokeAsync(() => StateHasChanged()); + currFilter = newParams; + isLoading = false; + } } } \ No newline at end of file diff --git a/WebDoorCreator.UI/Pages/OrdersHomePage.razor b/WebDoorCreator.UI/Pages/OrdersHomePage.razor index 57fe87f..751f3db 100644 --- a/WebDoorCreator.UI/Pages/OrdersHomePage.razor +++ b/WebDoorCreator.UI/Pages/OrdersHomePage.razor @@ -19,26 +19,31 @@ *@ -
- @*
+
+
+ @*
-
*@ -
- WEB DOOR CREATOR -
-
- -
- @*
+
*@ +
+ WEB DOOR CREATOR +
+
+ +
+ @*
-
*@ -
-
- +
*@ +
+
+ +
+ +
+ +
- - +