Üzenetküldés frontenden
This commit is contained in:
@@ -1,5 +1,8 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using CommunityToolkit.Maui.Alerts;
|
||||||
|
using CommunityToolkit.Maui.Core;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using System.Threading;
|
||||||
using WorkFlowCheck.Common.DTO;
|
using WorkFlowCheck.Common.DTO;
|
||||||
using WorkFlowCheck.MAUI.DataLayer;
|
using WorkFlowCheck.MAUI.DataLayer;
|
||||||
using WorkFlowCheck.MAUI.Services;
|
using WorkFlowCheck.MAUI.Services;
|
||||||
@@ -10,22 +13,29 @@ namespace WorkFlowCheck.MAUI
|
|||||||
public partial class App : Application
|
public partial class App : Application
|
||||||
{
|
{
|
||||||
private readonly AppDbContext _dbContext;
|
private readonly AppDbContext _dbContext;
|
||||||
|
private readonly IUserService _userService;
|
||||||
|
private readonly ISyncService _syncService;
|
||||||
|
private CancellationTokenSource _cancellationTokenSource;
|
||||||
|
|
||||||
public App(IServiceProvider serviceProvider)
|
public App(IServiceProvider serviceProvider)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
_dbContext = serviceProvider.GetRequiredService<AppDbContext>();
|
_dbContext = serviceProvider.GetRequiredService<AppDbContext>();
|
||||||
|
_userService = serviceProvider.GetRequiredService<IUserService>();
|
||||||
|
_syncService = serviceProvider.GetRequiredService<ISyncService>();
|
||||||
|
|
||||||
_dbContext.Database.EnsureDeleted(); // Adatbázis törlése
|
_dbContext.Database.EnsureDeleted(); // Adatbázis törlése
|
||||||
_dbContext.Database.EnsureCreated(); // Új adatbázis létrehozása
|
_dbContext.Database.EnsureCreated(); // Új adatbázis létrehozása
|
||||||
|
|
||||||
|
StartBackgroundTask();
|
||||||
MainPage = new AppShell();
|
MainPage = new AppShell();
|
||||||
//MainPage = new NavigationPage(new MainPage(serviceProvider.GetRequiredService<IUserService>()));
|
//MainPage = new NavigationPage(new MainPage(serviceProvider.GetRequiredService<IUserService>()));
|
||||||
|
|
||||||
}
|
}
|
||||||
protected async override void OnResume()
|
protected async override void OnResume()
|
||||||
{
|
{
|
||||||
|
StartBackgroundTask();
|
||||||
base.OnResume();
|
base.OnResume();
|
||||||
var isLogged = await SecureStorage.Default.GetAsync("WFCUser");
|
var isLogged = await SecureStorage.Default.GetAsync("WFCUser");
|
||||||
if (isLogged == null)
|
if (isLogged == null)
|
||||||
@@ -35,6 +45,7 @@ namespace WorkFlowCheck.MAUI
|
|||||||
}
|
}
|
||||||
protected override void OnSleep()
|
protected override void OnSleep()
|
||||||
{
|
{
|
||||||
|
_cancellationTokenSource?.Cancel();
|
||||||
SecureStorage.Default.Remove("WFCUser");
|
SecureStorage.Default.Remove("WFCUser");
|
||||||
base.OnSleep();
|
base.OnSleep();
|
||||||
}
|
}
|
||||||
@@ -44,6 +55,67 @@ namespace WorkFlowCheck.MAUI
|
|||||||
SecureStorage.Default.Remove("WFCUser");
|
SecureStorage.Default.Remove("WFCUser");
|
||||||
await Shell.Current.GoToAsync("//LoginPage");
|
await Shell.Current.GoToAsync("//LoginPage");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void StartBackgroundTask()
|
||||||
|
{
|
||||||
|
_cancellationTokenSource = new CancellationTokenSource();
|
||||||
|
Task.Run(() => BackgroundTask(_cancellationTokenSource.Token));
|
||||||
|
}
|
||||||
|
private async Task BackgroundTask(CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
while (!cancellationToken.IsCancellationRequested)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var userDTO = _userService.GetCurrentUser();
|
||||||
|
|
||||||
|
if (userDTO != null && userDTO.Id > 0)
|
||||||
|
{
|
||||||
|
if (userDTO.RoleDTO?.Count > 0)
|
||||||
|
{
|
||||||
|
foreach (var roleDTO in userDTO.RoleDTO)
|
||||||
|
{
|
||||||
|
if (roleDTO.CanEnableBlocked)
|
||||||
|
{
|
||||||
|
var deviceMessageDTOList = await _syncService.DeviceMessageReadUnreaded(_userService.DeviceId.ToUpper());
|
||||||
|
if (deviceMessageDTOList != null && deviceMessageDTOList.Count > 0)
|
||||||
|
{
|
||||||
|
await ShowSnackbar(deviceMessageDTOList[0].Message);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
await Task.Delay(TimeSpan.FromSeconds(5), cancellationToken);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private async Task ShowSnackbar(string message)
|
||||||
|
{
|
||||||
|
var visualOptions = new SnackbarOptions
|
||||||
|
{
|
||||||
|
ActionButtonTextColor = Colors.Yellow,
|
||||||
|
CornerRadius = new CornerRadius(5),
|
||||||
|
Font = Microsoft.Maui.Font.SystemFontOfSize(16),
|
||||||
|
BackgroundColor = Microsoft.Maui.Graphics.Color.Parse("Red"),
|
||||||
|
TextColor = Colors.Yellow
|
||||||
|
|
||||||
|
};
|
||||||
|
var snackbar = Snackbar.Make(message,
|
||||||
|
duration: TimeSpan.FromSeconds(10),
|
||||||
|
action: () => Console.WriteLine("Snackbar dismissed"),
|
||||||
|
actionButtonText: "OK",
|
||||||
|
visualOptions: visualOptions
|
||||||
|
);
|
||||||
|
|
||||||
|
await snackbar.Show();
|
||||||
|
}
|
||||||
private async Task<ApiResponseDTO<UserDTO>> CheckSecurity()
|
private async Task<ApiResponseDTO<UserDTO>> CheckSecurity()
|
||||||
{
|
{
|
||||||
var isLogged = await SecureStorage.Default.GetAsync("WFCUser");
|
var isLogged = await SecureStorage.Default.GetAsync("WFCUser");
|
||||||
|
|||||||
@@ -5,20 +5,46 @@
|
|||||||
Title="Főmenü"
|
Title="Főmenü"
|
||||||
BackgroundColor="#f0f0f0">
|
BackgroundColor="#f0f0f0">
|
||||||
|
|
||||||
<ContentPage.ToolbarItems>
|
<Shell.TitleView>
|
||||||
<ToolbarItem x:Name="DeviceId"
|
<Grid Padding="2" VerticalOptions="Center">
|
||||||
Text="MK001"
|
<Label Text="Főmenü"
|
||||||
Order="Primary"
|
FontSize="22"
|
||||||
Priority="0" />
|
FontAttributes="Bold"
|
||||||
<!--<ToolbarItem Text="Gomb" Order="Primary" Priority="1" Clicked="OnButtonAction" />-->
|
VerticalOptions="Center"
|
||||||
</ContentPage.ToolbarItems>
|
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="Auto, * , Auto" Padding="30,0">
|
<Grid RowDefinitions="Auto, * , Auto" Padding="30,0">
|
||||||
|
|
||||||
<ScrollView Grid.Row="1"
|
<ScrollView Grid.Row="1"
|
||||||
Padding="25">
|
Padding="25">
|
||||||
<VerticalStackLayout Spacing="25">
|
<VerticalStackLayout Spacing="25">
|
||||||
<Frame BorderColor="Gray"
|
<Frame x:Name="AdminFrame"
|
||||||
|
BorderColor="Gray"
|
||||||
Padding="5"
|
Padding="5"
|
||||||
CornerRadius="10"
|
CornerRadius="10"
|
||||||
Margin="1"
|
Margin="1"
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
using WorkFlowCheck.Common.DTO;
|
using DevExpress.Entity.Model.Metadata;
|
||||||
|
using WorkFlowCheck.Common.DTO;
|
||||||
using WorkFlowCheck.MAUI.Pages.Media;
|
using WorkFlowCheck.MAUI.Pages.Media;
|
||||||
using WorkFlowCheck.MAUI.Services.Interfaces;
|
using WorkFlowCheck.MAUI.Services.Interfaces;
|
||||||
namespace WorkFlowCheck.MAUI
|
namespace WorkFlowCheck.MAUI
|
||||||
{
|
{
|
||||||
public partial class MainPage : ContentPage
|
public partial class MainPage : ContentPage
|
||||||
{
|
{
|
||||||
int count = 0;
|
|
||||||
private IUserService _userService;
|
private IUserService _userService;
|
||||||
|
private UserDTO _currentUser;
|
||||||
|
|
||||||
public MainPage(IUserService userService)
|
public MainPage(IUserService userService)
|
||||||
{
|
{
|
||||||
@@ -14,23 +16,23 @@ namespace WorkFlowCheck.MAUI
|
|||||||
_userService = userService;
|
_userService = userService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SetInfo()
|
||||||
|
{
|
||||||
|
_currentUser = _userService.GetCurrentUser();
|
||||||
|
DeviceId.Text = _userService.DeviceId;
|
||||||
|
UserInfo.Text = $"{_currentUser?.FirstName} {_currentUser?.LastName}";
|
||||||
|
}
|
||||||
override protected async void OnAppearing()
|
override protected async void OnAppearing()
|
||||||
{
|
{
|
||||||
base.OnAppearing();
|
base.OnAppearing();
|
||||||
var currentUser = _userService.GetCurrentUser();
|
SetInfo();
|
||||||
DeviceId.Text = _userService.DeviceId;
|
if (_currentUser != null)
|
||||||
if (currentUser != null)
|
|
||||||
{
|
{
|
||||||
foreach (var role in currentUser.RoleDTO)
|
AdminFrame.IsVisible = false;
|
||||||
|
foreach (var role in _currentUser?.RoleDTO)
|
||||||
{
|
{
|
||||||
if (role.RoleName == "Admin")
|
if (role.IsAdmin) AdminFrame.IsVisible = true;
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,6 +59,7 @@ namespace WorkFlowCheck.MAUI
|
|||||||
}
|
}
|
||||||
private void OnButtonLogout(object sender, EventArgs e)
|
private void OnButtonLogout(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
_userService.SetCurrentUser(null);
|
||||||
SecureStorage.Default.Remove("WFCUser");
|
SecureStorage.Default.Remove("WFCUser");
|
||||||
SecureStorage.Default.Remove("AuthToken");
|
SecureStorage.Default.Remove("AuthToken");
|
||||||
Shell.Current.GoToAsync("//LoginPage");
|
Shell.Current.GoToAsync("//LoginPage");
|
||||||
|
|||||||
@@ -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"
|
x:Class="WorkFlowCheck.MAUI.Pages.CheckList.CheckListPage"
|
||||||
Title="Ellenőrzések"
|
Title="Ellenőrzések"
|
||||||
BackgroundColor="#f0f0f0">
|
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">
|
<Grid RowDefinitions="*,*" Padding="30,30">
|
||||||
<Frame Grid.Row="0"
|
<Frame Grid.Row="0"
|
||||||
BorderColor="Gray"
|
BorderColor="Gray"
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ public partial class CheckListPage : ContentPage
|
|||||||
private readonly ICheckListService _checkListService;
|
private readonly ICheckListService _checkListService;
|
||||||
private readonly IUserService _userService;
|
private readonly IUserService _userService;
|
||||||
private bool _isLoading;
|
private bool _isLoading;
|
||||||
|
private UserDTO _currentUser;
|
||||||
|
|
||||||
public ICommand NewCommand { get; set; }
|
public ICommand NewCommand { get; set; }
|
||||||
public ICommand ContinueCommand { get; set; }
|
public ICommand ContinueCommand { get; set; }
|
||||||
@@ -42,6 +42,12 @@ public partial class CheckListPage : ContentPage
|
|||||||
BlockCommand = new Command<CheckListHeaderDTO>(OnBlockItem);
|
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()
|
protected override bool OnBackButtonPressed()
|
||||||
{
|
{
|
||||||
Shell.Current.GoToAsync("//MainPage");
|
Shell.Current.GoToAsync("//MainPage");
|
||||||
@@ -50,7 +56,7 @@ public partial class CheckListPage : ContentPage
|
|||||||
protected override async void OnAppearing()
|
protected override async void OnAppearing()
|
||||||
{
|
{
|
||||||
base.OnAppearing();
|
base.OnAppearing();
|
||||||
|
SetInfo();
|
||||||
BindingContext = this;
|
BindingContext = this;
|
||||||
await LoadCheckListTemplate();
|
await LoadCheckListTemplate();
|
||||||
await LoadCheckList();
|
await LoadCheckList();
|
||||||
@@ -90,15 +96,15 @@ public partial class CheckListPage : ContentPage
|
|||||||
private async Task LoadCheckListTemplate()
|
private async Task LoadCheckListTemplate()
|
||||||
{
|
{
|
||||||
IsLoading = true;
|
IsLoading = true;
|
||||||
var userId = _userService.GetCurrentUser()?.Id;
|
|
||||||
CheckListTemplate.ItemsSource = await _checkListService.GetCheckListTemplates(userId ?? 1);
|
CheckListTemplate.ItemsSource = await _checkListService.GetCheckListTemplates(_currentUser.Id);
|
||||||
IsLoading = false;
|
IsLoading = false;
|
||||||
}
|
}
|
||||||
private async Task LoadCheckList()
|
private async Task LoadCheckList()
|
||||||
{
|
{
|
||||||
IsLoading = true;
|
IsLoading = true;
|
||||||
var userId = _userService.GetCurrentUser()?.Id;
|
|
||||||
CheckList.ItemsSource = await _checkListService.GetCheckLists(userId ?? 1);
|
CheckList.ItemsSource = await _checkListService.GetCheckLists(_currentUser.Id);
|
||||||
IsLoading = false;
|
IsLoading = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,39 @@
|
|||||||
xmlns:local="clr-namespace:WorkFlowCheck.MAUI.Pages.CheckList"
|
xmlns:local="clr-namespace:WorkFlowCheck.MAUI.Pages.CheckList"
|
||||||
BackgroundColor="#f0f0f0"
|
BackgroundColor="#f0f0f0"
|
||||||
Title="">
|
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>
|
<Grid>
|
||||||
<StackLayout Padding="20">
|
<StackLayout Padding="20">
|
||||||
<Label x:Name="progressLabel" Text="Folyamatjelző" FontSize="Default" HorizontalOptions="Center" />
|
<Label x:Name="progressLabel" Text="Folyamatjelző" FontSize="Default" HorizontalOptions="Center" />
|
||||||
|
|||||||
@@ -1,20 +1,22 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?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"
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
x:Class="WorkFlowCheck.MAUI.Pages.Security.LoginPage"
|
x:Class="WorkFlowCheck.MAUI.Pages.Security.LoginPage"
|
||||||
|
xmlns:local="clr-namespace:WorkFlowCheck.MAUI.Pages"
|
||||||
Title="Bejelentkezés"
|
Title="Bejelentkezés"
|
||||||
BackgroundColor="#f0f0f0">
|
BackgroundColor="#f0f0f0">
|
||||||
|
|
||||||
<ScrollView>
|
<ContentView x:Name="LoginContent">
|
||||||
<Grid>
|
<ScrollView>
|
||||||
<Grid.RowDefinitions>
|
<Grid>
|
||||||
<RowDefinition Height="*" />
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="*" />
|
||||||
<RowDefinition Height="*" />
|
<RowDefinition Height="Auto" />
|
||||||
</Grid.RowDefinitions>
|
<RowDefinition Height="*" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
<!-- Középen lévő kártya, ami mobilon is jól mutat, tableten pedig középen marad -->
|
<!-- Középen lévő kártya, ami mobilon is jól mutat, tableten pedig középen marad -->
|
||||||
<Frame Grid.Row="1"
|
<Frame Grid.Row="1"
|
||||||
BackgroundColor="White"
|
BackgroundColor="White"
|
||||||
BorderColor="#cccccc"
|
BorderColor="#cccccc"
|
||||||
CornerRadius="20"
|
CornerRadius="20"
|
||||||
@@ -25,22 +27,22 @@
|
|||||||
WidthRequest="{OnPlatform Android=350, iOS=350, WinUI=400, MacCatalyst=400}"
|
WidthRequest="{OnPlatform Android=350, iOS=350, WinUI=400, MacCatalyst=400}"
|
||||||
MaximumWidthRequest="500">
|
MaximumWidthRequest="500">
|
||||||
|
|
||||||
<VerticalStackLayout Spacing="20">
|
<VerticalStackLayout Spacing="20">
|
||||||
|
|
||||||
<Label Text="Bejelentkezés"
|
<Label Text="Bejelentkezés"
|
||||||
FontSize="24"
|
FontSize="24"
|
||||||
FontAttributes="Bold"
|
FontAttributes="Bold"
|
||||||
HorizontalOptions="Center"
|
HorizontalOptions="Center"
|
||||||
TextColor="#333" />
|
TextColor="#333" />
|
||||||
|
|
||||||
<Entry x:Name="UsernameEntry"
|
<Entry x:Name="UsernameEntry"
|
||||||
Placeholder="Felhasználói név"
|
Placeholder="Felhasználói név"
|
||||||
FontSize="18"
|
FontSize="18"
|
||||||
BackgroundColor="#f9f9f9"
|
BackgroundColor="#f9f9f9"
|
||||||
HeightRequest="50"
|
HeightRequest="50"
|
||||||
Margin="0" />
|
Margin="0" />
|
||||||
|
|
||||||
<Entry x:Name="PasswordEntry"
|
<Entry x:Name="PasswordEntry"
|
||||||
Placeholder="PIN kód"
|
Placeholder="PIN kód"
|
||||||
IsPassword="True"
|
IsPassword="True"
|
||||||
Keyboard="Numeric"
|
Keyboard="Numeric"
|
||||||
@@ -49,12 +51,12 @@
|
|||||||
HeightRequest="50"
|
HeightRequest="50"
|
||||||
Margin="0" />
|
Margin="0" />
|
||||||
|
|
||||||
<HorizontalStackLayout Spacing="20" HorizontalOptions="Center">
|
<HorizontalStackLayout Spacing="20" HorizontalOptions="Center">
|
||||||
<RadioButton x:Name="ProdOption" Content="PROD" GroupName="Environment" />
|
<RadioButton x:Name="ProdOption" Content="PROD" GroupName="Environment" />
|
||||||
<RadioButton x:Name="UatOption" Content="UAT" GroupName="Environment" />
|
<RadioButton x:Name="UatOption" Content="UAT" GroupName="Environment" />
|
||||||
</HorizontalStackLayout>
|
</HorizontalStackLayout>
|
||||||
|
|
||||||
<Button x:Name="LoginBtn"
|
<Button x:Name="LoginBtn"
|
||||||
Text="Bejelentkezés"
|
Text="Bejelentkezés"
|
||||||
FontSize="18"
|
FontSize="18"
|
||||||
HeightRequest="50"
|
HeightRequest="50"
|
||||||
@@ -62,7 +64,7 @@
|
|||||||
TextColor="White"
|
TextColor="White"
|
||||||
Clicked="OnLoginClicked" />
|
Clicked="OnLoginClicked" />
|
||||||
|
|
||||||
<Button x:Name="LoginNFCBtn"
|
<Button x:Name="LoginNFCBtn"
|
||||||
Text="NFC azonosítás"
|
Text="NFC azonosítás"
|
||||||
FontSize="18"
|
FontSize="18"
|
||||||
HeightRequest="50"
|
HeightRequest="50"
|
||||||
@@ -70,12 +72,13 @@
|
|||||||
TextColor="White"
|
TextColor="White"
|
||||||
Clicked="OnLoginNFCClicked" />
|
Clicked="OnLoginNFCClicked" />
|
||||||
|
|
||||||
<ActivityIndicator x:Name="LoadingIndicator"
|
<ActivityIndicator x:Name="LoadingIndicator"
|
||||||
IsRunning="False"
|
IsRunning="False"
|
||||||
IsVisible="False"
|
IsVisible="False"
|
||||||
HorizontalOptions="Center" />
|
HorizontalOptions="Center" />
|
||||||
</VerticalStackLayout>
|
</VerticalStackLayout>
|
||||||
</Frame>
|
</Frame>
|
||||||
</Grid>
|
</Grid>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
</ContentPage>
|
</ContentView>
|
||||||
|
</local:BasePage>
|
||||||
|
|||||||
@@ -6,13 +6,14 @@ using WorkFlowCheck.MAUI.Services.Interfaces;
|
|||||||
|
|
||||||
namespace WorkFlowCheck.MAUI.Pages.Security;
|
namespace WorkFlowCheck.MAUI.Pages.Security;
|
||||||
|
|
||||||
public partial class LoginPage : ContentPage
|
public partial class LoginPage : BasePage
|
||||||
{
|
{
|
||||||
private IUserService _userService;
|
private IUserService _userService;
|
||||||
private ISyncService _syncService;
|
private ISyncService _syncService;
|
||||||
public LoginPage()
|
public LoginPage()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
SetContent(LoginContent);
|
||||||
_userService = MauiProgram.ServiceProvider.GetRequiredService<IUserService>();
|
_userService = MauiProgram.ServiceProvider.GetRequiredService<IUserService>();
|
||||||
_syncService = MauiProgram.ServiceProvider.GetRequiredService<ISyncService>();
|
_syncService = MauiProgram.ServiceProvider.GetRequiredService<ISyncService>();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,6 @@ namespace WorkFlowCheck.MAUI.Services.Interfaces
|
|||||||
Task SyncCheckListHeader_Down(Action<double, string> reportProgress);
|
Task SyncCheckListHeader_Down(Action<double, string> reportProgress);
|
||||||
Task<ApiResponseDTO<string>> SyncCheckListHeader_Up(int Id, Action<double, string> reportProgress);
|
Task<ApiResponseDTO<string>> SyncCheckListHeader_Up(int Id, Action<double, string> reportProgress);
|
||||||
|
|
||||||
|
Task<List<DeviceMessageDTO>> DeviceMessageReadUnreaded(string deviceIdBase64);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,18 @@
|
|||||||
using Android.Content;
|
using Android.Content;
|
||||||
|
using Android.Util;
|
||||||
using AutoMapper;
|
using AutoMapper;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
|
using Microsoft.IdentityModel.Tokens;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using System.Net.Http.Json;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using WorkFlowCheck.Common.DTO;
|
using WorkFlowCheck.Common.DTO;
|
||||||
using WorkFlowCheck.MAUI.DataLayer;
|
using WorkFlowCheck.MAUI.DataLayer;
|
||||||
using WorkFlowCheck.MAUI.DataLayer.Entities;
|
using WorkFlowCheck.MAUI.DataLayer.Entities;
|
||||||
using WorkFlowCheck.MAUI.Handlers;
|
using WorkFlowCheck.MAUI.Handlers;
|
||||||
using WorkFlowCheck.MAUI.Services.Interfaces;
|
using WorkFlowCheck.MAUI.Services.Interfaces;
|
||||||
|
using static Android.Renderscripts.ScriptGroup;
|
||||||
using Location = WorkFlowCheck.MAUI.DataLayer.Entities.Location;
|
using Location = WorkFlowCheck.MAUI.DataLayer.Entities.Location;
|
||||||
|
|
||||||
namespace WorkFlowCheck.MAUI.Services
|
namespace WorkFlowCheck.MAUI.Services
|
||||||
@@ -16,10 +20,13 @@ namespace WorkFlowCheck.MAUI.Services
|
|||||||
public class SyncService : BaseService, ISyncService
|
public class SyncService : BaseService, ISyncService
|
||||||
{
|
{
|
||||||
private readonly IUserService _userService;
|
private readonly IUserService _userService;
|
||||||
|
|
||||||
public SyncService(HttpClient httpClient, IConfiguration configuration, AppDbContext dbContext, IMapper mapper, IUserService userService) : base(httpClient, configuration, dbContext, mapper)
|
public SyncService(HttpClient httpClient, IConfiguration configuration, AppDbContext dbContext, IMapper mapper, IUserService userService) : base(httpClient, configuration, dbContext, mapper)
|
||||||
{
|
{
|
||||||
_userService = userService;
|
_userService = userService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public async Task SyncDatas(Action<double, string> reportProgress)
|
public async Task SyncDatas(Action<double, string> reportProgress)
|
||||||
{
|
{
|
||||||
await SyncCheckPoints_Down(reportProgress);
|
await SyncCheckPoints_Down(reportProgress);
|
||||||
@@ -372,5 +379,28 @@ namespace WorkFlowCheck.MAUI.Services
|
|||||||
var responseList = JsonConvert.DeserializeObject<ApiResponseDTO<List<T>>>(jsonString);
|
var responseList = JsonConvert.DeserializeObject<ApiResponseDTO<List<T>>>(jsonString);
|
||||||
return responseList;
|
return responseList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<List<DeviceMessageDTO>> DeviceMessageReadUnreaded(string deviceId)
|
||||||
|
{
|
||||||
|
var deviceIdBase64= Base64UrlEncoder.Encode(Encoding.UTF8.GetBytes(deviceId));
|
||||||
|
string endpoint = $"{_httpClient.BaseAddress}api/Sync/DeviceMessageReadUnreaded/{deviceIdBase64}";
|
||||||
|
var retVal = new List<DeviceMessageDTO>();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var response = await _httpClient.GetFromJsonAsync<ApiResponseDTO<List<DeviceMessageDTO>>>(endpoint);
|
||||||
|
if (response != null)
|
||||||
|
{
|
||||||
|
if (response.IsSuccess)
|
||||||
|
{
|
||||||
|
return response.Data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
return retVal;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -187,11 +187,11 @@ namespace WorkFlowCheck.MAUI.Services
|
|||||||
}
|
}
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetCurrentUser(UserDTO user)
|
public void SetCurrentUser(UserDTO user)
|
||||||
{
|
{
|
||||||
CurrentUser = user;
|
CurrentUser = user;
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserDTO? GetCurrentUser() => CurrentUser;
|
public UserDTO? GetCurrentUser() => CurrentUser;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,6 +78,7 @@
|
|||||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.1" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.1" />
|
||||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.1" />
|
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.1" />
|
||||||
|
<PackageReference Include="Microsoft.IdentityModel.Tokens" Version="8.7.0" />
|
||||||
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
|
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
|
||||||
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="$(MauiVersion)" />
|
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="$(MauiVersion)" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.1" />
|
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.1" />
|
||||||
@@ -102,6 +103,9 @@
|
|||||||
<MauiXaml Update="ContentViews\HeaderView.xaml">
|
<MauiXaml Update="ContentViews\HeaderView.xaml">
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</MauiXaml>
|
</MauiXaml>
|
||||||
|
<MauiXaml Update="Pages\BasePage.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</MauiXaml>
|
||||||
<MauiXaml Update="Pages\BaseStock\BaseStockPage.xaml">
|
<MauiXaml Update="Pages\BaseStock\BaseStockPage.xaml">
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</MauiXaml>
|
</MauiXaml>
|
||||||
@@ -147,6 +151,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Folder Include="Helper\" />
|
||||||
<Folder Include="Platforms\Android\Resources\mipmap-hdpi\" />
|
<Folder Include="Platforms\Android\Resources\mipmap-hdpi\" />
|
||||||
<Folder Include="Platforms\Android\Resources\mipmap-xhdpi\" />
|
<Folder Include="Platforms\Android\Resources\mipmap-xhdpi\" />
|
||||||
<Folder Include="Platforms\Android\Resources\mipmap-xxhdpi\" />
|
<Folder Include="Platforms\Android\Resources\mipmap-xxhdpi\" />
|
||||||
|
|||||||
Reference in New Issue
Block a user