From a01cd5b118d57b770a6424ae29427669e14508e4 Mon Sep 17 00:00:00 2001 From: midhun-aot Date: Thu, 7 Mar 2024 14:03:41 -0800 Subject: [PATCH] Disabling edit grid controls --- .../Site Risk Classification Report.json | 148 +++++++------ .../epd-forms/Summary of Site Condition.json | 202 ++++++++++-------- 2 files changed, 195 insertions(+), 155 deletions(-) diff --git a/forms-flow-ai/epd-forms/Site Risk Classification Report.json b/forms-flow-ai/epd-forms/Site Risk Classification Report.json index 96f1196b..6a184323 100644 --- a/forms-flow-ai/epd-forms/Site Risk Classification Report.json +++ b/forms-flow-ai/epd-forms/Site Risk Classification Report.json @@ -152,10 +152,58 @@ }, { "title": "Associated Application ID ( if any)", + "theme": "default", + "tooltip": "", + "customClass": "", "collapsible": false, + "hidden": false, + "hideLabel": false, + "disabled": false, + "modalEdit": false, "key": "associatedApplicationIdIfAny", + "tags": [], + "properties": {}, + "customConditional": "", + "conditional": { + "json": "", + "show": null, + "when": null, + "eq": "" + }, + "logic": [ + { + "name": "Disable Logic", + "trigger": { + "type": "javascript", + "javascript": "result = true;\r\nconst UserDetails = JSON.parse(localStorage.getItem(\"UserDetails\"))\r\n\tconst groups = UserDetails[\"groups\"];\r\n\tif(!(groups.includes(\"/formsflow/formsflow-client\") || groups.includes(\"/formsflow/formsflow-reviewer/formsflow-client-reviewer\")))\r\n\t{\r\n\t\tresult = true;\r\n\t}\r\n\telse\r\n\t{\r\n\t\tresult= false;\r\n\t}\t\r\n\t\r\n\t\t\t" + }, + "actions": [ + { + "name": "Disable Action", + "type": "property", + "property": { + "label": "Disabled", + "value": "disabled", + "type": "boolean" + }, + "state": true + } + ] + } + ], + "attributes": {}, + "overlay": { + "style": "", + "page": "", + "left": "", + "top": "", + "width": "", + "height": "" + }, "type": "panel", "label": "Panel", + "breadcrumb": "default", + "tabindex": "", "input": false, "tableView": false, "components": [ @@ -231,7 +279,7 @@ "allowMultipleMasks": false, "addons": [], "tag": "p", - "id": "ez8txui" + "id": "egcu3jc" }, { "label": "Edit Grid", @@ -323,7 +371,7 @@ "displayMask": "", "spellcheck": true, "truncateMultipleSpaces": false, - "id": "etraas" + "id": "ejn0z6b" } ], "width": 2, @@ -407,7 +455,7 @@ "tree": false, "lazyLoad": false, "autoAdjust": false, - "id": "eoo3f8r" + "id": "e1ko0yr" } ], "placeholder": "", @@ -481,38 +529,30 @@ "tableRow": "\n {% util.eachComponent(components, function(component) { %}\n {% if (!component.hasOwnProperty('tableView') || component.tableView) { %}\n \n {{ getView(component, row[component.key]) }}\n \n {% } %}\n {% }) %}\n {% if (!instance.options.readOnly && !instance.disabled) { %}\n \n
\n \n {% if (!instance.hasRemoveButtons || instance.hasRemoveButtons()) { %}\n \n {% } %}\n
\n \n {% } %}\n ", "footer": "" }, - "id": "e3j7z5l" + "id": "e8wkano" } ], "placeholder": "", "prefix": "", - "customClass": "", "suffix": "", "multiple": false, "defaultValue": null, "protected": false, "unique": false, "persistent": false, - "hidden": false, "clearOnHide": false, "refreshOn": "", "redrawOn": "", - "modalEdit": false, "dataGridLabel": false, "labelPosition": "top", "description": "", "errorLabel": "", - "tooltip": "", - "hideLabel": false, - "tabindex": "", - "disabled": false, "autofocus": false, "dbIndex": false, "customDefaultValue": "", "calculateValue": "", "calculateServer": false, "widget": null, - "attributes": {}, "validateOn": "change", "validate": { "required": false, @@ -522,30 +562,15 @@ "multiple": false, "unique": false }, - "conditional": { - "show": null, - "when": null, - "eq": "" - }, - "overlay": { - "style": "", - "left": "", - "top": "", - "width": "", - "height": "" - }, "allowCalculateOverride": false, "encrypted": false, "showCharCount": false, "showWordCount": false, - "properties": {}, "allowMultipleMasks": false, "addons": [], "tree": false, "lazyLoad": false, - "theme": "default", - "breadcrumb": "default", - "id": "e0v23wm" + "id": "erd4jar" }, { "label": "Text Area", @@ -1834,7 +1859,7 @@ "validate": { "required": false, "customMessage": "", - "custom": "const emptyElements = [];\nconst elements = document.getElementsByClassName(\"list-group-item\");\nfor (let i = 0; i < elements.length; i++) {\nconst element = elements[i];\n\nif(element.querySelectorAll('div.row').length===0){(element).remove() }\n \n}\n\n\nvar b =JSON.parse(localStorage.getItem('UserDetails'))\n\nif(b.groups.includes(\"/formsflow/formsflow-client\") || b.groups.includes(\"/formsflow/formsflow-reviewer/formsflow-client-reviewer\"))\n{\n\tif(document.querySelector(\"[ref='editgrid-srcrNotes-addRow']\")!==null)\n\t{\n\t\tdocument.querySelector(\"[ref='editgrid-srcrNotes-addRow']\").remove();\n\t}\nvar editButtons = document.querySelectorAll('button.btn.btn-default.btn-light.btn-sm.editRow');\nfor(i=0;ix.commentFor==='external').length > 0)\nshow = true;\nelse\nshow = false;\n}\nelse\n{\n show = true;\n}\n\nif(UserDetails){\nvar addRowButton = document.querySelector(\"button[ref=editgrid-srcrNotes-addRow]\");\nif(addRowButton!=null)\n{\naddRowButton.addEventListener('click',\n(e)=>{\n\t\tif( groups.includes(\"/formsflow/formsflow-reviewer/csap\") || groups.includes(\"/formsflow/formsflow-reviewer/csap-society\"))\n\t\t{\n\t\t var internalRadio = document.querySelectorAll(\"input[value='internal'][type='radio']\");\n\t\t for (let i = 0; i < internalRadio.length; i++) {\n\t\t\tif(internalRadio[i].parentElement !== null)\n\t\t\t{\n\t\t\t\tinternalRadio[i].parentElement.remove();\n\t\t\t}\n\t\t }\n\t\t}\n})\n\nconst emptyElements = [];\nconst elements = document.getElementsByClassName(\"list-group-item\");\nfor (let i = 0; i < elements.length; i++) {\nconst element = elements[i];\n\nif(element.querySelectorAll('div.row').length===0){(element).remove() }\n \n}\n}\n\n\nconst emptyElements = [];\nconst elements = document.getElementsByClassName(\"list-group-item\");\nfor (let i = 0; i < elements.length; i++) {\nconst element = elements[i];\n\nif(element.querySelectorAll('div.row').length===0){(element).remove() }\n \n}\n\n\nvar b =JSON.parse(localStorage.getItem('UserDetails'))\n\nif(b.groups.includes(\"/formsflow/formsflow-client\") || b.groups.includes(\"/formsflow/formsflow-reviewer/formsflow-client-reviewer\") )\n{\n\tif(document.querySelector(\"[ref='editgrid-srcrNotes-addRow']\")!==null)\n\t{\n\t\tdocument.querySelector(\"[ref='editgrid-srcrNotes-addRow']\").remove();\n\t}\nvar editButtons = document.querySelectorAll('button.btn.btn-default.btn-light.btn-sm.editRow');\nfor(i=0;ix.commentFor==='external').length > 0)\r\nshow = true;\r\nelse\r\nshow = false;\r\n}\r\nelse\r\n{\r\n show = true;\r\n}\r\n\r\nif(UserDetails){\r\nvar addRowButton = document.querySelector(\"button[ref=editgrid-srcrNotes-addRow]\");\r\nif(addRowButton!=null)\r\n{\r\naddRowButton.addEventListener('click',\r\n(e)=>{\r\n\t\tif( groups.includes(\"/formsflow/formsflow-reviewer/csap\") || groups.includes(\"/formsflow/formsflow-reviewer/csap-society\"))\r\n\t\t{\r\n\t\t var internalRadio = document.querySelectorAll(\"input[value='internal'][type='radio']\");\r\n\t\t for (let i = 0; i < internalRadio.length; i++) {\r\n\t\t\tif(internalRadio[i].parentElement !== null)\r\n\t\t\t{\r\n\t\t\t\tinternalRadio[i].parentElement.remove();\r\n\t\t\t}\r\n\t\t }\r\n\t\t}\r\n})\r\n\r\nconst emptyElements = [];\r\nconst elements = document.getElementsByClassName(\"list-group-item\");\r\nfor (let i = 0; i < elements.length; i++) {\r\nconst element = elements[i];\r\n\r\nif(element.querySelectorAll('div.row').length===0){(element).remove() }\r\n \r\n}\r\n}\r\n\r\n\r\nconst emptyElements = [];\r\nconst elements = document.getElementsByClassName(\"list-group-item\");\r\nfor (let i = 0; i < elements.length; i++) {\r\nconst element = elements[i];\r\n\r\nif(element.querySelectorAll('div.row').length===0){(element).remove() }\r\n \r\n}\r\n\r\n\r\nvar b =JSON.parse(localStorage.getItem('UserDetails'))\r\n\r\nif(b.groups.includes(\"/formsflow/formsflow-client\") || b.groups.includes(\"/formsflow/formsflow-reviewer/formsflow-client-reviewer\") )\r\n{\r\n\tif(document.querySelector(\"[ref='editgrid-srcrNotes-addRow']\")!==null)\r\n\t{\r\n\t\tdocument.querySelector(\"[ref='editgrid-srcrNotes-addRow']\").remove();\r\n\t}\r\nvar editButtons = document.querySelectorAll('.formio-component-srcrNotes button.btn.btn-default.btn-light.btn-sm.editRow');\r\nfor(i=0;i\n {{ getView(component, row[component.key]) }}\n \n {% } %}\n {% }) %}\n {% if (!instance.options.readOnly && !instance.disabled) { %}\n \n
\n \n {% if (!instance.hasRemoveButtons || instance.hasRemoveButtons()) { %}\n \n {% } %}\n
\n \n {% } %}\n ", "footer": "" }, - "id": "eeiyt74" + "id": "e0du9x" } ], "placeholder": "", "prefix": "", - "customClass": "", "suffix": "", "multiple": false, "defaultValue": null, "protected": false, "unique": false, "persistent": false, - "hidden": false, "clearOnHide": false, "refreshOn": "", "redrawOn": "", - "modalEdit": false, "dataGridLabel": false, "labelPosition": "top", "description": "", "errorLabel": "", - "tooltip": "", - "hideLabel": false, - "tabindex": "", - "disabled": false, "autofocus": false, "dbIndex": false, "customDefaultValue": "", "calculateValue": "", "calculateServer": false, "widget": null, - "attributes": {}, "validateOn": "change", "validate": { "required": false, @@ -522,30 +562,15 @@ "multiple": false, "unique": false }, - "conditional": { - "show": null, - "when": null, - "eq": "" - }, - "overlay": { - "style": "", - "left": "", - "top": "", - "width": "", - "height": "" - }, "allowCalculateOverride": false, "encrypted": false, "showCharCount": false, "showWordCount": false, - "properties": {}, "allowMultipleMasks": false, "addons": [], "tree": false, "lazyLoad": false, - "theme": "default", - "breadcrumb": "default", - "id": "er67i3f" + "id": "ek29u5" }, { "label": "Text Area", @@ -1852,7 +1877,7 @@ "validate": { "required": false, "customMessage": "", - "custom": "const emptyElements = [];\r\nconst elements = document.getElementsByClassName(\"list-group-item\");\r\nfor (let i = 0; i < elements.length; i++) {\r\nconst element = elements[i];\r\n\r\nif(element.querySelectorAll('div.row').length===0){(element).remove() }\r\n \r\n}\r\n\r\n\r\nvar b =JSON.parse(localStorage.getItem('UserDetails'))\r\n\r\nif(b.groups.includes(\"/formsflow/formsflow-client\"))\r\n{\r\n\tif(document.querySelector(\"[ref='editgrid-soscNotes-addRow']\")!==null)\r\n\t{\r\n\t\tdocument.querySelector(\"[ref='editgrid-soscNotes-addRow']\").remove();\r\n\t}\r\nvar editButtons = document.querySelectorAll('button.btn.btn-default.btn-light.btn-sm.editRow');\r\nfor(i=0;ix.commentFor==='external').length > 0)\r\nshow = true;\r\nelse\r\nshow = false;\r\n}\r\nelse\r\n{\r\n show = true;\r\n}\r\n\r\nif(UserDetails){\r\nvar addRowButton = document.querySelector(\"button[ref=editgrid-soscNotes-addRow]\");\r\nif(addRowButton!=null)\r\n{\r\naddRowButton.addEventListener('click',\r\n(e)=>{\r\n\t\tif( groups.includes(\"/formsflow/formsflow-reviewer/csap\") || groups.includes(\"/formsflow/formsflow-reviewer/csap-society\"))\r\n\t\t{\r\n\t\t var internalRadio = document.querySelectorAll(\"input[value='internal'][type='radio']\");\r\n\t\t for (let i = 0; i < internalRadio.length; i++) {\r\n\t\t\tif(internalRadio[i].parentElement !== null)\r\n\t\t\t{\r\n\t\t\t\tinternalRadio[i].parentElement.remove();\r\n\t\t\t}\r\n\t\t }\r\n\t\t}\r\n})\r\n\r\nconst emptyElements = [];\r\nconst elements = document.getElementsByClassName(\"list-group-item\");\r\nfor (let i = 0; i < elements.length; i++) {\r\nconst element = elements[i];\r\n\r\nif(element.querySelectorAll('div.row').length===0){(element).remove() }\r\n \r\n}\r\n}\r\n\r\n\r\nconst emptyElements = [];\r\nconst elements = document.getElementsByClassName(\"list-group-item\");\r\nfor (let i = 0; i < elements.length; i++) {\r\nconst element = elements[i];\r\n\r\nif(element.querySelectorAll('div.row').length===0){(element).remove() }\r\n \r\n}\r\n\r\n\r\nvar b =JSON.parse(localStorage.getItem('UserDetails'))\r\n\r\nif(b.groups.includes(\"/formsflow/formsflow-client\"))\r\n{\r\n\tif(document.querySelector(\"[ref='editgrid-soscNotes-addRow']\")!==null)\r\n\t{\r\n\t\tdocument.querySelector(\"[ref='editgrid-soscNotes-addRow']\").remove();\r\n\t}\r\nvar editButtons = document.querySelectorAll('button.btn.btn-default.btn-light.btn-sm.editRow');\r\nfor(i=0;ix.commentFor==='external').length > 0)\r\nshow = true;\r\nelse\r\nshow = false;\r\n}\r\nelse\r\n{\r\n show = true;\r\n}\r\n\r\nif(UserDetails){\r\nvar addRowButton = document.querySelector(\"button[ref=editgrid-soscNotes-addRow]\");\r\nif(addRowButton!=null)\r\n{\r\naddRowButton.addEventListener('click',\r\n(e)=>{\r\n\t\tif( groups.includes(\"/formsflow/formsflow-reviewer/csap\") || groups.includes(\"/formsflow/formsflow-reviewer/csap-society\"))\r\n\t\t{\r\n\t\t var internalRadio = document.querySelectorAll(\"input[value='internal'][type='radio']\");\r\n\t\t for (let i = 0; i < internalRadio.length; i++) {\r\n\t\t\tif(internalRadio[i].parentElement !== null)\r\n\t\t\t{\r\n\t\t\t\tinternalRadio[i].parentElement.remove();\r\n\t\t\t}\r\n\t\t }\r\n\t\t}\r\n})\r\n\r\nconst emptyElements = [];\r\nconst elements = document.getElementsByClassName(\"list-group-item\");\r\nfor (let i = 0; i < elements.length; i++) {\r\nconst element = elements[i];\r\n\r\nif(element.querySelectorAll('div.row').length===0){(element).remove() }\r\n \r\n}\r\n}\r\n\r\n\r\nconst emptyElements = [];\r\nconst elements = document.getElementsByClassName(\"list-group-item\");\r\nfor (let i = 0; i < elements.length; i++) {\r\nconst element = elements[i];\r\n\r\nif(element.querySelectorAll('div.row').length===0){(element).remove() }\r\n \r\n}\r\n\r\n\r\nvar b =JSON.parse(localStorage.getItem('UserDetails'))\r\n\r\nif(b.groups.includes(\"/formsflow/formsflow-client\"))\r\n{\r\n\tif(document.querySelector(\"[ref='editgrid-soscNotes-addRow']\")!==null)\r\n\t{\r\n\t\tdocument.querySelector(\"[ref='editgrid-soscNotes-addRow']\").remove();\r\n\t}\r\nvar editButtons = document.querySelectorAll('.formio-component-soscNotes button.btn.btn-default.btn-light.btn-sm.editRow');\r\nfor(i=0;i