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
d85d481b
Commit
d85d481b
authored
2 years ago
by
devendra
Browse files
Options
Download
Patches
Plain Diff
Fix: User deails cache issue
parent
d287f95d
master
accept_file_type
cards-value-changes
delete-form
delete-user
form-issue
inspector-model
label-change
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/components/common/Header.tsx
+7
-6
src/components/common/Header.tsx
src/components/dashboard/Dashboard.js
+6
-7
src/components/dashboard/Dashboard.js
src/components/form/FormViewer.js
+11
-11
src/components/form/FormViewer.js
src/pages/Reviewer/ReviewerApplications.tsx
+4
-5
src/pages/Reviewer/ReviewerApplications.tsx
with
28 additions
and
29 deletions
+28
-29
src/components/common/Header.tsx
+
7
−
6
View file @
d85d481b
...
...
@@ -19,8 +19,8 @@ interface LoginState {
userName
:
any
;
userInfo
:
any
;
}
const
userRole
=
Helper
.
getUserRole
();
class
Header
extends
Component
<
LoginProps
,
LoginState
>
{
userRole
:
any
;
constructor
(
props
:
any
)
{
super
(
props
);
this
.
state
=
{
...
...
@@ -28,6 +28,7 @@ class Header extends Component<LoginProps, LoginState> {
userInfo
:
{},
};
this
.
logout
=
this
.
logout
.
bind
(
this
);
this
.
userRole
=
Helper
.
getUserRole
();
}
componentDidMount
()
{
...
...
@@ -141,7 +142,7 @@ class Header extends Component<LoginProps, LoginState> {
HOME
</
Link
>
</
li
>
{
userRole
===
APP
.
ROLE
.
INSTITUTION
&&
(
{
this
.
userRole
===
APP
.
ROLE
.
INSTITUTION
&&
(
<
li
className
=
"mr-3 mr-sm-2 mr-md-5 mr-lg-5"
>
<
Link
to
=
{
"
/applications
"
}
...
...
@@ -157,7 +158,7 @@ class Header extends Component<LoginProps, LoginState> {
</
Link
>
</
li
>
)
}
{
userRole
===
APP
.
ROLE
.
INSTITUTION
&&
(
{
this
.
userRole
===
APP
.
ROLE
.
INSTITUTION
&&
(
<
li
className
=
"mr-3 mr-sm-2 mr-md-5 mr-lg-5"
>
<
Link
to
=
{
"
/available-forms
"
}
...
...
@@ -173,7 +174,7 @@ class Header extends Component<LoginProps, LoginState> {
</
Link
>
</
li
>
)
}
{
(
userRole
===
APP
.
ROLE
.
REGULATOR
||
userRole
===
APP
.
ROLE
.
SUPER_ADMIN
)
&&
(
{
(
this
.
userRole
===
APP
.
ROLE
.
REGULATOR
||
this
.
userRole
===
APP
.
ROLE
.
SUPER_ADMIN
)
&&
(
<>
<
li
className
=
"mr-3 mr-sm-2 mr-md-5 mr-lg-5"
>
<
Link
...
...
@@ -206,7 +207,7 @@ class Header extends Component<LoginProps, LoginState> {
</
li
>
</>
)
}
{
userRole
===
APP
.
ROLE
.
INSPECTOR
&&
(
{
this
.
userRole
===
APP
.
ROLE
.
INSPECTOR
&&
(
<
li
className
=
"mr-3 mr-sm-2 mr-md-5 mr-lg-5"
>
<
Link
to
=
{
"
/all-applications
"
}
...
...
@@ -222,7 +223,7 @@ class Header extends Component<LoginProps, LoginState> {
</
Link
>
</
li
>
)
}
{
(
userRole
===
APP
.
ROLE
.
REGULATOR
||
userRole
===
APP
.
ROLE
.
SUPER_ADMIN
)
&&
(
{
(
this
.
userRole
===
APP
.
ROLE
.
REGULATOR
||
this
.
userRole
===
APP
.
ROLE
.
SUPER_ADMIN
)
&&
(
<
li
className
=
""
>
<
Link
to
=
{
"
/analytics
"
}
...
...
This diff is collapsed.
Click to expand it.
src/components/dashboard/Dashboard.js
+
6
−
7
View file @
d85d481b
...
...
@@ -12,7 +12,6 @@ import { CardTwo } from "../cards";
/**
* Dashboard component
*/
const
userRole
=
Helper
.
getUserRole
();
class
Dashboard
extends
Component
{
constructor
(
props
)
{
super
(
props
);
...
...
@@ -21,7 +20,7 @@ class Dashboard extends Component {
forms
:
[],
myApplications
:
[],
};
this
.
userRole
=
Helper
.
getUserRole
();
this
.
getInstituteApplications
=
this
.
getInstituteApplications
.
bind
();
}
...
...
@@ -43,7 +42,7 @@ class Dashboard extends Component {
}
getInstituteApplications
=
()
=>
{
if
(
userRole
===
APP
.
ROLE
.
INSTITUTION
)
{
if
(
this
.
userRole
===
APP
.
ROLE
.
INSTITUTION
)
{
FormService
.
get
().
then
(
(
response
)
=>
{
if
(
response
.
statusInfo
.
statusCode
===
APP
.
CODE
.
SUCCESS
)
{
...
...
@@ -96,7 +95,7 @@ class Dashboard extends Component {
return
(
<
Fragment
>
<
Header
history
=
{
this
.
props
.
history
}
/
>
{
userRole
===
APP
.
ROLE
.
INSTITUTION
&&
(
{
this
.
userRole
===
APP
.
ROLE
.
INSTITUTION
&&
(
<
Fragment
>
<
div
className
=
"
container-fluid main-container
"
>
<
div
className
=
"
container dashboard-inner-container pt-3 pb-3
"
>
...
...
@@ -199,7 +198,7 @@ class Dashboard extends Component {
<
/div
>
<
/Fragment
>
)}
{
/* {(userRole === APP.ROLE.REGULATOR || userRole === APP.ROLE.SUPER_ADMIN) && (
{
/* {(
this.
userRole === APP.ROLE.REGULATOR ||
this.
userRole === APP.ROLE.SUPER_ADMIN) && (
<Fragment>
<div className="container-fluid">
<div className="container dashboard-inner-container">
...
...
@@ -295,9 +294,9 @@ class Dashboard extends Component {
)} */
}
{
/* Inspector portal */
}
{
userRole
===
APP
.
ROLE
.
INSPECTOR
&&
<
InspectorHome
/>
}
{
this
.
userRole
===
APP
.
ROLE
.
INSPECTOR
&&
<
InspectorHome
/>
}
{
/* Inspector portal */
}
{(
userRole
===
APP
.
ROLE
.
REGULATOR
||
userRole
===
APP
.
ROLE
.
SUPER_ADMIN
)
&&
<
ReviewerHome
/>
}
{(
this
.
userRole
===
APP
.
ROLE
.
REGULATOR
||
this
.
userRole
===
APP
.
ROLE
.
SUPER_ADMIN
)
&&
<
ReviewerHome
/>
}
<
/Fragment
>
);
}
...
...
This diff is collapsed.
Click to expand it.
src/components/form/FormViewer.js
+
11
−
11
View file @
d85d481b
...
...
@@ -22,7 +22,6 @@ import { CardThree } from "../cards";
import
{
TextAreaField
}
from
"
../form-elements
"
;
// import { BtnTwo } from "../buttons";
// const $ = window.$;
const
userRole
=
Helper
.
getUserRole
();
class
FormViewer
extends
Component
{
constructor
(
props
)
{
super
(
props
);
...
...
@@ -38,6 +37,7 @@ class FormViewer extends Component {
showSaveAsDraft
:
true
,
breadCrumbData
:
[],
};
this
.
userRole
=
Helper
.
getUserRole
();
this
.
toggleSideBar
=
this
.
toggleSideBar
.
bind
(
this
);
this
.
loadFormDetails
=
this
.
loadFormDetails
.
bind
(
this
);
this
.
saveFields
=
this
.
saveFields
.
bind
(
this
);
...
...
@@ -61,7 +61,7 @@ class FormViewer extends Component {
this
.
props
.
match
.
params
.
applicationId
!==
null
&&
this
.
props
.
match
.
params
.
applicationId
!==
undefined
)
{
if
(
userRole
===
APP
.
ROLE
.
INSTITUTION
)
{
if
(
this
.
userRole
===
APP
.
ROLE
.
INSTITUTION
)
{
this
.
setState
({
breadCrumbData
:
[
{
title
:
"
HOME
"
,
url
:
"
/dashboard
"
,
icon
:
""
},
...
...
@@ -69,7 +69,7 @@ class FormViewer extends Component {
],
});
}
if
(
userRole
===
APP
.
ROLE
.
REGULATOR
||
userRole
===
APP
.
ROLE
.
SUPER_ADMIN
)
{
if
(
this
.
userRole
===
APP
.
ROLE
.
REGULATOR
||
this
.
userRole
===
APP
.
ROLE
.
SUPER_ADMIN
)
{
this
.
setState
({
breadCrumbData
:
[
{
title
:
"
HOME
"
,
url
:
"
/dashboard
"
,
icon
:
""
},
...
...
@@ -81,7 +81,7 @@ class FormViewer extends Component {
this
.
populateForm
(
this
.
props
.
match
.
params
.
applicationId
);
},
50
);
}
else
{
if
(
userRole
===
APP
.
ROLE
.
INSTITUTION
)
{
if
(
this
.
userRole
===
APP
.
ROLE
.
INSTITUTION
)
{
this
.
setState
({
breadCrumbData
:
[
{
title
:
"
HOME
"
,
url
:
"
/dashboard
"
,
icon
:
""
},
...
...
@@ -89,7 +89,7 @@ class FormViewer extends Component {
],
});
}
if
(
userRole
===
APP
.
ROLE
.
REGULATOR
||
userRole
===
APP
.
ROLE
.
SUPER_ADMIN
)
{
if
(
this
.
userRole
===
APP
.
ROLE
.
REGULATOR
||
this
.
userRole
===
APP
.
ROLE
.
SUPER_ADMIN
)
{
this
.
setState
({
breadCrumbData
:
[
{
title
:
"
HOME
"
,
url
:
"
/dashboard
"
,
icon
:
""
},
...
...
@@ -327,7 +327,7 @@ class FormViewer extends Component {
this
.
props
.
match
.
params
.
applicationId
!==
undefined
)
{
// if regulator disable form
if
(
userRole
===
APP
.
ROLE
.
REGULATOR
||
userRole
===
APP
.
ROLE
.
SUPER_ADMIN
)
{
if
(
this
.
userRole
===
APP
.
ROLE
.
REGULATOR
||
this
.
userRole
===
APP
.
ROLE
.
SUPER_ADMIN
)
{
setTimeout
(()
=>
{
this
.
disableFormElements
();
},
300
);
...
...
@@ -335,7 +335,7 @@ class FormViewer extends Component {
// if institute,
// if status: Draft - enable form edit & show 'save as draft'
if
(
userRole
===
APP
.
ROLE
.
INSTITUTION
&&
this
.
userRole
===
APP
.
ROLE
.
INSTITUTION
&&
(
this
.
state
.
applicationDetails
.
status
===
LANG
.
FORM_STATUS
.
DRAFT
||
this
.
state
.
applicationDetails
.
status
===
LANG
.
FORM_STATUS
.
RETURNED
)
)
{
...
...
@@ -350,7 +350,7 @@ class FormViewer extends Component {
// if institute,
// if status: not Draft - disable form edit & hide 'save as draft'
if
(
userRole
===
APP
.
ROLE
.
INSTITUTION
&&
this
.
userRole
===
APP
.
ROLE
.
INSTITUTION
&&
this
.
state
.
applicationDetails
.
status
!==
LANG
.
FORM_STATUS
.
DRAFT
&&
this
.
state
.
applicationDetails
.
status
!==
LANG
.
FORM_STATUS
.
RETURNED
)
{
...
...
@@ -392,7 +392,7 @@ class FormViewer extends Component {
(
this
.
props
.
match
.
params
.
applicationId
===
null
||
this
.
props
.
match
.
params
.
applicationId
===
undefined
||
this
.
state
.
applicationDetails
.
status
===
LANG
.
FORM_STATUS
.
RETURNED
)
&&
userRole
===
APP
.
ROLE
.
INSTITUTION
this
.
userRole
===
APP
.
ROLE
.
INSTITUTION
)
{
for
(
let
index
=
0
;
index
<=
this
.
state
.
headingIndex
;
index
++
)
{
if
(
!
flag
)
break
;
...
...
@@ -868,7 +868,7 @@ class FormViewer extends Component {
// this.props.match.params.applicationId !== null &&
// this.props.match.params.applicationId !== undefined
// ) &&
userRole
===
APP
.
ROLE
.
INSTITUTION
&&
this
.
userRole
===
APP
.
ROLE
.
INSTITUTION
&&
this
.
state
.
showSaveAsDraft
&&
(
<
button
className
=
"
btn btn-outline smf-btn-default mb-3
"
...
...
@@ -888,7 +888,7 @@ class FormViewer extends Component {
// this.props.match.params.applicationId !== null &&
// this.props.match.params.applicationId !== undefined
// ) &&
userRole
===
APP
.
ROLE
.
INSTITUTION
&&
this
.
userRole
===
APP
.
ROLE
.
INSTITUTION
&&
this
.
state
.
showSaveAsDraft
&&
this
.
state
.
headingIndex
===
this
.
state
.
formHeadings
.
length
-
1
&&
(
...
...
This diff is collapsed.
Click to expand it.
src/pages/Reviewer/ReviewerApplications.tsx
+
4
−
5
View file @
d85d481b
...
...
@@ -44,10 +44,8 @@ const FORM_STATUS = [
"
Inspection completed
"
,
"
Approved
"
];
const
userRole
=
Helper
.
getUserRole
();
class
ReviewerApplications
extends
Component
<
ReviewerApplicationsProps
,
ReviewerApplicationsState
>
{
userRole
:
any
;
constructor
(
props
:
any
)
{
super
(
props
);
...
...
@@ -56,11 +54,12 @@ class ReviewerApplications extends Component<ReviewerApplicationsProps, Reviewer
filteredApplications
:
[],
currentStatus
:
"
New
"
};
this
.
userRole
=
Helper
.
getUserRole
();
this
.
filterApplications
=
this
.
filterApplications
.
bind
(
this
);
}
componentDidMount
()
{
if
(
userRole
===
APP
.
ROLE
.
REGULATOR
||
userRole
===
APP
.
ROLE
.
SUPER_ADMIN
)
{
if
(
this
.
userRole
===
APP
.
ROLE
.
REGULATOR
||
this
.
userRole
===
APP
.
ROLE
.
SUPER_ADMIN
)
{
let
data
=
{
"
searchObjects
"
:
[
]
...
...
@@ -125,7 +124,7 @@ class ReviewerApplications extends Component<ReviewerApplicationsProps, Reviewer
<
Fragment
>
<
Header
history
=
{
this
.
props
.
history
}
/>
{
(
userRole
===
APP
.
ROLE
.
REGULATOR
||
userRole
===
APP
.
ROLE
.
SUPER_ADMIN
)
&&
(
{
(
this
.
userRole
===
APP
.
ROLE
.
REGULATOR
||
this
.
userRole
===
APP
.
ROLE
.
SUPER_ADMIN
)
&&
(
<
Fragment
>
<
div
className
=
"container-fluid"
>
<
div
className
=
"container dashboard-inner-container"
>
...
...
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