Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
web-ui
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
WEBGDE-Components
web-ui
Commits
d6146918
Commit
d6146918
authored
Oct 09, 2023
by
Owen Ryan Ang
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature-WG-401' into 'development-mobile'
Feature wg 401 See merge request
!70
parents
8cdc3cb5
338281c3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
25 deletions
+37
-25
generateFields.js
...bContent/WebGde-Widgets/DataInputWidget/generateFields.js
+33
-24
documentControlWidget.js
...de-Widgets/documentControlWidget/documentControlWidget.js
+4
-1
No files found.
WebGde/WebContent/WebGde-Widgets/DataInputWidget/generateFields.js
View file @
d6146918
...
...
@@ -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);
});
}
}
}
});
...
...
WebGde/WebContent/WebGde-Widgets/documentControlWidget/documentControlWidget.js
View file @
d6146918
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"
));
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment