Egy kis UI rendezés

This commit is contained in:
2025-04-07 07:57:10 +02:00
parent 2513765e51
commit e306139aec
19 changed files with 137 additions and 50 deletions
+1 -1
View File
@@ -18,7 +18,7 @@ namespace WorkFlowCheck.MAUI
{ {
base.OnAppearing(); base.OnAppearing();
var currentUser = _userService.GetCurrentUser(); var currentUser = _userService.GetCurrentUser();
DeviceId.Text = DeviceInfo.Current.Idiom.ToString(); DeviceId.Text = _userService.DeviceId;
if (currentUser != null) if (currentUser != null)
{ {
foreach (var role in currentUser.RoleDTO) foreach (var role in currentUser.RoleDTO)
+2 -1
View File
@@ -49,7 +49,8 @@ namespace WorkFlowCheck.MAUI
builder.Services.AddTransient<MainPage>(); builder.Services.AddTransient<MainPage>();
builder.UseMauiApp<App>() builder
.UseMauiApp<App>()
.UseDevExpressEditors() .UseDevExpressEditors()
.UseMauiCommunityToolkitCamera() .UseMauiCommunityToolkitCamera()
.ConfigureFonts(fonts => .ConfigureFonts(fonts =>
@@ -19,18 +19,20 @@
<CollectionView.ItemTemplate> <CollectionView.ItemTemplate>
<DataTemplate> <DataTemplate>
<Frame BorderColor="Gray" Padding="10" Margin="5" HasShadow="True" BackgroundColor="WhiteSmoke"> <Frame BorderColor="Gray" Padding="10" Margin="5" HasShadow="True" BackgroundColor="WhiteSmoke">
<Grid ColumnDefinitions="*,Auto">
<StackLayout> <StackLayout>
<Label Text="{Binding ShortName}" FontSize="16" FontAttributes="Bold" /> <Label Text="{Binding ShortName}" FontSize="16" FontAttributes="Bold" />
<Label Text="{Binding Code}" FontSize="14" /> <Label Text="{Binding Code}" FontSize="14" />
</StackLayout>
<HorizontalStackLayout HorizontalOptions="End"> <HorizontalStackLayout HorizontalOptions="End">
<Button Text="Edit" Margin="5,0,0,0" <Button Text="Betekintés" Margin="5,0,0,0"
Command="{Binding BindingContext.EditCommand, Source={x:Reference CheckPointsList}}" Command="{Binding BindingContext.EditCommand, Source={x:Reference CheckPointsList}}"
CommandParameter="{Binding .}" /> CommandParameter="{Binding .}" />
<Button Text="Pair" Margin="5,0,0,0" <Button Text="Párosítás" Margin="5,0,0,0"
Command="{Binding BindingContext.PairCommand, Source={x:Reference CheckPointsList}}" Command="{Binding BindingContext.PairCommand, Source={x:Reference CheckPointsList}}"
CommandParameter="{Binding .}" /> CommandParameter="{Binding .}" />
</HorizontalStackLayout> </HorizontalStackLayout>
</StackLayout> </Grid>
</Frame> </Frame>
</DataTemplate> </DataTemplate>
</CollectionView.ItemTemplate> </CollectionView.ItemTemplate>
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui" <ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:WorkFlowCheck.MAUI.Pages.CheckList"
x:Class="WorkFlowCheck.MAUI.Pages.CheckList.CheckListPage" x:Class="WorkFlowCheck.MAUI.Pages.CheckList.CheckListPage"
Title="Ellenőrzések" Title="Ellenőrzések"
BackgroundColor="#f0f0f0"> BackgroundColor="#f0f0f0">
@@ -18,17 +19,31 @@
<CollectionView.ItemTemplate> <CollectionView.ItemTemplate>
<DataTemplate> <DataTemplate>
<Frame BorderColor="Gray" Padding="10" Margin="5" HasShadow="True" BackgroundColor="WhiteSmoke"> <Frame BorderColor="Gray" Padding="10" Margin="5" HasShadow="True" BackgroundColor="WhiteSmoke">
<StackLayout> <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 DocumentNumber}" FontSize="16" FontAttributes="Bold" />
<Label Text="{Binding DateExecution}" FontSize="14" /> <Label Text="{Binding DateExecution}" FontSize="14" />
<HorizontalStackLayout HorizontalOptions="End"> </StackLayout>
<!-- Jobb oldali oszlop: Két gomb egymás mellett -->
<HorizontalStackLayout Grid.Column="1" HorizontalOptions="End" Spacing="5">
<Button Text="Feloldás"
Margin="5,0,0,0"
BackgroundColor="Green"
IsVisible="{Binding CheckStatus, Converter={StaticResource BlockedVisibleConverter}}"
Command="{Binding BindingContext.UnblockCommand, Source={x:Reference CheckList}}"
CommandParameter="{Binding .}">
</Button>
<Button Text="Folytatás" <Button Text="Folytatás"
Margin="5,0,0,0" Margin="5,0,0,0"
BackgroundColor="Blue" BackgroundColor="Blue"
IsVisible="{Binding CheckStatus, Converter={StaticResource BlockedHideConverter}}"
Command="{Binding BindingContext.ContinueCommand, Source={x:Reference CheckList}}" Command="{Binding BindingContext.ContinueCommand, Source={x:Reference CheckList}}"
CommandParameter="{Binding .}" /> CommandParameter="{Binding .}">
</Button>
</HorizontalStackLayout> </HorizontalStackLayout>
</StackLayout> </Grid>
</Frame> </Frame>
</DataTemplate> </DataTemplate>
</CollectionView.ItemTemplate> </CollectionView.ItemTemplate>
@@ -50,9 +65,11 @@
<CollectionView.ItemTemplate> <CollectionView.ItemTemplate>
<DataTemplate> <DataTemplate>
<Frame BorderColor="Gray" Padding="10" Margin="5" HasShadow="True" BackgroundColor="WhiteSmoke"> <Frame BorderColor="Gray" Padding="10" Margin="5" HasShadow="True" BackgroundColor="WhiteSmoke">
<Grid ColumnDefinitions="*,Auto">
<StackLayout> <StackLayout>
<Label Text="{Binding ShortName}" FontSize="16" FontAttributes="Bold" /> <Label Text="{Binding ShortName}" FontSize="16" FontAttributes="Bold" />
<Label Text="{Binding Description}" FontSize="14" /> <Label Text="{Binding Description}" FontSize="14" />
</StackLayout>
<HorizontalStackLayout HorizontalOptions="End"> <HorizontalStackLayout HorizontalOptions="End">
<Button Text="Új ellenőrzés" <Button Text="Új ellenőrzés"
BackgroundColor="Green" BackgroundColor="Green"
@@ -60,7 +77,7 @@
Command="{Binding BindingContext.NewCommand, Source={x:Reference CheckListTemplate}}" Command="{Binding BindingContext.NewCommand, Source={x:Reference CheckListTemplate}}"
CommandParameter="{Binding .}" /> CommandParameter="{Binding .}" />
</HorizontalStackLayout> </HorizontalStackLayout>
</StackLayout> </Grid>
</Frame> </Frame>
</DataTemplate> </DataTemplate>
</CollectionView.ItemTemplate> </CollectionView.ItemTemplate>
@@ -83,5 +100,10 @@
HeightRequest="50"/> HeightRequest="50"/>
</Grid> </Grid>
</Grid> </Grid>
<ContentPage.Resources>
<ResourceDictionary>
<local:BlockedVisibleConverter x:Key="BlockedVisibleConverter" />
<local:BlockedHideConverter x:Key="BlockedHideConverter" />
</ResourceDictionary>
</ContentPage.Resources>
</ContentPage> </ContentPage>
@@ -1,7 +1,9 @@
using System.Diagnostics; using System.Diagnostics;
using System.Globalization;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Input; using System.Windows.Input;
using WorkFlowCheck.Common.DTO; using WorkFlowCheck.Common.DTO;
using WorkFlowCheck.Common.Enums;
using WorkFlowCheck.MAUI.Pages.NFC; using WorkFlowCheck.MAUI.Pages.NFC;
using WorkFlowCheck.MAUI.Services.Interfaces; using WorkFlowCheck.MAUI.Services.Interfaces;
@@ -16,6 +18,7 @@ public partial class CheckListPage : ContentPage
public ICommand NewCommand { get; set; } public ICommand NewCommand { get; set; }
public ICommand ContinueCommand { get; set; } public ICommand ContinueCommand { get; set; }
public ICommand UnblockCommand { get; set; }
public bool IsLoading public bool IsLoading
{ {
get => _isLoading; get => _isLoading;
@@ -34,6 +37,7 @@ public partial class CheckListPage : ContentPage
_userService = MauiProgram.ServiceProvider.GetRequiredService<IUserService>(); _userService = MauiProgram.ServiceProvider.GetRequiredService<IUserService>();
NewCommand = new Command<CheckListTemplateHeaderDTO>(OnNewItem); NewCommand = new Command<CheckListTemplateHeaderDTO>(OnNewItem);
ContinueCommand = new Command<CheckListHeaderDTO>(OnContinueItem); ContinueCommand = new Command<CheckListHeaderDTO>(OnContinueItem);
UnblockCommand = new Command<CheckListHeaderDTO>(OnUnblockItem);
} }
protected override bool OnBackButtonPressed() protected override bool OnBackButtonPressed()
@@ -72,6 +76,10 @@ public partial class CheckListPage : ContentPage
await Navigation.PushAsync(new CheckListWorkPage(checkListHeaderDTO.Id, checkPointCode)); await Navigation.PushAsync(new CheckListWorkPage(checkListHeaderDTO.Id, checkPointCode));
} }
}
private async void OnUnblockItem(CheckListHeaderDTO checkListHeaderDTO)
{
} }
private async Task LoadCheckListTemplate() private async Task LoadCheckListTemplate()
{ {
@@ -89,3 +97,40 @@ public partial class CheckListPage : ContentPage
} }
} }
public class BlockedVisibleConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is CheckStatus status)
{
return status == CheckStatus.Blocked;
}
return false;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
public class BlockedHideConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is CheckStatus status)
{
if (status == CheckStatus.Open || status == CheckStatus.InProgress)
{
return true;
}
return false;
}
return false;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
@@ -137,6 +137,7 @@ public partial class LoginPage : ContentPage
finally finally
{ {
LoginBtn.IsEnabled = true; LoginBtn.IsEnabled = true;
LoginNFCBtn.IsEnabled = true;
LoadingIndicator.IsRunning = false; LoadingIndicator.IsRunning = false;
LoadingIndicator.IsVisible = false; LoadingIndicator.IsVisible = false;
UsernameEntry.IsEnabled = true; UsernameEntry.IsEnabled = true;
@@ -7,7 +7,16 @@ using Android.OS;
namespace WorkFlowCheck.MAUI namespace WorkFlowCheck.MAUI
{ {
[Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, LaunchMode = LaunchMode.SingleTop, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)] [Activity(Theme = "@style/Maui.SplashTheme",
Icon = "@mipmap/appicon",
MainLauncher = true,
LaunchMode = LaunchMode.SingleTop,
ConfigurationChanges = ConfigChanges.ScreenSize |
ConfigChanges.Orientation |
ConfigChanges.UiMode |
ConfigChanges.ScreenLayout |
ConfigChanges.SmallestScreenSize |
ConfigChanges.Density)]
public class MainActivity : MauiAppCompatActivity public class MainActivity : MauiAppCompatActivity
{ {
NfcAdapter nfcAdapter; NfcAdapter nfcAdapter;
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <ns0:svg xmlns:ns0="http://www.w3.org/2000/svg" width="456" height="456" viewBox="0 0 456 456" version="1.1">
<svg width="456" height="456" viewBox="0 0 456 456" version="1.1" xmlns="http://www.w3.org/2000/svg"> <ns0:rect x="0" y="0" width="456" height="456" fill="#512BD4" />
<rect x="0" y="0" width="456" height="456" fill="#512BD4" /> </ns0:svg>
</svg>

Before

Width:  |  Height:  |  Size: 228 B

After

Width:  |  Height:  |  Size: 189 B

@@ -1,8 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <ns0:svg xmlns:ns0="http://www.w3.org/2000/svg" width="456" height="456" viewBox="0 0 456 456" version="1.1" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <ns0:path d="m 105.50037,281.60863 c -2.70293,0 -5.00091,-0.90042 -6.893127,-2.70209 -1.892214,-1.84778 -2.837901,-4.04181 -2.837901,-6.58209 0,-2.58722 0.945687,-4.80389 2.837901,-6.65167 1.892217,-1.84778 4.190197,-2.77167 6.893127,-2.77167 2.74819,0 5.06798,0.92389 6.96019,2.77167 1.93749,1.84778 2.90581,4.06445 2.90581,6.65167 0,2.54028 -0.96832,4.73431 -2.90581,6.58209 -1.89221,1.80167 -4.212,2.70209 -6.96019,2.70209 z" style="fill:#ffffff;fill-rule:nonzero;stroke-width:0.838376" />
<svg width="456" height="456" viewBox="0 0 456 456" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;"> <ns0:path d="M 213.56111,280.08446 H 195.99044 L 149.69953,207.0544 c -1.17121,-1.84778 -2.14037,-3.76515 -2.90581,-5.75126 h -0.40578 c 0.36051,2.12528 0.54076,6.67515 0.54076,13.6496 v 65.13172 h -15.54349 v -99.36009 h 18.71925 l 44.7374,71.29798 c 1.89222,2.95695 3.1087,4.98917 3.64945,6.09751 h 0.26996 c -0.45021,-2.6325 -0.67573,-7.09015 -0.67573,-13.37293 v -64.02256 h 15.47557 z" style="fill:#ffffff;fill-rule:nonzero;stroke-width:0.838376" />
<path d="m 105.50037,281.60863 c -2.70293,0 -5.00091,-0.90042 -6.893127,-2.70209 -1.892214,-1.84778 -2.837901,-4.04181 -2.837901,-6.58209 0,-2.58722 0.945687,-4.80389 2.837901,-6.65167 1.892217,-1.84778 4.190197,-2.77167 6.893127,-2.77167 2.74819,0 5.06798,0.92389 6.96019,2.77167 1.93749,1.84778 2.90581,4.06445 2.90581,6.65167 0,2.54028 -0.96832,4.73431 -2.90581,6.58209 -1.89221,1.80167 -4.212,2.70209 -6.96019,2.70209 z" style="fill:#ffffff;fill-rule:nonzero;stroke-width:0.838376" /> <ns0:path d="m 289.25134,280.08446 h -54.40052 v -99.36009 h 52.23835 v 13.99669 h -36.15411 v 28.13085 h 33.31621 v 13.9271 h -33.31621 v 29.37835 h 38.31628 z" style="fill:#ffffff;fill-rule:nonzero;stroke-width:0.838376" />
<path d="M 213.56111,280.08446 H 195.99044 L 149.69953,207.0544 c -1.17121,-1.84778 -2.14037,-3.76515 -2.90581,-5.75126 h -0.40578 c 0.36051,2.12528 0.54076,6.67515 0.54076,13.6496 v 65.13172 h -15.54349 v -99.36009 h 18.71925 l 44.7374,71.29798 c 1.89222,2.95695 3.1087,4.98917 3.64945,6.09751 h 0.26996 c -0.45021,-2.6325 -0.67573,-7.09015 -0.67573,-13.37293 v -64.02256 h 15.47557 z" style="fill:#ffffff;fill-rule:nonzero;stroke-width:0.838376" /> <ns0:path d="M 366.56466,194.72106 H 338.7222 v 85.3634 h -16.08423 v -85.3634 h -27.77455 v -13.99669 h 71.70124 z" style="fill:#ffffff;fill-rule:nonzero;stroke-width:0.838376" />
<path d="m 289.25134,280.08446 h -54.40052 v -99.36009 h 52.23835 v 13.99669 h -36.15411 v 28.13085 h 33.31621 v 13.9271 h -33.31621 v 29.37835 h 38.31628 z" style="fill:#ffffff;fill-rule:nonzero;stroke-width:0.838376" /> </ns0:svg>
<path d="M 366.56466,194.72106 H 338.7222 v 85.3634 h -16.08423 v -85.3634 h -27.77455 v -13.99669 h 71.70124 z" style="fill:#ffffff;fill-rule:nonzero;stroke-width:0.838376" />
</svg>

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

@@ -23,6 +23,7 @@ namespace WorkFlowCheck.MAUI.Services
public readonly IConfiguration _configuration; public readonly IConfiguration _configuration;
public readonly IMapper _mapper; public readonly IMapper _mapper;
private string _deviceId; private string _deviceId;
public string DeviceId => _deviceId.ToUpper(); // Getter a DeviceId-hez
public BaseService(HttpClient httpClient, IConfiguration configuration, AppDbContext dbContext, IMapper mapper) public BaseService(HttpClient httpClient, IConfiguration configuration, AppDbContext dbContext, IMapper mapper)
{ {
@@ -10,6 +10,7 @@ namespace WorkFlowCheck.MAUI.Services.Interfaces
public interface IUserService public interface IUserService
{ {
UserDTO? GetCurrentUser(); UserDTO? GetCurrentUser();
string DeviceId { get; }
Task<ApiResponseDTO<UserDTO>> GetUserAsync(int id); Task<ApiResponseDTO<UserDTO>> GetUserAsync(int id);
Task<ApiResponseDTO<List<UserDTO>>> GetAllUserAsync(); Task<ApiResponseDTO<List<UserDTO>>> GetAllUserAsync();
Task<ApiResponseDTO<UserDTO>> Authenticate(string username, string password); Task<ApiResponseDTO<UserDTO>> Authenticate(string username, string password);
@@ -81,16 +81,16 @@ namespace WorkFlowCheck.MAUI.Services
} }
// Telepítés indítása a FileProvider segítségével // Telepítés indítása a FileProvider segítségével
var apkUri = FileProvider.GetUriForFile(Android.App.Application.Context, //var apkUri = FileProvider.GetUriForFile(Android.App.Application.Context,
$"{Android.App.Application.Context.PackageName}.fileprovider", // $"{Android.App.Application.Context.PackageName}.fileprovider",
new Java.IO.File(filePath)); // new Java.IO.File(filePath));
var installIntent = new Intent(Intent.ActionView); //var installIntent = new Intent(Intent.ActionView);
installIntent.SetDataAndType(apkUri, "application/vnd.android.package-archive"); //installIntent.SetDataAndType(apkUri, "application/vnd.android.package-archive");
installIntent.AddFlags(ActivityFlags.NewTask); //installIntent.AddFlags(ActivityFlags.NewTask);
installIntent.AddFlags(ActivityFlags.GrantReadUriPermission); //installIntent.AddFlags(ActivityFlags.GrantReadUriPermission);
Android.App.Application.Context.StartActivity(installIntent); //Android.App.Application.Context.StartActivity(installIntent);
} }
else else
{ {
@@ -21,6 +21,7 @@ namespace WorkFlowCheck.MAUI.Services
public class UserService : BaseService, IUserService public class UserService : BaseService, IUserService
{ {
public UserDTO? CurrentUser { get; private set; } public UserDTO? CurrentUser { get; private set; }
public UserService(HttpClient httpClient, IConfiguration configuration, AppDbContext dbContext, IMapper mapper) : base(httpClient, configuration, dbContext, mapper) public UserService(HttpClient httpClient, IConfiguration configuration, AppDbContext dbContext, IMapper mapper) : base(httpClient, configuration, dbContext, mapper)
{ {
} }
@@ -146,4 +146,11 @@
</MauiXaml> </MauiXaml>
</ItemGroup> </ItemGroup>
<ItemGroup>
<Folder Include="Platforms\Android\Resources\mipmap-hdpi\" />
<Folder Include="Platforms\Android\Resources\mipmap-xhdpi\" />
<Folder Include="Platforms\Android\Resources\mipmap-xxhdpi\" />
<Folder Include="Platforms\Android\Resources\mipmap-xxxhdpi\" />
</ItemGroup>
</Project> </Project>