Переглянути джерело

Merge commit '14fa1cbd52112e28b02e8d62b94b6e1f0a55a45b' into frank

Frank van den Bos 1 рік тому
батько
коміт
697c593014

+ 3 - 3
prs.desktop/MainWindow.xaml

@@ -676,9 +676,6 @@
                     <fluent:Button x:Name="AccountsTaskButton" Header="Task List"
                                    LargeIcon="pack://application:,,,/Resources/kanban.png"
                                    Click="Tasks_Checked" MinWidth="60" />
-                    <fluent:Button x:Name="AccountsDataButton" Header="Data Entry"
-                                   LargeIcon="pack://application:,,,/Resources/pencil.png"
-                                   Click="DataEntry_Click" MinWidth="60" />
                     <fluent:Button x:Name="AccountsAttendanceButton" Header="In/Out Board"
                                    LargeIcon="pack://application:,,,/Resources/attendance.png"
                                    Click="Attendance_Checked" MinWidth="60" />
@@ -702,6 +699,9 @@
                     <fluent:Button x:Name="SupplierList" Header="Suppliers"
                                    LargeIcon="pack://application:,,,/Resources/supplier.png"
                                    Click="SupplierList_Click" MinWidth="60" />
+                    <fluent:Button x:Name="AccountsDataButton" Header="Data Entry"
+                                   LargeIcon="pack://application:,,,/Resources/pencil.png"
+                                   Click="DataEntry_Click" MinWidth="60" />
                     <fluent:Button x:Name="PurchasesList" Header="Purchase Orders"
                                    LargeIcon="pack://application:,,,/Resources/purchase.png"
                                    Click="PurchasesList_Click" MinWidth="60" />

+ 4 - 3
prs.desktop/MainWindow.xaml.cs

@@ -950,7 +950,6 @@ namespace PRSDesktop
 
             SetVisibility(AccountsMessagesButton, Security.CanView<Notification>());
             SetVisibility(AccountsTaskButton, ClientFactory.IsSupported<Kanban>() && Security.IsAllowed<CanViewTasks>());
-            SetVisibility(AccountsDataButton, Security.IsAllowed<CanViewDataEntryPanel>());
             SetVisibility(AccountsAttendanceButton, ClientFactory.IsSupported<TimeSheet>() && Security.IsAllowed<CanViewInOutBoard>());
             SetVisibility(AccountsMapButton, bMaps);
             SetVisibility(AccountsDailyReportButton,
@@ -972,6 +971,8 @@ namespace PRSDesktop
                 && Security.CanView<Supplier>()
                 && Security.IsAllowed<ViewDesktopSuppliersScreen>());
 
+            SetVisibility(AccountsDataButton, Security.IsAllowed<CanViewDataEntryPanel>());
+
             SetVisibility(PurchasesList, ClientFactory.IsSupported<PurchaseOrder>() 
                 && Security.CanView<PurchaseOrder>()
                 && Security.IsAllowed<ViewDesktopPurchaseOrdersScreen>());
@@ -991,7 +992,7 @@ namespace PRSDesktop
                                 AccountsDailyReportButton
                 }, new FrameworkElement[] { CustomerList, InvoiceList, ReceiptList });
             SetVisibleIfEither(AccountsTaskSeparator2, new FrameworkElement[] { CustomerList, InvoiceList, ReceiptList },
-                new FrameworkElement[] { SupplierList, PurchasesList, BillsList, PaymentsList });
+                new FrameworkElement[] { SupplierList, AccountsDataButton, PurchasesList, BillsList, PaymentsList });
             SetVisibleIfAny(AccountsActions, AccountsDashboardButton, AccountsMessagesButton, AccountsTaskButton,
                 AccountsAttendanceButton,
                 AccountsDailyReportButton, CustomerList, InvoiceList, ReceiptList, SupplierList, PurchasesList, BillsList, PaymentsList);
@@ -1022,7 +1023,7 @@ namespace PRSDesktop
 
             AddSetupModulesAndReports(AccountsTab);
 
-            SetTabVisibleIfAny(AccountsTab, CustomerList, InvoiceList, ReceiptList, SupplierList, PurchasesList, BillsList, PaymentsList);
+            SetTabVisibleIfAny(AccountsTab, CustomerList, InvoiceList, ReceiptList, SupplierList, AccountsDataButton, PurchasesList, BillsList, PaymentsList);
         }
 
         private void SetupHumanResourcesTab(bool bMaps)

+ 1 - 1
prs.desktop/Panels/DataEntry/DataEntryGrid.cs

@@ -360,7 +360,7 @@ public class DataEntryGrid : DynamicDataGrid<DataEntryDocument>
 
         DataEntryCache.Cache.Add(new DataEntryCachedDocument(document));
 
-        Dispatcher.Invoke(() =>
+        Dispatcher.BeginInvoke(() =>
         {
             Refresh(false, true);
         });

+ 4 - 1
prs.desktop/Panels/DataEntry/DataEntryList.xaml

@@ -54,7 +54,10 @@
                                        PreviewStyle="{StaticResource HorizontalSplitterPreview}"/>
 
                     <Border Grid.Row="2"
-                            BorderBrush="Gray" Background="DimGray">
+                            BorderBrush="Gray" Background="DimGray"
+                            AllowDrop="True"
+                            DragOver="DynamicTabItem_DragOver"
+                            Drop="DynamicTabItem_Drop">
                         <ScrollViewer VerticalScrollBarVisibility="Auto">
                             <StackPanel x:Name="ViewListPanel" Orientation="Vertical" Margin="10">
                                 <StackPanel.ContextMenu>

+ 26 - 23
prs.desktop/Panels/DataEntry/DataEntryList.xaml.cs

@@ -292,38 +292,41 @@ public partial class DataEntryList : UserControl, ICorePanel, IDockPanel
     {
         Task.Run(() =>
         {
-            try
+            Dispatcher.Invoke(() =>
             {
-                var result = DocumentUtils.HandleFileDrop(e);
-                if (result is not null)
+                Progress.Show("Uploading documents");
+                try
                 {
-                    foreach (var (filename, stream) in result)
+                    var result = DocumentUtils.HandleFileDrop(e);
+                    if (result is not null)
                     {
-                        var newFilename = filename;
-                        byte[] data;
-                        if (stream is null)
-                        {
-                            data = File.ReadAllBytes(newFilename);
-                        }
-                        else
+                        foreach (var (filename, stream) in result)
                         {
-                            using var memStream = new MemoryStream();
-                            stream.CopyTo(memStream);
-                            data = memStream.ToArray();
+                            var newFilename = filename;
+                            byte[] data;
+                            if (stream is null)
+                            {
+                                data = File.ReadAllBytes(newFilename);
+                            }
+                            else
+                            {
+                                using var memStream = new MemoryStream();
+                                stream.CopyTo(memStream);
+                                data = memStream.ToArray();
+                            }
+                            data = RenderData(ref newFilename, data);
+
+                            _dataEntryGrid.UploadDocument(newFilename, data, Guid.Empty);
                         }
-                        data = RenderData(ref newFilename, data);
-
-                        _dataEntryGrid.UploadDocument(newFilename, data, Guid.Empty);
                     }
+                    Progress.Close();
                 }
-            }
-            catch(Exception e)
-            {
-                Dispatcher.BeginInvoke(() =>
+                catch (Exception e)
                 {
+                    Progress.Close();
                     MessageWindow.ShowError("Could not upload documents.", e);
-                });
-            }
+                }
+            });
         });
     }
 

+ 0 - 1
prs.desktop/Panels/Suppliers/Bills/SupplierBills.cs

@@ -39,7 +39,6 @@ namespace PRSDesktop
 
             options
                 .BeginUpdate()
-                .Clear()
                 .Add(DynamicGridOption.FilterRows)
                 .Add(DynamicGridOption.SelectColumns)
                 .Add(DynamicGridOption.MultiSelect)

+ 2 - 2
prs.desktop/Panels/Timesheets/TimeSheetLeaveRequestGrid.cs

@@ -86,7 +86,7 @@ namespace PRSDesktop
             criteria.Add(new InABox.Core.Filter<LeaveRequest>(x => x.From).IsLessThanOrEqualTo(To)
                 .And(x => x.To).IsGreaterThanOrEqualTo(From)
                 .And(x=>x.Status).IsEqualTo(LeaveRequestStatus.Approved)
-                .And(x =>x.DataEntered).IsEqualTo(DateTime.MinValue));
+                .And(x =>x.Processed).IsEqualTo(DateTime.MinValue));
             base.Reload(criteria, columns, ref sort, action);
         }
 
@@ -146,7 +146,7 @@ namespace PRSDesktop
                     }
 
                     i++;
-                    leave.DataEntered = DateTime.Now;
+                    leave.Processed = DateTime.Now;
                     leaves.Add(leave);
                 }
             }