using System; using System.Collections.Generic; using System.Linq; using System.Windows.Controls; using Comal.Classes; using InABox.Core; using InABox.DynamicGrid; namespace PRSDesktop; /// /// Interaction logic for LeaveRequestPanel.xaml /// public partial class LeaveRequestPanel : UserControl, IPanel { public LeaveRequestPanel() { InitializeComponent(); } public bool IsReady { get; set; } public event DataModelUpdateEvent OnUpdateDataModel; public void CreateToolbarButtons(IPanelHost host) { } public string SectionName => "Leave Requests"; public DataModel DataModel(Selection selection) { var ids = LeaveRequests.ExtractValues(x => x.ID, selection).ToArray(); return new LeaveRequestDataModel(new Filter(x => x.ID).InList(ids)); } public void Heartbeat(TimeSpan time) { } public void Refresh() { if (LeavePages.SelectedIndex == 0) LeaveCalendar.Refresh(); else if (LeavePages.SelectedIndex == 1) LeaveRequests.Refresh(false, true); } public Dictionary Selected() { return LeaveRequests.Selected(); } public void Setup() { LeaveRequests.Refresh(true, false); } public void Shutdown() { } private void LeavePages_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (e.Source is DynamicTabControl) Refresh(); } }