Üzenetküldés frontenden

This commit is contained in:
2025-04-07 17:05:40 +02:00
parent a3be387ee1
commit b02fb58f2e
14 changed files with 338 additions and 70 deletions
@@ -0,0 +1,42 @@
<?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.BasePage">
<!--<Shell.TitleView>
<Grid BackgroundColor="Blue" Padding="2" VerticalOptions="Center">
--><!-- Bal oldali cím --><!--
<Label Text="MK001"
TextColor="White"
FontSize="18"
VerticalOptions="Center"
HorizontalOptions="Start" />
--><!-- Jobb oldali keret --><!--
<Frame BackgroundColor="White"
CornerRadius="10"
Padding="5"
HasShadow="True"
VerticalOptions="Center"
HorizontalOptions="End">
<Label Text="Custom Frame" TextColor="Black"/>
</Frame>
</Grid>
</Shell.TitleView>-->
<Grid x:Name="MainGrid">
<!-- A tartalom helye -->
<ContentPresenter x:Name="MainContent"
VerticalOptions="Fill"
HorizontalOptions="Fill"/>
<!-- Jobb alsó sarokban a szöveg -->
<Label Text="Verzió 1.0.0"
TextColor="Black"
FontSize="8"
HorizontalOptions="End"
VerticalOptions="End"
Margin="5"
Opacity="0.5"
/>
</Grid>
</ContentPage>
@@ -0,0 +1,14 @@
namespace WorkFlowCheck.MAUI.Pages;
public partial class BasePage : ContentPage
{
public BasePage()
{
InitializeComponent();
}
protected void SetContent(View content)
{
MainGrid.Children.Add(content);
}
}
@@ -5,6 +5,39 @@
x:Class="WorkFlowCheck.MAUI.Pages.CheckList.CheckListPage"
Title="Ellenőrzések"
BackgroundColor="#f0f0f0">
<Shell.TitleView>
<Grid Padding="2" VerticalOptions="Center">
<Label Text="Ellenőrzések"
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"
@@ -14,7 +14,7 @@ public partial class CheckListPage : ContentPage
private readonly ICheckListService _checkListService;
private readonly IUserService _userService;
private bool _isLoading;
private UserDTO _currentUser;
public ICommand NewCommand { get; set; }
public ICommand ContinueCommand { get; set; }
@@ -42,6 +42,12 @@ public partial class CheckListPage : ContentPage
BlockCommand = new Command<CheckListHeaderDTO>(OnBlockItem);
}
private void SetInfo()
{
_currentUser = _userService.GetCurrentUser();
DeviceId.Text = _userService.DeviceId;
UserInfo.Text = $"{_currentUser?.FirstName} {_currentUser?.LastName}";
}
protected override bool OnBackButtonPressed()
{
Shell.Current.GoToAsync("//MainPage");
@@ -50,7 +56,7 @@ public partial class CheckListPage : ContentPage
protected override async void OnAppearing()
{
base.OnAppearing();
SetInfo();
BindingContext = this;
await LoadCheckListTemplate();
await LoadCheckList();
@@ -90,15 +96,15 @@ public partial class CheckListPage : ContentPage
private async Task LoadCheckListTemplate()
{
IsLoading = true;
var userId = _userService.GetCurrentUser()?.Id;
CheckListTemplate.ItemsSource = await _checkListService.GetCheckListTemplates(userId ?? 1);
CheckListTemplate.ItemsSource = await _checkListService.GetCheckListTemplates(_currentUser.Id);
IsLoading = false;
}
private async Task LoadCheckList()
{
IsLoading = true;
var userId = _userService.GetCurrentUser()?.Id;
CheckList.ItemsSource = await _checkListService.GetCheckLists(userId ?? 1);
CheckList.ItemsSource = await _checkListService.GetCheckLists(_currentUser.Id);
IsLoading = false;
}
@@ -6,6 +6,39 @@
xmlns:local="clr-namespace:WorkFlowCheck.MAUI.Pages.CheckList"
BackgroundColor="#f0f0f0"
Title="">
<Shell.TitleView>
<Grid Padding="2" VerticalOptions="Center">
<Label 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>
<StackLayout Padding="20">
<Label x:Name="progressLabel" Text="Folyamatjelző" FontSize="Default" HorizontalOptions="Center" />
@@ -1,20 +1,22 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
<local:BasePage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="WorkFlowCheck.MAUI.Pages.Security.LoginPage"
xmlns:local="clr-namespace:WorkFlowCheck.MAUI.Pages"
Title="Bejelentkezés"
BackgroundColor="#f0f0f0">
<ScrollView>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<ContentView x:Name="LoginContent">
<ScrollView>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<!-- Középen lévő kártya, ami mobilon is jól mutat, tableten pedig középen marad -->
<Frame Grid.Row="1"
<!-- Középen lévő kártya, ami mobilon is jól mutat, tableten pedig középen marad -->
<Frame Grid.Row="1"
BackgroundColor="White"
BorderColor="#cccccc"
CornerRadius="20"
@@ -25,22 +27,22 @@
WidthRequest="{OnPlatform Android=350, iOS=350, WinUI=400, MacCatalyst=400}"
MaximumWidthRequest="500">
<VerticalStackLayout Spacing="20">
<VerticalStackLayout Spacing="20">
<Label Text="Bejelentkezés"
<Label Text="Bejelentkezés"
FontSize="24"
FontAttributes="Bold"
HorizontalOptions="Center"
TextColor="#333" />
<Entry x:Name="UsernameEntry"
<Entry x:Name="UsernameEntry"
Placeholder="Felhasználói név"
FontSize="18"
BackgroundColor="#f9f9f9"
HeightRequest="50"
Margin="0" />
<Entry x:Name="PasswordEntry"
<Entry x:Name="PasswordEntry"
Placeholder="PIN kód"
IsPassword="True"
Keyboard="Numeric"
@@ -48,21 +50,21 @@
BackgroundColor="#f9f9f9"
HeightRequest="50"
Margin="0" />
<HorizontalStackLayout Spacing="20" HorizontalOptions="Center">
<RadioButton x:Name="ProdOption" Content="PROD" GroupName="Environment" />
<RadioButton x:Name="UatOption" Content="UAT" GroupName="Environment" />
</HorizontalStackLayout>
<Button x:Name="LoginBtn"
<HorizontalStackLayout Spacing="20" HorizontalOptions="Center">
<RadioButton x:Name="ProdOption" Content="PROD" GroupName="Environment" />
<RadioButton x:Name="UatOption" Content="UAT" GroupName="Environment" />
</HorizontalStackLayout>
<Button x:Name="LoginBtn"
Text="Bejelentkezés"
FontSize="18"
HeightRequest="50"
CornerRadius="10"
TextColor="White"
Clicked="OnLoginClicked" />
<Button x:Name="LoginNFCBtn"
<Button x:Name="LoginNFCBtn"
Text="NFC azonosítás"
FontSize="18"
HeightRequest="50"
@@ -70,12 +72,13 @@
TextColor="White"
Clicked="OnLoginNFCClicked" />
<ActivityIndicator x:Name="LoadingIndicator"
<ActivityIndicator x:Name="LoadingIndicator"
IsRunning="False"
IsVisible="False"
HorizontalOptions="Center" />
</VerticalStackLayout>
</Frame>
</Grid>
</ScrollView>
</ContentPage>
</VerticalStackLayout>
</Frame>
</Grid>
</ScrollView>
</ContentView>
</local:BasePage>
@@ -6,13 +6,14 @@ using WorkFlowCheck.MAUI.Services.Interfaces;
namespace WorkFlowCheck.MAUI.Pages.Security;
public partial class LoginPage : ContentPage
public partial class LoginPage : BasePage
{
private IUserService _userService;
private ISyncService _syncService;
public LoginPage()
{
InitializeComponent();
SetContent(LoginContent);
_userService = MauiProgram.ServiceProvider.GetRequiredService<IUserService>();
_syncService = MauiProgram.ServiceProvider.GetRequiredService<ISyncService>();
}