123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- using System;
- using System.Collections.Generic;
- using Xamarin.Forms;
- using InABox.Core;
- using Comal.Classes;
- using System.Linq;
- using System.Threading.Tasks;
- using Syncfusion.XForms.PopupLayout;
- using Xamarin.Essentials;
- using System.Windows.Input;
- using InABox.Mobile;
- using InABox.Mobile.Shared;
- using XF.Material.Forms.UI.Dialogs;
- using LogType = InABox.Core.LogType;
- using PRSSecurity = InABox.Core.Security;
- namespace PRS.Mobile
- {
-
- public partial class StaffStatusPage
- {
-
- public StaffStatusPage()
- {
-
- InitializeComponent();
-
- ProgressVisible = true;
-
- _staff.Columns
- .BeginUpdate()
- .Clear();
-
- if (!PRSSecurity.IsAllowed<CanViewMobileInOutBoardDetails>())
- _staff.Columns.Add(new MobileGridImageColumn<InOutShell>() { Column = x =>x.In, Width = 30, Margin = 6, Header = ImageSource.FromFile("circle_gray")});
-
- _staff.Columns.Add(new MobileGridTextColumn<InOutShell>() { Column = x => x.Name, Alignment = TextAlignment.Start, Width = GridLength.Star });
-
- if (PRSSecurity.IsAllowed<CanViewMobileInOutBoardDetails>())
- _staff.Columns
- .Add(new MobileGridTimeColumn<InOutShell>() { Column = x => x.Start, Width = 50 })
- .Add(new MobileGridTimeColumn<InOutShell>() { Column = x => x.Finish, Width = 50 });
- _staff.Columns.Add(new MobileGridImageColumn<InOutShell>() { Column = x => x.Call, Width = 30, Margin = 6, Tapped = CallEmployee, Header= ImageSource.FromFile("phone") });
-
- _staff.Columns.EndUpdate();
- RefreshData(false,true);
- }
- private async void CallEmployee(IMobileGridColumn column, object shell)
- {
- if (shell is InOutShell inout)
- {
- if (!String.IsNullOrWhiteSpace(inout.Mobile))
- {
- var confirm = await MaterialDialog.Instance.ConfirmAsync(message: inout.Mobile,
- title: "Contact Details",
- confirmingText: "Call",
- dismissiveText: "Cancel");
- if (confirm == true)
- PhoneDialer.Open(inout.Mobile);
- }
- }
- }
- private void RefreshData(bool force, bool async)
- {
- if (async)
- App.Data.InOut.Refresh(force, RefreshList);
- else
- {
- App.Data.InOut.Refresh(force);
- RefreshList();
- }
- }
-
- private void RefreshList()
- {
- _staff.ItemsSource ??= App.Data.InOut.Items;
- _staff.LastUpdated = App.Data.InOut.LastUpdated;
- ProgressVisible = false;
- }
-
- private void _staff_OnRefreshRequested(object sender, MobileGridRefreshRequestArgs args)
- {
- RefreshData(true, false);
- }
-
- }
- }
|