Jóváhagyás gomb MOBIL-on

This commit is contained in:
2025-04-17 14:39:50 +02:00
parent 2798aeaf0d
commit dbc2f30a27
3 changed files with 104 additions and 2 deletions
@@ -85,6 +85,17 @@
Command="{Binding BindingContext.UnblockCommand, Source={x:Reference CheckList}}"
CommandParameter="{Binding .}">
</Button>
<Button Text="Jóváhagyás"
Margin="5,0,0,0"
BackgroundColor="DarkGreen"
HeightRequest="50"
MaximumHeightRequest="50"
WidthRequest="120"
MaximumWidthRequest="120"
IsVisible="{Binding CheckStatus, Converter={StaticResource AcceptConverter}}"
Command="{Binding BindingContext.AcceptCommand, Source={x:Reference CheckList}}"
CommandParameter="{Binding .}">
</Button>
<Button Text="Folytatás"
Margin="5,0,0,0"
BackgroundColor="Blue"
@@ -23,6 +23,7 @@ public partial class CheckListPage : ContentPage
public ICommand ContinueCommand { get; set; }
public ICommand UnblockCommand { get; set; }
public ICommand BlockCommand { get; set; }
public ICommand AcceptCommand { get; set; }
public bool IsLoading
{
get => _isLoading;
@@ -44,6 +45,7 @@ public partial class CheckListPage : ContentPage
ContinueCommand = new Command<CheckListHeaderDTO>(OnContinueItem);
UnblockCommand = new Command<CheckListHeaderDTO>(OnUnblockItem);
BlockCommand = new Command<CheckListHeaderDTO>(OnBlockItem);
AcceptCommand = new Command<CheckListHeaderDTO>(OnAcceptItem);
}
private void SetInfo()
@@ -146,6 +148,15 @@ public partial class CheckListPage : ContentPage
await LoadCheckList();
}
}
private async void OnAcceptItem(CheckListHeaderDTO checkListHeaderDTO)
{
bool answer = await DisplayAlert("Megerõsítés", "Biztosan jóváhagyod a folyamatot?", "Igen", "Mégsem");
if (answer)
{
await _checkListService.AcceptCheckListHeader(checkListHeaderDTO);
await LoadCheckList();
}
}
private async Task LoadCheckListTemplate()
{
IsLoading = true;
@@ -233,6 +244,26 @@ public class ContinueConverter : IValueConverter
return false;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
public class AcceptConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is CheckStatus status)
{
if (status == CheckStatus.Sent)
{
return true;
}
return false;
}
return false;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();