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
00356362
Commit
00356362
authored
3 years ago
by
Sakthivel G
Browse files
Options
Download
Patches
Plain Diff
fix: resolve applications loading issue in inspector page
parent
1ede4bfe
master
accept_file_type
cards-value-changes
delete-form
delete-user
form-issue
inspector-model
label-change
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/pages/Inspector/InspectorApplications.tsx
+53
-52
src/pages/Inspector/InspectorApplications.tsx
src/pages/Inspector/InspectorHome.tsx
+2
-0
src/pages/Inspector/InspectorHome.tsx
with
55 additions
and
52 deletions
+55
-52
src/pages/Inspector/InspectorApplications.tsx
+
53
−
52
View file @
00356362
...
...
@@ -67,7 +67,7 @@ export const InspectorApplications = ({ data }: InspectorApplicationsProps) => {
setSelectedTab
(
"
Scheduled today
"
);
}
let
user
:
any
=
userDetails
.
length
&&
JSON
.
parse
(
userDetails
);
let
user
:
any
=
userDetails
&&
JSON
.
parse
(
userDetails
);
setUserDetails
(
user
);
// eslint-disable-next-line react-hooks/exhaustive-deps
},
[]);
...
...
@@ -100,68 +100,69 @@ export const InspectorApplications = ({ data }: InspectorApplicationsProps) => {
(
response
)
=>
{
if
(
response
.
statusInfo
.
statusCode
===
APP
.
CODE
.
SUCCESS
)
{
response
.
responseData
.
map
((
i
:
any
,
j
:
number
)
=>
{
if
(
i
.
inspection
.
status
===
LANG
.
FORM_STATUS
.
SENT_FOR_INSPECTION
&&
i
.
inspection
.
leadInspector
.
includes
(
userDetails
&&
userDetails
.
id
)
)
{
if
(
i
.
inspection
)
{
if
(
moment
(
todayDate
,
"
DD-MM-YYYY
"
).
isBefore
(
moment
(
i
.
inspection
.
scheduledDate
,
"
DD-MM-YYYY
"
)
i
.
inspection
.
status
===
LANG
.
FORM_STATUS
.
SENT_FOR_INSPECTION
&&
i
.
inspection
.
leadInspector
.
includes
(
userDetails
&&
userDetails
.
id
)
)
{
setUpcoming
((
upcoming
)
=>
[...
upcoming
,
i
]);
}
else
if
(
moment
(
todayDate
,
"
DD-MM-YYYY
"
).
isSame
(
moment
(
i
.
inspection
.
scheduledDate
,
"
DD-MM-YYYY
"
)
if
(
moment
(
todayDate
,
"
DD-MM-YYYY
"
).
isBefore
(
moment
(
i
.
inspection
.
scheduledDate
,
"
DD-MM-YYYY
"
)
)
)
{
setUpcoming
((
upcoming
)
=>
[...
upcoming
,
i
]);
}
else
if
(
moment
(
todayDate
,
"
DD-MM-YYYY
"
).
isSame
(
moment
(
i
.
inspection
.
scheduledDate
,
"
DD-MM-YYYY
"
)
)
)
{
setScheduledToday
((
today
)
=>
[...
today
,
i
]);
}
else
{
setPast
((
past
)
=>
[...
past
,
i
]);
}
}
if
(
(
i
.
inspection
.
status
===
LANG
.
FORM_STATUS
.
LEAD_INSPECTION_COMPLETED
||
i
.
inspection
.
status
===
LANG
.
FORM_STATUS
.
INSPECTION_COMPLETED
)
&&
i
.
inspection
.
leadInspector
.
includes
(
userDetails
&&
userDetails
.
id
)
)
{
setScheduledToday
((
today
)
=>
[...
today
,
i
]);
}
else
{
setPast
((
past
)
=>
[...
past
,
i
]);
}
}
if
(
(
i
.
inspection
.
status
===
LANG
.
FORM_STATUS
.
LEAD_INSPECTION_COMPLETED
||
if
(
i
.
inspection
.
status
===
LANG
.
FORM_STATUS
.
INSPECTION_COMPLETED
)
&&
i
.
inspection
.
leadInspector
.
includes
(
userDetails
&&
userDetails
.
id
)
)
{
setPast
((
past
)
=>
[...
past
,
i
]);
}
if
(
i
.
inspection
.
status
===
LANG
.
FORM_STATUS
.
INSPECTION_COMPLETED
&&
i
.
inspection
.
assistingInspector
.
includes
(
userDetails
&&
userDetails
.
id
)
)
{
setPast
((
past
)
=>
[...
past
,
i
]);
}
if
(
i
.
inspection
.
status
===
LANG
.
FORM_STATUS
.
LEAD_INSPECTION_COMPLETED
&&
i
.
inspection
.
assistingInspector
.
includes
(
userDetails
&&
userDetails
.
id
)
)
{
// consol
i
.
inspection
.
assignedTo
.
map
((
m
:
any
,
n
:
number
)
=>
{
if
(
m
.
id
===
userDetails
.
id
)
{
// if (m.status === LANG.FORM_STATUS.INSPECTION_COMPLETED) {
LANG
.
FORM_STATUS
.
INSPECTION_COMPLETED
&&
i
.
inspection
.
assistingInspector
.
includes
(
userDetails
&&
userDetails
.
id
)
)
{
setPast
((
past
)
=>
[...
past
,
i
]);
}
if
(
i
.
inspection
.
status
===
LANG
.
FORM_STATUS
.
LEAD_INSPECTION_COMPLETED
&&
i
.
inspection
.
assistingInspector
.
includes
(
userDetails
&&
userDetails
.
id
)
)
{
i
.
inspection
.
assignedTo
.
map
((
m
:
any
,
n
:
number
)
=>
{
if
(
m
.
id
===
userDetails
.
id
)
{
// if (m.status === LANG.FORM_STATUS.INSPECTION_COMPLETED) {
setPast
((
past
)
=>
[...
past
,
i
]);
// }
// }
return
null
;
}
return
null
;
}
return
null
;
});
});
}
}
return
null
;
});
}
else
{
...
...
This diff is collapsed.
Click to expand it.
src/pages/Inspector/InspectorHome.tsx
+
2
−
0
View file @
00356362
...
...
@@ -82,6 +82,7 @@ export const InspectorHome = ({ data }: InspectorProps) => {
if
(
response
.
statusInfo
.
statusCode
===
APP
.
CODE
.
SUCCESS
)
{
response
.
responseData
.
map
((
i
:
any
,
j
:
number
)
=>
{
if
(
i
.
inspection
&&
i
.
inspection
.
leadInspector
.
includes
(
userDetails
&&
userDetails
.
id
)
&&
...
...
@@ -121,6 +122,7 @@ export const InspectorHome = ({ data }: InspectorProps) => {
if
(
response
.
statusInfo
.
statusCode
===
APP
.
CODE
.
SUCCESS
)
{
response
.
responseData
.
map
((
i
:
any
,
j
:
number
)
=>
{
if
(
i
.
inspection
&&
i
.
inspection
.
status
===
LANG
.
FORM_STATUS
.
LEAD_INSPECTION_COMPLETED
&&
!
i
.
inspection
.
leadInspector
.
includes
(
...
...
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