UI rendberakása

This commit is contained in:
2025-04-11 10:55:40 +02:00
parent 9d107e8c0b
commit 6d276e73b8
15 changed files with 273 additions and 21 deletions
@@ -20,14 +20,17 @@ namespace WorkFlowCheck.MAUI.Mapper
.ForMember(dest => dest.CheckListTemplateRows, opt => opt.MapFrom(src => src.CheckListTemplateRowDTO));
CreateMap<CheckListTemplateHeader, CheckListTemplateHeaderDTO>()
.ForMember(dest => dest.CheckListTemplateRowDTO, opt => opt.MapFrom(src => src.CheckListTemplateRows));
CreateMap<CheckListTemplateRow, CheckListTemplateRowDTO>()
.ForMember(dest => dest.CheckPointDTO, opt => opt.MapFrom(src => src.CheckPoint));
CreateMap<CheckListTemplateRowDTO, CheckListTemplateRow>();
CreateMap<CheckListHeader, CheckListHeaderDTO>()
.ForMember(dest => dest.CheckListTemplateHeaderDTO, opt => opt.MapFrom(src => src.CheckListTemplateHeader))
.ForMember(dest => dest.CheckListRowDTO, opt => opt.MapFrom(src => src.CheckListRows));
CreateMap<CheckListHeaderDTO, CheckListHeader>()
.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>()
@@ -2,9 +2,43 @@
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="WorkFlowCheck.MAUI.Pages.BaseStock.BaseStockPage"
BackgroundColor="#f0f0f0"
Title="Törzs adatok">
<VerticalStackLayout Margin="10,0,10,0">
<Frame BorderColor="Gray" Padding="5" Margin="1" HasShadow="True">
<Shell.TitleView>
<Grid Padding="2" VerticalOptions="Center">
<Label Text="Törzs adatok"
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>
<VerticalStackLayout Margin="50,50,50,10">
<Frame BorderColor="Gray" Padding="5" Margin="1" HasShadow="True" CornerRadius="10">
<VerticalStackLayout Margin="10,10,10,0">
<Button
x:Name="ButtonGetCheckPoints"
@@ -13,20 +47,20 @@
SemanticProperties.Hint="Ellenőrzési pontok"
Clicked="OnButtonGetCheckPoints"
HorizontalOptions="Fill" />
<Button
<!--<Button
x:Name="ButtonGetEquipments"
Margin="0,0,0,10"
Text="Berendezések"
SemanticProperties.Hint="Berendezések"
Clicked="OnButtonGetEquipments"
HorizontalOptions="Fill" />
<Button
HorizontalOptions="Fill" />-->
<!--<Button
x:Name="ButtonGetLocations"
Margin="0,0,0,10"
Text="Lokációk"
SemanticProperties.Hint="Lokációk"
Clicked="OnButtonGetLocations"
HorizontalOptions="Fill" />
HorizontalOptions="Fill" />-->
<Button
x:Name="ButtonGetUsers"
Margin="0,0,0,10"
@@ -1,15 +1,32 @@
using Android.DeviceLock;
using WorkFlowCheck.Common.DTO;
using WorkFlowCheck.MAUI.Pages.Security;
using WorkFlowCheck.MAUI.Services.Interfaces;
namespace WorkFlowCheck.MAUI.Pages.BaseStock;
public partial class BaseStockPage : ContentPage
{
private IUserService _userService;
private UserDTO _currentUser;
public BaseStockPage()
{
InitializeComponent();
_userService = MauiProgram.ServiceProvider.GetRequiredService<IUserService>();
}
private void SetInfo()
{
_currentUser = _userService.GetCurrentUser();
DeviceId.Text = _userService.DeviceId;
UserInfo.Text = $"{_currentUser?.FirstName} {_currentUser?.LastName}";
}
override protected async void OnAppearing()
{
base.OnAppearing();
SetInfo();
}
private async void OnButtonGetCheckPoints(object sender, EventArgs e)
{
//await Shell.Current.GoToAsync("//CheckPointsPage");
@@ -55,8 +55,10 @@
<Grid ColumnDefinitions="*,Auto">
<!-- Bal oldali oszlop: Két Label egymás alatt -->
<StackLayout Grid.Column="0" Spacing="2">
<Label Text="{Binding DocumentNumber}" FontSize="16" FontAttributes="Bold" />
<Label Text="{Binding DateExecution}" FontSize="14" />
<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>
<!-- Jobb oldali oszlop: Két gomb egymás mellett -->
@@ -64,21 +66,21 @@
<Button Text="Blokkolás"
Margin="5,0,0,0"
BackgroundColor="Red"
IsVisible="{Binding CheckStatus, Converter={StaticResource BlockedHideConverter}}"
IsVisible="{Binding CheckStatus, Converter={StaticResource BlockedConverter}}"
Command="{Binding BindingContext.BlockCommand, Source={x:Reference CheckList}}"
CommandParameter="{Binding .}">
</Button>
<Button Text="Feloldás"
Margin="5,0,0,0"
BackgroundColor="Green"
IsVisible="{Binding CheckStatus, Converter={StaticResource BlockedVisibleConverter}}"
IsVisible="{Binding CheckStatus, Converter={StaticResource UnBlockedConverter}}"
Command="{Binding BindingContext.UnblockCommand, Source={x:Reference CheckList}}"
CommandParameter="{Binding .}">
</Button>
<Button Text="Folytatás"
Margin="5,0,0,0"
BackgroundColor="Blue"
IsVisible="{Binding CheckStatus, Converter={StaticResource BlockedHideConverter}}"
IsVisible="{Binding CheckStatus, Converter={StaticResource ContinueConverter}}"
Command="{Binding BindingContext.ContinueCommand, Source={x:Reference CheckList}}"
CommandParameter="{Binding .}">
</Button>
@@ -142,8 +144,9 @@
</Grid>
<ContentPage.Resources>
<ResourceDictionary>
<local:BlockedVisibleConverter x:Key="BlockedVisibleConverter" />
<local:BlockedHideConverter x:Key="BlockedHideConverter" />
<local:BlockedConverter x:Key="BlockedConverter" />
<local:UnBlockedConverter x:Key="UnBlockedConverter" />
<local:ContinueConverter x:Key="ContinueConverter" />
</ResourceDictionary>
</ContentPage.Resources>
</ContentPage>
@@ -168,13 +168,13 @@ public partial class CheckListPage : ContentPage
}
public class BlockedVisibleConverter : IValueConverter
public class BlockedConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is CheckStatus status)
{
return status == CheckStatus.Blocked;
return status == CheckStatus.InProgress;
}
return false;
}
@@ -184,13 +184,33 @@ public class BlockedVisibleConverter : IValueConverter
throw new NotImplementedException();
}
}
public class BlockedHideConverter : IValueConverter
public class UnBlockedConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is CheckStatus status)
{
if (status == CheckStatus.Open || status == CheckStatus.InProgress)
if (status == CheckStatus.Blocked)
{
return true;
}
return false;
}
return false;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
public class ContinueConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is CheckStatus status)
{
if (status == CheckStatus.InProgress || status == CheckStatus.Open)
{
return true;
}
@@ -4,7 +4,39 @@
x:Class="WorkFlowCheck.MAUI.Pages.NFC.NFCTestPage"
BackgroundColor="#f0f0f0"
Title="NFC teszt ">
<Shell.TitleView>
<Grid Padding="2" VerticalOptions="Center">
<Label Text="NFC olvasási teszt"
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>
<RefreshView x:Name="refreshView" Command="{Binding RefreshCommand}" IsRefreshing="{Binding IsRefreshing}">
<CollectionView x:Name="NFCDataListCollection" ItemsSource="{Binding NFCDataList}">
<CollectionView.ItemTemplate>
@@ -3,16 +3,27 @@ using System.Collections.ObjectModel;
using System.Text;
using System.Windows.Input;
using System.Linq;
using WorkFlowCheck.Common.DTO;
using WorkFlowCheck.MAUI.Services.Interfaces;
using Android.DeviceLock;
namespace WorkFlowCheck.MAUI.Pages.NFC;
public partial class NFCTestPage : ContentPage
{
private IUserService _userService;
private UserDTO _currentUser;
public NFCTestPage()
{
InitializeComponent();
_userService = MauiProgram.ServiceProvider.GetRequiredService<IUserService>();
}
private void SetInfo()
{
_currentUser = _userService.GetCurrentUser();
DeviceId.Text = _userService.DeviceId;
UserInfo.Text = $"{_currentUser?.FirstName} {_currentUser?.LastName}";
}
public ObservableCollection<NFCData> NFCDataList { get; set; }
public ICommand RefreshCommand { get; set; }
@@ -23,6 +34,7 @@ public partial class NFCTestPage : ContentPage
protected override async void OnAppearing()
{
base.OnAppearing();
SetInfo();
CrossNFC.Legacy = false;
if (CrossNFC.IsSupported)
@@ -2,7 +2,41 @@
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="WorkFlowCheck.MAUI.Pages.System.DownloadAPKPage"
BackgroundColor="#f0f0f0"
Title="Program letöltés">
<Shell.TitleView>
<Grid Padding="2" VerticalOptions="Center">
<Label Text="Program letöltés"
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>
<ScrollView>
<Grid>
<Grid.RowDefinitions>
@@ -1,3 +1,4 @@
using WorkFlowCheck.Common.DTO;
using WorkFlowCheck.MAUI.Services.Interfaces;
namespace WorkFlowCheck.MAUI.Pages.System;
@@ -5,10 +6,25 @@ namespace WorkFlowCheck.MAUI.Pages.System;
public partial class DownloadAPKPage : ContentPage
{
private ISyncService _syncService;
private IUserService _userService;
private UserDTO _currentUser;
public DownloadAPKPage()
{
InitializeComponent();
_syncService = MauiProgram.ServiceProvider.GetRequiredService<ISyncService>();
_userService = MauiProgram.ServiceProvider.GetRequiredService<IUserService>();
}
override protected async void OnAppearing()
{
base.OnAppearing();
SetInfo();
}
private void SetInfo()
{
_currentUser = _userService.GetCurrentUser();
DeviceId.Text = _userService.DeviceId;
UserInfo.Text = $"{_currentUser?.FirstName} {_currentUser?.LastName}";
}
private async void OnSyncClicked(object sender, EventArgs e)
{
@@ -4,6 +4,39 @@
x:Class="WorkFlowCheck.MAUI.Pages.System.SyncPage"
Title="Adatok szinkronizálása"
BackgroundColor="#f0f0f0">
<Shell.TitleView>
<Grid Padding="2" VerticalOptions="Center">
<Label Text="Adatok szinkronizálása"
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>
<ScrollView>
<Grid>
<Grid.RowDefinitions>
@@ -1,3 +1,5 @@
using Android.DeviceLock;
using WorkFlowCheck.Common.DTO;
using WorkFlowCheck.MAUI.Services.Interfaces;
namespace WorkFlowCheck.MAUI.Pages.System;
@@ -5,12 +7,26 @@ namespace WorkFlowCheck.MAUI.Pages.System;
public partial class SyncPage : ContentPage
{
private ISyncService _syncService;
private IUserService _userService;
private UserDTO _currentUser;
public SyncPage()
{
InitializeComponent();
_syncService = MauiProgram.ServiceProvider.GetRequiredService<ISyncService>();
_userService = MauiProgram.ServiceProvider.GetRequiredService<IUserService>();
}
override protected async void OnAppearing()
{
base.OnAppearing();
SetInfo();
}
private void SetInfo()
{
_currentUser = _userService.GetCurrentUser();
DeviceId.Text = _userService.DeviceId;
UserInfo.Text = $"{_currentUser?.FirstName} {_currentUser?.LastName}";
}
private async void OnSyncClicked(object sender, EventArgs e)
{
SyncBtn.IsEnabled = false;
@@ -96,6 +96,7 @@ namespace WorkFlowCheck.MAUI.Services
try
{
var res = await _dbContext.CheckListHeaders
.Include(i=> i.CheckListTemplateHeader)
.Where(w => w.CheckStatus == CheckStatus.Open ||
w.CheckStatus == CheckStatus.InProgress ||
w.CheckStatus == CheckStatus.Blocked)
@@ -116,7 +117,8 @@ namespace WorkFlowCheck.MAUI.Services
var retVal = new List<CheckListTemplateHeaderDTO>();
try
{
var res = await _dbContext.CheckListTemplateHeaders.ToListAsync();
var res = await _dbContext.CheckListTemplateHeaders
.ToListAsync();
retVal = _mapper.Map<List<CheckListTemplateHeaderDTO>>(res);
}
catch (Exception ex)