UI fejlesztése
This commit is contained in:
@@ -11,7 +11,8 @@ namespace WorkFlowCheck.Common.DTO
|
|||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public int CheckListHeaderId { get; set; }
|
public int CheckListHeaderId { get; set; }
|
||||||
public int CheckListTemplateRowId { get; set; }
|
public int CheckListTemplateRowId { get; set; }
|
||||||
public virtual CheckListTemplateRowDTO CheckListTemplateRowDTO { get; set; }
|
public CheckListTemplateRowDTO CheckListTemplateRowDTO { get; set; }
|
||||||
|
public string GroupName => $"AnswerGroup_{CheckListTemplateRowDTO.RowIndex}";
|
||||||
public string Answer { get; set; } = null!;
|
public string Answer { get; set; } = null!;
|
||||||
public byte[] Photo { get; set; } = null!;
|
public byte[] Photo { get; set; } = null!;
|
||||||
public Guid GuidNumber { get; set; }
|
public Guid GuidNumber { get; set; }
|
||||||
|
|||||||
@@ -27,6 +27,9 @@ namespace WorkFlowCheck.MAUI.Mapper
|
|||||||
.ForMember(dest => dest.CheckListRowDTO, opt => opt.MapFrom(src => src.CheckListRows));
|
.ForMember(dest => dest.CheckListRowDTO, opt => opt.MapFrom(src => src.CheckListRows));
|
||||||
CreateMap<CheckListHeaderDTO, CheckListHeader>()
|
CreateMap<CheckListHeaderDTO, CheckListHeader>()
|
||||||
.ForMember(dest => dest.CheckListRows, opt => opt.MapFrom(src => src.CheckListRowDTO));
|
.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>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
x:Class="WorkFlowCheck.MAUI.Pages.BaseStock.CheckPoints.CheckPointEditPage"
|
x:Class="WorkFlowCheck.MAUI.Pages.BaseStock.CheckPoints.CheckPointEditPage"
|
||||||
xmlns:local="clr-namespace:WorkFlowCheck.MAUI.Pages.BaseStock.CheckPoints"
|
xmlns:local="clr-namespace:WorkFlowCheck.MAUI.Pages.BaseStock.CheckPoints"
|
||||||
|
xmlns:templateselectors="clr-namespace:WorkFlowCheck.MAUI.TemplateSelectors"
|
||||||
Title="{Binding CheckPointDTO.ShortName}">
|
Title="{Binding CheckPointDTO.ShortName}">
|
||||||
<StackLayout Padding="20">
|
<StackLayout Padding="20">
|
||||||
<!-- Cím: Edit Item -->
|
<!-- Cím: Edit Item -->
|
||||||
@@ -143,7 +144,7 @@
|
|||||||
</Grid>
|
</Grid>
|
||||||
</Frame>
|
</Frame>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
<local:AnswerTypeTemplateSelector x:Key="AnswerTemplateSelector"
|
<templateselectors:AnswerTypeTemplateSelector x:Key="AnswerTemplateSelector"
|
||||||
I_N_Template="{StaticResource I_N_Template}"
|
I_N_Template="{StaticResource I_N_Template}"
|
||||||
P_Template="{StaticResource P_Template}"
|
P_Template="{StaticResource P_Template}"
|
||||||
SI_N_Template="{StaticResource SI_N_Template}"
|
SI_N_Template="{StaticResource SI_N_Template}"
|
||||||
|
|||||||
@@ -44,33 +44,3 @@ public partial class CheckPointEditPage : ContentPage
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public class AnswerTypeTemplateSelector : DataTemplateSelector
|
|
||||||
{
|
|
||||||
public DataTemplate I_N_Template { get; set; }
|
|
||||||
public DataTemplate P_Template { get; set; }
|
|
||||||
public DataTemplate V_Template { get; set; }
|
|
||||||
public DataTemplate SI_N_Template { get; set; }
|
|
||||||
public DataTemplate I_SN_Template { get; set; }
|
|
||||||
public DataTemplate PI_N_Template { get; set; }
|
|
||||||
public DataTemplate I_PN_Template { get; set; }
|
|
||||||
|
|
||||||
protected override DataTemplate OnSelectTemplate(object item, BindableObject container)
|
|
||||||
{
|
|
||||||
if (item is CheckListTemplateRowDTO model)
|
|
||||||
{
|
|
||||||
return model.AnswerType switch
|
|
||||||
{
|
|
||||||
"I-N" => I_N_Template,
|
|
||||||
"P" => P_Template,
|
|
||||||
"V" => V_Template,
|
|
||||||
"SI-N" => SI_N_Template,
|
|
||||||
"I-SN" => I_SN_Template,
|
|
||||||
"PI-N" => PI_N_Template,
|
|
||||||
"I-PN" => I_PN_Template,
|
|
||||||
_ => I_N_Template
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -44,9 +44,13 @@ public partial class CheckListPage : ContentPage
|
|||||||
{
|
{
|
||||||
var taskCompletionSource = new TaskCompletionSource<string>();
|
var taskCompletionSource = new TaskCompletionSource<string>();
|
||||||
await Navigation.PushAsync(new NFCWaiter(taskCompletionSource));
|
await Navigation.PushAsync(new NFCWaiter(taskCompletionSource));
|
||||||
var result = await taskCompletionSource.Task;
|
var checkPintCode = await taskCompletionSource.Task;
|
||||||
|
if (!string.IsNullOrEmpty(checkPintCode))
|
||||||
|
{
|
||||||
|
await Navigation.PopAsync();
|
||||||
|
await Navigation.PushAsync(new CheckListWorkPage(checkListHeaderDTO.Id, checkPintCode));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
private async Task LoadCheckListTemplate()
|
private async Task LoadCheckListTemplate()
|
||||||
|
|||||||
@@ -0,0 +1,206 @@
|
|||||||
|
<?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"
|
||||||
|
x:Class="WorkFlowCheck.MAUI.Pages.CheckList.CheckListWorkPage"
|
||||||
|
xmlns:templateselectors="clr-namespace:WorkFlowCheck.MAUI.TemplateSelectors"
|
||||||
|
xmlns:local="clr-namespace:WorkFlowCheck.MAUI.Pages.CheckList"
|
||||||
|
Title="CheckListWorkPage">
|
||||||
|
<StackLayout Padding="20">
|
||||||
|
<Label Text="Ellenőrzési feladatok" FontAttributes="Bold" FontSize="Medium" HorizontalOptions="Center" />
|
||||||
|
<Frame BorderColor="Gray" Padding="1" Margin="2" HasShadow="True" CornerRadius="2">
|
||||||
|
<CollectionView x:Name="CheckPointCheckListRows"
|
||||||
|
HeightRequest="640"
|
||||||
|
ItemTemplate="{StaticResource AnswerTemplateSelector}">
|
||||||
|
<CollectionView.EmptyView>
|
||||||
|
<Label Text="Nincsenek feladatok." HorizontalOptions="Center" VerticalOptions="Center"/>
|
||||||
|
</CollectionView.EmptyView>
|
||||||
|
</CollectionView>
|
||||||
|
</Frame>
|
||||||
|
</StackLayout>
|
||||||
|
<ContentPage.Resources>
|
||||||
|
<DataTemplate x:Key="I_N_Template">
|
||||||
|
<Frame BorderColor="Gray" Padding="1" Margin="2" HasShadow="True" CornerRadius="2">
|
||||||
|
<Grid ColumnSpacing="2">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="3*" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Label Text="{Binding CheckListTemplateRowDTO.RowIndex,StringFormat='{}{0:D1}.'}" BackgroundColor="WhiteSmoke" Grid.Column="0" />
|
||||||
|
<Label Text="{Binding CheckListTemplateRowDTO.OperationDescription}" BackgroundColor="WhiteSmoke" Grid.Column="1" />
|
||||||
|
<Grid Grid.Column="2" ColumnDefinitions="*,*">
|
||||||
|
<Label Text="I" Grid.Column="0" HorizontalTextAlignment="Center"/>
|
||||||
|
<Label Text="N" Grid.Column="1" HorizontalTextAlignment="Center"/>
|
||||||
|
</Grid>
|
||||||
|
<Label Grid.Column="3" Text="Válasz" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
|
||||||
|
</Grid>
|
||||||
|
</Frame>
|
||||||
|
</DataTemplate>
|
||||||
|
<DataTemplate x:Key="P_Template">
|
||||||
|
<Frame BorderColor="Gray" Padding="1" Margin="2" HasShadow="True" CornerRadius="2">
|
||||||
|
<Grid ColumnSpacing="2">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="3*" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Label Text="{Binding CheckListTemplateRowDTO.RowIndex,StringFormat='{}{0:D1}.'}" BackgroundColor="WhiteSmoke" Grid.Column="0" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" />
|
||||||
|
<Label Text="{Binding CheckListTemplateRowDTO.OperationDescription}" BackgroundColor="WhiteSmoke" Grid.Column="1" />
|
||||||
|
<Grid Grid.Column="2" ColumnDefinitions="*">
|
||||||
|
<Label Text="Fénykép készítése szükséges" Grid.Column="0" HorizontalTextAlignment="Center"/>
|
||||||
|
</Grid>
|
||||||
|
<Label Grid.Column="3" Text="Válasz" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" />
|
||||||
|
</Grid>
|
||||||
|
</Frame>
|
||||||
|
</DataTemplate>
|
||||||
|
<DataTemplate x:Key="V_Template">
|
||||||
|
<Frame BorderColor="Gray" Padding="1" Margin="2" HasShadow="True" CornerRadius="2">
|
||||||
|
<Grid ColumnSpacing="2">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="3*" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Label Text="{Binding CheckListTemplateRowDTO.RowIndex,StringFormat='{}{0:D1}.'}" BackgroundColor="WhiteSmoke" Grid.Column="0" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" />
|
||||||
|
<Label Text="{Binding CheckListTemplateRowDTO.OperationDescription}" BackgroundColor="WhiteSmoke" Grid.Column="1" />
|
||||||
|
<Grid Grid.Column="2" ColumnDefinitions="*">
|
||||||
|
<Label Text="Érték megadása szükséges" Grid.Column="0" HorizontalTextAlignment="Center"/>
|
||||||
|
</Grid>
|
||||||
|
<Label Grid.Column="3" Text="Válasz" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
|
||||||
|
</Grid>
|
||||||
|
</Frame>
|
||||||
|
</DataTemplate>
|
||||||
|
<DataTemplate x:Key="SI_N_Template">
|
||||||
|
<Frame BorderColor="Gray" Padding="1" Margin="2" HasShadow="True" CornerRadius="2">
|
||||||
|
<Grid ColumnSpacing="2">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="3*" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Label Text="{Binding CheckListTemplateRowDTO.RowIndex, StringFormat='{}{0:D1}.'}" BackgroundColor="WhiteSmoke" Grid.Column="0" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
|
||||||
|
<Label Text="{Binding CheckListTemplateRowDTO.OperationDescription}" BackgroundColor="WhiteSmoke" Grid.Column="1" />
|
||||||
|
<Grid Grid.Column="2" ColumnDefinitions="*,*">
|
||||||
|
<Label Text="I" Grid.Column="0" BackgroundColor="Yellow" TextColor="Black" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
|
||||||
|
<Label Text="N" Grid.Column="1" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
|
||||||
|
</Grid>
|
||||||
|
<Label Grid.Column="3" Text="Válasz" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
|
||||||
|
</Grid>
|
||||||
|
</Frame>
|
||||||
|
</DataTemplate>
|
||||||
|
<DataTemplate x:Key="I_SN_Template">
|
||||||
|
<Frame BorderColor="Gray" Padding="1" Margin="2" HasShadow="True" CornerRadius="2">
|
||||||
|
<Grid ColumnSpacing="2">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="3*" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Label Text="{Binding CheckListTemplateRowDTO.RowIndex, StringFormat='{}{0:D1}.'}" BackgroundColor="WhiteSmoke" Grid.Column="0" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
|
||||||
|
<Label Text="{Binding CheckListTemplateRowDTO.OperationDescription}" BackgroundColor="WhiteSmoke" Grid.Column="1" />
|
||||||
|
<Grid Grid.Column="2" ColumnDefinitions="*,*">
|
||||||
|
<Label Text="I" Grid.Column="0" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
|
||||||
|
<Label Text="N" Grid.Column="1" BackgroundColor="Yellow" TextColor="Black" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
|
||||||
|
</Grid>
|
||||||
|
<Grid Grid.Column="3" RowDefinitions="Auto,Auto">
|
||||||
|
<local:BindableRadioButton
|
||||||
|
Grid.Row="0"
|
||||||
|
Content="Igen"
|
||||||
|
Value="Igen"
|
||||||
|
BindableGroupName="{Binding GroupName}"
|
||||||
|
IsChecked="{Binding SelectedAnswer, Converter={StaticResource RadioButtonConverter}, ConverterParameter=Igen}"
|
||||||
|
HorizontalOptions="Center" VerticalOptions="Center"/>
|
||||||
|
<local:BindableRadioButton
|
||||||
|
Grid.Row="1"
|
||||||
|
Content="Nem"
|
||||||
|
Value="Nem"
|
||||||
|
BindableGroupName="{Binding GroupName}"
|
||||||
|
IsChecked="{Binding SelectedAnswer, Converter={StaticResource RadioButtonConverter}, ConverterParameter=Nem}"
|
||||||
|
HorizontalOptions="Center" VerticalOptions="Center"/>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</Frame>
|
||||||
|
</DataTemplate>
|
||||||
|
<DataTemplate x:Key="PI_N_Template">
|
||||||
|
<Frame BorderColor="Gray" Padding="1" Margin="2" HasShadow="True" CornerRadius="2">
|
||||||
|
<Grid ColumnSpacing="2">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="3*" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Label Text="{Binding CheckListTemplateRowDTO.RowIndex, StringFormat='{}{0:D1}.'}" BackgroundColor="WhiteSmoke" Grid.Column="0" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
|
||||||
|
<Label Text="{Binding CheckListTemplateRowDTO.OperationDescription}" BackgroundColor="WhiteSmoke" Grid.Column="1" />
|
||||||
|
<Grid Grid.Column="2" ColumnDefinitions="*,*">
|
||||||
|
<Label Text="I" Grid.Column="0" BackgroundColor="Red" TextColor="Black" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
|
||||||
|
<Label Text="N" Grid.Column="1" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
|
||||||
|
</Grid>
|
||||||
|
<Grid Grid.Column="3" RowDefinitions="Auto,Auto">
|
||||||
|
<local:BindableRadioButton
|
||||||
|
Grid.Row="0"
|
||||||
|
Content="Igen"
|
||||||
|
Value="Igen"
|
||||||
|
BindableGroupName="{Binding GroupName}"
|
||||||
|
IsChecked="{Binding SelectedAnswer, Converter={StaticResource RadioButtonConverter}, ConverterParameter=Igen}"
|
||||||
|
HorizontalOptions="Center" VerticalOptions="Center"/>
|
||||||
|
<local:BindableRadioButton
|
||||||
|
Grid.Row="1"
|
||||||
|
Content="Nem"
|
||||||
|
Value="Nem"
|
||||||
|
BindableGroupName="{Binding GroupName}"
|
||||||
|
IsChecked="{Binding SelectedAnswer, Converter={StaticResource RadioButtonConverter}, ConverterParameter=Nem}"
|
||||||
|
HorizontalOptions="Center" VerticalOptions="Center"/>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</Frame>
|
||||||
|
</DataTemplate>
|
||||||
|
<DataTemplate x:Key="I_PN_Template">
|
||||||
|
<Frame BorderColor="Gray" Padding="1" Margin="2" HasShadow="True" CornerRadius="2">
|
||||||
|
<Grid ColumnSpacing="2">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="3*" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Label Text="{Binding CheckListTemplateRowDTO.RowIndex, StringFormat='{}{0:D1}.'}" BackgroundColor="WhiteSmoke" Grid.Column="0" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
|
||||||
|
<Label Text="{Binding CheckListTemplateRowDTO.OperationDescription}" BackgroundColor="WhiteSmoke" Grid.Column="1" />
|
||||||
|
<Grid Grid.Column="2" ColumnDefinitions="*,*">
|
||||||
|
<Label Text="I" Grid.Column="0" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
|
||||||
|
<Label Text="N" Grid.Column="1" BackgroundColor="Red" TextColor="Black" HorizontalTextAlignment="Center" VerticalTextAlignment="Center"/>
|
||||||
|
</Grid>
|
||||||
|
<Grid Grid.Column="3" RowDefinitions="Auto,Auto">
|
||||||
|
<local:BindableRadioButton
|
||||||
|
Grid.Row="0"
|
||||||
|
Content="Igen"
|
||||||
|
Value="Igen"
|
||||||
|
BindableGroupName="{Binding GroupName}"
|
||||||
|
IsChecked="{Binding SelectedAnswer, Converter={StaticResource RadioButtonConverter}, ConverterParameter=Igen}"
|
||||||
|
HorizontalOptions="Center" VerticalOptions="Center"/>
|
||||||
|
<local:BindableRadioButton
|
||||||
|
Grid.Row="1"
|
||||||
|
Content="Nem"
|
||||||
|
Value="Nem"
|
||||||
|
BindableGroupName="{Binding GroupName}"
|
||||||
|
IsChecked="{Binding SelectedAnswer, Converter={StaticResource RadioButtonConverter}, ConverterParameter=Nem}"
|
||||||
|
HorizontalOptions="Center" VerticalOptions="Center"/>
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</Frame>
|
||||||
|
</DataTemplate>
|
||||||
|
<templateselectors:AnswerTypeTemplateSelector x:Key="AnswerTemplateSelector"
|
||||||
|
I_N_Template="{StaticResource I_N_Template}"
|
||||||
|
P_Template="{StaticResource P_Template}"
|
||||||
|
SI_N_Template="{StaticResource SI_N_Template}"
|
||||||
|
I_SN_Template="{StaticResource I_SN_Template}"
|
||||||
|
PI_N_Template="{StaticResource PI_N_Template}"
|
||||||
|
I_PN_Template="{StaticResource I_PN_Template}"
|
||||||
|
V_Template="{StaticResource V_Template}"/>
|
||||||
|
</ContentPage.Resources>
|
||||||
|
</ContentPage>
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
using WorkFlowCheck.Common.DTO;
|
||||||
|
using WorkFlowCheck.MAUI.Services.Interfaces;
|
||||||
|
using Microsoft.Maui.Controls;
|
||||||
|
|
||||||
|
namespace WorkFlowCheck.MAUI.Pages.CheckList;
|
||||||
|
|
||||||
|
public partial class CheckListWorkPage : ContentPage
|
||||||
|
{
|
||||||
|
private readonly ICheckListService _checkListService;
|
||||||
|
private string _checkPointCode;
|
||||||
|
private int _checkListHeaderId;
|
||||||
|
private UserDTO _userDTO;
|
||||||
|
|
||||||
|
|
||||||
|
public CheckListWorkPage(int checkListHeaderId, string checkPointCode)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_checkPointCode = checkPointCode;
|
||||||
|
_checkListHeaderId = checkListHeaderId;
|
||||||
|
_checkListService = MauiProgram.ServiceProvider.GetRequiredService<ICheckListService>();
|
||||||
|
_userDTO = MauiProgram.ServiceProvider.GetRequiredService<IUserService>().GetCurrentUser();
|
||||||
|
}
|
||||||
|
protected override async void OnAppearing()
|
||||||
|
{
|
||||||
|
base.OnAppearing();
|
||||||
|
BindingContext = this;
|
||||||
|
|
||||||
|
await LoadCheckPointCheckListRows();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task LoadCheckPointCheckListRows()
|
||||||
|
{
|
||||||
|
CheckPointCheckListRows.ItemsSource = await _checkListService.GetCheckListRowsByCheckPointCode(_userDTO.Id, _checkListHeaderId, _checkPointCode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public class BindableRadioButton : RadioButton
|
||||||
|
{
|
||||||
|
public static readonly BindableProperty BindableGroupNameProperty =
|
||||||
|
BindableProperty.Create(nameof(BindableGroupName), typeof(string), typeof(BindableRadioButton), default(string), propertyChanged: OnGroupNameChanged);
|
||||||
|
|
||||||
|
public string BindableGroupName
|
||||||
|
{
|
||||||
|
get => (string)GetValue(BindableGroupNameProperty);
|
||||||
|
set => SetValue(BindableGroupNameProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void OnGroupNameChanged(BindableObject bindable, object oldValue, object newValue)
|
||||||
|
{
|
||||||
|
if (bindable is BindableRadioButton radioButton && newValue is string newGroupName)
|
||||||
|
{
|
||||||
|
radioButton.GroupName = newGroupName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -59,7 +59,7 @@ public partial class NFCWaiter : ContentPage
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
await ShowAlert(ex.Message);
|
//await ShowAlert(ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
async Task EndListening()
|
async Task EndListening()
|
||||||
@@ -76,7 +76,7 @@ public partial class NFCWaiter : ContentPage
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
await ShowAlert(ex.Message);
|
//await ShowAlert(ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void SubscribeEvents()
|
void SubscribeEvents()
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using Microsoft.EntityFrameworkCore;
|
|||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using System.Net.Http.Json;
|
using System.Net.Http.Json;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
using WorkFlowCheck.Common.DTO;
|
using WorkFlowCheck.Common.DTO;
|
||||||
using WorkFlowCheck.MAUI.DataLayer;
|
using WorkFlowCheck.MAUI.DataLayer;
|
||||||
using WorkFlowCheck.MAUI.Services.Interfaces;
|
using WorkFlowCheck.MAUI.Services.Interfaces;
|
||||||
@@ -13,10 +14,10 @@ namespace WorkFlowCheck.MAUI.Services
|
|||||||
{
|
{
|
||||||
private readonly IUserService _userService;
|
private readonly IUserService _userService;
|
||||||
private readonly ISyncService _syncService;
|
private readonly ISyncService _syncService;
|
||||||
public CheckListService(HttpClient httpClient,
|
public CheckListService(HttpClient httpClient,
|
||||||
IConfiguration configuration,
|
IConfiguration configuration,
|
||||||
AppDbContext dbContext,
|
AppDbContext dbContext,
|
||||||
IMapper mapper,
|
IMapper mapper,
|
||||||
IUserService userService,
|
IUserService userService,
|
||||||
ISyncService syncService) : base(httpClient, configuration, dbContext, mapper)
|
ISyncService syncService) : base(httpClient, configuration, dbContext, mapper)
|
||||||
{
|
{
|
||||||
@@ -96,20 +97,46 @@ namespace WorkFlowCheck.MAUI.Services
|
|||||||
|
|
||||||
public async Task<List<CheckListTemplateHeaderDTO>> GetCheckListTemplates(int userId)
|
public async Task<List<CheckListTemplateHeaderDTO>> GetCheckListTemplates(int userId)
|
||||||
{
|
{
|
||||||
await _syncService.SyncDatas();
|
await _syncService.SyncDatas();
|
||||||
|
|
||||||
var retVal = new List<CheckListTemplateHeaderDTO>();
|
var retVal = new List<CheckListTemplateHeaderDTO>();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var res = await _dbContext.CheckListTemplateHeaders.ToListAsync();
|
var res = await _dbContext.CheckListTemplateHeaders.ToListAsync();
|
||||||
retVal = _mapper.Map<List<CheckListTemplateHeaderDTO>>(res);
|
retVal = _mapper.Map<List<CheckListTemplateHeaderDTO>>(res);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<List<CheckListRowDTO>> GetCheckListRowsByCheckPointCode(int userId, int checkListHeaderId, string checkPointCode)
|
||||||
|
{
|
||||||
|
var retVal = new List<CheckListRowDTO>();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var checkListRows = await _dbContext.CheckListRows
|
||||||
|
.Include(i => i.CheckListTemplateRow)
|
||||||
|
.ThenInclude(i => i.CheckPoint)
|
||||||
|
.Include(i => i.CheckListHeader)
|
||||||
|
.Where(w => w.CheckListTemplateRow.CheckPoint.Code == checkPointCode &&
|
||||||
|
w.CheckListHeader.UserId == userId &&
|
||||||
|
w.CheckListHeaderId == checkListHeaderId)
|
||||||
|
.AsNoTracking()
|
||||||
|
.ToListAsync();
|
||||||
|
retVal = _mapper.Map<List<CheckListRowDTO>>(checkListRows);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return retVal;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,5 +15,6 @@ namespace WorkFlowCheck.MAUI.Services.Interfaces
|
|||||||
|
|
||||||
Task<List<CheckListHeaderDTO>> GetCheckLists(int userId);
|
Task<List<CheckListHeaderDTO>> GetCheckLists(int userId);
|
||||||
Task<List<CheckListTemplateHeaderDTO>> GetCheckListTemplates(int userId);
|
Task<List<CheckListTemplateHeaderDTO>> GetCheckListTemplates(int userId);
|
||||||
|
Task<List<CheckListRowDTO>> GetCheckListRowsByCheckPointCode(int userId, int checkListHeaderId, string checkPointCode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -220,7 +220,32 @@ namespace WorkFlowCheck.MAUI.Services
|
|||||||
|
|
||||||
_dbContext.CheckListHeaders.AddRange(missingCheckListHeaders);
|
_dbContext.CheckListHeaders.AddRange(missingCheckListHeaders);
|
||||||
await _dbContext.SaveChangesAsync();
|
await _dbContext.SaveChangesAsync();
|
||||||
|
|
||||||
|
foreach (var item in missingItems)
|
||||||
|
{
|
||||||
|
var checkListHeaderDTO = item as CheckListHeaderDTO;
|
||||||
|
|
||||||
|
foreach (var checkListRowDTO in checkListHeaderDTO.CheckListRowDTO)
|
||||||
|
{
|
||||||
|
var checkListRow = _dbContext.CheckListRows.Where(w => w.GuidNumber == checkListRowDTO.GuidNumber).FirstOrDefault();
|
||||||
|
var isAdd = false;
|
||||||
|
if (checkListRow == null)
|
||||||
|
{
|
||||||
|
isAdd = true;
|
||||||
|
checkListRow = new CheckListRow();
|
||||||
|
checkListRow.CheckListHeaderId = checkListHeaderDTO.Id;
|
||||||
|
}
|
||||||
|
checkListRow.Answer = checkListRowDTO.Answer;
|
||||||
|
checkListRow.CheckListTemplateRowId = checkListRowDTO.CheckListTemplateRowId;
|
||||||
|
checkListRow.GuidNumber = checkListRowDTO.GuidNumber;
|
||||||
|
checkListRow.Photo = checkListRowDTO.Photo;
|
||||||
|
|
||||||
|
if (isAdd) _dbContext.CheckListRows.Add(checkListRow);
|
||||||
|
await _dbContext.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using WorkFlowCheck.Common.DTO;
|
||||||
|
|
||||||
|
namespace WorkFlowCheck.MAUI.TemplateSelectors
|
||||||
|
{
|
||||||
|
public class AnswerTypeTemplateSelector : DataTemplateSelector
|
||||||
|
{
|
||||||
|
public DataTemplate I_N_Template { get; set; }
|
||||||
|
public DataTemplate P_Template { get; set; }
|
||||||
|
public DataTemplate V_Template { get; set; }
|
||||||
|
public DataTemplate SI_N_Template { get; set; }
|
||||||
|
public DataTemplate I_SN_Template { get; set; }
|
||||||
|
public DataTemplate PI_N_Template { get; set; }
|
||||||
|
public DataTemplate I_PN_Template { get; set; }
|
||||||
|
|
||||||
|
protected override DataTemplate OnSelectTemplate(object item, BindableObject container)
|
||||||
|
{
|
||||||
|
if (item is CheckListTemplateRowDTO model)
|
||||||
|
{
|
||||||
|
return model.AnswerType switch
|
||||||
|
{
|
||||||
|
"I-N" => I_N_Template,
|
||||||
|
"P" => P_Template,
|
||||||
|
"V" => V_Template,
|
||||||
|
"SI-N" => SI_N_Template,
|
||||||
|
"I-SN" => I_SN_Template,
|
||||||
|
"PI-N" => PI_N_Template,
|
||||||
|
"I-PN" => I_PN_Template,
|
||||||
|
_ => I_N_Template
|
||||||
|
};
|
||||||
|
}
|
||||||
|
if (item is CheckListRowDTO model2)
|
||||||
|
{
|
||||||
|
return model2.CheckListTemplateRowDTO.AnswerType switch
|
||||||
|
{
|
||||||
|
"I-N" => I_N_Template,
|
||||||
|
"P" => P_Template,
|
||||||
|
"V" => V_Template,
|
||||||
|
"SI-N" => SI_N_Template,
|
||||||
|
"I-SN" => I_SN_Template,
|
||||||
|
"PI-N" => PI_N_Template,
|
||||||
|
"I-PN" => I_PN_Template,
|
||||||
|
_ => I_N_Template
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -109,6 +109,9 @@
|
|||||||
<MauiXaml Update="Pages\CheckList\CheckListPage.xaml">
|
<MauiXaml Update="Pages\CheckList\CheckListPage.xaml">
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</MauiXaml>
|
</MauiXaml>
|
||||||
|
<MauiXaml Update="Pages\CheckList\CheckListWorkPage.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</MauiXaml>
|
||||||
<MauiXaml Update="Pages\Media\CaptureImagePage.xaml">
|
<MauiXaml Update="Pages\Media\CaptureImagePage.xaml">
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</MauiXaml>
|
</MauiXaml>
|
||||||
|
|||||||
Reference in New Issue
Block a user