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 @@
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<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>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
......
......@@ -34,4 +34,15 @@
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</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>
eclipse.preferences.version=1
org.eclipse.jdt.apt.aptEnabled=false
......@@ -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.forbiddenReference=warning
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.source=1.8
<?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-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="/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="context-root" value="WebGde"/>
</wb-module>
</wb-module>
</project-modules>
......@@ -10,7 +10,45 @@ async function rejectElement() {
},
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();
init();
alert("Element Rejected");
......@@ -206,6 +244,27 @@ function createButtonElem(className, buttonName, icon) {
function saveExceptionToXml(){
var selected = document.querySelector('input[name="rejectRadio"]:checked').value;
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 = {
"projCode": PROJECT_CODE,
......@@ -227,8 +286,8 @@ function saveExceptionToXml(){
"eor": "",
"fields": {},
"outputDir": sessionStorage.getItem("element_file_loc") + "/" + (ENCODING_PASS == "PASS1" ? elementId + ".DTA" : elementId + ".DTB"),
"doctype": "",
"section": ""
"doctype": doctype,
"section": section
}
updateXMLException(xmlData);
......@@ -280,7 +339,7 @@ async function updateXMLException(xmlData){
body: JSON.stringify(xmlData)
});
if (response.status == 200) {
alert("Exception Updated");
console.log("Exception Updated");
}
else{
alert(`Error ${response.status}: Xml Update`);
......
......@@ -3,6 +3,44 @@ async function returnElementBPO(elementId) {
if (response.status == 200) {
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();
init();
alert('Element Returned');
......
......@@ -3,23 +3,16 @@ var File_Path;
var gfsFileName;
async function accessFile() {
var button = 0;
var size = 0;
let file_url = [];
const elStatus = document.getElementById('status');
function status(text) {
elStatus.innerHTML = text;
}
const progressBar = document.getElementById('progressBar');
const elProgress = document.getElementById('progress');
function progress({ loaded, total }) {
// elProgress.innerHTML = Math.round(loaded * .000001) + " mb of " + Math.round(total * .000001);
progressBar.value = Math.round(loaded / total * 100);
}
const indexedDB =
window.indexedDB ||
window.mozIndexedDB ||
......@@ -43,14 +36,6 @@ async function accessFile() {
const store = db.createObjectStore("image", { keyPath: "id" });
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) {
const request = indexedDB.open("ImageDatabase", 1);
......
......@@ -27,12 +27,32 @@ const displayFields = async (parentID) => {
clearFields(parentID) // make sure input fields are clear
await fetchSchema()
createDocTypeDropdown('DocType', div, schema)
await fetchSchema();
console.log(schema);
createDocTypeDropdown('DocType', div, schema)
createSection('Section', div)
const { ACCOUNTING_DOCUMENTS } = schema
/* 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
//getDocType = DOC_TYPE1 ;
......@@ -51,10 +71,6 @@ const displayFields = async (parentID) => {
const { SECTION3 } = HR_FILES
div = deconstruct(SECTION3, div, 'SECTION3')
if(!valid){
div.textContent = error
div.style.color = '#ff3333'
}
const submit = document.createElement('input')
submit.classList.add("submitButtons");
......@@ -221,6 +237,7 @@ const inputString = (key, validation) => {
let input = document.createElement('input')
input.setAttribute('id', `${key}`)
input.setAttribute('name', `${key}`)
input.setAttribute('type', 'text')
input.setAttribute('autocomplete', 'off')
input.addEventListener('focusout', handleInput)
......@@ -283,6 +300,7 @@ const inputNumeric = (key, validation) => {
const input = document.createElement('input')
input.setAttribute('id', `${key}`)
input.setAttribute('name', `${key}`)
input.setAttribute('type', 'text')
input.setAttribute('autocomplete', 'off')
input.setAttribute('pattern', '[0-9/-]+')
......@@ -313,6 +331,7 @@ const inputDate = (key, validation) => {
const input = document.createElement('input')
input.setAttribute('id', `${key}`)
input.setAttribute('name', `${key}`)
input.setAttribute('type', 'date')
input.addEventListener('focusout', handleInput)
......@@ -339,6 +358,7 @@ const inputDropdown = (key, validation) => {
const { mandatory, options } = validation
const input = document.createElement('select')
input.setAttribute('id', `${key}`)
input.setAttribute('name', `${key}`)
input.classList.add('dropdown-input')
input.addEventListener('focusout', handleInput)
......@@ -607,22 +627,23 @@ const createSection = (fieldLabel, div) => {
}
function saveForm(index){
const form = document.querySelector("#fields");
const inputs = form.querySelectorAll("input,textarea");
const values = {};
inputs.forEach(input => {
if(input.value != ''){
values[input.name] = input.value;
}
});
let formValues = {
name : document.getElementById("Name").value,
subject : document.getElementById("Subject").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--;
var formArray = JSON.parse(sessionStorage.getItem('formArray'));
//formArray.push(formValues);
if(typeof formArray[index] !== 'undefined') {
formArray.splice(index, 1, formValues)
formArray.splice(index, 1, values)
} else {
formArray.splice(index, 0, formValues)
formArray.splice(index, 0, values)
}
sessionStorage.setItem('formArray', JSON.stringify(formArray));
......@@ -637,36 +658,13 @@ function populateForm(index){
var formArray = JSON.parse(sessionStorage.getItem('formArray'));
var name = document.getElementById("Name");
var subject = document.getElementById("Subject");
var docNo = document.getElementById("Document_No");
var date = document.getElementById("Date");
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;
if (formArray[index] != null) {
var currForm = formArray[index];
for (let field in currForm) {
document.getElementById(field).value = currForm[field];
}
}
}
\ No newline at end of file
......@@ -182,8 +182,6 @@ function initHighlight() {
//waits until TIFF image is loaded, since its size is based on the displayed TIFF image
const observer = new MutationObserver(function (mutations, mutationInstance) {
console.log(sessionStorage.getItem("TiffViewer_current"));
var TIFFimg = document.getElementById(sessionStorage.getItem("TiffViewer_current"));
if (TIFFimg != null) {
//waits until width and height has been assigned
......
......@@ -316,29 +316,30 @@ function TIFFViewer(xhr, TiffViewerImageName) {
document.getElementById('TestTIFFDisplay').src = tiff.toCanvas().toDataURL();
//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');
img.id = `IMG${i + 1}`;
if (i != 0) {
img.id = `IMG${i}`;
if (i != 1) {
img.style.display = "none";
wzoom[TiffViewer_current - 1] = changedwidth; /*ADDED: to fit large TIFF files*/
hzoom[TiffViewer_current - 1] = changedheight;
Edited();
}
img.classList.add("TiffViewer_imgclass");
document.getElementById('TiffViewer_ImageContainer').append(img);
tiff.setDirectory(i);
img.classList.add("TiffViewer_imgclass");
tiff.setDirectory(i - 1);
var canvas = tiff.toCanvas().toDataURL();
document.getElementById(`IMG${i + 1}`).src = canvas;
document.getElementById(`IMG${i}`).src = canvas;
}
//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);
getMeta(canvas, function (width, height) {
wzoom[TiffViewer_current - 1] = changedwidth; /*ADDED: to fit large TIFF files*/
hzoom[TiffViewer_current - 1] = changedheight;
Edited(); origheight = height;
Edited();
origheight = height;
origwidth = width;
setwidth = width;
setheight = height;
......@@ -360,18 +361,23 @@ function TIFFViewer(xhr, TiffViewerImageName) {
} else if (setheight > 800 && setwidth <= 1000) {
img.style = "width: 800;";
changed = true;
}
if(setheight < 800 && setwidth < 1000){
changed = true;
}
} else{
img.style = `width: {setwidth}; height: {setheight}`;
changed = true;
}
if (changed) {
setwidth = parseInt(img.style.width, 10);
setheight = parseInt(img.style.height, 10);
if(TiffViewer_pages > 1){
hpercent = (parseInt(setheight, 10) * (10 / 100));
wpercent = (parseInt(setwidth, 10) * (10 / 100));
}
setwidth = parseInt(img.style.width, 10);
setheight = parseInt(img.style.height, 10);
document.getElementById("TiffViewer_FitButton").style.display = "inherit";
}
changedheight = setheight;
changedwidth = setwidth;
hpercent = (parseInt(setheight, 10) * (10 / 100));
......@@ -392,7 +398,13 @@ 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
function getMeta(url, callback) {
......@@ -791,7 +803,4 @@ function TIFFViewer(xhr, TiffViewerImageName) {
});
initHighlight();
}
......@@ -3,4 +3,4 @@ const validateSchema = () => {
if(!ACCOUNTING_DOCUMENTS) return { valid: false, error: 'SECTION is missing!' }
return { valid: true }
}
\ No newline at end of file
}
......@@ -85,8 +85,7 @@ button:hover{
padding: 0;
left: 0;
top: 0;
position: relative;
overflow-y: hidden;
/* position: relative; */
overflow-x: hidden;
}
......@@ -161,7 +160,7 @@ button:hover{
flex: 1;
max-height: 100vh;
display: inline-block;
overflow-y: scroll;
overflow-y: auto;
}
#fields>div {
......
......@@ -141,7 +141,7 @@ public class GDEWebServices {
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@Path("/write-mertrics")
@Path("/write-metrics")
public Response writeCSVMetrics(JsonObject jsonObject) {
SimpleDateFormat isoFormat = new SimpleDateFormat("MM-dd-yyyy");
......
......@@ -2,12 +2,12 @@ package com.svi.webgde.restservice.utils;
import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
......@@ -95,7 +95,7 @@ public class XMLUtil {
Result result = new StreamResult(xml.getOutputDir());
transformer.transform(source, result);
return new String(Files.readAllBytes(Paths.get(xml.getOutputDir())));
}
......@@ -133,42 +133,74 @@ public class XMLUtil {
document.getElementsByTagName("proc_duration").item(0).setTextContent(
String.valueOf(Double.valueOf(xmlLastProcDuration) + Double.valueOf(xml.getProcDuration())));
NodeList xmlRecords = document.getElementsByTagName("record");
Node xmlLastRecord = xmlRecords.item(xmlRecords.getLength() - 1);
String lastRecordNo = xmlLastRecord.getAttributes().getNamedItem("no").getNodeValue();
Element xmlRecord = document.createElement("record");
xmlRecord.setAttribute("no", String.valueOf(Integer.valueOf(lastRecordNo) + 1));
xmlRecord.setAttribute("total_subrec", String.valueOf(xml.getTotalSubRec()));
xmlRecord.setAttribute("max_subrec", String.valueOf(xml.getMaxSubRec()));
Element imagename = document.createElement("imagename");
imagename.appendChild(document.createTextNode(xml.getImageName()));
Element doctype = document.createElement("doctype");
doctype.appendChild(document.createTextNode(xml.getDoctype()));
Element section = document.createElement("section");
section.appendChild(document.createTextNode(xml.getSection()));
xmlRecord.appendChild(imagename);
xmlRecord.appendChild(doctype);
xmlRecord.appendChild(section);
Element xmlSubRecord = document.createElement("sub-record");
xmlSubRecord.setAttribute("no", String.valueOf(Integer.valueOf(xml.getSubRecordNo())));
xmlSubRecord.setAttribute("eor", String.valueOf(xml.getEor()));
xml.getFields().forEach((key, value) -> {
Element xmlField = document.createElement("field");
Element valueField = document.createElement("value");
valueField.appendChild(document.createTextNode(value));
xmlField.setAttribute("no", key);
xmlField.appendChild(valueField);
xmlSubRecord.appendChild(xmlField);
});
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);
}
xmlRecord.appendChild(xmlSubRecord);
root.appendChild(xmlRecord);
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");
Node xmlLastRecord = xmlRecords.item(xmlRecords.getLength() - 1);
String lastRecordNo = xmlLastRecord.getAttributes().getNamedItem("no").getNodeValue();
Element xmlRecord = document.createElement("record");
xmlRecord.setAttribute("no", String.valueOf(Integer.valueOf(lastRecordNo) + 1));
xmlRecord.setAttribute("total_subrec", String.valueOf(xml.getTotalSubRec()));
xmlRecord.setAttribute("max_subrec", String.valueOf(xml.getMaxSubRec()));
Element imagename = document.createElement("imagename");
imagename.appendChild(document.createTextNode(xml.getImageName()));
Element doctype = document.createElement("doctype");
doctype.appendChild(document.createTextNode(xml.getDoctype()));
Element section = document.createElement("section");
section.appendChild(document.createTextNode(xml.getSection()));
xmlRecord.appendChild(imagename);
xmlRecord.appendChild(doctype);
xmlRecord.appendChild(section);
Element xmlSubRecord = document.createElement("sub-record");
xmlSubRecord.setAttribute("no", String.valueOf(Integer.valueOf(xml.getSubRecordNo())));
xmlSubRecord.setAttribute("eor", String.valueOf(xml.getEor()));
xml.getFields().forEach((key, value) -> {
Element xmlField = document.createElement("field");
Element valueField = document.createElement("value");
valueField.appendChild(document.createTextNode(value));
xmlField.setAttribute("no", key);
xmlField.appendChild(valueField);
xmlSubRecord.appendChild(xmlField);
});
xmlRecord.appendChild(xmlSubRecord);
root.appendChild(xmlRecord);
}
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer();
......@@ -226,10 +258,10 @@ public class XMLUtil {
StreamResult result = new StreamResult(xml.getOutputDir());
transformer.transform(source, result);
}
public static void updateExceptionRmrk(XMLContents xml)
throws ParserConfigurationException,SAXException, IOException, TransformerException {
public static void updateExceptionRmrk(XMLContents xml)
throws ParserConfigurationException, SAXException, IOException, TransformerException {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse(xml.getOutputDir());
......@@ -247,8 +279,7 @@ public class XMLUtil {
DOMSource source = new DOMSource(document);
StreamResult result = new StreamResult(xml.getOutputDir());
transformer.transform(source, result);
}
}
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