Commit d6146918 by Owen Ryan Ang

Merge branch 'feature-WG-401' into 'development-mobile'

Feature wg 401 See merge request !70
parents 8cdc3cb5 338281c3
......@@ -1163,6 +1163,7 @@ const inputFileUpload = (key, validation) => {
// Add an event listener to handle when a file is selected
input.addEventListener('change', (event) => {
const file = event.target.files[0];
console.log(file)
if (file) {
// Create hidden inputs for fname and file content
......@@ -1256,30 +1257,38 @@ const inputFileUpload = (key, validation) => {
}
}
else {
// Display the filename only for unsupported file types
filename.textContent = file.name;
filename.style.display = 'inline';
document.getElementById(`${key}_buttonsContainer-video`).style.display = 'none';
x.style.display = 'block';
x.style.position = 'absolute';
// Set the hidden inputs for filename and empty file content
hiddenFnameInput.value = file.name;
hiddenFnameInput.display = '';
hiddenFileContentInput.value = ''; // Empty content for unsupported file types
hiddenFileContentInput.display = '';
// Remove the file on 'x' click
document.getElementById(`${key}_x`).addEventListener('click', () => {
filename.style.display = 'none';
document.getElementById(`${key}_buttonsContainer-video`).style.display = 'flex';
input.value = '';
x.style.display = 'none';
// Clear the hidden fields
container2.removeChild(hiddenFnameInput);
container2.removeChild(hiddenFileContentInput);
});
const reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = (e) => {
// Display the filename only for unsupported file types
const fileInput = document.getElementById(`${key}_attachedMedia`);
const fullPath = fileInput.value;
console.log(fileInput);
// const filename = fullPath.split('\\').pop().split('/').pop();
filename.textContent = fullPath.split('\\').pop().split('/').pop();
filename.style.display = 'inline';
document.getElementById(`${key}_buttonsContainer-video`).style.display = 'none';
x.style.display = 'block';
x.style.position = 'absolute';
// Set the hidden inputs for filename and empty file content
hiddenFnameInput.value = fullPath.split('\\').pop().split('/').pop();
hiddenFnameInput.display = '';
hiddenFileContentInput.value = e.target.result;
hiddenFileContentInput.display = '';
// Remove the file on 'x' click
document.getElementById(`${key}_x`).addEventListener('click', () => {
filename.style.display = 'none';
document.getElementById(`${key}_buttonsContainer-video`).style.display = 'flex';
input.value = '';
x.style.display = 'none';
// Clear the hidden fields
container2.removeChild(hiddenFnameInput);
container2.removeChild(hiddenFileContentInput);
});
}
}
}
});
......
import { createRejectWindow } from '../BPO/rejectElement.js';
import { createReturnWindow } from '../BPO/returnElement.js';
import { submitForm } from '../Submit/submit.js';
import { completeToNextNode, submitForm } from '../Submit/submit.js';
import { IS_RETRIEVE_FROM_BPO, ROOT_FOLDER } from '../config.js';
import { createInfoModal } from '../genericPopup/genericPopup.js';
import { BPO_OBJECT, DISPLAY_FIELD_OBJECT, DOCUMENT_CONTROL_OBJECT, IMAGE_VIEWER_OBJECT, INDEXED_DB_STORAGE } from '../globalVariable.js';
......@@ -79,6 +79,9 @@ export class DocumentControlWidget {
if (isSuccessful) {
DISPLAY_FIELD_OBJECT.clearForm();
createInfoModal(null, 'ok', 'Form Submitted.');
if (IS_RETRIEVE_FROM_BPO === "Y"){
let response = await completeToNextNode(sessionStorage.getItem("element_id"));
}
}
}
......
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