Commit aec6a2f3 by Jorem Magcawas

integration of features

parent afacb68a
......@@ -24,7 +24,7 @@
/*var SCHEMA_FILE = "./src/sample_schema/SC Schema.json"*/
var SCHEMA_FILE = "./src/sample_schema/HR Speed Test schema.json"
var SCHEMA_FILE = "./src/sample_schema/Speed Test Application Form schema.json"
//const INPUT_FILES = ["./input/Ong, Mae Janica - Application Form.TIFF","./input/Magalona, Rowell James - Application Form.TIFF","./input/Felizardo, Brylle Theodure - Application Form.TIFF","./input/Laxamana, Conrad John - Application Form.TIFF"] // list of URLs
......
......@@ -130,7 +130,9 @@ function createRejectWindow(){
var fileName = sessionStorage.getItem("file_Name");
if(fileName !== null && fileName !== undefined){
document.getElementById("controlsContainer").style.display = "none";
}
}else{
document.getElementById("TiffViewer_ButtonContainer").style.display = "none";
}
}
cancelButton.onclick = function () {
......
......@@ -69,24 +69,26 @@ async function returnElementLogout(elementId) {
var returnButton = document.getElementById('return');
returnButton.addEventListener("click", function () {
returnElementBPO(sessionStorage.getItem("element_id"));
// const fieldForm = document.getElementById("fields");
// fieldForm.querySelector('input[type="submit"]').click();
var fileName = sessionStorage.getItem("file_Name");
if(fileName !== null && fileName !== undefined){
document.getElementById("controlsContainer").style.display = "none";
}
});
returnElementBPO(sessionStorage.getItem("element_id"));
var fileName = sessionStorage.getItem("file_Name");
if(fileName !== null && fileName !== undefined){
document.getElementById("controlsContainer").style.display = "none";
}else{
document.getElementById("TiffViewer_ButtonContainer").style.display = "none";
}
});
window.addEventListener('keydown', function(e) {
if (e.altKey == true && e.keyCode == 85){
returnElementBPO(sessionStorage.getItem("element_id"));
// const fieldForm = document.getElementById("fields");
// fieldForm.querySelector('input[type="submit"]').click();
returnElementBPO(sessionStorage.getItem("element_id"));
var fileName = sessionStorage.getItem("file_Name");
if(fileName !== null && fileName !== undefined){
document.getElementById("controlsContainer").style.display = "none";
}else{
document.getElementById("TiffViewer_ButtonContainer").style.display = "none";
}
}
});
......
......@@ -11,7 +11,7 @@ async function WriteForm(e,metrics,doctype,section) {
for (var i=0;i<Nodes.length;i++) {
if (Nodes[i].style.display === 'none') continue
let fid = Nodes[i].id;
if (fid == 'DocType' || fid == 'Section' || fid == '') continue
if (fid == 'DocType' || fid == 'Section' || fid == '' || fid == "submitButton") continue
fields[Object.keys(lookup[fid]).includes('aka') ? lookup[fid].aka.replace("field", "") : fid] = Nodes[i].value;
}
......
......@@ -67,7 +67,7 @@ async function accessFile() {
idQuery.onsuccess = function() {
url = URL.createObjectURL(idQuery.result.address);
if (filename.endsWith(PDF_EXTENSION)) {
if (idQuery.result.name.endsWith(PDF_EXTENSION)) {
sessionStorage.setItem("file_Name", idQuery.result.name);
const TiffViewer_Header = document.getElementById("TiffModalHeader");
const TiffViewer_filedetail = document.createElement("div");
......@@ -75,23 +75,18 @@ async function accessFile() {
TiffViewer_filedetail.style.textAlign = "center";
TiffViewer_filedetail.textContent = "Filename: " + idQuery.result.name;
TiffViewer_Header.append(TiffViewer_filedetail);
displayPdf(img);
displayPdf(idQuery.result.path);
} else {
console.log("This is not a pdf file");
window.addEventListener("load", loadDoc(url, TIFFViewer, idQuery.result.name), false);
}
// File_Name = idQuery.result.name;
// File_Path = idQuery.result.path;
// store.delete(parseInt(localStorage.getItem("display_counter")) - 1);
// localStorage.setItem("submit", "0");
};
} else if (count.result >= 2 && (localStorage.length) >= 2 && localStorage.getItem("submit") == 1) {
const idQuery = store.get(parseInt(localStorage.getItem("display_counter")));
idQuery.onsuccess = function() {
url = URL.createObjectURL(idQuery.result.address);
if (filename.endsWith(PDF_EXTENSION)) {
if (idQuery.result.name.endsWith(PDF_EXTENSION)) {
sessionStorage.setItem("file_Name", idQuery.result.name);
const TiffViewer_Header = document.getElementById("TiffModalHeader");
const TiffViewer_filedetail = document.createElement("div");
......@@ -99,19 +94,11 @@ async function accessFile() {
TiffViewer_filedetail.style.textAlign = "center";
TiffViewer_filedetail.textContent = "Filename: " + idQuery.result.name;
TiffViewer_Header.append(TiffViewer_filedetail);
displayPdf(img);
displayPdf(idQuery.result.path);
} else {
console.log("This is not a pdf file");
window.addEventListener("load", loadDoc(url, TIFFViewer, idQuery.result.name), false);
}
// File_Name = idQuery.result.name;
// File_Path = idQuery.result.path;
// store.delete(parseInt(localStorage.getItem("display_counter")) - 1);
// store.put({ id: parseInt(localStorage.getItem("display_counter")) + 1, address: blob , name:filename, path:img});
// localStorage.setItem("submit", "0");
// localStorage.setItem("display_counter", parseInt(localStorage.getItem("display_counter")) + 1); //update how many have been fetched
// var file = new File([blob], filename + ".TIFF", {type: "img"}); //uplaod to uploadimgfolder //scanned images
};
}
}
......@@ -205,7 +192,6 @@ async function accessFile() {
}
localStorage.setItem("display_counter", 1);
sessionStorage.setItem('isLoadedFirstImg', "true");
size = size + total;
File_Name = filename;
File_Path = img;
......@@ -215,17 +201,10 @@ async function accessFile() {
document.getElementById('prev').setAttribute('disabled','true');
document.getElementById('next').removeAttribute('disabled');
store.put({ id: count.result + 1, address: blob , name:filename, path:img});
//start
url = URL.createObjectURL(blob);
window.addEventListener("load", loadDoc(url, TIFFViewer,filename), false);
//end
localStorage.setItem("submit", "0");
localStorage.setItem("display_counter", 2);
localStorage.setItem("sfIndex", 1);
size = size + total;
File_Name = filename;
File_Path = img;
/*populateFields();*/
} else if(totalImages != (parseInt(localStorage.getItem("sfIndex"))) && img == null && count.result >= 2 && (localStorage.length) >= 2 && localStorage.getItem("submit") == 1){ //if only one file left
const idQuery = store.get(parseInt(localStorage.getItem("display_counter")));
......@@ -312,7 +291,9 @@ async function accessFile() {
else {
// console.log(count.result);
// console.log(localStorage.length);
}
}
}
......@@ -329,7 +310,7 @@ async function accessFile() {
if(IS_RETRIEVE_FROM_GFS == "Y"){
const modal = document.getElementById("TiffViewerModal");
modal.style.display = 'none';//hide local modal\
getFolder(FOLDER_URL+sessionStorage.getItem('user_id')+'/element5');
getFolder(FOLDER_URL+sessionStorage.getItem('user_id')+'/element7');
}else{
if((localStorage.length)==0){
if(updated_input_files.length==0){
......@@ -631,3 +612,4 @@ function promptNoFilesLeft(){
function getGfsFileName(contentDisposition) {
return contentDisposition.split("filename=")[1].replaceAll('"', '');
}
{
"APPLICATION_FORM":
{
"SECTION1":
{
"Date":
{
"fieldLabel": "Date",
"aka": "field2",
"validation":
{
"fieldLength": 20,
"collection": "alphanumeric",
"invalidchar": "",
"mandatory": false
}
},
"Position Applied For":
{
"fieldLabel": "Pos Applied For",
"aka": "field3",
"validation":
{
"fieldLength": 30,
"collection": "alphanumeric",
"invalidchar": "",
"mandatory": false
}
},
"Surname":
{
"fieldLabel": "Surname",
"aka": "field4",
"validation":
{
"fieldLength": 50,
"collection": "alphanumeric",
"invalidchar": "",
"mandatory": false
}
},
"First Name":
{
"fieldLabel": "First Name",
"aka": "field5",
"validation":
{
"fieldLength": 50,
"collection": "alphanumeric",
"invalidchar": "",
"mandatory": false
}
},
"Middle Name":
{
"fieldLabel": "Mid Name",
"aka": "field6",
"validation":
{
"fieldLength": 50,
"collection": "alphanumeric",
"invalidchar": "",
"mandatory": false
}
},
"Mother's Maiden Name":
{
"fieldLabel": "Mother's Maiden Name",
"aka": "field7",
"validation":
{
"fieldLength": 100,
"collection": "alphanumeric",
"invalidchar": "",
"mandatory": false
}
},
"Nickname":
{
"fieldLabel": "Nickname",
"aka": "field8",
"validation":
{
"fieldLength": 20,
"collection": "alphanumeric",
"invalidchar": "",
"mandatory": false
}
},
"Email Address":
{
"fieldLabel": "Email",
"aka": "field9",
"validation":
{
"fieldLength": 50,
"collection": "alphanumeric",
"mandatory": false
}
},
"Mobile Number":
{
"fieldLabel": "Mobile No.",
"aka": "field10",
"validation":
{
"fieldLength": 30,
"collection": "alphanumeric",
"invalidchar": "",
"mandatory": false
}
},
"Telephone Number":
{
"fieldLabel": "Tel. No.",
"aka": "field11",
"validation":
{
"fieldLength": 20,
"collection": "alphanumeric",
"invalidchar": "",
"mandatory": false
}
},
"Present Address House No":
{
"fieldLabel": "Pres Add House No",
"aka": "field13",
"validation":
{
"fieldLength": 20,
"collection": "alphanumeric",
"invalidchar": "",
"mandatory": false
}
},
"Present Address Street":
{
"fieldLabel": "Pres Add Street",
"aka": "field14",
"validation":
{
"fieldLength": 30,
"collection": "alphanumeric",
"mandatory": false
}
},
"Present Address Village/Subd":
{
"fieldLabel": "Pres Add Vill/Subd",
"aka": "field15",
"validation":
{
"fieldLength": 50,
"collection": "alphanumeric",
"invalidchar": "`",
"mandatory": false
}
},
"Present Address Municipality/City/Province":
{
"fieldLabel": "Pres Add Mun/City/Prov",
"aka": "field16",
"validation":
{
"fieldLength": 60,
"collection": "alphanumeric",
"invalidchar": "",
"mandatory": false
}
},
"Years of Stay":
{
"fieldLabel": "Yrs of Stay",
"aka": "field17",
"validation":
{
"fieldLength": 3,
"collection": "numeric",
"mandatory": false
}
},
"Provincial Address House No":
{
"fieldLabel": "Prov Add House No",
"aka": "field19",
"validation":
{
"fieldLength": 20,
"collection": "alphanumeric",
"invalidchar": "`",
"mandatory": false
}
},
"Provincial Address Street":
{
"fieldLabel": "Prov Add Street",
"aka": "field20",
"validation":
{
"fieldLength": 30,
"collection": "alphanumeric",
"mandatory": false
}
},
"Provincial Address Village/Subd":
{
"fieldLabel": "Prov Add Vill/Subd",
"aka": "field21",
"validation":
{
"fieldLength": 50,
"collection": "alphanumeric",
"invalidchar": "",
"mandatory": false
}
},
"Provincial Address Municipality/City/Province":
{
"fieldLabel": "Prov Add Mun/City/Prov",
"aka": "field22",
"validation":
{
"fieldLength": 60,
"collection": "alphanumeric",
"invalidchar": "",
"mandatory": false
}
},
"Religion":
{
"fieldLabel": "Religion",
"aka": "field23",
"validation":
{
"fieldLength": 30,
"collection": "alphanumeric",
"invalidchar": "",
"mandatory": false
}
},
"Place of Birth":
{
"fieldLabel": "Place of Birth",
"aka": "field24",
"validation":
{
"fieldLength": 50,
"collection": "alphanumeric",
"invalidchar": "",
"mandatory": false
}
},
"Date of Birth":
{
"fieldLabel": "Date of Birth",
"aka": "field25",
"validation":
{
"fieldLength": 30,
"collection": "alphanumeric",
"invalidchar": "",
"mandatory": false
}
},
"Age":
{
"fieldLabel": "Age",
"aka": "field26",
"validation":
{
"fieldLength": 3,
"collection": "numeric",
"mandatory": false
}
},
"Gender":
{
"fieldLabel": "Gender",
"aka": "field27",
"validation":
{
"fieldLength": 10,
"collection": "alphanumeric",
"invalidchar": "",
"mandatory": false
}
},
"Civil Status":
{
"fieldLabel": "Civil Status",
"aka": "field28",
"validation":
{
"fieldLength": 10,
"collection": "alphanumeric",
"invalidchar": "",
"mandatory": false
}
},
"Nationality":
{
"fieldLabel": "Nationality",
"aka": "field29",
"validation":
{
"fieldLength": 20,
"collection": "alphanumeric",
"invalidchar": "",
"mandatory": false
}
},
"SSS Number":
{
"fieldLabel": "SSS No",
"aka": "field30",
"validation":
{
"fieldLength": 20,
"collection": "alphanumeric",
"invalidchar": "",
"mandatory": false
}
},
"TIN":
{
"fieldLabel": "TIN",
"aka": "field31",
"validation":
{
"fieldLength": 20,
"collection": "alphanumeric",
"invalidchar": "",
"mandatory": false
}
},
"Commmunity Tax Number":
{
"fieldLabel": "Comm Tax No",
"aka": "field32",
"validation":
{
"fieldLength": 20,
"collection": "alphanumeric",
"invalidchar": "",
"mandatory": false
}
},
"Place of Issue":
{
"fieldLabel": "Place of Issue",
"aka": "field33",
"validation":
{
"fieldLength": 30,
"collection": "alphanumeric",
"invalidchar": "",
"mandatory": false
}
},
"Date of Issue":
{
"fieldLabel": "Date of Issue",
"aka": "field34",
"validation":
{
"fieldLength": 25,
"collection": "alphanumeric",
"invalidchar": "",
"mandatory": false
}
},
"Height":
{
"fieldLabel": "Height",
"aka": "field35",
"validation":
{
"fieldLength": 10,
"collection": "alphanumeric",
"invalidchar": "",
"mandatory": false
}
},
"Weight":
{
"fieldLabel": "Weight",
"aka": "field36",
"validation":
{
"fieldLength": 10,
"collection": "alphanumeric",
"invalidchar": "",
"mandatory": false
}
},
"Spoken Languages":
{
"fieldLabel": "Spoken Languages",
"aka": "field38",
"validation":
{
"fieldLength": 30,
"collection": "alphanumeric",
"invalidchar": "",
"mandatory": false
}
},
"Written Languages":
{
"fieldLabel": "Written Languages",
"aka": "field39",
"validation":
{
"fieldLength": 30,
"collection": "alphanumeric",
"invalidchar": "",
"mandatory": false
}
}
}
}
}
......@@ -78,9 +78,7 @@ const submitForm = (e) => {
});
document.getElementById("counter").innerHTML = "";
clearTimeout(interval);
/*sessionStorage.removeItem("section");
sessionStorage.removeItem("doctype");*/
isCanvasNotCreated = true;
isCanvasNotCreated = true;
if(IS_RETRIEVE_FROM_GFS != "Y"){
init();
......
......@@ -634,23 +634,24 @@ function TIFFViewer(xhr, TiffViewerImageName) {
//Set Style per button click
function Edited() {
var TiffViewer_imgclass = document.getElementById("TiffViewer_FileContainer");
var TiffViewer_Screen = document.getElementById("TiffViewer_Screen");
const TiffViewer_Screen = document.getElementById("TiffViewer_Screen");
var TiffViewer_ImageContainer = document.getElementById("TiffViewer_ImageContainer");
var image = document.getElementById(filenameWithoutExt+`${TiffViewer_current}`);
image.style.display = "flex";
//if the image is rotated 90 degrees
if (rot[TiffViewer_current - 1] == 90 || rot[TiffViewer_current - 1] == 270 || rot[TiffViewer_current - 1] == -90 || rot[TiffViewer_current - 1] == -270) {
image.style = `display: flex;
image.style = `
width: ${setwidth + wzoom[TiffViewer_current - 1]};
height: ${setheight + hzoom[TiffViewer_current - 1]};
border: 0px groove white;
transform: rotate(${rot[TiffViewer_current - 1]}deg) scaleX(${flippedX[TiffViewer_current - 1]}) scaleY(${flippedY[TiffViewer_current - 1]});`;
image.style = `display: flex;
image.style = `
width: ${setwidth + wzoom[TiffViewer_current - 1]};
height: ${setheight + hzoom[TiffViewer_current - 1]};
border: 0px groove white;
-ms-transform: rotate(${rot[TiffViewer_current - 1]}deg) scaleX(${flippedX[TiffViewer_current - 1]}) scaleY(${flippedY[TiffViewer_current - 1]});`; // IE
image.style = `display: flex;
image.style = `
width: ${setwidth + wzoom[TiffViewer_current - 1]};
height: ${setheight + hzoom[TiffViewer_current - 1]};
border: 0px groove white;
......@@ -676,17 +677,17 @@ function TIFFViewer(xhr, TiffViewerImageName) {
width = TiffViewer_Screen.clientHeight;
height = TiffViewer_Screen.clientWidth;
} else {
image.style = `display: flex;
image.style = `
width: ${setwidth + wzoom[TiffViewer_current - 1]};
height: ${setheight + hzoom[TiffViewer_current - 1]};
border: 0px groove white;
transform: rotate(${rot[TiffViewer_current - 1]}deg) scaleX(${flippedX[TiffViewer_current - 1]}) scaleY(${flippedY[TiffViewer_current - 1]});`;
image.style = `display: flex;
image.style = `
width: ${setwidth + wzoom[TiffViewer_current - 1]};
height: ${setheight + hzoom[TiffViewer_current - 1]};
border: 0px groove white;
-ms-transform: rotate(${rot[TiffViewer_current - 1]}deg) scaleX(${flippedX[TiffViewer_current - 1]}) scaleY(${flippedY[TiffViewer_current - 1]});`; // IE
image.style = `display: flex;
image.style = `
width: ${setwidth + wzoom[TiffViewer_current - 1]};
height: ${setheight + hzoom[TiffViewer_current - 1]};
border: 0px groove white;
......
......@@ -756,7 +756,7 @@ vertical-align: middle;
.pageButtonInfoContainer {
position: absolute;
right: 0px;
right: 44px;
margin-right: 8vw;
}
......
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