Commit 92b796ba by Leonard Ambros II

Merge branch 'Feature-WG-392' into 'development'

Feature wg 392 See merge request !64
parents 31cb68eb ba6f07c0
......@@ -465,6 +465,7 @@ const inputChecklist = (key, validation) => {
dropdown1.classList.add('dropdown');
var dropdownContent = document.createElement('div');
dropdownContent.classList.add('dropdown-content');
dropdownContent.setAttribute('id',`checklistContainer_${key}`);
dropdown1.appendChild(dropdownContent);
var isOther = false;
......@@ -484,12 +485,8 @@ const inputChecklist = (key, validation) => {
if (index == 0) {
checkbox.classList.add("checkboxFirst");
checkbox.setAttribute('id', `${key}`);
<<<<<<< WebGde/WebContent/WebGde-Widgets/DataInputWidget/generateFields.js
}
=======
}
>>>>>>> WebGde/WebContent/WebGde-Widgets/DataInputWidget/generateFields.js
}
div.appendChild(checkbox);
var label = document.createTextNode(item);
div.appendChild(label);
......@@ -578,20 +575,12 @@ const inputRadiolist = (key, validation) => {
radio.type = 'radio';
radio.name = `radioChoices_${key}`;
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;
if (index == 0) {
radio.classList.add('radioFirst');
radio.setAttribute('id', `${key}`);
}
<<<<<<< WebGde/WebContent/WebGde-Widgets/DataInputWidget/generateFields.js
=======
>>>>>>> WebGde/WebContent/WebGde-Widgets/DataInputWidget/generateFields.js
var label = document.createTextNode(item);
radioDiv.appendChild(radio);
radioDiv.appendChild(label);
......@@ -669,8 +658,10 @@ const inputDropdown = (key, validation) => {
input.addEventListener('keydown', function (event) {
if (event.keyCode == 9) {
event.preventDefault();
var elem = document.getElementsByClassName('select2-search__field');
elem.focus();
//var elem = document.getElementsByClassName('select2-search__field');
//elem.focus();
const dropdownField = document.getElementById(`${key}`);
dropdownField.blur();
}
});
......@@ -713,8 +704,10 @@ const inputDbLookup = async (key, validation) => {
input.addEventListener('keydown', function (event) {
if (event.keyCode == 9) {
event.preventDefault();
var elem = document.getElementsByClassName('select2-search__field');
elem.focus();
//var elem = document.getElementsByClassName('select2-search__field');
//elem.focus();
const dropdownDbLookup = document.getElementById(`${key}`);
dropdownDbLookup.blur();
}
});
......@@ -1162,7 +1155,7 @@ export async function populateFields(imagePath) {
const sectionElem =$("Section");
for (let i = 0; i < document.getElementById("Section").options.length; i++) {
if (document.getElementById("Section").options[i].value == section) {
document.getElementById("Section").options[i].selected = "selected"
document.getElementById("Section").options[i].selected = "selected";
if(sectionElem[0]){
sectionElem.trigger('change');
}
......@@ -1176,7 +1169,7 @@ export async function populateFields(imagePath) {
sessionStorage.setItem("doctype", doctype);
for (let i = 0; i < document.getElementById("DocType").options.length; i++) {
if (document.getElementById("DocType").options[i].value == doctype) {
document.getElementById("DocType").options[i].selected = "selected"
document.getElementById("DocType").options[i].selected = "selected";
}
}
......@@ -1193,55 +1186,79 @@ export async function populateFields(imagePath) {
if (field == "fields") {
let fieldsobj = currForm[field];
//console.log(fieldsobj);
for (let [k, v] of Object.entries(fieldsobj)) {
for (let key of Object.keys(schema[doctype][section])) {
if (schema[doctype][section][key].aka == "field" + k) {
console.log("key = " + key);
console.log("validation: " + schema[doctype][section][key].validation.collection);
//console.log("key = " + key);
//console.log("validation: " + schema[doctype][section][key].validation.collection);
fields["field" + k] = v;
//var fieldId = schema[doctype][section][key].fieldLabel;
//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}"]`);
const radioButton = document.querySelector(`#dropdownContainer_${key} 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'
document.getElementById(`dependentTB_${key}`).style.display = 'inline-block';
}
} else if(schema[doctype][section][key].validation.collection === 'checklist') {
const checklistArrayValues = v.split(",");
let otherValues = "";
let isFirstCheckboxOtherValue = true;
let checkboxOtherValue = "";
for(let checklistValue of checklistArrayValues){
console.log("Array Values: " + checklistValue);
const checklistbox = document.querySelector(`#checklistContainer_${key} input[value="${checklistValue}"]`);
if(checklistbox){
checklistbox.checked = true;
if(checklistValue === "other" || checklistValue === "others"){
checkboxOtherValue = checklistValue;
document.getElementById(`dependentTB_${key}`).value = checkboxOtherValue;
document.getElementById(`dependentTB_${key}`).style.display = 'inline-block';
isFirstCheckboxOtherValue = false;
}
} else {
if(isFirstCheckboxOtherValue){
checkboxOtherValue = checklistValue;
isFirstCheckboxOtherValue = false;
} else{
checkboxOtherValue = checkboxOtherValue + "," + checklistValue;
}
const checkOther1 = document.querySelector(`#checklistContainer_${key} input[value="other"]`);
if(checkOther1){
console.log("checkOther1 checked");
checkOther1.checked = true;
}
const checkOther2 = document.querySelector(`#checklistContainer_${key} input[value="others"]`);
if(checkOther2){
console.log("checkOther2 checked");
checkOther2.checked = true;
}
document.getElementById(`dependentTB_${key}`).value = checkboxOtherValue;
document.getElementById(`dependentTB_${key}`).style.display = 'inline-block';
}
}
} else{
document.getElementById(key).value = v;
}
continue;
}
}
......@@ -1254,6 +1271,13 @@ export async function populateFields(imagePath) {
// displayFields("fields");
}
export function clearForm() {
// Check if the form element exists
const formElement = document.getElementById("fields");
......
......@@ -46,7 +46,7 @@ export async function WriteForm(e,metrics,doctype,section) {
});
fields[Object.keys(lookup[fid]).includes('aka') ? lookup[fid].aka.replace("field", "") : fid] = selectedValue;
i += radioButtons.length; //increment the number of radio buttons to skip the other radio button inputs.
i += radioButtons.length - 1; //increment the number of radio buttons to skip the other radio button inputs.
continue;
}
......@@ -69,7 +69,7 @@ export async function WriteForm(e,metrics,doctype,section) {
});
fields[Object.keys(lookup[fid]).includes('aka') ? lookup[fid].aka.replace("field", "") : fid] = selectedValue;
i += checkboxButtons.length ; //increment the number of checkboxes to skip the checkboxes input
i += checkboxButtons.length - 1; //increment the number of checkboxes to skip the checkboxes input
continue;
}
fields[Object.keys(lookup[fid]).includes('aka') ? lookup[fid].aka.replace("field", "") : fid] = Nodes[i].value;
......
......@@ -84,7 +84,7 @@ export const submitForm = async (e) => {
} else {
createInfoModal(null, 'OK', 'Invalid or Missing data on highlighted fields!');
}
return false
return false;
}
else {
const metrics = stopMetricCapture();
......@@ -93,8 +93,8 @@ export const submitForm = async (e) => {
}
return true
} catch (err) {
console.log(err)
return false
console.log(err);
return false;
}
}
......
......@@ -8,7 +8,7 @@ export const HIGH_LIGHT_SCHEMA = "./WebGde-Widgets/sample_schema/dbSchema_anno.
export const ROOT_FOLDER = "/WebGde-Widgets";
//this determines if the images will be retrieved from the gfs
const IP = "54.175.136.51"
const IP = "44.202.63.115"
const GDE_CONTEXTROOT = "WebGde-v121-b1"
export const DOMAIN = `http://${IP}:8080`
export const CONTEXTROOT = "gfs-explorer-ws"
......
......@@ -35,8 +35,8 @@
"aka" : "field5",
"validation" : {
"fieldLength" : 1.0,
"collection" : "radiolist",
"items" : [ "M", "F", "others" ],
"collection" : "dropdown",
"options" : [ "M", "F" ],
"mandatory" : true
}
},
......@@ -72,8 +72,8 @@
"aka" : "field9",
"validation" : {
"fieldLength" : 20.0,
"collection" : "radiolist",
"items" : [ "Emergency Room", "Inpatient", "Outpatient", "other" ],
"collection" : "dropdown",
"options" : [ "Emergency Room", "Inpatient", "Outpatient" ],
"mandatory" : true
}
},
......@@ -82,8 +82,8 @@
"aka" : "field10",
"validation" : {
"fieldLength" : 7.0,
"collection" : "radiolist",
"items" : [ "Pay", "Service", "other" ],
"collection" : "dropdown",
"options" : [ "Pay", "Service", "other" ],
"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