Selaa lähdekoodia

PRS MOBILE - roll out of Deliveries Grid, fix to Android deep link

Nick-PRSDigital@bitbucket.org 2 vuotta sitten
vanhempi
commit
89f7d3b95b

+ 11 - 3
prs.mobile/comal.timesheets.Android/MainActivity.cs

@@ -16,20 +16,28 @@ using Environment = System.Environment;
 using Android.Support.V4.App;
 using Xamarin.Essentials;
 using System.Linq;
+using Android.Annotation;
 
 namespace comal.timesheets.Droid
 {
-    [Activity(Name = "PRS.Mobile.Droid.MainActivity", Label = "TimeBench", Icon = "@mipmap/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize, ScreenOrientation = Android.Content.PM.ScreenOrientation.Portrait)]
+    [Activity(
+        Name = "PRS.Mobile.Droid.MainActivity",
+        Label = "TimeBench", Icon = "@mipmap/icon",
+        Theme = "@style/MainTheme", MainLauncher = true,
+        ConfigurationChanges = ConfigChanges.ScreenSize,
+        ScreenOrientation = Android.Content.PM.ScreenOrientation.Portrait
+        )]
     [IntentFilter(new[] { Android.Content.Intent.ActionView },
                        AutoVerify = true,
                        Categories = new[]
                        {
                             Android.Content.Intent.CategoryDefault,
-                            Android.Content.Intent.CategoryBrowsable
+                            Android.Content.Intent.CategoryBrowsable,
                        },
                        DataScheme = "http",
                        DataPathPrefix = "/open",
-                       DataHost = "www.PRSMobile.com")]
+                       DataHost = "www.prsmobile.com")
+        ]
 
     public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
     {

+ 1 - 1
prs.mobile/comal.timesheets.Android/Properties/AndroidManifest.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="710300" package="au.com.frogsoftware.timesheets.comal_timesheets" android:installLocation="auto" android:versionName="7.10.3">
-	<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="33" />
+	<uses-sdk android:minSdkVersion="12" android:targetSdkVersion="33" />
 	<uses-permission android:name="android.permission.INTERNET" />
 	<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
 	<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />

+ 0 - 1
prs.mobile/comal.timesheets.Android/Resources/Resource.designer.cs

@@ -2,7 +2,6 @@
 //------------------------------------------------------------------------------
 // <auto-generated>
 //     This code was generated by a tool.
-//     Runtime Version:4.0.30319.42000
 //
 //     Changes to this file may cause incorrect behavior and will be lost if
 //     the code is regenerated.

+ 2 - 0
prs.mobile/comal.timesheets/Data Classes/GlobalVariables.cs

@@ -59,6 +59,8 @@ namespace comal.timesheets
         public static bool IsJobOnlyEmployee { get => InABox.Core.Security.IsAllowed<IsJobOnlyEmployee>(); }
 
         public static List<JobShell> EmployeeJobs { get; set; }
+
+        public static bool IsDeliveryDriver { get; set; }
         public static string GetEmployeeName()
         {
             try

+ 21 - 12
prs.mobile/comal.timesheets/DigitalForms/Renderer/QAFormViewer.cs

@@ -1227,7 +1227,7 @@ namespace comal.timesheets.QAForms
             string value = "";
             bool disableLibrary = false;
             DFLayoutVideoField vidField = element as DFLayoutVideoField;
-            
+
             EmbeddedImageCapture embeddedImageCapture = new EmbeddedImageCapture(false, true);
 
             embeddedImageCapture.VideoQuality =
@@ -1237,8 +1237,8 @@ namespace comal.timesheets.QAForms
                 vidField.Properties.Quality == DFLayoutVideoFieldProperties.VideoQuality.Default ? Plugin.Media.Abstractions.VideoQuality.Medium :
                 Plugin.Media.Abstractions.VideoQuality.Medium;
 
-            embeddedImageCapture.VideoLength =                
-                vidField.Properties.MaximumVideoLength == 0? new TimeSpan(0, 0, 20) :
+            embeddedImageCapture.VideoLength =
+                vidField.Properties.MaximumVideoLength == 0 ? new TimeSpan(0, 0, 20) :
                 new TimeSpan(0, 0, vidField.Properties.MaximumVideoLength);
 
             if (loadData.TryGetValue(vidField.Name, out value))
@@ -1381,12 +1381,19 @@ namespace comal.timesheets.QAForms
                     view = frame;
                 }
 
-                if (element.Row > 0) SetRow(view, element.Row - 1); //rows and columns coming in from the desktop designer start from 1, not 0 (most of the time??)
-                else if (element.Row == 0) SetRow(view, dfLayout.RowHeights.Count + 1);
-                if (element.RowSpan > 0) SetRowSpan(view, element.RowSpan);
-                else if (element.RowSpan == 0) SetRowSpan(view, 1);
-                if (element.Column > 0) SetColumn(view, element.Column - 1); //rows and columns coming in from the desktop designer start from 1, not 0 (most of the time??)
-                if (element.ColumnSpan > 0) SetColumnSpan(view, element.ColumnSpan);
+                if (element.Row > 0)
+                    SetRow(view, element.Row - 1); //rows and columns coming in from the desktop designer start from 1, not 0 (most of the time??)
+                else if (element.Row == 0)
+                    SetRow(view, dfLayout.RowHeights.Count + 1);
+                if (element.RowSpan > 0)
+                    SetRowSpan(view, element.RowSpan);
+                else if (element.RowSpan == 0)
+                    SetRowSpan(view, 1);
+                if (element.Column > 0)
+                    SetColumn(view, element.Column - 1); //rows and columns coming in from the desktop designer start from 1, not 0 (most of the time??)
+                if (element.ColumnSpan > 0)
+                    SetColumnSpan(view, element.ColumnSpan);
+
                 if (element.ColumnSpan > 1)
                 {
                     view.HorizontalOptions = LayoutOptions.FillAndExpand;
@@ -1401,12 +1408,14 @@ namespace comal.timesheets.QAForms
                 else if (element.ColumnSpan == 0) SetColumnSpan(view, 1);
 
                 view.SetValue(Grid.MarginProperty, 0.01);
+
                 if (element is DFLayoutSignaturePad)
-                {
                     view.Margin = new Thickness(25, 0, 25, 0);
-                }
 
-                Device.BeginInvokeOnMainThread(() => { Children.Add(view); });
+                Device.BeginInvokeOnMainThread(() =>
+                {
+                    Children.Add(view);
+                });
 
                 if (element is DFLayoutHeader)
                     if ((element as DFLayoutHeader).Collapsed)

+ 1 - 1
prs.mobile/comal.timesheets/Grids/DeliveryGrid.cs

@@ -121,7 +121,7 @@ namespace comal.timesheets
                 foreach (var job in GlobalVariables.EmployeeJobs)
                     jobids.Add(job.ID);
 
-                filter = filter.And(x => x.Job.ID).InList(jobids);
+                filter = new Filter<Delivery>(x => x.Job.ID).InList(jobids);
             }
             return filter;
         }

+ 18 - 12
prs.mobile/comal.timesheets/Main/MainPage.xaml.cs

@@ -1456,18 +1456,24 @@ namespace comal.timesheets
                     };
                     Deliveries.OnTapped += ((object sender, EventArgs e) =>
                     {
-                        var delivery_form = new DeliveryList();
-                        Navigation.PushAsync(delivery_form);
-
-                        //DataGridHost host = new DataGridHost(new DeliveryGrid());
-                        //host.SetActionButton("Add");
-                        //host.OnActionButtonClicked += ((list) =>
-                        //{
-                        //    DeliveryDetails details = new DeliveryDetails(Guid.Empty);
-                        //    details.OnDeliverySaved += () => { (host.DataGrid as DeliveryGrid).RefreshGrid(); };
-                        //    Navigation.PushAsync(details);
-                        //});
-                        //Navigation.PushAsync(host);
+                        if (GlobalVariables.IsDeliveryDriver)
+                        {
+                            var delivery_form = new DeliveryList();
+                            Navigation.PushAsync(delivery_form);
+                        }
+
+                        else
+                        {
+                            DataGridHost host = new DataGridHost(new DeliveryGrid());
+                            host.SetActionButton("Add");
+                            host.OnActionButtonClicked += ((list) =>
+                            {
+                                DeliveryDetails details = new DeliveryDetails(Guid.Empty);
+                                details.OnDeliverySaved += () => { (host.DataGrid as DeliveryGrid).RefreshGrid(); };
+                                Navigation.PushAsync(details);
+                            });
+                            Navigation.PushAsync(host);
+                        }
                     });
                     if (PRSSecurity.CanView<Delivery>())
                         toolEntries.Add(Deliveries);

+ 8 - 0
prs.mobile/comal.timesheets/Main/MainPageUtils.cs

@@ -110,6 +110,14 @@ namespace comal.timesheets
 
             try
             {
+                bool deliveryteam = new Client<EmployeeTeam>().Query(new Filter<EmployeeTeam>(x => x.EmployeeLink.ID).IsEqualTo(GlobalVariables.EmpID)
+                    .And(x => x.TeamLink.ID).IsEqualTo(Guid.Parse("b7871075-4768-411f-b4f0-30874d5e6db6"))).Rows.Any()? true : false;                
+
+                if (deliveryteam || GlobalVariables.EmpID == Guid.Parse("ec88c8cc-9c05-4da8-89d8-060519ea1b70"))
+                    GlobalVariables.IsDeliveryDriver = true;
+                else 
+                    GlobalVariables.IsDeliveryDriver = false;
+
                 _timesheet = App.Data.TimeSheets?.Rows.FirstOrDefault()?.ToObject<TimeSheet>();
                 _employee = App.Data.Employee;
                 _jobs = App.Data.Jobs;