CheckListInfoPage implementálása
This commit is contained in:
@@ -22,5 +22,7 @@ namespace WorkFlowCheck.Common.DTO
|
||||
|
||||
[DisplayName("Ellenőrzési pontok száma")]
|
||||
public int CheckPointCount { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace WorkFlowCheck.MAUI.Helper
|
||||
public static string DatabaseName = "";
|
||||
public static bool Syncronised = false;
|
||||
public static UserDTO SystemUserDTO;
|
||||
public static string ProgramVersion = "v1.1.023";
|
||||
public static string ProgramVersion = "v1.1.024";
|
||||
|
||||
#if DEBUG
|
||||
public static string ApiBaseUrl = $"https://dev.wfcapi.nuvolar.hu/";
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
<?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.CheckListInfoPage"
|
||||
Title="CheckListInfoPage">
|
||||
<Shell.TitleView>
|
||||
<Grid Padding="2" VerticalOptions="Center">
|
||||
<Label x:Name="HeaderLabel" Text=""
|
||||
FontSize="22"
|
||||
FontAttributes="Bold"
|
||||
VerticalOptions="Center"
|
||||
HorizontalOptions="Start" />
|
||||
<HorizontalStackLayout
|
||||
VerticalOptions="Center"
|
||||
HorizontalOptions="End"
|
||||
Spacing="5">
|
||||
<Frame CornerRadius="1"
|
||||
Padding="5"
|
||||
HasShadow="True"
|
||||
VerticalOptions="Center"
|
||||
HorizontalOptions="End">
|
||||
<Label x:Name="DeviceId"
|
||||
FontSize="10"
|
||||
TextColor="Black"/>
|
||||
</Frame>
|
||||
<Frame CornerRadius="1"
|
||||
Padding="5"
|
||||
HasShadow="True"
|
||||
VerticalOptions="Center"
|
||||
HorizontalOptions="End">
|
||||
<Label x:Name="UserInfo"
|
||||
FontSize="10"
|
||||
FontAttributes="Bold"
|
||||
TextColor="Black"/>
|
||||
</Frame>
|
||||
</HorizontalStackLayout>
|
||||
</Grid>
|
||||
</Shell.TitleView>
|
||||
<Grid RowDefinitions="*" Padding="30,30">
|
||||
<Frame Grid.Row="0"
|
||||
BorderColor="Gray"
|
||||
Padding="5"
|
||||
Margin="1"
|
||||
CornerRadius="10"
|
||||
HasShadow="True">
|
||||
<StackLayout Grid.Column="1" Spacing="2">
|
||||
<Label x:Name="row1" FontSize="20" FontAttributes="Bold" />
|
||||
<Label x:Name="row2" Text="B" FontSize="20" />
|
||||
<Label x:Name="row3" Text="C" FontSize="20" />
|
||||
<Label x:Name="row4" Text="D" FontSize="20" />
|
||||
<Label x:Name="row5" Text="D" FontSize="25" FontAttributes="Bold"/>
|
||||
</StackLayout>
|
||||
</Frame>
|
||||
</Grid>
|
||||
</ContentPage>
|
||||
@@ -0,0 +1,71 @@
|
||||
using Android.DeviceLock;
|
||||
using Firebase.Auth;
|
||||
using System.Globalization;
|
||||
using System.Threading.Tasks;
|
||||
using WorkFlowCheck.Common.DTO;
|
||||
using WorkFlowCheck.MAUI.Services.Interfaces;
|
||||
|
||||
namespace WorkFlowCheck.MAUI.Pages.CheckList;
|
||||
|
||||
public partial class CheckListInfoPage : ContentPage
|
||||
{
|
||||
private readonly ICheckListService _checkListService;
|
||||
private readonly IUserService _userService;
|
||||
private UserDTO _currentUser;
|
||||
private CheckListHeaderDTO _checkListHeaderDTO;
|
||||
private CheckListHeaderInfoDTO _checkListHeaderInfoDTO;
|
||||
public CheckListInfoPage(CheckListHeaderDTO checkListHeaderDTO)
|
||||
{
|
||||
InitializeComponent();
|
||||
_userService = MauiProgram.ServiceProvider.GetRequiredService<IUserService>();
|
||||
_checkListService = MauiProgram.ServiceProvider.GetRequiredService<ICheckListService>();
|
||||
_checkListHeaderDTO = checkListHeaderDTO;
|
||||
}
|
||||
private async Task SetInfo()
|
||||
{
|
||||
_currentUser = _userService.GetCurrentUser();
|
||||
DeviceId.Text = _userService.DeviceId;
|
||||
UserInfo.Text = $"{_currentUser?.LastName} {_currentUser?.FirstName}";
|
||||
HeaderLabel.Text = _checkListHeaderDTO.DocumentNumber;
|
||||
}
|
||||
protected override async void OnAppearing()
|
||||
{
|
||||
base.OnAppearing();
|
||||
BindingContext = this;
|
||||
await SetInfo();
|
||||
BuildCheckListHeaderInfo();
|
||||
}
|
||||
private async Task BuildCheckListHeaderInfo()
|
||||
{
|
||||
_checkListHeaderInfoDTO = new CheckListHeaderInfoDTO();
|
||||
|
||||
var result = _checkListHeaderDTO.CheckListRowDTO
|
||||
.GroupBy(r => 1)
|
||||
.Select(g => new
|
||||
{
|
||||
TotalRowCount = g.Count(),
|
||||
EmptyAnswerCount = g.Count(r => string.IsNullOrEmpty(r.Answer)),
|
||||
CheckPointCount = g.Select(r => r.CheckListTemplateRowDTO.CheckPointId).Distinct().Count()
|
||||
})
|
||||
.FirstOrDefault();
|
||||
if (result != null)
|
||||
{
|
||||
_checkListHeaderInfoDTO.TotalRowCount = result.TotalRowCount;
|
||||
_checkListHeaderInfoDTO.CheckPointCount = result.CheckPointCount;
|
||||
_checkListHeaderInfoDTO.EmptyAnswerCount = result.EmptyAnswerCount;
|
||||
if (_checkListHeaderInfoDTO.TotalRowCount > 0)
|
||||
{
|
||||
_checkListHeaderInfoDTO.ReadyPercent = ((double)(_checkListHeaderInfoDTO.TotalRowCount - _checkListHeaderInfoDTO.EmptyAnswerCount) / _checkListHeaderInfoDTO.TotalRowCount * 100)
|
||||
.ToString("0.00", new CultureInfo("hu-HU")) + " %";
|
||||
}
|
||||
}
|
||||
|
||||
var checkPointDTO = await _checkListService.GetNextCheckpointNotSend(_checkListHeaderDTO);
|
||||
|
||||
row1.Text = $"Összes ellenõrizendõ lépés: {_checkListHeaderInfoDTO.TotalRowCount} db";
|
||||
row2.Text = $"Összes még nem ellenõrzött lépés: {_checkListHeaderInfoDTO.EmptyAnswerCount} db";
|
||||
row3.Text = $"Ellenõrzési pontok száma: {_checkListHeaderInfoDTO.CheckPointCount} db";
|
||||
row4.Text = $"Készültség: {_checkListHeaderInfoDTO.ReadyPercent}";
|
||||
row5.Text = $"Következõ ellenõrzési pont : {checkPointDTO.ShortName}";
|
||||
}
|
||||
}
|
||||
@@ -82,67 +82,92 @@
|
||||
<DataTemplate>
|
||||
<Frame BorderColor="Gray" Padding="15" Margin="5" HasShadow="True" BackgroundColor="WhiteSmoke">
|
||||
<Grid ColumnDefinitions="*,Auto">
|
||||
<!-- Bal oldali oszlop: Két Label egymás alatt -->
|
||||
<StackLayout Grid.Column="0" Spacing="2">
|
||||
<Label Text="{Binding DocumentNumber}" FontSize="14" FontAttributes="Bold" />
|
||||
<Label Text="{Binding DateExecution}" FontSize="12" />
|
||||
<Label Text="{Binding CheckListTemplateHeaderDTO.ShortName}" FontSize="10" />
|
||||
<Label Text="{Binding StatusName}" FontSize="10" />
|
||||
</StackLayout>
|
||||
<Grid ColumnSpacing="10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Bal oldali gomb -->
|
||||
<Button Grid.Column="0"
|
||||
VerticalOptions="Center"
|
||||
Text="i"
|
||||
FontSize="17"
|
||||
FontAttributes="Bold"
|
||||
BackgroundColor="Purple"
|
||||
HeightRequest="40"
|
||||
WidthRequest="40"
|
||||
CornerRadius="20"
|
||||
BorderColor="Gray"
|
||||
BorderWidth="1"
|
||||
Command="{Binding BindingContext.InfoCommand, Source={x:Reference CheckList}}"
|
||||
CommandParameter="{Binding .}" />
|
||||
|
||||
<!-- Jobb oldali szövegek -->
|
||||
<StackLayout Grid.Column="1" Spacing="2">
|
||||
<Label Text="{Binding DocumentNumber}" FontSize="14" FontAttributes="Bold" />
|
||||
<Label Text="{Binding DateExecution}" FontSize="12" />
|
||||
<Label Text="{Binding CheckListTemplateHeaderDTO.ShortName}" FontSize="10" />
|
||||
<Label Text="{Binding StatusName}" FontSize="10" />
|
||||
</StackLayout>
|
||||
</Grid>
|
||||
|
||||
<!-- Jobb oldali oszlop: Két gomb egymás mellett -->
|
||||
<HorizontalStackLayout Grid.Column="1" HorizontalOptions="End" Spacing="3">
|
||||
<Button Text=""
|
||||
Margin="0,0,0,0"
|
||||
ImageSource="arrow_down.svg"
|
||||
BackgroundColor="Red"
|
||||
HeightRequest="50"
|
||||
MaximumHeightRequest="50"
|
||||
WidthRequest="50"
|
||||
MaximumWidthRequest="50"
|
||||
CornerRadius="25"
|
||||
IsVisible="{Binding CheckStatus, Converter={StaticResource BlockedConverter}}"
|
||||
Command="{Binding BindingContext.BlockCommand, Source={x:Reference CheckList}}"
|
||||
CommandParameter="{Binding .}">
|
||||
Margin="0,0,0,0"
|
||||
ImageSource="arrow_down.svg"
|
||||
BackgroundColor="Red"
|
||||
HeightRequest="50"
|
||||
MaximumHeightRequest="50"
|
||||
WidthRequest="50"
|
||||
MaximumWidthRequest="50"
|
||||
CornerRadius="25"
|
||||
IsVisible="{Binding CheckStatus, Converter={StaticResource BlockedConverter}}"
|
||||
Command="{Binding BindingContext.BlockCommand, Source={x:Reference CheckList}}"
|
||||
CommandParameter="{Binding .}">
|
||||
</Button>
|
||||
<Button Text=""
|
||||
ImageSource="arrow_up.svg"
|
||||
Margin="0,0,0,0"
|
||||
BackgroundColor="Green"
|
||||
HeightRequest="50"
|
||||
MaximumHeightRequest="50"
|
||||
WidthRequest="50"
|
||||
MaximumWidthRequest="50"
|
||||
CornerRadius="25"
|
||||
IsVisible="{Binding CheckStatus, Converter={StaticResource UnBlockedConverter}}"
|
||||
Command="{Binding BindingContext.UnblockCommand, Source={x:Reference CheckList}}"
|
||||
CommandParameter="{Binding .}">
|
||||
ImageSource="arrow_up.svg"
|
||||
Margin="0,0,0,0"
|
||||
BackgroundColor="Green"
|
||||
HeightRequest="50"
|
||||
MaximumHeightRequest="50"
|
||||
WidthRequest="50"
|
||||
MaximumWidthRequest="50"
|
||||
CornerRadius="25"
|
||||
IsVisible="{Binding CheckStatus, Converter={StaticResource UnBlockedConverter}}"
|
||||
Command="{Binding BindingContext.UnblockCommand, Source={x:Reference CheckList}}"
|
||||
CommandParameter="{Binding .}">
|
||||
</Button>
|
||||
<Button Text=""
|
||||
ImageSource="check_circle.svg"
|
||||
Margin="0,0,0,0"
|
||||
BackgroundColor="DarkGreen"
|
||||
HeightRequest="50"
|
||||
MaximumHeightRequest="50"
|
||||
WidthRequest="50"
|
||||
MaximumWidthRequest="50"
|
||||
CornerRadius="25"
|
||||
IsVisible="{Binding CheckStatus, Converter={StaticResource AcceptConverter}}"
|
||||
Command="{Binding BindingContext.AcceptCommand, Source={x:Reference CheckList}}"
|
||||
CommandParameter="{Binding .}">
|
||||
ImageSource="check_circle.svg"
|
||||
Margin="0,0,0,0"
|
||||
BackgroundColor="DarkGreen"
|
||||
HeightRequest="50"
|
||||
MaximumHeightRequest="50"
|
||||
WidthRequest="50"
|
||||
MaximumWidthRequest="50"
|
||||
CornerRadius="25"
|
||||
IsVisible="{Binding CheckStatus, Converter={StaticResource AcceptConverter}}"
|
||||
Command="{Binding BindingContext.AcceptCommand, Source={x:Reference CheckList}}"
|
||||
CommandParameter="{Binding .}">
|
||||
</Button>
|
||||
<Button Text=""
|
||||
ImageSource="arrow_right.svg"
|
||||
Margin="0,0,0,0"
|
||||
BackgroundColor="Blue"
|
||||
CornerRadius="25"
|
||||
HeightRequest="50"
|
||||
MaximumHeightRequest="50"
|
||||
WidthRequest="50"
|
||||
MaximumWidthRequest="50"
|
||||
IsVisible="{Binding CheckStatus, Converter={StaticResource ContinueConverter}, ConverterParameter = {Binding IsNFCSupported}}"
|
||||
Command="{Binding BindingContext.ContinueCommand, Source={x:Reference CheckList}}"
|
||||
CommandParameter="{Binding .}">
|
||||
ImageSource="arrow_right.svg"
|
||||
Margin="0,0,0,0"
|
||||
BackgroundColor="Blue"
|
||||
CornerRadius="25"
|
||||
HeightRequest="50"
|
||||
MaximumHeightRequest="50"
|
||||
WidthRequest="50"
|
||||
MaximumWidthRequest="50"
|
||||
IsVisible="{Binding CheckStatus, Converter={StaticResource ContinueConverter}, ConverterParameter = {Binding IsNFCSupported}}"
|
||||
Command="{Binding BindingContext.ContinueCommand, Source={x:Reference CheckList}}"
|
||||
CommandParameter="{Binding .}">
|
||||
</Button>
|
||||
</HorizontalStackLayout>
|
||||
</Grid>
|
||||
|
||||
@@ -27,6 +27,7 @@ public partial class CheckListPage : ContentPage
|
||||
public ICommand UnblockCommand { get; set; }
|
||||
public ICommand BlockCommand { get; set; }
|
||||
public ICommand AcceptCommand { get; set; }
|
||||
public ICommand InfoCommand { get; set; }
|
||||
public ICommand RefreshCommand { get; }
|
||||
|
||||
public bool IsLoading
|
||||
@@ -73,6 +74,7 @@ public partial class CheckListPage : ContentPage
|
||||
UnblockCommand = new Command<CheckListHeaderDTO>(OnUnblockItem);
|
||||
BlockCommand = new Command<CheckListHeaderDTO>(OnBlockItem);
|
||||
AcceptCommand = new Command<CheckListHeaderDTO>(OnAcceptItem);
|
||||
InfoCommand = new Command<CheckListHeaderDTO>(OnInfoItem);
|
||||
RefreshCommand = new Command(async () => await OnRefresh());
|
||||
|
||||
}
|
||||
@@ -311,6 +313,10 @@ public partial class CheckListPage : ContentPage
|
||||
}
|
||||
}
|
||||
}
|
||||
private async void OnInfoItem(CheckListHeaderDTO checkListHeaderDTO)
|
||||
{
|
||||
await Navigation.PushAsync(new CheckListInfoPage(checkListHeaderDTO));
|
||||
}
|
||||
private async Task LoadCheckListTemplate()
|
||||
{
|
||||
IsLoading = true;
|
||||
|
||||
@@ -130,6 +130,9 @@
|
||||
<MauiXaml Update="Pages\BaseStock\Locations\LocationsPage.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</MauiXaml>
|
||||
<MauiXaml Update="Pages\CheckList\CheckListInfoPage.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</MauiXaml>
|
||||
<MauiXaml Update="Pages\CheckList\CheckListPage.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</MauiXaml>
|
||||
|
||||
Reference in New Issue
Block a user