Manuális lezárás indokkal
This commit is contained in:
@@ -117,6 +117,18 @@
|
||||
|
||||
<!-- Jobb oldali oszlop: Két gomb egymás mellett -->
|
||||
<HorizontalStackLayout Grid.Column="1" HorizontalOptions="End" Spacing="3">
|
||||
<Button Text="L"
|
||||
Margin="0,0,0,0"
|
||||
BackgroundColor="DarkOrange"
|
||||
HeightRequest="50"
|
||||
MaximumHeightRequest="50"
|
||||
WidthRequest="50"
|
||||
MaximumWidthRequest="50"
|
||||
CornerRadius="25"
|
||||
IsVisible="{Binding CheckStatus, Converter={StaticResource CloseConverter}}"
|
||||
Command="{Binding BindingContext.CloseCommand, Source={x:Reference CheckList}}"
|
||||
CommandParameter="{Binding .}">
|
||||
</Button>
|
||||
<Button Text=""
|
||||
Margin="0,0,0,0"
|
||||
ImageSource="arrow_down.svg"
|
||||
@@ -238,6 +250,7 @@
|
||||
<local:UnBlockedConverter x:Key="UnBlockedConverter" />
|
||||
<local:ContinueConverter x:Key="ContinueConverter" />
|
||||
<local:AcceptConverter x:Key="AcceptConverter" />
|
||||
<local:CloseConverter x:Key="CloseConverter" />
|
||||
</ResourceDictionary>
|
||||
</ContentPage.Resources>
|
||||
</ContentPage>
|
||||
@@ -9,6 +9,7 @@ using WorkFlowCheck.Common.DTO;
|
||||
using WorkFlowCheck.Common.Enums;
|
||||
using WorkFlowCheck.MAUI.Helper;
|
||||
using WorkFlowCheck.MAUI.Pages.NFC;
|
||||
using WorkFlowCheck.MAUI.Pages.System;
|
||||
using WorkFlowCheck.MAUI.Services.Interfaces;
|
||||
|
||||
namespace WorkFlowCheck.MAUI.Pages.CheckList;
|
||||
@@ -28,6 +29,7 @@ public partial class CheckListPage : ContentPage
|
||||
public ICommand BlockCommand { get; set; }
|
||||
public ICommand AcceptCommand { get; set; }
|
||||
public ICommand InfoCommand { get; set; }
|
||||
public ICommand CloseCommand { get; set; }
|
||||
public ICommand RefreshCommand { get; }
|
||||
|
||||
public bool IsLoading
|
||||
@@ -75,6 +77,7 @@ public partial class CheckListPage : ContentPage
|
||||
BlockCommand = new Command<CheckListHeaderDTO>(OnBlockItem);
|
||||
AcceptCommand = new Command<CheckListHeaderDTO>(OnAcceptItem);
|
||||
InfoCommand = new Command<CheckListHeaderDTO>(OnInfoItem);
|
||||
CloseCommand = new Command<CheckListHeaderDTO>(OnCloseItem);
|
||||
RefreshCommand = new Command(async () => await OnRefresh());
|
||||
|
||||
}
|
||||
@@ -285,6 +288,43 @@ public partial class CheckListPage : ContentPage
|
||||
}
|
||||
}
|
||||
}
|
||||
private async void OnCloseItem(CheckListHeaderDTO checkListHeaderDTO)
|
||||
{
|
||||
var popup = new InputPopup("Kérem adja meg a lezárás okát!");
|
||||
var (isConfirmed, userInput) = await popup.ShowAsync();
|
||||
|
||||
|
||||
if (isConfirmed && !string.IsNullOrEmpty(userInput))
|
||||
{
|
||||
var checkListHeaderCloseDTO = new CheckListHeaderCloseDTO()
|
||||
{
|
||||
Id = checkListHeaderDTO.Id,
|
||||
CloseReason = userInput,
|
||||
UserId = _userService.GetCurrentUser().Id
|
||||
};
|
||||
var success = await _checkListService.CloseCheckListHeader(checkListHeaderCloseDTO);
|
||||
if (success)
|
||||
{
|
||||
IsRefreshing = true;
|
||||
await LoadCheckList();
|
||||
IsRefreshing = false;
|
||||
await SystemHelper.ShowSnackBar("Lezárás sikeres!",
|
||||
SystemHelper.ColorToHex(Colors.Green),
|
||||
SystemHelper.ColorToHex(Colors.Green),
|
||||
SystemHelper.ColorToHex(Colors.White),
|
||||
5);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
await SystemHelper.ShowSnackBar("Lezárás SIKERTELEN!",
|
||||
SystemHelper.ColorToHex(Colors.Red),
|
||||
SystemHelper.ColorToHex(Colors.Red),
|
||||
SystemHelper.ColorToHex(Colors.Yellow),
|
||||
15);
|
||||
}
|
||||
}
|
||||
}
|
||||
private async void OnAcceptItem(CheckListHeaderDTO checkListHeaderDTO)
|
||||
{
|
||||
bool answer = await DisplayAlert("Megerõsítés", "Biztosan jóváhagyod a folyamatot?", "Igen", "Mégsem");
|
||||
@@ -378,6 +418,31 @@ public class BlockedConverter : IValueConverter
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
public class CloseConverter : 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 && canEnableBlocked)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
public class UnBlockedConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
|
||||
Reference in New Issue
Block a user