|
@@ -14,6 +14,7 @@ using comal.timesheets.Tasks;
|
|
|
using Comal.Classes;
|
|
|
using PRSClasses;
|
|
|
using Newtonsoft.Json;
|
|
|
+using Java.Security.Cert;
|
|
|
|
|
|
namespace comal.timesheets.QAForms
|
|
|
{
|
|
@@ -137,9 +138,14 @@ namespace comal.timesheets.QAForms
|
|
|
def.SetValue(RowDefinition.HeightProperty, 60);
|
|
|
}
|
|
|
}
|
|
|
- else if (row == "*")
|
|
|
+ else if (row.Contains("*"))
|
|
|
{
|
|
|
- def = new RowDefinition { Height = new GridLength(1, GridUnitType.Star) };
|
|
|
+ if (int.TryParse(row.Substring(0, row.IndexOf("*")), out int result))
|
|
|
+ {
|
|
|
+ def = new RowDefinition { Height = new GridLength(result, GridUnitType.Star) };
|
|
|
+ }
|
|
|
+ else
|
|
|
+ def = new RowDefinition { Height = new GridLength(1, GridUnitType.Star) };
|
|
|
}
|
|
|
Device.BeginInvokeOnMainThread(() => { RowDefinitions.Add(def); });
|
|
|
}
|
|
@@ -151,9 +157,14 @@ namespace comal.timesheets.QAForms
|
|
|
ColumnDefinition def = new ColumnDefinition { Width = new GridLength(1, GridUnitType.Auto) };
|
|
|
if (int.TryParse(col, out int colWidth))
|
|
|
def = new ColumnDefinition { Width = new GridLength(colWidth, GridUnitType.Absolute) };
|
|
|
- else if (col == "*")
|
|
|
+ else if (col.Contains("*"))
|
|
|
{
|
|
|
- def = new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) };
|
|
|
+ if (int.TryParse(col.Substring(0, col.IndexOf("*")), out int result))
|
|
|
+ {
|
|
|
+ def = new ColumnDefinition { Width = new GridLength(result, GridUnitType.Star) };
|
|
|
+ }
|
|
|
+ else
|
|
|
+ def = new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) };
|
|
|
}
|
|
|
Device.BeginInvokeOnMainThread(() => { ColumnDefinitions.Add(def); });
|
|
|
}
|
|
@@ -258,12 +269,14 @@ namespace comal.timesheets.QAForms
|
|
|
{
|
|
|
FormatAndAddView(LoadHeader(element), element, false);
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
private View LoadHeader(DFLayoutControl element)
|
|
|
{
|
|
|
DFLayoutHeader dFLayoutHeader = (DFLayoutHeader)element;
|
|
|
DigitalFormsHeader header = new DigitalFormsHeader(dFLayoutHeader.Collapsed);
|
|
|
+ header.SetHeaderStyle(dFLayoutHeader);
|
|
|
if (dFLayoutHeader.Collapsed)
|
|
|
header = AddNumberToHeader(header);
|
|
|
|
|
@@ -396,7 +409,7 @@ namespace comal.timesheets.QAForms
|
|
|
{
|
|
|
dfLayout.ChangeField(dfLayoutBooleanField.Name);
|
|
|
};
|
|
|
-
|
|
|
+
|
|
|
return new Tuple<View, Boolean>(item, dfLayoutBooleanField.Properties.Required);
|
|
|
}
|
|
|
|
|
@@ -405,17 +418,39 @@ namespace comal.timesheets.QAForms
|
|
|
DFLayoutLabel label = element as DFLayoutLabel;
|
|
|
Label item = new Label();
|
|
|
item.Text = label.Caption;
|
|
|
- item.FontSize = Device.GetNamedSize(NamedSize.Medium, item);
|
|
|
item.TextColor = Color.Black;
|
|
|
- item.LineBreakMode = LineBreakMode.WordWrap;
|
|
|
+ item.LineBreakMode = label.Style.TextWrapping == true ? LineBreakMode.WordWrap : LineBreakMode.NoWrap;
|
|
|
item.VerticalOptions = LayoutOptions.FillAndExpand;
|
|
|
- item.VerticalTextAlignment = TextAlignment.Center;
|
|
|
item.MinimumHeightRequest = 60;
|
|
|
+ item.BackgroundColor = label.Style.BackgroundColour;
|
|
|
+
|
|
|
+ item.FontAttributes = label.Style.IsBold ? FontAttributes.Bold
|
|
|
+ : label.Style.IsItalic ? FontAttributes.Italic
|
|
|
+ : FontAttributes.None;
|
|
|
+ item.TextDecorations = label.Style.Underline == UnderlineType.Single || label.Style.Underline == UnderlineType.Double ?
|
|
|
+ TextDecorations.Underline : TextDecorations.None;
|
|
|
+
|
|
|
+ item.FontSize = label.Style.FontSize > 5 && label.Style.FontSize < 37 ? label.Style.FontSize
|
|
|
+ : Device.GetNamedSize(NamedSize.Medium, item);
|
|
|
+
|
|
|
+ item.TextColor = label.Style.ForegroundColour;
|
|
|
+
|
|
|
if (ColumnDefinitions.Count == 1)
|
|
|
{
|
|
|
item.HorizontalOptions = LayoutOptions.CenterAndExpand;
|
|
|
item.HorizontalTextAlignment = TextAlignment.Center;
|
|
|
- }
|
|
|
+ }
|
|
|
+
|
|
|
+ item.HorizontalTextAlignment = label.Style.HorizontalTextAlignment == DFLayoutAlignment.Start ? TextAlignment.Start
|
|
|
+ : label.Style.HorizontalTextAlignment == DFLayoutAlignment.Middle ? TextAlignment.Center
|
|
|
+ : label.Style.HorizontalTextAlignment == DFLayoutAlignment.End ? TextAlignment.End
|
|
|
+ : item.HorizontalTextAlignment;
|
|
|
+
|
|
|
+ item.VerticalTextAlignment = label.Style.VerticalTextAlignment == DFLayoutAlignment.Start ? TextAlignment.Start
|
|
|
+ : label.Style.HorizontalTextAlignment == DFLayoutAlignment.Middle ? TextAlignment.Center
|
|
|
+ : label.Style.HorizontalTextAlignment == DFLayoutAlignment.End ? TextAlignment.End
|
|
|
+ : TextAlignment.Center;
|
|
|
+
|
|
|
return new Tuple<View, Boolean>(item, false);
|
|
|
}
|
|
|
|
|
@@ -431,26 +466,48 @@ namespace comal.timesheets.QAForms
|
|
|
if (element is DFLayoutStringField)
|
|
|
{
|
|
|
DFLayoutStringField dfLayoutStringField = element as DFLayoutStringField;
|
|
|
+
|
|
|
item.TextColor = Color.Black;
|
|
|
item.Placeholder = "Enter answer";
|
|
|
isrequired = dfLayoutStringField.Properties.Required;
|
|
|
issecure = dfLayoutStringField.Properties.Secure;
|
|
|
+
|
|
|
+ DataButtonControl button = new DataButtonControl();
|
|
|
+ button.Clicked += (s, e) =>
|
|
|
+ {
|
|
|
+ PopupEditor edt = new PopupEditor(button.Data);
|
|
|
+ edt.OnPopupEdtSaved += (text) =>
|
|
|
+ {
|
|
|
+ button.Data = text;
|
|
|
+ button.Text = text.Length > 25 ? text.Substring(0, 25) + "..." : text;
|
|
|
+ dfLayout.ChangeField(dfLayoutStringField.Name);
|
|
|
+ };
|
|
|
+ Navigation.PushAsync(edt);
|
|
|
+ };
|
|
|
+ button.Text = "Edit";
|
|
|
+
|
|
|
if (loadData.TryGetValue(dfLayoutStringField.Name, out value))
|
|
|
{
|
|
|
- item.Text = value;
|
|
|
+ item.Text = value;
|
|
|
+ button.Text = value.Length > 25 ? value.Substring(0, 25) + "..." : value;
|
|
|
}
|
|
|
if (loadRetainedForm)
|
|
|
{
|
|
|
if (RetainedResults.Results.TryGetValue(dfLayoutStringField.Name, out value))
|
|
|
{
|
|
|
item.Text = value;
|
|
|
+ button.Text = value.Length > 25 ? value.Substring(0, 25) + "..." : value;
|
|
|
}
|
|
|
}
|
|
|
item.TextChanged += (object sender, TextChangedEventArgs e) =>
|
|
|
{
|
|
|
dfLayout.ChangeField(dfLayoutStringField.Name);
|
|
|
};
|
|
|
- view = item;
|
|
|
+
|
|
|
+ if (dfLayoutStringField.Properties.PopupEditor)
|
|
|
+ view = button;
|
|
|
+ else
|
|
|
+ view = item;
|
|
|
}
|
|
|
|
|
|
else if (element is DFLayoutIntegerField)
|
|
@@ -548,7 +605,7 @@ namespace comal.timesheets.QAForms
|
|
|
item.DateSelected += (object sender, DateChangedEventArgs e) =>
|
|
|
{
|
|
|
dfLayout.ChangeField(dfLayoutDateField.Name);
|
|
|
- };
|
|
|
+ };
|
|
|
|
|
|
return new Tuple<View, Boolean>(item, dfLayoutDateField.Properties.Required);
|
|
|
}
|
|
@@ -585,7 +642,7 @@ namespace comal.timesheets.QAForms
|
|
|
{
|
|
|
View view = null;
|
|
|
try
|
|
|
- {
|
|
|
+ {
|
|
|
string value = "";
|
|
|
|
|
|
var isrequired = false;
|
|
@@ -791,14 +848,7 @@ namespace comal.timesheets.QAForms
|
|
|
DataButtonControl button = new DataButtonControl()
|
|
|
{
|
|
|
Text = "Choose Option",
|
|
|
- HorizontalOptions = LayoutOptions.FillAndExpand,
|
|
|
- VerticalOptions = LayoutOptions.Center,
|
|
|
Margin = 0,
|
|
|
- BackgroundColor = Color.FromHex("#15C7C1"),
|
|
|
- FontAttributes = FontAttributes.Bold,
|
|
|
- TextColor = Color.White,
|
|
|
- CornerRadius = 5,
|
|
|
- Padding = 1,
|
|
|
ExtraData = additionalPropertyValues,
|
|
|
LookupFieldOptions = lookupFieldOptions
|
|
|
};
|
|
@@ -855,14 +905,6 @@ namespace comal.timesheets.QAForms
|
|
|
DataButtonControl button = new DataButtonControl()
|
|
|
{
|
|
|
Text = "Choose Option",
|
|
|
- HorizontalOptions = LayoutOptions.FillAndExpand,
|
|
|
- VerticalOptions = LayoutOptions.Center,
|
|
|
- Margin = 0,
|
|
|
- BackgroundColor = Color.FromHex("#15C7C1"),
|
|
|
- FontAttributes = FontAttributes.Bold,
|
|
|
- TextColor = Color.White,
|
|
|
- CornerRadius = 5,
|
|
|
- Padding = 1,
|
|
|
};
|
|
|
button.Clicked += (object sender, EventArgs eventArgs) =>
|
|
|
{
|
|
@@ -1172,11 +1214,6 @@ namespace comal.timesheets.QAForms
|
|
|
DataButtonControl button = new DataButtonControl
|
|
|
{
|
|
|
Text = "Add Signatures",
|
|
|
- TextColor = Color.White,
|
|
|
- HorizontalOptions = LayoutOptions.FillAndExpand,
|
|
|
- CornerRadius = 0,
|
|
|
- BackgroundColor = Color.FromHex("#15C7C1"),
|
|
|
- FontAttributes = FontAttributes.Bold
|
|
|
};
|
|
|
if (loadData.TryGetValue(dfLayoutMultiSignaturePad.Name, out value))
|
|
|
{
|
|
@@ -1334,7 +1371,10 @@ namespace comal.timesheets.QAForms
|
|
|
string userInput = "";
|
|
|
if (field is DFLayoutStringField || field is DFLayoutIntegerField || field is DFLayoutDoubleField)
|
|
|
{
|
|
|
- userInput = (view as Editor).Text;
|
|
|
+ if (field is DFLayoutStringField && (field as DFLayoutStringField).Properties.PopupEditor)
|
|
|
+ userInput = (view as DataButtonControl).Data;
|
|
|
+ else
|
|
|
+ userInput = (view as Editor).Text;
|
|
|
}
|
|
|
else if (field is DFLayoutBooleanField)
|
|
|
{
|
|
@@ -1822,7 +1862,15 @@ namespace comal.timesheets.QAForms
|
|
|
(view as CustomBoolean).Value = (bool)value;
|
|
|
|
|
|
else if (field is DFLayoutStringField || field is DFLayoutIntegerField || field is DFLayoutDoubleField)
|
|
|
- (view as Editor).Text = value.ToString();
|
|
|
+ {
|
|
|
+ if (field is DFLayoutStringField && (field as DFLayoutStringField).Properties.PopupEditor)
|
|
|
+ {
|
|
|
+ (view as DataButtonControl).Data = value.ToString();
|
|
|
+ (view as DataButtonControl).Text = value.ToString();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ (view as Editor).Text = value.ToString();
|
|
|
+ }
|
|
|
|
|
|
else if (field is DFLayoutDateField)
|
|
|
(view as DatePicker).Date = (DateTime)(value as DateTime?);
|
|
@@ -1891,8 +1939,13 @@ namespace comal.timesheets.QAForms
|
|
|
return (view as CustomBoolean).Value;
|
|
|
|
|
|
if (field is DFLayoutStringField)
|
|
|
- return (view as Editor).Text;
|
|
|
-
|
|
|
+ {
|
|
|
+ if ((field as DFLayoutStringField).Properties.PopupEditor)
|
|
|
+ return (view as DataButtonControl).Data;
|
|
|
+ else
|
|
|
+ return (view as Editor).Text;
|
|
|
+ }
|
|
|
+
|
|
|
else if (field is DFLayoutIntegerField)
|
|
|
return int.Parse((view as Editor).Text);
|
|
|
|