Egy kis UI rendezés

This commit is contained in:
2025-04-07 07:57:10 +02:00
parent 2513765e51
commit e306139aec
19 changed files with 137 additions and 50 deletions
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:WorkFlowCheck.MAUI.Pages.CheckList"
x:Class="WorkFlowCheck.MAUI.Pages.CheckList.CheckListPage"
Title="Ellenőrzések"
BackgroundColor="#f0f0f0">
@@ -18,17 +19,31 @@
<CollectionView.ItemTemplate>
<DataTemplate>
<Frame BorderColor="Gray" Padding="10" Margin="5" HasShadow="True" BackgroundColor="WhiteSmoke">
<StackLayout>
<Label Text="{Binding DocumentNumber}" FontSize="16" FontAttributes="Bold" />
<Label Text="{Binding DateExecution}" FontSize="14" />
<HorizontalStackLayout HorizontalOptions="End">
<Button Text="Folytatás"
Margin="5,0,0,0"
BackgroundColor="Blue"
Command="{Binding BindingContext.ContinueCommand, Source={x:Reference CheckList}}"
CommandParameter="{Binding .}" />
<Grid ColumnDefinitions="*,Auto">
<!-- Bal oldali oszlop: Két Label egymás alatt -->
<StackLayout Grid.Column="0" Spacing="2">
<Label Text="{Binding DocumentNumber}" FontSize="16" FontAttributes="Bold" />
<Label Text="{Binding DateExecution}" FontSize="14" />
</StackLayout>
<!-- Jobb oldali oszlop: Két gomb egymás mellett -->
<HorizontalStackLayout Grid.Column="1" HorizontalOptions="End" Spacing="5">
<Button Text="Feloldás"
Margin="5,0,0,0"
BackgroundColor="Green"
IsVisible="{Binding CheckStatus, Converter={StaticResource BlockedVisibleConverter}}"
Command="{Binding BindingContext.UnblockCommand, Source={x:Reference CheckList}}"
CommandParameter="{Binding .}">
</Button>
<Button Text="Folytatás"
Margin="5,0,0,0"
BackgroundColor="Blue"
IsVisible="{Binding CheckStatus, Converter={StaticResource BlockedHideConverter}}"
Command="{Binding BindingContext.ContinueCommand, Source={x:Reference CheckList}}"
CommandParameter="{Binding .}">
</Button>
</HorizontalStackLayout>
</StackLayout>
</Grid>
</Frame>
</DataTemplate>
</CollectionView.ItemTemplate>
@@ -36,8 +51,8 @@
</VerticalStackLayout>
</ScrollView>
</Frame>
<Frame Grid.Row="1"
<Frame Grid.Row="1"
BorderColor="Gray"
Padding="5"
Margin="1"
@@ -50,17 +65,19 @@
<CollectionView.ItemTemplate>
<DataTemplate>
<Frame BorderColor="Gray" Padding="10" Margin="5" HasShadow="True" BackgroundColor="WhiteSmoke">
<StackLayout>
<Label Text="{Binding ShortName}" FontSize="16" FontAttributes="Bold" />
<Label Text="{Binding Description}" FontSize="14" />
<Grid ColumnDefinitions="*,Auto">
<StackLayout>
<Label Text="{Binding ShortName}" FontSize="16" FontAttributes="Bold" />
<Label Text="{Binding Description}" FontSize="14" />
</StackLayout>
<HorizontalStackLayout HorizontalOptions="End">
<Button Text="Új ellenőrzés"
BackgroundColor="Green"
Margin="5,0,0,0"
Command="{Binding BindingContext.NewCommand, Source={x:Reference CheckListTemplate}}"
CommandParameter="{Binding .}" />
BackgroundColor="Green"
Margin="5,0,0,0"
Command="{Binding BindingContext.NewCommand, Source={x:Reference CheckListTemplate}}"
CommandParameter="{Binding .}" />
</HorizontalStackLayout>
</StackLayout>
</Grid>
</Frame>
</DataTemplate>
</CollectionView.ItemTemplate>
@@ -75,7 +92,7 @@
VerticalOptions="Fill"
HorizontalOptions="Fill"
ZIndex="1000">
<ActivityIndicator IsRunning="{Binding IsLoading}"
<ActivityIndicator IsRunning="{Binding IsLoading}"
HorizontalOptions="Center"
VerticalOptions="Center"
Color="White"
@@ -83,5 +100,10 @@
HeightRequest="50"/>
</Grid>
</Grid>
<ContentPage.Resources>
<ResourceDictionary>
<local:BlockedVisibleConverter x:Key="BlockedVisibleConverter" />
<local:BlockedHideConverter x:Key="BlockedHideConverter" />
</ResourceDictionary>
</ContentPage.Resources>
</ContentPage>
@@ -1,7 +1,9 @@
using System.Diagnostics;
using System.Globalization;
using System.Threading.Tasks;
using System.Windows.Input;
using WorkFlowCheck.Common.DTO;
using WorkFlowCheck.Common.Enums;
using WorkFlowCheck.MAUI.Pages.NFC;
using WorkFlowCheck.MAUI.Services.Interfaces;
@@ -16,6 +18,7 @@ public partial class CheckListPage : ContentPage
public ICommand NewCommand { get; set; }
public ICommand ContinueCommand { get; set; }
public ICommand UnblockCommand { get; set; }
public bool IsLoading
{
get => _isLoading;
@@ -34,6 +37,7 @@ public partial class CheckListPage : ContentPage
_userService = MauiProgram.ServiceProvider.GetRequiredService<IUserService>();
NewCommand = new Command<CheckListTemplateHeaderDTO>(OnNewItem);
ContinueCommand = new Command<CheckListHeaderDTO>(OnContinueItem);
UnblockCommand = new Command<CheckListHeaderDTO>(OnUnblockItem);
}
protected override bool OnBackButtonPressed()
@@ -53,8 +57,8 @@ public partial class CheckListPage : ContentPage
{
IsLoading = true;
await _checkListService.StartNew(
new CheckListHeaderNewDTO()
{
new CheckListHeaderNewDTO()
{
UserId = _userService.GetCurrentUser().Id,
CheckListTemplateHeaderId = checkListTemplateHeaderDTO.Id
});
@@ -72,6 +76,10 @@ public partial class CheckListPage : ContentPage
await Navigation.PushAsync(new CheckListWorkPage(checkListHeaderDTO.Id, checkPointCode));
}
}
private async void OnUnblockItem(CheckListHeaderDTO checkListHeaderDTO)
{
}
private async Task LoadCheckListTemplate()
{
@@ -88,4 +96,41 @@ public partial class CheckListPage : ContentPage
IsLoading = false;
}
}
public class BlockedVisibleConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is CheckStatus status)
{
return status == CheckStatus.Blocked;
}
return false;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
public class BlockedHideConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is CheckStatus status)
{
if (status == CheckStatus.Open || status == CheckStatus.InProgress)
{
return true;
}
return false;
}
return false;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}