Ver código fonte

Version 4.39.6

Nick-PRSDigital@bitbucket.org 2 anos atrás
pai
commit
c92eaa89cf

+ 1 - 1
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="439200" android:versionName="4.39.2" package="au.com.frogsoftware.timesheets.comal_timesheets" android:installLocation="auto">
+<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="439600" android:versionName="4.39.6" package="au.com.frogsoftware.timesheets.comal_timesheets" android:installLocation="auto">
 	<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="31" />
 	<uses-permission android:name="android.permission.INTERNET" />
 	<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

+ 2 - 1
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.
@@ -14,7 +15,7 @@ namespace comal.timesheets.Droid
 {
 	
 	
-	[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "13.0.0.73")]
+	[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "13.1.0.5")]
 	public partial class Resource
 	{
 		

+ 2 - 2
prs.mobile/comal.timesheets.iOS/Info.plist

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

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

@@ -116,8 +116,8 @@ namespace comal.timesheets
             string latestChanges = "";
             List<string> changes = new List<string>
             {
-                "- Further fixes to Dimensions",
-                "- iOS login issues"
+                "- Notification opens leave request form",
+                "- Upgrade to Setouts Module"
                                                            
             };
             foreach (string s in changes)

+ 160 - 0
prs.mobile/comal.timesheets/SetoutPacketGrid.cs

@@ -0,0 +1,160 @@
+using Comal.Classes;
+using InABox.Clients;
+using InABox.Core;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Xamarin.Forms;
+
+namespace comal.timesheets
+{
+    public class SetoutPacketGrid : Frame
+    {
+        public SetoutShell Shell;
+        Dictionary<string, Guid> fileNameIDS = new Dictionary<string, Guid>();
+
+        public SetoutPacketGrid(SetoutShell shell)
+        {
+            Margin = 0;
+            Padding = 0;
+            BorderColor = Color.Gray;
+            HasShadow = false;
+
+            Shell = shell;
+
+            Grid mainGrid = new Grid();
+
+            mainGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) });
+            mainGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(2, GridUnitType.Star) });
+
+            mainGrid.Children.Add(SetupSetoutColumn(shell));
+
+            mainGrid.Children.Add(SetupPacketsColumn(shell));
+
+            Content = mainGrid;
+
+            GestureRecognizers.Add(OpenPDFCommand(shell));
+        }
+
+        private View SetupPacketsColumn(SetoutShell shell)
+        {
+            StackLayout layout = new StackLayout
+            {
+                Orientation = StackOrientation.Vertical
+            };
+
+            layout.SetValue(Grid.ColumnProperty, 1);
+
+            foreach (var packet in shell.Packets)
+            {
+                layout.Children.Add(CreatePacketView(packet));
+            }
+
+            return layout;
+        }
+
+        private View CreatePacketView(MiniManufacturingPacket packet)
+        {
+            Frame frame = new Frame();
+            frame.Margin = 1;
+            frame.Padding = 0;
+            frame.BorderColor = Color.Gray;
+            frame.HasShadow = false;
+            frame.Content = new Label
+            {
+                Text = packet.Serial + " / " + packet.Location,
+                Margin = new Thickness(5, 0, 0, 0)
+            };
+
+            frame.GestureRecognizers.Add(OpenPacketCommand(packet));
+
+            return frame;
+        }
+
+        private IGestureRecognizer OpenPacketCommand(MiniManufacturingPacket packet)
+        {
+            var tapped = new TapGestureRecognizer();
+            tapped.Tapped += async (s, e) =>
+            {
+                ManufacturingPacketPopup popup = new ManufacturingPacketPopup(packet.ID, packet.OrderID);
+                Navigation.PushAsync(popup);
+            };
+            return tapped;
+        }
+
+        private IGestureRecognizer OpenPDFCommand(SetoutShell shell)
+        {
+
+            var tapped = new TapGestureRecognizer();
+            tapped.Tapped += async (s, e) =>
+            {
+                fileNameIDS.Clear();
+                CoreTable table = new Client<SetoutDocument>().Query
+                (
+                new Filter<SetoutDocument>(x => x.EntityLink.ID).IsEqualTo(shell.ID),
+                new Columns<SetoutDocument>(x => x.DocumentLink.ID, x => x.DocumentLink.FileName)
+                );
+                if (table.Rows.Any())
+                {
+                    foreach (CoreRow row in table.Rows)
+                    {
+                        if (!fileNameIDS.ContainsKey(row.Get<string>("DocumentLink.FileName")))
+                            fileNameIDS.Add(row.Get<string>("DocumentLink.FileName"), row.Get<Guid>("DocumentLink.ID"));
+                    }
+                    PDFList list = new PDFList(fileNameIDS);
+                    Navigation.PushAsync(list);
+                }
+            };
+            return tapped;
+        }
+
+
+        #region Setup Setout column
+        private Grid SetupSetoutColumn(SetoutShell shell)
+        {
+            Grid grid = new Grid();
+            grid.SetValue(Grid.ColumnProperty, 0);
+
+            grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Auto) });
+            grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Auto) });
+
+            Label label = new Label
+            {
+                Text = shell.Number,
+                LineBreakMode = LineBreakMode.WordWrap,
+                Margin = new Thickness(5, 0, 0, 0)
+            };
+
+            label.SetValue(Grid.RowProperty, 0);
+
+            Label label1 = new Label
+            {
+                Text = shell.Description,
+                LineBreakMode = LineBreakMode.WordWrap,
+                Margin = new Thickness(5, 0, 0, 0)
+            };
+
+            label1.SetValue(Grid.RowProperty, 1);
+
+            grid.Children.Add(label);
+            grid.Children.Add(label1);
+
+            return grid;
+        }
+
+        private View CreateLabel(string text, double rownumber)
+        {
+            Label label = new Label
+            {
+                Text = text,
+                LineBreakMode = LineBreakMode.WordWrap
+            };
+
+            label.SetValue(Grid.RowProperty, rownumber);
+
+            return label;
+        }
+        #endregion
+    }
+}

+ 3 - 156
prs.mobile/comal.timesheets/SetoutsScreen.xaml

@@ -24,7 +24,6 @@
             <Grid.RowDefinitions>
                 <RowDefinition Height="50"/>
                 <RowDefinition Height="*"/>
-                <RowDefinition Height="0" x:Name="packetRow"/>
             </Grid.RowDefinitions>
 
             <!-- Row 0 -->
@@ -44,162 +43,10 @@
             </Grid>
 
             <!-- Row 1 -->
-            <ListView Grid.Row="1" x:Name="setoutsListView" HasUnevenRows="True">
-                <ListView.ItemTemplate>
-                    <DataTemplate>
-                        <ViewCell Tapped="SetoutsListView_Tapped">
-                            <!-- Column 0 -->
-                            <Frame Grid.Column="0" HasShadow="False" CornerRadius="3" Padding="2"
-                                   Margin="5, 1, 5, 1" BorderColor="#15C7C1">
-                                <Grid RowSpacing="0" ColumnSpacing="0">
-                                    <Grid.RowDefinitions>
-                                        <RowDefinition Height="20"/>
-                                        <RowDefinition Height="auto"/>
-                                    </Grid.RowDefinitions>
-                                    <Label Grid.Row="0" Text="{Binding Number}" FontAttributes="Bold" Margin="5, 1, 1, 1"/>
-                                    <Label Grid.Row="1" Text="{Binding Description}" Margin="5, 1, 1, 1" LineBreakMode="WordWrap"/>
-                                </Grid>
-                            </Frame>
-                        </ViewCell>
-                    </DataTemplate>
-                </ListView.ItemTemplate>
-            </ListView>
-
-            <!-- Row 2 for hidden manufacturing packet viewer -->
-            <Frame x:Name="packetsFrame" Grid.Row="2" HasShadow="False" BorderColor="#a2006d" CornerRadius="3" Padding="0" Margin="1,1,1,15">
-                <Grid RowSpacing="0" ColumnSpacing="0">
-                    <Grid.RowDefinitions>
-                        <RowDefinition Height="60"/>
-                        <RowDefinition Height="auto"/>
-                    </Grid.RowDefinitions>
-
-                    <!-- Inner Row 0 -->
-                    <Grid Grid.Row="0" RowSpacing="0" ColumnSpacing="0">
-                        <Grid.ColumnDefinitions>
-                            <ColumnDefinition Width="2*"/>
-                            <ColumnDefinition Width="*"/>
-                            <ColumnDefinition Width="*"/>
-                        </Grid.ColumnDefinitions>
-
-                        <Label Grid.Column="0" Text="Packets" Margin="15, 0, 0, 0" x:Name="packetsLbl"
-                               VerticalOptions="Center" FontAttributes="Bold" FontSize="Medium"
-                               />
-
-                        <Image Grid.Column="1" Source="pdficon.png" Margin="5"
-                               VerticalOptions="Center" HorizontalOptions="Center"
-                               HeightRequest="50" WidthRequest="50"
-                               >
-                            <Image.GestureRecognizers>
-                                <TapGestureRecognizer Tapped="PDFs_Tapped"/>
-                            </Image.GestureRecognizers>
-                        </Image>
-
-                        <Frame x:Name="notificationFrame" Grid.Column="1" HorizontalOptions="End" VerticalOptions="Start" BorderColor="Black"
-                           HeightRequest="30" WidthRequest="30" CornerRadius="15" HasShadow="False" Margin="0, 1, 12, 0"
-                            BackgroundColor="Yellow" Padding="1">
-                            <Label FontAttributes="Bold" TextColor="Gray" FontSize="Medium" HorizontalOptions="Center" VerticalOptions="Center" Margin="1"
-                            x:Name="numberOfDocsLbl" />
-                        </Frame>
-
-                        <Image Grid.Column="2" Source="closee.png" Margin="5" x:Name="closeImg"
-                               VerticalOptions="Start" HorizontalOptions="End"
-                               HeightRequest="30" WidthRequest="30">
-
-                            <Image.GestureRecognizers>
-                                <TapGestureRecognizer Tapped="ClosePackets_Clicked"/>
-                            </Image.GestureRecognizers>
-                        </Image>
-
-                    </Grid>
-                    
-                    <!-- Inner Row 1 -->
-                    <ListView Grid.Row="1" x:Name="packetListView" HasUnevenRows="True" VerticalOptions="FillAndExpand">
-                        <ListView.ItemTemplate>
-                            <DataTemplate>
-                                <ViewCell Tapped="PacketListView_Tapped">
-                                    <Frame BorderColor="#15C7C1"  Margin="2" CornerRadius="15"  Padding="5" HasShadow="False">
-                                        <Grid>
-                                            <Grid.RowDefinitions>
-                                                <RowDefinition Height="auto"/>
-                                                <!--0-->
-                                                <RowDefinition Height="auto"/>
-                                                <!--1-->
-                                                <RowDefinition Height="auto"/>
-                                                <!--2-->
-                                                <RowDefinition Height="auto"/>
-                                                <!--3-->
-                                                <RowDefinition Height="{Binding LastRowHeight}"/>
-                                                <!--4-->
-                                            </Grid.RowDefinitions>
-                                            <Grid.ColumnDefinitions>
-                                                <ColumnDefinition Width="4*"/>
-                                                <ColumnDefinition Width="2*"/>
-                                                <ColumnDefinition Width="*"/>
-                                            </Grid.ColumnDefinitions>
-
-                                            <!--Column 0-->
-
-                                            <Label Grid.Row="0" Grid.Column="0" Text="{Binding Serial}" FontAttributes="Bold" TextColor="PaleVioletRed"
-                                               />
-                                            <Label Grid.Row="1" Grid.Column="0" LineBreakMode="WordWrap" MaxLines="6" FontAttributes="Bold"
-                                           Text="{Binding Title}" HorizontalOptions="Start"/>
-
-                                            <Label Grid.Row="2" Grid.Column="0" VerticalOptions="End"
-                                           Text="{Binding Location}"/>
-
-                                            <Label Grid.Row="3" Grid.Column="0"
-                                           Text="{Binding JobName}"/>
-
-                                            <Label Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="3"
-                                           HorizontalOptions="FillAndExpand" FontAttributes="Bold" FontSize="Medium" VerticalOptions="Center"
-                                           IsVisible="{Binding OnOrderVisible}" HorizontalTextAlignment="Center"
-                                           Text="{Binding OrderETA}" BackgroundColor="#cb99c9"
-                                           />
-
-                                            <!--Column 1-->
-
-                                            <Label Grid.Row="0" Grid.Column="1" FontAttributes="Bold"
-                                           Text="{Binding SetoutNumber}"/>
-
-                                            <Label Grid.Row="1" Grid.Column="1" 
-                                           Text="{Binding Created}"/>
-
-                                            <Label Grid.Row="2" Grid.Column="1"
-                                           Text="{Binding DueDate}"/>
-
-                                            <Label Grid.Row="3" Grid.Column="1"
-                                           Text="{Binding StageLinkPercentage}"/>
-
-                                            <!--Column 2-->
-
-                                            <Grid Grid.Column="2" Grid.Row="0" Grid.RowSpan="4" VerticalOptions="Center" HorizontalOptions="Center">
-                                                <Grid.RowDefinitions>
-                                                    <RowDefinition Height="auto"/>
-                                                    <RowDefinition Height="auto"/>
-                                                    <RowDefinition Height="auto"/>
-                                                </Grid.RowDefinitions>
-                                                <Image Grid.Row="0"  HeightRequest="{Binding ImageHeight}" WidthRequest="{Binding ImageWidth}"
-                                               HorizontalOptions="Center" VerticalOptions="Center"
-                                               Source="{Binding ImagePath}"/>
-
-                                                <Label Grid.Row="1"  FontSize="30" 
-                                           Text="{Binding Quantity}"/>
-
-                                                <Label Grid.Row="2"
-                                           Text="{Binding TemplateLinkCode}"/>
-                                            </Grid>
-
-                                        </Grid>
-                                    </Frame>
-                                </ViewCell>
-                            </DataTemplate>
-                        </ListView.ItemTemplate>
-                    </ListView>
-                </Grid>
-                
-                
-            </Frame>
+            <ScrollView Grid.Row="1">
+                <FlexLayout x:Name="setoutsList" AlignContent="Start" AlignItems="Start" Direction="Column"/>
 
+            </ScrollView>
         </Grid>
 
     </ContentPage.Content>

+ 124 - 219
prs.mobile/comal.timesheets/SetoutsScreen.xaml.cs

@@ -21,17 +21,12 @@ namespace comal.timesheets
         #region Constructor / navigation
         Guid JobID = new Guid();
         List<SetoutShell> Setouts = new List<SetoutShell>();
-        List<ManufacturingPacketShell> packets = new List<ManufacturingPacketShell>();
-        Dictionary<string, Guid> fileNameIDS = new Dictionary<string, Guid>();
+        List<ManufacturingPacketShell> packetShells = new List<ManufacturingPacketShell>();
+        List<MiniManufacturingPacket> packets = new List<MiniManufacturingPacket>();
         public SetoutsScreen()
         {
             InitializeComponent();
             NavigationPage.SetHasBackButton(this, false);
-            if (Device.RuntimePlatform == Device.iOS)
-            {
-                closeImg.HeightRequest = 45;
-                closeImg.WidthRequest = 45;
-            }
         }
 
         private void ExitBtn_Clicked(object sender, EventArgs e)
@@ -50,8 +45,6 @@ namespace comal.timesheets
                 using (await MaterialDialog.Instance.LoadingDialogAsync(message: "Loading"))
                 {
                     AddSetoutsToList(DoSetoutsQuery());
-
-                    DisplayList();
                 }
             }
             catch { }
@@ -68,33 +61,79 @@ namespace comal.timesheets
                         x => x.Description
                         )
                     );
+
+            DoPacketsQuery(table);
+
             return table;
         }
+
+        private void DoPacketsQuery(CoreTable table)
+        {
+            List<Guid> ids = new List<Guid>();
+            foreach (CoreRow row in table.Rows)
+                ids.Add(row.Get<Setout, Guid>(x => x.ID));
+
+            CoreTable packetstable = new Client<ManufacturingPacket>().Query(new Filter<ManufacturingPacket>(x => x.SetoutLink.ID).InList(ids.ToArray())
+                , Columns);
+
+            foreach (CoreRow row in packetstable.Rows)
+            {
+                packets.Add(new MiniManufacturingPacket
+                {
+                    ID = row.Get<ManufacturingPacket, Guid>(x => x.ID),
+                    OrderID = row.Get<ManufacturingPacket, Guid>(x => x.OrderItem.ID),
+                    Serial = row.Get<ManufacturingPacket, string>(x => x.Serial),
+                    Location = row.Get<ManufacturingPacket, string>(x => x.Location),
+                    SetoutID = row.Get<ManufacturingPacket, Guid>(x => x.SetoutLink.ID),
+                });
+            }
+        }
         private void AddSetoutsToList(CoreTable table)
         {
             foreach (CoreRow row in table.Rows)
                 Setouts.Add(CreateSetoutShell(row));
+
+            foreach (var shell in Setouts)
+            {
+                var item = CreateSetOutViewItem(shell);
+                setoutsList.Children.Add(item);
+            }
+
         }
+
+        private SetoutPacketGrid CreateSetOutViewItem(SetoutShell shell)
+        {
+            return new SetoutPacketGrid(shell);
+        }
+
         private SetoutShell CreateSetoutShell(CoreRow row)
         {
-            List<object> list = row.Values;
-            if (list[0] == null) list[0] = Guid.Empty;
-            if (list[1] == null) list[1] = "";
-            if (list[2] == null) list[2] = "";
+            SetoutShell shell = AddSetoutDetails(row);
+
+            shell = AddPacketDetails(shell);
+
+            return shell;
+        }
 
+        private SetoutShell AddSetoutDetails(CoreRow row)
+        {
             SetoutShell shell = new SetoutShell();
-            shell.ID = Guid.Parse(list[0].ToString());
-            shell.Number = list[1].ToString();
-            shell.Description = list[2].ToString();
+            shell.ID = row.Get<Setout, Guid>(x => x.ID);
+            shell.Number = row.Get<Setout, string>(x => x.Number);
+            shell.Description = row.Get<Setout, string>(x => x.Description);
 
             return shell;
         }
-        private void DisplayList()
+
+        private SetoutShell AddPacketDetails(SetoutShell shell)
         {
-            Device.BeginInvokeOnMainThread(() =>
+            var list = packets.Where(x => x.SetoutID == shell.ID);
+            foreach (var packet in list)
             {
-                setoutsListView.ItemsSource = Setouts;
-            });
+                shell.Packets.Add(packet);
+            }
+
+            return shell;
         }
         #endregion
 
@@ -110,225 +149,72 @@ namespace comal.timesheets
             };
             Navigation.PushAsync(page);
         }
-        private void SetoutsListView_Tapped(object sender, EventArgs e)
-        {
-            try
-            {
-                SetoutShell shell = setoutsListView.SelectedItem as SetoutShell;
-                QueryPDFsAndPackets(shell.ID);
-                DisplayPackets();
-            }
-            catch { }
-        }
-        private async void ClosePackets_Clicked(object sender, EventArgs e)
-        {
-            await packetsFrame.TranslateTo(0, 900, 500);
-            packetsFrame.IsVisible = false;
-            packetsFrame.TranslateTo(0, 0, 500);
-            packetsFrame.IsVisible = false;
-            packetRow.Height = 0;
-        }
-        private void PDFs_Tapped(object sender, EventArgs e)
-        {
-            PDFList list = new PDFList(fileNameIDS);
-            Navigation.PushAsync(list);
-        }
-        private void PacketListView_Tapped(object sender, EventArgs e)
-        {
-            ManufacturingPacketShell shell = packetListView.SelectedItem as ManufacturingPacketShell;
-            ManufacturingPacketPopup popup = new ManufacturingPacketPopup(shell.ID, shell.OrderID);
-            Navigation.PushAsync(popup);
-        }
         #endregion
 
-        #region Loading Setout Details (Packets and PDFs)
-        private async void DisplayPackets()
-        {
-            packetsFrame.IsVisible = false;
-
-            int height = 60 + (packets.Count * 150);
-            if (height > 600)
-                height = 600;
-
-            packetRow.Height = height;
-
-            packetListView.ItemsSource = null;
-            packetListView.ItemsSource = packets;
+        Columns<ManufacturingPacket> Columns = new Columns<ManufacturingPacket>(
+                        x => x.ID,
+                        x => x.OrderItem.ID,
+                        x => x.Serial,
+                        x => x.Location,
+                        x => x.SetoutLink.ID
+                        );
 
-            packetsLbl.Text = "Packets (" + packets.Count + ")";
-            await packetsFrame.TranslateTo(0, 900, 0);
-            packetsFrame.IsVisible = true;
-            await packetsFrame.TranslateTo(0, 0, 500);
-        }
-        private void QueryPDFsAndPackets(Guid setoutID)
-        {
-            QueryPackets(setoutID);
-            Task.Run(() => { QueryPDFs(setoutID); });
-        }
-        private void AddPacketsToList(CoreTable table)
-        {
-            packets.Clear();
-            foreach (CoreRow row in table.Rows)
-                packets.Add(CreatePacket(row));
-        }
-        private ManufacturingPacketShell CreatePacket(CoreRow row)
+        #region Searching
+        private void SearchEnt_Changed(object sender, EventArgs e)
         {
-            List<object> list = row.Values;
-            if (list[0] == null) { list[0] = ""; } //0
-            if (list[1] == null) { list[1] = 0; } //1
-            if (list[2] == null) { list[2] = Guid.Empty; } //2
-            if (list[3] == null) { list[3] = ""; } //3
-            if (list[4] == null) { list[4] = ""; } //4
-            if (list[5] == null) { list[5] = ""; } //5
-            if (list[6] == null) { list[6] = DateTime.MinValue; } //6
-            if (list[7] == null) { list[7] = DateTime.MinValue; } //7
-            if (list[8] == null) { list[8] = 0; } //8
-            if (list[9] == null) { list[9] = 0.0; } //9
-            if (list[10] == null) { list[10] = ""; } //10
-            if (list[11] == null) { list[11] = ""; } //11
-            if (list[12] == null) { list[12] = ""; } //12
-            if (list[13] == null) { list[13] = Guid.Empty; } //13
-            if (list[14] == null) { list[14] = ""; } //14
-            if (list[15] == null) { list[15] = Guid.Empty; } //15
-            if (list[16] == null) { list[16] = ""; } //16
-            if (list[17] == null) { list[17] = ""; } //17
-            if (list[18] == null) { list[18] = ""; } //18
-            if (list[19] == null) { list[19] = ""; } //19
-            if (list[20] == null) { list[20] = Guid.Empty; } //20
-            if (list[21] == null) { list[21] = DateTime.MinValue; } //21
-            if (list[22] == null) { list[22] = DateTime.MinValue; } //22
-            if (list[23] == null) { list[23] = Guid.Empty; } //23
-
-            ManufacturingPacketShell shell = new ManufacturingPacketShell()
-            {
-                Title = list[0].ToString(),
-                Quantity = list[1].ToString(),
-                DrawingID = Guid.Parse(list[2].ToString()),
-                StageLinkSection = list[3].ToString(),
-                JobNumber = list[4].ToString(),
-                ITPCode = list[4].ToString() + " " + list[5].ToString(),
-                Created = "C: " + DateTime.Parse(list[6].ToString()).ToString("dd MMM yy"),
-                DueDate = "D: " + DateTime.Parse(list[7].ToString()).ToString("dd MMM yy"),
-                StageLinkStation = int.Parse(list[8].ToString()),
-                StageLinkPercentage = list[9].ToString() + "%",
-                FactoryName = list[10].ToString(),
-                Location = list[11].ToString(),
-                SetoutID = Guid.Parse(list[13].ToString()),
-                SetoutNumber = list[14].ToString(),
-                ID = Guid.Parse(list[15].ToString()),
-                TemplateLinkCode = list[16].ToString(),
-                JobName = list[17].ToString(),
-                OrderID = Guid.Parse(list[20].ToString()),
-                OrderRecDate = DateTime.Parse(list[21].ToString()),
-                JobID = Guid.Parse(list[23].ToString()),
-            };
-            if (!string.IsNullOrWhiteSpace(list[18].ToString()))
-            {
-                shell.Serial = "[" + list[18].ToString() + "] " + list[12].ToString() + ":";
-            }
-            else
-            {
-                shell.Serial = list[12].ToString();
-            }
-            if (!string.IsNullOrWhiteSpace(shell.StageLinkSection))
-                shell.StageLinkPercentage = shell.StageLinkPercentage + " of " + shell.StageLinkSection;
-            else
-                shell.StageLinkPercentage = "TBI";
-
-            if (!string.IsNullOrWhiteSpace(list[19].ToString()))
+            if (!string.IsNullOrWhiteSpace(searchEnt.Text))
             {
-                shell.ImagePath = "notifications.png";
-                shell.ImageHeight = 25.0;
-                shell.ImageWidth = 25.0;
-                if (Device.RuntimePlatform.Equals(Device.iOS))
+                foreach (var child in setoutsList.Children)
                 {
-                    shell.ImageHeight = 35.0;
-                    shell.ImageWidth = 35.0;
+                    if (ConditionsMet(child, searchEnt.Text))
+                        child.IsVisible = true;
+                    else
+                        child.IsVisible = false;
                 }
             }
-
-            if (shell.OrderID != Guid.Empty && shell.OrderRecDate == DateTime.MinValue)
+            else
             {
-                shell.OnOrderVisible = true;
-                shell.LastRowHeight = 30;
-                if (DateTime.TryParse(list[22].ToString(), out DateTime ETA))
+                foreach (var c in setoutsList.Children)
                 {
-                    shell.OrderETA = "ON ORDER ETA: " + ETA.ToString("dd MMM yy");
-                }
-                else
-                {
-                    shell.OrderETA = "ON ORDER";
+                    c.IsVisible = true;
                 }
             }
-            return shell;
         }
-        private void QueryPDFs(Guid setoutID)
+
+        private bool ConditionsMet(View child, string text)
         {
-            fileNameIDS.Clear();
-            CoreTable table = new Client<SetoutDocument>().Query
-                (
-                new Filter<SetoutDocument>(x => x.EntityLink.ID).IsEqualTo(setoutID),
-                new Columns<SetoutDocument>(x => x.DocumentLink.ID, x => x.DocumentLink.FileName)
-                );
-            if (table.Rows.Any())
-            {
-                foreach (CoreRow row in table.Rows)
-                {
-                    fileNameIDS.Add(row.Get<string>("DocumentLink.FileName"), row.Get<Guid>("DocumentLink.ID"));
-                }
-            }
-            Device.BeginInvokeOnMainThread(() =>
-            {
-                numberOfDocsLbl.Text = fileNameIDS.Count.ToString();
-            });
+            var item = child as SetoutPacketGrid;
+            if (SetOutConditionsMatch(item, text) || PacketConditionsMet(item, text))
+                return true;
+            else
+                return false;
         }
-        private void QueryPackets(Guid setoutID)
+
+        private bool SetOutConditionsMatch(SetoutPacketGrid child, string text)
         {
-            AddPacketsToList(new Client<ManufacturingPacket>().Query
-                (
-                new Filter<ManufacturingPacket>(x => x.SetoutLink.ID).IsEqualTo(setoutID),
-                Columns
-                ));
+            if (child.Shell.Number.Contains(text) || child.Shell.Number.Contains(text.ToLower()) || child.Shell.Number.Contains(text.ToUpper())
+                || child.Shell.Number.Contains(SearchUtils.UpperCaseFirst(text)) ||
+                child.Shell.Description.Contains(text) || child.Shell.Description.Contains(text.ToLower()) || child.Shell.Description.Contains(text.ToUpper())
+                || child.Shell.Description.Contains(SearchUtils.UpperCaseFirst(text)))
+                return true;
+            else
+                return false;
         }
 
-        Columns<ManufacturingPacket> Columns = new Columns<ManufacturingPacket>(
-                        x => x.Title, //0
-                        x => x.Quantity, //1
-                        x => x.Drawing.ID, //2
-                        x => x.StageLink.Section, //3
-                        x => x.SetoutLink.JobLink.JobNumber, //4
-                        x => x.ITP.Code, //5
-                        x => x.Created, //6
-                        x => x.DueDate, //7
-                        x => x.StageLink.Station, //8
-                        x => x.StageLink.PercentageComplete, //9
-                        x => x.ManufacturingTemplateLink.Factory.Name, //10
-                        x => x.Location, //11
-                        x => x.Serial, //12
-                        x => x.SetoutLink.ID, //13
-                        x => x.SetoutLink.Number, //14
-                        x => x.ID, //15
-                        x => x.ManufacturingTemplateLink.Code, //16
-                        x => x.SetoutLink.JobLink.Name, //17
-                        x => x.WaterMark, //18
-                        x => x.Issues, //19
-                        x => x.OrderItem.ID, //20
-                        x => x.OrderItem.ReceivedDate, //21
-                        x => x.OrderItem.Consignment.EstimatedWarehouseArrival, //22
-                        x => x.SetoutLink.JobLink.ID //23
-                        );
-        #endregion
-
-        #region Searching
-        private void SearchEnt_Changed(object sender, EventArgs e)
+        private bool PacketConditionsMet(SetoutPacketGrid child, string text)
         {
-            if (!string.IsNullOrWhiteSpace(searchEnt.Text))
-                setoutsListView.ItemsSource = Setouts.Where(x => x.Number.Contains(searchEnt.Text)
-                || x.Description.Contains(searchEnt.Text) || x.Description.Contains(SearchUtils.UpperCaseFirst(searchEnt.Text))
-                || x.Description.Contains(searchEnt.Text.ToLower()) || x.Description.Contains(searchEnt.Text.ToUpper()));
-            else
-                setoutsListView.ItemsSource = Setouts;
+            foreach (var packet in child.Shell.Packets)
+            {
+                if (packet.Serial.Contains(text) || packet.Serial.Contains(text.ToUpper()) || packet.Serial.Contains(text.ToLower())
+                    || packet.Serial.Contains(SearchUtils.UpperCaseFirst(text))
+                    || packet.Location.Contains(text) || packet.Location.Contains(text.ToUpper()) || packet.Location.Contains(text.ToLower())
+                    || packet.Location.Contains(SearchUtils.UpperCaseFirst(text)))
+                    return true;
+            }
+            return false;
         }
+
+
         #endregion
     }
 
@@ -337,12 +223,31 @@ namespace comal.timesheets
         public Guid ID { get; set; }
         public string Number { get; set; }
         public string Description { get; set; }
+        public List<MiniManufacturingPacket> Packets { get; set; }
 
         public SetoutShell()
         {
             ID = Guid.Empty;
             Number = "";
             Description = "";
+            Packets = new List<MiniManufacturingPacket>();
+        }
+    }
+
+    public class MiniManufacturingPacket
+    {
+        public Guid ID { get; set; }
+        public Guid OrderID { get; set; }
+        public Guid SetoutID { get; set; }
+        public string Serial { get; set; }
+        public string Location { get; set; }
+        public MiniManufacturingPacket()
+        {
+            ID = Guid.Empty;
+            OrderID = Guid.Empty;
+            Serial = "";
+            Location = "";
+            SetoutID = Guid.Empty;
         }
     }
 }

+ 1 - 0
prs.mobile/comal.timesheets/comal.timesheets.projitems

@@ -547,6 +547,7 @@
       <DependentUpon>Site.xaml</DependentUpon>
       <SubType>Code</SubType>
     </Compile>
+    <Compile Include="$(MSBuildThisFileDirectory)SetoutPacketGrid.cs" />
   </ItemGroup>
   <ItemGroup>
     <Folder Include="$(MSBuildThisFileDirectory)CustomControls\Pages\Selection Screens\Under development\" />