diff --git a/src/WorkFlowCheck.Common/DTO/CheckListHeaderDTO.cs b/src/WorkFlowCheck.Common/DTO/CheckListHeaderDTO.cs index 628b025..cefa51e 100644 --- a/src/WorkFlowCheck.Common/DTO/CheckListHeaderDTO.cs +++ b/src/WorkFlowCheck.Common/DTO/CheckListHeaderDTO.cs @@ -5,6 +5,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using WorkFlowCheck.Common.Enums; +using WorkFlowCheck.Common.Helper; namespace WorkFlowCheck.Common.DTO { @@ -17,6 +18,8 @@ namespace WorkFlowCheck.Common.DTO [DisplayName("Státusz")] public CheckStatus CheckStatus { get; set; } + public string StatusName => DisplayNameHelper.GetEnumDisplayName(CheckStatus); + [DisplayName("Dátum")] public DateTime DateExecution { get; set; } diff --git a/src/WorkFlowCheck.Common/Enums/CheckStatus.cs b/src/WorkFlowCheck.Common/Enums/CheckStatus.cs index 655a246..198532b 100644 --- a/src/WorkFlowCheck.Common/Enums/CheckStatus.cs +++ b/src/WorkFlowCheck.Common/Enums/CheckStatus.cs @@ -1,19 +1,35 @@ using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Xml.Linq; namespace WorkFlowCheck.Common.Enums { public enum CheckStatus { + + [Display(Name = "Nyitott")] Open = 0, + + [Display(Name = "Folyamatban")] InProgress = 1, + + [Display(Name = "Blokkolt")] Blocked = 2, + + [Display(Name = "Sztornózva")] Storno = 3, + + [Display(Name = "Beküldött")] Sent = 4, + + [Display(Name = "Jóváhagyva")] Signed = 5, + + [Display(Name = "Lezárva")] Closed = 6 } } diff --git a/src/WorkFlowCheck.Common/Helper/DisplayNameHelper.cs b/src/WorkFlowCheck.Common/Helper/DisplayNameHelper.cs index 8f4cf9f..fcf34c2 100644 --- a/src/WorkFlowCheck.Common/Helper/DisplayNameHelper.cs +++ b/src/WorkFlowCheck.Common/Helper/DisplayNameHelper.cs @@ -1,7 +1,9 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.ComponentModel.DataAnnotations; using System.Linq; +using System.Reflection; using System.Text; using System.Threading.Tasks; @@ -17,6 +19,15 @@ namespace WorkFlowCheck.Common.Helper return displayNameAttribute?.DisplayName ?? propertyName; } + public static string GetEnumDisplayName(this Enum enumValue) + { + return enumValue + .GetType() + .GetMember(enumValue.ToString()) + .First() + .GetCustomAttribute()? + .Name ?? enumValue.ToString(); + } } } diff --git a/src/WorkFlowCheck.MAUI/Mapper/MapperProfile.cs b/src/WorkFlowCheck.MAUI/Mapper/MapperProfile.cs index be452c4..6ec83e6 100644 --- a/src/WorkFlowCheck.MAUI/Mapper/MapperProfile.cs +++ b/src/WorkFlowCheck.MAUI/Mapper/MapperProfile.cs @@ -20,14 +20,17 @@ namespace WorkFlowCheck.MAUI.Mapper .ForMember(dest => dest.CheckListTemplateRows, opt => opt.MapFrom(src => src.CheckListTemplateRowDTO)); CreateMap() .ForMember(dest => dest.CheckListTemplateRowDTO, opt => opt.MapFrom(src => src.CheckListTemplateRows)); + CreateMap() .ForMember(dest => dest.CheckPointDTO, opt => opt.MapFrom(src => src.CheckPoint)); CreateMap(); CreateMap() + .ForMember(dest => dest.CheckListTemplateHeaderDTO, opt => opt.MapFrom(src => src.CheckListTemplateHeader)) .ForMember(dest => dest.CheckListRowDTO, opt => opt.MapFrom(src => src.CheckListRows)); CreateMap() .ForMember(dest => dest.CheckListRows, opt => opt.MapFrom(src => src.CheckListRowDTO)); + CreateMap() .ForMember(dest => dest.CheckListTemplateRowDTO, opt => opt.MapFrom(src => src.CheckListTemplateRow)); CreateMap() diff --git a/src/WorkFlowCheck.MAUI/Pages/BaseStock/BaseStockPage.xaml b/src/WorkFlowCheck.MAUI/Pages/BaseStock/BaseStockPage.xaml index e8fb794..8d8bb83 100644 --- a/src/WorkFlowCheck.MAUI/Pages/BaseStock/BaseStockPage.xaml +++ b/src/WorkFlowCheck.MAUI/Pages/BaseStock/BaseStockPage.xaml @@ -2,9 +2,43 @@ - - + + + + + + @@ -142,8 +144,9 @@ - - + + + \ No newline at end of file diff --git a/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListPage.xaml.cs b/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListPage.xaml.cs index 4c92669..1f16bc8 100644 --- a/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListPage.xaml.cs +++ b/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListPage.xaml.cs @@ -168,13 +168,13 @@ public partial class CheckListPage : ContentPage } -public class BlockedVisibleConverter : IValueConverter +public class BlockedConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value is CheckStatus status) { - return status == CheckStatus.Blocked; + return status == CheckStatus.InProgress; } return false; } @@ -184,13 +184,33 @@ public class BlockedVisibleConverter : IValueConverter throw new NotImplementedException(); } } -public class BlockedHideConverter : IValueConverter +public class UnBlockedConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value is CheckStatus status) { - if (status == CheckStatus.Open || status == CheckStatus.InProgress) + if (status == CheckStatus.Blocked) + { + return true; + } + return false; + } + return false; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } +} +public class ContinueConverter : IValueConverter +{ + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (value is CheckStatus status) + { + if (status == CheckStatus.InProgress || status == CheckStatus.Open) { return true; } diff --git a/src/WorkFlowCheck.MAUI/Pages/NFC/NFCTestPage.xaml b/src/WorkFlowCheck.MAUI/Pages/NFC/NFCTestPage.xaml index 75f6ae1..9699085 100644 --- a/src/WorkFlowCheck.MAUI/Pages/NFC/NFCTestPage.xaml +++ b/src/WorkFlowCheck.MAUI/Pages/NFC/NFCTestPage.xaml @@ -4,7 +4,39 @@ x:Class="WorkFlowCheck.MAUI.Pages.NFC.NFCTestPage" BackgroundColor="#f0f0f0" Title="NFC teszt "> - + + + + diff --git a/src/WorkFlowCheck.MAUI/Pages/NFC/NFCTestPage.xaml.cs b/src/WorkFlowCheck.MAUI/Pages/NFC/NFCTestPage.xaml.cs index 9be56cf..987627d 100644 --- a/src/WorkFlowCheck.MAUI/Pages/NFC/NFCTestPage.xaml.cs +++ b/src/WorkFlowCheck.MAUI/Pages/NFC/NFCTestPage.xaml.cs @@ -3,16 +3,27 @@ using System.Collections.ObjectModel; using System.Text; using System.Windows.Input; using System.Linq; +using WorkFlowCheck.Common.DTO; +using WorkFlowCheck.MAUI.Services.Interfaces; +using Android.DeviceLock; namespace WorkFlowCheck.MAUI.Pages.NFC; public partial class NFCTestPage : ContentPage { + private IUserService _userService; + private UserDTO _currentUser; public NFCTestPage() { InitializeComponent(); + _userService = MauiProgram.ServiceProvider.GetRequiredService(); + } + private void SetInfo() + { + _currentUser = _userService.GetCurrentUser(); + DeviceId.Text = _userService.DeviceId; + UserInfo.Text = $"{_currentUser?.FirstName} {_currentUser?.LastName}"; } - public ObservableCollection NFCDataList { get; set; } public ICommand RefreshCommand { get; set; } @@ -23,6 +34,7 @@ public partial class NFCTestPage : ContentPage protected override async void OnAppearing() { base.OnAppearing(); + SetInfo(); CrossNFC.Legacy = false; if (CrossNFC.IsSupported) diff --git a/src/WorkFlowCheck.MAUI/Pages/System/DownloadAPKPage.xaml b/src/WorkFlowCheck.MAUI/Pages/System/DownloadAPKPage.xaml index 7126969..1d9b276 100644 --- a/src/WorkFlowCheck.MAUI/Pages/System/DownloadAPKPage.xaml +++ b/src/WorkFlowCheck.MAUI/Pages/System/DownloadAPKPage.xaml @@ -2,7 +2,41 @@ + + + + diff --git a/src/WorkFlowCheck.MAUI/Pages/System/DownloadAPKPage.xaml.cs b/src/WorkFlowCheck.MAUI/Pages/System/DownloadAPKPage.xaml.cs index 35b844e..9792aad 100644 --- a/src/WorkFlowCheck.MAUI/Pages/System/DownloadAPKPage.xaml.cs +++ b/src/WorkFlowCheck.MAUI/Pages/System/DownloadAPKPage.xaml.cs @@ -1,3 +1,4 @@ +using WorkFlowCheck.Common.DTO; using WorkFlowCheck.MAUI.Services.Interfaces; namespace WorkFlowCheck.MAUI.Pages.System; @@ -5,10 +6,25 @@ namespace WorkFlowCheck.MAUI.Pages.System; public partial class DownloadAPKPage : ContentPage { private ISyncService _syncService; + private IUserService _userService; + private UserDTO _currentUser; + public DownloadAPKPage() { InitializeComponent(); _syncService = MauiProgram.ServiceProvider.GetRequiredService(); + _userService = MauiProgram.ServiceProvider.GetRequiredService(); + } + override protected async void OnAppearing() + { + base.OnAppearing(); + SetInfo(); + } + private void SetInfo() + { + _currentUser = _userService.GetCurrentUser(); + DeviceId.Text = _userService.DeviceId; + UserInfo.Text = $"{_currentUser?.FirstName} {_currentUser?.LastName}"; } private async void OnSyncClicked(object sender, EventArgs e) { diff --git a/src/WorkFlowCheck.MAUI/Pages/System/SyncPage.xaml b/src/WorkFlowCheck.MAUI/Pages/System/SyncPage.xaml index 7d9a808..3bb69b6 100644 --- a/src/WorkFlowCheck.MAUI/Pages/System/SyncPage.xaml +++ b/src/WorkFlowCheck.MAUI/Pages/System/SyncPage.xaml @@ -4,6 +4,39 @@ x:Class="WorkFlowCheck.MAUI.Pages.System.SyncPage" Title="Adatok szinkronizálása" BackgroundColor="#f0f0f0"> + + + + diff --git a/src/WorkFlowCheck.MAUI/Pages/System/SyncPage.xaml.cs b/src/WorkFlowCheck.MAUI/Pages/System/SyncPage.xaml.cs index 8a46b74..510fd1b 100644 --- a/src/WorkFlowCheck.MAUI/Pages/System/SyncPage.xaml.cs +++ b/src/WorkFlowCheck.MAUI/Pages/System/SyncPage.xaml.cs @@ -1,3 +1,5 @@ +using Android.DeviceLock; +using WorkFlowCheck.Common.DTO; using WorkFlowCheck.MAUI.Services.Interfaces; namespace WorkFlowCheck.MAUI.Pages.System; @@ -5,12 +7,26 @@ namespace WorkFlowCheck.MAUI.Pages.System; public partial class SyncPage : ContentPage { private ISyncService _syncService; + private IUserService _userService; + private UserDTO _currentUser; + public SyncPage() { InitializeComponent(); _syncService = MauiProgram.ServiceProvider.GetRequiredService(); + _userService = MauiProgram.ServiceProvider.GetRequiredService(); + } + override protected async void OnAppearing() + { + base.OnAppearing(); + SetInfo(); + } + private void SetInfo() + { + _currentUser = _userService.GetCurrentUser(); + DeviceId.Text = _userService.DeviceId; + UserInfo.Text = $"{_currentUser?.FirstName} {_currentUser?.LastName}"; } - private async void OnSyncClicked(object sender, EventArgs e) { SyncBtn.IsEnabled = false; diff --git a/src/WorkFlowCheck.MAUI/Services/CheckListService.cs b/src/WorkFlowCheck.MAUI/Services/CheckListService.cs index 4a72cfe..b5fcc65 100644 --- a/src/WorkFlowCheck.MAUI/Services/CheckListService.cs +++ b/src/WorkFlowCheck.MAUI/Services/CheckListService.cs @@ -96,6 +96,7 @@ namespace WorkFlowCheck.MAUI.Services try { var res = await _dbContext.CheckListHeaders + .Include(i=> i.CheckListTemplateHeader) .Where(w => w.CheckStatus == CheckStatus.Open || w.CheckStatus == CheckStatus.InProgress || w.CheckStatus == CheckStatus.Blocked) @@ -116,7 +117,8 @@ namespace WorkFlowCheck.MAUI.Services var retVal = new List(); try { - var res = await _dbContext.CheckListTemplateHeaders.ToListAsync(); + var res = await _dbContext.CheckListTemplateHeaders + .ToListAsync(); retVal = _mapper.Map>(res); } catch (Exception ex)