Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Client
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
web-et-numerique
Factory
Resin
Client
Commits
541949e7
Commit
541949e7
authored
3 weeks ago
by
Etienne LOUPIAS
Browse files
Options
Downloads
Patches
Plain Diff
improve test patch
parent
24d7c882
No related branches found
Branches containing commit
No related tags found
2 merge requests
!993
Draft: Notif
,
!983
feat(dashboard) : create dashboard !
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/app/profile/dashboard/orientation-details/orientation-details.component.ts
+28
-16
28 additions, 16 deletions
...oard/orientation-details/orientation-details.component.ts
with
28 additions
and
16 deletions
src/app/profile/dashboard/orientation-details/orientation-details.component.ts
+
28
−
16
View file @
541949e7
import
{
Component
,
OnInit
}
from
'
@angular/core
'
;
import
{
ActivatedRoute
}
from
'
@angular/router
'
;
import
{
User
}
from
'
../../../models/user.model
'
;
import
{
NotificationService
}
from
'
../../../services/notification.service
'
;
import
{
OrientationService
}
from
'
../../../services/orientation.service
'
;
import
{
ProfileService
}
from
'
../../services/profile.service
'
;
@
Component
({
selector
:
'
app-orientation-details
'
,
...
...
@@ -13,10 +15,12 @@ export class OrientationDetailsComponent implements OnInit {
private
route
:
ActivatedRoute
,
public
orientationService
:
OrientationService
,
private
notificationService
:
NotificationService
,
private
profileService
:
ProfileService
,
)
{}
public
orientation
;
public
isModalOpenned
=
false
;
public
userProfile
:
User
;
ngOnInit
():
void
{
this
.
route
.
params
.
subscribe
((
urlParams
)
=>
{
...
...
@@ -27,6 +31,9 @@ export class OrientationDetailsComponent implements OnInit {
});
}
});
this
.
profileService
.
getProfile
().
then
((
profile
)
=>
{
this
.
userProfile
=
new
User
(
profile
);
});
}
public
goBack
():
void
{
...
...
@@ -40,29 +47,34 @@ export class OrientationDetailsComponent implements OnInit {
public
closeOrientation
(
event
):
void
{
if
(
event
)
{
// close orientation
// wip test patch
this
.
orientationService
.
patchOrientation
(
this
.
orientation
.
_id
,
{
status
:
'
completed
'
}).
subscribe
({
next
:
(
orientation
)
=>
{
this
.
notificationService
.
showSuccess
(
"
L'orientation a bien été mise à jour.
"
);
// Update the status displayed on the orientation details page
this
.
orientation
.
status
=
orientation
.
status
;
// After the successful update, close the modal
this
.
isModalOpenned
=
false
;
},
error
:
()
=>
{
this
.
notificationService
.
showErrorPleaseRetry
(
"
Une erreur s'est produite lors de la mise à jour de l'orientation.
"
,
);
},
this
.
patchOrientation
({
status
:
'
completed
'
,
closingComment
:
'
closing comment
'
,
closingUser
:
this
.
userProfile
.
_id
,
closingDate
:
new
Date
(),
});
}
else
{
this
.
isModalOpenned
=
false
;
}
this
.
isModalOpenned
=
false
;
}
public
setOrientationStatus
(
status
):
void
{
// set status
console
.
log
(
status
);
}
private
patchOrientation
(
updatedFields
):
void
{
this
.
orientationService
.
patchOrientation
(
this
.
orientation
.
_id
,
updatedFields
).
subscribe
({
next
:
(
orientation
)
=>
{
this
.
notificationService
.
showSuccess
(
"
L'orientation a bien été mise à jour.
"
);
// Display the updated values on the orientation details page
this
.
orientation
=
orientation
;
},
error
:
()
=>
{
this
.
notificationService
.
showErrorPleaseRetry
(
"
Une erreur s'est produite lors de la mise à jour de l'orientation.
"
,
);
},
});
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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