Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
web-ui
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
WEBGDE-Components
web-ui
Commits
41a7e37b
Commit
41a7e37b
authored
Feb 05, 2024
by
Owen Ryan Ang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
getElementId implem, fixed some bugs in return.
parent
d8f95776
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
84 additions
and
6 deletions
+84
-6
returnElement.js
WebGde/WebContent/WebGde-Widgets/BPO/returnElement.js
+8
-1
androidInterface.js
...gets/DataInputWidget/AndroidInterface/androidInterface.js
+5
-0
generateFields.js
...bContent/WebGde-Widgets/DataInputWidget/generateFields.js
+61
-3
submit.js
WebGde/WebContent/WebGde-Widgets/Submit/submit.js
+2
-2
DEV_SCHEMA2.json
.../WebContent/WebGde-Widgets/sample_schema/DEV_SCHEMA2.json
+8
-0
No files found.
WebGde/WebContent/WebGde-Widgets/BPO/returnElement.js
View file @
41a7e37b
...
...
@@ -11,7 +11,14 @@ import { returnForm } from "../Submit/submit.js";
export
async
function
returnElementBPO
(
elementId
)
{
try
{
// Get current timestamp
const
currentTimeStamp
=
Date
.
now
();
const
currentDate
=
new
Date
(
currentTimeStamp
);
const
humanReadableTime
=
currentDate
.
toLocaleString
();
// Save to session storage
sessionStorage
.
setItem
(
"timeEnd"
,
humanReadableTime
);
let
response
=
await
fetch
(
getUrlReturnElement
(
elementId
),
{
method
:
"POST"
});
if
(
response
.
ok
)
{
...
...
WebGde/WebContent/WebGde-Widgets/DataInputWidget/AndroidInterface/androidInterface.js
View file @
41a7e37b
...
...
@@ -18,4 +18,8 @@ export function fingerprintCapture(key){
export
async
function
getLocation
(){
await
window
.
LocationHandlerInterface
.
setupLocation
();
}
export
async
function
getDeviceId
(){
return
await
window
.
MobileGdeJavascriptInterface
.
getDeviceId
();
}
\ No newline at end of file
WebGde/WebContent/WebGde-Widgets/DataInputWidget/generateFields.js
View file @
41a7e37b
...
...
@@ -6,7 +6,7 @@ import { showError } from "./showError.js";
import
{
submitForm
}
from
"../Submit/submit.js"
;
import
{
BPO_OBJECT
}
from
"../globalVariable.js"
;
import
{
fetchOptionsDB
}
from
"./DBLookup/DBLookup.js"
;
import
{
fingerprintCapture
,
getLocation
,
imageCapture
,
videoCapture
}
from
"./AndroidInterface/androidInterface.js"
;
import
{
fingerprintCapture
,
get
DeviceId
,
get
Location
,
imageCapture
,
videoCapture
}
from
"./AndroidInterface/androidInterface.js"
;
import
{
processCapture
}
from
"./ImageCapture/captureImage.js"
;
import
{
processFingerprint
}
from
"./FingerprintCapture/captureFingerprint.js"
;
import
{
processVideoCapture
}
from
"./VideoCapture/captureVideo.js"
;
...
...
@@ -1641,6 +1641,56 @@ const inputGeoTagStart = (key, validation) => {
* @returns
* created input field element
*/
const inputDeviceId = async (key, validation) => {
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
')
let deviceId
try {
// Get the device ID using async/await
deviceId = await getDeviceId();
} catch {
}
// Check if deviceId is null or an error
if (deviceId === null || deviceId instanceof Error || deviceId === undefined) {
// Handle the case where deviceId is null or an error
deviceId = ''; // Set a default value or handle it according to your logic
}
// Set the device ID as the value of the input element
input1.value = deviceId;
// 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
}
/**
*
* @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;
...
...
@@ -1685,7 +1735,7 @@ const inputDropdown = (key, validation, readOnly) => {
} catch (err) {
throw err;
}
};
};
...
...
@@ -1863,6 +1913,11 @@ const deconstruct = async (section, container, classAttribute) => {
hiddenInputGeoStart.setAttribute('
class
', classAttribute);
inputContainer.appendChild(hiddenInputGeoStart);
break;
case "deviceid":
const hiddenInputDeviceId = await inputDeviceId(key, validation);
hiddenInputDeviceId.setAttribute('
class
', classAttribute);
inputContainer.appendChild(hiddenInputDeviceId);
break;
default:
const hiddenInputDefault = inputHidden(key, validation);
hiddenInputDefault.setAttribute('
class
', classAttribute);
...
...
@@ -1972,6 +2027,9 @@ const deconstruct = async (section, container, classAttribute) => {
case '
geotagstart
':
input = inputGeoTagStart(key, validation)
break
case '
deviceid
':
input = await inputDeviceId(key, validation, readOnly)
break
default:
input = noValidation()
break
...
...
@@ -1979,7 +2037,7 @@ const deconstruct = async (section, container, classAttribute) => {
input.classList.add(classAttribute)
inputContainer.appendChild(input)
if (hidden && ["geotag", "geotagstart", "altitude", "direction"].includes(collection)){
if (hidden && ["geotag", "geotagstart", "altitude", "direction"
,"deviceid"
].includes(collection)){
newField.style.display = '
none
'; // Hide the input
newField.classList.add('
hidden
'); // Add '
hidden
' class
}
...
...
WebGde/WebContent/WebGde-Widgets/Submit/submit.js
View file @
41a7e37b
...
...
@@ -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
(
'geotagstart'
)
||
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'
)
||
element
.
classList
.
contains
(
'deviceid'
)
)
{
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
(
'geotagstart'
)
||
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'
)
||
element
.
classList
.
contains
(
'deviceid'
)
)
{
continue
;
}
if
(
type
===
'submit'
)
continue
...
...
WebGde/WebContent/WebGde-Widgets/sample_schema/DEV_SCHEMA2.json
View file @
41a7e37b
...
...
@@ -117,6 +117,14 @@
"collection"
:
"geotagstart"
,
"mandatory"
:
false
}
},
"device_id"
:
{
"fieldLabel"
:
"Device ID"
,
"aka"
:
"field13"
,
"validation"
:
{
"collection"
:
"deviceid"
,
"mandatory"
:
false
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment