Commit d6bd16cc by Jorem Magcawas

Merge branch 'feature-merge-branch' into 'feature-UI_construction'

# Conflicts: # WebGde/WebContent/src/tiffViewer/tiffViewer.js # WebGde/WebContent/style.css
parents 3af64547 8f42e223
...@@ -26,7 +26,23 @@ ...@@ -26,7 +26,23 @@
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes> <attributes>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/> </attributes>
</classpathentry>
<classpathentry kind="src" path="target/generated-sources/annotations">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="m2e-apt" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="m2e-apt" value="true"/>
<attribute name="test" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="output" path="target/classes"/> <classpathentry kind="output" path="target/classes"/>
......
...@@ -34,4 +34,15 @@ ...@@ -34,4 +34,15 @@
<nature>org.eclipse.jdt.core.javanature</nature> <nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature> <nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</natures> </natures>
<filteredResources>
<filter>
<id>1675315043043</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription> </projectDescription>
eclipse.preferences.version=1
org.eclipse.jdt.apt.aptEnabled=false
...@@ -7,5 +7,6 @@ org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled ...@@ -7,5 +7,6 @@ org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
org.eclipse.jdt.core.compiler.processAnnotations=disabled
org.eclipse.jdt.core.compiler.release=disabled org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8 org.eclipse.jdt.core.compiler.source=1.8
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0"> <?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="WebGde-0.0.1-SNAPSHOT"> <wb-module deploy-name="WebGde-0.0.1-SNAPSHOT">
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/> <wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/WebContent" tag="defaultRootSource"/> <wb-resource deploy-path="/" source-path="/WebContent" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/annotations"/>
<property name="java-output-path" value="/WebGde/build/classes"/> <property name="java-output-path" value="/WebGde/build/classes"/>
<property name="context-root" value="WebGde"/> <property name="context-root" value="WebGde"/>
</wb-module> </wb-module>
</project-modules> </project-modules>
async function initGetElement() { async function initGetElement() {
const elements = [...(await getWorkload())].reverse(); const elements = [...(await getWorkload())].reverse();
for(const element of elements) { for (const element of elements) {
const retElement = await getReturnedElement(element); const retElement = await getReturnedElement(element);
if (retElement.errorCode == 0) { if (retElement.errorCode == 0) {
...@@ -10,10 +10,9 @@ async function initGetElement() { ...@@ -10,10 +10,9 @@ async function initGetElement() {
const xml = await isXMLExisting(retElement.element); const xml = await isXMLExisting(retElement.element);
if (xml.isExisting) { if (xml.isExisting) {
const xmlString = await [...xml.data].join('').replace('\t',''); const xmlString = await [...xml.data].join('').replace('\t', '');
const lastImage = getXmlLastImage(xmlString); const lastImage = getXmlLastImage(xmlString);
console.log('xmlString:' + xmlString);
sessionStorage.setItem('section', getXmlSection(xmlString)); sessionStorage.setItem('section', getXmlSection(xmlString));
sessionStorage.setItem('doctype', getXmlDocType(xmlString)); sessionStorage.setItem('doctype', getXmlDocType(xmlString));
...@@ -71,25 +70,41 @@ async function isLSTExisting(element) { ...@@ -71,25 +70,41 @@ async function isLSTExisting(element) {
const response = await fetch(urlGetIfExisting, { const response = await fetch(urlGetIfExisting, {
method: "POST", method: "POST",
headers: { headers: {
'Content-Type':'application/json' 'Content-Type': 'application/json'
}, },
body: JSON.stringify({ "filePath": `${element.fileLocation}/${element.elementId}.lst` }) body: JSON.stringify({
"filePath": `${element.fileLocation}/${element.elementId}.lst`
})
}); });
return await response.json(); return await response.json();
}
//var folderLoc = `${element.fileLocation}` + "worker1" + "/" + "element1"; //var folderLoc = `${element.fileLocation}` + "worker1" + "/" + "element1";
//getFolderLst(folderLoc); //getFolderLst(folderLoc);
// const response = await fetch() // const response = await fetch()
async function isXMLExisting(element) {
const response = await fetch(urlGetIfExisting, {
method: "POST",
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
"filePath": `${element.fileLocation}/${element.elementId}.${ENCODING_PASS == "PASS1" ? "DTA" : "DTB"}`
})
});
return await response.json();
} }
async function getFieldXml(element) { async function getFieldXml(element) {
const response = await fetch(urlGetXml, { const response = await fetch(urlGetXml, {
method: "POST", method: "POST",
headers: { headers: {
'Content-Type':'application/json' 'Content-Type': 'application/json'
}, },
body: JSON.stringify({ "filePath": `${element.fileLocation}/${element.elementId}.${ENCODING_PASS == "PASS1" ? "DTA" : "DTB"}` }) body: JSON.stringify({
"filePath": `${element.fileLocation}/${element.elementId}.${ENCODING_PASS == "PASS1" ? "DTA" : "DTB"}`
})
}); });
return await response.json(); return await response.json();
} }
...@@ -99,7 +114,9 @@ function formatDirectory(dir) { ...@@ -99,7 +114,9 @@ function formatDirectory(dir) {
} }
async function returnElement(element) { async function returnElement(element) {
let response = await fetch(getUrlReturnElement(element.elementId), {method: "POST"}); let response = await fetch(getUrlReturnElement(element.elementId), {
method: "POST"
});
if (response.status != 200) { if (response.status != 200) {
alert(`Error ${response.status}: Returning element`) alert(`Error ${response.status}: Returning element`)
...@@ -194,12 +211,12 @@ async function createOutputXml(fields, metrics, doctype, section) { ...@@ -194,12 +211,12 @@ async function createOutputXml(fields, metrics, doctype, section) {
let response = await fetch(urlWriteXml, { let response = await fetch(urlWriteXml, {
method: "POST", method: "POST",
headers: { headers: {
'Content-Type':'application/json' 'Content-Type': 'application/json'
}, },
body: JSON.stringify(xmlData) body: JSON.stringify(xmlData)
}); });
/*if (localStorage.getItem("complete") == 1) {*/ if (localStorage.getItem("complete") == 1) {
if (completenessCheck(await response.text())) { if (completenessCheck(await response.text())) {
let response = await fetch(urlUpdateEob, { let response = await fetch(urlUpdateEob, {
method: "POST", method: "POST",
...@@ -210,7 +227,7 @@ async function createOutputXml(fields, metrics, doctype, section) { ...@@ -210,7 +227,7 @@ async function createOutputXml(fields, metrics, doctype, section) {
}); });
await completeToNextNode(elementId); await completeToNextNode(elementId);
} }
/* }*/ }
} }
...@@ -253,7 +270,7 @@ async function completeToNextNode(elementId) { ...@@ -253,7 +270,7 @@ async function completeToNextNode(elementId) {
} }
function getFolderLst(url){ function getFolderLst(url) {
const promise = fetch(url, { const promise = fetch(url, {
method: 'GET', method: 'GET',
headers: { headers: {
...@@ -261,8 +278,8 @@ function getFolderLst(url){ ...@@ -261,8 +278,8 @@ function getFolderLst(url){
// 'Content-Type': 'application/x-www-form-urlencoded', // 'Content-Type': 'application/x-www-form-urlencoded',
} }
}) })
.then(function (response) { .then(function(response) {
if(response.status === 200){ if (response.status === 200) {
response.json().then(function(data) { response.json().then(function(data) {
let temp = data.folderContent; let temp = data.folderContent;
// temp.forEach(function(obj){ // temp.forEach(function(obj){
...@@ -277,7 +294,7 @@ function getFolderLst(url){ ...@@ -277,7 +294,7 @@ function getFolderLst(url){
overlay.id = "containerModal" + i; overlay.id = "containerModal" + i;
overlay.style.display = 'none'; overlay.style.display = 'none';
container.append(overlay); container.append(overlay);
if(temp[i].name.includes(contain)){//contains if (temp[i].name.includes(contain)) { //contains
console.log(temp[i].name); console.log(temp[i].name);
} }
// getFiles(DOWNLOAD_URL,temp[i].fileId,overlay,temp[i].name); // getFiles(DOWNLOAD_URL,temp[i].fileId,overlay,temp[i].name);
...@@ -287,25 +304,27 @@ function getFolderLst(url){ ...@@ -287,25 +304,27 @@ function getFolderLst(url){
var currDislplay = document.getElementById("containerModal" + sessionStorage.getItem('gfsCounter')); var currDislplay = document.getElementById("containerModal" + sessionStorage.getItem('gfsCounter'));
currDislplay.style.display = 'block'; currDislplay.style.display = 'block';
}); });
}else{ } else {
console.log("Error"); console.log("Error");
} }
}) })
.catch(function (error) { .catch(function(error) {
console.log('Request failed', error); console.log('Request failed', error);
}); });
return promise; return promise;
} }
async function getFileLst(url,id,overlay,filename){ async function getFileLst(url, id, overlay, filename) {
console.log(url); console.log(url);
var myObject = {fileId : id}; var myObject = {
fileId: id
};
fetch(url, { fetch(url, {
method: 'POST', method: 'POST',
headers: { headers: {
'Authorization': sessionStorage.getItem('token'), 'Authorization': sessionStorage.getItem('token'),
'Content-Type':'application/json' 'Content-Type': 'application/json'
}, },
body: JSON.stringify(myObject) body: JSON.stringify(myObject)
}) })
...@@ -316,7 +335,7 @@ async function getFileLst(url,id,overlay,filename){ ...@@ -316,7 +335,7 @@ async function getFileLst(url,id,overlay,filename){
fileReader.onload = function() { fileReader.onload = function() {
console.log(this.result); console.log(this.result);
var fileReader = new FileReader(); var fileReader = new FileReader();
fileReader.onload = function () { fileReader.onload = function() {
// File_Name = filename; // File_Name = filename;
console.log(filename); console.log(filename);
// tiffViewerTest(this.result, overlay, filename); // tiffViewerTest(this.result, overlay, filename);
...@@ -328,7 +347,7 @@ async function getFileLst(url,id,overlay,filename){ ...@@ -328,7 +347,7 @@ async function getFileLst(url,id,overlay,filename){
}); });
}) })
.catch(function (error) { .catch(function(error) {
console.log('Request failed', error); console.log('Request failed', error);
}); });
} }
...@@ -342,16 +361,39 @@ function getBlobService(url, func) { ...@@ -342,16 +361,39 @@ function getBlobService(url, func) {
}) })
.then(function(response) { .then(function(response) {
switch (response.status) { switch (response.status) {
case 200: response.blob().then(function(data) { func(data); }); break; case 200:
case 460: createInfoPopup("Error 460", "User does not exist."); break; response.blob().then(function(data) {
case 403: removeOverlay(); createInfoPopup("We are so sorry...", "Permission Denied: You don't have access here."); break; func(data);
case 464: createInfoPopup("Error 464", "No folder was retrieved."); break; });
case 463: createInfoPopup("Error 463", "The folder name you entered already exists."); break; break;
case 462: createInfoPopup("Error 462", "No file was retrieved."); break; case 460:
case 461: createInfoPopup("Error 461", "File already exists."); break; createInfoPopup("Error 460", "User does not exist.");
case 465: createInfoPopup("Error 465", "Source not found"); break; break;
case 500: removeOverlay(); createInfoPopup("It's not you. It's us... So sorry.", "Error 500: Please contact the support team so we can fix this immediately."); break; case 403:
default: break; removeOverlay();
createInfoPopup("We are so sorry...", "Permission Denied: You don't have access here.");
break;
case 464:
createInfoPopup("Error 464", "No folder was retrieved.");
break;
case 463:
createInfoPopup("Error 463", "The folder name you entered already exists.");
break;
case 462:
createInfoPopup("Error 462", "No file was retrieved.");
break;
case 461:
createInfoPopup("Error 461", "File already exists.");
break;
case 465:
createInfoPopup("Error 465", "Source not found");
break;
case 500:
removeOverlay();
createInfoPopup("It's not you. It's us... So sorry.", "Error 500: Please contact the support team so we can fix this immediately.");
break;
default:
break;
} }
}) })
.catch(function(error) { .catch(function(error) {
...@@ -359,7 +401,5 @@ function getBlobService(url, func) { ...@@ -359,7 +401,5 @@ function getBlobService(url, func) {
createInfoPopup("Whoops!", "We encountered some problems with your request. Rest assured we're working on this and it'll be okay soon."); createInfoPopup("Whoops!", "We encountered some problems with your request. Rest assured we're working on this and it'll be okay soon.");
}); });
return promise; return promise;
} }
\ No newline at end of file
...@@ -11,6 +11,44 @@ async function rejectElement() { ...@@ -11,6 +11,44 @@ async function rejectElement() {
body: JSON.stringify(load) body: JSON.stringify(load)
}); });
if (response.status == 200) { if (response.status == 200) {
const indexedDB =
window.indexedDB ||
window.mozIndexedDB ||
window.webkitIndexedDB ||
window.msIndexedDB ||
window.shimIndexedDB;
const request = indexedDB.open("ImageDatabase", 1);
request.onsuccess = function () {
const db = request.result;
const delRequest = db.transaction("image", 'readwrite')
.objectStore("image")
.clear();
};
[...document.getElementsByClassName("TiffModalContent")].forEach(el => {
while (el.children[1].hasChildNodes()) {
el.children[1].removeChild(el.children[1].firstChild);
}
while (el.children[2].hasChildNodes()) {
el.children[2].removeChild(el.children[2].firstChild);
}
while (el.children[3].hasChildNodes()) {
el.children[3].removeChild(el.children[3].firstChild);
}
});
[...document.getElementsByClassName("bar")].forEach(el => {
el.style.removeProperty('display');
});
document.getElementById("counter").innerHTML = "";
clearTimeout(interval);
sessionStorage.removeItem("section");
sessionStorage.removeItem("doctype");
isCanvasNotCreated = true;
localStorage.clear();
Current_page = 0;
await initGetElement(); await initGetElement();
init(); init();
alert("Element Rejected"); alert("Element Rejected");
...@@ -207,6 +245,27 @@ function saveExceptionToXml(){ ...@@ -207,6 +245,27 @@ function saveExceptionToXml(){
var selected = document.querySelector('input[name="rejectRadio"]:checked').value; var selected = document.querySelector('input[name="rejectRadio"]:checked').value;
var elementId = sessionStorage.getItem("element_id"); var elementId = sessionStorage.getItem("element_id");
let doctype;
let section;
// Validate all elements again
for(let element of document.getElementById("fields").elements) {
if (element.style.display === 'none') continue
const { id, value,type } = element
const { valid } = validateInput(id, value)
// Skip submit button
if(type==='submit') continue
if(id==='DocType') {
doctype = element.options[element.selectedIndex].text;
continue;
}
if(id==='Section') {
section = element.options[element.selectedIndex].text;
continue;
}
}
let xmlData = { let xmlData = {
"projCode": PROJECT_CODE, "projCode": PROJECT_CODE,
"userId": sessionStorage.getItem("user_id"), "userId": sessionStorage.getItem("user_id"),
...@@ -227,8 +286,8 @@ function saveExceptionToXml(){ ...@@ -227,8 +286,8 @@ function saveExceptionToXml(){
"eor": "", "eor": "",
"fields": {}, "fields": {},
"outputDir": sessionStorage.getItem("element_file_loc") + "/" + (ENCODING_PASS == "PASS1" ? elementId + ".DTA" : elementId + ".DTB"), "outputDir": sessionStorage.getItem("element_file_loc") + "/" + (ENCODING_PASS == "PASS1" ? elementId + ".DTA" : elementId + ".DTB"),
"doctype": "", "doctype": doctype,
"section": "" "section": section
} }
updateXMLException(xmlData); updateXMLException(xmlData);
...@@ -280,7 +339,7 @@ async function updateXMLException(xmlData){ ...@@ -280,7 +339,7 @@ async function updateXMLException(xmlData){
body: JSON.stringify(xmlData) body: JSON.stringify(xmlData)
}); });
if (response.status == 200) { if (response.status == 200) {
alert("Exception Updated"); console.log("Exception Updated");
} }
else{ else{
alert(`Error ${response.status}: Xml Update`); alert(`Error ${response.status}: Xml Update`);
......
...@@ -3,6 +3,44 @@ async function returnElementBPO(elementId) { ...@@ -3,6 +3,44 @@ async function returnElementBPO(elementId) {
if (response.status == 200) { if (response.status == 200) {
saveExceptionToXml(); saveExceptionToXml();
const indexedDB =
window.indexedDB ||
window.mozIndexedDB ||
window.webkitIndexedDB ||
window.msIndexedDB ||
window.shimIndexedDB;
const request = indexedDB.open("ImageDatabase", 1);
request.onsuccess = function () {
const db = request.result;
const delRequest = db.transaction("image", 'readwrite')
.objectStore("image")
.clear();
};
[...document.getElementsByClassName("TiffModalContent")].forEach(el => {
while (el.children[1].hasChildNodes()) {
el.children[1].removeChild(el.children[1].firstChild);
}
while (el.children[2].hasChildNodes()) {
el.children[2].removeChild(el.children[2].firstChild);
}
while (el.children[3].hasChildNodes()) {
el.children[3].removeChild(el.children[3].firstChild);
}
});
[...document.getElementsByClassName("bar")].forEach(el => {
el.style.removeProperty('display');
});
document.getElementById("counter").innerHTML = "";
clearTimeout(interval);
sessionStorage.removeItem("section");
sessionStorage.removeItem("doctype");
isCanvasNotCreated = true;
localStorage.clear();
Current_page = 0;
await loadWaitingElement(); await loadWaitingElement();
init(); init();
alert('Element Returned'); alert('Element Returned');
......
...@@ -3,23 +3,16 @@ var File_Path; ...@@ -3,23 +3,16 @@ var File_Path;
var gfsFileName; var gfsFileName;
async function accessFile() { async function accessFile() {
var button = 0;
var size = 0; var size = 0;
let file_url = [];
const elStatus = document.getElementById('status'); const elStatus = document.getElementById('status');
function status(text) { function status(text) {
elStatus.innerHTML = text; elStatus.innerHTML = text;
} }
const progressBar = document.getElementById('progressBar'); const progressBar = document.getElementById('progressBar');
const elProgress = document.getElementById('progress');
function progress({ loaded, total }) { function progress({ loaded, total }) {
// elProgress.innerHTML = Math.round(loaded * .000001) + " mb of " + Math.round(total * .000001); // elProgress.innerHTML = Math.round(loaded * .000001) + " mb of " + Math.round(total * .000001);
progressBar.value = Math.round(loaded / total * 100); progressBar.value = Math.round(loaded / total * 100);
} }
const indexedDB = const indexedDB =
window.indexedDB || window.indexedDB ||
window.mozIndexedDB || window.mozIndexedDB ||
...@@ -44,14 +37,6 @@ async function accessFile() { ...@@ -44,14 +37,6 @@ async function accessFile() {
store.createIndex("image_address", ["address"], { unique: false }); store.createIndex("image_address", ["address"], { unique: false });
}; };
request.onsuccess = function () {
const db = request.result;
const delRequest = db.transaction("image", 'readwrite')
.objectStore("image")
.clear();
}
async function main(img) { async function main(img) {
const request = indexedDB.open("ImageDatabase", 1); const request = indexedDB.open("ImageDatabase", 1);
request.onsuccess = async function () { request.onsuccess = async function () {
......
...@@ -27,11 +27,31 @@ const displayFields = async (parentID) => { ...@@ -27,11 +27,31 @@ const displayFields = async (parentID) => {
clearFields(parentID) // make sure input fields are clear clearFields(parentID) // make sure input fields are clear
await fetchSchema() await fetchSchema();
console.log(schema);
createDocTypeDropdown('DocType', div, schema) createDocTypeDropdown('DocType', div, schema)
createSection('Section', div) createSection('Section', div)
/* Object.keys(schema).forEach(function(key) {
let doctypes = schema[key];
const { valid, error } = validateSchema(key)
if(!valid){
div.textContent = error
div.style.color = '#ff3333'
}
for (let key in doctypes) {
if (doctypes.hasOwnProperty(key)) {
console.log(key + ": " + doctypes[key]); //sections on doctypes
let section = doctypes[key];
console.log(section);
div = deconstruct(section, div, key)
}
}
});*/
const { ACCOUNTING_DOCUMENTS } = schema const { ACCOUNTING_DOCUMENTS } = schema
//getDocType = DOC_TYPE1 ; //getDocType = DOC_TYPE1 ;
...@@ -51,10 +71,6 @@ const displayFields = async (parentID) => { ...@@ -51,10 +71,6 @@ const displayFields = async (parentID) => {
const { SECTION3 } = HR_FILES const { SECTION3 } = HR_FILES
div = deconstruct(SECTION3, div, 'SECTION3') div = deconstruct(SECTION3, div, 'SECTION3')
if(!valid){
div.textContent = error
div.style.color = '#ff3333'
}
const submit = document.createElement('input') const submit = document.createElement('input')
submit.classList.add("submitButtons"); submit.classList.add("submitButtons");
...@@ -221,6 +237,7 @@ const inputString = (key, validation) => { ...@@ -221,6 +237,7 @@ const inputString = (key, validation) => {
let input = document.createElement('input') let input = document.createElement('input')
input.setAttribute('id', `${key}`) input.setAttribute('id', `${key}`)
input.setAttribute('name', `${key}`)
input.setAttribute('type', 'text') input.setAttribute('type', 'text')
input.setAttribute('autocomplete', 'off') input.setAttribute('autocomplete', 'off')
input.addEventListener('focusout', handleInput) input.addEventListener('focusout', handleInput)
...@@ -283,6 +300,7 @@ const inputNumeric = (key, validation) => { ...@@ -283,6 +300,7 @@ const inputNumeric = (key, validation) => {
const input = document.createElement('input') const input = document.createElement('input')
input.setAttribute('id', `${key}`) input.setAttribute('id', `${key}`)
input.setAttribute('name', `${key}`)
input.setAttribute('type', 'text') input.setAttribute('type', 'text')
input.setAttribute('autocomplete', 'off') input.setAttribute('autocomplete', 'off')
input.setAttribute('pattern', '[0-9/-]+') input.setAttribute('pattern', '[0-9/-]+')
...@@ -313,6 +331,7 @@ const inputDate = (key, validation) => { ...@@ -313,6 +331,7 @@ const inputDate = (key, validation) => {
const input = document.createElement('input') const input = document.createElement('input')
input.setAttribute('id', `${key}`) input.setAttribute('id', `${key}`)
input.setAttribute('name', `${key}`)
input.setAttribute('type', 'date') input.setAttribute('type', 'date')
input.addEventListener('focusout', handleInput) input.addEventListener('focusout', handleInput)
...@@ -339,6 +358,7 @@ const inputDropdown = (key, validation) => { ...@@ -339,6 +358,7 @@ const inputDropdown = (key, validation) => {
const { mandatory, options } = validation const { mandatory, options } = validation
const input = document.createElement('select') const input = document.createElement('select')
input.setAttribute('id', `${key}`) input.setAttribute('id', `${key}`)
input.setAttribute('name', `${key}`)
input.classList.add('dropdown-input') input.classList.add('dropdown-input')
input.addEventListener('focusout', handleInput) input.addEventListener('focusout', handleInput)
...@@ -607,22 +627,23 @@ const createSection = (fieldLabel, div) => { ...@@ -607,22 +627,23 @@ const createSection = (fieldLabel, div) => {
} }
function saveForm(index){ function saveForm(index){
const form = document.querySelector("#fields");
const inputs = form.querySelectorAll("input,textarea");
const values = {};
let formValues = { inputs.forEach(input => {
name : document.getElementById("Name").value, if(input.value != ''){
subject : document.getElementById("Subject").value, values[input.name] = input.value;
docNo : document.getElementById("Document_No").value,
date : document.getElementById("Date").value,
accountNo : document.getElementById("Account_No").value,
empNo : document.getElementById("Employee_No").value,
} }
});
index--; index--;
var formArray = JSON.parse(sessionStorage.getItem('formArray')); var formArray = JSON.parse(sessionStorage.getItem('formArray'));
//formArray.push(formValues); //formArray.push(formValues);
if(typeof formArray[index] !== 'undefined') { if(typeof formArray[index] !== 'undefined') {
formArray.splice(index, 1, formValues) formArray.splice(index, 1, values)
} else { } else {
formArray.splice(index, 0, formValues) formArray.splice(index, 0, values)
} }
sessionStorage.setItem('formArray', JSON.stringify(formArray)); sessionStorage.setItem('formArray', JSON.stringify(formArray));
...@@ -637,36 +658,13 @@ function populateForm(index){ ...@@ -637,36 +658,13 @@ function populateForm(index){
var formArray = JSON.parse(sessionStorage.getItem('formArray')); var formArray = JSON.parse(sessionStorage.getItem('formArray'));
var name = document.getElementById("Name"); if (formArray[index] != null) {
var subject = document.getElementById("Subject"); var currForm = formArray[index];
var docNo = document.getElementById("Document_No"); for (let field in currForm) {
var date = document.getElementById("Date"); document.getElementById(field).value = currForm[field];
var accountNo = document.getElementById("Account_No");
var empNo = document.getElementById("Employee_No");
if (formArray[index].name != null) {
name.value = formArray[index].name;
}
if (formArray[index].subject != null) {
subject.value = formArray[index].subject;
}
if (formArray[index].docNo != null) {
docNo.value = formArray[index].docNo;
} }
if (formArray[index].date != null) {
date.value = formArray[index].date;
} }
if (formArray[index].accountNo != null) {
accountNo.value = formArray[index].accountNo;
}
if (formArray[index].empNo != null) {
empNo.value = formArray[index].empNo;
}
} }
\ No newline at end of file
...@@ -182,8 +182,6 @@ function initHighlight() { ...@@ -182,8 +182,6 @@ function initHighlight() {
//waits until TIFF image is loaded, since its size is based on the displayed TIFF image //waits until TIFF image is loaded, since its size is based on the displayed TIFF image
const observer = new MutationObserver(function (mutations, mutationInstance) { const observer = new MutationObserver(function (mutations, mutationInstance) {
console.log(sessionStorage.getItem("TiffViewer_current"));
var TIFFimg = document.getElementById(sessionStorage.getItem("TiffViewer_current")); var TIFFimg = document.getElementById(sessionStorage.getItem("TiffViewer_current"));
if (TIFFimg != null) { if (TIFFimg != null) {
//waits until width and height has been assigned //waits until width and height has been assigned
......
...@@ -316,29 +316,30 @@ function TIFFViewer(xhr, TiffViewerImageName) { ...@@ -316,29 +316,30 @@ function TIFFViewer(xhr, TiffViewerImageName) {
document.getElementById('TestTIFFDisplay').src = tiff.toCanvas().toDataURL(); document.getElementById('TestTIFFDisplay').src = tiff.toCanvas().toDataURL();
//creating blank image containers for each page and setting TIFF data as image source //creating blank image containers for each page and setting TIFF data as image source
for (var i = 0; i < TiffViewer_pages; ++i) { for (var i = 1; i <= TiffViewer_pages; i++) {
var img = document.createElement('img'); var img = document.createElement('img');
img.id = `IMG${i + 1}`; img.id = `IMG${i}`;
if (i != 0) { if (i != 1) {
img.style.display = "none"; img.style.display = "none";
wzoom[TiffViewer_current - 1] = changedwidth; /*ADDED: to fit large TIFF files*/ wzoom[TiffViewer_current - 1] = changedwidth; /*ADDED: to fit large TIFF files*/
hzoom[TiffViewer_current - 1] = changedheight; hzoom[TiffViewer_current - 1] = changedheight;
Edited(); Edited();
} }
img.classList.add("TiffViewer_imgclass");
document.getElementById('TiffViewer_ImageContainer').append(img); document.getElementById('TiffViewer_ImageContainer').append(img);
tiff.setDirectory(i); img.classList.add("TiffViewer_imgclass");
tiff.setDirectory(i - 1);
var canvas = tiff.toCanvas().toDataURL(); var canvas = tiff.toCanvas().toDataURL();
document.getElementById(`IMG${i + 1}`).src = canvas; document.getElementById(`IMG${i}`).src = canvas;
} }
//setting the style per page //setting the style per page
for (var j = 1; j <= TiffViewer_pages; ++j) { for (var j = 1; j <= TiffViewer_pages; j++) {
var img = document.getElementById("IMG" + j); var img = document.getElementById("IMG" + j);
getMeta(canvas, function (width, height) { getMeta(canvas, function (width, height) {
wzoom[TiffViewer_current - 1] = changedwidth; /*ADDED: to fit large TIFF files*/ wzoom[TiffViewer_current - 1] = changedwidth; /*ADDED: to fit large TIFF files*/
hzoom[TiffViewer_current - 1] = changedheight; hzoom[TiffViewer_current - 1] = changedheight;
Edited(); origheight = height; Edited();
origheight = height;
origwidth = width; origwidth = width;
setwidth = width; setwidth = width;
setheight = height; setheight = height;
...@@ -360,18 +361,23 @@ function TIFFViewer(xhr, TiffViewerImageName) { ...@@ -360,18 +361,23 @@ function TIFFViewer(xhr, TiffViewerImageName) {
} else if (setheight > 800 && setwidth <= 1000) { } else if (setheight > 800 && setwidth <= 1000) {
img.style = "width: 800;"; img.style = "width: 800;";
changed = true; changed = true;
} } else{
img.style = `width: {setwidth}; height: {setheight}`;
if(setheight < 800 && setwidth < 1000){
changed = true; changed = true;
} }
if (changed) { if (changed) {
if(TiffViewer_pages > 1){
hpercent = (parseInt(setheight, 10) * (10 / 100));
wpercent = (parseInt(setwidth, 10) * (10 / 100));
}
setwidth = parseInt(img.style.width, 10); setwidth = parseInt(img.style.width, 10);
setheight = parseInt(img.style.height, 10); setheight = parseInt(img.style.height, 10);
document.getElementById("TiffViewer_FitButton").style.display = "inherit"; document.getElementById("TiffViewer_FitButton").style.display = "inherit";
} }
changedheight = setheight; changedheight = setheight;
changedwidth = setwidth; changedwidth = setwidth;
hpercent = (parseInt(setheight, 10) * (10 / 100)); hpercent = (parseInt(setheight, 10) * (10 / 100));
...@@ -393,6 +399,12 @@ function TIFFViewer(xhr, TiffViewerImageName) { ...@@ -393,6 +399,12 @@ function TIFFViewer(xhr, TiffViewerImageName) {
} }
if(TiffViewer_pages > 1){
for (var j = 1; j <= TiffViewer_pages; j++) {
var img = document.getElementById("IMG" + j).style.display = "none";
}
}
//getting the metadata of each TIFF page //getting the metadata of each TIFF page
function getMeta(url, callback) { function getMeta(url, callback) {
...@@ -792,6 +804,3 @@ function TIFFViewer(xhr, TiffViewerImageName) { ...@@ -792,6 +804,3 @@ function TIFFViewer(xhr, TiffViewerImageName) {
initHighlight(); initHighlight();
} }
...@@ -85,8 +85,7 @@ button:hover{ ...@@ -85,8 +85,7 @@ button:hover{
padding: 0; padding: 0;
left: 0; left: 0;
top: 0; top: 0;
position: relative; /* position: relative; */
overflow-y: hidden;
overflow-x: hidden; overflow-x: hidden;
} }
...@@ -161,7 +160,7 @@ button:hover{ ...@@ -161,7 +160,7 @@ button:hover{
flex: 1; flex: 1;
max-height: 100vh; max-height: 100vh;
display: inline-block; display: inline-block;
overflow-y: scroll; overflow-y: auto;
} }
#fields>div { #fields>div {
......
...@@ -141,7 +141,7 @@ public class GDEWebServices { ...@@ -141,7 +141,7 @@ public class GDEWebServices {
@POST @POST
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Path("/write-mertrics") @Path("/write-metrics")
public Response writeCSVMetrics(JsonObject jsonObject) { public Response writeCSVMetrics(JsonObject jsonObject) {
SimpleDateFormat isoFormat = new SimpleDateFormat("MM-dd-yyyy"); SimpleDateFormat isoFormat = new SimpleDateFormat("MM-dd-yyyy");
......
...@@ -2,12 +2,12 @@ package com.svi.webgde.restservice.utils; ...@@ -2,12 +2,12 @@ package com.svi.webgde.restservice.utils;
import java.io.IOException; import java.io.IOException;
import java.io.StringReader; import java.io.StringReader;
import java.io.StringWriter;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.DocumentBuilderFactory;
...@@ -133,6 +133,37 @@ public class XMLUtil { ...@@ -133,6 +133,37 @@ public class XMLUtil {
document.getElementsByTagName("proc_duration").item(0).setTextContent( document.getElementsByTagName("proc_duration").item(0).setTextContent(
String.valueOf(Double.valueOf(xmlLastProcDuration) + Double.valueOf(xml.getProcDuration()))); String.valueOf(Double.valueOf(xmlLastProcDuration) + Double.valueOf(xml.getProcDuration())));
Map<String, Integer> imagenames = new HashMap<>();
for (int i = 0; i < document.getElementsByTagName("imagename").getLength(); i++) {
imagenames.put(document.getElementsByTagName("imagename").item(i).getTextContent(), i);
}
if (imagenames.containsKey(xml.getImageName())) {
Node imagename = document.getElementsByTagName("imagename").item(imagenames.get(xml.getImageName()));
Node xmlSubRecord = imagename.getParentNode().getLastChild().getPreviousSibling();
// xml.getFields().forEach((key, value) -> {
for (Map.Entry<String, String> entry : xml.getFields().entrySet()) {
for (int i = 0; i < xmlSubRecord.getChildNodes().getLength(); i++) {
String key = entry.getKey();
String value = entry.getValue();
if (xmlSubRecord.getChildNodes().item(i).getNodeType() == Node.ELEMENT_NODE) {
if (xmlSubRecord.getChildNodes().item(i).getAttributes().getNamedItem("no").getNodeValue()
.equals(key)) {
for (int j = 0; j < xmlSubRecord.getChildNodes().item(i).getChildNodes().getLength(); j++) {
if (xmlSubRecord.getChildNodes().item(i).getChildNodes().item(j)
.getNodeType() == Node.ELEMENT_NODE) {
xmlSubRecord.getChildNodes().item(i).getChildNodes().item(j).setTextContent(value);
}
}
}
}
}
}
// });
} else {
NodeList xmlRecords = document.getElementsByTagName("record"); NodeList xmlRecords = document.getElementsByTagName("record");
Node xmlLastRecord = xmlRecords.item(xmlRecords.getLength() - 1); Node xmlLastRecord = xmlRecords.item(xmlRecords.getLength() - 1);
String lastRecordNo = xmlLastRecord.getAttributes().getNamedItem("no").getNodeValue(); String lastRecordNo = xmlLastRecord.getAttributes().getNamedItem("no").getNodeValue();
...@@ -169,6 +200,7 @@ public class XMLUtil { ...@@ -169,6 +200,7 @@ public class XMLUtil {
xmlRecord.appendChild(xmlSubRecord); xmlRecord.appendChild(xmlSubRecord);
root.appendChild(xmlRecord); root.appendChild(xmlRecord);
}
TransformerFactory transformerFactory = TransformerFactory.newInstance(); TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer(); Transformer transformer = transformerFactory.newTransformer();
...@@ -228,7 +260,7 @@ public class XMLUtil { ...@@ -228,7 +260,7 @@ public class XMLUtil {
} }
public static void updateExceptionRmrk(XMLContents xml) public static void updateExceptionRmrk(XMLContents xml)
throws ParserConfigurationException,SAXException, IOException, TransformerException { throws ParserConfigurationException, SAXException, IOException, TransformerException {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder(); DocumentBuilder builder = factory.newDocumentBuilder();
...@@ -250,5 +282,4 @@ public class XMLUtil { ...@@ -250,5 +282,4 @@ public class XMLUtil {
} }
} }
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