Commit c6a17f72 by Owen Ryan Ang

MobileGde v1.2 commit

parent 32f89783
import { onLocationPermissionDeniedImplem, onLocationPermissionGrantedImplem } from "../../Submit/submit.js";
export function imageCapture(key) {
try {
window.ImageCaptureInterface.captureImage(key);
......@@ -31,6 +33,9 @@ export function fingerprintCapture(key){
}
export async function getLocation(){
localStorage.setItem("locationRequired", true);
window.onLocationPermissionGranted = onLocationPermissionGranted;
window.onLocationPermissionDenied = onLocationPermissionDenied;
try {
await window.LocationHandlerInterface.setupLocation();
} catch (error) {
......@@ -38,6 +43,14 @@ export async function getLocation(){
}
}
function onLocationPermissionGranted() {
onLocationPermissionGrantedImplem();
}
function onLocationPermissionDenied() {
onLocationPermissionDeniedImplem();
}
export async function getDeviceId(){
try {
return await window.MobileGdeJavascriptInterface.getDeviceId();
......
......@@ -18,9 +18,11 @@ import { validateForm } from "./validateForm.js";
let newOption;
let isDoctypeReadOnly;
let locationSetupInitiated = false;
export let schema;
export async function generateFields(inputSchema, containerId) {
locationSetupInitiated = false;
if (IS_RETRIEVE_FROM_BPO) {
let elementId = sessionStorage.getItem("element_id");
......@@ -1608,9 +1610,10 @@ const inputGeoTag = async (key, validation) => {
input1.setAttribute('class', `${collection}`)
input1.setAttribute('type', 'text')
input1.setAttribute('readonly', 'true')
if (collection === 'geotag') {
await getLocation();
}
if (collection === 'geotag' && !locationSetupInitiated) {
locationSetupInitiated = true; // Update flag to indicate location setup has been initiated
await getLocation();
}
// Create a container div to hold both the input and the text node
const container = document.createElement('div');
......@@ -1646,7 +1649,8 @@ const inputGeoTagStart = async (key, validation) => {
input1.setAttribute('class', `${collection}`)
input1.setAttribute('type', 'text')
input1.setAttribute('readonly', 'true')
if (collection === 'geotagstart') {
if (collection === 'geotagstart' && !locationSetupInitiated) {
locationSetupInitiated = true;
await getLocation();
}
......
......@@ -6,7 +6,7 @@ import { createInfoModal } from "../../genericPopup/genericPopup.js";
import { PROJECT_CODE, ENCODING_PASS, TEMPORARY_FOLDER } from "../config.js";
import { completeToNextNode } from "../submit.js";
export async function WriteForm(e,metrics,doctype,section) {
export async function WriteForm(metrics,doctype,section) {
try {
var Frm= document.getElementById("fields");
var Nodes=Frm.elements;
......
......@@ -12,7 +12,7 @@ import { urlGetFile } from "./XMLWriter/WebServices.js";
import { WriteForm } from "./XMLWriter/XML_Saver.js";
import { GFS_ROOT_FOLDER, GFS_URL, PROJECT_CODE, TEMPORARY_FOLDER } from "./config.js";
export const submitForm = async (e) => {
export const submitForm = async () => {
try {
// Get current timestamp
const currentTimeStamp = Date.now();
......@@ -128,7 +128,7 @@ export const submitForm = async (e) => {
else {
if (IS_RETRIEVE_FROM_BPO === "N") {
let response = await WriteForm(e, [], doctype, section);
let response = await WriteForm([], doctype, section);
await batchUpload(Form);
if (response !== false) {
let folderName = sessionStorage.getItem("recentlySavedFileNameOnly");
......@@ -151,7 +151,7 @@ export const submitForm = async (e) => {
return false
}
} else {
let response = await WriteForm(e, [], doctype, section);
let response = await WriteForm([], doctype, section);
await batchUpload(Form);
if (response !== false) {
let folderName = sessionStorage.getItem("recentlySavedFileNameOnly");
......@@ -343,30 +343,60 @@ export const returnForm = async (e) => {
}
}
export async function createSubmitWindow(e) {
let submitStatus;
async function okButtonFunction() {
createLoadingModal("Submitting Element", "Please wait...", null, null, null);
submitStatus = await submitForm(e);
if (submitStatus) {
removeLoadingModal();
DISPLAY_FIELD_OBJECT.clearForm();
if (SHOW_ELEMENT_LIST_VIEWER === "Y") {
createInfoModal(goBackToElementListViewer, 'ok', 'Form Submitted.');
} else {
createInfoModal(null, 'ok', 'Form Submitted.');
}
if (IS_RETRIEVE_FROM_BPO === "Y") {
await updateExtraDetails(sessionStorage.getItem("user_id"));
let response = await completeToNextNode(sessionStorage.getItem("element_id"));
}
} else {
removeLoadingModal();
}
};
// Function to handle location permission granted
export async function onLocationPermissionGrantedImplem() {
let submitStatus = await submitForm();
if (submitStatus) {
removeLoadingModal();
DISPLAY_FIELD_OBJECT.clearForm();
if (SHOW_ELEMENT_LIST_VIEWER === "Y") {
createInfoModal(goBackToElementListViewer, 'ok', 'Form Submitted.');
} else {
createInfoModal(null, 'ok', 'Form Submitted.');
}
if (IS_RETRIEVE_FROM_BPO === "Y") {
await updateExtraDetails(sessionStorage.getItem("user_id"));
let response = await completeToNextNode(sessionStorage.getItem("element_id"));
}
} else {
removeLoadingModal();
}
}
// Function to handle location permission denied
export function onLocationPermissionDeniedImplem() {
removeLoadingModal();
createErrorModal(null, "Ok", "Permission Access Required.");
}
// Function to trigger Android function and handle response
async function triggerAndroidFunction() {
createLoadingModal("Submitting Element", "Please wait...", null, null, null);
// Trigger Android function to request location service
await window.LocationHandlerInterface.callSubmit();
}
// Function to handle OK button click
async function okButtonFunction() {
try {
// Check if location is required
const locationRequired = localStorage.getItem("locationRequired");
if (locationRequired === "true") {
await triggerAndroidFunction();
} else {
// Location is not required, submit directly
await onLocationPermissionGrantedImplem();
}
} catch (error) {
console.error("Error triggering Android function:", error);
removeLoadingModal();
return;
}
}
return createConfirmationModal(okButtonFunction, "Submit Element?");
// Main function to create submit window
export async function createSubmitWindow() {
return createConfirmationModal(okButtonFunction, "Submit Element?");
}
function validateMedia(key) {
......
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAijGUjaY12S9AfkZJ4tTiSqPIBdDxWLXfkAAsKCQKstPGvd3rkPKXS+LZJzQq1nnro7pAOk1fjiqWs2TnDxuyOuDhQatSlfPQavEgSjzAC876wSXbtP8OfhPZGs+DnYSKElIUPV+mokaok2BBhmWwXbTA02Gmq30qVjzmOxppwle9XvGD1wvFVy4GlNDoFHmg8dtg7VmbGLTXc+FYOUKnFSAfW8z0KyKK53A8XR1UssO4o9gLQGP0VX0m5Mrb3D/I+vaSXcAzzyv2WRIOa49AuPx+m8IJnRb/CdY7tM0wZcrRwjC02sQk0VHG9Fg9lOk9wXytaq8GLPoRq5f4zZsPvwIDAQAB
\ No newline at end of file
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAkduOYtZV0mGUvim4rG7njHT7iK0usZlYKsflIsHsBz5xGTOqs9T6JHBoV+LHK41bhzJEbt0Kcb/oS240CsmV78OZGmzd44qsIv4A7ixE2wMgoyL3xDofkIPhYo8JaQr7lCDe2SiHDV/s6lsrUb7uV6wxlOlff8CEq1HXZRUDTzmTgk/FgpECHBbMM028P9EOf9esk5ZCDNkb/pnOsRFSlASQ2Zm8rorGbsHUMYSs5sZQfSgmwuxFZeJ4db3F3tvcyHUOB5GIDtpf+nIN4weVEMeyKRuLDnpfVAw8hIoetMOeYK+KA9AD3XTu5K8932eByUFgNxt+MnK8DNONhe08mwIDAQAB
\ No newline at end of file
import { onLocationPermissionDeniedImplem, onLocationPermissionGrantedImplem } from "../../Submit/submit.js";
export function imageCapture(key) {
try {
window.ImageCaptureInterface.captureImage(key);
......@@ -31,6 +33,9 @@ export function fingerprintCapture(key){
}
export async function getLocation(){
sessionStorage.setItem("locationRequired", true);
window.onLocationPermissionGranted = onLocationPermissionGranted;
window.onLocationPermissionDenied = onLocationPermissionDenied;
try {
await window.LocationHandlerInterface.setupLocation();
} catch (error) {
......@@ -38,6 +43,14 @@ export async function getLocation(){
}
}
function onLocationPermissionGranted() {
onLocationPermissionGrantedImplem();
}
function onLocationPermissionDenied() {
onLocationPermissionDeniedImplem();
}
export async function getDeviceId(){
try {
return await window.MobileGdeJavascriptInterface.getDeviceId();
......
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg fill="#FFF" version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
width="800px" height="800px" viewBox="0 0 950 950" xml:space="preserve">
<g>
<path d="M857.7,141.3c-30.1-30.1-65.1-53.5-104.3-69.4c-37.8-15.3-77.7-23.2-118.7-23.2c-40.9,0-80.9,7.7-118.7,22.9
c-39.1,15.8-74.2,38.9-104.3,68.8L73.1,478.3C49.3,501.9,30.9,529.4,18.3,560.2C6.2,589.9,0,621.3,0,653.6
C0,685.7,6.1,717,18.1,746.7c12.4,30.7,30.7,58.2,54.3,81.899c23.6,23.7,51.2,42,81.9,54.5c29.7,12.101,61.1,18.2,93.3,18.2
c32.2,0,63.6-6.1,93.3-18.1c30.8-12.5,58.399-30.8,82.1-54.4l269.101-268c17.3-17.2,30.6-37.3,39.699-59.7
c8.801-21.6,13.2-44.5,13.2-67.899c0-48.2-18.8-93.2-52.899-127c-34-34.2-79.2-53.1-127.301-53.3c-48.199-0.1-93.5,18.6-127.6,52.7
L269.6,473.3c-8.5,8.5-13.1,19.7-13.1,31.601c0,11.899,4.6,23.199,13.1,31.6l0.7,0.7c17.4,17.5,45.8,17.5,63.3,0.1l168-167.5
c35.1-34.8,92.1-35,127.199-0.399c16.9,16.8,26.101,39.3,26.101,63.399c0,24.3-9.4,47.101-26.5,64.101l-269,268
c-0.5,0.5-0.9,0.899-1.2,1.5c-29.7,28.899-68.9,44.699-110.5,44.5c-41.9-0.2-81.2-16.5-110.6-46c-14.7-15-26.1-32.5-34-52
C95.5,694,91.7,674,91.7,653.6c0-41.8,16.1-80.899,45.4-110.3c0.4-0.3,0.7-0.6,1.1-0.899l337.9-337.8c0.3-0.3,0.6-0.7,0.899-1.1
c21.4-21,46.3-37.4,74-48.5c27-10.8,55.4-16.2,84.601-16.2c29.199,0,57.699,5.6,84.6,16.4c27.9,11.3,52.9,27.8,74.3,49.1
c21.4,21.4,37.9,46.4,49.2,74.3c10.9,26.9,16.4,55.4,16.4,84.6c0,29.3-5.5,57.9-16.5,85c-11.301,28-28,53.2-49.5,74.8l-233.5,232.8
c-8.5,8.5-13.2,19.7-13.2,31.7s4.7,23.2,13.1,31.6l0.5,0.5c17.4,17.4,45.8,17.4,63.2,0L857.5,586.9
C887.601,556.8,911,521.7,926.9,482.6C942.3,444.8,950,404.9,950,363.9c0-40.9-7.8-80.8-23.1-118.5
C911.101,206.3,887.8,171.3,857.7,141.3z"/>
</g>
</svg>
\ No newline at end of file
......@@ -355,6 +355,31 @@ input[type=file]:hover {
overflow: hidden;
}
.file-upload button {
width: 100%;
border-radius: 8px;
display: flex;
justify-content: center;
background-color: #006BA6;
border-style: none;
color: white;
padding: 10px 50px;
font-size: 14px;
font-weight: bold;
overflow: hidden;
}
.file-upload .icon{
width: 18px; /* Adjust the width of the icon */
height: 18px; /* Adjust the height of the icon */
display: inline-block;
margin-right: 30px;
background-repeat: no-repeat;
background-size: contain;
background-position: center center;
background-image: url('Assets/paper-clip-svgrepo-com.svg'); /* Replace with the actual path to your icon */
}
.image-container {
background-color: #a0c4dc;
padding: 8px;
......
......@@ -91,7 +91,11 @@ export function processCapture(key, imgFilename, imgFileSize) {
toggleSubmit();
}
document.getElementById(`${key}_x`).addEventListener('click', ()=> {
// document.getElementById(`${key}_x`).addEventListener('click', ()=> {
// createConfirmationModal(deleteImage, "Delete Image?")
// });
closeIconContainer.addEventListener('click', ()=> {
createConfirmationModal(deleteImage, "Delete Image?")
});
}
......@@ -167,4 +171,17 @@ function openImageViewer(imageSrc) {
image.style.transform = transformValue;
}
}
\ No newline at end of file
}
export function formatFileSize(size) {
const units = ["B", "KB", "MB", "GB", "TB"];
let unitIndex = 0;
let fileSize = size;
while (fileSize > 1024 && unitIndex < units.length - 1) {
fileSize /= 1024;
unitIndex++;
}
return `${fileSize.toFixed(2)} ${units[unitIndex]}`;
}
//Data Input Field Config
export var SCHEMA_FILE_PATH = "./WebGde-Widgets/sample_schema/REG-INP.json";
export var SCHEMA_FILE_PATH = "./WebGde-Widgets/sample_schema/10_pages_document.json";
//DBLookup Webservice URL
export var DB_URL = "http://localhost:8080/WebGde/svc/gfs-rest/db-lookup"
\ No newline at end of file
......@@ -7,7 +7,7 @@ import { submitForm } from "../Submit/submit.js";
import { BPO_OBJECT, DOCUMENT_CONTROL_OBJECT, setDocumentControlObject } from "../globalVariable.js";
import { fetchOptionsDB } from "./DBLookup/DBLookup.js";
import { fingerprintCapture, getDeviceId, getLocation, imageCapture, videoCapture } from "./AndroidInterface/androidInterface.js";
import { processCapture } from "./ImageCapture/captureImage.js";
import { formatFileSize, processCapture } from "./ImageCapture/captureImage.js";
import { processFingerprint } from "./FingerprintCapture/captureFingerprint.js";
import { processVideoCapture } from "./VideoCapture/captureVideo.js";
import { IS_RETRIEVE_FROM_BPO } from "../config.js";
......@@ -18,9 +18,13 @@ import { validateForm } from "./validateForm.js";
let newOption;
let isDoctypeReadOnly;
let isDoctypeHidden;
let isSectionHidden;
let locationSetupInitiated = false;
export let schema;
export async function generateFields(inputSchema, containerId) {
locationSetupInitiated = false;
if (IS_RETRIEVE_FROM_BPO) {
let elementId = sessionStorage.getItem("element_id");
......@@ -1145,9 +1149,12 @@ const inputFileUpload = (key, validation, readOnly) => {
const container = document.createElement('div');
const container2 = document.createElement('div');
const outputContainer = document.createElement('div');
container.appendChild(container2);
container.appendChild(outputContainer);
container2.classList.add('file-upload');
container2.setAttribute('id', `${key}_container`);
outputContainer.setAttribute('id', `${key}_outputContainer`);
const input = document.createElement('input');
input.setAttribute('id', `${key}_attachedMedia`);
......@@ -1174,58 +1181,15 @@ const inputFileUpload = (key, validation, readOnly) => {
const file = event.target.files[0];
console.log(file)
if (file) {
// Create hidden inputs for fname and file content
const hiddenFnameInput = document.createElement('input');
hiddenFnameInput.setAttribute('id', `${key}`);
hiddenFnameInput.setAttribute('type', 'hidden');
hiddenFnameInput.setAttribute('name', 'hidden_fname');
container2.appendChild(hiddenFnameInput);
const hiddenFileContentInput = document.createElement('input');
hiddenFileContentInput.setAttribute('id', `${key}`);
hiddenFileContentInput.setAttribute('type', 'hidden');
hiddenFileContentInput.setAttribute('name', 'hidden_file_content');
container2.appendChild(hiddenFileContentInput);
const img = document.getElementById(`${key}_zz`);
const thumb = document.getElementById(`${key}_thumbnail`);
const x = document.getElementById(`${key}_x`);
const fileSizeString = formatFileSize(file.size);
const fileNameString = file.name;
if (file.type.startsWith('image/')) {
// If it's an image file, display it directly
const reader = new FileReader();
reader.onload = function(e) {
img.src = e.target.result;
img.style.display = 'inline';
img.style.width = '100%'; // Set maximum width to 100% of the container
img.style.height = '100%'; // Set maximum height to a specific value (adjust as needed)
thumb.style.display = 'none';
filename.textContent = file.name;
filename.style.display = 'inline';
// Set the hidden inputs when a file is selected
hiddenFnameInput.value = file.name;
hiddenFnameInput.display = '';
hiddenFileContentInput.value = e.target.result; // This will store the base64-encoded content of the file
hiddenFileContentInput.display = '';
document.getElementById(`${key}_buttonsContainer-video`).style.display = 'none';
x.style.display = 'block';
x.style.position = 'absolute';
document.getElementById(`${key}_x`).addEventListener('click', () => {
img.style.display = 'none';
img.src = '';
thumb.style.display = 'none';
x.style.display = 'none';
input.value = ''
filename.style.display = 'none';
filename.textContent = '';
document.getElementById(`${key}_buttonsContainer-video`).style.display = 'flex';
// Clear the hidden fields
container2.removeChild(hiddenFnameInput);
container2.removeChild(hiddenFileContentInput);
});
processCapture(key, fileNameString, fileSizeString);
};
reader.readAsDataURL(file);
} else if (file.type.startsWith('video/')) {
......@@ -1312,10 +1276,11 @@ const inputFileUpload = (key, validation, readOnly) => {
x.setAttribute('style', 'display: none')
x.textContent = 'x';
const input1 = document.createElement('input');
const input1 = document.createElement('button');
input1.setAttribute('id', `${key}`);
input1.setAttribute('name', `${key}`);
input1.setAttribute('type', 'button');
input1.innerHTML = '<span class="icon"></span> Attach File';
input1.addEventListener('click', () => {
document.getElementById(`${key}_attachedMedia`).click(); // Trigger click on hidden input
});
......@@ -1608,9 +1573,10 @@ const inputGeoTag = async (key, validation) => {
input1.setAttribute('class', `${collection}`)
input1.setAttribute('type', 'text')
input1.setAttribute('readonly', 'true')
if (collection === 'geotag') {
await getLocation();
}
if (collection === 'geotag' && !locationSetupInitiated) {
locationSetupInitiated = true; // Update flag to indicate location setup has been initiated
await getLocation();
}
// Create a container div to hold both the input and the text node
const container = document.createElement('div');
......@@ -1646,7 +1612,8 @@ const inputGeoTagStart = async (key, validation) => {
input1.setAttribute('class', `${collection}`)
input1.setAttribute('type', 'text')
input1.setAttribute('readonly', 'true')
if (collection === 'geotagstart') {
if (collection === 'geotagstart' && !locationSetupInitiated) {
locationSetupInitiated = true;
await getLocation();
}
......@@ -2210,6 +2177,12 @@ const createDocTypeDropdown = (fieldLabel, container, schema, doc) => {
if (schema[doctype].readOnly){
isDoctypeReadOnly = true;
}
if (schema[doctype].docTypeHidden){
isDoctypeHidden = true;
}
if (schema[doctype].sectionHidden){
isSectionHidden = true;
}
continue;
}
newOption = document.createElement("option")
......@@ -2229,6 +2202,10 @@ const createDocTypeDropdown = (fieldLabel, container, schema, doc) => {
docTypeDropDown.classList.add('inputField')
inputContainer.appendChild(docTypeDropDown)
if(isDoctypeHidden){
newField.style.display = "none";
}
return container
} catch (err) {
throw err
......@@ -2280,6 +2257,10 @@ const createSection = (fieldLabel, container, doctype, section, sec) => {
docTypeDropDown.classList.add('inputField')
inputContainer.appendChild(docTypeDropDown)
if(isSectionHidden){
newField.style.display = "none";
}
return container
} catch (err) {
throw err
......
......@@ -42,4 +42,6 @@ function parseJwt(token) {
}).join(''));
return JSON.parse(jsonPayload);
}
\ No newline at end of file
}
window.parseJwt = parseJwt;
\ No newline at end of file
......@@ -6,7 +6,7 @@ import { createInfoModal } from "../../genericPopup/genericPopup.js";
import { PROJECT_CODE, ENCODING_PASS, TEMPORARY_FOLDER } from "../config.js";
import { completeToNextNode } from "../submit.js";
export async function WriteForm(e,metrics,doctype,section) {
export async function WriteForm(metrics,doctype,section) {
try {
var Frm= document.getElementById("fields");
var Nodes=Frm.elements;
......
......@@ -12,7 +12,7 @@ import { urlGetFile } from "./XMLWriter/WebServices.js";
import { WriteForm } from "./XMLWriter/XML_Saver.js";
import { GFS_ROOT_FOLDER, GFS_URL, PROJECT_CODE, TEMPORARY_FOLDER } from "./config.js";
export const submitForm = async (e) => {
export const submitForm = async () => {
try {
// Get current timestamp
const currentTimeStamp = Date.now();
......@@ -32,10 +32,18 @@ export const submitForm = async (e) => {
// Validate all elements again
for (let element of elements) {
const { id, value, type, name } = element
if (id === 'DocType') {
doctype = element.options[element.selectedIndex].text;
continue;
}
if (id === 'Section') {
section = element.options[element.selectedIndex].text;
continue;
}
if (element.style.display === 'none' || element.classList.contains('hidden')) {
continue;
}
const { id, value, type, name } = element
const errorContainer = document.getElementById(`${id}_error`);
// Skip submit, buttons, and files
if (element.classList.contains('radioOther') || element.classList.contains('checkboxOther')) continue;
......@@ -46,15 +54,7 @@ export const submitForm = async (e) => {
if (type === 'file') continue
if (type === 'hidden') continue
if (element.classList.contains('radioOption') && id.length === 0) continue
if (element.classList.contains('checkboxOption') && id.length === 0) continue
if (id === 'DocType') {
doctype = element.options[element.selectedIndex].text;
continue;
}
if (id === 'Section') {
section = element.options[element.selectedIndex].text;
continue;
}
if (element.classList.contains('checkboxOption') && id.length === 0) continue
const { valid, errors } = validateInput(id, value)
......@@ -128,7 +128,7 @@ export const submitForm = async (e) => {
else {
if (IS_RETRIEVE_FROM_BPO === "N") {
let response = await WriteForm(e, [], doctype, section);
let response = await WriteForm([], doctype, section);
await batchUpload(Form);
if (response !== false) {
let folderName = sessionStorage.getItem("recentlySavedFileNameOnly");
......@@ -151,7 +151,7 @@ export const submitForm = async (e) => {
return false
}
} else {
let response = await WriteForm(e, [], doctype, section);
let response = await WriteForm([], doctype, section);
await batchUpload(Form);
if (response !== false) {
let folderName = sessionStorage.getItem("recentlySavedFileNameOnly");
......@@ -343,30 +343,60 @@ export const returnForm = async (e) => {
}
}
export async function createSubmitWindow(e) {
let submitStatus;
async function okButtonFunction() {
createLoadingModal("Submitting Element", "Please wait...", null, null, null);
submitStatus = await submitForm(e);
if (submitStatus) {
removeLoadingModal();
DISPLAY_FIELD_OBJECT.clearForm();
if (SHOW_ELEMENT_LIST_VIEWER === "Y") {
createInfoModal(goBackToElementListViewer, 'ok', 'Form Submitted.');
} else {
createInfoModal(null, 'ok', 'Form Submitted.');
}
if (IS_RETRIEVE_FROM_BPO === "Y") {
await updateExtraDetails(sessionStorage.getItem("user_id"));
let response = await completeToNextNode(sessionStorage.getItem("element_id"));
}
} else {
removeLoadingModal();
}
};
// Function to handle location permission granted
export async function onLocationPermissionGrantedImplem() {
let submitStatus = await submitForm();
if (submitStatus) {
removeLoadingModal();
DISPLAY_FIELD_OBJECT.clearForm();
if (SHOW_ELEMENT_LIST_VIEWER === "Y") {
createInfoModal(goBackToElementListViewer, 'ok', 'Form Submitted.');
} else {
createInfoModal(null, 'ok', 'Form Submitted.');
}
if (IS_RETRIEVE_FROM_BPO === "Y") {
await updateExtraDetails(sessionStorage.getItem("user_id"));
let response = await completeToNextNode(sessionStorage.getItem("element_id"));
}
} else {
removeLoadingModal();
}
}
// Function to handle location permission denied
export function onLocationPermissionDeniedImplem() {
removeLoadingModal();
createErrorModal(null, "Ok", "Permission Access Required.");
}
// Function to trigger Android function and handle response
async function triggerAndroidFunction() {
createLoadingModal("Submitting Element", "Please wait...", null, null, null);
// Trigger Android function to request location service
await window.LocationHandlerInterface.callSubmit();
}
// Function to handle OK button click
async function okButtonFunction() {
try {
// Check if location is required
const locationRequired = sessionStorage.getItem("locationRequired");
if (locationRequired === "true") {
await triggerAndroidFunction();
} else {
// Location is not required, submit directly
await onLocationPermissionGrantedImplem();
}
} catch (error) {
console.error("Error triggering Android function:", error);
removeLoadingModal();
return;
}
}
return createConfirmationModal(okButtonFunction, "Submit Element?");
// Main function to create submit window
export async function createSubmitWindow() {
return createConfirmationModal(okButtonFunction, "Submit Element?");
}
function validateMedia(key) {
......
......@@ -23,18 +23,18 @@ export const INVALID_KEYS = "F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,F11,F12,PrintScreen,
export const OUTPUT_FILE_EXTENSION = ".DTA"
//BPO CONFIG
export const IS_RETRIEVE_FROM_BPO = "Y"
export const IS_RETRIEVE_FROM_BPO = "N"
export let BPO_URL = DOMAIN + "bpo/";
export let CURRENT_NODE = ""
export const ENCODING_PASS = "PASS1"
export const PROD_OUTPUT_UNIT = "INSPECTION"
export const NEXT_NODE = "INSPECTED"
export const EXCEPTION_NODE = "CANCELLED"
export const SHOW_ELEMENT_LIST_VIEWER = "Y"
export const SHOW_ELEMENT_LIST_VIEWER = "N"
export const ADD_NEW_OPTION = "N"
export const DISPLAYED_DETAILS = "inspectionType|businessAddress" //pipe-delimited
export const USERID_FIELD = "inspectorUsername"
export const ENABLE_PRINT = "Y"
export const ENABLE_PRINT = "N"
export const PDF_EXTENSION = ".pdf"
export const JPG_EXTENSION = ".jpg"
......
......@@ -92,7 +92,7 @@ export class DocumentControlWidget {
});
this.global.submitBtn.onclick = async (e) => {
createSubmitWindow(e);
createSubmitWindow();
}
this.global.returnBtn.onclick = (e) => {
......
{
"_attributes": {
"readOnly":false,
"docTypeHidden":true,
"sectionHidden":true
},
"DOCUMENT": {
"Section": {
"page1": {
"fieldLabel": "Page 1",
"aka": "field2",
"validation": {
"fieldLength": 1.0,
"collection": "image-capture",
"validDate": "",
"mandatory": true
}
},
"page2": {
"fieldLabel": "Page 2",
"aka": "field3",
"validation": {
"fieldLength": 1.0,
"collection": "file-upload",
"validDate": "",
"mandatory": false
}
},
"page3": {
"fieldLabel": "Page 3",
"aka": "field4",
"validation": {
"fieldLength": 1.0,
"collection": "image-capture",
"validDate": "",
"mandatory": false
}
},
"page4": {
"fieldLabel": "Page 4",
"aka": "field5",
"validation": {
"fieldLength": 1.0,
"collection": "image-capture",
"validDate": "",
"mandatory": false
}
},
"page5": {
"fieldLabel": "Page 5",
"aka": "field6",
"validation": {
"fieldLength": 1.0,
"collection": "image-capture",
"validDate": "",
"mandatory": false
}
},
"page6": {
"fieldLabel": "Page 6",
"aka": "field7",
"validation": {
"fieldLength": 1.0,
"collection": "image-capture",
"validDate": "",
"mandatory": false
}
},
"page7": {
"fieldLabel": "Page 7",
"aka": "field8",
"validation": {
"fieldLength": 1.0,
"collection": "image-capture",
"validDate": "",
"mandatory": false
}
},
"page8": {
"fieldLabel": "Page 8",
"aka": "field9",
"validation": {
"fieldLength": 1.0,
"collection": "image-capture",
"validDate": "",
"mandatory": false
}
},
"page9": {
"fieldLabel": "Page 9",
"aka": "field10",
"validation": {
"fieldLength": 1.0,
"collection": "image-capture",
"validDate": "",
"mandatory": false
}
},
"page10": {
"fieldLabel": "Page 10",
"aka": "field11",
"validation": {
"fieldLength": 1.0,
"collection": "image-capture",
"validDate": "",
"mandatory": false
}
}
}
}
}
\ No newline at end of file
{
"_attributes": {
"readOnly": true
"readOnly": true,
"sectionHidden":true
},
"REG-INP" : {
"Section" : {
......
{
"_attributes": {
"readOnly":false,
"docTypeHidden":true,
"sectionHidden":true
},
"Demo Schema" : {
"Section" : {
"first_name": {
"fieldLabel": "First Name",
"aka": "field2",
"validation": {
"fieldLength": 30.0,
"collection": "alphanumeric",
"validDate": "",
"mandatory": true
}
},
"middle_name": {
"fieldLabel": "Middle Name",
"aka": "field3",
"validation": {
"fieldLength": 30.0,
"collection": "alphanumeric",
"validDate": "",
"mandatory": false
}
},
"last_name": {
"fieldLabel": "Last Name",
"aka": "field4",
"validation": {
"fieldLength": 30.0,
"collection": "alphanumeric",
"validDate": "",
"mandatory": true
}
},
"birthdate": {
"fieldLabel": "Birthdate",
"aka": "field5",
"validation": {
"fieldLength": 10.0,
"collection": "datepicker",
"validDate": "",
"mandatory": true
}
},
"sex": {
"fieldLabel": "Sex",
"aka": "field6",
"validation": {
"fieldLength": 1.0,
"collection": "radiolist",
"items": ["M", "F"],
"mandatory": true
}
},
"supporting_document_1": {
"fieldLabel": "Supporting Document 1",
"aka": "field7",
"validation": {
"fieldLength": 1.0,
"collection": "image-capture",
"validDate": "",
"mandatory": false
}
},
"supporting_document_2": {
"fieldLabel": "Supporting Document 1",
"aka": "field8",
"validation": {
"fieldLength": 1.0,
"collection": "image-capture",
"validDate": "",
"mandatory": false
}
},
"supporting_document_3": {
"fieldLabel": "Supporting Document 1",
"aka": "field9",
"validation": {
"fieldLength": 1.0,
"collection": "image-capture",
"validDate": "",
"mandatory": false
}
}
}
}
}
\ No newline at end of file
......@@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>WebGde</groupId>
<artifactId>WebGde</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>1.2.0-SNAPSHOT</version>
<packaging>war</packaging>
<dependencies>
<dependency>
......
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