using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media.Imaging;
using Comal.Classes;
using InABox.Clients;
using InABox.Core;
using InABox.DynamicGrid;
using InABox.WPF;
using Syncfusion.Windows.Controls.RichTextBoxAdv;
using SelectionChangedEventArgs = System.Windows.Controls.SelectionChangedEventArgs;
namespace PRSDesktop;
///
/// Interaction logic for NotificationPanel.xaml
///
public partial class NotificationPanel : UserControl, IPanel
{
private readonly Button Archive;
private readonly Button AttachToJob;
private readonly Button CreateDelivery;
private readonly Button CreateRequi;
private readonly Button CreateSetout;
private readonly Button CreateTask;
private readonly List> folders = new()
{
new("Inbox", PRSDesktop.Resources.download.AsBitmapImage()),
new("Sent", PRSDesktop.Resources.upload.AsBitmapImage()),
new("Archive", PRSDesktop.Resources.box.AsBitmapImage())
};
private readonly Button Forward;
private readonly Employee me = new Client().Load(new Filter(x => x.UserLink.ID).IsEqualTo(ClientFactory.UserGuid))
.FirstOrDefault();
private readonly DynamicDataGrid Notifications;
private readonly Button Reopen;
//Button WriteNew = null;
private readonly Button Reply;
private readonly Button ViewEntity;
private readonly Button ViewForm;
private readonly Button ViewJob;
public NotificationPanel()
{
InitializeComponent();
Notifications = new DynamicDataGrid();
Notifications.HiddenColumns.Add(x => x.Sender.ID);
Notifications.HiddenColumns.Add(x => x.Employee.ID);
Notifications.HiddenColumns.Add(x => x.Job.ID);
Notifications.HiddenColumns.Add(x => x.EntityType);
Notifications.HiddenColumns.Add(x => x.EntityID);
//Notifications.HiddenColumns.Add(x => x.Kanban.ID);
//Notifications.HiddenColumns.Add(x => x.Setout.ID);
//Notifications.HiddenColumns.Add(x => x.Requisition.ID);
//Notifications.HiddenColumns.Add(x => x.Delivery.ID);
//Notifications.HiddenColumns.Add(x => x.LeaveRequestLink.ID);
Notifications.HiddenColumns.Add(x => x.Closed);
Notifications.Options.AddRange(DynamicGridOption.RecordCount, DynamicGridOption.FilterRows, DynamicGridOption.SelectColumns,
DynamicGridOption.MultiSelect);
Notifications.SetValue(Grid.RowProperty, 0);
Notifications.SetValue(Grid.ColumnProperty, 1);
Notifications.Margin = new Thickness(0);
Notifications.OnReload += Notifications_OnReload;
Notifications.OnSelectItem += Notifications_OnSelectItem;
//WriteNew = CreateButton("Write New", null, WriteNewClick);
//WriteNew.Visibility = Visibility.Visible;
//WriteNew.Margin = new Thickness(WriteNew.Margin.Left, WriteNew.Margin.Top, 10.0F, WriteNew.Margin.Bottom);
Reply = CreateButton("Reply", null, ReplyClick);
Forward = CreateButton("Forward", null, ForwardClick);
ViewForm = CreateButton("View Form", null, ViewFormClick);
ViewEntity = CreateButton("View Item", null, ViewEntityClick);
AttachToJob = CreateButton("Attach To Job", null, AttachToJobClick);
ViewJob = CreateButton("View Job", null, ViewJobClick);
CreateTask = CreateButton("Create Task", null, CreateTaskClick);
CreateSetout = CreateButton("Create Setout", null, CreateSetoutClick);
CreateRequi = CreateButton("Create Requi", null, CreateRequiClick);
CreateDelivery = CreateButton("Create Delivery", null, CreateDeliveryClick);
Archive = CreateButton("Archive", null, ArchiveClick);
Archive.Margin = new Thickness(10.0F, Archive.Margin.Top, Archive.Margin.Right, Archive.Margin.Bottom);
Reopen = CreateButton("Reopen", null, ReopenClick);
Reopen.Margin = new Thickness(10.0F, Reopen.Margin.Top, Reopen.Margin.Right, Reopen.Margin.Bottom);
Layout.Children.Add(Notifications);
Folders.ItemsSource = folders;
}
public bool IsReady { get; set; }
public event DataModelUpdateEvent OnUpdateDataModel;
private Button CreateButton(string caption, BitmapImage umage, Func