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
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
e937ecd8
Commit
e937ecd8
authored
5 months ago
by
Bastien DUMONT
Browse files
Options
Downloads
Patches
Plain Diff
refactor: use signals for modals management
parent
54edb209
No related branches found
No related tags found
2 merge requests
!945
V3.3.0
,
!921
refactor: use signals for modals management
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/app/profile/edit/edit.component.html
+10
-10
10 additions, 10 deletions
src/app/profile/edit/edit.component.html
src/app/profile/edit/edit.component.ts
+16
-35
16 additions, 35 deletions
src/app/profile/edit/edit.component.ts
with
26 additions
and
45 deletions
src/app/profile/edit/edit.component.html
+
10
−
10
View file @
e937ecd8
...
...
@@ -13,14 +13,14 @@
[iconName]=
"'delete'"
[size]=
"'small'"
[wide]=
"true"
(action)=
"s
how
DeleteAccountModal
(
)"
(action)=
"
i
sDeleteAccountModal
Open.set(true
)"
/>
<app-icon-button
ariaLabel=
"Supprimer mon compte"
class=
"hide-on-desktop"
[variant]=
"'secondaryDelete'"
[iconName]=
"'delete'"
(action)=
"s
how
DeleteAccountModal
(
)"
(action)=
"
i
sDeleteAccountModal
Open.set(true
)"
/>
</div>
<!-- Navigation -->
...
...
@@ -78,7 +78,7 @@
[iconName]=
"'email'"
[size]=
"'small'"
[wide]=
"true"
(action)=
"s
how
EmailModal
(
)"
(action)=
"
i
sEmailModal
Open.set(true
)"
/>
<app-button
[variant]=
"'secondary'"
...
...
@@ -86,7 +86,7 @@
[iconName]=
"'lock'"
[size]=
"'small'"
[wide]=
"true"
(action)=
"s
how
PasswordModal
(
)"
(action)=
"
i
sPasswordModal
Open.set(true
)"
/>
</div>
</div>
...
...
@@ -138,9 +138,9 @@
<app-modal
[singleButton]=
"true"
[title]=
"'ATTENTION'"
[opened]=
"
a
ppointmentModal"
[opened]=
"
isA
ppointmentModal
Open()
"
[validateLabel]=
"'OK'"
(closed)=
"
close
AppointmentModal
(
)"
(closed)=
"
is
AppointmentModal
Open.set(false
)"
>
<p
class=
"modalContent emphasized"
>
Veuillez indiquer si vous souhaitez proposer la fonctionnalité 'Demander un rendez-vous' dans l'onglet 'Employeur
...
...
@@ -151,7 +151,7 @@
<!-- Some modifications are pending, confirm leaving -->
<app-modal
[title]=
"'ATTENTION'"
[opened]=
"
p
endingChangesModal"
[opened]=
"
isP
endingChangesModal
Open()
"
[validateLabel]=
"'Continuer'"
(closed)=
"hasPendingChangesRedirectionAccepted($event ? true : false)"
>
...
...
@@ -161,7 +161,7 @@
<!-- Modal: Email change -->
<app-modal
[title]=
"'Modifier mon email'"
[opened]=
"
e
mailModal"
[opened]=
"
isE
mailModal
Open()
"
[validateLabel]=
"'Valider'"
[validateDisabled]=
"!(emailValid(this.newEmail) && newEmail === newEmailConfirm)"
(closed)=
"$event ? confirm() : closeModal()"
...
...
@@ -198,7 +198,7 @@
<!-- Modal: Password change -->
<app-modal
[title]=
"'Modifier mon mot de passe'"
[opened]=
"
p
asswordModal"
[opened]=
"
isP
asswordModal
Open()
"
[validateDisabled]=
"!isPageValid()"
(closed)=
"$event ? confirm() : closeModal()"
>
...
...
@@ -248,7 +248,7 @@
<!-- Modal: Delete account -->
<app-modal
[title]=
"'Supprimer mon compte'"
[opened]=
"
d
eleteAccountModal"
[opened]=
"
isD
eleteAccountModal
Open()
"
[validateLabel]=
"'Valider'"
[validateDisabled]=
"!passwordValid(oldPassword)"
(closed)=
"$event ? confirmDeleteAccount() : closeModal()"
...
...
This diff is collapsed.
Click to expand it.
src/app/profile/edit/edit.component.ts
+
16
−
35
View file @
e937ecd8
import
{
HttpErrorResponse
}
from
'
@angular/common/http
'
;
import
{
Component
,
Input
,
OnInit
}
from
'
@angular/core
'
;
import
{
Component
,
Input
,
OnInit
,
signal
}
from
'
@angular/core
'
;
import
{
Router
}
from
'
@angular/router
'
;
import
{
lastValueFrom
}
from
'
rxjs
'
;
import
{
Employer
}
from
'
../../models/employer.model
'
;
...
...
@@ -61,13 +61,13 @@ export class EditComponent implements OnInit {
public
statusCode
=
200
;
// Modal canExit var
public
e
mailModal
=
false
;
public
p
asswordModal
=
false
;
public
d
eleteAccountModal
=
false
;
public
p
endingChangesModal
=
false
;
public
isE
mailModal
Open
=
signal
(
false
)
;
public
isP
asswordModal
Open
=
signal
(
false
)
;
public
isD
eleteAccountModal
Open
=
signal
(
false
)
;
public
isP
endingChangesModal
Open
=
signal
(
false
)
;
private
resolve
:
CanExitResolver
;
private
canDeactivate
=
false
;
public
a
ppointmentModal
=
false
;
public
isA
ppointmentModal
Open
=
signal
(
false
)
;
constructor
(
public
profileService
:
ProfileService
,
...
...
@@ -204,18 +204,6 @@ export class EditComponent implements OnInit {
this
.
userProfile
=
{
...
this
.
initialUserProfile
};
}
public
showEmailModal
():
void
{
this
.
emailModal
=
true
;
}
public
showPasswordModal
():
void
{
this
.
passwordModal
=
true
;
}
public
showDeleteAccountModal
():
void
{
this
.
deleteAccountModal
=
true
;
}
public
showPassword
(
key
:
showPasswordEnum
):
void
{
this
.
isShowPassword
[
key
]
=
!
this
.
isShowPassword
[
key
];
}
...
...
@@ -224,18 +212,18 @@ export class EditComponent implements OnInit {
this
.
oldPassword
=
''
;
this
.
newPassword
=
''
;
this
.
newPasswordConfirm
=
''
;
this
.
e
mailModal
=
false
;
this
.
p
asswordModal
=
false
;
this
.
d
eleteAccountModal
=
false
;
this
.
isE
mailModal
Open
.
set
(
false
)
;
this
.
isP
asswordModal
Open
.
set
(
false
)
;
this
.
isD
eleteAccountModal
Open
.
set
(
false
)
;
}
public
isPageValid
():
boolean
{
if
(
this
.
currentTab
===
tabsEnum
.
details
)
{
return
this
.
coordsHaveChanged
()
&&
this
.
phoneValid
()
&&
this
.
nameValid
()
&&
this
.
surnameValid
();
}
else
if
(
this
.
currentTab
===
tabsEnum
.
credentials
)
{
if
(
this
.
e
mailModal
)
{
if
(
this
.
isE
mailModal
Open
()
)
{
return
this
.
emailValid
(
this
.
newEmail
)
&&
this
.
newEmail
===
this
.
newEmailConfirm
;
}
else
if
(
this
.
p
asswordModal
)
{
}
else
if
(
this
.
isP
asswordModal
Open
()
)
{
return
this
.
passwordValid
(
this
.
newPassword
)
&&
this
.
newPassword
===
this
.
newPasswordConfirm
;
}
}
else
if
(
this
.
currentTab
===
tabsEnum
.
employer
)
{
...
...
@@ -250,9 +238,9 @@ export class EditComponent implements OnInit {
if
(
this
.
currentTab
===
tabsEnum
.
details
)
{
this
.
confirmDetails
();
}
else
if
(
this
.
currentTab
===
tabsEnum
.
credentials
)
{
if
(
this
.
e
mailModal
)
{
if
(
this
.
isE
mailModal
Open
()
)
{
this
.
confirmNewEmail
();
}
else
if
(
this
.
p
asswordModal
)
{
}
else
if
(
this
.
isP
asswordModal
Open
()
)
{
this
.
confirmNewPassword
();
}
}
else
if
(
this
.
currentTab
===
tabsEnum
.
employer
)
{
...
...
@@ -417,7 +405,7 @@ export class EditComponent implements OnInit {
return
new
Promise
((
resolve
)
=>
this
.
showPendingChangesModal
(
resolve
));
}
if
(
this
.
hasPersonalOffer
&&
this
.
selectedRdvChoice
===
undefined
)
{
return
new
Promise
(()
=>
this
.
s
how
AppointmentModal
(
));
return
new
Promise
(()
=>
this
.
i
sAppointmentModal
Open
.
set
(
true
));
}
return
Promise
.
resolve
(
true
);
}
...
...
@@ -459,18 +447,11 @@ export class EditComponent implements OnInit {
}
public
showPendingChangesModal
(
resolve
:
CanExitResolver
):
void
{
this
.
p
endingChangesModal
=
true
;
this
.
isP
endingChangesModal
Open
.
set
(
true
)
;
this
.
resolve
=
resolve
;
}
public
hasPendingChangesRedirectionAccepted
(
hasAccept
:
boolean
):
void
{
this
.
resolve
(
hasAccept
);
this
.
pendingChangesModal
=
false
;
}
private
showAppointmentModal
():
void
{
this
.
appointmentModal
=
true
;
}
public
closeAppointmentModal
():
void
{
this
.
appointmentModal
=
false
;
this
.
isPendingChangesModalOpen
.
set
(
false
);
}
}
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