From 3c394f632da4638759891a645a8cd1fad2dafabb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Szab=C3=B3?= Date: Tue, 22 Apr 2025 14:17:11 +0200 Subject: [PATCH] =?UTF-8?q?Most=20m=C5=B1k=C3=B6dik=20egy=20tesztelhet?= =?UTF-8?q?=C5=91=20verzi=C3=B3.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/WorkFlowCheck.MAUI/Helper/SystemHelper.cs | 2 + src/WorkFlowCheck.MAUI/MainPage.xaml.cs | 2 +- .../Pages/BaseStock/BaseStockPage.xaml.cs | 2 +- .../Pages/CheckList/CheckListPage.xaml.cs | 73 ++++++++++++++++--- .../Pages/CheckList/CheckListWorkPage.xaml | 2 +- .../Pages/CheckList/CheckListWorkPage.xaml.cs | 32 +++++--- .../Pages/NFC/NFCTestPage.xaml.cs | 2 +- .../Pages/Security/LoginPage.xaml.cs | 3 + .../Pages/System/DownloadAPKPage.xaml.cs | 2 +- .../Pages/System/SyncPage.xaml.cs | 2 +- .../Services/CheckListService.cs | 27 +++++++ .../Services/Interfaces/ICheckListService.cs | 3 +- 12 files changed, 124 insertions(+), 28 deletions(-) diff --git a/src/WorkFlowCheck.MAUI/Helper/SystemHelper.cs b/src/WorkFlowCheck.MAUI/Helper/SystemHelper.cs index d8cf74c..1c8b173 100644 --- a/src/WorkFlowCheck.MAUI/Helper/SystemHelper.cs +++ b/src/WorkFlowCheck.MAUI/Helper/SystemHelper.cs @@ -17,6 +17,8 @@ namespace WorkFlowCheck.MAUI.Helper { public static string DatabaseName = ""; public static bool Syncronised = false; + public static UserDTO SystemUserDTO; + #if DEBUG public static string ApiBaseUrl = $"https://dev.wfcapi.nuvolar.hu/"; public static string ApiKey = $"RUJeLSpSMzVASUdaRCEzUyYxRSE0VyFISFRSJC0zRzhLM1hCSDU="; diff --git a/src/WorkFlowCheck.MAUI/MainPage.xaml.cs b/src/WorkFlowCheck.MAUI/MainPage.xaml.cs index 93d1896..9ad3656 100644 --- a/src/WorkFlowCheck.MAUI/MainPage.xaml.cs +++ b/src/WorkFlowCheck.MAUI/MainPage.xaml.cs @@ -21,7 +21,7 @@ namespace WorkFlowCheck.MAUI { _currentUser = _userService.GetCurrentUser(); DeviceId.Text = $"{_userService.DeviceId}"; - UserInfo.Text = $"{_currentUser?.FirstName} {_currentUser?.LastName}"; + UserInfo.Text = $"{_currentUser?.LastName} {_currentUser?.FirstName}"; } override protected async void OnAppearing() { diff --git a/src/WorkFlowCheck.MAUI/Pages/BaseStock/BaseStockPage.xaml.cs b/src/WorkFlowCheck.MAUI/Pages/BaseStock/BaseStockPage.xaml.cs index 2ff9ca1..4be65fc 100644 --- a/src/WorkFlowCheck.MAUI/Pages/BaseStock/BaseStockPage.xaml.cs +++ b/src/WorkFlowCheck.MAUI/Pages/BaseStock/BaseStockPage.xaml.cs @@ -19,7 +19,7 @@ public partial class BaseStockPage : ContentPage { _currentUser = _userService.GetCurrentUser(); DeviceId.Text = _userService.DeviceId; - UserInfo.Text = $"{_currentUser?.FirstName} {_currentUser?.LastName}"; + UserInfo.Text = $"{_currentUser?.LastName} {_currentUser?.FirstName}"; } override protected async void OnAppearing() diff --git a/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListPage.xaml.cs b/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListPage.xaml.cs index d4f83fd..81b0035 100644 --- a/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListPage.xaml.cs +++ b/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListPage.xaml.cs @@ -7,6 +7,7 @@ using System.Threading.Tasks; using System.Windows.Input; using WorkFlowCheck.Common.DTO; using WorkFlowCheck.Common.Enums; +using WorkFlowCheck.MAUI.Helper; using WorkFlowCheck.MAUI.Pages.NFC; using WorkFlowCheck.MAUI.Services.Interfaces; @@ -26,7 +27,7 @@ public partial class CheckListPage : ContentPage public ICommand UnblockCommand { get; set; } public ICommand BlockCommand { get; set; } public ICommand AcceptCommand { get; set; } - + public bool IsLoading { get => _isLoading; @@ -57,8 +58,8 @@ public partial class CheckListPage : ContentPage UnblockCommand = new Command(OnUnblockItem); BlockCommand = new Command(OnBlockItem); AcceptCommand = new Command(OnAcceptItem); - - + + } private void SetInfo() { @@ -132,15 +133,36 @@ public partial class CheckListPage : ContentPage } private async void OnContinueItem(CheckListHeaderDTO checkListHeaderDTO) { - var checkPointCode = await NFCWaiter.ShowModalAsync(); - if (!string.IsNullOrEmpty(checkPointCode)) + if (CrossNFC.IsSupported && CrossNFC.Current.IsAvailable) { - if (Navigation.ModalStack.Count > 0) + var checkPointCode = await NFCWaiter.ShowModalAsync(); + if (!string.IsNullOrEmpty(checkPointCode)) { - await Navigation.PopModalAsync(); + if (Navigation.ModalStack.Count > 0) + { + await Navigation.PopModalAsync(); + } + + await Navigation.PushAsync(new CheckListWorkPage(checkListHeaderDTO.Id, checkPointCode)); + } + } + else + { + // Ha nincs NFC, akkor az utoljára beküldött és a sorrendben lévő checkpointra ugrik + var nextCheckPoint = await _checkListService.GetNextCheckpointNotSend(checkListHeaderDTO); + if (nextCheckPoint != null && nextCheckPoint.Id > 0) + { + if (!string.IsNullOrEmpty(nextCheckPoint.Code)) + { + if (Navigation.ModalStack.Count > 0) + { + await Navigation.PopModalAsync(); + } + + await Navigation.PushAsync(new CheckListWorkPage(checkListHeaderDTO.Id, nextCheckPoint.Code)); + } } - await Navigation.PushAsync(new CheckListWorkPage(checkListHeaderDTO.Id, checkPointCode)); } } private async void OnUnblockItem(CheckListHeaderDTO checkListHeaderDTO) @@ -211,7 +233,16 @@ public class BlockedConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { - if (value is CheckStatus status) + var canEnableBlocked = false; + foreach (var roleDTO in SystemHelper.SystemUserDTO.RoleDTO) + { + if (roleDTO.CanEnableBlocked) + { + canEnableBlocked = true; + break; + } + } + if (value is CheckStatus status && canEnableBlocked) { return status == CheckStatus.InProgress; } @@ -227,9 +258,18 @@ public class UnBlockedConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { + var canEnableBlocked = false; + foreach (var roleDTO in SystemHelper.SystemUserDTO.RoleDTO) + { + if (roleDTO.CanEnableBlocked) + { + canEnableBlocked = true; + break; + } + } if (value is CheckStatus status) { - if (status == CheckStatus.Blocked) + if (status == CheckStatus.Blocked && canEnableBlocked) { return true; } @@ -247,7 +287,7 @@ public class ContinueConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { - if (value is CheckStatus status && CrossNFC.IsSupported && CrossNFC.Current.IsAvailable) + if (value is CheckStatus status) { if (status == CheckStatus.InProgress || status == CheckStatus.Open) { @@ -267,7 +307,16 @@ public class AcceptConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { - if (value is CheckStatus status) + var canEnableBlocked = false; + foreach (var roleDTO in SystemHelper.SystemUserDTO.RoleDTO) + { + if (roleDTO.CanEnableBlocked) + { + canEnableBlocked = true; + break; + } + } + if (value is CheckStatus status && canEnableBlocked) { if (status == CheckStatus.Sent) { diff --git a/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListWorkPage.xaml b/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListWorkPage.xaml index eda4002..9bb60ed 100644 --- a/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListWorkPage.xaml +++ b/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListWorkPage.xaml @@ -8,7 +8,7 @@ Title=""> -