Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Register
Sign in
Toggle navigation
Menu
UPSMF
uphrh-smf-web
Commits
41ffa7fe
Commit
41ffa7fe
authored
3 years ago
by
Shoaib
Browse files
Options
Download
Patches
Plain Diff
Issue fixing in progress.
parent
9113a6d8
master
accept_file_type
cards-value-changes
delete-form
delete-user
form-issue
inspector-model
label-change
No related merge requests found
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
src/components/common/Header.tsx
+1
-1
src/components/common/Header.tsx
src/components/form/AddForm.js
+3
-1
src/components/form/AddForm.js
src/components/form/FormViewer.js
+45
-19
src/components/form/FormViewer.js
src/components/form/ListForms.js
+2
-2
src/components/form/ListForms.js
src/components/form/MyApplications.js
+9
-8
src/components/form/MyApplications.js
src/components/form/MyForms.js
+4
-3
src/components/form/MyForms.js
with
64 additions
and
34 deletions
+64
-34
src/components/common/Header.tsx
+
1
−
1
View file @
41ffa7fe
...
...
@@ -95,7 +95,7 @@ class Header extends Component<LoginProps, LoginState> {
</
li
>
{
Helper
.
getUserRole
()
===
APP
.
ROLE
.
INSTITUTION
&&
(
<
li
className
=
"mr-5"
>
<
Link
to
=
{
"
/applications
"
}
className
=
{
`
${
this
.
props
.
history
.
location
.
pathname
.
match
(
"
/
my-
applications
"
)
<
Link
to
=
{
"
/applications
"
}
className
=
{
`
${
this
.
props
.
history
.
location
.
pathname
.
match
(
"
/applications
"
)
?
"
active
"
:
""
}
`
}
>
MY APPLICATIONS
</
Link
>
...
...
This diff is collapsed.
Click to expand it.
src/components/form/AddForm.js
+
3
−
1
View file @
41ffa7fe
...
...
@@ -29,6 +29,7 @@ class AddForm extends Component {
this
.
state
=
{
language
:
"
en
"
,
formElements
:
[],
formTitle
:
""
,
formDetails
:
{
id
:
""
,
version
:
""
,
...
...
@@ -59,6 +60,7 @@ class AddForm extends Component {
if
(
response
.
statusInfo
.
statusCode
===
APP
.
CODE
.
SUCCESS
)
{
this
.
setState
({
formDetails
:
response
.
responseData
,
formTitle
:
response
.
responseData
.
title
});
document
.
getElementById
(
"
id
"
).
value
=
response
.
responseData
.
id
;
document
.
getElementById
(
"
version
"
).
value
=
...
...
@@ -255,7 +257,7 @@ class AddForm extends Component {
arrow_forward_ios
<
/i
>
<
span
className
=
"
ml-4
"
>
{
this
.
state
.
form
Details
.
t
itle
.
toUpperCase
()}
{
this
.
state
.
form
T
itle
.
toUpperCase
()}
<
/span
>
<
i
className
=
"
material-icons white-70 absolute
"
>
arrow_forward_ios
...
...
This diff is collapsed.
Click to expand it.
src/components/form/FormViewer.js
+
45
−
19
View file @
41ffa7fe
...
...
@@ -32,7 +32,8 @@ class FormViewer extends Component {
this
.
saveFields
=
this
.
saveFields
.
bind
(
this
);
this
.
populateForm
=
this
.
populateForm
.
bind
(
this
);
this
.
populateData
=
this
.
populateData
.
bind
(
this
);
this
.
validationPassed
=
this
.
validationPassed
.
bind
(
true
);
this
.
populateData
=
this
.
populateData
.
bind
(
this
);
this
.
disableFormElements
=
this
.
disableFormElements
.
bind
(
true
);
this
.
submitForm
=
this
.
submitForm
.
bind
(
this
);
}
...
...
@@ -148,11 +149,11 @@ class FormViewer extends Component {
);
};
populateData
=
()
=>
{
populateData
=
()
=>
{
// Code for files starts
var
fileElements
=
document
.
getElementsByClassName
(
"
custom-file-display
"
);
for
(
let
ele1
=
0
;
ele1
<
fileElements
.
length
;
ele1
++
)
{
fileElements
[
ele1
].
innerHTML
=
""
fileElements
[
ele1
].
innerHTML
=
""
;
fileElements
[
ele1
].
style
.
display
=
"
none
"
;
}
var
fileElements
=
document
.
getElementsByClassName
(
"
form-control-file
"
);
...
...
@@ -165,6 +166,7 @@ class FormViewer extends Component {
// console.log(this.state.formFields);
for
(
var
key
of
Object
.
keys
(
fields
))
{
var
element
=
document
.
getElementsByName
(
key
);
if
(
element
.
length
>
0
)
{
if
(
element
[
0
].
type
===
"
checkbox
"
||
element
[
0
].
type
===
"
radio
"
)
{
var
len
=
element
.
length
;
...
...
@@ -189,17 +191,19 @@ class FormViewer extends Component {
element
[
0
].
setAttribute
(
"
path
"
,
fields
[
key
]);
element
.
innerHTML
=
""
;
// alert();
if
(
fields
[
key
]
!==
""
)
{
let
temp
=
fields
[
key
].
split
(
"
,
"
);
var
keyIndex
=
key
.
split
(
"
_
"
);
for
(
let
l
=
0
;
l
<
temp
.
length
;
l
++
)
{
var
element
=
document
.
getElementById
(
"
files-list-
"
+
keyIndex
[
1
]);
for
(
let
l
=
0
;
l
<
temp
.
length
;
l
++
)
{
var
element
=
document
.
getElementById
(
"
files-list-
"
+
keyIndex
[
1
]
);
element
.
style
.
display
=
"
block
"
;
element
.
innerHTML
+=
'
<div class="col-12 file-item">
\
<span>
'
+
temp
[
l
]
+
temp
[
l
]
+
'
</span>
\
<span
\
class="cross"
\
...
...
@@ -212,22 +216,44 @@ class FormViewer extends Component {
}
}
}
if
(
this
.
props
.
match
.
params
.
applicationId
!==
null
&&
this
.
props
.
match
.
params
.
applicationId
!==
undefined
)
{
this
.
disableFormElements
();
}
};
disableFormElements
=
()
=>
{
let
fields
=
this
.
state
.
formFields
;
for
(
let
key
of
Object
.
keys
(
fields
))
{
console
.
log
(
key
);
let
element
=
document
.
getElementById
(
key
.
replace
(
"
_
"
,
"
-
"
));
if
(
element
)
element
.
disabled
=
true
;
}
document
.
querySelector
(
'
.file-item .cross
'
).
style
.
display
=
"
none
"
;
};
validationPassed
=
()
=>
{
let
flag
=
true
;
let
fields
=
this
.
state
.
formFieldGroups
[
this
.
state
.
headingIndex
];
for
(
let
i
=
0
;
i
<
fields
.
length
;
i
++
)
{
// console.log("field_" + fields[i].order);
if
(
this
.
state
.
formFields
[
"
field_
"
+
fields
[
i
].
order
]
===
""
&&
fields
[
i
].
isRequired
)
{
flag
=
false
;
if
(
this
.
props
.
match
.
params
.
applicationId
===
null
||
this
.
props
.
match
.
params
.
applicationId
===
undefined
)
{
let
fields
=
this
.
state
.
formFieldGroups
[
this
.
state
.
headingIndex
];
for
(
let
i
=
0
;
i
<
fields
.
length
;
i
++
)
{
// console.log("field_" + fields[i].order);
if
(
this
.
state
.
formFields
[
"
field_
"
+
fields
[
i
].
order
]
===
""
&&
fields
[
i
].
isRequired
)
{
flag
=
false
;
}
}
if
(
!
flag
)
{
Notify
.
error
(
"
Please fill all required fields.
"
);
}
}
if
(
!
flag
)
{
Notify
.
error
(
"
Please fill all required fields.
"
);
}
return
flag
;
};
...
...
@@ -446,7 +472,7 @@ class FormViewer extends Component {
this
.
populateData
();
},
100
);
}
}
else
if
(
(
i
!==
this
.
state
.
headingIndex
)
)
{
}
else
if
(
i
!==
this
.
state
.
headingIndex
)
{
this
.
setState
({
headingIndex
:
i
});
setTimeout
(()
=>
{
this
.
populateData
();
...
...
This diff is collapsed.
Click to expand it.
src/components/form/ListForms.js
+
2
−
2
View file @
41ffa7fe
...
...
@@ -136,7 +136,7 @@ class ListForms extends Component {
<
tr
>
<
th
scope
=
"
col
"
>
Form
name
<
/th
>
<
th
scope
=
"
col
"
>
Status
<
/th
>
<
th
scope
=
"
col
"
>
Published
/
created
on
<
/th
>
{
/*
<th scope="col">Published/created on</th>
*/
}
<
th
scope
=
"
col
"
><
/th
>
<
th
scope
=
"
col
"
><
/th
>
<
/tr
>
...
...
@@ -148,7 +148,7 @@ class ListForms extends Component {
{
form
.
title
}
<
/th
>
<
td
>
Published
<
/td
>
<
td
><
/td
>
{
/*
<td></td>
*/
}
<
td
className
=
"
td-preview
"
>
<
Link
to
=
{
`/forms/
${
form
.
id
}
`
}
>
Preview
<
/Link
>
<
/td
>
...
...
This diff is collapsed.
Click to expand it.
src/components/form/MyApplications.js
+
9
−
8
View file @
41ffa7fe
...
...
@@ -12,6 +12,7 @@ class ListMyApplications extends Component {
this
.
state
=
{
forms
:
[],
};
this
.
searchApplications
=
this
.
searchApplications
.
bind
(
this
);
}
formatDate
(
dateParam
)
{
...
...
@@ -44,19 +45,19 @@ class ListMyApplications extends Component {
);
}
search
Form
s
=
(
event
)
=>
{
search
Application
s
=
(
event
)
=>
{
var
input
,
filter
,
formContainer
,
formItems
,
a
,
i
,
txtValue
;
input
=
event
.
target
.
value
;
filter
=
input
.
toUpperCase
();
formContainer
=
document
.
getElementById
(
"
forms-container
"
);
formItems
=
formContainer
.
getElementsByClassName
(
"
form
-item
"
);
formItems
=
formContainer
.
getElementsByClassName
(
"
application
-item
"
);
for
(
i
=
0
;
i
<
formItems
.
length
;
i
++
)
{
a
=
formItems
[
i
].
getElementsByClassName
(
"
form-title
"
)[
0
];
txtValue
=
a
.
textContent
||
a
.
innerText
;
if
(
txtValue
.
toUpperCase
().
indexOf
(
filter
)
>
-
1
)
{
formItems
[
i
].
style
.
display
=
""
;
formItems
[
i
].
parentNode
.
style
.
display
=
""
;
}
else
{
formItems
[
i
].
style
.
display
=
"
none
"
;
formItems
[
i
].
parentNode
.
style
.
display
=
"
none
"
;
}
}
};
...
...
@@ -89,7 +90,7 @@ class ListMyApplications extends Component {
)}
<
/div
>
<
/div
>
{
/*
<div className="row mt-4 mb-4">
<
div
className
=
"
row mt-4 mb-4
"
>
<
div
className
=
"
col-md-12
"
>
<
div
className
=
"
row
"
>
<
div
className
=
"
col-md-3
"
>
...
...
@@ -103,13 +104,13 @@ class ListMyApplications extends Component {
id
=
"
search-roles
"
placeholder
=
"
Search for an application
"
autoComplete
=
"
off
"
onKeyUp={(event) => this.search
Form
s(event)}
onKeyUp
=
{(
event
)
=>
this
.
search
Application
s
(
event
)}
/
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
</div>
*/
}
<
/div
>
<
div
className
=
"
row
"
id
=
"
forms-container
"
>
{
this
.
state
.
forms
.
map
((
form
,
key
)
=>
(
<
div
className
=
"
col-md-4 col-sm-12 col-12 mb-3
"
key
=
{
key
}
>
...
...
@@ -117,7 +118,7 @@ class ListMyApplications extends Component {
className
=
"
application-item white-bg
"
style
=
{{
minHeight
:
"
150px
"
}}
>
<
h3
className
=
""
>
{
form
.
title
}
<
/h3
>
<
h3
className
=
"
form-title
"
>
{
form
.
title
}
<
/h3
>
<
span
className
=
"
h3-subheading d-block black-60 mb-2
"
>
Submitted
on
:{
"
"
}
{
this
.
formatDate
(
`
${
form
.
createdDate
}
`
||
"
2022-01-01
"
)}
...
...
This diff is collapsed.
Click to expand it.
src/components/form/MyForms.js
+
4
−
3
View file @
41ffa7fe
...
...
@@ -12,6 +12,7 @@ class MyForms extends Component {
this
.
state
=
{
forms
:
[],
};
this
.
searchForms
=
this
.
searchForms
.
bind
(
this
);
}
componentDidMount
()
{
...
...
@@ -43,9 +44,9 @@ class MyForms extends Component {
a
=
formItems
[
i
].
getElementsByClassName
(
"
form-title
"
)[
0
];
txtValue
=
a
.
textContent
||
a
.
innerText
;
if
(
txtValue
.
toUpperCase
().
indexOf
(
filter
)
>
-
1
)
{
formItems
[
i
].
style
.
display
=
""
;
formItems
[
i
].
parentNode
.
style
.
display
=
""
;
}
else
{
formItems
[
i
].
style
.
display
=
"
none
"
;
formItems
[
i
].
parentNode
.
style
.
display
=
"
none
"
;
}
}
};
...
...
@@ -90,7 +91,7 @@ class MyForms extends Component {
type
=
"
text
"
className
=
"
form-control
"
id
=
"
search-roles
"
placeholder
=
"
Search for a
n application
"
placeholder
=
"
Search for a
form
"
autoComplete
=
"
off
"
onKeyUp
=
{(
event
)
=>
this
.
searchForms
(
event
)}
/
>
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets