MOBILE BUGFIX-ek

This commit is contained in:
2025-04-25 10:29:14 +02:00
parent 1294a00219
commit 62419a2c28
10 changed files with 266 additions and 67 deletions
@@ -38,32 +38,61 @@
</HorizontalStackLayout>
</Grid>
</Shell.TitleView>
<Grid RowDefinitions="*,*" Padding="30,30">
<Frame Grid.Row="0"
<Grid RowDefinitions="*,4*,2*" Padding="30,30">
<VerticalStackLayout Grid.Row="0" Margin="0,0,0,0">
<Label x:Name="progressLabel" Text="Folyamatjelző" FontSize="Medium" HorizontalOptions="Center" />
<HorizontalStackLayout HorizontalOptions="Center" Spacing="10">
<ActivityIndicator x:Name="LoadingIndicator"
IsRunning="False"
IsVisible="False"
VerticalOptions="Center"
HorizontalOptions="Center" />
<ProgressBar x:Name="progressBar"
WidthRequest="310"
HeightRequest="30"
VerticalOptions="Center" />
<Button x:Name="SyncBtn"
ImageSource="cloud_download"
Text=""
Clicked="OnSyncClicked"
HeightRequest="50"
MaximumHeightRequest="50"
WidthRequest="50"
MaximumWidthRequest="50"
CornerRadius="25"
VerticalOptions="Center" />
</HorizontalStackLayout>
</VerticalStackLayout>
<Frame Grid.Row="1"
BorderColor="Gray"
Padding="5"
Margin="1"
CornerRadius="10"
HasShadow="True">
<ScrollView >
<VerticalStackLayout>
<Label Text="Megkezdett ellenőrzések" FontAttributes="Bold" FontSize="Medium" HorizontalOptions="Center" />
<CollectionView x:Name="CheckList">
<CollectionView.ItemTemplate>
<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>
<RefreshView x:Name="CheckListRefreshView"
IsRefreshing="{Binding IsRefreshing}"
Command="{Binding RefreshCommand}">
<ScrollView >
<VerticalStackLayout>
<Label Text="Megkezdett ellenőrzések" FontAttributes="Bold" FontSize="Medium" HorizontalOptions="Center" />
<CollectionView x:Name="CheckList">
<CollectionView.ItemTemplate>
<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>
<!-- Jobb oldali oszlop: Két gomb egymás mellett -->
<HorizontalStackLayout Grid.Column="1" HorizontalOptions="End" Spacing="3">
<Button Text=""
<!-- 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"
@@ -75,20 +104,21 @@
IsVisible="{Binding CheckStatus, Converter={StaticResource BlockedConverter}}"
Command="{Binding BindingContext.BlockCommand, Source={x:Reference CheckList}}"
CommandParameter="{Binding .}">
</Button>
<Button Text="Feloldás"
</Button>
<Button Text=""
ImageSource="arrow_up.svg"
Margin="0,0,0,0"
BackgroundColor="Green"
HeightRequest="50"
MaximumHeightRequest="50"
WidthRequest="120"
MaximumWidthRequest="120"
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=""
</Button>
<Button Text=""
ImageSource="check_circle.svg"
Margin="0,0,0,0"
BackgroundColor="DarkGreen"
@@ -100,8 +130,8 @@
IsVisible="{Binding CheckStatus, Converter={StaticResource AcceptConverter}}"
Command="{Binding BindingContext.AcceptCommand, Source={x:Reference CheckList}}"
CommandParameter="{Binding .}">
</Button>
<Button Text=""
</Button>
<Button Text=""
ImageSource="arrow_right.svg"
Margin="0,0,0,0"
BackgroundColor="Blue"
@@ -113,18 +143,19 @@
IsVisible="{Binding CheckStatus, Converter={StaticResource ContinueConverter}, ConverterParameter = {Binding IsNFCSupported}}"
Command="{Binding BindingContext.ContinueCommand, Source={x:Reference CheckList}}"
CommandParameter="{Binding .}">
</Button>
</HorizontalStackLayout>
</Grid>
</Frame>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</VerticalStackLayout>
</ScrollView>
</Button>
</HorizontalStackLayout>
</Grid>
</Frame>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
</VerticalStackLayout>
</ScrollView>
</RefreshView>
</Frame>
<Frame Grid.Row="1"
<Frame Grid.Row="2"
BorderColor="Gray"
Padding="5"
Margin="1"
@@ -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 RefreshCommand { get; }
public bool IsLoading
{
@@ -47,6 +48,20 @@ public partial class CheckListPage : ContentPage
}
}
private bool _isRefreshing;
public bool IsRefreshing
{
get => _isRefreshing;
set
{
if (_isRefreshing != value)
{
_isRefreshing = value;
OnPropertyChanged(nameof(IsRefreshing));
}
}
}
public CheckListPage()
{
InitializeComponent();
@@ -58,8 +73,55 @@ public partial class CheckListPage : ContentPage
UnblockCommand = new Command<CheckListHeaderDTO>(OnUnblockItem);
BlockCommand = new Command<CheckListHeaderDTO>(OnBlockItem);
AcceptCommand = new Command<CheckListHeaderDTO>(OnAcceptItem);
RefreshCommand = new Command(async () => await OnRefresh());
}
private async void OnSyncClicked(object sender, EventArgs e)
{
SyncBtn.IsEnabled = false;
LoadingIndicator.IsRunning = true;
LoadingIndicator.IsVisible = true;
progressLabel.Text = "Szinkronizálás indítása...";
progressBar.Progress = 0;
try
{
await Task.Run(async () =>
{
await _syncService.SyncCheckListHeader_Down((percentage, infostring) =>
{
// Direkt UI frissítés
MainThread.BeginInvokeOnMainThread(() =>
{
progressBar.Progress = percentage / 100;
progressLabel.Text = $"{infostring}: {percentage:0.00}%";
});
});
});
SystemHelper.Syncronised = true;
progressLabel.Text = "Szinkronizálás befejezve!";
}
catch (Exception ex)
{
progressLabel.Text = $"Hiba történt: {ex.Message}";
}
finally
{
SyncBtn.IsEnabled = true;
LoadingIndicator.IsVisible = false;
LoadingIndicator.IsRunning = false;
}
}
private async Task OnRefresh()
{
IsRefreshing = true;
//await _syncService.SyncCheckListHeader_Down((d, s) => { });
await LoadCheckList();
IsRefreshing = false;
}
private void SetInfo()
{
@@ -170,18 +232,55 @@ public partial class CheckListPage : ContentPage
bool answer = await DisplayAlert("Megerõsítés", "Biztosan feloldod a blokkolást?", "Igen", "Mégsem");
if (answer)
{
await _checkListService.UnBlockCheckListHeader(checkListHeaderDTO);
await LoadCheckList();
var success = await _checkListService.UnBlockCheckListHeader(checkListHeaderDTO);
if (success)
{
IsRefreshing = true;
await LoadCheckList();
IsRefreshing = false;
await SystemHelper.ShowSnackBar("Blokkolás feloldás sikeres!",
SystemHelper.ColorToHex(Colors.Green),
SystemHelper.ColorToHex(Colors.Green),
SystemHelper.ColorToHex(Colors.White),
5);
}
else
{
await SystemHelper.ShowSnackBar("Blokkolás feloldás SIKERTELEN!",
SystemHelper.ColorToHex(Colors.Red),
SystemHelper.ColorToHex(Colors.Red),
SystemHelper.ColorToHex(Colors.Yellow),
15);
}
}
}
private async void OnBlockItem(CheckListHeaderDTO checkListHeaderDTO)
{
bool answer = await DisplayAlert("Megerõsítés", "Biztosan blokkolod a folyamatot?", "Igen", "Mégsem");
if (answer)
{
await _checkListService.BlockCheckListHeader(checkListHeaderDTO);
await LoadCheckList();
var success = await _checkListService.BlockCheckListHeader(checkListHeaderDTO);
if (success)
{
IsRefreshing = true;
await LoadCheckList();
IsRefreshing = false;
await SystemHelper.ShowSnackBar("Blokkolás sikeres!",
SystemHelper.ColorToHex(Colors.Green),
SystemHelper.ColorToHex(Colors.Green),
SystemHelper.ColorToHex(Colors.White),
5);
}
else
{
await SystemHelper.ShowSnackBar("Blokkolás SIKERTELEN!",
SystemHelper.ColorToHex(Colors.Red),
SystemHelper.ColorToHex(Colors.Red),
SystemHelper.ColorToHex(Colors.Yellow),
15);
}
}
}
private async void OnAcceptItem(CheckListHeaderDTO checkListHeaderDTO)
@@ -189,8 +288,27 @@ public partial class CheckListPage : ContentPage
bool answer = await DisplayAlert("Megerõsítés", "Biztosan jóváhagyod a folyamatot?", "Igen", "Mégsem");
if (answer)
{
await _checkListService.AcceptCheckListHeader(checkListHeaderDTO);
await LoadCheckList();
var success = await _checkListService.AcceptCheckListHeader(checkListHeaderDTO);
if (success)
{
IsRefreshing = true;
await LoadCheckList();
IsRefreshing = false;
await SystemHelper.ShowSnackBar("Jóváhagyás sikeres!",
SystemHelper.ColorToHex(Colors.Green),
SystemHelper.ColorToHex(Colors.Green),
SystemHelper.ColorToHex(Colors.White),
5);
}
else
{
await SystemHelper.ShowSnackBar("Jóváhagyás SIKERTELEN!",
SystemHelper.ColorToHex(Colors.Red),
SystemHelper.ColorToHex(Colors.Red),
SystemHelper.ColorToHex(Colors.Yellow),
15);
}
}
}
private async Task LoadCheckListTemplate()
@@ -43,8 +43,8 @@ public partial class CheckListWorkPage : ContentPage
_syncService = MauiProgram.ServiceProvider.GetRequiredService<ISyncService>();
_userService = MauiProgram.ServiceProvider.GetRequiredService<IUserService>();
SaveCommand = new Command(OnSave);
SendCommand = new Command(OnSend);
SaveCommand = new Command(async () => await OnSave());
SendCommand = new Command(async () => await OnSend());
}
private async Task SetInfo()
{
@@ -60,14 +60,14 @@ public partial class CheckListWorkPage : ContentPage
}
}
private async void OnSend()
private async Task OnSend()
{
IsLoading = true;
sendButton.IsEnabled = false;
saveButton.IsEnabled = false;
try
{
OnSave();
await OnSave();
await Task.Run(async () =>
{
@@ -109,7 +109,7 @@ public partial class CheckListWorkPage : ContentPage
}
}
private async void OnSave()
private async Task OnSave()
{
IsLoading = true;
try
@@ -156,6 +156,7 @@ public partial class CheckListWorkPage : ContentPage
{
if (MediaPicker.IsCaptureSupported)
{
await OnSave();
var photo = await MediaPicker.CapturePhotoAsync();
if (photo != null)
{