Commit 31cb68eb by Leonard Ambros II

Merge branch 'FEATURE-WG-388' into 'development'

resolution on WG-388 See merge request !60
parents 55e0429a 30350162
...@@ -484,7 +484,11 @@ const inputChecklist = (key, validation) => { ...@@ -484,7 +484,11 @@ const inputChecklist = (key, validation) => {
if (index == 0) { if (index == 0) {
checkbox.classList.add("checkboxFirst"); checkbox.classList.add("checkboxFirst");
checkbox.setAttribute('id', `${key}`); checkbox.setAttribute('id', `${key}`);
<<<<<<< WebGde/WebContent/WebGde-Widgets/DataInputWidget/generateFields.js
}
=======
} }
>>>>>>> WebGde/WebContent/WebGde-Widgets/DataInputWidget/generateFields.js
div.appendChild(checkbox); div.appendChild(checkbox);
var label = document.createTextNode(item); var label = document.createTextNode(item);
...@@ -558,6 +562,7 @@ const inputRadiolist = (key, validation) => { ...@@ -558,6 +562,7 @@ const inputRadiolist = (key, validation) => {
dropdown1.classList.add('dropdown'); dropdown1.classList.add('dropdown');
var dropdownContent = document.createElement('div'); var dropdownContent = document.createElement('div');
dropdownContent.classList.add('dropdown-content'); dropdownContent.classList.add('dropdown-content');
dropdownContent.setAttribute('id',`dropdownContainer_${key}`);
dropdown1.appendChild(dropdownContent); dropdown1.appendChild(dropdownContent);
var isOther = false; var isOther = false;
...@@ -573,11 +578,20 @@ const inputRadiolist = (key, validation) => { ...@@ -573,11 +578,20 @@ const inputRadiolist = (key, validation) => {
radio.type = 'radio'; radio.type = 'radio';
radio.name = `radioChoices_${key}`; radio.name = `radioChoices_${key}`;
radio.classList.add("radioOption"); radio.classList.add("radioOption");
<<<<<<< WebGde/WebContent/WebGde-Widgets/DataInputWidget/generateFields.js
radio.name = `radioChoices_${key}`;
=======
>>>>>>> WebGde/WebContent/WebGde-Widgets/DataInputWidget/generateFields.js
radio.value = item; radio.value = item;
if (index == 0) { if (index == 0) {
radio.classList.add('radioFirst'); radio.classList.add('radioFirst');
radio.setAttribute('id', `${key}`); radio.setAttribute('id', `${key}`);
} }
<<<<<<< WebGde/WebContent/WebGde-Widgets/DataInputWidget/generateFields.js
=======
>>>>>>> WebGde/WebContent/WebGde-Widgets/DataInputWidget/generateFields.js
var label = document.createTextNode(item); var label = document.createTextNode(item);
radioDiv.appendChild(radio); radioDiv.appendChild(radio);
radioDiv.appendChild(label); radioDiv.appendChild(label);
...@@ -615,11 +629,12 @@ const inputRadiolist = (key, validation) => { ...@@ -615,11 +629,12 @@ const inputRadiolist = (key, validation) => {
inputTextBox.style.display = 'none'; // Hide the input text box when "other" radio button is unchecked inputTextBox.style.display = 'none'; // Hide the input text box when "other" radio button is unchecked
} }
}); });
inputTextBox.addEventListener("input", event => { inputTextBox.addEventListener('change', event => {
if (dependentRadio.checked) { if (dependentRadio.checked) {
dependentRadio.value = event.target.value; dependentRadio.value = event.target.value;
} }
}); });
} }
...@@ -1178,13 +1193,56 @@ export async function populateFields(imagePath) { ...@@ -1178,13 +1193,56 @@ export async function populateFields(imagePath) {
if (field == "fields") { if (field == "fields") {
let fieldsobj = currForm[field]; let fieldsobj = currForm[field];
//console.log(fieldsobj);
for (let [k, v] of Object.entries(fieldsobj)) { for (let [k, v] of Object.entries(fieldsobj)) {
for (let key of Object.keys(schema[doctype][section])) { for (let key of Object.keys(schema[doctype][section])) {
if (schema[doctype][section][key].aka == "field" + k) { if (schema[doctype][section][key].aka == "field" + k) {
console.log("key = " + key);
console.log("validation: " + schema[doctype][section][key].validation.collection);
fields["field" + k] = v; fields["field" + k] = v;
var fieldId = schema[doctype][section][key].fieldLabel;
var currId = fieldId.replace(" ", "_") //var fieldId = schema[doctype][section][key].fieldLabel;
document.getElementById(currId).value = v; //var currId = fieldId.replaceAll(" ", "_");
//console.log(fieldId);
//console.log(currId);
console.log(v);
//document.getElementById(currId).value = v;
if(schema[doctype][section][key].validation.collection === 'radiolist'){
console.log("RADIOLIST");
//retrieve the radio button value from the XML
const radioButton = document.querySelector(`input[value="${v}"]`);
if(radioButton){
radioButton.checked = true;
} else {
//const radOther1 = document.querySelector(`#radiochoices_${key} input[value="other"]`);
const radOther1 = document.querySelector(`#dropdownContainer_${key} input[value="other"]`);
if(radOther1){
radOther1.checked = true;
}
//const radOther2 = document.querySelector(`#radiochoices_${key} input[value="others"]`);
const radOther2 = document.querySelector(`#dropdownContainer_${key} input[value="others"]`);
if(radOther2){
radOther2.checked = true;
}
document.getElementById(`dependentTB_${key}`).value = v;
document.getElementById(`dependentTB_${key}`).style.display = 'inline-block'
}
} else{
document.getElementById(key).value = v;
}
continue;
} }
} }
} }
......
...@@ -33,7 +33,7 @@ export async function WriteForm(e,metrics,doctype,section) { ...@@ -33,7 +33,7 @@ export async function WriteForm(e,metrics,doctype,section) {
continue; continue;
} }
// If the first radio button was found // If the first radio button was found
if (Nodes[i].classList.contains('radioFirst')) { if (Nodes[i].classList.contains('radioFirst')) {
var key = fid; var key = fid;
const radioButtons = document.getElementsByName(`radioChoices_${key}`); const radioButtons = document.getElementsByName(`radioChoices_${key}`);
let selectedValue; let selectedValue;
...@@ -51,7 +51,7 @@ export async function WriteForm(e,metrics,doctype,section) { ...@@ -51,7 +51,7 @@ export async function WriteForm(e,metrics,doctype,section) {
} }
// If the first checkbox was found // If the first checkbox was found
if (Nodes[i].classList.contains('checkboxFirst')) { if (Nodes[i].classList.contains('checkboxFirst')) {
var key = fid; var key = fid;
const checkboxButtons = document.getElementsByName(`checkboxChoices_${key}`); const checkboxButtons = document.getElementsByName(`checkboxChoices_${key}`);
let selectedValue = ''; let selectedValue = '';
......
...@@ -8,7 +8,7 @@ export const HIGH_LIGHT_SCHEMA = "./WebGde-Widgets/sample_schema/dbSchema_anno. ...@@ -8,7 +8,7 @@ export const HIGH_LIGHT_SCHEMA = "./WebGde-Widgets/sample_schema/dbSchema_anno.
export const ROOT_FOLDER = "/WebGde-Widgets"; export const ROOT_FOLDER = "/WebGde-Widgets";
//this determines if the images will be retrieved from the gfs //this determines if the images will be retrieved from the gfs
const IP = "54.211.251.251" const IP = "54.175.136.51"
const GDE_CONTEXTROOT = "WebGde-v121-b1" const GDE_CONTEXTROOT = "WebGde-v121-b1"
export const DOMAIN = `http://${IP}:8080` export const DOMAIN = `http://${IP}:8080`
export const CONTEXTROOT = "gfs-explorer-ws" export const CONTEXTROOT = "gfs-explorer-ws"
......
...@@ -35,8 +35,8 @@ ...@@ -35,8 +35,8 @@
"aka" : "field5", "aka" : "field5",
"validation" : { "validation" : {
"fieldLength" : 1.0, "fieldLength" : 1.0,
"collection" : "dropdown", "collection" : "radiolist",
"options" : [ "M", "F" ], "items" : [ "M", "F", "others" ],
"mandatory" : true "mandatory" : true
} }
}, },
...@@ -73,7 +73,7 @@ ...@@ -73,7 +73,7 @@
"validation" : { "validation" : {
"fieldLength" : 20.0, "fieldLength" : 20.0,
"collection" : "radiolist", "collection" : "radiolist",
"items" : [ "Emergency Room", "Inpatient", "Outpatient", "others" ], "items" : [ "Emergency Room", "Inpatient", "Outpatient", "other" ],
"mandatory" : true "mandatory" : true
} }
}, },
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
"validation" : { "validation" : {
"fieldLength" : 7.0, "fieldLength" : 7.0,
"collection" : "radiolist", "collection" : "radiolist",
"items" : [ "Pay", "Service" ], "items" : [ "Pay", "Service", "other" ],
"mandatory" : true "mandatory" : true
} }
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment