BUGFIXEK UI oldalon

This commit is contained in:
2025-03-31 22:13:28 +02:00
parent 61dd5bc9a1
commit ea305ebbf4
6 changed files with 22 additions and 17 deletions
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WorkFlowCheck.Common.Enums;
namespace WorkFlowCheck.MAUI.DataLayer.Entities
{
@@ -10,7 +11,8 @@ namespace WorkFlowCheck.MAUI.DataLayer.Entities
{
public int Id { get; set; }
public int CheckListTemplateHeaderId { get; set; }
public virtual CheckListTemplateHeader CheckListTemplateHeader { get; set; }
public virtual CheckListTemplateHeader? CheckListTemplateHeader { get; set; }
public CheckStatus CheckStatus { get; set; }
public DateTime DateExecution { get; set; }
public int UserId { get; set; }
public string ShortName { get; set; } = null!;
@@ -29,7 +29,8 @@ namespace WorkFlowCheck.MAUI.Mapper
.ForMember(dest => dest.CheckListRows, opt => opt.MapFrom(src => src.CheckListRowDTO));
CreateMap<CheckListRow, CheckListRowDTO>()
.ForMember(dest => dest.CheckListTemplateRowDTO, opt => opt.MapFrom(src => src.CheckListTemplateRow));
CreateMap<CheckListRowDTO, CheckListRow>();
CreateMap<CheckListRowDTO, CheckListRow>()
.ForMember(dest => dest.CheckListTemplateRow, opt => opt.MapFrom(src => src.CheckListTemplateRowDTO));
}
}
}
@@ -12,7 +12,7 @@ public partial class CheckListPage : ContentPage
private readonly ICheckListService _checkListService;
private readonly IUserService _userService;
private bool _isLoading;
public ICommand NewCommand { get; set; }
public ICommand ContinueCommand { get; set; }
@@ -25,7 +25,7 @@ public partial class CheckListPage : ContentPage
OnPropertyChanged(nameof(IsLoading));
}
}
public CheckListPage()
{
@@ -44,15 +44,21 @@ public partial class CheckListPage : ContentPage
protected override async void OnAppearing()
{
base.OnAppearing();
BindingContext = this;
await LoadCheckListTemplate();
await LoadCheckList();
}
private async void OnNewItem(CheckListTemplateHeaderDTO checkListTemplateHeaderDTO)
{
//await Navigation.PushAsync(new CheckPointEditPage(checkPointDTO));
IsLoading = true;
await _checkListService.StartNew(
new CheckListHeaderNewDTO()
{
UserId = _userService.GetCurrentUser().Id,
CheckListTemplateHeaderId = checkListTemplateHeaderDTO.Id
});
IsLoading = false;
}
private async void OnContinueItem(CheckListHeaderDTO checkListHeaderDTO)
{
@@ -56,7 +56,7 @@ namespace WorkFlowCheck.MAUI.Services
return retVal;
}
public async Task<ApiResponseDTO<CheckListHeaderDTO>> StartNew(CheckListTemplateHeaderDTO checkListTemplateHeaderDTO)
public async Task<ApiResponseDTO<CheckListHeaderDTO>> StartNew(CheckListHeaderNewDTO checkListHeaderNewDTO)
{
try
{
@@ -64,13 +64,7 @@ namespace WorkFlowCheck.MAUI.Services
// Az API végpont meghatározása
string endpoint = $"{_httpClient.BaseAddress}api/checklist/StartNewCheckList";
// HTTP POST kérés küldése
ApiRequestDTO<CheckListTemplateHeaderDTO> request = new ApiRequestDTO<CheckListTemplateHeaderDTO>();
request.UserDTO = _userService.GetCurrentUser();
request.Data = checkListTemplateHeaderDTO;
using (HttpResponseMessage httpResponseMessage = await _httpClient.PostAsJsonAsync(endpoint, request))
using (HttpResponseMessage httpResponseMessage = await _httpClient.PostAsJsonAsync(endpoint, checkListHeaderNewDTO))
{
httpResponseMessage.EnsureSuccessStatusCode();
@@ -9,7 +9,7 @@ namespace WorkFlowCheck.MAUI.Services.Interfaces
{
public interface ICheckListService
{
Task<ApiResponseDTO<CheckListHeaderDTO>> StartNew(CheckListTemplateHeaderDTO checkListTemplateHeaderDTO);
Task<ApiResponseDTO<CheckListHeaderDTO>> StartNew(CheckListHeaderNewDTO checkListHeaderNewDTO);
Task<ApiResponseDTO<CheckPointDTO>> GetCheckPoint(int checkPointId);
Task<ApiResponseDTO<CheckPointDTO>> GetCheckPoint(string checkPointCode);
@@ -262,9 +262,11 @@ namespace WorkFlowCheck.MAUI.Services
await PrepareAuthenticatedRequestAsync();
var checkListHeader = await _dbContext.CheckListHeaders
.Where(w => w.Id == Id)
.Include(i => i.CheckListRows)
.AsNoTracking()
.ToListAsync();
.FirstOrDefaultAsync();
var checkListHeaderDTO = _mapper.Map<CheckListHeaderDTO>(checkListHeader);