using System; using System.Collections.Generic; using Xamarin.Forms; using InABox.Core; using Comal.Classes; using InABox.Clients; using System.Linq; using System.Threading.Tasks; using Syncfusion.XForms.PopupLayout; using Xamarin.Essentials; using System.Windows.Input; using InABox.Mobile; using XF.Material.Forms.UI.Dialogs; using LogType = InABox.Core.LogType; using PRSSecurity = InABox.Core.Security; namespace comal.timesheets { public partial class StaffStatusPage { private SfPopupLayout popup; public StaffStatusPage() { popup = new SfPopupLayout(); InitializeComponent(); _staff.Columns .BeginUpdate() .Clear(); if (!PRSSecurity.IsAllowed()) _staff.Columns.Add(new MobileGridImageColumn() { Column = x =>x.In, Width=40 }); _staff.Columns.Add(new MobileGridTextColumn() { Column = x => x.Name, Alignment = TextAlignment.Start, Width = GridLength.Star }); if (PRSSecurity.IsAllowed()) _staff.Columns .Add(new MobileGridTimeColumn() { Column = x => x.Start, Width = 50 }) .Add(new MobileGridTimeColumn() { Column = x => x.Finish, Width = 50 }); _staff.Columns.Add(new MobileGridImageColumn() { Column = x => x.Call, Width = 40, Tapped = CallEmployee }); _staff.Columns.EndUpdate(); App.Data.InOut.Refresh(false, RefreshScreen); } private async void CallEmployee(IMobileGridColumn column, object shell) { if (shell is InOutShell inout) { var copy = await MaterialDialog.Instance.ConfirmAsync(message: inout.Mobile, title: "Contact Details", confirmingText: "Call", dismissiveText: "Cancel"); if (copy == true) PhoneDialer.Open(inout.Mobile); } } private void RefreshScreen() { _staff.ItemsSource = App.Data.InOut.Items; } private void _staff_OnRefreshRequested(object sender, MobileGridRefreshRequestArgs args) { App.Data.InOut.Refresh(true, RefreshScreen); } } }