From bce3c9e4016a4ba378a046476ba1439e6a9c1b19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Szab=C3=B3?= Date: Thu, 17 Apr 2025 08:41:56 +0200 Subject: [PATCH] =?UTF-8?q?Felold=C3=A1s=20mobilr=C3=B3l?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Pages/CheckList/CheckListPage.xaml.cs | 16 ++++++++- .../Services/CheckListService.cs | 36 ++++++++++++++++++- .../Services/Interfaces/ICheckListService.cs | 4 +++ 3 files changed, 54 insertions(+), 2 deletions(-) diff --git a/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListPage.xaml.cs b/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListPage.xaml.cs index af1d092..5e2e336 100644 --- a/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListPage.xaml.cs +++ b/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListPage.xaml.cs @@ -67,6 +67,9 @@ public partial class CheckListPage : ContentPage } private async void OnNewItem(CheckListTemplateHeaderDTO checkListTemplateHeaderDTO) { + bool answer = await DisplayAlert("Megerősítés", "Biztosan indítasz egy új ellenőrzést?", "Igen", "Mégsem"); + if (!answer) return; + IsLoading = true; var response = await _checkListService.StartNew( new CheckListHeaderNewDTO() @@ -126,11 +129,22 @@ public partial class CheckListPage : ContentPage } private async void OnUnblockItem(CheckListHeaderDTO checkListHeaderDTO) { + bool answer = await DisplayAlert("Megerősítés", "Biztosan feloldod a blokkolást?", "Igen", "Mégsem"); + if (answer) + { + await _checkListService.UnBlockCheckListHeader(checkListHeaderDTO); + await LoadCheckList(); + } } private async void OnBlockItem(CheckListHeaderDTO checkListHeaderDTO) { - + bool answer = await DisplayAlert("Megerősítés", "Biztosan blokkolod a folyamatot?", "Igen", "Mégsem"); + if (answer) + { + await _checkListService.BlockCheckListHeader(checkListHeaderDTO); + await LoadCheckList(); + } } private async Task LoadCheckListTemplate() { diff --git a/src/WorkFlowCheck.MAUI/Services/CheckListService.cs b/src/WorkFlowCheck.MAUI/Services/CheckListService.cs index 7b20edc..a5f1950 100644 --- a/src/WorkFlowCheck.MAUI/Services/CheckListService.cs +++ b/src/WorkFlowCheck.MAUI/Services/CheckListService.cs @@ -96,7 +96,7 @@ namespace WorkFlowCheck.MAUI.Services try { var res = await _dbContext.CheckListHeaders - .Include(i=> i.CheckListTemplateHeader) + .Include(i => i.CheckListTemplateHeader) .Where(w => w.CheckStatus == CheckStatus.Open || w.CheckStatus == CheckStatus.InProgress || w.CheckStatus == CheckStatus.Blocked) @@ -176,5 +176,39 @@ namespace WorkFlowCheck.MAUI.Services } return retVal; } + + public async Task UnBlockCheckListHeader(CheckListHeaderDTO checkListHeaderDTO) + { + var retVal = false; + try + { + var checkListHeader = await _dbContext.CheckListHeaders + .Where(w => w.Id == checkListHeaderDTO.Id) + .FirstOrDefaultAsync(); + if (checkListHeader != null) + { + var userDTO = _userService.GetCurrentUser(); + var endpoint = $"{_httpClient.BaseAddress}api/CheckList/UnBlockCheckListHeader/{checkListHeaderDTO.Id}/{userDTO.Id}"; + var response = await _httpClient.GetFromJsonAsync>(endpoint); + if (response != null) + { + if (response.IsSuccess) + { + checkListHeader.CheckStatus = CheckStatus.InProgress; + await _dbContext.SaveChangesAsync(); + retVal = true; + } + } + } + } + catch (Exception ex) + { + + + } + return retVal; + } + public async Task BlockCheckListHeader(CheckListHeaderDTO checkListHeaderDTO) => throw new NotImplementedException(); + public async Task AcceptCheckListHeader(CheckListHeaderDTO checkListHeaderDTO) => throw new NotImplementedException(); } } diff --git a/src/WorkFlowCheck.MAUI/Services/Interfaces/ICheckListService.cs b/src/WorkFlowCheck.MAUI/Services/Interfaces/ICheckListService.cs index abd7fea..a014cf4 100644 --- a/src/WorkFlowCheck.MAUI/Services/Interfaces/ICheckListService.cs +++ b/src/WorkFlowCheck.MAUI/Services/Interfaces/ICheckListService.cs @@ -18,5 +18,9 @@ namespace WorkFlowCheck.MAUI.Services.Interfaces Task> GetCheckListTemplates(int userId); Task> GetCheckListRowsByCheckPointCode(int userId, int checkListHeaderId, string checkPointCode); Task UpdateCheckListRow(CheckListRowDTO checkListRowDTO); + + Task UnBlockCheckListHeader(CheckListHeaderDTO checkListHeaderDTO); + Task BlockCheckListHeader(CheckListHeaderDTO checkListHeaderDTO); + Task AcceptCheckListHeader(CheckListHeaderDTO checkListHeaderDTO); } }