Van új és folytatható CheckLista
This commit is contained in:
@@ -3,32 +3,62 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
x:Class="WorkFlowCheck.MAUI.Pages.CheckList.CheckListPage"
|
||||
Title="Ellenőrzések">
|
||||
<Grid RowDefinitions="Auto, * , Auto" Padding="30,0">
|
||||
<Grid RowDefinitions="*,*" Padding="30,0">
|
||||
|
||||
<ScrollView Grid.Row="0">
|
||||
<Frame BorderColor="Gray" Padding="5" Margin="1" HasShadow="True">
|
||||
<VerticalStackLayout>
|
||||
<Label Text="Megkezdett ellenőrzések" FontAttributes="Bold" FontSize="Medium" HorizontalOptions="Center" />
|
||||
<CollectionView x:Name="CheckList">
|
||||
<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 .}" />
|
||||
</HorizontalStackLayout>
|
||||
</StackLayout>
|
||||
</Frame>
|
||||
</DataTemplate>
|
||||
</CollectionView.ItemTemplate>
|
||||
</CollectionView>
|
||||
</VerticalStackLayout>
|
||||
</Frame>
|
||||
</ScrollView>
|
||||
|
||||
<ScrollView Grid.Row="1">
|
||||
<Frame BorderColor="Gray" Padding="5" Margin="1" HasShadow="True">
|
||||
<VerticalStackLayout>
|
||||
<Label Text="Megkezdett ellenőrzések" FontAttributes="Bold" FontSize="Medium" HorizontalOptions="Center" />
|
||||
|
||||
</VerticalStackLayout>
|
||||
</Frame>
|
||||
|
||||
</ScrollView>
|
||||
<ScrollView Grid.Row="2">
|
||||
<Frame BorderColor="Gray" Padding="5" Margin="1" HasShadow="True">
|
||||
<VerticalStackLayout>
|
||||
<Label Text="Új ellenőrzés" FontAttributes="Bold" FontSize="Medium" HorizontalOptions="Center" />
|
||||
<Button
|
||||
x:Name="ButtonNewCheck" Margin="5"
|
||||
BackgroundColor="Green"
|
||||
Text="Új indítása"
|
||||
SemanticProperties.Hint="Új indítása"
|
||||
Clicked="OnButtonNewCheck"
|
||||
HorizontalOptions="Fill" />
|
||||
<CollectionView x:Name="CheckListTemplate">
|
||||
<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" />
|
||||
<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 .}" />
|
||||
</HorizontalStackLayout>
|
||||
</StackLayout>
|
||||
</Frame>
|
||||
</DataTemplate>
|
||||
</CollectionView.ItemTemplate>
|
||||
</CollectionView>
|
||||
</VerticalStackLayout>
|
||||
</Frame>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
</Grid>
|
||||
|
||||
</ContentPage>
|
||||
@@ -1,19 +1,56 @@
|
||||
using System.Windows.Input;
|
||||
using WorkFlowCheck.Common.DTO;
|
||||
using WorkFlowCheck.MAUI.Services.Interfaces;
|
||||
|
||||
namespace WorkFlowCheck.MAUI.Pages.CheckList;
|
||||
|
||||
public partial class CheckListPage : ContentPage
|
||||
{
|
||||
public CheckListPage()
|
||||
private readonly ICheckListService _checkListService;
|
||||
private readonly IUserService _userService;
|
||||
|
||||
public ICommand NewCommand { get; set; }
|
||||
public ICommand ContinueCommand { get; set; }
|
||||
|
||||
public CheckListPage()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
_checkListService = MauiProgram.ServiceProvider.GetRequiredService<ICheckListService>();
|
||||
_userService = MauiProgram.ServiceProvider.GetRequiredService<IUserService>();
|
||||
|
||||
}
|
||||
protected override bool OnBackButtonPressed()
|
||||
{
|
||||
Shell.Current.GoToAsync("//MainPage");
|
||||
return true;
|
||||
}
|
||||
public async void OnButtonNewCheck(object sender, EventArgs e)
|
||||
protected override async void OnAppearing()
|
||||
{
|
||||
base.OnAppearing();
|
||||
NewCommand = new Command<CheckListTemplateHeaderDTO>(OnNewItem);
|
||||
ContinueCommand = new Command<CheckListHeaderDTO>(OnContinueItem);
|
||||
await LoadCheckListTemplate();
|
||||
await LoadCheckList();
|
||||
}
|
||||
private async void OnNewItem(CheckListTemplateHeaderDTO checkListTemplateHeaderDTO)
|
||||
{
|
||||
|
||||
//await Navigation.PushAsync(new CheckPointEditPage(checkPointDTO));
|
||||
}
|
||||
private async void OnContinueItem(CheckListHeaderDTO checkListTemplateHeaderDTO)
|
||||
{
|
||||
|
||||
//await Navigation.PushAsync(new CheckPointEditPage(checkPointDTO));
|
||||
}
|
||||
private async Task LoadCheckListTemplate()
|
||||
{
|
||||
var userId = _userService.GetCurrentUser()?.Id;
|
||||
CheckListTemplate.ItemsSource = await _checkListService.GetCheckListTemplates(userId ?? 1);
|
||||
}
|
||||
private async Task LoadCheckList()
|
||||
{
|
||||
var userId = _userService.GetCurrentUser()?.Id;
|
||||
CheckList.ItemsSource = await _checkListService.GetCheckLists(userId ?? 1);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user