Kis kerek gombok + Egyéb nyalánkságok

This commit is contained in:
2025-04-21 19:16:58 +02:00
parent dbc2f30a27
commit cba9181a2d
18 changed files with 118 additions and 24 deletions
@@ -1,4 +1,6 @@
using Android.Util; using Android.Util;
using CommunityToolkit.Maui.Alerts;
using CommunityToolkit.Maui.Core;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -51,5 +53,35 @@ namespace WorkFlowCheck.MAUI.Helper
} }
} }
} }
public async static Task ShowSnackBar(string message,
string actionButtonTextColor = "#FF0000",
string backgroundColor = "#FF0000",
string textColor = "#FF0000",
int duration = 10,
string actionButtonText = "Ok",
Func<Task> action = null)
{
var visualOptions = new SnackbarOptions
{
ActionButtonTextColor = Colors.Yellow,
CornerRadius = new CornerRadius(10),
Font = Microsoft.Maui.Font.SystemFontOfSize(16),
BackgroundColor = Colors.Red,
TextColor = Colors.Yellow
};
var snackbar = Snackbar.Make(
message,
duration: TimeSpan.FromSeconds(duration),
action: async () =>
{
if (action != null)
await action();
},
actionButtonText: actionButtonText,
visualOptions: visualOptions
);
await snackbar.Show();
}
} }
} }
+1
View File
@@ -46,6 +46,7 @@ namespace WorkFlowCheck.MAUI
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold"); fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
fonts.AddFont("FontAwesome.ttf", "FontAwesome"); fonts.AddFont("FontAwesome.ttf", "FontAwesome");
}) })
.UseMauiCommunityToolkitCore() .UseMauiCommunityToolkitCore()
.UseMauiCommunityToolkit(); .UseMauiCommunityToolkit();
#if DEBUG #if DEBUG
@@ -51,7 +51,7 @@
<CollectionView x:Name="CheckList"> <CollectionView x:Name="CheckList">
<CollectionView.ItemTemplate> <CollectionView.ItemTemplate>
<DataTemplate> <DataTemplate>
<Frame BorderColor="Gray" Padding="10" Margin="5" HasShadow="True" BackgroundColor="WhiteSmoke"> <Frame BorderColor="Gray" Padding="15" Margin="5" HasShadow="True" BackgroundColor="WhiteSmoke">
<Grid ColumnDefinitions="*,Auto"> <Grid ColumnDefinitions="*,Auto">
<!-- Bal oldali oszlop: Két Label egymás alatt --> <!-- Bal oldali oszlop: Két Label egymás alatt -->
<StackLayout Grid.Column="0" Spacing="2"> <StackLayout Grid.Column="0" Spacing="2">
@@ -62,20 +62,23 @@
</StackLayout> </StackLayout>
<!-- Jobb oldali oszlop: Két gomb egymás mellett --> <!-- Jobb oldali oszlop: Két gomb egymás mellett -->
<HorizontalStackLayout Grid.Column="1" HorizontalOptions="End" Spacing="5"> <HorizontalStackLayout Grid.Column="1" HorizontalOptions="End" Spacing="3">
<Button Text="Blokkolás" <Button Text=""
Margin="5,0,0,0" Margin="0,0,0,0"
ImageSource="arrow_down.svg"
BackgroundColor="Red" BackgroundColor="Red"
HeightRequest="50" HeightRequest="50"
MaximumHeightRequest="50" MaximumHeightRequest="50"
WidthRequest="120" WidthRequest="50"
MaximumWidthRequest="120" MaximumWidthRequest="50"
CornerRadius="25"
IsVisible="{Binding CheckStatus, Converter={StaticResource BlockedConverter}}" IsVisible="{Binding CheckStatus, Converter={StaticResource BlockedConverter}}"
Command="{Binding BindingContext.BlockCommand, Source={x:Reference CheckList}}" Command="{Binding BindingContext.BlockCommand, Source={x:Reference CheckList}}"
CommandParameter="{Binding .}"> CommandParameter="{Binding .}">
</Button> </Button>
<Button Text="Feloldás" <Button Text="Feloldás"
Margin="5,0,0,0" ImageSource="arrow_up.svg"
Margin="0,0,0,0"
BackgroundColor="Green" BackgroundColor="Green"
HeightRequest="50" HeightRequest="50"
MaximumHeightRequest="50" MaximumHeightRequest="50"
@@ -85,25 +88,29 @@
Command="{Binding BindingContext.UnblockCommand, Source={x:Reference CheckList}}" Command="{Binding BindingContext.UnblockCommand, Source={x:Reference CheckList}}"
CommandParameter="{Binding .}"> CommandParameter="{Binding .}">
</Button> </Button>
<Button Text="Jóváhagyás" <Button Text=""
Margin="5,0,0,0" ImageSource="check_circle.svg"
Margin="0,0,0,0"
BackgroundColor="DarkGreen" BackgroundColor="DarkGreen"
HeightRequest="50" HeightRequest="50"
MaximumHeightRequest="50" MaximumHeightRequest="50"
WidthRequest="120" WidthRequest="50"
MaximumWidthRequest="120" MaximumWidthRequest="50"
CornerRadius="25"
IsVisible="{Binding CheckStatus, Converter={StaticResource AcceptConverter}}" IsVisible="{Binding CheckStatus, Converter={StaticResource AcceptConverter}}"
Command="{Binding BindingContext.AcceptCommand, Source={x:Reference CheckList}}" Command="{Binding BindingContext.AcceptCommand, Source={x:Reference CheckList}}"
CommandParameter="{Binding .}"> CommandParameter="{Binding .}">
</Button> </Button>
<Button Text="Folytatás" <Button Text=""
Margin="5,0,0,0" ImageSource="arrow_right.svg"
Margin="0,0,0,0"
BackgroundColor="Blue" BackgroundColor="Blue"
CornerRadius="25"
HeightRequest="50" HeightRequest="50"
MaximumHeightRequest="50" MaximumHeightRequest="50"
WidthRequest="120" WidthRequest="50"
MaximumWidthRequest="120" MaximumWidthRequest="50"
IsVisible="{Binding CheckStatus, Converter={StaticResource ContinueConverter}}" IsVisible="{Binding CheckStatus, Converter={StaticResource ContinueConverter}, ConverterParameter = {Binding IsNFCSupported}}"
Command="{Binding BindingContext.ContinueCommand, Source={x:Reference CheckList}}" Command="{Binding BindingContext.ContinueCommand, Source={x:Reference CheckList}}"
CommandParameter="{Binding .}"> CommandParameter="{Binding .}">
</Button> </Button>
@@ -174,6 +181,7 @@
<local:BlockedConverter x:Key="BlockedConverter" /> <local:BlockedConverter x:Key="BlockedConverter" />
<local:UnBlockedConverter x:Key="UnBlockedConverter" /> <local:UnBlockedConverter x:Key="UnBlockedConverter" />
<local:ContinueConverter x:Key="ContinueConverter" /> <local:ContinueConverter x:Key="ContinueConverter" />
<local:AcceptConverter x:Key="AcceptConverter" />
</ResourceDictionary> </ResourceDictionary>
</ContentPage.Resources> </ContentPage.Resources>
</ContentPage> </ContentPage>
@@ -1,5 +1,6 @@
using CommunityToolkit.Maui.Alerts; using CommunityToolkit.Maui.Alerts;
using CommunityToolkit.Maui.Core; using CommunityToolkit.Maui.Core;
using Plugin.NFC;
using System.Diagnostics; using System.Diagnostics;
using System.Globalization; using System.Globalization;
using System.Threading.Tasks; using System.Threading.Tasks;
@@ -17,6 +18,7 @@ public partial class CheckListPage : ContentPage
private readonly IUserService _userService; private readonly IUserService _userService;
private readonly ISyncService _syncService; private readonly ISyncService _syncService;
private bool _isLoading; private bool _isLoading;
private bool _isNFCSupported;
private UserDTO _currentUser; private UserDTO _currentUser;
public ICommand NewCommand { get; set; } public ICommand NewCommand { get; set; }
@@ -24,6 +26,7 @@ public partial class CheckListPage : ContentPage
public ICommand UnblockCommand { get; set; } public ICommand UnblockCommand { get; set; }
public ICommand BlockCommand { get; set; } public ICommand BlockCommand { get; set; }
public ICommand AcceptCommand { get; set; } public ICommand AcceptCommand { get; set; }
public bool IsLoading public bool IsLoading
{ {
get => _isLoading; get => _isLoading;
@@ -33,7 +36,15 @@ public partial class CheckListPage : ContentPage
OnPropertyChanged(nameof(IsLoading)); OnPropertyChanged(nameof(IsLoading));
} }
} }
public bool IsNFCSupported
{
get => _isNFCSupported;
set
{
_isNFCSupported = value;
OnPropertyChanged(nameof(IsNFCSupported));
}
}
public CheckListPage() public CheckListPage()
{ {
@@ -47,6 +58,7 @@ public partial class CheckListPage : ContentPage
BlockCommand = new Command<CheckListHeaderDTO>(OnBlockItem); BlockCommand = new Command<CheckListHeaderDTO>(OnBlockItem);
AcceptCommand = new Command<CheckListHeaderDTO>(OnAcceptItem); AcceptCommand = new Command<CheckListHeaderDTO>(OnAcceptItem);
} }
private void SetInfo() private void SetInfo()
{ {
@@ -62,8 +74,10 @@ public partial class CheckListPage : ContentPage
protected override async void OnAppearing() protected override async void OnAppearing()
{ {
base.OnAppearing(); base.OnAppearing();
SetInfo();
BindingContext = this; BindingContext = this;
//CrossNFC.Legacy = false;
//IsNFCSupported = CrossNFC.IsSupported;
SetInfo();
await LoadCheckListTemplate(); await LoadCheckListTemplate();
await LoadCheckList(); await LoadCheckList();
} }
@@ -233,7 +247,7 @@ public class ContinueConverter : IValueConverter
{ {
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{ {
if (value is CheckStatus status) if (value is CheckStatus status && CrossNFC.IsSupported && CrossNFC.Current.IsAvailable)
{ {
if (status == CheckStatus.InProgress || status == CheckStatus.Open) if (status == CheckStatus.InProgress || status == CheckStatus.Open)
{ {
@@ -72,7 +72,8 @@ public partial class CheckListWorkPage : ContentPage
{ {
if (Navigation.ModalStack.Count > 0) if (Navigation.ModalStack.Count > 0)
{ {
await Shell.Current.Navigation.PopModalAsync(); //await Navigation.PopModalAsync();
await Shell.Current.GoToAsync("//CheckListPage");
} }
} }
else else
@@ -62,6 +62,7 @@
HeightRequest="50" HeightRequest="50"
CornerRadius="10" CornerRadius="10"
TextColor="White" TextColor="White"
ImageSource="check_circle.svg"
Clicked="OnLoginClicked" /> Clicked="OnLoginClicked" />
<Button x:Name="LoginNFCBtn" <Button x:Name="LoginNFCBtn"
@@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="#FFFFFF" class="bi bi-arrow-clockwise" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M8 3a5 5 0 1 0 4.546 2.914.5.5 0 0 1 .908-.417A6 6 0 1 1 8 2z"/>
<path d="M8 4.466V.534a.25.25 0 0 1 .41-.192l2.36 1.966c.12.1.12.284 0 .384L8.41 4.658A.25.25 0 0 1 8 4.466"/>
</svg>

After

Width:  |  Height:  |  Size: 344 B

@@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="#FFFFFF" class="bi bi-arrow-counterclockwise" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M8 3a5 5 0 1 1-4.546 2.914.5.5 0 0 0-.908-.417A6 6 0 1 0 8 2z"/>
<path d="M8 4.466V.534a.25.25 0 0 0-.41-.192L5.23 2.308a.25.25 0 0 0 0 .384l2.36 1.966A.25.25 0 0 0 8 4.466"/>
</svg>

After

Width:  |  Height:  |  Size: 351 B

@@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="#FFFFFF" class="bi bi-arrow-down" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M8 1a.5.5 0 0 1 .5.5v11.793l3.146-3.147a.5.5 0 0 1 .708.708l-4 4a.5.5 0 0 1-.708 0l-4-4a.5.5 0 0 1 .708-.708L7.5 13.293V1.5A.5.5 0 0 1 8 1"/>
</svg>

After

Width:  |  Height:  |  Size: 303 B

@@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="#FFFFFF" class="bi bi-arrow-left" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M15 8a.5.5 0 0 0-.5-.5H2.707l3.147-3.146a.5.5 0 1 0-.708-.708l-4 4a.5.5 0 0 0 0 .708l4 4a.5.5 0 0 0 .708-.708L2.707 8.5H14.5A.5.5 0 0 0 15 8"/>
</svg>

After

Width:  |  Height:  |  Size: 305 B

@@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="#FFFFFF" class="bi bi-arrow-right" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M1 8a.5.5 0 0 1 .5-.5h11.793l-3.147-3.146a.5.5 0 0 1 .708-.708l4 4a.5.5 0 0 1 0 .708l-4 4a.5.5 0 0 1-.708-.708L13.293 8.5H1.5A.5.5 0 0 1 1 8"/>
</svg>

After

Width:  |  Height:  |  Size: 306 B

@@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="#FFFFFF" class="bi bi-arrow-up" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M8 15a.5.5 0 0 0 .5-.5V2.707l3.146 3.147a.5.5 0 0 0 .708-.708l-4-4a.5.5 0 0 0-.708 0l-4 4a.5.5 0 1 0 .708.708L7.5 2.707V14.5a.5.5 0 0 0 .5.5"/>
</svg>

After

Width:  |  Height:  |  Size: 303 B

@@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
<path fill="#FFFFFF" d="M10.97 4.97a.75.75 0 0 1 1.07 1.05l-3.99 4.99a.75.75 0 0 1-1.08.02L4.324 8.384a.75.75 0 1 1 1.06-1.06l2.094 2.093 3.473-4.425z"/>
</svg>

After

Width:  |  Height:  |  Size: 225 B

@@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
<path fill="#FFFFFF" d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14m0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16"/>
<path fill="#FFFFFF" d="m10.97 4.97-.02.022-3.473 4.425-2.093-2.094a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-1.071-1.05"/>
</svg>

After

Width:  |  Height:  |  Size: 334 B

@@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="#FFFFFF" class="bi bi-pencil-fill" viewBox="0 0 16 16">
<path d="M12.854.146a.5.5 0 0 0-.707 0L10.5 1.793 14.207 5.5l1.647-1.646a.5.5 0 0 0 0-.708zm.646 6.061L9.793 2.5 3.293 9H3.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.207zm-7.468 7.468A.5.5 0 0 1 6 13.5V13h-.5a.5.5 0 0 1-.5-.5V12h-.5a.5.5 0 0 1-.5-.5V11h-.5a.5.5 0 0 1-.5-.5V10h-.5a.5.5 0 0 1-.175-.032l-.179.178a.5.5 0 0 0-.11.168l-2 5a.5.5 0 0 0 .65.65l5-2a.5.5 0 0 0 .168-.11z"/>
</svg>

After

Width:  |  Height:  |  Size: 557 B

@@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="#FFFFFF" class="bi bi-save2" viewBox="0 0 16 16">
<path d="M2 1a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H9.5a1 1 0 0 0-1 1v4.5h2a.5.5 0 0 1 .354.854l-2.5 2.5a.5.5 0 0 1-.708 0l-2.5-2.5A.5.5 0 0 1 5.5 6.5h2V2a2 2 0 0 1 2-2H14a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2h2.5a.5.5 0 0 1 0 1z"/>
</svg>

After

Width:  |  Height:  |  Size: 411 B

@@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-stop" viewBox="0 0 16 16">
<path d="M3.5 5A1.5 1.5 0 0 1 5 3.5h6A1.5 1.5 0 0 1 12.5 5v6a1.5 1.5 0 0 1-1.5 1.5H5A1.5 1.5 0 0 1 3.5 11zM5 4.5a.5.5 0 0 0-.5.5v6a.5.5 0 0 0 .5.5h6a.5.5 0 0 0 .5-.5V5a.5.5 0 0 0-.5-.5z"/>
</svg>

After

Width:  |  Height:  |  Size: 320 B

@@ -225,7 +225,7 @@ namespace WorkFlowCheck.MAUI.Services
{ {
if (response.IsSuccess) if (response.IsSuccess)
{ {
checkListHeader.CheckStatus = CheckStatus.InProgress; checkListHeader.CheckStatus = CheckStatus.Blocked;
await _dbContext.SaveChangesAsync(); await _dbContext.SaveChangesAsync();
retVal = true; retVal = true;
} }
@@ -256,7 +256,7 @@ namespace WorkFlowCheck.MAUI.Services
{ {
if (response.IsSuccess) if (response.IsSuccess)
{ {
checkListHeader.CheckStatus = CheckStatus.InProgress; checkListHeader.CheckStatus = CheckStatus.Signed;
await _dbContext.SaveChangesAsync(); await _dbContext.SaveChangesAsync();
retVal = true; retVal = true;
} }