STN Asset Movements and Berthings.

This commit is contained in:
Andy Howard
2019-08-15 18:40:02 +01:00
parent 3e25524057
commit a9047daf8a
75 changed files with 1050 additions and 498 deletions
@@ -64,6 +64,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Mobile\Droid\App\MainActivity.cs" /> <Compile Include="Mobile\Droid\App\MainActivity.cs" />
<Compile Include="Mobile\Droid\Forms\Views\SlmWebViewRenderer.cs" />
<Compile Include="Resources\Resource.designer.cs" /> <Compile Include="Resources\Resource.designer.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup> </ItemGroup>
@@ -0,0 +1,67 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Sarand.Core.Base;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android;
[assembly: ExportRenderer(typeof(WebView), typeof(Sarand.LogisticsMgr.Mobile.Droid.Forms.Views.SlmWebViewRenderer))]
namespace Sarand.LogisticsMgr.Mobile.Droid.Forms.Views
{
//=======================================================================
/// <summary>
/// Rerplacement Web View Renderer to enable/override default behaviour.
/// <para>1. Enable scrcolling within Scroll View etc.</para>
/// <para>Ref. https://forums.xamarin.com/discussion/54365/android-enabling-scrolling-for-a-webview-inside-a-scrollview</para>
/// </summary>
public class SlmWebViewRenderer : WebViewRenderer
{
//-------------------------------------------------------------------
// Construction.
public SlmWebViewRenderer (Context context) : base(context)
{
Logger.Trace(GetType().Name + " CTR");
}
//-------------------------------------------------------------------
protected override void OnElementChanged (ElementChangedEventArgs<WebView> e)
{
base.OnElementChanged(e);
if (e.OldElement != null)
{
Control.Touch -= Control_Touch;
}
if (e.NewElement != null)
{
Control.Touch += Control_Touch;
}
}
//-------------------------------------------------------------------
void Control_Touch (object sender, Android.Views.View.TouchEventArgs e)
{
// Executing this will prevent the Scrolling to be intercepted by parent views.
switch (e.Event.Action)
{
case MotionEventActions.Down:
Control.Parent.RequestDisallowInterceptTouchEvent(true);
break;
case MotionEventActions.Up:
Control.Parent.RequestDisallowInterceptTouchEvent(false);
break;
}
// Calling this will allow the scrolling event to be executed in the WebView.
Control.OnTouchEvent(e.Event);
}
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.2.1" package="LogisticsMgrMobile.LogisticsMgrMobile" android:installLocation="auto" android:versionCode="4" android:icon="@drawable/icon_solent_stevedores"> <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.2.2" package="LogisticsMgrMobile.LogisticsMgrMobile" android:installLocation="auto" android:versionCode="5" android:icon="@drawable/icon_solent_stevedores">
<uses-sdk android:minSdkVersion="27" android:targetSdkVersion="27" /> <uses-sdk android:minSdkVersion="27" android:targetSdkVersion="27" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
@@ -144,7 +144,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Xamarin.Essentials"> <PackageReference Include="Xamarin.Essentials">
<Version>1.1.0</Version> <Version>1.2.0</Version>
</PackageReference> </PackageReference>
<PackageReference Include="Xamarin.Forms" Version="3.6.0.344457" /> <PackageReference Include="Xamarin.Forms" Version="3.6.0.344457" />
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform" Version="6.2.8" /> <PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform" Version="6.2.8" />
@@ -2,37 +2,38 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>UIDeviceFamily</key> <key>UIDeviceFamily</key>
<array> <array>
<integer>1</integer> <integer>1</integer>
<integer>2</integer> <integer>2</integer>
</array> </array>
<key>UISupportedInterfaceOrientations</key> <key>UISupportedInterfaceOrientations</key>
<array> <array>
<string>UIInterfaceOrientationPortrait</string> <string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string> <string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeRight</string> <string>UIInterfaceOrientationLandscapeLeft</string>
</array> <string>UIInterfaceOrientationLandscapeRight</string>
<key>UISupportedInterfaceOrientations~ipad</key> </array>
<array> <key>UISupportedInterfaceOrientations~ipad</key>
<string>UIInterfaceOrientationPortrait</string> <array>
<string>UIInterfaceOrientationPortraitUpsideDown</string> <string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string> <string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeRight</string> <string>UIInterfaceOrientationLandscapeLeft</string>
</array> <string>UIInterfaceOrientationLandscapeRight</string>
<key>MinimumOSVersion</key> </array>
<string>8.0</string> <key>MinimumOSVersion</key>
<key>CFBundleDisplayName</key> <string>8.0</string>
<string>LogisticsMgrMobile</string> <key>CFBundleDisplayName</key>
<key>CFBundleIdentifier</key> <string>LogisticsMgrMobile</string>
<string>com.companyname.LogisticsMgrMobile</string> <key>CFBundleIdentifier</key>
<key>CFBundleVersion</key> <string>com.companyname.LogisticsMgrMobile</string>
<string>1.0</string> <key>CFBundleVersion</key>
<key>UILaunchStoryboardName</key> <string>1.0</string>
<string>LaunchScreen</string> <key>UILaunchStoryboardName</key>
<key>CFBundleName</key> <string>LaunchScreen</string>
<string>LogisticsMgrMobile</string> <key>CFBundleName</key>
<key>XSAppIconAssets</key> <string>LogisticsMgrMobile</string>
<string>Assets.xcassets/AppIcon.appiconset</string> <key>XSAppIconAssets</key>
<string>Assets.xcassets/AppIcon.appiconset</string>
</dict> </dict>
</plist> </plist>
@@ -89,6 +89,9 @@
<CodesignKey>iPhone Distribution</CodesignKey> <CodesignKey>iPhone Distribution</CodesignKey>
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements> <CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(RunConfiguration)' == 'Default' ">
<AppExtensionDebugBundleId />
</PropertyGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Main.cs" /> <Compile Include="Main.cs" />
<Compile Include="AppDelegate.cs" /> <Compile Include="AppDelegate.cs" />
@@ -149,7 +152,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Xamarin.Essentials"> <PackageReference Include="Xamarin.Essentials">
<Version>1.1.0</Version> <Version>1.2.0</Version>
</PackageReference> </PackageReference>
<PackageReference Include="Xamarin.Forms" Version="3.6.0.344457" /> <PackageReference Include="Xamarin.Forms" Version="3.6.0.344457" />
</ItemGroup> </ItemGroup>
@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LogisticsMgrMobile.iOS")] [assembly: AssemblyProduct("LogisticsMgrMobile.iOS")]
[assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyCopyright("Copyright © Sarand 2014-2019")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
@@ -11,7 +11,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Xamarin.Essentials" Version="1.1.0" /> <PackageReference Include="Xamarin.Essentials" Version="1.2.0" />
<PackageReference Include="Xamarin.Forms" Version="3.6.0.344457" /> <PackageReference Include="Xamarin.Forms" Version="3.6.0.344457" />
</ItemGroup> </ItemGroup>
@@ -99,7 +99,8 @@ namespace Sarand.LogisticsMgr.Mobile.App
sites.Add(new SlmSiteDefinition_App(Slm.Site.Southampton, "STN [IP4 int]", "http://10.1.4.13:34567/SaLogMgr")); sites.Add(new SlmSiteDefinition_App(Slm.Site.Southampton, "STN [IP4 int]", "http://10.1.4.13:34567/SaLogMgr"));
sites.Add(new SlmSiteDefinition_App(Slm.Site.Southampton, "STN [IP6 int]", "http://[fe80:f4c9:7720:45d8:f1b0]:34567/SaLogMgr")); sites.Add(new SlmSiteDefinition_App(Slm.Site.Southampton, "STN [IP6 int]", "http://[fe80:f4c9:7720:45d8:f1b0]:34567/SaLogMgr"));
sites.Add(new SlmSiteDefinition_App(Slm.Site.Southampton, "STN - dev [403-IP6]", "http://[2a00:23c4:1b29:cc00:f14f:66b9:c098:242d]:34567/SaLogMgr")); sites.Add(new SlmSiteDefinition_App(Slm.Site.Southampton, "STN - dev [403-IP6]", "http://[2a00:23c4:1b29:cc00:f14f:66b9:c098:242d]:34567/SaLogMgr"));
if (false/*allowLgp*/) bool allowLgp = false;
if (allowLgp)
{ {
sites.Add(new SlmSiteDefinition_App(Slm.Site.LondonGateway, "LGP", "http://SS-APP-LG1:34568/SaLogMgr")); sites.Add(new SlmSiteDefinition_App(Slm.Site.LondonGateway, "LGP", "http://SS-APP-LG1:34568/SaLogMgr"));
sites.Add(new SlmSiteDefinition_App(Slm.Site.LondonGateway, "LGP [IP4 int]", "http://10.1.20.12:34568/SaLogMgr")); sites.Add(new SlmSiteDefinition_App(Slm.Site.LondonGateway, "LGP [IP4 int]", "http://10.1.20.12:34568/SaLogMgr"));
@@ -1,10 +1,6 @@
using Sarand.Core.Base; using Sarand.Core.Base;
using Sarand.Core.Mobile.Forms.Controls;
using Sarand.LogisticsMgr.Core.App;
using Sarand.LogisticsMgr.Mobile.Core.App; using Sarand.LogisticsMgr.Mobile.Core.App;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; using Sarand.LogisticsMgr.Mobile.Core.Forms.Panels;
using Sarand.LogisticsMgr.Mobile.Forms.Components;
using Sarand.LogisticsMgr.Mobile.Forms.Pages.Forms.Assets;
using Sarand.LogisticsMgr.Mobile.Forms.Pages.Templates; using Sarand.LogisticsMgr.Mobile.Forms.Pages.Templates;
using Sarand.LogisticsMgr.Mobile.Forms.Panels.Main; using Sarand.LogisticsMgr.Mobile.Forms.Panels.Main;
using Sarand.LogisticsMgr.Mobile.Forms.Panels.Main.Assets; using Sarand.LogisticsMgr.Mobile.Forms.Panels.Main.Assets;
@@ -1,11 +1,9 @@
using Sarand.Core.Base; using Sarand.Core.Base;
using Sarand.Core.Mobile.Forms.Utils;
using Sarand.LogisticsMgr.Core.App; using Sarand.LogisticsMgr.Core.App;
using Sarand.LogisticsMgr.Core.Bus; using Sarand.LogisticsMgr.Core.Bus;
using Sarand.LogisticsMgr.Mobile.App;
using Sarand.LogisticsMgr.Mobile.Core.App; using Sarand.LogisticsMgr.Mobile.Core.App;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; using Sarand.LogisticsMgr.Mobile.Core.Forms.Base;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Controls; using Sarand.LogisticsMgr.Mobile.Core.Forms.ControlViews;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
@@ -89,11 +87,15 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Components.Assets
public void PopulateToControls (SlmContainer.Data data) public void PopulateToControls (SlmContainer.Data data)
{ {
EntryAssetCode.Text = data.Code; EntryAssetCode.Text = data.Code;
if (!StringUtil.IsEmpty(data.SizeCode) && !PickerAssetSize.ContainsCode(data.SizeCode))
PickerAssetSize.AddItem(data.SizeCode, data.SizeCode);
PickerAssetSize.SelectedCode= data.SizeCode; PickerAssetSize.SelectedCode= data.SizeCode;
Changed = false; Changed = false;
} }
public void PopulateToControls (SlmAssetMovement.Data data) public void PopulateToControls (SlmAssetMovement.Data data)
{ {
if (!StringUtil.IsEmpty(data.AssetSizeCode) && !PickerAssetSize.ContainsCode(data.AssetSizeCode))
PickerAssetSize.AddItem(data.AssetSizeCode, data.AssetSizeCode);
PickerAssetSize.SelectedCode = data.AssetSizeCode; PickerAssetSize.SelectedCode = data.AssetSizeCode;
PickerMovementType.SelectedCode = movementTypes.GetCodeForType((int)data.MovementType); PickerMovementType.SelectedCode = movementTypes.GetCodeForType((int)data.MovementType);
EntryReference.Text = data.MovementRef; EntryReference.Text = data.MovementRef;
@@ -2,10 +2,9 @@
using Sarand.Core.Mobile.Forms.Utils; using Sarand.Core.Mobile.Forms.Utils;
using Sarand.LogisticsMgr.Core.App; using Sarand.LogisticsMgr.Core.App;
using Sarand.LogisticsMgr.Core.Bus; using Sarand.LogisticsMgr.Core.Bus;
using Sarand.LogisticsMgr.Mobile.App;
using Sarand.LogisticsMgr.Mobile.Core.App; using Sarand.LogisticsMgr.Mobile.Core.App;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; using Sarand.LogisticsMgr.Mobile.Core.Forms.Base;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Controls; using Sarand.LogisticsMgr.Mobile.Core.Forms.ControlViews;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
@@ -1,7 +1,7 @@
using Sarand.LogisticsMgr.Core.App; using Sarand.LogisticsMgr.Core.App;
using Sarand.LogisticsMgr.Core.Bus; using Sarand.LogisticsMgr.Core.Bus;
using Sarand.LogisticsMgr.Mobile.Core.App;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; using Sarand.LogisticsMgr.Mobile.Core.Forms.Base;
using Sarand.LogisticsMgr.Mobile.Core.Forms.ControlViews;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
@@ -2,9 +2,8 @@
using Sarand.Core.Mobile.Forms.Controls; using Sarand.Core.Mobile.Forms.Controls;
using Sarand.LogisticsMgr.Core.App; using Sarand.LogisticsMgr.Core.App;
using Sarand.LogisticsMgr.Core.Bus; using Sarand.LogisticsMgr.Core.Bus;
using Sarand.LogisticsMgr.Mobile.Core.App;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; using Sarand.LogisticsMgr.Mobile.Core.Forms.Base;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Controls; using Sarand.LogisticsMgr.Mobile.Core.Forms.ControlViews;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
@@ -1,10 +1,7 @@
using Sarand.Core.Base; using Sarand.LogisticsMgr.Core.Bus;
using Sarand.LogisticsMgr.Core.App;
using Sarand.LogisticsMgr.Core.Bus;
using Sarand.LogisticsMgr.Mobile.App;
using Sarand.LogisticsMgr.Mobile.Core.App; using Sarand.LogisticsMgr.Mobile.Core.App;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; using Sarand.LogisticsMgr.Mobile.Core.Forms.Base;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Controls; using Sarand.LogisticsMgr.Mobile.Core.Forms.ControlViews;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
@@ -28,6 +25,7 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Components.Bulk
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Properties. // Properties.
// Controls.
// Vessel. // Vessel.
public SlmPickerView PickerVessel { get; } = new SlmPickerView() { LabelText = "Vessel", ReadOnly = true }; public SlmPickerView PickerVessel { get; } = new SlmPickerView() { LabelText = "Vessel", ReadOnly = true };
// Berthing. // Berthing.
@@ -63,6 +61,12 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Components.Bulk
} }
public void PopulateToControls (SlmBerthing.Data data) public void PopulateToControls (SlmBerthing.Data data)
{ {
// Vessel.
PickerVessel.SelectedItemId = data.VesselId;
// Companies.
PickerAgent.SelectedItemId = data.CompanyIdAgent;
PickerCustomer.SelectedItemId = data.CompanyIdCustomer;
// Common properties.
EditorNotes.Text = data.Notes; EditorNotes.Text = data.Notes;
Changed = false; Changed = false;
} }
@@ -1,9 +1,10 @@
using Sarand.Core.Base; using Sarand.Core.Base;
using Sarand.Core.Mobile.Tasks;
using Sarand.LogisticsMgr.Core.App; using Sarand.LogisticsMgr.Core.App;
using Sarand.LogisticsMgr.Core.Bus; using Sarand.LogisticsMgr.Core.Bus;
using Sarand.LogisticsMgr.Mobile.Core.App; using Sarand.LogisticsMgr.Mobile.Core.App;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; using Sarand.LogisticsMgr.Mobile.Core.Forms.Base;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Controls; using Sarand.LogisticsMgr.Mobile.Core.Forms.ControlViews;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
@@ -21,7 +22,7 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Components.Bulk
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Construction. // Construction.
public SlmComponents_BerthingTask() public SlmComponents_BerthingTask ()
{ {
berthingTaskTypes = SlmSystem.GetCodesOfType(Slm.SystemCode.BerthingTaskType); berthingTaskTypes = SlmSystem.GetCodesOfType(Slm.SystemCode.BerthingTaskType);
InitialiseComponents(); InitialiseComponents();
@@ -31,8 +32,8 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Components.Bulk
// Properties. // Properties.
// Controls. // Controls.
public SlmPickerView_SystemCodes PickerTaskType { get; } = new SlmPickerView_SystemCodes(Slm.SystemCode.BerthingTaskType) { LabelText = "Task type" }; public SlmPickerView_SystemCodes PickerTaskType { get; } = new SlmPickerView_SystemCodes(Slm.SystemCode.BerthingTaskType) { LabelText = "Task type" };
public SlmDatePickerView DatePickerStarted { get; } = new SlmDatePickerView() { LabelText = "Started" }; public SlmDateTimePickerView DatePickerStarted { get; } = new SlmDateTimePickerView() { LabelText = "Started" };
public SlmDatePickerView DatePickerCompleted { get; } = new SlmDatePickerView() { LabelText = "Completed" }; public SlmDateTimePickerView DatePickerCompleted { get; } = new SlmDateTimePickerView() { LabelText = "Completed" };
public SlmEditorView EntryRemarks { get; } = new SlmEditorView() { LabelText = "Remarks" }; public SlmEditorView EntryRemarks { get; } = new SlmEditorView() { LabelText = "Remarks" };
//------------------------------------------------------------------- //-------------------------------------------------------------------
@@ -43,7 +44,13 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Components.Bulk
//------------------------------------------------------------------- //-------------------------------------------------------------------
private void InitialiseComponents () private void InitialiseComponents ()
{ {
// Filename. // Started.
DatePickerStarted.DateTime = DateUtil.RoundTime(DateTime.Now, 15, DateUtil.RoundingDirection.Nearest);
// Completed.
DatePickerCompleted.DateTime = DateUtil.RoundTime(DateTime.Now, 15, DateUtil.RoundingDirection.Nearest);
// Remarks.
EntryRemarks.MaxLength = (int)SlmDbDfn.GetColTextLen(SlmDbDfn.ColumnIdx.BerthingTask_Remarks); EntryRemarks.MaxLength = (int)SlmDbDfn.GetColTextLen(SlmDbDfn.ColumnIdx.BerthingTask_Remarks);
EntryRemarks.TextChanged += EntryRemarks_TextChanged; EntryRemarks.TextChanged += EntryRemarks_TextChanged;
EntryRemarks.Completed += EntryRemarks_Completed; EntryRemarks.Completed += EntryRemarks_Completed;
@@ -57,21 +64,37 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Components.Bulk
public void PopulateToControls (SlmBerthingTask.Data data) public void PopulateToControls (SlmBerthingTask.Data data)
{ {
PickerTaskType.SelectedCode = berthingTaskTypes.GetCodeForType((int)data.BerthingTaskType); PickerTaskType.SelectedCode = berthingTaskTypes.GetCodeForType((int)data.BerthingTaskType);
DatePickerStarted.Date = data.Started; DatePickerStarted.DateTime = data.Started;
DatePickerCompleted.Date = data.Completed; DatePickerCompleted.DateTime = data.Completed;
EntryRemarks.Text = data.Remarks; EntryRemarks.Text = data.Remarks;
Changed = false; Changed = false;
} }
public bool IsDataValid (SlmBerthingTask.Data data) public bool IsDataValid (SlmBerthingTask.Data data)
{ {
if ((int)data.BerthingTaskType < 1)
{
DisplayAlert("Berthing Task", "Task type must be selected.", "OK");
//EntryRemarks.Focus();
return false;
}
if (StringUtil.IsEmpty(data.Remarks))
{
DisplayAlert("Berthing Task", "Remarks must be entered.", "OK");
//EntryRemarks.Focus();
return false;
}
return true; return true;
} }
public void PopulateFromControls (SlmBerthingTask.Data data) public void PopulateFromControls (SlmBerthingTask.Data data)
{ {
data.BerthingTaskType = (Slm.BerthingTaskType)berthingTaskTypes.GetTypeForCode(PickerTaskType.SelectedCode); if (PickerTaskType.Parent != null && PickerTaskType.IsVisible && !PickerTaskType.ReadOnly)
data.Started = DatePickerStarted.Date; data.BerthingTaskType = (Slm.BerthingTaskType)berthingTaskTypes.GetTypeForCode(PickerTaskType.SelectedCode);
data.Completed = DatePickerCompleted.Date; if (DatePickerStarted.Parent != null && DatePickerStarted.IsVisible && !DatePickerStarted.ReadOnly)
data.Remarks = EntryRemarks.Text; data.Started = DatePickerStarted.DateTime;
if (DatePickerCompleted.Parent != null && DatePickerCompleted.IsVisible && !DatePickerCompleted.ReadOnly)
data.Completed = DatePickerCompleted.DateTime;
if (EntryRemarks.Parent != null && EntryRemarks.IsVisible && !EntryRemarks.ReadOnly)
data.Remarks = EntryRemarks.Text;
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
@@ -1,9 +1,8 @@
using Sarand.Core.Base; using Sarand.Core.Base;
using Sarand.LogisticsMgr.Core.App;
using Sarand.LogisticsMgr.Mobile.App;
using Sarand.LogisticsMgr.Mobile.Core.App; using Sarand.LogisticsMgr.Mobile.Core.App;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; using Sarand.LogisticsMgr.Mobile.Core.Forms.Base;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Controls; using Sarand.LogisticsMgr.Mobile.Core.Forms.Controls;
using Sarand.LogisticsMgr.Mobile.Core.Forms.ControlViews;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
@@ -1,9 +1,8 @@
using Sarand.Core.Base; using Sarand.Core.Base;
using Sarand.LogisticsMgr.Core.App;
using Sarand.LogisticsMgr.Mobile.App;
using Sarand.LogisticsMgr.Mobile.Core.App; using Sarand.LogisticsMgr.Mobile.Core.App;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; using Sarand.LogisticsMgr.Mobile.Core.Forms.Base;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Controls; using Sarand.LogisticsMgr.Mobile.Core.Forms.Controls;
using Sarand.LogisticsMgr.Mobile.Core.Forms.ControlViews;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
@@ -1,11 +1,10 @@
using Sarand.Core.Base; using Sarand.Core.Base;
using Sarand.Core.Net;
using Sarand.LogisticsMgr.Core.App; using Sarand.LogisticsMgr.Core.App;
using Sarand.LogisticsMgr.Core.Data; using Sarand.LogisticsMgr.Core.Data;
using Sarand.LogisticsMgr.Core.WebService; using Sarand.LogisticsMgr.Core.WebService;
using Sarand.LogisticsMgr.Mobile.App;
using Sarand.LogisticsMgr.Mobile.Core.App; using Sarand.LogisticsMgr.Mobile.Core.App;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; using Sarand.LogisticsMgr.Mobile.Core.Forms.Pages;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Views;
using Sarand.LogisticsMgr.Mobile.Forms.Components; using Sarand.LogisticsMgr.Mobile.Forms.Components;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -1,6 +1,8 @@
using Sarand.Core.Base; using Sarand.Core.Base;
using Sarand.LogisticsMgr.Mobile.Core.App; using Sarand.LogisticsMgr.Mobile.Core.App;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; using Sarand.LogisticsMgr.Mobile.Core.Forms.Controls;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Pages;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Views;
using System.Collections.Generic; using System.Collections.Generic;
using Xamarin.Essentials; using Xamarin.Essentials;
using Xamarin.Forms; using Xamarin.Forms;
@@ -4,7 +4,10 @@ using Sarand.Core.Bus;
using Sarand.Core.Tasks; using Sarand.Core.Tasks;
using Sarand.LogisticsMgr.Core.App; using Sarand.LogisticsMgr.Core.App;
using Sarand.LogisticsMgr.Core.Bus; using Sarand.LogisticsMgr.Core.Bus;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; using Sarand.LogisticsMgr.Mobile.Core.App;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Controls;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Pages;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Views;
using Sarand.LogisticsMgr.Mobile.Forms.Components.Assets; using Sarand.LogisticsMgr.Mobile.Forms.Components.Assets;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -148,46 +151,48 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Pages.Forms.Assets
{ {
// Asset Repair form. // Asset Repair form.
FormBodyView.Content = gridProperties; FormBodyView.Content = gridProperties;
gridProperties.RowSpacing = SlmMobile.FormGridRowSpacing;
gridProperties.ColumnSpacing = SlmMobile.FormGridColumnSpacing;
gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto }); gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto });
gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Star }); gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Star });
gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto }); gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto });
//--------------------------------------------------------------- //---------------------------------------------------------------
// Asset. // Asset.
AddControlViewToGrid(gridProperties, assetMovementComponents.EntryAssetCode); gridProperties.AddControlViewToGrid(assetMovementComponents.EntryAssetCode);
AddControlViewToGrid(gridProperties, assetMovementComponents.PickerAssetSize); gridProperties.AddControlViewToGrid(assetMovementComponents.PickerAssetSize);
// Movement. // Movement.
AddControlViewToGrid(gridProperties, assetMovementComponents.PickerMovementType); gridProperties.AddControlViewToGrid(assetMovementComponents.PickerMovementType);
AddControlViewToGrid(gridProperties, assetMovementComponents.EntryReference); gridProperties.AddControlViewToGrid(assetMovementComponents.EntryReference);
AddControlViewToGrid(gridProperties, assetMovementComponents.DatePickerMovementDate); gridProperties.AddControlViewToGrid(assetMovementComponents.DatePickerMovementDate);
// Customer. // Customer.
AddControlViewToGrid(gridProperties, assetMovementComponents.EntryCustomer); gridProperties.AddControlViewToGrid(assetMovementComponents.EntryCustomer);
AddControlViewToGrid(gridProperties, assetMovementComponents.EntryCustomerReference); gridProperties.AddControlViewToGrid(assetMovementComponents.EntryCustomerReference);
// Location. // Location.
AddControlViewToGrid(gridProperties, assetMovementComponents.EntryLocationStart); gridProperties.AddControlViewToGrid(assetMovementComponents.EntryLocationStart);
AddControlViewToGrid(gridProperties, assetMovementComponents.EntryLocationCurrent); gridProperties.AddControlViewToGrid(assetMovementComponents.EntryLocationCurrent);
AddControlViewToGrid(gridProperties, assetMovementComponents.EntryLocationFinish); gridProperties.AddControlViewToGrid(assetMovementComponents.EntryLocationFinish);
// Haulier & Registration. // Haulier & Registration.
AddControlViewToGrid(gridProperties, assetMovementComponents.EntryHaulierInitial); gridProperties.AddControlViewToGrid(assetMovementComponents.EntryHaulierInitial);
AddControlViewToGrid(gridProperties, assetMovementComponents.EntryRegistrationInitial); gridProperties.AddControlViewToGrid(assetMovementComponents.EntryRegistrationInitial);
AddControlViewToGrid(gridProperties, assetMovementComponents.EntryHaulierFinal); gridProperties.AddControlViewToGrid(assetMovementComponents.EntryHaulierFinal);
AddControlViewToGrid(gridProperties, assetMovementComponents.EntryRegistrationFinal); gridProperties.AddControlViewToGrid(assetMovementComponents.EntryRegistrationFinal);
// Numbers. // Numbers.
AddControlViewToGrid(gridProperties, assetMovementComponents.EntryPinNumber); gridProperties.AddControlViewToGrid(assetMovementComponents.EntryPinNumber);
AddControlViewToGrid(gridProperties, assetMovementComponents.EntrySealNumber); gridProperties.AddControlViewToGrid(assetMovementComponents.EntrySealNumber);
// Status. // Status.
AddControlViewToGrid(gridProperties, assetMovementComponents.EntryStatus); gridProperties.AddControlViewToGrid(assetMovementComponents.EntryStatus);
AddControlViewToGrid(gridProperties, assetMovementComponents.DatePickerInProgressDate); gridProperties.AddControlViewToGrid(assetMovementComponents.DatePickerInProgressDate);
AddControlViewToGrid(gridProperties, assetMovementComponents.DatePickerCompletedDate); gridProperties.AddControlViewToGrid(assetMovementComponents.DatePickerCompletedDate);
// Notes. // Notes.
AddControlViewToGrid(gridProperties, assetMovementComponents.EditorNotes); gridProperties.AddControlViewToGrid(assetMovementComponents.EditorNotes);
//--------------------------------------------------------------- //---------------------------------------------------------------
// Populate properties to components. // Populate properties to components.
@@ -6,7 +6,9 @@ using Sarand.Core.Xml;
using Sarand.LogisticsMgr.Core.App; using Sarand.LogisticsMgr.Core.App;
using Sarand.LogisticsMgr.Core.Bus; using Sarand.LogisticsMgr.Core.Bus;
using Sarand.LogisticsMgr.Core.WebService; using Sarand.LogisticsMgr.Core.WebService;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; using Sarand.LogisticsMgr.Mobile.Core.App;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Pages;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Views;
using Sarand.LogisticsMgr.Mobile.Forms.Components.Assets; using Sarand.LogisticsMgr.Mobile.Forms.Components.Assets;
using Sarand.LogisticsMgr.Mobile.Forms.Panels.Assets; using Sarand.LogisticsMgr.Mobile.Forms.Panels.Assets;
using System; using System;
@@ -66,18 +68,20 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Pages.Forms.Assets
{ {
// Asset Repair form. // Asset Repair form.
FormBodyView.Content = gridProperties; FormBodyView.Content = gridProperties;
gridProperties.RowSpacing = SlmMobile.FormGridRowSpacing;
gridProperties.ColumnSpacing = SlmMobile.FormGridColumnSpacing;
gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto }); gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto });
gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Star }); gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Star });
gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto }); gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto });
int rowIdx = -1; int rowIdx = -1;
// Shipping line company. // Shipping line company.
AddControlViewToGrid(gridProperties, assetRepairComponents.PickerCompany); gridProperties.AddControlViewToGrid(assetRepairComponents.PickerCompany);
assetRepairComponents.PickerCompany.Populated += PickerCompany_Populated; assetRepairComponents.PickerCompany.Populated += PickerCompany_Populated;
assetRepairComponents.PickerCompany.SelectedIndexChanged += PickerCompany_SelectedIndexChanged; assetRepairComponents.PickerCompany.SelectedIndexChanged += PickerCompany_SelectedIndexChanged;
// Asset code. // Asset code.
AddControlViewToGrid(gridProperties, assetRepairComponents.EntryAssetCode); gridProperties.AddControlViewToGrid(assetRepairComponents.EntryAssetCode);
assetRepairComponents.EntryAssetCode.TextChanged += EntryAssetCode_TextChanged; assetRepairComponents.EntryAssetCode.TextChanged += EntryAssetCode_TextChanged;
assetRepairComponents.EntryAssetCode.Completed += EntryAssetCode_Completed; assetRepairComponents.EntryAssetCode.Completed += EntryAssetCode_Completed;
@@ -97,13 +101,13 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Pages.Forms.Assets
assetSearchResultsWebView.AssetMovementSelected += AssetSearchResultsWebView_AssetMovementSelected; assetSearchResultsWebView.AssetMovementSelected += AssetSearchResultsWebView_AssetMovementSelected;
// Asset Size. // Asset Size.
AddControlViewToGrid(gridProperties, assetRepairComponents.PickerAssetSize); gridProperties.AddControlViewToGrid(assetRepairComponents.PickerAssetSize);
// Repair Narrative. // Repair Narrative.
AddControlViewToGrid(gridProperties, assetRepairComponents.EntryRepairNarrative); gridProperties.AddControlViewToGrid(assetRepairComponents.EntryRepairNarrative);
// Repair Inspector. // Repair Inspector.
AddControlViewToGrid(gridProperties, assetRepairComponents.EntryRepairInspector); gridProperties.AddControlViewToGrid(assetRepairComponents.EntryRepairInspector);
// Jobs panel. // Jobs panel.
SlmPanel_AssetRepair_Jobs.Config jobsPanelConfig = new SlmPanel_AssetRepair_Jobs.Config(); SlmPanel_AssetRepair_Jobs.Config jobsPanelConfig = new SlmPanel_AssetRepair_Jobs.Config();
@@ -1,12 +1,9 @@
using Sarand.Core.Base; using Sarand.Core.Bus;
using Sarand.Core.Bus;
using Sarand.Core.Tasks;
using Sarand.LogisticsMgr.Core.App;
using Sarand.LogisticsMgr.Core.Bus; using Sarand.LogisticsMgr.Core.Bus;
using Sarand.LogisticsMgr.Core.WebService; using Sarand.LogisticsMgr.Mobile.Core.App;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; using Sarand.LogisticsMgr.Mobile.Core.Forms.Pages;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Views;
using Sarand.LogisticsMgr.Mobile.Forms.Components.Assets; using Sarand.LogisticsMgr.Mobile.Forms.Components.Assets;
using Sarand.LogisticsMgr.Mobile.Forms.Panels.Assets;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@@ -59,14 +56,15 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Pages.Forms.Assets
{ {
// Asset Repair form. // Asset Repair form.
FormBodyView.Content = gridProperties; FormBodyView.Content = gridProperties;
gridProperties.RowSpacing = SlmMobile.FormGridRowSpacing;
gridProperties.ColumnSpacing = SlmMobile.FormGridColumnSpacing;
gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto }); gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto });
gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto }); gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto });
gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Star }); gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Star });
gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto }); gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto });
int rowIdx = -1;
// Filename. // Filename.
AddControlViewToGrid(gridProperties, repairImageComponents.EntryFilename); gridProperties.AddControlViewToGrid(repairImageComponents.EntryFilename);
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
@@ -1,12 +1,10 @@
using Sarand.Core.Base; using Sarand.Core.Base;
using Sarand.Core.Bus; using Sarand.Core.Bus;
using Sarand.Core.Tasks;
using Sarand.LogisticsMgr.Core.App;
using Sarand.LogisticsMgr.Core.Bus; using Sarand.LogisticsMgr.Core.Bus;
using Sarand.LogisticsMgr.Core.WebService; using Sarand.LogisticsMgr.Mobile.Core.App;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; using Sarand.LogisticsMgr.Mobile.Core.Forms.Pages;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Views;
using Sarand.LogisticsMgr.Mobile.Forms.Components.Assets; using Sarand.LogisticsMgr.Mobile.Forms.Components.Assets;
using Sarand.LogisticsMgr.Mobile.Forms.Panels.Assets;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@@ -63,6 +61,8 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Pages.Forms.Assets
{ {
// Asset Repair form. // Asset Repair form.
FormBodyView.Content = gridProperties; FormBodyView.Content = gridProperties;
gridProperties.RowSpacing = SlmMobile.FormGridRowSpacing;
gridProperties.ColumnSpacing = SlmMobile.FormGridColumnSpacing;
gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto }); gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto });
gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto }); gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto });
gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Star }); gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Star });
@@ -102,7 +102,7 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Pages.Forms.Assets
Grid.SetColumnSpan(repairJobComponents.PickerRepair, 2); Grid.SetColumnSpan(repairJobComponents.PickerRepair, 2);
// Quantity. // Quantity.
AddControlViewToGrid(gridProperties, repairJobComponents.EntryQuantity); gridProperties.AddControlViewToGrid(repairJobComponents.EntryQuantity);
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
@@ -4,8 +4,13 @@ using Sarand.Core.Bus;
using Sarand.Core.Tasks; using Sarand.Core.Tasks;
using Sarand.LogisticsMgr.Core.Bus; using Sarand.LogisticsMgr.Core.Bus;
using Sarand.LogisticsMgr.Core.WebService; using Sarand.LogisticsMgr.Core.WebService;
using Sarand.LogisticsMgr.Mobile.Core.App;
using Sarand.LogisticsMgr.Mobile.Core.Bus; using Sarand.LogisticsMgr.Mobile.Core.Bus;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; using Sarand.LogisticsMgr.Mobile.Core.Forms.Controls;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Layouts;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Pages;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Panels;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Views;
using Sarand.LogisticsMgr.Mobile.Forms.Components.Bulk; using Sarand.LogisticsMgr.Mobile.Forms.Components.Bulk;
using Sarand.LogisticsMgr.Mobile.Forms.Panels.Bulk; using Sarand.LogisticsMgr.Mobile.Forms.Panels.Bulk;
using System; using System;
@@ -29,9 +34,10 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Pages.Forms.Bulk
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Data members. // Data members.
private readonly Config config; private readonly Config config;
private SlmGrid gridProperties = new SlmGrid(); // Components.
private SlmComponents_Berthing berthingComponents = new SlmComponents_Berthing(); private SlmStackLayout panelLayout = new SlmStackLayout() { Orientation = StackOrientation.Vertical };
private SlmPanel_Bulk_BerthingTasks berthingTasksPanel; private SlmPanel_PropertySummary panelPropertySummary = new SlmPanel_PropertySummary();
private SlmTabControl tabbedView = new SlmTabControl();
// Data to view/update. // Data to view/update.
private SlmBerthing BerthingToUpdate; private SlmBerthing BerthingToUpdate;
private SlmVessel Berthing_Vessel; private SlmVessel Berthing_Vessel;
@@ -45,10 +51,6 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Pages.Forms.Bulk
this.config = config; this.config = config;
Title = "Bulk - Berthing"; Title = "Bulk - Berthing";
AddMode = !SysId.IsValid(config.BerthingIdToUpdate); AddMode = !SysId.IsValid(config.BerthingIdToUpdate);
if (config.ReadOnly)
{
berthingComponents.ReadOnly = true;
}
PrepareFormData(); PrepareFormData();
} }
@@ -78,7 +80,7 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Pages.Forms.Bulk
catch (Exception exc) catch (Exception exc)
{ {
if (SacsSystem.DebugMode) Logger.Warn(fn + " " + ExceptionUtil.GetLogMessage(exc)); if (SacsSystem.DebugMode) Logger.Warn(fn + " " + ExceptionUtil.GetLogMessage(exc));
CloseFormWithAlert(nameof(exc)+" on form initialisation.\n\n"+exc.Message); CloseFormWithAlert(nameof(exc) + " on form initialisation.\n\n" + exc.Message);
} }
}, taskDataPrepareData.CancellationToken) }, taskDataPrepareData.CancellationToken)
.ContinueWith(task => .ContinueWith(task =>
@@ -173,41 +175,50 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Pages.Forms.Bulk
private void InitialiseComponents () private void InitialiseComponents ()
{ {
// Asset Repair form. // Asset Repair form.
gridProperties.BackgroundColor = Color.Transparent; FormBodyView.Content = panelLayout;
FormBodyView.Content = gridProperties;
gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto });
gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Star });
gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto });
//--------------------------------------------------------------- // Summary Preopeties panel.
// Vessel. panelPropertySummary.BorderColor = SlmMobile.ItemListHeaderBorderColor;
AddControlViewToGrid(gridProperties, berthingComponents.PickerVessel); panelPropertySummary.PanelBackgroundColor = SlmMobile.ItemListHeaderBackgroundColor;
panelPropertySummary.FontSize = panelPropertySummary.DefaultFontSize * SlmMobile.FontSizeRatio;
panelPropertySummary.ClearProperties();
panelPropertySummary.AddProperty("Vessel", Berthing_Vessel?.Name ?? "");
panelPropertySummary.AddProperty("Agent", Berthing_Company_Agent?.Name ?? "");
panelPropertySummary.AddProperty("Customer", Berthing_Company_Customer?.Name ?? "");
panelLayout.Children.Add(panelPropertySummary);
// Companies. // Tabbed panel.
AddControlViewToGrid(gridProperties, berthingComponents.PickerAgent); tabbedView.HeaderFontSize = tabbedView.DefaultHeaderFontSize * SlmMobile.FontSizeRatio;
AddControlViewToGrid(gridProperties, berthingComponents.PickerCustomer); tabbedView.HeaderBackgroundColor = SlmMobile.TabControlHeaderBackgroundColor;
tabbedView.CaptionBackgroundColor = SlmMobile.TabControlCaptionBackgroundColor;
tabbedView.BodyBackgroundColor = SlmMobile.TabControlBodyBackgroundColor;
panelLayout.Children.Add(tabbedView);
// Notes. // Initialise tabbed panels.
AddControlViewToGrid(gridProperties, berthingComponents.EditorNotes); InitTabs();
// Tasks panel.
SlmPanel_Bulk_BerthingTasks.Config berthingTasksPanelConfig = new SlmPanel_Bulk_BerthingTasks.Config();
berthingTasksPanelConfig.BerthingForm = this;
berthingTasksPanel = new SlmPanel_Bulk_BerthingTasks(berthingTasksPanelConfig);
int rowIdx = gridProperties.RowDefinitions.Count;
gridProperties.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
gridProperties.Children.Add(berthingTasksPanel, 0, rowIdx);
Grid.SetColumnSpan(berthingTasksPanel, 3);
//---------------------------------------------------------------
// Populate properties to components.
berthingComponents.PopulateToControls(Berthing_Vessel?.GetData() ?? new SlmVessel.Data());
berthingComponents.PopulateToControls(BerthingToUpdate?.GetData() ?? new SlmBerthing.Data());
// Complete page configuration. // Complete page configuration.
SetControlActivity(); SetControlActivity();
Changed = false; Changed = false;
} }
private void InitTabs ()
{
// Berthing panel.
SlmPanel_Berthing.Config configBerthing = new SlmPanel_Berthing.Config();
configBerthing.BerthingToUpdate = BerthingToUpdate;
configBerthing.Berthing_Vessel = Berthing_Vessel;
configBerthing.Berthing_Company_Agent = Berthing_Company_Agent;
configBerthing.Berthing_Company_Customer = Berthing_Company_Customer;
configBerthing.ReadOnly = true;
SlmPanel_Berthing panelBerthing = new SlmPanel_Berthing(configBerthing);
tabbedView.AddPanel("Berthing", panelBerthing);
// Tasks panel.
SlmPanel_Bulk_BerthingTasks.Config berthingTasksPanelConfig = new SlmPanel_Bulk_BerthingTasks.Config();
berthingTasksPanelConfig.BerthingForm = this;
SlmPanel_Bulk_BerthingTasks berthingTasksPanel = new SlmPanel_Bulk_BerthingTasks(berthingTasksPanelConfig);
tabbedView.AddPanel("Tasks", berthingTasksPanel);
}
//------------------------------------------------------------------- //-------------------------------------------------------------------
// C o n t r o l A c t i v i t y // C o n t r o l A c t i v i t y
@@ -1,8 +1,8 @@
using Sarand.Core.Base; using Sarand.Core.Bus;
using Sarand.Core.Bus;
using Sarand.Core.Tasks;
using Sarand.LogisticsMgr.Core.Bus; using Sarand.LogisticsMgr.Core.Bus;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; using Sarand.LogisticsMgr.Mobile.Core.App;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Pages;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Views;
using Sarand.LogisticsMgr.Mobile.Forms.Components.Bulk; using Sarand.LogisticsMgr.Mobile.Forms.Components.Bulk;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -56,16 +56,18 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Pages.Forms.Bulk
{ {
// Asset Repair form. // Asset Repair form.
FormBodyView.Content = gridProperties; FormBodyView.Content = gridProperties;
gridProperties.RowSpacing = SlmMobile.FormGridRowSpacing;
gridProperties.ColumnSpacing = SlmMobile.FormGridColumnSpacing;
gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto }); gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto });
gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto }); gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto });
gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Star }); gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Star });
gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto }); gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto });
// Controls. // Controls.
AddControlViewToGrid(gridProperties, berthingTaskComponents.PickerTaskType); gridProperties.AddControlViewToGrid(berthingTaskComponents.PickerTaskType);
AddControlViewToGrid(gridProperties, berthingTaskComponents.DatePickerStarted); gridProperties.AddControlViewToGrid(berthingTaskComponents.DatePickerStarted);
AddControlViewToGrid(gridProperties, berthingTaskComponents.DatePickerCompleted); //gridProperties.AddControlViewToGrid(berthingTaskComponents.DatePickerCompleted);
AddControlViewToGrid(gridProperties, berthingTaskComponents.EntryRemarks); gridProperties.AddControlViewToGrid(berthingTaskComponents.EntryRemarks);
if (AddMode) if (AddMode)
{ {
@@ -1,7 +1,5 @@
using Sarand.Core.App; using Sarand.Core.App;
using Sarand.Core.Base; using Sarand.Core.Base;
using Sarand.LogisticsMgr.Mobile.App;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Base;
using Sarand.LogisticsMgr.Mobile.Forms.Views; using Sarand.LogisticsMgr.Mobile.Forms.Views;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -13,6 +11,8 @@ using System.Text;
using Xamarin.Forms; using Xamarin.Forms;
using Sarand.LogisticsMgr.Mobile.Core.App; using Sarand.LogisticsMgr.Mobile.Core.App;
using Sarand.Core.Mobile.Utils; using Sarand.Core.Mobile.Utils;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Pages;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Views;
namespace Sarand.LogisticsMgr.Mobile.Forms.Pages.Templates namespace Sarand.LogisticsMgr.Mobile.Forms.Pages.Templates
{ {
@@ -4,7 +4,7 @@ using Sarand.Core.Tasks;
using Sarand.LogisticsMgr.Core.App; using Sarand.LogisticsMgr.Core.App;
using Sarand.LogisticsMgr.Core.Bus; using Sarand.LogisticsMgr.Core.Bus;
using Sarand.LogisticsMgr.Core.WebService; using Sarand.LogisticsMgr.Core.WebService;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; using Sarand.LogisticsMgr.Mobile.Core.Forms.Views;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
@@ -1,6 +1,7 @@
using Sarand.LogisticsMgr.Core.Bus; using Sarand.LogisticsMgr.Core.Bus;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; using Sarand.LogisticsMgr.Mobile.Core.Forms.Controls;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Panels; using Sarand.LogisticsMgr.Mobile.Core.Forms.Panels;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Views;
using Sarand.LogisticsMgr.Mobile.Forms.Pages.Forms.Assets; using Sarand.LogisticsMgr.Mobile.Forms.Pages.Forms.Assets;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -1,8 +1,9 @@
using Sarand.Core.App; using Sarand.Core.App;
using Sarand.Core.Mobile.Utils; using Sarand.Core.Mobile.Utils;
using Sarand.LogisticsMgr.Core.Bus; using Sarand.LogisticsMgr.Core.Bus;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; using Sarand.LogisticsMgr.Mobile.Core.Forms.Controls;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Panels; using Sarand.LogisticsMgr.Mobile.Core.Forms.Panels;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Views;
using Sarand.LogisticsMgr.Mobile.Forms.Pages.Forms.Assets; using Sarand.LogisticsMgr.Mobile.Forms.Pages.Forms.Assets;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -0,0 +1,89 @@
using Sarand.Core.Bus;
using Sarand.LogisticsMgr.Core.Bus;
using Sarand.LogisticsMgr.Mobile.Core.App;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Panels;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Views;
using Sarand.LogisticsMgr.Mobile.Forms.Components.Bulk;
using System;
using System.Collections.Generic;
using System.Text;
using Xamarin.Forms;
namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Bulk
{
//=======================================================================
public class SlmPanel_Berthing : SlmPanel_ItemProperties
{
//-------------------------------------------------------------------
// Definitions.
public new class Config : SlmPanel_ItemProperties.Config
{
// Data to view/update.
public SlmBerthing BerthingToUpdate;
public SlmVessel Berthing_Vessel;
public SlmCompany Berthing_Company_Agent;
public SlmCompany Berthing_Company_Customer;
}
//-------------------------------------------------------------------
// Data members.
private Config config;
// Components.
private SlmGrid gridProperties = new SlmGrid();
private SlmComponents_Berthing berthingComponents = new SlmComponents_Berthing();
//-------------------------------------------------------------------
// Construction.
public SlmPanel_Berthing (Config config) : base(config)
{
this.config = config;
AddMode = config.BerthingToUpdate != null && !SysId.IsValid(config.BerthingToUpdate.Id);
if (config.ReadOnly)
{
berthingComponents.ReadOnly = true;
}
InitialiseComponents();
}
//-------------------------------------------------------------------
// I n i t i a l i s e
//-------------------------------------------------------------------
private void InitialiseComponents ()
{
// Properties grid.
Content = gridProperties;
gridProperties.RowSpacing = SlmMobile.FormGridRowSpacing;
gridProperties.ColumnSpacing = SlmMobile.FormGridColumnSpacing;
gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto });
gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Star });
gridProperties.ColumnDefinitions.Add(new ColumnDefinition { Width = GridLength.Auto });
//---------------------------------------------------------------
// Vessel.
gridProperties.AddControlViewToGrid(berthingComponents.PickerVessel);
// Companies.
gridProperties.AddControlViewToGrid(berthingComponents.PickerAgent);
gridProperties.AddControlViewToGrid(berthingComponents.PickerCustomer);
// Notes.
gridProperties.AddControlViewToGrid(berthingComponents.EditorNotes);
//---------------------------------------------------------------
// Populate vessel and companies to pickers if not already present.
if (config.Berthing_Vessel != null && !berthingComponents.PickerVessel.ContainsId(config.Berthing_Vessel.Id))
berthingComponents.PickerVessel.AddItem(config.Berthing_Vessel.Id, config.Berthing_Vessel.Name);
if (config.Berthing_Company_Agent != null && !berthingComponents.PickerAgent.ContainsId(config.Berthing_Company_Agent.Id))
berthingComponents.PickerAgent.AddItem(config.Berthing_Company_Agent.Id, config.Berthing_Company_Agent.Name);
if (config.Berthing_Company_Customer != null && !berthingComponents.PickerCustomer.ContainsId(config.Berthing_Company_Customer.Id))
berthingComponents.PickerCustomer.AddItem(config.Berthing_Company_Customer.Id, config.Berthing_Company_Customer.Name);
// Populate properties to components.
berthingComponents.PopulateToControls(config.Berthing_Vessel?.GetData() ?? new SlmVessel.Data());
berthingComponents.PopulateToControls(config.BerthingToUpdate?.GetData() ?? new SlmBerthing.Data());
}
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -2,15 +2,20 @@
using Sarand.Core.Base; using Sarand.Core.Base;
using Sarand.Core.Bus; using Sarand.Core.Bus;
using Sarand.Core.Mobile.Forms.Controls; using Sarand.Core.Mobile.Forms.Controls;
using Sarand.Core.Mobile.Forms.Panels;
using Sarand.Core.Tasks; using Sarand.Core.Tasks;
using Sarand.LogisticsMgr.Core.App; using Sarand.LogisticsMgr.Core.App;
using Sarand.LogisticsMgr.Core.Bus; using Sarand.LogisticsMgr.Core.Bus;
using Sarand.LogisticsMgr.Core.WebService; using Sarand.LogisticsMgr.Core.WebService;
using Sarand.LogisticsMgr.Mobile.Core.App; using Sarand.LogisticsMgr.Mobile.Core.App;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; using Sarand.LogisticsMgr.Mobile.Core.Forms.Base;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Controls;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Layouts;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Panels; using Sarand.LogisticsMgr.Mobile.Core.Forms.Panels;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Views;
using Sarand.LogisticsMgr.Mobile.Forms.Pages.Forms.Assets; using Sarand.LogisticsMgr.Mobile.Forms.Pages.Forms.Assets;
using Sarand.LogisticsMgr.Mobile.Forms.Pages.Forms.Bulk; using Sarand.LogisticsMgr.Mobile.Forms.Pages.Forms.Bulk;
using Sarand.LogisticsMgr.Mobile.Forms.Panels.Main;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
@@ -20,11 +25,11 @@ using Xamarin.Forms;
namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Bulk namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Bulk
{ {
//======================================================================= //=======================================================================
public class SlmPanel_Bulk_BerthingTasks : SlmPanel_AssociatedItems public class SlmPanel_Bulk_BerthingTasks : SlmPanel
{ {
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Definitions. // Definitions.
public new class Config : SlmPanel_AssociatedItems.Config public new class Config : SlmPanel.Config
{ {
public SlmFormPage_Bulk_Berthing BerthingForm { get; set; } public SlmFormPage_Bulk_Berthing BerthingForm { get; set; }
} }
@@ -34,8 +39,9 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Bulk
private Config config; private Config config;
private readonly List<TypeCodeDesc> berthingTaskTypes; private readonly List<TypeCodeDesc> berthingTaskTypes;
private List<SlmBerthingTask.Data> berthingTaskDataList = new List<SlmBerthingTask.Data>(); private List<SlmBerthingTask.Data> berthingTaskDataList = new List<SlmBerthingTask.Data>();
private SlmLabel labelSummary = new SlmLabel(); // Components.
//private SlmGrid gridDetails = new SlmGrid(); private SlmStackLayout panelLayout = new SlmStackLayout() { Orientation = StackOrientation.Vertical };
private SaxPanel_ItemListSummary panelSummary = new SaxPanel_ItemListSummary();
private SlmWebView webViewDetails = new SlmWebView(); private SlmWebView webViewDetails = new SlmWebView();
private String berthingTaskUpdatePrefix = "BthTskUpdate_"; private String berthingTaskUpdatePrefix = "BthTskUpdate_";
@@ -52,6 +58,7 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Bulk
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Properties. // Properties.
public String MessageCaption { get; } = "Berthing Tasks";
public List<SlmBerthingTask.Data> BerthingTasks { get { return new List<SlmBerthingTask.Data>(berthingTaskDataList); } } public List<SlmBerthingTask.Data> BerthingTasks { get { return new List<SlmBerthingTask.Data>(berthingTaskDataList); } }
//------------------------------------------------------------------- //-------------------------------------------------------------------
@@ -59,17 +66,23 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Bulk
//------------------------------------------------------------------- //-------------------------------------------------------------------
private void InitialiseComponents () private void InitialiseComponents ()
{ {
Caption = "Berthing Tasks"; // Main layout - vertical stack.
VerticalOptions = LayoutOptions.Fill;
panelLayout.VerticalOptions = LayoutOptions.Fill;
Content = panelLayout;
// Summary panel. // Messages panel.
labelSummary.HorizontalOptions = LayoutOptions.FillAndExpand; panelSummary.ShowAddButton = !config.ReadOnly;
SummaryPanel.Content = labelSummary; panelSummary.AddClicked += PanelSummary_AddClicked;
panelSummary.MessageFontSize = panelSummary.DefaultMessageFontSize * SlmMobile.FontSizeRatio;
panelLayout.Children.Add(panelSummary);
// Details panel. // Berthing Task list component.
webViewDetails.HorizontalOptions = LayoutOptions.StartAndExpand; webViewDetails.HorizontalOptions = LayoutOptions.Fill;
webViewDetails.VerticalOptions = LayoutOptions.StartAndExpand; webViewDetails.VerticalOptions = LayoutOptions.FillAndExpand;
webViewDetails.AppNavigating += WebViewDetails_AppNavigating; webViewDetails.AppNavigating += WebViewDetails_AppNavigating;
DetailsPanel.Content = webViewDetails; webViewDetails.MinimumHeightRequest = 120;
panelLayout.Children.Add(webViewDetails);
RefreshPanels(); RefreshPanels();
} }
@@ -91,7 +104,10 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Bulk
catch (Exception exc) catch (Exception exc)
{ {
if (SacsSystem.DebugMode) Logger.Warn(fn + " " + ExceptionUtil.GetLogMessage(exc)); if (SacsSystem.DebugMode) Logger.Warn(fn + " " + ExceptionUtil.GetLogMessage(exc));
ErrorStateMessage = nameof(exc) + " on population - " + exc.Message; Device.BeginInvokeOnMainThread(() =>
{
panelSummary.SetMessage(nameof(exc) + " on population - " + exc.Message, SaMessageLevel.Exception);
});
} }
}, taskDataPrepareData.CancellationToken) }, taskDataPrepareData.CancellationToken)
.ContinueWith(task => .ContinueWith(task =>
@@ -138,32 +154,29 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Bulk
//------------------------------------------------------------------- //-------------------------------------------------------------------
private void RefreshSummaryPanel () private void RefreshSummaryPanel ()
{ {
panelSummary.ClearMessage();
if (berthingTaskDataList.Count == 0) if (berthingTaskDataList.Count == 0)
labelSummary.Text = "No tasks defined"; panelSummary.SetMessage(new SacsMessage("No tasks defined"));
else if (berthingTaskDataList.Count == 1) else if (berthingTaskDataList.Count == 1)
labelSummary.Text = "1 task defined"; panelSummary.SetMessage(new SacsMessage("1 task defined"));
else else
labelSummary.Text = berthingTaskDataList.Count + " tasks defined"; panelSummary.SetMessage(new SacsMessage(berthingTaskDataList.Count + " tasks defined"));
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
private void RefreshDetailsPanel () private void RefreshDetailsPanel ()
{ {
List<String> html = new List<string>(); List<String> html = new List<string>();
html.Add("<html><head>" + GetItemListStyles().Concat("\n") + GetItemListScripts().Concat("\n") + "</head><body>"); html.Add("<html><head>" + GetBerthingTaskListStyles().Concat("\n") + GetBerthingTaskListScripts().Concat("\n") + "</head><body>");
foreach (SlmBerthingTask.Data item in berthingTaskDataList) foreach (SlmBerthingTask.Data item in berthingTaskDataList)
{ {
html.Add("<div id='BthTsk-" + SysId.ToString(item.Id) + "' class='item' ondblclick='slm.openBerthingTask(" + SysId.ToString(item.Id) + ")'>"); html.Add("<div id='BthTsk-" + SysId.ToString(item.Id) + "' class='item' ondblclick='slm.openBerthingTask(" + SysId.ToString(item.Id) + ")'>");
html.Add("<table class='fullwidth'>"); html.Add("<table class='fullwidth'>");
html.Add(" <tr>"); html.Add(" <tr>");
html.Add(" <td class='label'>Started</td><td class='value'>" + DateUtil.Format(item.Started, "ddd d-MMM-yyyy HH:mm") + "</td>");
html.Add(" <td class='label'>Type</td><td class='value'>" + berthingTaskTypes.GetDescForType((int)item.BerthingTaskType) + "</td>"); html.Add(" <td class='label'>Type</td><td class='value'>" + berthingTaskTypes.GetDescForType((int)item.BerthingTaskType) + "</td>");
html.Add(" <td class='label'>Status</td><td class='value'>" + SacsSystem.GetStatusDesc(item.Status) + "</td>");
html.Add(" </tr>"); html.Add(" </tr>");
html.Add(" <tr>"); html.Add(" <tr>");
html.Add(" <td class='label'>Started</td><td class='value'>" + DateUtil.Format(item.Started, "ddd d-MMM-yyyy") + "</td>"); html.Add(" <td class='label'>Remarks</td><td class='value' colspan='3'>" + item.Remarks.ReplaceAll("\n", "<br/>") + "</td>");
html.Add(" <td class='label'>Completed</td><td class='value'>" + DateUtil.Format(item.Completed, "ddd d-MMM-yyyy") + "</td>");
html.Add(" </tr>");
html.Add(" <tr>");
html.Add(" <td class='label'>Arrived</td><td class='value' colspan='3'>" + item.Remarks.ReplaceAll("\n","<br/>") + "</td>");
html.Add(" </tr>"); html.Add(" </tr>");
if (SacsSystem.DebugMode) if (SacsSystem.DebugMode)
{ {
@@ -178,29 +191,19 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Bulk
html.Add("</body></html>"); html.Add("</body></html>");
webViewDetails.Html = html.Concat("\n"); webViewDetails.Html = html.Concat("\n");
} }
private List<String> GetItemListStyles () private List<String> GetBerthingTaskListStyles ()
{ {
return new List<string>() List<string> styles = new List<string>(SlmMainPanel_ItemList.GetItemListBaseStyles());
styles.AddRange(new String[]
{ {
"<style>" + SlmResourceConsole.GetTextResource(SlmResourceConsole.TextResource.JQueryUiCss) + "</style>", });
"<style>" + SlmResourceConsole.GetTextResource(SlmResourceConsole.TextResource.SaBaseCss) + "</style>", return styles;
"<style>" + SlmResourceConsole.GetTextResource(SlmResourceConsole.TextResource.SlmBaseCss) + "</style>",
"<style>",
"body{padding:4px;font-size:" + SlmMobile.HtmlFontSize + ";border:1px solid #808080;border-radius:8px;overflow-y:auto;}",
"td{padding:2px;}",
"tr.other th, tr.other td{background-color:#f0f0f0;}",
"div.item{margin:0 0 4px 0;padding:4px;background-color:#f8f8f8;border:2px solid #808080;border-radius:8px;}",
"</style>"
};
} }
private List<String> GetItemListScripts () private List<String> GetBerthingTaskListScripts ()
{ {
return new List<string>() List<string> scripts = new List<string>(SlmMainPanel_ItemList.GetItemListBaseScripts());
scripts.AddRange(new String[]
{ {
"<script>" + SlmResourceConsole.GetTextResource(SlmResourceConsole.TextResource.JQueryJs) + "</script>",
"<script>" + SlmResourceConsole.GetTextResource(SlmResourceConsole.TextResource.JQueryUiJs) + "</script>",
"<script>" + SlmResourceConsole.GetTextResource(SlmResourceConsole.TextResource.SaBaseJs) + "</script>",
"<script>" + SlmResourceConsole.GetTextResource(SlmResourceConsole.TextResource.SlmBaseJs) + "</script>",
"<script>", "<script>",
"slm.openBerthingTask=function(id)", "slm.openBerthingTask=function(id)",
"{", "{",
@@ -212,13 +215,14 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Bulk
" ", " ",
"});", "});",
"</script>" "</script>"
}; });
return scripts;
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
// P a n e l E v e n t s // P a n e l E v e n t s
//------------------------------------------------------------------- //-------------------------------------------------------------------
protected override void ButtonAddItem_Clicked (object sender, EventArgs e) private void PanelSummary_AddClicked (object sender, EventArgs e)
{ {
SlmFormPage_Bulk_BerthingTask.Config formConfig = new SlmFormPage_Bulk_BerthingTask.Config(config.BerthingForm.BerthingId); SlmFormPage_Bulk_BerthingTask.Config formConfig = new SlmFormPage_Bulk_BerthingTask.Config(config.BerthingForm.BerthingId);
SlmFormPage_Bulk_BerthingTask berthingTaskForm = new SlmFormPage_Bulk_BerthingTask(formConfig); SlmFormPage_Bulk_BerthingTask berthingTaskForm = new SlmFormPage_Bulk_BerthingTask(formConfig);
@@ -231,7 +235,6 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Bulk
{ {
berthingTaskDataList.Add(berthingTaskData); berthingTaskDataList.Add(berthingTaskData);
RefreshPanels(); RefreshPanels();
DropDown();
} }
} }
}; };
@@ -247,13 +250,13 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Bulk
SysId berthingTaskId = new SysId(StringUtil.ToInt(eventArgs.AppAction.Right(eventArgs.AppAction.Length - berthingTaskUpdatePrefix.Length))); SysId berthingTaskId = new SysId(StringUtil.ToInt(eventArgs.AppAction.Right(eventArgs.AppAction.Length - berthingTaskUpdatePrefix.Length)));
if (!SysId.IsValid(berthingTaskId)) if (!SysId.IsValid(berthingTaskId))
{ {
DisplayAlert(Caption, "Invalid berthing task selected.", "OK"); DisplayAlert(MessageCaption, "Invalid berthing task selected.", "OK");
return; return;
} }
SlmBerthingTask.Data berthingTaskData = berthingTaskDataList.Find(item => item.Id.Equals(berthingTaskId)); SlmBerthingTask.Data berthingTaskData = berthingTaskDataList.Find(item => item.Id.Equals(berthingTaskId));
if (!SysId.IsValid(berthingTaskId)) if (!SysId.IsValid(berthingTaskId))
{ {
DisplayAlert(Caption, "Failed to retrieve berthing task.", "OK"); DisplayAlert(MessageCaption, "Failed to retrieve berthing task.", "OK");
return; return;
} }
@@ -267,7 +270,6 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Bulk
{ {
berthingTaskDataList.Add(berthingTaskData); berthingTaskDataList.Add(berthingTaskData);
RefreshPanels(); RefreshPanels();
DropDown();
} }
}; };
Application.Current.MainPage.Navigation.PushModalAsync(berthingTaskForm, false); Application.Current.MainPage.Navigation.PushModalAsync(berthingTaskForm, false);
@@ -8,6 +8,7 @@ using Sarand.LogisticsMgr.Core.App;
using Sarand.LogisticsMgr.Core.Bus; using Sarand.LogisticsMgr.Core.Bus;
using Sarand.LogisticsMgr.Core.WebService; using Sarand.LogisticsMgr.Core.WebService;
using Sarand.LogisticsMgr.Mobile.Core.App; using Sarand.LogisticsMgr.Mobile.Core.App;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Pages;
using Sarand.LogisticsMgr.Mobile.Forms.Pages.Forms.Assets; using Sarand.LogisticsMgr.Mobile.Forms.Pages.Forms.Assets;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -197,6 +198,21 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Main.Assets
configRequest.Context.Debug = SacsSystem.DebugMode; configRequest.Context.Debug = SacsSystem.DebugMode;
// Filter. // Filter.
Dictionary<String, String> filter = AssetMgr.GetAssetMovementQueryFilter_Mobile(assetMovementParams); Dictionary<String, String> filter = AssetMgr.GetAssetMovementQueryFilter_Mobile(assetMovementParams);
//---------------------------------------------------
// ToDo Temporary fix to list all containers if up to 100
// so that entire train is listed rather than having to page through results.
configRequest.RequestType = SlmWebServiceRequest.RequestType.Count;
SlmWebServiceClient.ItemCountResponseData itemCountResponseData = await new SlmWebServiceClient().RequestItemCount(configRequest, filter, taskDataRefreshList_Local);
if (itemCountResponseData.ItemCount <= 100)
{
// Clear paging and refresh filter.
assetMovementParams.ResultsPaging.PageNo = 1;
assetMovementParams.ResultsPaging.PageLength = (ushort)itemCountResponseData.ItemCount;
filter = AssetMgr.GetAssetMovementQueryFilter_Mobile(assetMovementParams);
}
//---------------------------------------------------
// Columns. // Columns.
List<String> queryColumns = new List<String>() List<String> queryColumns = new List<String>()
{ {
@@ -220,6 +236,7 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Main.Assets
}; };
// Request User profile. // Request User profile.
if (SacsSystem.DebugMode) Logger.Debug(fn + " Querying data - START"); if (SacsSystem.DebugMode) Logger.Debug(fn + " Querying data - START");
configRequest.RequestType = SlmWebServiceRequest.RequestType.QueryList;
SlmWebServiceClient.QueryListResponseData responseData = SlmWebServiceClient.QueryListResponseData responseData =
await new SlmWebServiceClient().RequestQueryList(configRequest, filter, queryColumns, taskDataRefreshList_Local); await new SlmWebServiceClient().RequestQueryList(configRequest, filter, queryColumns, taskDataRefreshList_Local);
if (SacsSystem.DebugMode) Logger.Debug(fn + " Querying data - END Items: " + (responseData?.Items.Count.ToString() ?? "None") + (taskDataRefreshList_Local.IsCancellationRequested ? " [Cancelled]" : "")); if (SacsSystem.DebugMode) Logger.Debug(fn + " Querying data - END Items: " + (responseData?.Items.Count.ToString() ?? "None") + (taskDataRefreshList_Local.IsCancellationRequested ? " [Cancelled]" : ""));
@@ -239,6 +256,7 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Main.Assets
taskDataRefreshList = null; taskDataRefreshList = null;
}); });
if (SacsSystem.DebugMode) Logger.Debug(fn + " Timer method complete."); if (SacsSystem.DebugMode) Logger.Debug(fn + " Timer method complete.");
// Kill timer with false response.
return false; return false;
}); });
} }
@@ -248,10 +266,10 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Main.Assets
{ {
// Refresh paging properties. // Refresh paging properties.
if (responseData != null) if (responseData != null)
HeaderPanel.SetPaging(responseData.PageNo, responseData.PageLength, responseData.Total); HeaderPanel.SetPaging(responseData.PageNo, responseData.PageLength, responseData.Total > 0 ? responseData.Total : responseData.Count);
else HeaderPanel.SetPaging(0, 0, 0); else HeaderPanel.SetPaging(0, 0, 0);
// Construct item list HTML. // Construct item list HTML.
string html = "<html><head>"+GetItemListStyles().Concat("\n")+GetItemListScripts().Concat("\n")+"</head><body>"; string html = "<html><head>"+GetAssetMovementListStyles().Concat("\n")+GetAssetMovementListScripts().Concat("\n")+"</head><body>";
if (message != null) if (message != null)
{ {
String messageClass = "inf"; String messageClass = "inf";
@@ -277,8 +295,9 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Main.Assets
{ {
html += "<div id='AssMov-" + SysId.ToString(item.GetIdValue(cols.Id.DataName)) + "' class='item' ondblclick='slm.openAssetMovement(" + SysId.ToString(item.GetIdValue(cols.Id.DataName)) + ")'>"; html += "<div id='AssMov-" + SysId.ToString(item.GetIdValue(cols.Id.DataName)) + "' class='item' ondblclick='slm.openAssetMovement(" + SysId.ToString(item.GetIdValue(cols.Id.DataName)) + ")'>";
html += "<table class='fullwidth'>"; html += "<table class='fullwidth'>";
html += " <tr><td style='width:10%'></td><td style='width:40%'></td><td style='width:10%'></td><td style='width:40%'></td></tr>";
html += " <tr>"; html += " <tr>";
html += " <td class='label'>Container</td><td class='value bold'>" + item.GetValue(cols.Asset_Code.DataName) + "</td>"; html += " <td class='label pt2'>Container</td><td class='value caption'>" + item.GetValue(cols.Asset_Code.DataName) + "</td>";
html += " <td class='label'>Size</td><td class='value'>" + item.GetValue(cols.AssetSizeCode.DataName) + "</td>"; html += " <td class='label'>Size</td><td class='value'>" + item.GetValue(cols.AssetSizeCode.DataName) + "</td>";
html += " </tr>"; html += " </tr>";
html += " <tr>"; html += " <tr>";
@@ -309,29 +328,19 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Main.Assets
ItemListWebView.Html = html; ItemListWebView.Html = html;
//Logger.Debug("HTML: " + html); //Logger.Debug("HTML: " + html);
} }
private List<String> GetItemListStyles () private List<String> GetAssetMovementListStyles ()
{ {
return new List<string>() List<string> styles = new List<string>(GetItemListBaseStyles());
styles.AddRange(new String[]
{ {
"<style>" + SlmResourceConsole.GetTextResource(SlmResourceConsole.TextResource.JQueryUiCss) + "</style>", });
"<style>" + SlmResourceConsole.GetTextResource(SlmResourceConsole.TextResource.SaBaseCss) + "</style>", return styles;
"<style>" + SlmResourceConsole.GetTextResource(SlmResourceConsole.TextResource.SlmBaseCss) + "</style>",
"<style>",
"body{padding:4px;font-size:" + SlmMobile.HtmlFontSize + ";border:1px solid #808080;border-radius:8px;overflow-y:auto;}",
"td{padding:2px;}",
"tr.other th, tr.other td{background-color:#f0f0f0;}",
"div.item{margin:0 0 4px 0;padding:4px;background-color:#f8f8f8;border:2px solid #808080;border-radius:8px;}",
"</style>"
};
} }
private List<String> GetItemListScripts () private List<String> GetAssetMovementListScripts ()
{ {
return new List<string>() List<string> scripts = new List<string>(GetItemListBaseScripts());
scripts.AddRange(new String[]
{ {
"<script>" + SlmResourceConsole.GetTextResource(SlmResourceConsole.TextResource.JQueryJs) + "</script>",
"<script>" + SlmResourceConsole.GetTextResource(SlmResourceConsole.TextResource.JQueryUiJs) + "</script>",
"<script>" + SlmResourceConsole.GetTextResource(SlmResourceConsole.TextResource.SaBaseJs) + "</script>",
"<script>" + SlmResourceConsole.GetTextResource(SlmResourceConsole.TextResource.SlmBaseJs) + "</script>",
"<script>", "<script>",
"slm.openAssetMovement=function(id)", "slm.openAssetMovement=function(id)",
"{", "{",
@@ -343,7 +352,8 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Main.Assets
" ", " ",
"});", "});",
"</script>" "</script>"
}; });
return scripts;
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
@@ -368,7 +378,7 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Main.Assets
SlmFormPage_Assets_Movement.Config pageConfig = new SlmFormPage_Assets_Movement.Config(); SlmFormPage_Assets_Movement.Config pageConfig = new SlmFormPage_Assets_Movement.Config();
pageConfig.AssetMovementIdToUpdate = assetMovementId; pageConfig.AssetMovementIdToUpdate = assetMovementId;
pageConfig.ReadOnly = true; pageConfig.ReadOnly = true;
if (pageConfig.ReadOnly) pageConfig.NavigationMode = Core.Forms.Base.SlmFormPage.NavigationMode.Close; if (pageConfig.ReadOnly) pageConfig.NavigationMode = SlmFormPage.NavigationMode.Close;
SlmFormPage_Assets_Movement assetRepairForm = new SlmFormPage_Assets_Movement (pageConfig); SlmFormPage_Assets_Movement assetRepairForm = new SlmFormPage_Assets_Movement (pageConfig);
//assetRepairForm.Disappearing += (sender2, e2) => { }; //assetRepairForm.Disappearing += (sender2, e2) => { };
SlmGlobals_Mobile.Application.MainPage.Navigation.PushModalAsync(assetRepairForm, false); SlmGlobals_Mobile.Application.MainPage.Navigation.PushModalAsync(assetRepairForm, false);
@@ -9,6 +9,7 @@ using Sarand.LogisticsMgr.Core.Bus;
using Sarand.LogisticsMgr.Core.WebService; using Sarand.LogisticsMgr.Core.WebService;
using Sarand.LogisticsMgr.Mobile.Core.App; using Sarand.LogisticsMgr.Mobile.Core.App;
using Sarand.LogisticsMgr.Mobile.Core.Bus; using Sarand.LogisticsMgr.Mobile.Core.Bus;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Pages;
using Sarand.LogisticsMgr.Mobile.Forms.Pages.Forms.Bulk; using Sarand.LogisticsMgr.Mobile.Forms.Pages.Forms.Bulk;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -239,6 +240,7 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Main.Bulk
taskDataRefreshList = null; taskDataRefreshList = null;
}); });
if (SacsSystem.DebugMode) Logger.Debug(fn + " Timer method complete."); if (SacsSystem.DebugMode) Logger.Debug(fn + " Timer method complete.");
// Kill timer with false response.
return false; return false;
}); });
} }
@@ -248,10 +250,10 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Main.Bulk
{ {
// Refresh paging properties. // Refresh paging properties.
if (responseData != null) if (responseData != null)
HeaderPanel.SetPaging(responseData.PageNo, responseData.PageLength, responseData.Total); HeaderPanel.SetPaging(responseData.PageNo, responseData.PageLength, responseData.Total > 0 ? responseData.Total : responseData.Count);
else HeaderPanel.SetPaging(0, 0, 0); else HeaderPanel.SetPaging(0, 0, 0);
// Construct item list HTML. // Construct item list HTML.
string html = "<html><head>"+GetItemListStyles().Concat("\n")+GetItemListScripts().Concat("\n")+"</head><body>"; string html = "<html><head>"+GetBerthingListStyles().Concat("\n")+GetBerthingListScripts().Concat("\n")+"</head><body>";
if (message != null) if (message != null)
{ {
String messageClass = "inf"; String messageClass = "inf";
@@ -277,9 +279,9 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Main.Bulk
{ {
html += "<div id='Bth-" + SysId.ToString(item.GetIdValue(cols.Id.DataName)) + "' class='item' ondblclick='slm.openBerthing(" + SysId.ToString(item.GetIdValue(cols.Id.DataName)) + ")'>"; html += "<div id='Bth-" + SysId.ToString(item.GetIdValue(cols.Id.DataName)) + "' class='item' ondblclick='slm.openBerthing(" + SysId.ToString(item.GetIdValue(cols.Id.DataName)) + ")'>";
html += "<table class='fullwidth'>"; html += "<table class='fullwidth'>";
html += " <tr><td style='width:10%'></td><td style='width:40%'></td><td style='width:10%'></td><td style='width:40%'></td></tr>";
html += " <tr>"; html += " <tr>";
html += " <td class='label'>Vessel</td><td class='value bold'>" + item.GetValue(cols.VesselName.DataName) + "</td>"; html += " <td class='label pt2'>Vessel</td><td class='value caption' colspan='3'>" + item.GetValue(cols.VesselName.DataName) + "</td>";
html += " <td class='label'></td><td class='value'>" + "</td>";
html += " </tr>"; html += " </tr>";
html += " <tr>"; html += " <tr>";
html += " <td class='label'>Customer</td><td class='value'>" + item.GetValue(cols.CustomerName.DataName) + "</td>"; html += " <td class='label'>Customer</td><td class='value'>" + item.GetValue(cols.CustomerName.DataName) + "</td>";
@@ -290,18 +292,23 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Main.Bulk
html += " <td class='label'>Bollard</td><td class='value'>" + item.GetValue(cols.Bollard.DataName) + "</td>"; html += " <td class='label'>Bollard</td><td class='value'>" + item.GetValue(cols.Bollard.DataName) + "</td>";
html += " </tr>"; html += " </tr>";
html += " <tr>"; html += " <tr>";
html += " <td class='label'>Arrived</td><td class='value'>" + DateUtil.Format(item.GetDateTimeValue(cols.Arrived.DataName), "ddd d-MMM-yyyy") + "</td>"; // Expected/Arrived.
SaStatus berthingStatus = SacsSystem.GetStatusForCode(item.GetValue(cols.Status.DataName)); DateTime expected = item.GetDateTimeValue(cols.Expected.DataName);
html += " <td class='label'>Status</td><td class='value'>" + SacsSystem.GetStatusDesc(berthingStatus) + "</td>"; DateTime arrived = item.GetDateTimeValue(cols.Arrived.DataName);
html += " </tr>"; if (DateUtil.IsValid(arrived))
html += " <tr>"; html += " <td class='label'>Arrived</td><td class='value'>" + DateUtil.Format(arrived, "ddd d-MMM-yyyy") + "</td>";
html += " <td class='label'>Completed</td><td class='value'>" + DateUtil.Format(item.GetDateTimeValue(cols.Completed.DataName), "ddd d-MMM-yyyy") + "</td>"; else html += " <td class='label'>Expected</td><td class='value'>" + DateUtil.Format(expected, "ddd d-MMM-yyyy") + "</td>";
html += " <td class='label'>Departed</td><td class='value'>" + DateUtil.Format(item.GetDateTimeValue(cols.Departed.DataName), "ddd d-MMM-yyyy") + "</td>";
html += " </tr>";
if (SacsSystem.DebugMode) if (SacsSystem.DebugMode)
html += " <td class='label'>Id</td><td class='value'>" + SysId.ToString(item.GetIdValue(cols.Id.DataName)) + "</td>";
html += " </tr>";
// Completed/Departed.
DateTime completed = item.GetDateTimeValue(cols.Completed.DataName);
DateTime departed = item.GetDateTimeValue(cols.Departed.DataName);
if (DateUtil.IsValid(completed))
{ {
html += " <tr>"; html += " <tr>";
html += " <td class='label'>Id</td><td class='value'>" + SysId.ToString(item.GetIdValue(cols.Id.DataName)) + "</td>"; html += " <td class='label'>Completed</td><td class='value'>" + DateUtil.Format(completed, "ddd d-MMM-yyyy") + "</td>";
html += " <td class='label'>Departed</td><td class='value'>" + DateUtil.Format(departed, "ddd d-MMM-yyyy") + "</td>";
html += " </tr>"; html += " </tr>";
} }
html += "</table>"; html += "</table>";
@@ -313,29 +320,19 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Main.Bulk
ItemListWebView.Html = html; ItemListWebView.Html = html;
//Logger.Debug("HTML: " + html); //Logger.Debug("HTML: " + html);
} }
private List<String> GetItemListStyles () private List<String> GetBerthingListStyles ()
{ {
return new List<string>() List<string> styles = new List<string>(GetItemListBaseStyles());
styles.AddRange(new String[]
{ {
"<style>" + SlmResourceConsole.GetTextResource(SlmResourceConsole.TextResource.JQueryUiCss) + "</style>", });
"<style>" + SlmResourceConsole.GetTextResource(SlmResourceConsole.TextResource.SaBaseCss) + "</style>", return styles;
"<style>" + SlmResourceConsole.GetTextResource(SlmResourceConsole.TextResource.SlmBaseCss) + "</style>",
"<style>",
"body{padding:4px;font-size:" + SlmMobile.HtmlFontSize + ";border:1px solid #808080;border-radius:8px;overflow-y:auto;}",
"td{padding:2px;}",
"tr.other th, tr.other td{background-color:#f0f0f0;}",
"div.item{margin:0 0 4px 0;padding:4px;background-color:#f8f8f8;border:2px solid #808080;border-radius:8px;}",
"</style>"
};
} }
private List<String> GetItemListScripts () private List<String> GetBerthingListScripts ()
{ {
return new List<string>() List<string> scripts = new List<string>(GetItemListBaseScripts());
scripts.AddRange(new String[]
{ {
"<script>" + SlmResourceConsole.GetTextResource(SlmResourceConsole.TextResource.JQueryJs) + "</script>",
"<script>" + SlmResourceConsole.GetTextResource(SlmResourceConsole.TextResource.JQueryUiJs) + "</script>",
"<script>" + SlmResourceConsole.GetTextResource(SlmResourceConsole.TextResource.SaBaseJs) + "</script>",
"<script>" + SlmResourceConsole.GetTextResource(SlmResourceConsole.TextResource.SlmBaseJs) + "</script>",
"<script>", "<script>",
"slm.openBerthing=function(id)", "slm.openBerthing=function(id)",
"{", "{",
@@ -347,7 +344,8 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Main.Bulk
" ", " ",
"});", "});",
"</script>" "</script>"
}; });
return scripts;
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
@@ -372,7 +370,7 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Main.Bulk
SlmFormPage_Bulk_Berthing.Config pageConfig = new SlmFormPage_Bulk_Berthing.Config(); SlmFormPage_Bulk_Berthing.Config pageConfig = new SlmFormPage_Bulk_Berthing.Config();
pageConfig.BerthingIdToUpdate = berthingId; pageConfig.BerthingIdToUpdate = berthingId;
pageConfig.ReadOnly = true; pageConfig.ReadOnly = true;
if (pageConfig.ReadOnly) pageConfig.NavigationMode = Core.Forms.Base.SlmFormPage.NavigationMode.Close; if (pageConfig.ReadOnly) pageConfig.NavigationMode = SlmFormPage.NavigationMode.Close;
SlmFormPage_Bulk_Berthing assetRepairForm = new SlmFormPage_Bulk_Berthing (pageConfig); SlmFormPage_Bulk_Berthing assetRepairForm = new SlmFormPage_Bulk_Berthing (pageConfig);
//assetRepairForm.Disappearing += (sender2, e2) => { }; //assetRepairForm.Disappearing += (sender2, e2) => { };
SlmGlobals_Mobile.Application.MainPage.Navigation.PushModalAsync(assetRepairForm, false); SlmGlobals_Mobile.Application.MainPage.Navigation.PushModalAsync(assetRepairForm, false);
@@ -1,6 +1,7 @@
using Sarand.Core.Mobile.Forms.Controls; using Sarand.Core.Mobile.Forms.Controls;
using Sarand.LogisticsMgr.Mobile.Core.App; using Sarand.LogisticsMgr.Mobile.Core.App;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; using Sarand.LogisticsMgr.Mobile.Core.Forms.Panels;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Views;
using Sarand.LogisticsMgr.Mobile.Forms.Components; using Sarand.LogisticsMgr.Mobile.Forms.Components;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -1,11 +1,11 @@
using Sarand.Core.Base; using Sarand.Core.Base;
using Sarand.Core.Mobile.Forms.Controls; using Sarand.Core.Mobile.Forms.Controls;
using Sarand.Core.Mobile.Forms.Panels; using Sarand.Core.Mobile.Forms.Panels;
using Sarand.LogisticsMgr.Core.App;
using Sarand.LogisticsMgr.Core.WebService; using Sarand.LogisticsMgr.Core.WebService;
using Sarand.LogisticsMgr.Mobile.Core.App; using Sarand.LogisticsMgr.Mobile.Core.App;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Base;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Panels; using Sarand.LogisticsMgr.Mobile.Core.Forms.Panels;
using Sarand.LogisticsMgr.Mobile.Forms.Components; using Sarand.LogisticsMgr.Mobile.Core.Forms.Views;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
@@ -97,6 +97,34 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Panels.Main
protected abstract void RefreshItemList (uint pageNo = 1); protected abstract void RefreshItemList (uint pageNo = 1);
protected abstract void DisplayItemList (SlmWebServiceClient.QueryListResponseData responseData, SacsMessage message = null); protected abstract void DisplayItemList (SlmWebServiceClient.QueryListResponseData responseData, SacsMessage message = null);
//-------------------------------------------------------------------
public static List<String> GetItemListBaseStyles ()
{
return new List<string>()
{
"<style>" + SlmResourceConsole.GetTextResource(SlmResourceConsole.TextResource.JQueryUiCss) + "</style>",
"<style>" + SlmResourceConsole.GetTextResource(SlmResourceConsole.TextResource.SaBaseCss) + "</style>",
"<style>" + SlmResourceConsole.GetTextResource(SlmResourceConsole.TextResource.SlmBaseCss) + "</style>",
"<style>",
"body{padding:4px;font-size:" + SlmMobile.HtmlFontSize + ";border:1px solid #808080;border-radius:8px;}",
"td{padding:0px;}",
"tr.other th, tr.other td{background-color:#f0f0f0;}",
"div.item{margin:0 0 4px 0;padding:4px;background-color:#f8f8f8;border:2px solid #808080;border-radius:7px;}",
"div.item .caption{font-weight:bold;font-size:1.2em;}",
"</style>"
};
}
public static List<String> GetItemListBaseScripts ()
{
return new List<string>()
{
"<script>" + SlmResourceConsole.GetTextResource(SlmResourceConsole.TextResource.JQueryJs) + "</script>",
"<script>" + SlmResourceConsole.GetTextResource(SlmResourceConsole.TextResource.JQueryUiJs) + "</script>",
"<script>" + SlmResourceConsole.GetTextResource(SlmResourceConsole.TextResource.SaBaseJs) + "</script>",
"<script>" + SlmResourceConsole.GetTextResource(SlmResourceConsole.TextResource.SlmBaseJs) + "</script>",
};
}
//------------------------------------------------------------------- //-------------------------------------------------------------------
// P a n e l A c t i o n s // P a n e l A c t i o n s
//------------------------------------------------------------------- //-------------------------------------------------------------------
@@ -3,11 +3,11 @@ using Sarand.Core.Base;
using Sarand.Core.Mobile.Forms.Controls; using Sarand.Core.Mobile.Forms.Controls;
using Sarand.Core.Mobile.Utils; using Sarand.Core.Mobile.Utils;
using Sarand.Core.Tasks; using Sarand.Core.Tasks;
using Sarand.Core.Xml;
using Sarand.LogisticsMgr.Core.App; using Sarand.LogisticsMgr.Core.App;
using Sarand.LogisticsMgr.Core.WebService; using Sarand.LogisticsMgr.Core.WebService;
using Sarand.LogisticsMgr.Mobile.Core.App; using Sarand.LogisticsMgr.Mobile.Core.App;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; using Sarand.LogisticsMgr.Mobile.Core.Forms.Panels;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Views;
using Sarand.LogisticsMgr.Mobile.Forms.Components; using Sarand.LogisticsMgr.Mobile.Forms.Components;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -1,7 +1,7 @@
using Sarand.Core.Mobile.Forms.Views; using Sarand.Core.Mobile.Forms.Views;
using Sarand.LogisticsMgr.Mobile.App;
using Sarand.LogisticsMgr.Mobile.Core.App; using Sarand.LogisticsMgr.Mobile.Core.App;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; using Sarand.LogisticsMgr.Mobile.Core.Forms.Controls;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Views;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
@@ -90,6 +90,7 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Views
if (option.Command != null) if (option.Command != null)
{ {
var tapGestureRecognizer = new TapGestureRecognizer(); var tapGestureRecognizer = new TapGestureRecognizer();
tapGestureRecognizer.Tapped += MeunOption_Tapped;
tapGestureRecognizer.Tapped += (s, e) => { option.Command.Execute(null); InvokeMenuOptionClicked(); }; tapGestureRecognizer.Tapped += (s, e) => { option.Command.Execute(null); InvokeMenuOptionClicked(); };
optionLabel.GestureRecognizers.Add(tapGestureRecognizer); optionLabel.GestureRecognizers.Add(tapGestureRecognizer);
if (optionImage != null) if (optionImage != null)
@@ -98,6 +99,21 @@ namespace Sarand.LogisticsMgr.Mobile.Forms.Views
} }
} }
private void MeunOption_Tapped (object sender, EventArgs e)
{
// Want to highlight option that has been tapped to reassure the user that it is being actioned.
// May need to add MenuOptionPanel across grid row to be able to idntify relevant label
// rather than relying on the label itself being tapped.
Element element = (sender as Element);
Label label = (sender as Label);
if (sender is Element)
{
var parent = element.Parent; // Grid.
if (label != null)
label.TextColor = Color.Red;
}
}
//------------------------------------------------------------------- //-------------------------------------------------------------------
// M e n u E v e n t s // M e n u E v e n t s
//------------------------------------------------------------------- //-------------------------------------------------------------------
+12 -4
View File
@@ -64,10 +64,11 @@ namespace Sarand.LogisticsMgr.Mobile.Core.App
{ {
get get
{ {
if (SaxApplication.MinDeviceDimension > 2000) return "18px"; if (SaxApplication.MinDeviceDimension > 2000) return "14pt";
if (SaxApplication.MinDeviceDimension > 1600) return "16px"; if (SaxApplication.MinDeviceDimension > 1600) return "13pt";
if (SaxApplication.MinDeviceDimension > 1200) return "14px"; if (SaxApplication.MinDeviceDimension > 1200) return "12pt";
return "12px"; if (SaxApplication.MinDeviceDimension > 1000) return "11pt";
return "10pt";
} }
} }
public static double FontSizeRatio public static double FontSizeRatio
@@ -99,11 +100,18 @@ namespace Sarand.LogisticsMgr.Mobile.Core.App
public static float ItemListHeaderBorderRadius = 6.0f; public static float ItemListHeaderBorderRadius = 6.0f;
public static Color ItemListHeaderBorderColor = ApplicationBarBackgroundColor; public static Color ItemListHeaderBorderColor = ApplicationBarBackgroundColor;
public static Color ItemListHeaderBackgroundColor = Color.FromHex("#F0F0F0"); public static Color ItemListHeaderBackgroundColor = Color.FromHex("#F0F0F0");
// Forms.
public static double FormGridRowSpacing { get; } = 4.0;
public static double FormGridColumnSpacing { get; } = 4.0;
// Controls. // Controls.
public static Color ControlBackgroundColor { get; } = Color.FromHex("#F8F8F8"); public static Color ControlBackgroundColor { get; } = Color.FromHex("#F8F8F8");
public static Color ControlBorderColor { get; } = Color.FromHex("#E0E0E0"); public static Color ControlBorderColor { get; } = Color.FromHex("#E0E0E0");
public static double ControlBorderWidth { get; } = 0.5; public static double ControlBorderWidth { get; } = 0.5;
public static Thickness LabelMargin { get; } = new Thickness(4.0, 8.0, 0, 0); public static Thickness LabelMargin { get; } = new Thickness(4.0, 8.0, 0, 0);
// Tab controls.
public static Color TabControlHeaderBackgroundColor { get; } = Color.Transparent;
public static Color TabControlCaptionBackgroundColor { get; } = Color.FromHex("#E0E0E0");
public static Color TabControlBodyBackgroundColor { get; } = Color.FromHex("#F8F8F8");
// Associated items panel. // Associated items panel.
public static Color AssociatedItemsCaptionBackgroundColor { get; } = Color.FromHex("#becee4"); public static Color AssociatedItemsCaptionBackgroundColor { get; } = Color.FromHex("#becee4");
public static Color AssociatedItemsCaptionTextColor { get; } = Color.FromHex("#f8f8f8"); public static Color AssociatedItemsCaptionTextColor { get; } = Color.FromHex("#f8f8f8");
@@ -1,4 +1,5 @@
using Sarand.Core.Mobile.Forms.Base; using Sarand.Core.Mobile.Forms.Base;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Panels;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
@@ -7,7 +8,7 @@ using Xamarin.Forms;
namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base
{ {
//======================================================================= //=======================================================================
public class SlmComponents : SaxComponents public class SlmComponents : SlmPanel
{ {
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Definitions. // Definitions.
@@ -23,6 +24,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Properties. // Properties.
public bool Changed { get; protected set; } = false;
//------------------------------------------------------------------- //-------------------------------------------------------------------
// C o n f i g u r e C o m p o n e n t s // C o n f i g u r e C o m p o n e n t s
@@ -1,5 +1,7 @@
using Sarand.Core.Base; using Sarand.Core.Base;
using Sarand.LogisticsMgr.Mobile.Core.App; using Sarand.LogisticsMgr.Mobile.Core.App;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Controls;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Views;
using Sarand.LogisticsMgr.Mobile.Core.Mgr; using Sarand.LogisticsMgr.Mobile.Core.Mgr;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -7,7 +9,7 @@ using System.Runtime.CompilerServices;
using System.Text; using System.Text;
using Xamarin.Forms; using Xamarin.Forms;
namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base namespace Sarand.LogisticsMgr.Mobile.Core.Forms.ControlViews
{ {
//======================================================================= //=======================================================================
public abstract class SlmControlView : SlmContentView public abstract class SlmControlView : SlmContentView
@@ -20,11 +22,9 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base
// Components. // Components.
private SlmContentView outerView = new SlmContentView(); private SlmContentView outerView = new SlmContentView();
private SlmContentView embeddedView = new SlmContentView(); private SlmContentView embeddedView = new SlmContentView();
private readonly SlmLabel labelReadOnly = new SlmLabel();
// Styling. // Styling.
private Thickness borderThickness = new Thickness(); private Thickness borderThickness = new Thickness();
private Color borderColor = Color.Transparent; private Color borderColor = Color.Transparent;
private bool readOnly = false;
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Construction. // Construction.
@@ -40,8 +40,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base
BorderWidth = SlmMobile.ControlBorderWidth; BorderWidth = SlmMobile.ControlBorderWidth;
// Read-only label configuration. // Read-only label configuration.
labelReadOnly.BackgroundColor = Color.Transparent; ReadOnlyLabel.BackgroundColor = Color.Transparent;
labelReadOnly.Margin = new Thickness(SlmMobile.LabelMargin.Left, SlmMobile.LabelMargin.Top); ReadOnlyLabel.Margin = new Thickness(SlmMobile.LabelMargin.Left, SlmMobile.LabelMargin.Top);
SetControlActivity(); SetControlActivity();
} }
@@ -51,6 +51,8 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base
// Label. // Label.
public SlmLabel Label { get; } = new SlmLabel() { Text = "" }; public SlmLabel Label { get; } = new SlmLabel() { Text = "" };
public String LabelText { get { return Label.Text; } set { if (Label.Text.Equals(value)) return; Label.Text = value; } } public String LabelText { get { return Label.Text; } set { if (Label.Text.Equals(value)) return; Label.Text = value; } }
/// <summary>Control used for read-only display.</summary>
protected SlmLabel ReadOnlyLabel { get; } = new SlmLabel() { Text = "" };
// Styling. // Styling.
public Thickness BorderThickness public Thickness BorderThickness
{ {
@@ -62,21 +64,16 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base
set { BorderThickness = new Thickness(value); } set { BorderThickness = new Thickness(value); }
} }
public Color BorderColor { get; set; } public Color BorderColor { get; set; }
public bool ReadOnly
{
get { return readOnly; }
set { if (readOnly == value) return; readOnly = value; SetControlActivity(); }
}
protected String ReadOnlyText protected String ReadOnlyText
{ {
get{ return labelReadOnly.Text; } get{ return ReadOnlyLabel.Text; }
set { if (labelReadOnly.Text.Equals(value)) return; labelReadOnly.Text = value; } set { if (ReadOnlyLabel.Text.Equals(value)) return; ReadOnlyLabel.Text = value; }
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
// C o n f i g u r e C o m p o n e n t s // C o n f i g u r e C o m p o n e n t s
//------------------------------------------------------------------- //-------------------------------------------------------------------
/// <summary>Control configuration that can b changed dynamically.</summary> /// <summary>Control configuration that can be changed dynamically.</summary>
protected override void ConfigureComponents () protected override void ConfigureComponents ()
{ {
// Outer view acts as border. // Outer view acts as border.
@@ -93,11 +90,11 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base
protected override void SetControlActivity () protected override void SetControlActivity ()
{ {
base.SetControlActivity(); base.SetControlActivity();
SetControlsReadOnly();
} }
protected override void SetControlsReadOnly () protected override void SetControlsReadOnly ()
{ {
if (readOnly) Content = labelReadOnly; base.SetControlsReadOnly();
if (ReadOnly) Content = ReadOnlyLabel;
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
@@ -118,21 +115,12 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base
//------------------------------------------------------------------- //-------------------------------------------------------------------
// V i e w E v e n t s // V i e w E v e n t s
//------------------------------------------------------------------- //-------------------------------------------------------------------
protected override void OnParentSet ()
{
base.OnParentSet();
}
//-------------------------------------------------------------------
protected override void OnPropertyChanging ([CallerMemberName] string propertyName = null)
{
base.OnPropertyChanging(propertyName);
}
protected override void OnPropertyChanged ([CallerMemberName] string propertyName = null) protected override void OnPropertyChanged ([CallerMemberName] string propertyName = null)
{ {
base.OnPropertyChanged(propertyName); base.OnPropertyChanged(propertyName);
//Logger.Debug(GetType().Name + ".OnPropertyChanged Name=" + propertyName); //Logger.Debug(GetType().Name + ".OnPropertyChanged Name=" + propertyName);
if (propertyName.EqualsCI("Padding")) if (propertyName.EqualsCI(PaddingProperty.PropertyName))
{ {
if (!embeddedView.Padding.Equals(Padding)) if (!embeddedView.Padding.Equals(Padding))
{ {
@@ -141,25 +129,11 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base
Padding = new Thickness(); Padding = new Thickness();
} }
} }
else if (propertyName.EqualsCI("BackgroundColor")) else if (propertyName.EqualsCI(BackgroundColorProperty.PropertyName))
{ {
embeddedView.BackgroundColor = BackgroundColor; embeddedView.BackgroundColor = BackgroundColor;
} }
} }
//-------------------------------------------------------------------
protected override void OnChildAdded (Element child)
{
base.OnChildAdded(child);
}
protected override void OnChildRemoved (Element child)
{
base.OnChildRemoved(child);
}
//-------------------------------------------------------------------
protected override void OnSizeAllocated (double width, double height)
{
base.OnSizeAllocated(width, height);
}
//------------------------------------------------------------------- //-------------------------------------------------------------------
} }
@@ -1,13 +1,12 @@
using Sarand.Core.Base; using Sarand.Core.Base;
using Sarand.Core.Mobile.Forms.Controls; using Sarand.LogisticsMgr.Mobile.Core.Forms.Controls;
using Sarand.LogisticsMgr.Mobile.Core.App;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Text; using System.Text;
using Xamarin.Forms; using Xamarin.Forms;
namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base namespace Sarand.LogisticsMgr.Mobile.Core.Forms.ControlViews
{ {
//======================================================================= //=======================================================================
public class SlmDatePickerView : SlmControlView public class SlmDatePickerView : SlmControlView
@@ -48,7 +47,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base
//------------------------------------------------------------------- //-------------------------------------------------------------------
// C o n f i g u r e C o m p o n e n t s // C o n f i g u r e C o m p o n e n t s
//------------------------------------------------------------------- //-------------------------------------------------------------------
/// <summary>Control configuration that can b changed dynamically.</summary> /// <summary>Control configuration that can be changed dynamically.</summary>
protected override void ConfigureComponents () protected override void ConfigureComponents ()
{ {
base.ConfigureComponents(); base.ConfigureComponents();
@@ -60,7 +59,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base
protected override void SetControlActivity () protected override void SetControlActivity ()
{ {
base.SetControlActivity(); base.SetControlActivity();
SetControlsReadOnly(); DatePicker.IsEnabled = IsEnabled;
} }
protected override void SetControlsReadOnly () protected override void SetControlsReadOnly ()
{ {
@@ -71,11 +70,6 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base
//------------------------------------------------------------------- //-------------------------------------------------------------------
// V i e w E v e n t s // V i e w E v e n t s
//------------------------------------------------------------------- //-------------------------------------------------------------------
protected override void OnParentSet ()
{
base.OnParentSet();
}
//-------------------------------------------------------------------
protected override void OnPropertyChanging ([CallerMemberName] string propertyName = null) protected override void OnPropertyChanging ([CallerMemberName] string propertyName = null)
{ {
base.OnPropertyChanging(propertyName); base.OnPropertyChanging(propertyName);
@@ -83,16 +77,6 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base
protected override void OnPropertyChanged ([CallerMemberName] string propertyName = null) protected override void OnPropertyChanged ([CallerMemberName] string propertyName = null)
{ {
base.OnPropertyChanged(propertyName); base.OnPropertyChanged(propertyName);
//Logger.Debug(GetType().Name + ".OnPropertyChanged Name=" + propertyName);
}
//-------------------------------------------------------------------
protected override void OnChildAdded (Element child)
{
base.OnChildAdded(child);
}
protected override void OnChildRemoved (Element child)
{
base.OnChildRemoved(child);
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
protected override void OnSizeAllocated (double width, double height) protected override void OnSizeAllocated (double width, double height)
@@ -0,0 +1,97 @@
using Sarand.Core.Base;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Controls;
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Text;
using Xamarin.Forms;
namespace Sarand.LogisticsMgr.Mobile.Core.Forms.ControlViews
{
//=======================================================================
public class SlmDateTimePickerView : SlmControlView
{
//-------------------------------------------------------------------
// Definitions.
//-------------------------------------------------------------------
// Data members.
//-------------------------------------------------------------------
// Construction.
public SlmDateTimePickerView (SlmDateTimePicker suppliedPicker = null)
{
// Control configuration.
if (suppliedPicker != null) DateTimePicker = suppliedPicker;
DateTimePicker.BackgroundColor = Color.Transparent;
// Control events.
DateTimePicker.BackgroundColor = Color.Transparent;
DateTimePicker.DateSelected += DateTimePicker_DateSelected;
DateTimePicker.Focused += DateTimePicker_Focused;
DateTimePicker.Unfocused += DateTimePicker_Unfocused;
ConfigureComponents();
SetControlActivity();
}
//-------------------------------------------------------------------
// Properties.
protected SlmDateTimePicker DateTimePicker { get; } = new SlmDateTimePicker();
public DateTime DateTime
{
get { return DateTimePicker.DateTime; }
set { if (DateTimePicker.DateTime.CompareTo(value) == 0) return; DateTimePicker.DateTime = value; }
}
//-------------------------------------------------------------------
// C o n f i g u r e C o m p o n e n t s
//-------------------------------------------------------------------
/// <summary>Control configuration that can be changed dynamically.</summary>
protected override void ConfigureComponents ()
{
base.ConfigureComponents();
}
//-------------------------------------------------------------------
// C o n t r o l A c t i v i t y
//-------------------------------------------------------------------
protected override void SetControlActivity ()
{
base.SetControlActivity();
DateTimePicker.IsEnabled = IsEnabled;
}
protected override void SetControlsReadOnly ()
{
base.SetControlsReadOnly();
if (!ReadOnly) Content = DateTimePicker;
}
//-------------------------------------------------------------------
// V i e w E v e n t s
//-------------------------------------------------------------------
//-------------------------------------------------------------------
// C o n t r o l E v e n t s
//-------------------------------------------------------------------
public event EventHandler<DateChangedEventArgs> DateSelected;
private void DateTimePicker_DateSelected (object sender, DateChangedEventArgs e)
{
ReadOnlyText = DateTimePicker.FormattedDateTime;
if (ReadOnly) return;
if (DateSelected != null) DateSelected.Invoke(sender, e);
}
//-------------------------------------------------------------------
private void DateTimePicker_Focused (object sender, FocusEventArgs e)
{
Control_Focused(sender, e);
}
private void DateTimePicker_Unfocused (object sender, FocusEventArgs e)
{
Control_Unfocused(sender, e);
}
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -1,13 +1,12 @@
using Sarand.Core.Base; using Sarand.Core.Base;
using Sarand.Core.Mobile.Forms.Controls; using Sarand.LogisticsMgr.Mobile.Core.Forms.Controls;
using Sarand.LogisticsMgr.Mobile.Core.App;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Text; using System.Text;
using Xamarin.Forms; using Xamarin.Forms;
namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base namespace Sarand.LogisticsMgr.Mobile.Core.Forms.ControlViews
{ {
//======================================================================= //=======================================================================
public class SlmEditorView : SlmControlView public class SlmEditorView : SlmControlView
@@ -17,20 +16,21 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Data members. // Data members.
private readonly SlmEditor entry = new SlmEditor(); private readonly SlmEditor editorControl = new SlmEditor();
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Construction. // Construction.
public SlmEditorView () public SlmEditorView ()
{ {
// Control configuration. // Control configuration.
entry.BackgroundColor = Color.Transparent; editorControl.BackgroundColor = Color.Transparent;
EditorVerticalOptions = LayoutOptions.FillAndExpand;
// Editor events. // Editor events.
entry.Focused += Editor_Focused; editorControl.Focused += Editor_Focused;
entry.Unfocused += Editor_Unfocused; editorControl.Unfocused += Editor_Unfocused;
entry.TextChanged += Editor_TextChanged; editorControl.TextChanged += Editor_TextChanged;
entry.Completed += Editor_Completed; editorControl.Completed += Editor_Completed;
ConfigureComponents(); ConfigureComponents();
SetControlActivity(); SetControlActivity();
@@ -40,18 +40,37 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base
// Properties. // Properties.
public int MaxLength public int MaxLength
{ {
get { return entry.MaxLength; } get { return editorControl.MaxLength; }
set { entry.MaxLength = value; } set { editorControl.MaxLength = value; }
} }
public Keyboard Keyboard public Keyboard Keyboard
{ {
get { return entry.Keyboard; } get { return editorControl.Keyboard; }
set { entry.Keyboard = value; } set { editorControl.Keyboard = value; }
} }
public String Text public String Text
{ {
get { return entry.Text; } get { return editorControl.Text; }
set { value = StringUtil.EmptyOnNull(value); if (entry.Text != null && entry.Text.Equals(value)) return; entry.Text = value; } set { value = StringUtil.EmptyOnNull(value); if (editorControl.Text != null && editorControl.Text.Equals(value)) return; editorControl.Text = value; }
}
// Editor configuration.
public LayoutOptions EditorVerticalOptions
{
get { return editorControl.VerticalOptions; }
set
{
editorControl.VerticalOptions = value;
ReadOnlyLabel.VerticalOptions = value;
}
}
public LayoutOptions EditorHorizontalOptions
{
get { return editorControl.HorizontalOptions; }
set
{
editorControl.HorizontalOptions = value;
ReadOnlyLabel.HorizontalOptions = value;
}
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
@@ -74,7 +93,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base
protected override void SetControlsReadOnly () protected override void SetControlsReadOnly ()
{ {
base.SetControlsReadOnly(); base.SetControlsReadOnly();
if (!ReadOnly) Content = entry; if (!ReadOnly) Content = editorControl;
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
@@ -94,7 +113,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base
public event EventHandler<TextChangedEventArgs> TextChanged; public event EventHandler<TextChangedEventArgs> TextChanged;
private void Editor_TextChanged (object sender, TextChangedEventArgs e) private void Editor_TextChanged (object sender, TextChangedEventArgs e)
{ {
ReadOnlyText = entry.Text; ReadOnlyText = editorControl.Text;
if (ReadOnly) return; if (ReadOnly) return;
if (TextChanged != null) TextChanged.Invoke(sender, e); if (TextChanged != null) TextChanged.Invoke(sender, e);
} }
@@ -1,13 +1,13 @@
using Sarand.Core.Base; using Sarand.Core.Base;
using Sarand.Core.Mobile.Forms.Controls; using Sarand.Core.Mobile.Forms.Controls;
using Sarand.LogisticsMgr.Mobile.Core.App; using Sarand.LogisticsMgr.Mobile.Core.Forms.Controls;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Text; using System.Text;
using Xamarin.Forms; using Xamarin.Forms;
namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base namespace Sarand.LogisticsMgr.Mobile.Core.Forms.ControlViews
{ {
//======================================================================= //=======================================================================
public class SlmEntryView : SlmControlView public class SlmEntryView : SlmControlView
@@ -7,7 +7,7 @@ using System.Runtime.CompilerServices;
using System.Text; using System.Text;
using Xamarin.Forms; using Xamarin.Forms;
namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base namespace Sarand.LogisticsMgr.Mobile.Core.Forms.ControlViews
{ {
//======================================================================= //=======================================================================
public class SlmLabelView : SlmControlView public class SlmLabelView : SlmControlView
@@ -38,7 +38,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base
//------------------------------------------------------------------- //-------------------------------------------------------------------
// C o n f i g u r e C o m p o n e n t s // C o n f i g u r e C o m p o n e n t s
//------------------------------------------------------------------- //-------------------------------------------------------------------
/// <summary>Control configuration that can b changed dynamically.</summary> /// <summary>Control configuration that can be changed dynamically.</summary>
protected override void ConfigureComponents () protected override void ConfigureComponents ()
{ {
ReadOnly = true; ReadOnly = true;
@@ -1,13 +1,15 @@
using Sarand.Core.Base; using Sarand.Core.Base;
using Sarand.Core.Bus;
using Sarand.Core.Mobile.Forms.Controls; using Sarand.Core.Mobile.Forms.Controls;
using Sarand.LogisticsMgr.Mobile.Core.App; using Sarand.LogisticsMgr.Mobile.Core.App;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Controls;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Text; using System.Text;
using Xamarin.Forms; using Xamarin.Forms;
namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base namespace Sarand.LogisticsMgr.Mobile.Core.Forms.ControlViews
{ {
//======================================================================= //=======================================================================
public class SlmPickerView : SlmControlView public class SlmPickerView : SlmControlView
@@ -48,22 +50,67 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base
get { return picker.SelectedIndex; } get { return picker.SelectedIndex; }
set { if (picker.SelectedIndex == value) return; picker.SelectedIndex = value; } set { if (picker.SelectedIndex == value) return; picker.SelectedIndex = value; }
} }
//public object SelectedItem { get { return picker.SelectedItem; } set { picker.SelectedItem = value; } }
public SlmPicker.SlmPickerItem SelectedPickerItem { get { return picker.SelectedPickerItem; } } public SlmPicker.SlmPickerItem SelectedPickerItem { get { return picker.SelectedPickerItem; } }
public object SelectedItem public SysId SelectedItemId
{ {
get { return picker.SelectedItem; } get { return picker.SelectedItemId; }
set { picker.SelectedItem = value; } set { picker.SelectedItemId = value; }
}
public String SelectedItemCode
{
get { return picker.SelectedItemCode; }
set { picker.SelectedItemCode = value; }
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
// C o n f i g u r e C o m p o n e n t s // C o n f i g u r e C o m p o n e n t s
//------------------------------------------------------------------- //-------------------------------------------------------------------
/// <summary>Control configuration that can b changed dynamically.</summary> /// <summary>Control configuration that can be changed dynamically.</summary>
protected override void ConfigureComponents () protected override void ConfigureComponents ()
{ {
base.ConfigureComponents(); base.ConfigureComponents();
} }
//-------------------------------------------------------------------
// P i c k e r D a t a
//-------------------------------------------------------------------
/// <summary>
/// Does the list contain an item with the same Id.
/// <para>NB Invalid Id values are matched.</para>
/// </summary>
public bool ContainsId (SysId id)
{
return picker.ContainsItemId(id);
}
/// <summary>
/// Does the list contain an item with the same code.
/// <para>NB Codes are case-insensitive.</para>
/// </summary>
public bool ContainsCode (string code)
{
return picker.ContainsItemCode(code);
}
//-------------------------------------------------------------------
/// <summary>
/// Add an item identified by a SysId value.
/// <para>NB Fails if an item already exists with the same id.</para>
/// </summary>
public bool AddItem (SysId id, String caption)
{
picker.AddItem(id, caption);
return true;
}
/// <summary>
/// Add an item identified by a code value.
/// <para>NB Fails if an item already exists with the same case-insensitive code.</para>
/// </summary>
public bool AddItem (String code, String caption)
{
picker.AddItem(code, caption);
return true;
}
//------------------------------------------------------------------- //-------------------------------------------------------------------
// C o n t r o l A c t i v i t y // C o n t r o l A c t i v i t y
//------------------------------------------------------------------- //-------------------------------------------------------------------
@@ -1,19 +1,17 @@
using Sarand.Core.Base; using Sarand.Core.Base;
using Sarand.Core.Bus;
using Sarand.Core.CodeTypes; using Sarand.Core.CodeTypes;
using Sarand.Core.Tasks; using Sarand.Core.Tasks;
using Sarand.LogisticsMgr.Core.App; using Sarand.LogisticsMgr.Core.App;
using Sarand.LogisticsMgr.Mobile.Core.App; using Sarand.LogisticsMgr.Mobile.Core.App;
using Sarand.LogisticsMgr.Mobile.Core.CodeTypes; using Sarand.LogisticsMgr.Mobile.Core.CodeTypes;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; using Sarand.LogisticsMgr.Mobile.Core.Forms.Controls;
using Sarand.LogisticsMgr.Mobile.Core.Mgr;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Xamarin.Forms; using Xamarin.Forms;
namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Controls namespace Sarand.LogisticsMgr.Mobile.Core.Forms.ControlViews
{ {
//======================================================================= //=======================================================================
public class SlmPickerView_CodeType : SlmPickerView public class SlmPickerView_CodeType : SlmPickerView
@@ -29,16 +27,15 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Controls
get { return (Picker as SlmPicker_CodeType).CodeType; } get { return (Picker as SlmPicker_CodeType).CodeType; }
set { (Picker as SlmPicker_CodeType).CodeType = value; } set { (Picker as SlmPicker_CodeType).CodeType = value; }
} }
public bool ContainsCode (String code)
{
return Picker.ContainsItemCode(code);
}
public String SelectedCode public String SelectedCode
{ {
get { return (Picker as SlmPicker_CodeType).SelectedCode; } get { return (Picker as SlmPicker_CodeType).SelectedCode; }
set { (Picker as SlmPicker_CodeType).SelectedCode = value; } set { (Picker as SlmPicker_CodeType).SelectedCode = value; }
} }
//-------------------------------------------------------------------
// Utilities.
//------------------------------------------------------------------- //-------------------------------------------------------------------
} }
//======================================================================= //=======================================================================
@@ -4,7 +4,7 @@ using Sarand.Core.Tasks;
using Sarand.LogisticsMgr.Core.App; using Sarand.LogisticsMgr.Core.App;
using Sarand.LogisticsMgr.Core.Bus; using Sarand.LogisticsMgr.Core.Bus;
using Sarand.LogisticsMgr.Mobile.Core.App; using Sarand.LogisticsMgr.Mobile.Core.App;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; using Sarand.LogisticsMgr.Mobile.Core.Forms.Controls;
using Sarand.LogisticsMgr.Mobile.Core.Mgr; using Sarand.LogisticsMgr.Mobile.Core.Mgr;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -12,7 +12,7 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Xamarin.Forms; using Xamarin.Forms;
namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Controls namespace Sarand.LogisticsMgr.Mobile.Core.Forms.ControlViews
{ {
//======================================================================= //=======================================================================
public class SlmPickerView_Companies : SlmPickerView public class SlmPickerView_Companies : SlmPickerView
@@ -1,19 +1,13 @@
using Sarand.Core.Base; using Sarand.Core.Base;
using Sarand.Core.Bus;
using Sarand.Core.CodeTypes;
using Sarand.Core.Tasks;
using Sarand.LogisticsMgr.Core.App;
using Sarand.LogisticsMgr.Mobile.Core.App; using Sarand.LogisticsMgr.Mobile.Core.App;
using Sarand.LogisticsMgr.Mobile.Core.CodeTypes; using Sarand.LogisticsMgr.Mobile.Core.Forms.Controls;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Base;
using Sarand.LogisticsMgr.Mobile.Core.Mgr;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Xamarin.Forms; using Xamarin.Forms;
namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Controls namespace Sarand.LogisticsMgr.Mobile.Core.Forms.ControlViews
{ {
//======================================================================= //=======================================================================
public class SlmPickerView_SiteDefinitions : SlmPickerView public class SlmPickerView_SiteDefinitions : SlmPickerView
@@ -1,19 +1,13 @@
using Sarand.Core.Base; using Sarand.Core.Base;
using Sarand.Core.Bus;
using Sarand.Core.CodeTypes;
using Sarand.Core.Tasks;
using Sarand.LogisticsMgr.Core.App; using Sarand.LogisticsMgr.Core.App;
using Sarand.LogisticsMgr.Mobile.Core.App; using Sarand.LogisticsMgr.Mobile.Core.Forms.Controls;
using Sarand.LogisticsMgr.Mobile.Core.CodeTypes;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Base;
using Sarand.LogisticsMgr.Mobile.Core.Mgr;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Xamarin.Forms; using Xamarin.Forms;
namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Controls namespace Sarand.LogisticsMgr.Mobile.Core.Forms.ControlViews
{ {
//======================================================================= //=======================================================================
public class SlmPickerView_SystemCodes : SlmPickerView public class SlmPickerView_SystemCodes : SlmPickerView
@@ -60,10 +54,12 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Controls
public void PopulateSystemCodes () public void PopulateSystemCodes ()
{ {
Items.Clear(); Items.Clear();
if (systemCodes.Count > 1)
AddItem("", "");
foreach (TypeCodeDesc systemCode in systemCodes) foreach (TypeCodeDesc systemCode in systemCodes)
{
AddItem(systemCode.Code, systemCode.Desc); AddItem(systemCode.Code, systemCode.Desc);
} if (systemCodes.Count == 1)
SelectedItemCode = systemCodes[0].Code;
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
@@ -7,7 +7,7 @@ using System.Collections.Generic;
using System.Text; using System.Text;
using Xamarin.Forms; using Xamarin.Forms;
namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Controls
{ {
//======================================================================= //=======================================================================
public class SlmDatePicker : SaxDatePicker public class SlmDatePicker : SaxDatePicker
@@ -30,7 +30,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base
// Properties. // Properties.
//------------------------------------------------------------------- //-------------------------------------------------------------------
// P i c k e r E v e n t s // C o n t r o l E v e n t s
//------------------------------------------------------------------- //-------------------------------------------------------------------
//------------------------------------------------------------------- //-------------------------------------------------------------------
@@ -0,0 +1,39 @@
using Sarand.Core.Base;
using Sarand.Core.Bus;
using Sarand.Core.Mobile.Forms.Controls;
using Sarand.LogisticsMgr.Mobile.Core.App;
using System;
using System.Collections.Generic;
using System.Text;
using Xamarin.Forms;
namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Controls
{
//=======================================================================
public class SlmDateTimePicker : SaxDateTimePicker
{
//-------------------------------------------------------------------
// Definitions.
//-------------------------------------------------------------------
// Data members.
//-------------------------------------------------------------------
// Construction.
public SlmDateTimePicker ()
{
// Font sizing.
FontSize = FontSize * SlmMobile.FontSizeRatio;
}
//-------------------------------------------------------------------
// Properties.
//-------------------------------------------------------------------
// C o n t r o l E v e n t s
//-------------------------------------------------------------------
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -5,7 +5,7 @@ using System.Collections.Generic;
using System.Text; using System.Text;
using Xamarin.Forms; using Xamarin.Forms;
namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Controls
{ {
//======================================================================= //=======================================================================
public class SlmEditor : SaxEditor public class SlmEditor : SaxEditor
@@ -27,6 +27,10 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Properties. // Properties.
//-------------------------------------------------------------------
// C o n t r o l E v e n t s
//-------------------------------------------------------------------
//------------------------------------------------------------------- //-------------------------------------------------------------------
} }
//======================================================================= //=======================================================================
@@ -5,7 +5,7 @@ using System.Collections.Generic;
using System.Text; using System.Text;
using Xamarin.Forms; using Xamarin.Forms;
namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Controls
{ {
//======================================================================= //=======================================================================
public class SlmEntry : SaxEntry public class SlmEntry : SaxEntry
@@ -27,6 +27,10 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Properties. // Properties.
//-------------------------------------------------------------------
// C o n t r o l E v e n t s
//-------------------------------------------------------------------
//------------------------------------------------------------------- //-------------------------------------------------------------------
} }
//======================================================================= //=======================================================================
@@ -0,0 +1,33 @@
using Sarand.Core.Mobile.Forms.Controls;
using System;
using System.Collections.Generic;
using System.Text;
namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Controls
{
//=======================================================================
public class SlmImageButton : SaxImageButton
{
//-------------------------------------------------------------------
// Definitions.
//-------------------------------------------------------------------
// Data members.
//-------------------------------------------------------------------
// Construction.
public SlmImageButton ()
{
}
//-------------------------------------------------------------------
// Properties.
//-------------------------------------------------------------------
// C o n t r o l E v e n t s
//-------------------------------------------------------------------
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -5,7 +5,7 @@ using System.Collections.Generic;
using System.Text; using System.Text;
using Xamarin.Forms; using Xamarin.Forms;
namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Controls
{ {
//======================================================================= //=======================================================================
public class SlmLabel : SaxLabel public class SlmLabel : SaxLabel
@@ -30,6 +30,10 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Properties. // Properties.
//-------------------------------------------------------------------
// C o n t r o l E v e n t s
//-------------------------------------------------------------------
//------------------------------------------------------------------- //-------------------------------------------------------------------
} }
//======================================================================= //=======================================================================
@@ -7,7 +7,7 @@ using System.Collections.Generic;
using System.Text; using System.Text;
using Xamarin.Forms; using Xamarin.Forms;
namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Controls
{ {
//======================================================================= //=======================================================================
public class SlmPicker : SaxPicker public class SlmPicker : SaxPicker
@@ -30,7 +30,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base
// Properties. // Properties.
//------------------------------------------------------------------- //-------------------------------------------------------------------
// P i c k e r E v e n t s // C o n t r o l E v e n t s
//------------------------------------------------------------------- //-------------------------------------------------------------------
//------------------------------------------------------------------- //-------------------------------------------------------------------
@@ -0,0 +1,34 @@
using Sarand.Core.Mobile.Forms.Controls;
using Sarand.Core.Mobile.Forms.Views;
using System;
using System.Collections.Generic;
using System.Text;
namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Controls
{
//=======================================================================
public class SlmTabControl : SaxTabControl
{
//-------------------------------------------------------------------
// Definitions.
//-------------------------------------------------------------------
// Data members.
//-------------------------------------------------------------------
// Construction.
public SlmTabControl ()
{
}
//-------------------------------------------------------------------
// Properties.
//-------------------------------------------------------------------
// C o n t r o l E v e n t s
//-------------------------------------------------------------------
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -0,0 +1,39 @@
using Sarand.Core.Base;
using Sarand.Core.Bus;
using Sarand.Core.Mobile.Forms.Controls;
using Sarand.LogisticsMgr.Mobile.Core.App;
using System;
using System.Collections.Generic;
using System.Text;
using Xamarin.Forms;
namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Controls
{
//=======================================================================
public class SlmTimePicker : SaxTimePicker
{
//-------------------------------------------------------------------
// Definitions.
//-------------------------------------------------------------------
// Data members.
//-------------------------------------------------------------------
// Construction.
public SlmTimePicker ()
{
// Font sizing.
FontSize = FontSize * SlmMobile.FontSizeRatio;
}
//-------------------------------------------------------------------
// Properties.
//-------------------------------------------------------------------
// C o n t r o l E v e n t s
//-------------------------------------------------------------------
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -4,7 +4,7 @@ using System.Collections.Generic;
using System.Text; using System.Text;
using Xamarin.Forms; using Xamarin.Forms;
namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Layouts
{ {
//======================================================================= //=======================================================================
public class SlmStackLayout : SaxStackLayout public class SlmStackLayout : SaxStackLayout
@@ -9,7 +9,7 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Xamarin.Forms; using Xamarin.Forms;
namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Pages
{ {
//======================================================================= //=======================================================================
public class SlmContentPage : SaxContentPage public class SlmContentPage : SaxContentPage
@@ -1,6 +1,9 @@
using Sarand.Core.Mobile.Forms.Controls; using Sarand.Core.Mobile.Forms.Controls;
using Sarand.LogisticsMgr.Core.WebService; using Sarand.LogisticsMgr.Core.WebService;
using Sarand.LogisticsMgr.Mobile.Core.App; using Sarand.LogisticsMgr.Mobile.Core.App;
using Sarand.LogisticsMgr.Mobile.Core.Forms.ControlViews;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Layouts;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Views;
using Sarand.LogisticsMgr.Mobile.Core.Mgr; using Sarand.LogisticsMgr.Mobile.Core.Mgr;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -9,7 +12,7 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Xamarin.Forms; using Xamarin.Forms;
namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Pages
{ {
//======================================================================= //=======================================================================
public abstract class SlmFormPage : SlmContentPage public abstract class SlmFormPage : SlmContentPage
@@ -143,20 +146,6 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base
buttonClose.Clicked += ButtonClose_Clicked; buttonClose.Clicked += ButtonClose_Clicked;
} }
//-------------------------------------------------------------------
/// <summary>
/// Add label and control to form grid.
/// <para>NB Control takes up 2 rows by default to allow for control pairs (control + button etc).</para>
/// </summary>
protected static void AddControlViewToGrid (SlmGrid grid, SlmControlView controlView)
{
int rowIdx = grid.RowDefinitions.Count;
grid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
grid.Children.Add(controlView.Label, 0, rowIdx);
grid.Children.Add(controlView, 1, rowIdx);
Grid.SetColumnSpan(controlView, 2);
}
//------------------------------------------------------------------- //-------------------------------------------------------------------
// C o n f i g u r e F o r m // C o n f i g u r e F o r m
//------------------------------------------------------------------- //-------------------------------------------------------------------
@@ -8,7 +8,7 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Xamarin.Forms; using Xamarin.Forms;
namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Panels
{ {
//======================================================================= //=======================================================================
public class SlmMainPanel : SlmPanel public class SlmMainPanel : SlmPanel
@@ -29,7 +29,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base
{ {
this.config = new Config(); this.config = new Config();
} }
protected SlmMainPanel (Config config) protected SlmMainPanel (Config config) : base(config)
{ {
this.config = config; this.config = config;
} }
@@ -1,4 +1,5 @@
using Sarand.LogisticsMgr.Mobile.Core.App; using Sarand.LogisticsMgr.Mobile.Core.App;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Views;
using Sarand.LogisticsMgr.Mobile.Core.Mgr; using Sarand.LogisticsMgr.Mobile.Core.Mgr;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@@ -8,7 +9,7 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Xamarin.Forms; using Xamarin.Forms;
namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Panels
{ {
//======================================================================= //=======================================================================
public class SlmPanel : SlmContentView public class SlmPanel : SlmContentView
@@ -17,6 +18,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base
// Definitions. // Definitions.
public class Config public class Config
{ {
public Boolean ReadOnly { get; set; }
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
@@ -57,41 +59,16 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base
//------------------------------------------------------------------- //-------------------------------------------------------------------
protected override void SetControlActivity () protected override void SetControlActivity ()
{ {
base.SetControlActivity();
} }
protected override void SetControlsReadOnly () protected override void SetControlsReadOnly ()
{ {
base.SetControlsReadOnly();
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
// P a n e l E v e n t s // P a n e l E v e n t s
//------------------------------------------------------------------- //-------------------------------------------------------------------
protected override void OnParentSet ()
{
base.OnParentSet();
}
//-------------------------------------------------------------------
protected override void OnPropertyChanging ([CallerMemberName] string propertyName = null)
{
base.OnPropertyChanging(propertyName);
}
protected override void OnPropertyChanged ([CallerMemberName] string propertyName = null)
{
base.OnPropertyChanged(propertyName);
}
//-------------------------------------------------------------------
protected override void OnChildAdded (Element child)
{
base.OnChildAdded(child);
}
protected override void OnChildRemoved (Element child)
{
base.OnChildRemoved(child);
}
//-------------------------------------------------------------------
protected override void OnSizeAllocated (double width, double height)
{
base.OnSizeAllocated(width, height);
}
//------------------------------------------------------------------- //-------------------------------------------------------------------
} }
@@ -1,9 +1,9 @@
using Sarand.Core.App; using Sarand.Core.App;
using Sarand.Core.Mobile.Utils; using Sarand.Core.Mobile.Utils;
using Sarand.LogisticsMgr.Core.WebService;
using Sarand.LogisticsMgr.Mobile.Core.App; using Sarand.LogisticsMgr.Mobile.Core.App;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Base; using Sarand.LogisticsMgr.Mobile.Core.Forms.Controls;
using Sarand.LogisticsMgr.Mobile.Core.Mgr; using Sarand.LogisticsMgr.Mobile.Core.Forms.Layouts;
using Sarand.LogisticsMgr.Mobile.Core.Forms.Views;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
@@ -23,10 +23,6 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Panels
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Data members. // Data members.
private Config config; private Config config;
private SlmAccountMgr_Mobile accountMgr;
private SlmBerthingMgr_Mobile berthingMgr;
private SlmAssetMgr_Mobile assetMgr;
private SlmWebServiceClient webServiceClient;
// Layout. // Layout.
private SlmFrame viewPanel = new SlmFrame(); private SlmFrame viewPanel = new SlmFrame();
private SlmStackLayout stackLayout = new SlmStackLayout() { Orientation = StackOrientation.Vertical }; private SlmStackLayout stackLayout = new SlmStackLayout() { Orientation = StackOrientation.Vertical };
@@ -118,18 +114,11 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Panels
get { return labelCaption.Text; } get { return labelCaption.Text; }
set { if (labelCaption.Text.Equals(value)) return; labelCaption.Text = value; } set { if (labelCaption.Text.Equals(value)) return; labelCaption.Text = value; }
} }
// Session.
protected SlmUserContext_Mobile UserContext { get { return SlmGlobals_Mobile.SessionProfile.UserContext_Mobile; } }
protected SlmSessionContext_Mobile SessionContext { get { return SlmGlobals_Mobile.SessionProfile.SessionContext_Mobile; } }
// Layout. // Layout.
protected SlmPanel SummaryPanel { get { return panelSummary; } } protected SlmPanel SummaryPanel { get { return panelSummary; } }
protected SlmPanel DetailsPanel { get { return panelDetails; } } protected SlmPanel DetailsPanel { get { return panelDetails; } }
protected String ErrorStateMessage { get; set; } protected String ErrorStateMessage { get; set; }
// Managers. // NB Session properties, managers and WebService are defined in SlmContentView.
protected SlmAccountMgr_Mobile AccountMgr { get { if (accountMgr == null) accountMgr = new SlmAccountMgr_Mobile(SessionContext); return accountMgr; } }
protected SlmBerthingMgr_Mobile BerthingMgr { get { if (berthingMgr == null) berthingMgr = new SlmBerthingMgr_Mobile(SessionContext); return berthingMgr; } }
protected SlmAssetMgr_Mobile AssetMgr { get { if (assetMgr == null) assetMgr = new SlmAssetMgr_Mobile(SessionContext); return assetMgr; } }
public SlmWebServiceClient WebServiceClient { get { if (webServiceClient == null) webServiceClient = new SlmWebServiceClient(); return webServiceClient; } }
//------------------------------------------------------------------- //-------------------------------------------------------------------
// I t e m s T o g g l e // I t e m s T o g g l e
@@ -0,0 +1,36 @@
using Sarand.LogisticsMgr.Mobile.Core.Forms.Views;
using System;
using System.Collections.Generic;
using System.Text;
namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Panels
{
//=======================================================================
public class SlmPanel_ItemProperties : SlmContentView
{
//-------------------------------------------------------------------
// Definitions.
public class Config
{
public bool ReadOnly { get; set; }
}
//-------------------------------------------------------------------
// Data members.
private Config config;
//-------------------------------------------------------------------
// Construction.
public SlmPanel_ItemProperties (Config config)
{
this.config = config;
}
//-------------------------------------------------------------------
// Properties.
public bool AddMode { get; protected set; }
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -0,0 +1,29 @@
using Sarand.Core.Mobile.Forms.Panels;
using System;
using System.Collections.Generic;
using System.Text;
namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Panels
{
//=======================================================================
public class SlmPanel_PropertySummary : SaxPanel_PropertySummary
{
//-------------------------------------------------------------------
// Definitions.
//-------------------------------------------------------------------
// Data members.
//-------------------------------------------------------------------
// Construction.
public SlmPanel_PropertySummary ()
{
}
//-------------------------------------------------------------------
// Properties.
//-------------------------------------------------------------------
}
//=======================================================================
}
@@ -1,4 +1,5 @@
using Sarand.Core.Mobile.Forms.Views; using Sarand.Core.Mobile.Forms.Views;
using Sarand.LogisticsMgr.Core.WebService;
using Sarand.LogisticsMgr.Mobile.Core.App; using Sarand.LogisticsMgr.Mobile.Core.App;
using Sarand.LogisticsMgr.Mobile.Core.Mgr; using Sarand.LogisticsMgr.Mobile.Core.Mgr;
using System; using System;
@@ -9,7 +10,7 @@ using System.Text;
using Xamarin.Forms; using Xamarin.Forms;
namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Views
{ {
//======================================================================= //=======================================================================
public class SlmContentView : SaxContentView public class SlmContentView : SaxContentView
@@ -22,6 +23,7 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base
private SlmAccountMgr_Mobile accountMgr = null; private SlmAccountMgr_Mobile accountMgr = null;
private SlmBerthingMgr_Mobile berthingMgr = null; private SlmBerthingMgr_Mobile berthingMgr = null;
private SlmAssetMgr_Mobile assetMgr = null; private SlmAssetMgr_Mobile assetMgr = null;
private SlmWebServiceClient webServiceClient;
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Construction. // Construction.
@@ -31,11 +33,14 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Properties. // Properties.
// Session.
protected SlmUserContext_Mobile UserContext { get { return SlmGlobals_Mobile.SessionProfile.UserContext_Mobile; } }
protected SlmSessionContext_Mobile SessionContext { get { return SlmGlobals_Mobile.SessionProfile.SessionContext_Mobile; } } protected SlmSessionContext_Mobile SessionContext { get { return SlmGlobals_Mobile.SessionProfile.SessionContext_Mobile; } }
// Managers. // Managers.
protected SlmAccountMgr_Mobile AccountMgr { get { if (accountMgr == null) accountMgr = new SlmAccountMgr_Mobile(SessionContext); return accountMgr; } } protected SlmAccountMgr_Mobile AccountMgr { get { if (accountMgr == null) accountMgr = new SlmAccountMgr_Mobile(SessionContext); return accountMgr; } }
protected SlmBerthingMgr_Mobile BerthingMgr { get { if (berthingMgr == null) berthingMgr = new SlmBerthingMgr_Mobile(SessionContext); return berthingMgr; } } protected SlmBerthingMgr_Mobile BerthingMgr { get { if (berthingMgr == null) berthingMgr = new SlmBerthingMgr_Mobile(SessionContext); return berthingMgr; } }
protected SlmAssetMgr_Mobile AssetMgr { get { if (assetMgr == null) assetMgr = new SlmAssetMgr_Mobile(SessionContext); return assetMgr; } } protected SlmAssetMgr_Mobile AssetMgr { get { if (assetMgr == null) assetMgr = new SlmAssetMgr_Mobile(SessionContext); return assetMgr; } }
public SlmWebServiceClient WebServiceClient { get { if (webServiceClient == null) webServiceClient = new SlmWebServiceClient(); return webServiceClient; } }
//------------------------------------------------------------------- //-------------------------------------------------------------------
// C o n f i g u r e C o m p o n e n t s // C o n f i g u r e C o m p o n e n t s
@@ -49,41 +54,16 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base
//------------------------------------------------------------------- //-------------------------------------------------------------------
protected override void SetControlActivity () protected override void SetControlActivity ()
{ {
base.SetControlActivity();
} }
protected override void SetControlsReadOnly () protected override void SetControlsReadOnly ()
{ {
base.SetControlsReadOnly();
} }
//------------------------------------------------------------------- //-------------------------------------------------------------------
// V i e w E v e n t s // V i e w E v e n t s
//------------------------------------------------------------------- //-------------------------------------------------------------------
protected override void OnParentSet ()
{
base.OnParentSet();
}
//-------------------------------------------------------------------
protected override void OnPropertyChanging ([CallerMemberName] string propertyName = null)
{
base.OnPropertyChanging(propertyName);
}
protected override void OnPropertyChanged ([CallerMemberName] string propertyName = null)
{
base.OnPropertyChanged(propertyName);
}
//-------------------------------------------------------------------
protected override void OnChildAdded (Element child)
{
base.OnChildAdded(child);
}
protected override void OnChildRemoved (Element child)
{
base.OnChildRemoved(child);
}
//-------------------------------------------------------------------
protected override void OnSizeAllocated (double width, double height)
{
base.OnSizeAllocated(width, height);
}
//------------------------------------------------------------------- //-------------------------------------------------------------------
} }
@@ -3,7 +3,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Views
{ {
//======================================================================= //=======================================================================
public class SlmFrame : SaxFrame public class SlmFrame : SaxFrame
@@ -1,11 +1,12 @@
using Sarand.Core.Mobile.Forms.Templates; using Sarand.Core.Mobile.Forms.Templates;
using Sarand.LogisticsMgr.Mobile.Core.Forms.ControlViews;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Text; using System.Text;
using Xamarin.Forms; using Xamarin.Forms;
namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Views
{ {
//======================================================================= //=======================================================================
public class SlmGrid : SaxGrid public class SlmGrid : SaxGrid
@@ -25,6 +26,21 @@ namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base
//------------------------------------------------------------------- //-------------------------------------------------------------------
// Properties. // Properties.
//-------------------------------------------------------------------
/// <summary>
/// Add label and control to form grid.
/// <para>NB Control takes up 2 rows by default to allow for control pairs (control + button etc).</para>
/// </summary>
public void AddControlViewToGrid (SlmControlView controlView, ushort controlColumnSpan = 2)
{
int rowIdx = RowDefinitions.Count;
RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto });
Children.Add(controlView.Label, 0, rowIdx);
Children.Add(controlView, 1, rowIdx);
if (controlColumnSpan > 0)
SetColumnSpan(controlView, 2);
}
//------------------------------------------------------------------- //-------------------------------------------------------------------
// G r i d E v e n t s // G r i d E v e n t s
//------------------------------------------------------------------- //-------------------------------------------------------------------
@@ -6,7 +6,7 @@ using System.Text;
using Xamarin.Forms; using Xamarin.Forms;
namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Views
{ {
//======================================================================= //=======================================================================
public class SlmScrollView : ScrollView public class SlmScrollView : ScrollView
@@ -4,7 +4,7 @@ using System.Collections.Generic;
using System.Text; using System.Text;
using Xamarin.Forms; using Xamarin.Forms;
namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Views
{ {
//======================================================================= //=======================================================================
public class SlmView : SaxView public class SlmView : SaxView
@@ -7,7 +7,7 @@ using System.Collections.Generic;
using System.Text; using System.Text;
using Xamarin.Forms; using Xamarin.Forms;
namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Base namespace Sarand.LogisticsMgr.Mobile.Core.Forms.Views
{ {
//======================================================================= //=======================================================================
public class SlmWebView : SaxWebView public class SlmWebView : SaxWebView
+1 -1
View File
@@ -6,7 +6,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Xamarin.Essentials" Version="1.1.0" /> <PackageReference Include="Xamarin.Essentials" Version="1.2.0" />
<PackageReference Include="Xamarin.Forms" Version="3.6.0.344457" /> <PackageReference Include="Xamarin.Forms" Version="3.6.0.344457" />
</ItemGroup> </ItemGroup>