diff --git a/devdocs/specs/core-customize-form-fields.txt b/devdocs/specs/core-customize-form-fields.txt index 099c9e19..f0c0df9d 100644 --- a/devdocs/specs/core-customize-form-fields.txt +++ b/devdocs/specs/core-customize-form-fields.txt @@ -36,6 +36,8 @@ UI FEATURE - The ability to customize forms: - According to the docs https://www.postgresql.org/docs/9.1/datatype-character.html this is pretty efficient - I don't like the idea of an outside table holding all custom values, it would be hammered pretty hard, this way the data stays with it's record - The server doesn't validate it or anything, just stores what the client provides and retrieves what the client needs and the client co-erces the value to the correct type + - If a user changes the underlying objects type then the client must handle discrepencies and attempt to fix it. + - So the client end must handle adapting the value if the type changes ## TODO diff --git a/server/AyaNova/Controllers/FormCustomController.cs b/server/AyaNova/Controllers/FormCustomController.cs index fd02dd3d..e0e72431 100644 --- a/server/AyaNova/Controllers/FormCustomController.cs +++ b/server/AyaNova/Controllers/FormCustomController.cs @@ -53,8 +53,8 @@ namespace AyaNova.Api.Controllers /// Any /// /// - /// - /// + /// The official form key used by AyaNova + /// A prior concurrency token used to check if there are any changes without using up bandwidth sending unnecessary data /// A single FormCustom [HttpGet("{formkey}")] public async Task GetFormCustom([FromRoute] string formkey, [FromQuery] uint? concurrencyToken) diff --git a/server/AyaNova/biz/FormAvailableFields.cs b/server/AyaNova/biz/FormAvailableFields.cs index 1585b337..08800416 100644 --- a/server/AyaNova/biz/FormAvailableFields.cs +++ b/server/AyaNova/biz/FormAvailableFields.cs @@ -14,7 +14,7 @@ namespace AyaNova.Biz get { List l = new List{ - WIDGET_FORM_KEY//,USER_CRUD, WIDGET etc + WIDGET_FORM_KEY, USER_FORM_KEY }; return l; } diff --git a/server/AyaNova/util/Seeder.cs b/server/AyaNova/util/Seeder.cs index 3575a4b3..32089e18 100644 --- a/server/AyaNova/util/Seeder.cs +++ b/server/AyaNova/util/Seeder.cs @@ -76,6 +76,25 @@ namespace AyaNova.Util ct.SaveChanges(); } + + //WIDGET sample form customization + { + var ct = ServiceProviderProvider.DBContext; + var fc = new FormCustom() + { + FormKey = "widget", + Template = "{template:[{fld:\"WidgetNotes\",required:\"true\"}" + + ",{fld:\"WidgetCustom1\",hide:\"false\",required:\"false\", type:\"date\"}" + + ",{fld:\"WidgetCustom2\",hide:\"false\",required:\"true\", type:\"text\"}" + + ",{fld:\"WidgetCustom3\",hide:\"false\",required:\"false\", type:\"int\"}" + + ",{fld:\"WidgetCustom4\",hide:\"false\",required:\"false\", type:\"bool\"}" + + ",{fld:\"WidgetCustom5\",hide:\"false\",required:\"false\", type:\"decimal\"}" + + "]" + }; + + ct.FormCustom.Add(fc); + ct.SaveChanges(); + } //Seed special test data for integration testing //log.LogInformation("Seeding known users"); @@ -462,6 +481,7 @@ namespace AyaNova.Util + for (int x = 0; x < count; x++) { Widget o = new Widget(); @@ -475,6 +495,21 @@ namespace AyaNova.Util o.Roles = randomRole; o.Notes = f.Lorem.Paragraph(); o.Tags = RandomTags(f); + + +//RANDOM CUSTOM FIELD DATA +var custDate=GetSomeDateHereThatIsThenMadeIntoText; + +// Template = "{template:[{fld:\"WidgetNotes\",required:\"true\"}" + +// ",{fld:\"WidgetCustom1\",hide:\"false\",required:\"false\", type:\"date\"}" + +// ",{fld:\"WidgetCustom2\",hide:\"false\",required:\"true\", type:\"text\"}" + +// ",{fld:\"WidgetCustom3\",hide:\"false\",required:\"false\", type:\"int\"}" + +// ",{fld:\"WidgetCustom4\",hide:\"false\",required:\"false\", type:\"bool\"}" + +// ",{fld:\"WidgetCustom5\",hide:\"false\",required:\"false\", type:\"decimal\"}" + +// "]" + + + var NewObject = Biz.Create(ServiceProviderProvider.DBContext, o); if (NewObject == null) {