diff --git a/devdocs/todo.txt b/devdocs/todo.txt index 4404f62a..97b5497c 100644 --- a/devdocs/todo.txt +++ b/devdocs/todo.txt @@ -20,6 +20,15 @@ REALLY MAKING MORE PROGRESS WHEN CLIENT DEV DRIVES BACKEND DEV, STICK TO THAT!! ----------------------- DATATYPE: should this be an enum rather than text because text takes up a lot of space bandwidth wise and is inefficient and also an enum can allow compiler type enforcement to avoid typos etc + - Test enum picklist route on datatypes + +CLIENT CUSTOM FIELDS CHANGE + - Must use numeric instead of text values now + - Additional NUMBER is split now between integer and decimal types update control STEP value for inputs to include decimal places or none depending on type + +TEST CHANGES + - Must use numeric instead of text values now + - Test datatypes enum picklist GRID LISTS TODO NOW: diff --git a/server/AyaNova/Controllers/AyaEnumPickListController.cs b/server/AyaNova/Controllers/AyaEnumPickListController.cs index 8bab10c4..9f6e3368 100644 --- a/server/AyaNova/Controllers/AyaEnumPickListController.cs +++ b/server/AyaNova/Controllers/AyaEnumPickListController.cs @@ -63,6 +63,19 @@ namespace AyaNova.Api.Controllers switch (enumkey) { + case "datatypes": + { + //Iterate the enum and get the values + Type t = typeof(AyaDataType); + Enum.GetName(t, AyaDataType.NoType); + foreach (var dt in Enum.GetValues(t)) + { + ReturnList.Add(new NameIdItem() { Name = Enum.GetName(t, dt), Id = (long) dt }); + } + + } + break; + case "usertypes": { LocaleKeysToFetch.Add("UserTypesAdministrator"); @@ -160,6 +173,7 @@ namespace AyaNova.Api.Controllers ret.Add(new KeyValuePair("usertypes", "AyaNova user account types")); ret.Add(new KeyValuePair("authorizationroles", "AyaNova user account role types")); ret.Add(new KeyValuePair("AyaType", "All AyaNova object types, use the AyaTypeController route to fetch these")); + ret.Add(new KeyValuePair("datatypes", "Types of data used in AyaNova for display and formatting UI purposes")); return Ok(ApiOkResponse.Response(ret, true)); } diff --git a/server/AyaNova/Controllers/FormCustomController.cs b/server/AyaNova/Controllers/FormCustomController.cs index 0614bbf9..2be68e88 100644 --- a/server/AyaNova/Controllers/FormCustomController.cs +++ b/server/AyaNova/Controllers/FormCustomController.cs @@ -102,12 +102,14 @@ namespace AyaNova.Api.Controllers /// /// Get available types allowed for Custom fields /// Used to build UI for customizing a form + /// These values are a subset of the AyaDataTypes values + /// which can be fetched from the EnumPickList route /// /// Required roles: /// BizAdminFull only has rights to customize forms /// /// - /// A list of type string values valid for custom fields + /// A list of valid values for custom field types [HttpGet("AvailableCustomTypes")] public ActionResult GetAvailableCustomTypes() { diff --git a/server/AyaNova/biz/CustomFieldType.cs b/server/AyaNova/biz/CustomFieldType.cs index 245cee29..4cec97fe 100644 --- a/server/AyaNova/biz/CustomFieldType.cs +++ b/server/AyaNova/biz/CustomFieldType.cs @@ -13,16 +13,6 @@ namespace AyaNova.Biz // - Text // - Bool - // public const string Currency = "currency"; - // public const string Date = "date"; - // public const string Time = "time"; - // public const string DateTime = "datetime"; - // public const string Text = "text"; - // public const string Number = "number"; //decimal regardless - // public const string Bool = "bool"; - - - public static List ValidCustomFieldTypes { get @@ -31,10 +21,11 @@ namespace AyaNova.Biz ret.Add((int)AyaDataType.Currency); ret.Add((int)AyaDataType.Date); ret.Add((int)AyaDataType.Time); - ret.Add((int)AyaDataType.DateTime); + ret.Add((int)AyaDataType.DateTime); ret.Add((int)AyaDataType.Text); - ret.Add((int)AyaDataType.Number); - ret.Add((int)AyaDataType.Bool); + ret.Add((int)AyaDataType.Decimal); + ret.Add((int)AyaDataType.Integer); + ret.Add((int)AyaDataType.Bool); return ret; } } diff --git a/server/AyaNova/biz/FormCustomBiz.cs b/server/AyaNova/biz/FormCustomBiz.cs index dd276a36..8bd94792 100644 --- a/server/AyaNova/biz/FormCustomBiz.cs +++ b/server/AyaNova/biz/FormCustomBiz.cs @@ -258,7 +258,7 @@ namespace AyaNova.Biz AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "Template", $"Template array item {i}, \"type\" property value is not valid, only Custom fields can have types specified"); else {//It is a custom field, is it a valid type value - var templateFieldCustomTypeValue = formFieldItem["type"].Value(); + var templateFieldCustomTypeValue = formFieldItem["type"].Value(); if (!ValidCustomFieldTypes.Contains(templateFieldCustomTypeValue)) AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "Template", $"Template array item {i}, \"type\" property value of \"{templateFieldCustomTypeValue}\" is not a valid custom field type"); } diff --git a/server/AyaNova/util/Seeder.cs b/server/AyaNova/util/Seeder.cs index b33ff54d..0eeb05a4 100644 --- a/server/AyaNova/util/Seeder.cs +++ b/server/AyaNova/util/Seeder.cs @@ -79,6 +79,7 @@ namespace AyaNova.Util //WIDGET sample form customization { + var fc = new FormCustom() { FormKey = ObjectFields.WIDGET_KEY, @@ -90,37 +91,37 @@ namespace AyaNova.Util { ""fld"": ""WidgetCustom1"", ""required"": false, - ""type"": ""datetime"" + ""type"": 1 }, { ""fld"": ""WidgetCustom2"", ""required"": true, - ""type"": ""text"" + ""type"": 4 }, { ""fld"": ""WidgetCustom3"", ""required"": false, - ""type"": ""number"" + ""type"": 5 }, { ""fld"": ""WidgetCustom4"", ""required"": false, - ""type"": ""bool"" + ""type"": 6 }, { ""fld"": ""WidgetCustom5"", ""required"": false, - ""type"": ""currency"" + ""type"": 8 }, { ""fld"": ""WidgetCustom6"", ""required"": false, - ""type"": ""date"" + ""type"": 2 }, { ""fld"": ""WidgetCustom7"", ""required"": false, - ""type"": ""time"" + ""type"": 3 } ]" };