Bladeren bron

PRS MOBILE - version 7.10

Nick-PRSDigital@bitbucket.org 2 jaren geleden
bovenliggende
commit
acd0bd3406

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

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="709100" package="au.com.frogsoftware.timesheets.comal_timesheets" android:installLocation="auto" android:versionName="7.09.1">
+<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-permission android:name="android.permission.INTERNET" />
 	<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
@@ -22,9 +22,6 @@
 	<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
 	<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
 	<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
-	<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
-	<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
-	<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
 	<uses-feature android:name="android.hardware.bluetooth_le" android:required="true" />
 	<application android:resizeableActivity="false">
 		<meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyB9ZnKdEpKsbN9cm3K7rNfqeN5fIe_xlJ0" />

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

@@ -2,6 +2,7 @@
 //------------------------------------------------------------------------------
 // <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 - 2
prs.mobile/comal.timesheets.iOS/Info.plist

@@ -9,9 +9,9 @@
 	<key>CFBundleName</key>
 	<string>TimeBench</string>
 	<key>CFBundleShortVersionString</key>
-	<string>7.09.1</string>
+	<string>7.10.1</string>
 	<key>CFBundleVersion</key>
-	<string>7.09.1</string>
+	<string>7.10.1</string>
 	<key>NSBluetoothAlwaysUsageDescription</key>
 	<string>Bluetooth access is needed to locate equipment items</string>
 	<key>NSBluetoothPeripheralUsageDescription</key>

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

@@ -56,7 +56,7 @@ namespace comal.timesheets
 
         public static string LoadFromLinkString { get; set; }
 
-        public static bool IsJobOnlyEmployee { get => EmployeeJobs.Count > 0 ? true : false; }
+        public static bool IsJobOnlyEmployee { get => InABox.Core.Security.IsAllowed<IsJobOnlyEmployee>(); }
 
         public static List<JobShell> EmployeeJobs { get; set; }
         public static string GetEmployeeName()

+ 3 - 7
prs.mobile/comal.timesheets/Data Classes/NotifyChanges.cs

@@ -17,13 +17,9 @@ namespace comal.timesheets
             string latestChanges = "";
             List<string> changes = new List<string>
                 {
-                "- Added notes to edit task screen",
-                "- Added Job Forms Grid (site)",
-                "- Added Job Tasks Grid (site)",
-                "- Fixed leave request saving end of day",
-                "- Added videos to Digital Forms",
-                "- Added Products Grid",
-                "- Improved stability of background processes"
+                "- Fix to scanner page",
+                "- Fix to digital forms loading from task",
+                "- Added employee by job-only view of modules"
                 };
             foreach (string s in changes)
             {

+ 10 - 2
prs.mobile/comal.timesheets/DigitalForms/DigitalFormPickerScreen/DigitalFormsPicker.xaml.cs

@@ -133,7 +133,11 @@ namespace comal.timesheets
                 , new Columns<EmployeeRole>(x => x.RoleLink.ID));
             if (!table.Rows.Any())
             {
-                DisplayAlert("Alert", "No Roles found for your employee profile. Please check with your administrator.", "OK");
+                Device.BeginInvokeOnMainThread(() =>
+                {
+                    DisplayAlert("Alert", "No Roles found for your employee profile. Please check with your administrator.", "OK");
+                });
+
                 return table;
             }
 
@@ -141,7 +145,11 @@ namespace comal.timesheets
 
             if (!roleForms.Rows.Any())
             {
-                DisplayAlert("Alert", "No Forms found for your employee role. Please check with your administrator.", "OK");
+                Device.BeginInvokeOnMainThread(() =>
+                {
+                    DisplayAlert("Alert", "No Forms found for your employee role. Please check with your administrator.", "OK");
+                });
+
                 return table;
             }
 

+ 64 - 28
prs.mobile/comal.timesheets/DigitalForms/Renderer/QAFormViewer.cs

@@ -392,9 +392,12 @@ namespace comal.timesheets.QAForms
                 item.falseBtn.Content = dfLayoutBooleanField.Properties.FalseValue;
             if (loadData.TryGetValue(dfLayoutBooleanField.Name, out value))
             {
-                item.Value = bool.Parse(value);
-                if (bool.Parse(value) == false)
-                    item.SetFalseValue();
+                if (!string.IsNullOrWhiteSpace(value))
+                {
+                    item.Value = bool.Parse(value);
+                    if (bool.Parse(value) == false)
+                        item.SetFalseValue();
+                }
             }
             if (loadRetainedForm)
             {
@@ -491,8 +494,11 @@ namespace comal.timesheets.QAForms
 
                 if (loadData.TryGetValue(dfLayoutStringField.Name, out value))
                 {
-                    item.Text = value;
-                    button.Text = value.Length > 25 ? value.Substring(0, 25) + "..." : value;
+                    if (!string.IsNullOrWhiteSpace(value))
+                    {
+                        item.Text = value;
+                        button.Text = value.Length > 25 ? value.Substring(0, 25) + "..." : value;
+                    }
                 }
                 if (loadRetainedForm)
                 {
@@ -524,7 +530,10 @@ namespace comal.timesheets.QAForms
                 issecure = dfLayoutIntegerField.Properties.Secure;
                 if (loadData.TryGetValue(dfLayoutIntegerField.Name, out value))
                 {
-                    item.Text = value;
+                    if (!string.IsNullOrWhiteSpace(value))
+                    {
+                        item.Text = value;
+                    }
                 }
                 if (loadRetainedForm)
                 {
@@ -550,7 +559,10 @@ namespace comal.timesheets.QAForms
                 issecure = dfLayoutDoubleField.Properties.Secure;
                 if (loadData.TryGetValue(dfLayoutDoubleField.Name, out value))
                 {
-                    item.Text = value;
+                    if (!string.IsNullOrWhiteSpace(value))
+                    {
+                        item.Text = value;
+                    }
                 }
                 if (loadRetainedForm)
                 {
@@ -596,7 +608,10 @@ namespace comal.timesheets.QAForms
             item.HorizontalOptions = LayoutOptions.CenterAndExpand;
             if (loadData.TryGetValue(dfLayoutDateField.Name, out value))
             {
-                item.Date = DateTime.Parse(value);
+                if (!string.IsNullOrWhiteSpace(value))
+                {
+                    item.Date = DateTime.Parse(value);
+                }
             }
             if (loadRetainedForm)
             {
@@ -623,7 +638,10 @@ namespace comal.timesheets.QAForms
             item.HorizontalOptions = LayoutOptions.Center;
             if (loadData.TryGetValue(dfLayoutTimeField.Name, out value))
             {
-                item.Time = DateTime.Parse(value).TimeOfDay;
+                if (!string.IsNullOrWhiteSpace(value))
+                {
+                    item.Time = DateTime.Parse(value).TimeOfDay;
+                }
             }
             if (loadRetainedForm)
             {
@@ -652,7 +670,7 @@ namespace comal.timesheets.QAForms
 
                 DFLayoutOptionField dfLayoutOptionField = element as DFLayoutOptionField;
                 isrequired = dfLayoutOptionField.Properties.Required;
-                if (GlobalVariables.DeviceString == "i" || GlobalVariables.DeviceString == "I")
+                if (Device.RuntimePlatform.Equals(Device.iOS))
                 {
                     CustomPickeriOS item = new CustomPickeriOS();
                     string s = dfLayoutOptionField.Properties.Options;
@@ -668,10 +686,13 @@ namespace comal.timesheets.QAForms
                     }
                     if (loadData.TryGetValue(dfLayoutOptionField.Name, out value))
                     {
-                        int index = optionList.IndexOf(value);
-                        item.SelectedIndex = index;
-                        item.SelectedItem = optionList[index];
-                        item.SetDefault(optionList[index]);
+                        if (!string.IsNullOrWhiteSpace(value))
+                        {
+                            int index = optionList.IndexOf(value);
+                            item.SelectedIndex = index;
+                            item.SelectedItem = optionList[index];
+                            item.SetDefault(optionList[index]);
+                        }
                     }
                     if (loadRetainedForm)
                     {
@@ -712,9 +733,12 @@ namespace comal.timesheets.QAForms
                     }
                     if (loadData.TryGetValue(dfLayoutOptionField.Name, out value))
                     {
-                        int index = optionList.IndexOf(value);
-                        picker.SelectedIndex = index;
-                        picker.SelectedItem = optionList[index];
+                        if (!string.IsNullOrWhiteSpace(value))
+                        {
+                            int index = optionList.IndexOf(value);
+                            picker.SelectedIndex = index;
+                            picker.SelectedItem = optionList[index];
+                        }
                     }
                     if (loadRetainedForm)
                     {
@@ -875,8 +899,11 @@ namespace comal.timesheets.QAForms
             };
             if (loadData.TryGetValue(dfLayoutLookupField.Name, out value))
             {
-                button.Data = value;
-                button.Text = value;
+                if (!string.IsNullOrWhiteSpace(value))
+                {
+                    button.Data = value;
+                    button.Text = value;
+                }
             }
             if (loadRetainedForm)
             {
@@ -922,8 +949,11 @@ namespace comal.timesheets.QAForms
             };
             if (loadData.TryGetValue(dfLayoutLookupField.Name, out value))
             {
-                button.Data = value;
-                button.Text = value;
+                if (!string.IsNullOrWhiteSpace(value))
+                {
+                    button.Data = value;
+                    button.Text = value;
+                }
             }
             if (loadRetainedForm)
             {
@@ -1030,11 +1060,14 @@ namespace comal.timesheets.QAForms
             var isrequired = dFLayoutSignaturePad.Properties.Required;
             if (loadData.TryGetValue(dFLayoutSignaturePad.Name, out value))
             {
-                EmbeddedImageCapture embeddedImageCapture = new EmbeddedImageCapture();
-                byte[] data = Convert.FromBase64String(value);
-                embeddedImageCapture.DataToImage(data);
-                view = embeddedImageCapture;
-                view.IsEnabled = false;
+                if (!string.IsNullOrWhiteSpace(value))
+                {
+                    EmbeddedImageCapture embeddedImageCapture = new EmbeddedImageCapture();
+                    byte[] data = Convert.FromBase64String(value);
+                    embeddedImageCapture.DataToImage(data);
+                    view = embeddedImageCapture;
+                    view.IsEnabled = false;
+                }
             }
             else
             {
@@ -1164,8 +1197,11 @@ namespace comal.timesheets.QAForms
                 embeddedImageCapture.LibraryButton.BackgroundColor = Color.LightGray;
             if (loadData.TryGetValue(dfLayoutEmbeddedImage.Name, out value))
             {
-                byte[] data = Convert.FromBase64String(value);
-                embeddedImageCapture.DataToImage(data);
+                if (!string.IsNullOrWhiteSpace(value))
+                {
+                    byte[] data = Convert.FromBase64String(value);
+                    embeddedImageCapture.DataToImage(data);
+                }
             }
             else
             {

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

@@ -8,7 +8,6 @@ using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
 using Xamarin.Forms;
-using Xamarin.Forms.Platform.Android;
 using XF.Material.Forms.UI.Dialogs;
 using PRSSecurity = InABox.Core.Security;
 namespace comal.timesheets

+ 3 - 3
prs.mobile/comal.timesheets/Main/MainPage.xaml

@@ -15,9 +15,9 @@
 
     <Grid x:Name="homeScreenGrid" RowSpacing="0" ColumnSpacing="0">
         <Grid.RowDefinitions>
-            <RowDefinition Height="5.5*"/>
-            <RowDefinition Height="45"/>
-            <RowDefinition Height="45"/>
+            <RowDefinition Height="5.5*" x:Name="row0"/>
+            <RowDefinition Height="45" x:Name="row1"/>
+            <RowDefinition Height="45" x:Name="row2"/>
             <RowDefinition Height="12*"/>
         </Grid.RowDefinitions>
 

+ 31 - 23
prs.mobile/comal.timesheets/Main/MainPage.xaml.cs

@@ -286,6 +286,13 @@ namespace comal.timesheets
                 CurrentLocation.IsVisible = false;
                 buttonsGrid.IsVisible = false;
                 taskBtn.IsVisible = false;
+                row0.Height = 0;
+                row1.Height = 0;
+                row2.Height = 150;
+                Image img = new Image { Source = "logo.png" };
+                img.Margin = 15;
+                Grid.SetRow(img, 2);
+                homeScreenGrid.Children.Add(img);
             }
             else
             {
@@ -1432,13 +1439,14 @@ namespace comal.timesheets
                         Text = "Assignments",
                         Image = "calendar"
                     };
-                    Assignments.IsVisible = PRSSecurity.CanView<Assignment>();
+
                     Assignments.OnTapped += ((object sender, EventArgs e) =>
                     {
                         var assignment_form = new AssignmentList();
                         Navigation.PushAsync(assignment_form);
                     });
-                    toolEntries.Add(Assignments);
+                    if (PRSSecurity.CanView<Assignment>())
+                        toolEntries.Add(Assignments);
 
                     //Deliveries
                     ToolEntry Deliveries = new ToolEntry
@@ -1446,7 +1454,6 @@ namespace comal.timesheets
                         Text = "Deliveries",
                         Image = "deliveries"
                     };
-                    Deliveries.IsVisible = PRSSecurity.CanView<Delivery>();
                     Deliveries.OnTapped += ((object sender, EventArgs e) =>
                     {
                         var delivery_form = new DeliveryList();
@@ -1454,7 +1461,7 @@ namespace comal.timesheets
 
                         //DataGridHost host = new DataGridHost(new DeliveryGrid());
                         //host.SetActionButton("Add");
-                        //host.OnActionButtonClicked += ((list) => 
+                        //host.OnActionButtonClicked += ((list) =>
                         //{
                         //    DeliveryDetails details = new DeliveryDetails(Guid.Empty);
                         //    details.OnDeliverySaved += () => { (host.DataGrid as DeliveryGrid).RefreshGrid(); };
@@ -1462,7 +1469,8 @@ namespace comal.timesheets
                         //});
                         //Navigation.PushAsync(host);
                     });
-                    toolEntries.Add(Deliveries);
+                    if (PRSSecurity.CanView<Delivery>())
+                        toolEntries.Add(Deliveries);
 
                     //Digital Forms
                     ToolEntry Forms = new ToolEntry
@@ -1470,13 +1478,13 @@ namespace comal.timesheets
                         Text = "Forms",
                         Image = "forms"
                     };
-                    Forms.IsVisible = PRSSecurity.CanView<DigitalForm>();
                     Forms.OnTapped += ((object sender, EventArgs e) =>
                     {
                         var qaFormPicker = new DigitalFormsPicker();
                         Navigation.PushAsync(qaFormPicker);
                     });
-                    toolEntries.Add(Forms);
+                    if (PRSSecurity.CanView<DigitalForm>())
+                        toolEntries.Add(Forms);
 
                     //Equipment
                     ToolEntry Equipment = new ToolEntry
@@ -1484,7 +1492,6 @@ namespace comal.timesheets
                         Text = "Equipment",
                         Image = "digger"
                     };
-                    Equipment.IsVisible = PRSSecurity.CanView<Equipment>();
                     Equipment.OnTapped += (async (object sender, EventArgs e) =>
                     {
                         using (await MaterialDialog.Instance.LoadingDialogAsync(message: "Loading"))
@@ -1493,7 +1500,8 @@ namespace comal.timesheets
                             Navigation.PushAsync(equipment);
                         }
                     });
-                    toolEntries.Add(Equipment);
+                    if (PRSSecurity.CanView<Equipment>())
+                        toolEntries.Add(Equipment);
 
                     //InOut
                     ToolEntry InOut = new ToolEntry
@@ -1501,13 +1509,13 @@ namespace comal.timesheets
                         Text = "In/Out",
                         Image = "inout"
                     };
-                    InOut.IsVisible = PRSSecurity.IsAllowed<CanViewInOutBoard>();
                     InOut.OnTapped += ((object sender, EventArgs e) =>
                     {
                         var staff_form = new StaffStatusPage();
                         Navigation.PushAsync(staff_form);
                     });
-                    toolEntries.Add(InOut);
+                    if (PRSSecurity.IsAllowed<CanViewInOutBoard>())
+                        toolEntries.Add(InOut);
 
                     //Manufacturing
                     ToolEntry Manufacturing = new ToolEntry
@@ -1519,13 +1527,13 @@ namespace comal.timesheets
                     {
                         Manufacturing.Image = "Image";
                     }
-                    Manufacturing.IsVisible = PRSSecurity.IsAllowed<CanViewManufacturingOnMobile>();
                     Manufacturing.OnTapped += ((object sender, EventArgs e) =>
                     {
                         ManufacturingScreen manufacturingScreen = new ManufacturingScreen();
                         Navigation.PushAsync(manufacturingScreen);
                     });
-                    toolEntries.Add(Manufacturing);
+                    if (PRSSecurity.IsAllowed<CanViewManufacturingOnMobile>())
+                        toolEntries.Add(Manufacturing);
 
                     //My HR
                     ToolEntry MyHR = new ToolEntry
@@ -1564,14 +1572,14 @@ namespace comal.timesheets
                         Text = "Products",
                         Image = "products"
                     };
-                    Products.IsVisible = PRSSecurity.CanView(typeof(Product));
                     Products.OnTapped += (object sender, EventArgs e) =>
                     {
                         var page = new DataGridHost(new ProductsGrid());
 
                         Navigation.PushAsync(page);
                     };
-                    toolEntries.Add(Products);
+                    if (PRSSecurity.CanView(typeof(Product)))
+                        toolEntries.Add(Products);
 
                     //Purchase Orders
                     ToolEntry PurchaseOrders = new ToolEntry()
@@ -1579,13 +1587,13 @@ namespace comal.timesheets
                         Text = "Purchase Orders",
                         Image = "shoppingcart"
                     };
-                    PurchaseOrders.IsVisible = PRSSecurity.CanView<PurchaseOrder>();
                     PurchaseOrders.OnTapped += ((object sender, EventArgs e) =>
                     {
                         PurchaseOrderModule page = new PurchaseOrderModule();
                         Navigation.PushAsync(page);
                     });
-                    toolEntries.Add(PurchaseOrders);
+                    if (PRSSecurity.CanView<PurchaseOrder>())
+                        toolEntries.Add(PurchaseOrders);
 
                     //Scanner
                     ToolEntry Scanner = new ToolEntry
@@ -1619,13 +1627,13 @@ namespace comal.timesheets
                         Text = "Store Requis",
                         Image = "storerequis"
                     };
-                    StoreRequis.IsVisible = PRSSecurity.CanView<Requisition>();
                     StoreRequis.OnTapped += ((object sender, EventArgs e) =>
                     {
                         var storeRequisList = new StoreRequiList();
                         Navigation.PushAsync(storeRequisList);
                     });
-                    toolEntries.Add(StoreRequis);
+                    if (PRSSecurity.CanView<Requisition>())
+                        toolEntries.Add(StoreRequis);
 
                     //Tasks
                     ToolEntry Tasks = new ToolEntry
@@ -1633,13 +1641,13 @@ namespace comal.timesheets
                         Text = "My Tasks",
                         Image = "tasks"
                     };
-                    Tasks.IsVisible = PRSSecurity.IsAllowed<CanViewTasks>();
                     Tasks.OnTapped += ((object sender, EventArgs e) =>
                     {
                         var tasksForm = new TasksList();
                         Navigation.PushAsync(tasksForm);
                     });
-                    toolEntries.Add(Tasks);
+                    if (PRSSecurity.IsAllowed<CanViewTasks>())
+                        toolEntries.Add(Tasks);
 
                     //Warehousing
                     ToolEntry Warehousing = new ToolEntry
@@ -1647,13 +1655,13 @@ namespace comal.timesheets
                         Text = "Warehousing",
                         Image = "newwarehousing"
                     };
-                    Warehousing.IsVisible = PRSSecurity.CanView<StockWarehouse>();
                     Warehousing.OnTapped += ((object sender, EventArgs e) =>
                     {
                         Warehousing2 locations = new Warehousing2();
                         Navigation.PushAsync(locations);
                     });
-                    toolEntries.Add(Warehousing);
+                    if (PRSSecurity.CanView<StockWarehouse>())
+                        toolEntries.Add(Warehousing);
 
                     AddChildren();
                 });

+ 1 - 1
prs.mobile/comal.timesheets/Main/MainPageUtils.cs

@@ -61,7 +61,7 @@ namespace comal.timesheets
             {
                 GlobalVariables.EmployeeJobs = new List<JobShell>();
 
-                if (!Security.IsAllowed<IsJobOnlyEmployee>())
+                if (!PRSSecurity.IsAllowed<IsJobOnlyEmployee>())
                     return;
 
                 CoreTable table = new Client<JobEmployee>().Query(new Filter<JobEmployee>(x => x.EmployeeLink.ID).IsEqualTo(GlobalVariables.EmpID));