Commit 0f97c7f1 by Owen Ryan Ang

image capture validation bug fix

parent f45a70f2
......@@ -42,6 +42,7 @@ export function processFingerprint(key, filename) {
thumb.style.display = 'none';
x.style.display = 'none';
filenameElement.style.display = 'none';
filenameElement.textContent = '';
document.getElementById(`${key}_buttonsContainer-video`).style.display = 'flex';
// Clear the hidden fields
......
......@@ -43,6 +43,7 @@ export function processCapture(key, imgFilename) {
thumb.style.display = 'none';
x.style.display = 'none';
filename.style.display = 'none';
filename.textContent = '';
document.getElementById(`${key}_buttonsContainer-video`).style.display = 'flex';
// Clear the hidden fields
......
......@@ -39,6 +39,7 @@ export function processVideoCapture(key, videoFilename){
thumb.style.display = 'none';
x.style.display = 'none';
filename.style.display = 'none';
filename.textContent = '';
document.getElementById(`${key}_buttonsContainer-video`).style.display = 'flex';
// Clear the hidden fields
......
......@@ -546,6 +546,7 @@ const inputImageCapture = (key, validation) => {
x.style.display = 'none';
input.value = ''
filename.style.display = 'none';
filename.textContent = '';
document.getElementById(`${key}_buttonsContainer-video`).style.display = 'flex';
// Clear the hidden fields
......@@ -581,6 +582,7 @@ const inputImageCapture = (key, validation) => {
x.style.display = 'none';
filename.style.display = 'none';
filename.textContent = '';
document.getElementById(`${key}_buttonsContainer-video`).style.display = 'flex';
input.value = ''
......@@ -634,6 +636,12 @@ const inputImageCapture = (key, validation) => {
img.setAttribute('id', `${key}_zz`);
img.setAttribute('style', 'display: none');
img.addEventListener('load', function() {
// Image loaded successfully, handle it as valid
// You can add your logic to handle a valid image here
container2.classList.remove('input-invalid');
container2.classList.add('input-valid');
});
const filename = document.createElement('span');
filename.setAttribute('id', `${key}_fname`);
......@@ -751,6 +759,7 @@ const inputVideoCapture = (key, validation) => {
x.style.display = 'none';
input.value = ''
filename.style.display = 'none';
filename.textContent = '';
document.getElementById(`${key}_buttonsContainer-video`).style.display = 'flex';
// Clear the hidden fields
......@@ -786,6 +795,7 @@ const inputVideoCapture = (key, validation) => {
x.style.display = 'none';
filename.style.display = 'none';
filename.textContent = '';
document.getElementById(`${key}_buttonsContainer-video`).style.display = 'flex';
input.value = ''
......@@ -839,6 +849,12 @@ const inputVideoCapture = (key, validation) => {
img.setAttribute('id', `${key}_zz`);
img.setAttribute('style', 'display: none');
img.addEventListener('load', function() {
// Image loaded successfully, handle it as valid
// You can add your logic to handle a valid image here
container2.classList.remove('input-invalid');
container2.classList.add('input-valid');
});
const filename = document.createElement('span');
filename.setAttribute('id', `${key}_fname`);
......@@ -956,6 +972,7 @@ const inputFingerprintCapture = (key, validation) => {
x.style.display = 'none';
input.value = ''
filename.style.display = 'none';
filename.textContent = '';
document.getElementById(`${key}_buttonsContainer-video`).style.display = 'flex';
// Clear the hidden fields
......@@ -991,6 +1008,7 @@ const inputFingerprintCapture = (key, validation) => {
x.style.display = 'none';
filename.style.display = 'none';
filename.textContent = '';
document.getElementById(`${key}_buttonsContainer-video`).style.display = 'flex';
input.value = ''
......@@ -1030,6 +1048,12 @@ const inputFingerprintCapture = (key, validation) => {
img.setAttribute('id', `${key}_zz`);
img.setAttribute('style', 'display: none');
img.addEventListener('load', function() {
// Image loaded successfully, handle it as valid
// You can add your logic to handle a valid image here
container2.classList.remove('input-invalid');
container2.classList.add('input-valid');
});
const filename = document.createElement('span');
filename.setAttribute('id', `${key}_fname`);
......@@ -1239,6 +1263,7 @@ const inputFileUpload = (key, validation) => {
x.style.display = 'none';
input.value = ''
filename.style.display = 'none';
filename.textContent = '';
document.getElementById(`${key}_buttonsContainer-video`).style.display = 'flex';
// Clear the hidden fields
......@@ -1276,6 +1301,7 @@ const inputFileUpload = (key, validation) => {
x.style.display = 'none';
filename.style.display = 'none';
filename.textContent = '';
document.getElementById(`${key}_buttonsContainer-video`).style.display = 'flex';
input.value = ''
......@@ -1309,6 +1335,7 @@ const inputFileUpload = (key, validation) => {
// Remove the file on 'x' click
document.getElementById(`${key}_x`).addEventListener('click', () => {
filename.style.display = 'none';
filename.textContent = '';
document.getElementById(`${key}_buttonsContainer-video`).style.display = 'flex';
input.value = '';
x.style.display = 'none';
......@@ -1345,6 +1372,12 @@ const inputFileUpload = (key, validation) => {
img.setAttribute('id', `${key}_zz`);
img.setAttribute('style', 'display: none');
img.addEventListener('load', function() {
// Image loaded successfully, handle it as valid
// You can add your logic to handle a valid image here
container2.classList.remove('input-invalid');
container2.classList.add('input-valid');
});
const filename = document.createElement('span');
filename.setAttribute('id', `${key}_fname`);
......
......@@ -304,7 +304,8 @@ const validateMedia = (validation, fieldID) => {
const { mandatory } = validation
const inputElement = document.getElementById(`${fieldID}_attachedMedia`);
if (mandatory && inputElement.files.length === 0) {
const inputFilename = document.getElementById(`${fieldID}_fname`);
if (mandatory && inputElement.files.length === 0 && inputFilename.textContent.trim() === '') {
errors = [...errors, 'No File Attached!']
}
return {
......
......@@ -21,7 +21,7 @@ export const IS_RETRIEVE_FROM_GFS = "N"
export const INVALID_KEYS = "F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,F11,F12,PrintScreen,ScrollLock,Pause,PageUp,PageDown,Insert,Delete,Control"
//BPO CONFIG
export const IS_RETRIEVE_FROM_BPO = "Y"
export const IS_RETRIEVE_FROM_BPO = "N"
// export const BPO_URL = "http://35.171.20.94:8080/bpo-sqa/"
// export const CURRENT_NODE = "Web GDE"
export let BPO_URL = DOMAIN + "bpo/";
......@@ -30,7 +30,7 @@ export let CURRENT_NODE = ""
export const ENCODING_PASS = "PASS1"
export const NEXT_NODE = "Complete"
export const EXCEPTION_NODE = "Exception"
export const SHOW_ELEMENT_LIST_VIEWER = "Y"
export const SHOW_ELEMENT_LIST_VIEWER = "N"
export const ADD_NEW_OPTION = "N"
export const PDF_EXTENSION = ".pdf"
......
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