|
|
@@ -4,12 +4,15 @@ using Avalonia.Controls.Primitives;
|
|
|
using Avalonia.Controls.Templates;
|
|
|
using Avalonia.Layout;
|
|
|
using Avalonia.Media;
|
|
|
+using Comal.Classes;
|
|
|
using Comal.Classes.SecurityDescriptors;
|
|
|
using CommunityToolkit.Mvvm.Input;
|
|
|
using InABox.Avalonia;
|
|
|
+using InABox.Avalonia.Components;
|
|
|
using InABox.Avalonia.Converters;
|
|
|
using InABox.Avalonia.Dialogs;
|
|
|
using InABox.Core;
|
|
|
+using PRS.Avalonia.Components;
|
|
|
using ReactiveUI;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
@@ -81,6 +84,7 @@ internal partial class DFMultiSignatureFieldControl : DigitalFormFieldControl<DF
|
|
|
CommandParameter = value.Key,
|
|
|
Command = DeleteSignatureCommand
|
|
|
};
|
|
|
+ button.IsVisible = _isEnabled;
|
|
|
button.Classes.Add("Standard");
|
|
|
|
|
|
grid.AddChild(image, 0, 0, colSpan: 2);
|
|
|
@@ -198,9 +202,70 @@ internal partial class DFMultiSignatureFieldControl : DigitalFormFieldControl<DF
|
|
|
}
|
|
|
|
|
|
[RelayCommand]
|
|
|
- private void Select()
|
|
|
+ private async Task Select()
|
|
|
{
|
|
|
+ var model = new EmployeeDetailModel(ViewModelBase.Repositories.Data, LookupFactory.DefineFilter<Employee>);
|
|
|
+ SelectionViewModel.Execute<EmployeeDetailShell>(model =>
|
|
|
+ {
|
|
|
+ model.Columns.BeginUpdate()
|
|
|
+ .Add(new AvaloniaDataGridTextColumn<EmployeeDetailShell>
|
|
|
+ {
|
|
|
+ Column = x => x.Code,
|
|
|
+ Width = GridLength.Auto
|
|
|
+ })
|
|
|
+ .Add(new AvaloniaDataGridTextColumn<EmployeeDetailShell>
|
|
|
+ {
|
|
|
+ Column = x => x.Name,
|
|
|
+ Width = GridLength.Star
|
|
|
+ })
|
|
|
+ .EndUpdate();
|
|
|
+ model.SelectionPageMode = SelectionPageMode.MultiSelect;
|
|
|
+ }, args =>
|
|
|
+ {
|
|
|
+ model.SelectFilter(args.Filter);
|
|
|
+ return model.Refresh(args.Force);
|
|
|
+ }, employees =>
|
|
|
+ {
|
|
|
+ AddEmployees(employees).ContinueWith(task =>
|
|
|
+ {
|
|
|
+ if(task.Exception is not null)
|
|
|
+ {
|
|
|
+ _ = MessageDialog.ShowError(task.Exception);
|
|
|
+ MobileLogging.Log(task.Exception);
|
|
|
+ }
|
|
|
+ }, TaskScheduler.FromCurrentSynchronizationContext());
|
|
|
+ });
|
|
|
+ }
|
|
|
+ private async Task AddEmployees(EmployeeDetailShell[] employees)
|
|
|
+ {
|
|
|
+ var withoutSignature = new List<string>();
|
|
|
+ var changed = false;
|
|
|
+ foreach(var employee in employees)
|
|
|
+ {
|
|
|
+ if (!_value.ContainsKey(employee.Name))
|
|
|
+ {
|
|
|
+ if(employee.Signature is not null && employee.Signature.Length > 0)
|
|
|
+ {
|
|
|
+ _value.Add(employee.Name.ToUpper(), employee.Signature);
|
|
|
+ changed = true;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ withoutSignature.Add(employee.Name);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
+ if(withoutSignature.Count > 0)
|
|
|
+ {
|
|
|
+ await MessageDialog.ShowMessage($"The following people do not have a signature saved in the system, and will have to be added manually:\n{string.Join(',', withoutSignature)}");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (changed)
|
|
|
+ {
|
|
|
+ Update();
|
|
|
+ ChangeField();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
[RelayCommand]
|