Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Maarch
MaarchCourrier
Commits
7aba904d
Commit
7aba904d
authored
Aug 25, 2021
by
Hamza HRAMCHI
Browse files
FIX #17812 TIME 0:10 use headerService + data from the back
parent
15f2a6f8
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/frontend/app/actions/avis-give-parallel-action/give-avis-parallel-action.component.ts
View file @
7aba904d
...
...
@@ -7,6 +7,7 @@ import { NoteEditorComponent } from '../../notes/note-editor.component';
import
{
tap
,
finalize
,
catchError
}
from
'
rxjs/operators
'
;
import
{
of
}
from
'
rxjs
'
;
import
{
FunctionsService
}
from
'
@service/functions.service
'
;
import
{
HeaderService
}
from
'
@service/header.service
'
;
@
Component
({
templateUrl
:
'
give-avis-parallel-action.component.html
'
,
...
...
@@ -39,10 +40,11 @@ export class GiveAvisParallelActionComponent implements OnInit {
private
notify
:
NotificationService
,
public
dialogRef
:
MatDialogRef
<
GiveAvisParallelActionComponent
>
,
@
Inject
(
MAT_DIALOG_DATA
)
public
data
:
any
,
public
functions
:
FunctionsService
)
{
}
public
functions
:
FunctionsService
,
public
headerService
:
HeaderService
)
{
}
async
ngOnInit
()
{
await
this
.
isRedirected
();
ngOnInit
()
{
this
.
checkAvisParallel
();
}
...
...
@@ -68,6 +70,11 @@ export class GiveAvisParallelActionComponent implements OnInit {
this
.
opinionLimitDate
=
new
Date
(
data
.
resourcesInformations
.
success
[
0
].
opinionLimitDate
);
this
.
opinionLimitDate
=
this
.
functions
.
formatDateObjectToDateString
(
this
.
opinionLimitDate
);
}
const
userId
:
number
=
parseInt
(
this
.
data
.
userId
,
10
);
this
.
delegation
.
isDelegated
=
userId
!==
this
.
headerService
.
user
.
id
?
true
:
false
;
if
(
this
.
delegation
.
isDelegated
&&
!
this
.
noResourceToProcess
)
{
this
.
delegation
.
userDelegated
=
data
.
resourcesInformations
.
success
[
0
].
delegatingUser
;
}
}),
finalize
(()
=>
this
.
loading
=
false
),
catchError
((
err
:
any
)
=>
{
...
...
@@ -108,28 +115,4 @@ export class GiveAvisParallelActionComponent implements OnInit {
isValidAction
()
{
return
!
this
.
noResourceToProcess
&&
!
this
.
functions
.
empty
(
this
.
noteEditor
.
getNoteContent
());
}
isRedirected
()
{
return
new
Promise
((
resolve
)
=>
{
this
.
http
.
get
(
'
../rest/currentUser/profile
'
).
pipe
(
tap
((
data
:
any
)
=>
{
const
userId
:
number
=
parseInt
(
this
.
data
.
userId
,
10
);
this
.
delegation
.
isDelegated
=
userId
!==
data
.
id
?
true
:
false
;
if
(
this
.
delegation
.
isDelegated
)
{
this
.
http
.
get
(
'
../rest/users/
'
+
userId
).
pipe
(
tap
((
user
:
any
)
=>
{
this
.
delegation
.
userDelegated
=
`
${
user
.
firstname
}
${
user
.
lastname
}
`
;
})
).
subscribe
();
}
resolve
(
true
);
}),
catchError
((
err
:
any
)
=>
{
this
.
notify
.
handleErrors
(
err
);
return
of
(
false
);
})
).
subscribe
();
});
}
}
Write
Preview
Supports
Markdown
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