StaffStatusPage.xaml.cs 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. using System;
  2. using System.Collections.Generic;
  3. using Xamarin.Forms;
  4. using InABox.Core;
  5. using Comal.Classes;
  6. using InABox.Clients;
  7. using System.Linq;
  8. using System.Threading.Tasks;
  9. using Syncfusion.XForms.PopupLayout;
  10. using Xamarin.Essentials;
  11. using System.Windows.Input;
  12. using InABox.Mobile;
  13. using XF.Material.Forms.UI.Dialogs;
  14. using LogType = InABox.Core.LogType;
  15. using PRSSecurity = InABox.Core.Security;
  16. namespace comal.timesheets
  17. {
  18. public partial class StaffStatusPage
  19. {
  20. private SfPopupLayout popup;
  21. public StaffStatusPage()
  22. {
  23. popup = new SfPopupLayout();
  24. InitializeComponent();
  25. _staff.Columns
  26. .BeginUpdate()
  27. .Clear();
  28. if (!PRSSecurity.IsAllowed<CanViewMobileInOutBoardDetails>())
  29. _staff.Columns.Add(new MobileGridImageColumn<InOutShell>() { Column = x =>x.In, Width=40 });
  30. _staff.Columns.Add(new MobileGridTextColumn<InOutShell>() { Column = x => x.Name, Alignment = TextAlignment.Start, Width = GridLength.Star });
  31. if (PRSSecurity.IsAllowed<CanViewMobileInOutBoardDetails>())
  32. _staff.Columns
  33. .Add(new MobileGridTimeColumn<InOutShell>() { Column = x => x.Start, Width = 50 })
  34. .Add(new MobileGridTimeColumn<InOutShell>() { Column = x => x.Finish, Width = 50 });
  35. _staff.Columns.Add(new MobileGridImageColumn<InOutShell>() { Column = x => x.Call, Width = 40, Tapped = CallEmployee });
  36. _staff.Columns.EndUpdate();
  37. App.Data.InOut.Refresh(false, RefreshScreen);
  38. }
  39. private async void CallEmployee(IMobileGridColumn column, object shell)
  40. {
  41. if (shell is InOutShell inout)
  42. {
  43. var copy = await MaterialDialog.Instance.ConfirmAsync(message: inout.Mobile,
  44. title: "Contact Details",
  45. confirmingText: "Call",
  46. dismissiveText: "Cancel");
  47. if (copy == true)
  48. PhoneDialer.Open(inout.Mobile);
  49. }
  50. }
  51. private void RefreshScreen()
  52. {
  53. _staff.ItemsSource = App.Data.InOut.Items;
  54. }
  55. private void _staff_OnRefreshRequested(object sender, MobileGridRefreshRequestArgs args)
  56. {
  57. App.Data.InOut.Refresh(true, RefreshScreen);
  58. }
  59. }
  60. }