Van új és folytatható CheckLista

This commit is contained in:
2025-03-22 14:18:25 +01:00
parent 6d78762275
commit 3a4db4dd14
10 changed files with 232 additions and 26 deletions
@@ -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);
}
}