diff --git a/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListRowCS.cs b/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListRowCS.cs
new file mode 100644
index 0000000..87756c7
--- /dev/null
+++ b/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListRowCS.cs
@@ -0,0 +1,66 @@
+using System.ComponentModel;
+using WorkFlowCheck.Common.DTO;
+
+namespace WorkFlowCheck.MAUI.Pages.CheckList
+{
+ public class CheckListRowCS : INotifyPropertyChanged
+ {
+ private byte[] _photoBytes;
+ private ImageSource? _photo;
+
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ public int Id { get; set; }
+ public string AnswerType { get; set; } = null!;
+ public int RowIndex { get; set; }
+ public string OperationDescription { get; set; } = null!;
+ public string GroupName { get; set; } = null!;
+ public string Answer { get; set; } = null!;
+ public bool? AnswerYes { get; set; } = null!;
+ public bool? AnswerNo { get; set; } = null!;
+ public byte[] PhotoBytes
+ {
+ get => _photoBytes;
+ set
+ {
+ if (_photoBytes != value)
+ {
+ _photoBytes = value;
+ _photo = null;
+ OnPropertyChanged(nameof(PhotoBytes));
+ OnPropertyChanged(nameof(Photo));
+ }
+ }
+ }
+ public ImageSource Photo
+ {
+ get
+ {
+ if (_photo == null)
+ {
+ if (PhotoBytes != null && PhotoBytes.Length > 0)
+ {
+ try
+ {
+ var bytesCopy = PhotoBytes.ToArray();
+ _photo = ImageSource.FromStream(() => new MemoryStream(bytesCopy));
+ }
+ catch
+ {
+ _photo = ImageSource.FromFile("noimage.png");
+ }
+ }
+ else
+ {
+ _photo = ImageSource.FromFile("noimage.png");
+ }
+ }
+
+ return _photo;
+ }
+ }
+
+ protected void OnPropertyChanged(string name) =>
+ PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
+ }
+}
\ No newline at end of file
diff --git a/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListWorkPage.xaml b/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListWorkPage.xaml
index a348a5e..e477a95 100644
--- a/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListWorkPage.xaml
+++ b/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListWorkPage.xaml
@@ -48,7 +48,7 @@
@@ -93,8 +93,8 @@
-
-
+
+
@@ -126,8 +126,8 @@
-
-
+
+
-
-
-
+ Source="{Binding Photo}" >
-
-
+
+
@@ -181,8 +175,8 @@
-
-
+
+
@@ -215,8 +209,8 @@
-
-
+
+
@@ -249,8 +243,8 @@
-
-
+
+
@@ -283,8 +277,8 @@
-
-
+
+
@@ -316,6 +310,5 @@
PI_N_Template="{StaticResource PI_N_Template}"
I_PN_Template="{StaticResource I_PN_Template}"
V_Template="{StaticResource V_Template}"/>
-
\ No newline at end of file
diff --git a/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListWorkPage.xaml.cs b/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListWorkPage.xaml.cs
index 039ed81..ec4b9eb 100644
--- a/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListWorkPage.xaml.cs
+++ b/src/WorkFlowCheck.MAUI/Pages/CheckList/CheckListWorkPage.xaml.cs
@@ -29,17 +29,13 @@ public partial class CheckListWorkPage : ContentPage
OnPropertyChanged(nameof(IsLoading));
}
}
- public ObservableCollection CheckListRows { get; set; } = new ObservableCollection();
- public ICommand RefreshImageCommand => new Command(item =>
- {
- int i = 0;
- // Ha kell, itt újra lehet állítani valamit vagy logolni
- //Debug.WriteLine($"Kép frissítés: {item.Id}");
- });
+ public ObservableCollection CheckListRowCSs { get; set; } = new ObservableCollection();
+ public List CheckListRowDTOs { get; set; }
+
public ICommand TakePhoto { get; set; }
public ICommand SendCommand { get; set; }
public ICommand SaveCommand { get; set; }
-
+
public CheckListWorkPage(int checkListHeaderId, string checkPointCode)
{
InitializeComponent();
@@ -122,17 +118,22 @@ public partial class CheckListWorkPage : ContentPage
{
await Task.Run(async () =>
{
- foreach (var checkListRow in CheckListRows)
+ foreach (var checkListRowCS in CheckListRowCSs)
{
- if (checkListRow.AnswerYes == true)
+ var checkListRowDTO = CheckListRowDTOs.Where(w => w.Id == checkListRowCS.Id).FirstOrDefault();
+
+ if (checkListRowDTO != null)
{
- checkListRow.Answer = "Igen";
+ if (checkListRowDTO.AnswerYes == true)
+ {
+ checkListRowDTO.Answer = "Igen";
+ }
+ if (checkListRowDTO.AnswerNo == true)
+ {
+ checkListRowDTO.Answer = "Nem";
+ }
+ await _checkListService.UpdateCheckListRow(checkListRowDTO, withReload);
}
- if (checkListRow.AnswerNo == true)
- {
- checkListRow.Answer = "Nem";
- }
- await _checkListService.UpdateCheckListRow(checkListRow, withReload);
}
if (withReload) await LoadCheckPointCheckListRows();
});
@@ -152,7 +153,7 @@ public partial class CheckListWorkPage : ContentPage
base.OnAppearing();
BindingContext = this;
await SetInfo();
- TakePhoto = new Command(OnTakePhoto);
+ TakePhoto = new Command(OnTakePhoto);
await LoadCheckPointCheckListRows();
}
@@ -175,7 +176,7 @@ public partial class CheckListWorkPage : ContentPage
return data.ToArray();
}
- private async void OnTakePhoto(CheckListRowDTO checkListRowDTO)
+ private async void OnTakePhoto(CheckListRowCS checkListRowCS)
{
try
{
@@ -185,11 +186,18 @@ public partial class CheckListWorkPage : ContentPage
var photo = await MediaPicker.CapturePhotoAsync();
if (photo != null)
{
- checkListRowDTO.Photo = await ResizePicture(photo, 500);
- checkListRowDTO.Answer = "Igen";
+ checkListRowCS.PhotoBytes = await ResizePicture(photo, 500);
+ checkListRowCS.Answer = "Igen";
- await _checkListService.UpdateCheckListRow(checkListRowDTO, true);
- await LoadCheckPointCheckListRows();
+ var checkListRowDTO = CheckListRowDTOs.FirstOrDefault(w => w.Id == checkListRowCS.Id);
+ if (checkListRowDTO != null)
+ {
+ checkListRowDTO.Photo = checkListRowCS.PhotoBytes;
+ checkListRowDTO.Answer = "Igen";
+
+ await _checkListService.UpdateCheckListRow(checkListRowDTO, true);
+ await LoadCheckPointCheckListRows();
+ }
}
}
else
@@ -206,9 +214,11 @@ public partial class CheckListWorkPage : ContentPage
{
IsLoading = true;
- CheckListRows.Clear();
- var checkListRowDTOs = await _checkListService.GetCheckListRowsByCheckPointCode(_currentUser.Id, _checkListHeaderId, _checkPointCode);
- foreach (var item in checkListRowDTOs)
+ CheckListRowCSs.Clear();
+
+ CheckListRowDTOs = await _checkListService.GetCheckListRowsByCheckPointCode(_currentUser.Id, _checkListHeaderId, _checkPointCode);
+
+ foreach (var item in CheckListRowDTOs)
{
if (item.Answer == "Igen")
{
@@ -220,7 +230,20 @@ public partial class CheckListWorkPage : ContentPage
item.AnswerYes = false;
item.AnswerNo = true;
}
- CheckListRows.Add(item);
+ var checkListRowCS = new CheckListRowCS()
+ {
+ Answer = item.Answer,
+ AnswerNo = item.AnswerNo,
+ AnswerYes = item.AnswerYes,
+ GroupName = $"AnswerGroup_{item.CheckListTemplateRowDTO?.Id ?? 0}",
+ Id = item.Id,
+ RowIndex = item.CheckListTemplateRowDTO?.RowIndex ?? 0,
+ OperationDescription = item.CheckListTemplateRowDTO?.OperationDescription ?? "N/A",
+ AnswerType = item.CheckListTemplateRowDTO?.AnswerType ?? "I-N",
+ PhotoBytes = item.Photo ?? Array.Empty(),
+ };
+
+ CheckListRowCSs.Add(checkListRowCS);
}
IsLoading = false;
@@ -273,19 +296,4 @@ public class BindableRadioButton : RadioButton
}
}
}
-public class ByteArrayToImageSourceConverter : IValueConverter
-{
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- if (value is byte[] bytes && bytes.Length > 0)
- {
- return ImageSource.FromStream(() => new MemoryStream(bytes));
- }
- return ImageSource.FromFile("noimage.png"); ;
- }
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- throw new NotImplementedException();
- }
-}
diff --git a/src/WorkFlowCheck.MAUI/Services/SyncService.cs b/src/WorkFlowCheck.MAUI/Services/SyncService.cs
index 0bbea58..bce4e1b 100644
--- a/src/WorkFlowCheck.MAUI/Services/SyncService.cs
+++ b/src/WorkFlowCheck.MAUI/Services/SyncService.cs
@@ -218,7 +218,7 @@ namespace WorkFlowCheck.MAUI.Services
{
if (responseList.IsSuccess)
{
- var entityList = await _dbContext.Locations.ToListAsync();
+ var entityList = await _dbContext.Equipments.ToListAsync();
var missingItems = responseList.Data.Where(f => !entityList.Any(s => s.Id == f.Id)).ToList();
var mappedMissingItems = _mapper.Map>(missingItems);
diff --git a/src/WorkFlowCheck.MAUI/TemplateSelectors/AnswerTypeTemplateSelector.cs b/src/WorkFlowCheck.MAUI/TemplateSelectors/AnswerTypeTemplateSelector.cs
index 601555d..2cef3b9 100644
--- a/src/WorkFlowCheck.MAUI/TemplateSelectors/AnswerTypeTemplateSelector.cs
+++ b/src/WorkFlowCheck.MAUI/TemplateSelectors/AnswerTypeTemplateSelector.cs
@@ -50,6 +50,21 @@ namespace WorkFlowCheck.MAUI.TemplateSelectors
_ => I_N_Template
};
}
+ if (item is CheckListRowCS model3)
+ {
+ return model3.AnswerType switch
+ {
+ "I-N" => I_N_Template,
+ "P" => P_Template,
+ "PN" => P_Template,
+ "V" => V_Template,
+ "SI-N" => SI_N_Template,
+ "I-SN" => I_SN_Template,
+ "PI-N" => PI_N_Template,
+ "I-PN" => I_PN_Template,
+ _ => I_N_Template
+ };
+ }
return null;
}