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
eaf8a8fa
Commit
eaf8a8fa
authored
3 years ago
by
Shoaib
Browse files
Options
Download
Patches
Plain Diff
Roles integrated.
parent
9997f045
master
accept_file_type
cards-value-changes
delete-form
delete-user
form-issue
inspector-model
label-change
No related merge requests found
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
public/css/new.css
+81
-4
public/css/new.css
public/index.html
+3
-3
public/index.html
src/components/common/Header.tsx
+6
-5
src/components/common/Header.tsx
src/components/dashboard/Dashboard.js
+164
-68
src/components/dashboard/Dashboard.js
src/components/form/AddForm.js
+35
-15
src/components/form/AddForm.js
src/components/form/FormViewer.js
+59
-2
src/components/form/FormViewer.js
src/components/form/ListForms.js
+40
-8
src/components/form/ListForms.js
src/components/form/elements/Field.js
+3
-3
src/components/form/elements/Field.js
src/components/form/elements/Heading.js
+3
-3
src/components/form/elements/Heading.js
src/components/login/Login.tsx
+1
-0
src/components/login/Login.tsx
src/constants/ApiConstants.ts
+1
-0
src/constants/ApiConstants.ts
src/constants/AppConstants.ts
+4
-0
src/constants/AppConstants.ts
src/helpers/auth.js
+6
-1
src/helpers/auth.js
src/helpers/authHeader.js
+2
-2
src/helpers/authHeader.js
src/services/form.service.js
+15
-1
src/services/form.service.js
with
423 additions
and
115 deletions
+423
-115
public/css/new.css
+
81
−
4
View file @
eaf8a8fa
...
...
@@ -60,7 +60,7 @@ h2 {
font-size
:
20px
!important
;
letter-spacing
:
0.12px
!important
;
font-weight
:
600
!important
;
font-family
:
'Montserrat'
'Lato-Bold'
;
font-family
:
'Montserrat''Lato-Bold'
;
}
.h2-subheading
{
...
...
@@ -76,7 +76,7 @@ h3 {
font-size
:
16px
!important
;
letter-spacing
:
0.12
!important
;
font-weight
:
600
!important
;
font-family
:
'Montserrat'
'Lato-Bold'
;
font-family
:
'Montserrat''Lato-Bold'
;
}
.h3-subheading
{
...
...
@@ -87,6 +87,11 @@ h3 {
font-family
:
'Lato'
;
}
.activity-item
.h3-subheading
{
color
:
var
(
--black-87
);
font-weight
:
500
;
}
.dashboard-inner-container
{
min-height
:
100px
;
}
...
...
@@ -105,6 +110,18 @@ h3 {
min-width
:
87px
;
}
.btn.smf-btn-default-inverse
{
color
:
#fff
!important
;
background-color
:
var
(
--primary-color
)
!important
;
border
:
solid
1px
var
(
--primary-color
)
!important
;
font-size
:
14px
!important
;
letter-spacing
:
0.5px
!important
;
font-weight
:
700
!important
;
/* height: 48px; */
min-width
:
87px
;
}
.btn.smf-btn-primary
{
background-color
:
var
(
--primary-color
)
!important
;
color
:
#fff
;
...
...
@@ -123,6 +140,32 @@ h3 {
padding
:
20px
!important
;
}
.dashboard-form-item
{
border
:
solid
1px
RGBA
(
0
,
0
,
0
,
0.08
);
box-shadow
:
3px
3px
4px
0px
RGBA
(
0
,
0
,
0
,
0.04
);
border-radius
:
4px
;
padding
:
20px
!important
;
background-color
:
#fff
;
}
.form-item-button
{
border
:
solid
1px
RGBA
(
0
,
0
,
0
,
0.08
);
font-size
:
12px
;
color
:
RGB
(
29
,
137
,
35
);
border-radius
:
22px
10px
10px
22px
;
background-color
:
solid
1px
RGBA
(
0
,
0
,
0
,
0.04
);
padding
:
2px
12px
;
}
.activity-item
{
border
:
solid
1px
RGBA
(
0
,
0
,
0
,
0.08
);
box-shadow
:
3px
3px
4px
0px
RGBA
(
0
,
0
,
0
,
0.04
);
border-radius
:
4px
;
padding
:
20px
!important
;
background-color
:
#fff
;
height
:
100px
;
}
.smf-btn-default.highlighted
{
border
:
solid
2px
var
(
--primary-color
)
!important
;
padding-left
:
20px
;
...
...
@@ -187,7 +230,10 @@ a[data-toggle="collapse"] {
right
:
20px
;
transform
:
translateY
(
-50%
);
}
a
,
a
:hover
,
a
:focus
{
a
,
a
:hover
,
a
:focus
{
color
:
inherit
;
text-decoration
:
none
;
transition
:
all
0.3s
;
...
...
@@ -222,16 +268,20 @@ a, a:hover, a:focus {
font-size
:
14px
;
font-family
:
'Lato'
;
}
#sidebar
ul
li
a
:hover
{
/* color: var(--menu-active-color); */
background
:
var
(
--menu-active-color
);
border-left
:
4px
solid
var
(
--primary-color
);
}
#sidebar
ul
li
.active
>
a
,
a
[
aria-expanded
=
"true"
]
{
#sidebar
ul
li
.active
>
a
,
a
[
aria-expanded
=
"true"
]
{
color
:
var
(
--black-87
);
background
:
var
(
--menu-active-color
);
border-left
:
4px
solid
var
(
--primary-color
);
}
ul
ul
a
{
font-size
:
0.9em
!important
;
padding-left
:
30px
!important
;
...
...
@@ -241,6 +291,7 @@ ul ul a {
.d-none-imp
{
display
:
none
!important
;
}
.d-block-imp
{
display
:
block
!important
;
}
...
...
@@ -258,7 +309,33 @@ a:-webkit-any-link {
#sidebar
{
margin-left
:
-250px
;
}
#sidebar
.active
{
margin-left
:
0
;
}
}
@media
(
min-width
:
768px
)
and
(
max-width
:
1200px
)
{
.activity-item
{
height
:
120px
;
}
}
.borderless
{
border
:
none
!important
;
border-top-style
:
none
!important
;
border-bottom-style
:
none
!important
;
}
.table-smf
>
:not
(
caption
)>*>*
{
padding
:
1rem
0.5rem
!important
;
}
.td-preview
{
color
:
var
(
--primary-color
)
!important
;
font-weight
:
700
!important
;
}
.card-body-heading
{
background-color
:
RGBA
(
0
,
0
,
0
,
0.12
);
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
public/index.html
+
3
−
3
View file @
eaf8a8fa
...
...
@@ -6,8 +6,8 @@
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
/>
<meta
name=
"theme-color"
content=
"#000000"
/>
<meta
name=
"
description
"
content=
"
Dashboards powered by RAIN Analytics Platform
"
name=
"
SMF
"
content=
"
Online application submittion
"
/>
<!--
...
...
@@ -37,7 +37,7 @@
<link
rel=
"stylesheet"
href=
"/css/main.css"
/>
<link
rel=
"stylesheet"
href=
"/css/new.css"
/>
<title>
Tarento |
SMF
SMF
</title>
</head>
...
...
This diff is collapsed.
Click to expand it.
src/components/common/Header.tsx
+
6
−
5
View file @
eaf8a8fa
...
...
@@ -2,6 +2,8 @@ import React, { Component, Fragment } from "react";
import
Auth
from
"
../../helpers/auth
"
;
import
{
Link
}
from
"
react-router-dom
"
;
import
{
UserService
}
from
"
../../services/user.service
"
;
import
{
APP
}
from
"
../../constants
"
;
import
Helper
from
"
../../helpers/auth
"
;
/**
* Header component
...
...
@@ -23,7 +25,7 @@ class Header extends Component<LoginProps, LoginState> {
}
getUserInitials
(
userName
:
string
)
{
console
.
log
(
'
userName:
'
,
userName
)
//
console.log('userName: ', userName)
if
(
userName
)
{
const
userNameArr
=
userName
.
split
(
'
.
'
).
slice
(
0
,
2
)
return
userNameArr
.
map
((
u
)
=>
u
[
0
]).
join
(
''
).
toUpperCase
()
...
...
@@ -92,15 +94,14 @@ class Header extends Component<LoginProps, LoginState> {
:
""
}
`
}
>
HOME
</
Link
>
</
li
>
<
li
className
=
"mr-5"
>
<
Link
to
=
{
"
/dashboard
"
}
className
=
""
>
MY APPLICATIONS
</
Link
>
</
li
>
{
Helper
.
getUserRole
()
!==
APP
.
ROLE
.
INSTITUTE
&&
(
<
li
className
=
"mr-5"
>
<
Link
to
=
{
"
/forms
"
}
className
=
{
`
${
this
.
props
.
history
.
location
.
pathname
.
match
(
"
/forms
"
)
?
"
active
"
:
""
}
`
}
>
APPLICATIONS
</
Link
>
}
`
}
>
MANAGE
</
Link
>
</
li
>
)
}
</
ul
>
</
div
>
</
div
>
...
...
This diff is collapsed.
Click to expand it.
src/components/dashboard/Dashboard.js
+
164
−
68
View file @
eaf8a8fa
...
...
@@ -4,6 +4,7 @@ import { Link } from "react-router-dom";
import
{
FormService
}
from
"
../../services/form.service
"
;
import
{
APP
}
from
"
../../constants
"
;
import
Notify
from
"
../../helpers/notify
"
;
import
Helper
from
"
../../helpers/auth
"
;
/**
* Dashboard component
...
...
@@ -19,90 +20,185 @@ class Dashboard extends Component {
}
componentDidMount
()
{
FormService
.
get
().
then
(
(
response
)
=>
{
if
(
response
.
statusInfo
.
statusCode
===
APP
.
CODE
.
SUCCESS
)
{
this
.
setState
({
forms
:
response
.
responseData
,
});
// console.log(response.responseData);
}
else
{
Notify
.
error
(
response
.
statusInfo
.
errorMessage
);
// console.log(Helper.getUserRole());
if
(
Helper
.
getUserRole
()
===
APP
.
ROLE
.
INSTITUTE
)
{
FormService
.
get
().
then
(
(
response
)
=>
{
if
(
response
.
statusInfo
.
statusCode
===
APP
.
CODE
.
SUCCESS
)
{
this
.
setState
({
forms
:
response
.
responseData
,
});
// console.log(response.responseData);
}
else
{
Notify
.
error
(
response
.
statusInfo
.
errorMessage
);
}
},
(
error
)
=>
{
error
.
statusInfo
?
Notify
.
error
(
error
.
statusInfo
.
errorMessage
)
:
Notify
.
error
(
error
.
message
);
}
},
(
error
)
=>
{
error
.
statusInfo
?
Notify
.
error
(
error
.
statusInfo
.
errorMessage
)
:
Notify
.
error
(
error
.
message
);
}
);
);
}
}
render
()
{
return
(
<
Fragment
>
<
Header
history
=
{
this
.
props
.
history
}
/
>
<
div
className
=
"
container-fluid main-container
"
>
<
div
className
=
"
container dashboard-inner-container
"
>
<
div
className
=
"
row
"
>
<
div
className
=
"
col-md-8 col-sm-12 col-12 pt-5
"
>
<
h2
>
My
applications
<
/h2
>
<
p
className
=
"
h2-subheading
"
>
There
is
no
active
applications
.
Select
one
from
the
below
list
to
apply
.
<
/p
>
{
Helper
.
getUserRole
()
===
APP
.
ROLE
.
INSTITUTE
&&
(
<
Fragment
>
<
div
className
=
"
container-fluid main-container
"
>
<
div
className
=
"
container dashboard-inner-container
"
>
<
div
className
=
"
row
"
>
<
div
className
=
"
col-md-8 col-sm-12 col-12 pt-5
"
>
<
h2
>
My
applications
<
/h2
>
<
p
className
=
"
h2-subheading
"
>
There
is
no
active
applications
.
Select
one
from
the
below
list
to
apply
.
<
/p
>
<
/div
>
<
div
className
=
"
col-md-4 col-sm-12 col-12
"
><
/div
>
<
/div
>
<
/div
>
<
div
className
=
"
col-md-4 col-sm-12 col-12
"
><
/div
>
<
/div
>
<
/div
>
<
/div
>
<
div
className
=
"
container-fluid bottom-container
"
>
<
div
className
=
"
container dashboard-inner-container
"
>
<
div
className
=
"
row
"
>
<
div
className
=
"
col-md-10 col-sm-12 col-12 pt-5
"
>
<
h2
>
Available
applications
<
/h2
>
<
p
className
=
"
h2-subheading
"
>
These
are
the
available
appplication
forms
for
you
apply
.
Click
on
any
of
them
to
start
filling
<
/p
>
<
/div
>
<
div
className
=
"
col-md-2 col-sm-12 col-12 pt-5
"
>
<
button
className
=
"
btn btn-default smf-btn-default float-right
"
>
SEE
ALL
<
/button
>
<
div
className
=
"
container-fluid bottom-container
"
>
<
div
className
=
"
container dashboard-inner-container
"
>
<
div
className
=
"
row
"
>
<
div
className
=
"
col-md-10 col-sm-12 col-12 pt-5
"
>
<
h2
>
Available
forms
<
/h2
>
<
p
className
=
"
h2-subheading
"
>
These
are
the
available
appplication
forms
for
you
apply
.
Click
on
any
of
them
to
start
filling
<
/p
>
<
/div
>
<
div
className
=
"
col-md-2 col-sm-12 col-12 pt-5
"
>
<
button
className
=
"
btn btn-default smf-btn-default float-right
"
>
SEE
ALL
<
/button
>
<
/div
>
<
/div
>
<
div
className
=
"
row mt-3
"
>
{
this
.
state
.
forms
.
splice
(
0
,
6
).
map
((
form
,
key
)
=>
(
<
div
className
=
"
col-md-4 mb-4 col-sm-12 col-12
"
key
=
{
key
}
>
<
div
className
=
"
application-item
"
style
=
{{
minHeight
:
"
150px
"
}}
>
<
h3
className
=
""
>
{
form
.
title
}
<
/h3
>
<
p
className
=
"
h3-subheading
"
>
{
form
.
description
!=
null
?
form
.
description
:
"
Application form
"
}
<
/p
>
<
Link
to
=
{
"
/forms/
"
+
form
.
id
}
className
=
"
btn btn-default smf-btn-default highlighted mt-3
"
>
Apply
<
/Link
>
<
/div
>
<
/div
>
))}
<
/div
>
<
/div
>
<
/div
>
<
div
className
=
"
row mt-3
"
>
{
this
.
state
.
forms
.
splice
(
0
,
6
).
map
((
form
,
key
)
=>
(
<
div
className
=
"
col-md-4 mb-4 col-sm-12 col-12
"
key
=
{
key
}
>
<
div
className
=
"
application-item
"
style
=
{{
minHeight
:
"
150px
"
}}
>
<
h3
className
=
""
>
{
form
.
title
}
<
/h3
>
<
p
className
=
"
h3-subheading
"
>
{
form
.
description
!=
null
?
form
.
description
:
'
Application form
'
}
<
/p
>
<
Link
to
=
{
"
/forms/
"
+
form
.
id
}
className
=
"
btn btn-default smf-btn-default highlighted mt-3
"
>
Apply
<
/Link
>
<
/Fragment
>
)}
{
Helper
.
getUserRole
()
===
APP
.
ROLE
.
REGULATOR
&&
(
<
Fragment
>
<
div
className
=
"
container-fluid
"
>
<
div
className
=
"
container dashboard-inner-container
"
>
<
div
className
=
"
row pt-5
"
>
<
div
className
=
"
col-md-12 col-sm-12 col-12 mb-3
"
>
<
h2
>
Your
activity
<
/h2
>
<
/div
>
<
div
className
=
"
col-md-2 col-sm-4 col-6 mb-3
"
>
<
div
className
=
"
activity-item
"
>
<
h2
className
=
""
>
12
<
/h2
>
<
p
className
=
"
h3-subheading mt-4
"
>
Total
pending
<
/p
>
<
/div
>
<
/div
>
))}
{
/* <div className="col-md-4 col-sm-12 col-12">
<div className="application-item">
<h3 className="">Application name</h3>
<p className="h3-subheading">In oculis quidem rerum necessitatibus saepe eveniet, ut et via.</p>
<button className="btn btn-default smf-btn-default highlighted mt-3">Apply</button>
<
/div
>
<
div
className
=
"
col-md-2 col-sm-4 col-6 mb-3
"
>
<
div
className
=
"
activity-item
"
>
<
h2
className
=
""
>
8
<
/h2
>
<
p
className
=
"
h3-subheading mt-4
"
>
Recieved
today
<
/p
>
<
/div
>
<
/div
>
<
div
className
=
"
col-md-2 col-sm-4 col-6 mb-3
"
>
<
div
className
=
"
activity-item
"
>
<
h2
className
=
""
>
4
<
/h2
>
<
p
className
=
"
h3-subheading mt-4
"
>
Pending
from
past
<
/p
>
<
/div
>
<
/div
>
<
div
className
=
"
col-md-2 col-sm-4 col-6 mb-3
"
>
<
div
className
=
"
activity-item
"
>
<
h2
className
=
""
>
7
<
/h2
>
<
p
className
=
"
h3-subheading mt-4
"
>
Total
pending
<
/p
>
<
/div
>
<
/div
>
<
div
className
=
"
col-md-2 col-sm-4 col-6 mb-3
"
>
<
div
className
=
"
activity-item
"
>
<
h2
className
=
""
>
3
<
/h2
>
<
p
className
=
"
h3-subheading mt-4
"
>
In
progress
<
/p
>
<
/div
>
<
/div
>
<
div
className
=
"
col-md-2 col-sm-4 col-6 mb-3
"
>
<
div
className
=
"
activity-item
"
>
<
h2
className
=
""
>
12
<
/h2
>
<
p
className
=
"
h3-subheading mt-4
"
>
Reviewed
in
total
<
/p
>
<
/div
>
<
/div
>
<
/div
>
<
/div
>
<div className="col-md-4 col-sm-12 col-12">
<div className="application-item">
<h3 className="">Application name</h3>
<p className="h3-subheading">In oculis quidem rerum necessitatibus saepe eveniet, ut et via.</p>
<button className="btn btn-default smf-btn-default highlighted mt-3">Apply</button>
<
/div
>
<
div
className
=
"
container-fluid main-container
"
>
<
div
className
=
"
container dashboard-inner-container
"
>
<
div
className
=
"
row pt-5
"
>
<
div
className
=
"
col-md-10 col-sm-10 col-10
"
>
<
h2
>
Pending
applications
<
/h2
>
<
p
className
=
"
h2-subheading
"
>
These
are
the
latest
applications
which
are
pending
for
your
review
/
approval
.
<
/p
>
<
/div
>
<
div
className
=
"
col-md-2 col-sm-2 col-2
"
>
<
button
className
=
"
btn btn-default smf-btn-default float-right
"
>
SEE
ALL
<
/button
>
<
/div
>
<
/div
>
<
div
className
=
"
row mt-3 pb-5
"
>
{[
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
].
map
((
item
,
key
)
=>
{
return
(
<
div
className
=
"
col-md-3 col-sm-6 col-12 mb-3
"
key
=
{
key
}
>
<
div
className
=
"
dashboard-form-item
"
>
<
h3
className
=
""
>
Form
{
item
}
<
/h3
>
<
p
className
=
"
h3-subheading
"
>
<
b
>
Collage
name
<
/b
>
<
br
/>
Recieved
on
:
dd
/
mm
/
yyy
.
<
/p
>
<
div
>
<
button
className
=
"
form-item-button
"
>
Status
:
New
<
/button
>
<
/div
>
<
div
className
=
"
mt-3
"
>
<
button
className
=
"
btn btn-default smf-btn-default highlighted mt-2
"
>
View
application
<
/button
>
<
/div
>
<
/div
>
<
/div
>
);
})}
<
/div
>
</div>
*/
}
<
/div
>
<
/div
>
<
/
div
>
<
/div
>
<
/
Fragment
>
)}
<
/Fragment
>
);
}
...
...
This diff is collapsed.
Click to expand it.
src/components/form/AddForm.js
+
35
−
15
View file @
eaf8a8fa
...
...
@@ -230,9 +230,15 @@ class AddForm extends Component {
<
div
className
=
"
row col-md-12
"
>
<
div
className
=
"
row col-md-12 mt-5
"
>
<
div
className
=
"
col-9
"
>
<
Link
to
=
"
/
admin/
forms
"
className
=
"
formAnchor white-70
"
>
<
Link
to
=
"
/forms
"
className
=
"
formAnchor white-70
"
>
MANAGE
<
/Link>{" "
}
<>
<
i
className
=
"
material-icons white-70 absolute
"
>
arrow_forward_ios
<
/i
>
<
span
className
=
"
ml-4
"
>
FORMS
<
/span
>
<
/
>
{
!
this
.
props
.
match
.
params
.
id
&&
(
<>
<
i
className
=
"
material-icons white-70 absolute
"
>
...
...
@@ -246,25 +252,35 @@ class AddForm extends Component {
<
i
className
=
"
material-icons white-70 absolute
"
>
arrow_forward_ios
<
/i
>
<
span
className
=
"
white-70 button-text
"
>
<
span
className
=
"
ml-4
"
>
{
this
.
state
.
formDetails
.
title
.
toUpperCase
()}
<
/span
>
<
i
className
=
"
material-icons white-70 absolute
"
>
arrow_forward_ios
<
/i
>
<
span
className
=
"
white-90 button-text
"
>
EDIT
<
/span
>
<
span
className
=
"
ml-4
"
>
EDIT
<
/span
>
<
/
>
)}
<
/div
>
<
div
className
=
"
col-3
"
>
<
button
onClick
=
{
this
.
submit
}
type
=
"
button
"
id
=
"
submit
"
className
=
"
btn btn-default smf-btn-default pull-right
"
>
Save
Changes
<
/button
>
<
div
className
=
"
pull-right
"
>
<
button
onClick
=
{(
e
)
=>
this
.
props
.
history
.
push
(
"
/forms
"
)}
type
=
"
button
"
id
=
"
submit
"
className
=
"
btn btn-default smf-btn-default
"
>
Cancel
<
/button
>
<
button
onClick
=
{
this
.
submit
}
type
=
"
button
"
id
=
"
submit
"
className
=
"
btn btn-default smf-btn-default-inverse
"
>
Save
Changes
<
/button
>
<
/div
>
<
/div
>
<
/div
>
<
div
className
=
"
row col-md-12
"
>
...
...
@@ -293,7 +309,9 @@ class AddForm extends Component {
<
div
className
=
"
row
"
>
<
div
className
=
"
col-md-6
"
>
<
div
className
=
"
form-group
"
>
<
label
htmlFor
=
"
field-name
"
>
Application
heading
<
/label
>
<
label
htmlFor
=
"
field-name
"
>
Application
heading
<
/label
>
<
input
type
=
"
text
"
id
=
"
title
"
...
...
@@ -311,7 +329,9 @@ class AddForm extends Component {
<
div
className
=
"
row
"
>
<
div
className
=
"
col-md-6
"
>
<
div
className
=
"
form-group
"
>
<
label
htmlFor
=
"
field-name
"
>
Application
description
<
/label
>
<
label
htmlFor
=
"
field-name
"
>
Application
description
<
/label
>
<
textarea
id
=
"
description
"
name
=
"
description
"
...
...
@@ -387,7 +407,7 @@ class AddForm extends Component {
>
<
button
className
=
"
btn btn-default smf-btn-default
"
>
{
/* <i className="material-icons absolute">title</i> */
}
<
span
className
=
"
button-text
"
>
Add
section
<
/span
>
Add
section
<
/button
>
<
/div
>
<
div
...
...
@@ -396,7 +416,7 @@ class AddForm extends Component {
>
<
button
className
=
"
btn btn-default smf-btn-default pull-right
"
>
{
/* <i className="material-icons absolute">add</i> */
}
<
span
className
=
"
button-text
"
>
Add
question
<
/span
>
Add
question
<
/button
>
<
/div
>
<
/div
>
...
...
This diff is collapsed.
Click to expand it.
src/components/form/FormViewer.js
+
59
−
2
View file @
eaf8a8fa
...
...
@@ -26,6 +26,7 @@ class FormViewer extends Component {
};
this
.
toggleSideBar
=
this
.
toggleSideBar
.
bind
(
this
);
this
.
loadFormDetails
=
this
.
loadFormDetails
.
bind
(
this
);
this
.
submitForm
=
this
.
submitForm
.
bind
(
this
);
}
toggleSideBar
()
{
...
...
@@ -87,6 +88,59 @@ class FormViewer extends Component {
);
};
submitForm
=
()
=>
{
var
form
=
document
.
getElementById
(
"
application-form
"
);
const
formData
=
new
FormData
(
form
);
const
data
=
Array
.
from
(
formData
.
entries
()).
reduce
(
(
memo
,
pair
)
=>
({
...
memo
,
[
pair
[
0
]]:
pair
[
1
],
}),
{}
);
// data = JSON.stringify(data);
// console.log(data['']);
let
formFields
=
{};
let
fields
=
this
.
state
.
formDetails
.
fields
,
i
=
0
;
console
.
log
(
data
);
for
(
i
=
0
;
i
<
fields
.
length
;
i
++
)
{
if
(
fields
[
i
][
"
fieldType
"
]
!==
LANG
.
HEADING
&&
fields
[
i
][
"
fieldType
"
]
!==
LANG
.
SEPARATOR
)
{
formFields
[
"
field-
"
+
fields
[
i
][
"
order
"
]]
=
data
[
"
field-
"
+
fields
[
i
][
"
order
"
]]
!=
undefined
?
data
[
"
field-
"
+
fields
[
i
][
"
order
"
]]
:
""
;
// console.log("field-" + fields[i]["order"]);
}
}
let
formDetails
=
{
formId
:
this
.
state
.
formDetails
.
id
,
version
:
this
.
state
.
formDetails
.
version
,
dataObject
:
formFields
,
};
// formDetails = JSON.stringify(formDetails);
console
.
log
(
formDetails
);
FormService
.
submit
(
formDetails
).
then
(
(
response
)
=>
{
if
(
response
.
statusInfo
.
statusCode
===
APP
.
CODE
.
SUCCESS
)
{
Notify
.
success
(
response
.
statusInfo
.
statusMessage
);
// this.props.updateParent(response.responseData.id);
this
.
props
.
history
.
push
(
"
/dashboard
"
);
}
else
{
Notify
.
error
(
response
.
statusInfo
.
errorMessage
);
}
},
(
error
)
=>
{
error
.
statusInfo
?
Notify
.
error
(
error
.
statusInfo
.
errorMessage
)
:
Notify
.
error
(
error
.
message
);
}
);
};
render
()
{
return
(
<
Fragment
>
...
...
@@ -121,7 +175,10 @@ class FormViewer extends Component {
<
/div
>
<
div
className
=
"
col-md-6
"
>
<
div
className
=
"
pull-right
"
>
<
button
className
=
"
btn btn-outline smf-btn-default
"
>
<
button
className
=
"
btn btn-outline smf-btn-default
"
onClick
=
{(
e
)
=>
this
.
submitForm
()}
>
Save
<
/button
>
{
this
.
state
.
headingIndex
<
...
...
@@ -183,7 +240,7 @@ class FormViewer extends Component {
<
i
className
=
"
fa fa-bars
"
><
/i
>
{
/* <span>Toggle Sidebar</span> */
}
<
/button
>
<
form
>
<
form
id
=
"
application-form
"
>
{
this
.
state
.
formFieldGroups
.
length
>
0
&&
this
.
state
.
formFieldGroups
[
this
.
state
.
headingIndex
].
map
(
(
field
,
index
)
=>
{
...
...
This diff is collapsed.
Click to expand it.
src/components/form/ListForms.js
+
40
−
8
View file @
eaf8a8fa
...
...
@@ -19,6 +19,7 @@ class ListForms extends Component {
FormService
.
get
().
then
(
(
response
)
=>
{
if
(
response
.
statusInfo
.
statusCode
===
APP
.
CODE
.
SUCCESS
)
{
// console.log(response.responseData);
this
.
setState
({
forms
:
response
.
responseData
,
});
...
...
@@ -81,15 +82,11 @@ class ListForms extends Component {
<
div
className
=
"
row col-md-12
"
>
<
div
className
=
"
row col-md-12 mt-5
"
>
<
div
className
=
"
col-md-12
"
>
<
Link
to
=
"
/forms/add
"
>
<
button
className
=
"
btn btn-default smf-btn-default
"
>
Add
Application
<
/button
>
<
/Link
>
<
h2
className
=
"
mb-4
"
>
Manage
<
/h2
>
<
/div
>
<
/div
>
<
div
className
=
"
row col-md-12 mt-4
"
>
<
div
className
=
"
col-md-
3
"
>
<
div
className
=
"
col-md-
4
"
>
<
div
className
=
"
form-group has-search
"
>
<
i
className
=
"
material-icons form-control-feedback
"
>
search
...
...
@@ -104,9 +101,16 @@ class ListForms extends Component {
/
>
<
/div
>
<
/div
>
<
div
className
=
"
col-md-8
"
>
<
Link
to
=
"
/forms/add
"
className
=
"
pull-right
"
>
<
button
className
=
"
btn btn-default smf-btn-default-inverse
"
>
Create
new
<
/button
>
<
/Link
>
<
/div
>
<
/div
>
<
div
className
=
"
row col-md-12 mt-4
"
id
=
"
forms-container
"
>
{
this
.
state
.
forms
.
map
((
form
,
key
)
=>
(
{
/*
{this.state.forms.map((form, key) => (
<div className="col-md-4 form-item mb-4" key={key}>
<div
className="application-item"
...
...
@@ -126,7 +130,35 @@ class ListForms extends Component {
</Link>
</div>
</div>
))}
))} */
}
<
table
className
=
"
table table-smf
"
>
<
thead
className
=
"
thead-light
"
>
<
tr
>
<
th
scope
=
"
col
"
>
Form
name
<
/th
>
<
th
scope
=
"
col
"
>
Status
<
/th
>
<
th
scope
=
"
col
"
>
Published
/
created
on
<
/th
>
<
th
scope
=
"
col
"
><
/th
>
<
th
scope
=
"
col
"
><
/th
>
<
/tr
>
<
/thead
>
<
tbody
>
{
this
.
state
.
forms
.
map
((
form
,
key
)
=>
(
<
tr
key
=
{
key
}
className
=
"
form-item
"
>
<
th
scope
=
"
row
"
className
=
"
form-title
"
>
{
form
.
title
}
<
/th
>
<
td
>
Published
<
/td
>
<
td
><
/td
>
<
td
className
=
"
td-preview
"
>
<
Link
to
=
{
`/forms/
${
form
.
id
}
`
}
>
Preview
<
/Link
>
<
/td
>
<
td
className
=
"
td-preview
"
>
<
Link
to
=
{
`/forms/
${
form
.
id
}
/edit`
}
>
Edit
<
/Link
>
<
/td
>
<
/tr
>
))}
<
/tbody
>
<
/table
>
<
/div
>
<
/div
>
<
/div
>
...
...
This diff is collapsed.
Click to expand it.
src/components/form/elements/Field.js
+
3
−
3
View file @
eaf8a8fa
...
...
@@ -75,7 +75,7 @@ class Field extends Component {
<
div
className
=
"
card
"
>
<
div
className
=
"
card-body
"
>
<
div
className
=
"
row col-md-12 pb-2
"
>
<
div
className
=
"
col-md-
3
"
>
<
div
className
=
"
col-md-
4
"
>
<
div
className
=
"
form-group
"
>
<
label
htmlFor
=
"
fieldName
"
>
Field
Name
<
/label
>
<
input
...
...
@@ -92,7 +92,7 @@ class Field extends Component {
/
>
<
/div
>
<
/div
>
<
div
className
=
"
col-md-
3
"
>
<
div
className
=
"
col-md-
5
"
>
<
div
className
=
"
form-group
"
>
<
label
htmlFor
=
"
fieldType
"
>
Type
of
Field
<
/label
>
<
select
...
...
@@ -111,7 +111,7 @@ class Field extends Component {
<
/select
>
<
/div
>
<
/div
>
<
div
className
=
"
col-md-3
"
>
<
div
className
=
"
col-md-3
"
style
=
{{
display
:
"
none
"
}}
>
<
div
className
=
"
form-group
"
>
<
label
htmlFor
=
"
fieldType
"
>
Width
<
/label
>
<
select
...
...
This diff is collapsed.
Click to expand it.
src/components/form/elements/Heading.js
+
3
−
3
View file @
eaf8a8fa
...
...
@@ -30,9 +30,9 @@ class Heading extends Component {
render
()
{
return
(
<
div
className
=
"
card
"
>
<
div
className
=
"
card-body
"
>
<
div
className
=
"
card-body
card-body-heading
"
>
<
div
className
=
"
row col-md-12
"
>
<
div
className
=
"
col-md-
3
"
>
<
div
className
=
"
col-md-
4
"
>
<
div
className
=
"
form-group
"
>
<
input
type
=
"
hidden
"
...
...
@@ -70,7 +70,7 @@ class Heading extends Component {
/
>
<
/div
>
<
/div
>
<
div
className
=
"
col-md-
3
"
>
<
div
className
=
"
col-md-
2
"
>
<
i
onClick
=
{()
=>
this
.
props
.
removeElement
(
this
.
props
.
index
)}
className
=
"
material-icons fa-2x pull-right pointer
"
...
...
This diff is collapsed.
Click to expand it.
src/components/login/Login.tsx
+
1
−
0
View file @
eaf8a8fa
...
...
@@ -47,6 +47,7 @@ class Login extends Component<LoginProps, LoginState> {
).
then
(
response
=>
{
if
(
response
.
statusInfo
.
statusCode
===
APP
.
CODE
.
SUCCESS
)
{
// console.log(response.responseData);
localStorage
.
setItem
(
"
user
"
,
JSON
.
stringify
(
response
.
responseData
));
this
.
props
.
history
.
push
(
"
/dashboard
"
);
}
else
{
...
...
This diff is collapsed.
Click to expand it.
src/constants/ApiConstants.ts
+
1
−
0
View file @
eaf8a8fa
...
...
@@ -11,5 +11,6 @@ export const APIS = {
ADD
:
"
forms/createForm
"
,
UPDATE
:
""
,
DELETE
:
""
,
SUBMIT
:
"
forms/v1/saveFormSubmit'
"
,
},
};
This diff is collapsed.
Click to expand it.
src/constants/AppConstants.ts
+
4
−
0
View file @
eaf8a8fa
...
...
@@ -8,4 +8,8 @@ export const APP = {
CODE
:
{
SUCCESS
:
200
},
ROLE
:
{
INSTITUTE
:
"
Institute
"
,
REGULATOR
:
"
Regulator
"
,
}
};
This diff is collapsed.
Click to expand it.
src/helpers/auth.js
+
6
−
1
View file @
eaf8a8fa
const
Auth
=
{
get
(
item
)
{
const
user
=
JSON
.
parse
(
localStorage
.
getItem
(
"
user
"
));
console
.
log
(
'
user ::
'
,
user
)
//
console.log('user :: ', user)
return
(
user
&&
user
[
item
])
||
''
;
},
...
...
@@ -13,6 +13,11 @@ const Auth = {
response
=
false
;
}
return
response
;
},
getUserRole
()
{
let
user
=
JSON
.
parse
(
localStorage
.
getItem
(
"
user
"
));
return
user
.
roles
[
0
].
name
;
}
};
...
...
This diff is collapsed.
Click to expand it.
src/helpers/authHeader.js
+
2
−
2
View file @
eaf8a8fa
...
...
@@ -4,8 +4,8 @@ export function authHeader() {
let
user
=
JSON
.
parse
(
localStorage
.
getItem
(
"
user
"
));
if
(
user
&&
user
.
authToken
)
{
return
{
//
"Authorization": "Bearer " + Auth.get('authToken'),
"
Authorization
"
:
"
Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0YXJlbnRvYWRtaW5AdGFyZW50by5jb20iLCJzY29wZXMiOlt7ImF1dGhvcml0eSI6IlJPTEVfQURNSU4ifV0sImlzcyI6Imh0dHA6Ly9kZXZnbGFuLmNvbSIsImlhdCI6MTY0MzI3OTUzNywiZXhwIjoxNjQ1ODcxNTM3fQ.qj8LU0ODK0WdP2-MHrrQT6g9GimtjD4kMgypk5lWni0
"
,
"
Authorization
"
:
"
Bearer
"
+
Auth
.
get
(
'
authToken
'
),
//
"Authorization": "Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0YXJlbnRvYWRtaW5AdGFyZW50by5jb20iLCJzY29wZXMiOlt7ImF1dGhvcml0eSI6IlJPTEVfQURNSU4ifV0sImlzcyI6Imh0dHA6Ly9kZXZnbGFuLmNvbSIsImlhdCI6MTY0MzI3OTUzNywiZXhwIjoxNjQ1ODcxNTM3fQ.qj8LU0ODK0WdP2-MHrrQT6g9GimtjD4kMgypk5lWni0",
"
Content-Type
"
:
"
application/json
"
,
"
Accept
"
:
"
application/json
"
,
"
Access-Control-Allow-Origin
"
:
"
*
"
,
...
...
This diff is collapsed.
Click to expand it.
src/services/form.service.js
+
15
−
1
View file @
eaf8a8fa
...
...
@@ -6,7 +6,8 @@ export const FormService = {
find
,
add
,
update
,
remove
remove
,
submit
};
function
get
()
{
...
...
@@ -67,6 +68,19 @@ function remove(form) {
).
then
(
handleResponse
);
}
function
submit
(
form
)
{
const
requestOptions
=
{
method
:
APP
.
REQUEST
.
POST
,
body
:
JSON
.
stringify
(
form
),
headers
:
authHeader
()
};
return
fetch
(
// process.env.REACT_APP_API_URL + APIS.FORM.ADD,
"
http://20.204.178.190/api/forms/v1/saveFormSubmit
"
,
requestOptions
).
then
(
handleResponse
);
}
function
handleResponse
(
response
)
{
return
response
.
text
().
then
(
text
=>
{
const
data
=
text
&&
JSON
.
parse
(
text
);
...
...
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