From 05259a09eef0f4a5cb657abcd1b561859eb4dc4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Szab=C3=B3?= Date: Thu, 22 May 2025 21:02:09 +0200 Subject: [PATCH] =?UTF-8?q?CheckListInfoPage=20implement=C3=A1l=C3=A1sa?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DTO/CheckListHeaderInfoDTO.cs | 6 +- src/WorkFlowCheck.MAUI/Helper/SystemHelper.cs | 2 +- .../Pages/CheckList/CheckListInfoPage.xaml | 55 ++++++++ .../Pages/CheckList/CheckListInfoPage.xaml.cs | 71 ++++++++++ .../Pages/CheckList/CheckListPage.xaml | 127 +++++++++++------- .../Pages/CheckList/CheckListPage.xaml.cs | 6 + .../WorkFlowCheck.MAUI.csproj | 3 + 7 files changed, 216 insertions(+), 54 deletions(-) create mode 100644 src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListInfoPage.xaml create mode 100644 src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListInfoPage.xaml.cs diff --git a/src/WorkFlowCheck.Common/DTO/CheckListHeaderInfoDTO.cs b/src/WorkFlowCheck.Common/DTO/CheckListHeaderInfoDTO.cs index f41ad5b..9f3e2ff 100644 --- a/src/WorkFlowCheck.Common/DTO/CheckListHeaderInfoDTO.cs +++ b/src/WorkFlowCheck.Common/DTO/CheckListHeaderInfoDTO.cs @@ -19,8 +19,10 @@ namespace WorkFlowCheck.Common.DTO [DisplayName("Készültség %")] public string ReadyPercent { get; set; } - + [DisplayName("EllenÅ‘rzési pontok száma")] - public int CheckPointCount { get; set; } + public int CheckPointCount { get; set; } + + } } diff --git a/src/WorkFlowCheck.MAUI/Helper/SystemHelper.cs b/src/WorkFlowCheck.MAUI/Helper/SystemHelper.cs index 500d10f..93f9a18 100644 --- a/src/WorkFlowCheck.MAUI/Helper/SystemHelper.cs +++ b/src/WorkFlowCheck.MAUI/Helper/SystemHelper.cs @@ -19,7 +19,7 @@ namespace WorkFlowCheck.MAUI.Helper public static string DatabaseName = ""; public static bool Syncronised = false; public static UserDTO SystemUserDTO; - public static string ProgramVersion = "v1.1.023"; + public static string ProgramVersion = "v1.1.024"; #if DEBUG public static string ApiBaseUrl = $"https://dev.wfcapi.nuvolar.hu/"; diff --git a/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListInfoPage.xaml b/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListInfoPage.xaml new file mode 100644 index 0000000..06f9f62 --- /dev/null +++ b/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListInfoPage.xaml @@ -0,0 +1,55 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListInfoPage.xaml.cs b/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListInfoPage.xaml.cs new file mode 100644 index 0000000..e416f83 --- /dev/null +++ b/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListInfoPage.xaml.cs @@ -0,0 +1,71 @@ +using Android.DeviceLock; +using Firebase.Auth; +using System.Globalization; +using System.Threading.Tasks; +using WorkFlowCheck.Common.DTO; +using WorkFlowCheck.MAUI.Services.Interfaces; + +namespace WorkFlowCheck.MAUI.Pages.CheckList; + +public partial class CheckListInfoPage : ContentPage +{ + private readonly ICheckListService _checkListService; + private readonly IUserService _userService; + private UserDTO _currentUser; + private CheckListHeaderDTO _checkListHeaderDTO; + private CheckListHeaderInfoDTO _checkListHeaderInfoDTO; + public CheckListInfoPage(CheckListHeaderDTO checkListHeaderDTO) + { + InitializeComponent(); + _userService = MauiProgram.ServiceProvider.GetRequiredService(); + _checkListService = MauiProgram.ServiceProvider.GetRequiredService(); + _checkListHeaderDTO = checkListHeaderDTO; + } + private async Task SetInfo() + { + _currentUser = _userService.GetCurrentUser(); + DeviceId.Text = _userService.DeviceId; + UserInfo.Text = $"{_currentUser?.LastName} {_currentUser?.FirstName}"; + HeaderLabel.Text = _checkListHeaderDTO.DocumentNumber; + } + protected override async void OnAppearing() + { + base.OnAppearing(); + BindingContext = this; + await SetInfo(); + BuildCheckListHeaderInfo(); + } + private async Task BuildCheckListHeaderInfo() + { + _checkListHeaderInfoDTO = new CheckListHeaderInfoDTO(); + + var result = _checkListHeaderDTO.CheckListRowDTO + .GroupBy(r => 1) + .Select(g => new + { + TotalRowCount = g.Count(), + EmptyAnswerCount = g.Count(r => string.IsNullOrEmpty(r.Answer)), + CheckPointCount = g.Select(r => r.CheckListTemplateRowDTO.CheckPointId).Distinct().Count() + }) + .FirstOrDefault(); + if (result != null) + { + _checkListHeaderInfoDTO.TotalRowCount = result.TotalRowCount; + _checkListHeaderInfoDTO.CheckPointCount = result.CheckPointCount; + _checkListHeaderInfoDTO.EmptyAnswerCount = result.EmptyAnswerCount; + if (_checkListHeaderInfoDTO.TotalRowCount > 0) + { + _checkListHeaderInfoDTO.ReadyPercent = ((double)(_checkListHeaderInfoDTO.TotalRowCount - _checkListHeaderInfoDTO.EmptyAnswerCount) / _checkListHeaderInfoDTO.TotalRowCount * 100) + .ToString("0.00", new CultureInfo("hu-HU")) + " %"; + } + } + + var checkPointDTO = await _checkListService.GetNextCheckpointNotSend(_checkListHeaderDTO); + + row1.Text = $"Összes ellenõrizendõ lépés: {_checkListHeaderInfoDTO.TotalRowCount} db"; + row2.Text = $"Összes még nem ellenõrzött lépés: {_checkListHeaderInfoDTO.EmptyAnswerCount} db"; + row3.Text = $"Ellenõrzési pontok száma: {_checkListHeaderInfoDTO.CheckPointCount} db"; + row4.Text = $"Készültség: {_checkListHeaderInfoDTO.ReadyPercent}"; + row5.Text = $"Következõ ellenõrzési pont : {checkPointDTO.ShortName}"; + } +} \ No newline at end of file diff --git a/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListPage.xaml b/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListPage.xaml index e7b1d06..d5b33b5 100644 --- a/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListPage.xaml +++ b/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListPage.xaml @@ -82,67 +82,92 @@ - - - + + + + + + + + + + + diff --git a/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListPage.xaml.cs b/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListPage.xaml.cs index 43bee7b..42b9dc0 100644 --- a/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListPage.xaml.cs +++ b/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListPage.xaml.cs @@ -27,6 +27,7 @@ public partial class CheckListPage : ContentPage public ICommand UnblockCommand { get; set; } public ICommand BlockCommand { get; set; } public ICommand AcceptCommand { get; set; } + public ICommand InfoCommand { get; set; } public ICommand RefreshCommand { get; } public bool IsLoading @@ -73,6 +74,7 @@ public partial class CheckListPage : ContentPage UnblockCommand = new Command(OnUnblockItem); BlockCommand = new Command(OnBlockItem); AcceptCommand = new Command(OnAcceptItem); + InfoCommand = new Command(OnInfoItem); RefreshCommand = new Command(async () => await OnRefresh()); } @@ -311,6 +313,10 @@ public partial class CheckListPage : ContentPage } } } + private async void OnInfoItem(CheckListHeaderDTO checkListHeaderDTO) + { + await Navigation.PushAsync(new CheckListInfoPage(checkListHeaderDTO)); + } private async Task LoadCheckListTemplate() { IsLoading = true; diff --git a/src/WorkFlowCheck.MAUI/WorkFlowCheck.MAUI.csproj b/src/WorkFlowCheck.MAUI/WorkFlowCheck.MAUI.csproj index c98622b..dd19bc8 100644 --- a/src/WorkFlowCheck.MAUI/WorkFlowCheck.MAUI.csproj +++ b/src/WorkFlowCheck.MAUI/WorkFlowCheck.MAUI.csproj @@ -130,6 +130,9 @@ MSBuild:Compile + + MSBuild:Compile + MSBuild:Compile