diff --git a/ayanova/devdocs/todo.txt b/ayanova/devdocs/todo.txt index 9f92e32c..17eb09e2 100644 --- a/ayanova/devdocs/todo.txt +++ b/ayanova/devdocs/todo.txt @@ -46,33 +46,23 @@ CURRENT TODOs =-=-=-=-=-=-= -TODO: UI would be greatly enhanced if server defined form customization rules for required fields REGULAR fields only (custom are already handled) were incorporated into client end before roundtripping to the server - - Right now it has to save the record to get the return errors about required regular fields, that is shit. The client is easily able to tell what is required in the form customization so it should be able to surface that up front - - This will save bandwidth and annoyance factor 1000 for people - - ERROR MESSAGE: - - Currently it appears identically to the stock required but should indicate it's user required - - Need new or maybe already exists locale key for it, currently it's this: // "ErrorRequiredFieldEmpty": "{0} is a required field. Please enter a value for {0}", - -TODO: Widget edit form, new record sb time and dates pre-filled in? Server involved? How to handle new record initial date set? - - Seeing a few issues that are probably related to having an empty record on start of new object - - Don't start blank basically - - some objects may be configurable what the default date/time range is so maybe enable that for widget to test - - SB defaults route on server or is this a profile thing and user selectable? +TODO: Why am I using different values for ref in the form than the server knows the fields to be named??? + - Answer is I'm not actually, the server knows them as the field names of the widget object for example StartDate but sends them not capitalized on first character + - I'm thinking of the LT keys which because they need to be system wide unique are prepended with the object name -TODO: Form customize UI +TODO: Form customization - hidden fields support + - Obviously not the required ones (how to know if required?) + + +TODO: Any other widget form stuff, then do a on server test (bump version) then can proceed + + + +TODO: MOVE THIS DOWN? AFTER ALL WIDGET FORM STUFF IS DONE Form customize UI - Where you create custom fields and edit - If a user changes a field data type there needs to be a big warning before accepting it. -TODO: Support form customization beyond Custom: - - hide fields not used - - force user to enter a value in a field optionally that isn't already required - -TODO: Save button isn't enabling on changes in new record when it should. Enter in a value in the Name field of an empty record and move to a new field and it should immediately show the save button due to dirtiness? - - Or is it becuase of broken rules that are not being displayed immediately? (new record should really show a bunch of broken rules right away as it has some empty and required fields) - - Yes this seems to be it, also until all rules are unbroken save sb not enabled, but it appears that one more edit needs to be done after the last broken rule to unstick it or maybe it's the case mismatch issue above that will fix it - - diff --git a/ayanova/src/api/gzform.js b/ayanova/src/api/gzform.js index cea1e4cd..059d5442 100644 --- a/ayanova/src/api/gzform.js +++ b/ayanova/src/api/gzform.js @@ -47,20 +47,14 @@ function isNumber(n) { // function getControl(vm, ref) { var ctrl = vm.$refs[ref]; - if (ctrl === undefined) { - //it's either a sub field in custom fields component or it's a coding error - var customFields = vm.$refs["customFields"]; - if (customFields !== undefined) { - ctrl = customFields.$refs[ref]; - } - } - //can't do it like this because during init undefined is normal apparently - // if (ctrl === undefined && window.$gz.errorHandler.devMode()) { - // debugger; - // throw "DEV ERROR gzform::formState.getControl -> control ref of [" + - // ref + - // "] was not found in the form or in the custom fields"; + //I don't think this is reauired anymore + // if (ctrl === undefined) { + // //it's either a sub field in custom fields component or it's a coding error + // var customFields = vm.$refs["customFields"]; + // if (customFields !== undefined) { + // ctrl = customFields.$refs[ref]; + // } // } return ctrl; @@ -345,7 +339,7 @@ export default { // USER REQUIRED FIELDS // (Fields defined by AyaNova users as required on form that are not stock required already) // - userRequiredFields(vm, ref, userRequiredFieldName) { + userRequiredFields(vm, ref, formCustomTemplateFieldName) { if (vm.formState.loading) { return false; } @@ -355,13 +349,13 @@ export default { if (template === undefined) { return false; } - //See if control ref is in server required fields collection + //See if control formCustomTemplateFieldName is in server required fields collection //this is a collection of both custom field definitions and standard form fields that are required //since all names are unique can just filter out the one we need by name which will inherently ignore custom fields by default //_https://lodash.com/docs#find var templateItem = window.$gz._.find(template, [ "fld", - userRequiredFieldName + formCustomTemplateFieldName ]); //templateItem.required is a string value, not a boolean value @@ -521,6 +515,34 @@ export default { //default if no error message to display return ret; }, + /////////////////////////////// + // ShowMe + // (returns false if the field has been set to hidden by the user in the formcustomtemplate) + // NOTE: that in a form this should only be used with non stock-required fields, if they are already required they cannot be hidden + // + showMe(vm, formCustomTemplateFieldName) { + var template = + window.$gz.store.state.formCustomTemplate[vm.formCustomTemplateKey]; + if (template === undefined) { + return true; + } + //See if control templateFieldName is in server required fields collection + //this is a collection of both custom field definitions and standard form fields that are required + //since all names are unique can just filter out the one we need by name which will inherently ignore custom fields by default + //_https://lodash.com/docs#find + var templateItem = window.$gz._.find(template, [ + "fld", + formCustomTemplateFieldName + ]); + + //templateItem.required is a string value, not a boolean value + if (templateItem === undefined || templateItem.hide !== "true") { + return true; + } + + //Only here if we have a record in the custom template for this particular field and it's set to hide:"true" + return false; + }, /////////////////////////////// // ClearformState.serverErrors diff --git a/ayanova/src/views/inventory-widget-edit.vue b/ayanova/src/views/inventory-widget-edit.vue index 8321e609..6940dfbb 100644 --- a/ayanova/src/views/inventory-widget-edit.vue +++ b/ayanova/src/views/inventory-widget-edit.vue @@ -34,7 +34,13 @@ @change="onChange('name')" > - +