Commit 303e0609 by Owen Ryan Ang

Merge branch 'feature-QC' into 'feature-WG-490'

# Conflicts: # WebGde/WebContent/WebGde-Widgets/config.js
parents 17820fbd c3340999
......@@ -1603,6 +1603,44 @@ const inputGeoTag = (key, validation) => {
* @returns
* created input field element
*/
const inputGeoTagStart = (key, validation) => {
try {
const {
mandatory,
fieldLength,
collection
} = validation
//Text box to store the longitude and lattitude (for easier submission of data)
const input1 = document.createElement('input')
input1.setAttribute('id', `${key}`)
input1.setAttribute('name', `${key}`)
input1.setAttribute('class', `${collection}`)
input1.setAttribute('type', 'text')
input1.setAttribute('readonly', 'true')
if (collection === 'geotagstart') {
getLocation();
}
// Create a container div to hold both the input and the text node
const container = document.createElement('div');
// container.appendChild(input); // Append the input element to the container
container.appendChild(input1); // Append the text container to the container
return container; // Return the combined container
} catch (err) {
throw err;
}
}
/**
*
* @param {*} key
* will serve as id of input field
* @param {*} validation
* validation of field from schema
* @returns
* created input field element
*/
const inputDropdown = (key, validation, readOnly) => {
try {
const { mandatory, options } = validation;
......@@ -1820,7 +1858,11 @@ const deconstruct = async (section, container, classAttribute) => {
hiddenInputGeo.setAttribute('class', classAttribute);
inputContainer.appendChild(hiddenInputGeo);
break;
case "geotagstart":
const hiddenInputGeoStart = inputGeoTagStart(key, validation);
hiddenInputGeoStart.setAttribute('class', classAttribute);
inputContainer.appendChild(hiddenInputGeoStart);
break;
default:
const hiddenInputDefault = inputHidden(key, validation);
hiddenInputDefault.setAttribute('class', classAttribute);
......@@ -1927,6 +1969,9 @@ const deconstruct = async (section, container, classAttribute) => {
case 'geotag':
input = inputGeoTag(key, validation)
break
case 'geotagstart':
input = inputGeoTagStart(key, validation)
break
default:
input = noValidation()
break
......@@ -1934,7 +1979,7 @@ const deconstruct = async (section, container, classAttribute) => {
input.classList.add(classAttribute)
inputContainer.appendChild(input)
if (hidden && ["geotag", "altitude", "direction"].includes(collection)){
if (hidden && ["geotag", "geotagstart", "altitude", "direction"].includes(collection)){
newField.style.display = 'none'; // Hide the input
newField.classList.add('hidden'); // Add 'hidden' class
}
......
......@@ -39,7 +39,7 @@ export const submitForm = async (e) => {
const errorContainer = document.getElementById(`${id}_error`);
// Skip submit, buttons, and files
if (element.classList.contains('radioOther') || element.classList.contains('checkboxOther')) continue;
if (element.classList.contains('geotag') || element.classList.contains('altitude') || element.classList.contains('direction')) {
if (element.classList.contains('geotag') || element.classList.contains('geotagstart') || element.classList.contains('altitude') || element.classList.contains('direction')) {
continue;
}
if (type === 'submit') continue
......@@ -200,7 +200,7 @@ export const returnForm = async (e) => {
const errorContainer = document.getElementById(`${id}_error`);
// Skip submit, buttons, and files
if (element.classList.contains('radioOther') || element.classList.contains('checkboxOther')) continue;
if (element.classList.contains('geotag') || element.classList.contains('altitude') || element.classList.contains('direction')) {
if (element.classList.contains('geotag') || element.classList.contains('geotagstart') || element.classList.contains('altitude') || element.classList.contains('direction')) {
continue;
}
if (type === 'submit') continue
......
......@@ -99,6 +99,24 @@
"mandatory" : false
},
"readOnly" : false
},
"EndLocation" : {
"fieldLabel" : "End Location",
"aka" : "field11",
"validation" : {
"fieldLength" : 20.0,
"collection" : "geotag",
"mandatory" : false
}
},
"StartLocation" : {
"fieldLabel" : "Start Location",
"aka" : "field12",
"validation" : {
"fieldLength" : 20.0,
"collection" : "geotagstart",
"mandatory" : false
}
}
}
}
......
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