Explorar o código

Working Through Module Issues

Frank van den Bos %!s(int64=2) %!d(string=hai) anos
pai
achega
6958df8805

+ 1 - 0
prs.mobile/comal.timesheets.iOS/comal.timesheets.iOS.csproj

@@ -34,6 +34,7 @@
     <MtouchHttpClientHandler>NSUrlSessionHandler</MtouchHttpClientHandler>
     <CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
     <LangVersion>8.0</LangVersion>
+    <MtouchFastDev>true</MtouchFastDev>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
     <DebugType>none</DebugType>

+ 3 - 5
prs.mobile/comal.timesheets/Data Models/Details/AssignmentDetail/AssignmentDetailModel.cs

@@ -1,17 +1,12 @@
 using System;
 using System.Collections.Generic;
-using System.Collections.ObjectModel;
 using System.ComponentModel;
 using System.Linq;
 using System.Runtime.CompilerServices;
-using Android.App.Admin;
 using Comal.Classes;
-using comal.timesheets;
 using InABox.Core;
 using JetBrains.Annotations;
 using Syncfusion.Drawing;
-using Syncfusion.Pdf;
-using Xamarin.Forms.Internals;
 
 namespace comal.timesheets
 {
@@ -140,6 +135,9 @@ namespace comal.timesheets
         public override void AfterLoad(MultiQuery query, Guid id)
         {
             base.AfterLoad(query, id);
+
+            JobID = Item.JobID;
+            EmployeeID = Item.EmployeeID;
             
             Activities = query.Get<EmployeeActivity>().ToDictionary<EmployeeActivity, Guid, String>(
                 x => x.Activity.ID,

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

@@ -222,7 +222,8 @@ namespace comal.timesheets
                  {
                      "192.168.208.216:8010",
                      "192.168.0.247:8010",
-                     "192.168.100.54:8010"
+                     "192.168.100.54:8010",
+                     "192.168.100.52:8000"
                      //"demo.prsdigital.com.au:8003",
                      //"demo2.prsdigital.com.au:8003",
                      //"demo3.prsdigital.com.au:8003"

+ 46 - 82
prs.mobile/comal.timesheets/Modules/Assignments/AssignmentEdit.xaml

@@ -1,94 +1,58 @@
 <?xml version="1.0" encoding="utf-8"?>
 
-<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
+<local:BasePage xmlns="http://xamarin.com/schemas/2014/forms"
              xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
              xmlns:local="clr-namespace:comal.timesheets"
              xmlns:tabView="clr-namespace:Syncfusion.XForms.TabView;assembly=Syncfusion.SfTabView.XForms"
              xmlns:ui="clr-namespace:XF.Material.Forms.UI;assembly=XF.Material"
-             x:Class="comal.timesheets.AssignmentEdit">
+             x:Class="comal.timesheets.AssignmentEdit"
+             Title="Assignment Details">
     
-    <NavigationPage.TitleView>
-        <Grid Margin="0" Padding="0">
-            <Grid.ColumnDefinitions>
-                <ColumnDefinition Width="Auto"/>
-                <ColumnDefinition Width="*"/>
-                <ColumnDefinition Width="Auto"/>
-            </Grid.ColumnDefinitions>
+    <local:BasePage.ToolbarItems>
+        <ToolbarItem x:Name="Save" Order="Primary" Priority="0" Clicked="Save_OnClicked" IconImageSource="floppydisk.png"/>
+    </local:BasePage.ToolbarItems>
+    
+    <local:BasePage.Content>
+    
+        <tabView:SfTabView x:Name="TabView" VisibleHeaderCount="3" TabHeaderPosition="Top">
             
-            <Button
-                x:Name="Cancel"
-                Grid.Column="0"
-                Text="Cancel"
-                Clicked="Cancel_OnClicked"
-                IsVisible="False"
-                />
+            <tabView:SfTabView.SelectionIndicatorSettings>
+                <tabView:SelectionIndicatorSettings
+                    Color="Transparent" 
+                    Position="Bottom" 
+                    StrokeThickness="0"/>
+            </tabView:SfTabView.SelectionIndicatorSettings>
             
-            <Label 
-                Grid.Column="1" 
-                x:Name="Title"
-                Text="Assignment Details" 
-                VerticalOptions="Center"
-                HorizontalOptions="Center" 
-                HorizontalTextAlignment="Center" 
-                TextColor="White" 
-                FontSize="Medium"
-                FontAttributes="Bold" 
-                BackgroundColor="Transparent"/>
+            <tabView:SfTabItem Title="Info">
+                <tabView:SfTabItem.HeaderContent>
+                    <ui:MaterialButton Text="Details" CommandParameter="0" Clicked="Button_OnClicked"/>
+                </tabView:SfTabItem.HeaderContent>
+                <tabView:SfTabItem.Content>
+                    <local:AssignmentDetails x:Name="Details" BindingContext="{Binding .}" OnDetailsChanged="Details_OnOnDetailsChanged"/>
+                </tabView:SfTabItem.Content>
+            </tabView:SfTabItem>
             
-            <Button
-                x:Name="Save"
-                Grid.Column="2"
-                Text="Save"
-                IsVisible="False"
-                Clicked="Save_OnClicked"/>
-                
-        </Grid>
-    </NavigationPage.TitleView>
-    
-    <tabView:SfTabView x:Name="TabView" VisibleHeaderCount="3" TabHeaderPosition="Top">
-        
-        <tabView:SfTabView.SelectionIndicatorSettings>
-            <tabView:SelectionIndicatorSettings
-                Color="Transparent" 
-                Position="Bottom" 
-                StrokeThickness="0"/>
-        </tabView:SfTabView.SelectionIndicatorSettings>
-        
-        <tabView:SfTabItem Title="Info">
-            <tabView:SfTabItem.HeaderContent>
-                <ui:MaterialButton Text="Details" CommandParameter="0" Clicked="Button_OnClicked"/>
-            </tabView:SfTabItem.HeaderContent>
-            <tabView:SfTabItem.Content>
-                <local:AssignmentDetails x:Name="Details" BindingContext="{StaticResource DataModel}" OnDetailsChanged="Details_OnOnDetailsChanged"/>
-            </tabView:SfTabItem.Content>
-        </tabView:SfTabItem>
-        
-        <tabView:SfTabItem x:Name="MapHeader" Title="Map">
-            <tabView:SfTabItem.HeaderContent>
-                <ui:MaterialButton Text="Map" CommandParameter="1" Clicked="Button_OnClicked"/>
-            </tabView:SfTabItem.HeaderContent>
-            <tabView:SfTabItem.Content>
-                <local:AssignmentMap x:Name="Map" BindingContext="{StaticResource DataModel}"/>
-            </tabView:SfTabItem.Content>
-        </tabView:SfTabItem>
-        
-        <tabView:SfTabItem x:Name="FormHeader" Title="Forms">
-            <tabView:SfTabItem.HeaderContent>
-                <ui:MaterialButton Text="Forms" CommandParameter="2" Clicked="Button_OnClicked"/>
-            </tabView:SfTabItem.HeaderContent>
-            <tabView:SfTabItem.Content>
-                <local:AssignmentForms x:Name="Forms" BindingContext="{StaticResource DataModel}"/>
-            </tabView:SfTabItem.Content>
-        </tabView:SfTabItem>
-        
+            <tabView:SfTabItem x:Name="MapHeader" Title="Map">
+                <tabView:SfTabItem.HeaderContent>
+                    <ui:MaterialButton Text="Map" CommandParameter="1" Clicked="Button_OnClicked"/>
+                </tabView:SfTabItem.HeaderContent>
+                <tabView:SfTabItem.Content>
+                    <local:AssignmentMap x:Name="Map" BindingContext="{Binding .}"/>
+                </tabView:SfTabItem.Content>
+            </tabView:SfTabItem>
+            
+            <tabView:SfTabItem x:Name="FormHeader" Title="Forms">
+                <tabView:SfTabItem.HeaderContent>
+                    <ui:MaterialButton Text="Forms" CommandParameter="2" Clicked="Button_OnClicked"/>
+                </tabView:SfTabItem.HeaderContent>
+                <tabView:SfTabItem.Content>
+                    <local:AssignmentForms x:Name="Forms" BindingContext="{Binding .}"/>
+                </tabView:SfTabItem.Content>
+            </tabView:SfTabItem>
+            
+            
+        </tabView:SfTabView>
         
-    </tabView:SfTabView>
-
-    
-   
-    
-    
-    
-    
+    </local:BasePage.Content>    
     
-</ContentPage>
+</local:BasePage>

+ 12 - 29
prs.mobile/comal.timesheets/Modules/Assignments/AssignmentEdit.xaml.cs

@@ -8,45 +8,40 @@ using XF.Material.Forms.UI.Dialogs;
 namespace comal.timesheets
 {
     [XamlCompilation(XamlCompilationOptions.Compile)]
-    public partial class AssignmentEdit : ContentPage
+    public partial class AssignmentEdit
     {
-        private AssignmentDetailModel _datamodel { get; set; }
+        public AssignmentDetailModel DataModel { get; private set; }
         
         public AssignmentEdit(AssignmentShell assignment)
         {
+            DataModel = new AssignmentDetailModel(App.Data);
+            BindingContext = DataModel;
             InitializeComponent();
-            _datamodel = new AssignmentDetailModel(App.Data);
-            _datamodel.JobID = assignment.JobID;
-            _datamodel.EmployeeID = assignment.EmployeeId;
-            _datamodel.Load(assignment.Id, () => LoadPages());
+            DataModel.Load(assignment.Id, () => LoadPages());
         }        
         
         public AssignmentEdit(Assignment assignment)
         {
+            DataModel = new AssignmentDetailModel(App.Data);
+            BindingContext = DataModel;
             InitializeComponent();
-            _datamodel.JobID = assignment.JobLink.ID;
-            _datamodel.EmployeeID = assignment.EmployeeLink.ID;
-            _datamodel.Load(assignment, () => LoadPages());
+            DataModel.Load(assignment, () => LoadPages());
         }
 
         private void LoadPages()
         {
             Dispatcher.BeginInvokeOnMainThread(() =>
             {
-                Title.Text = _datamodel.Item.ID == Guid.Empty 
+                Title = DataModel.Item.ID == Guid.Empty 
                     ? "New Assignment"
-                    : $"Assignment {_datamodel.Item.Number}";
+                    : $"Assignment {DataModel.Item.Number}";
 
                 Details.Load();
                 
                 Map.Load();
                 
                 Forms.Load();
-
-                NavigationPage.SetHasBackButton(this, _datamodel.Item.ID != Guid.Empty);
-                Cancel.IsVisible = _datamodel.Item.ID == Guid.Empty;
-                Save.IsVisible = _datamodel.Item.ID == Guid.Empty;
-
+                
             });
         }
         
@@ -56,17 +51,9 @@ namespace comal.timesheets
             TabView.SelectedIndex = int.Parse(button.CommandParameter.ToString());
         }
         
-        private async void Cancel_OnClicked(object sender, EventArgs e)
-        {
-            var confirm = await MaterialDialog.Instance.ConfirmAsync("Are you sure you wish to cancel this action?",
-                "Confirm Cancel", "OK", "Keep Editing") == true;
-            if (confirm)
-            Navigation.PopAsync();
-        }
-
         private void Save_OnClicked(object sender, EventArgs e)
         {
-            _datamodel.Save("Saved by PRS Mobile");
+            DataModel.Save("Saved by PRS Mobile");
             Navigation.PopAsync();
         }
 
@@ -74,10 +61,6 @@ namespace comal.timesheets
         {
             if (String.Equals(args.Property, "Job"))
                 Map.Load();
-            
-            NavigationPage.SetHasBackButton(this, false);
-            Cancel.IsVisible = true;
-            Save.IsVisible = true;
         }
     }
 }

+ 4 - 4
prs.mobile/comal.timesheets/Modules/Assignments/AssignmentList.xaml

@@ -115,7 +115,7 @@
                 
             </Frame>
             
-            <Frame x:Name="TimelineFrame" Grid.Row="1" Grid.Column="0" BorderColor="Gray" Padding="2" Margin="3,0,0,5" IsVisible="False" CornerRadius="5" HasShadow="False">
+            <Frame x:Name="TimelineFrame" Grid.Row="1" Grid.Column="0" BorderColor="Silver" Padding="2" Margin="3,0,0,5" IsVisible="False" CornerRadius="5" HasShadow="False">
                 <schedule:SfSchedule 
                     x:Name="TimeLineView"
                     ScheduleView="TimelineView" 
@@ -180,7 +180,7 @@
                     FontSize="Micro"/>
             </Frame>
             
-            <Frame x:Name="LookupsFrame" Grid.Row="1" Grid.Column="1" BorderColor="Gray" Padding="0" Margin="0,0,3,5" CornerRadius="5" HasShadow="False">
+            <Frame x:Name="LookupsFrame" Grid.Row="1" Grid.Column="1" BorderColor="Silver" Padding="0" Margin="0,0,3,5" CornerRadius="5" HasShadow="False">
                 <ListView 
                     x:Name="Lookups" 
                     HasUnevenRows="True" 
@@ -188,7 +188,7 @@
                     <ListView.ItemTemplate>
                         <DataTemplate>
                             <ViewCell>
-                                <Grid VerticalOptions="FillAndExpand" BackgroundColor="{Binding Colour}">
+                                <Grid VerticalOptions="FillAndExpand" BackgroundColor="{Binding Colour}" Margin="2,5,2,0">
                                         <Grid.RowDefinitions>
                                             <RowDefinition Height="Auto"/>
                                             <RowDefinition Height="Auto"/>
@@ -196,7 +196,7 @@
                                         </Grid.RowDefinitions>
                                         <Label Text="{Binding Code}" Grid.Row="0" VerticalOptions="FillAndExpand" HorizontalTextAlignment="Center" FontSize="Micro"/>
                                         <Label Text="{Binding Description}" Grid.Row="1" VerticalOptions="FillAndExpand" HorizontalTextAlignment="Center" FontSize="Micro"/>
-                                        <BoxView Grid.Row="2" HeightRequest="1" Color="LightGray" />
+                                        <BoxView Grid.Row="2" HeightRequest="1" Color="Silver" />
                                     </Grid>
                             </ViewCell>
                         </DataTemplate>

+ 1 - 1
prs.mobile/comal.timesheets/Modules/Warehousing/Relocate/RelocatePage.xaml

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8" ?>
 <timesheets:BasePage xmlns="http://xamarin.com/schemas/2014/forms"
              xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:material="clr-namespace:XF.Material.Forms.UI;assembly=XF.Material"
-             xmlns:timesheets="clr-namespace:comal.timesheets;assembly=comal.timesheets.Android"
+             xmlns:timesheets="clr-namespace:comal.timesheets"
              x:Class="comal.timesheets.RelocatePage"
              Title="Rearrange Locations">
     <timesheets:BasePage.Content>

+ 1 - 1
prs.mobile/comal.timesheets/Modules/Warehousing/Stocktake/StocktakePage.xaml

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8" ?>
 <timesheets:BasePage xmlns="http://xamarin.com/schemas/2014/forms"
              xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
-             xmlns:timesheets="clr-namespace:comal.timesheets;assembly=comal.timesheets.Android"
+             xmlns:timesheets="clr-namespace:comal.timesheets"
              x:Class="comal.timesheets.StocktakePage"
              Title="Stock Take">
 

+ 1 - 1
prs.mobile/comal.timesheets/Modules/Warehousing/Transfer/RecTrans.xaml

@@ -3,7 +3,7 @@
              xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
              x:Class="comal.timesheets.RecTrans"
              xmlns:material="clr-namespace:XF.Material.Forms.UI;assembly=XF.Material" xmlns:extensions="http://xamarin.com/schemas/2020/toolkit"
-             xmlns:timesheets="clr-namespace:comal.timesheets;assembly=comal.timesheets.Android"
+             xmlns:timesheets="clr-namespace:comal.timesheets"
              material:MaterialNavigationPage.AppBarColor="#a2006d"
              Title="Transfer Stock"
              >