|
2 | 2 | #recoveryModal |
3 | 3 | p-hide-close |
4 | 4 | p-size="auto" |
5 | | - [ngSwitch]="modalType" |
6 | 5 | [p-components-size]="componentsSize" |
7 | 6 | [p-primary-action]="primaryAction" |
8 | 7 | [p-secondary-action]="secondaryAction" |
9 | 8 | [p-title]="modalTitle" |
10 | 9 | > |
11 | 10 | <div class="po-modal-password-recovery-wrapper"> |
12 | | - <div *ngSwitchCase="'email'" class="po-modal-password-recovery-content po-row"> |
13 | | - <div class="po-modal-password-recovery-text po-md-12 po-mb-1"> |
14 | | - {{ emailModalPhrases.firstPhrase }} |
15 | | - </div> |
16 | | - <div class="po-mb-2 po-md-12"> |
17 | | - <form #emailForm="ngForm"> |
18 | | - <div *ngIf="modalPasswordRecoveryTypeAll"> |
19 | | - <po-radio-group |
20 | | - name="type" |
21 | | - [(ngModel)]="chosenTypeFormOption" |
22 | | - [p-options]="typeFormOptions" |
23 | | - [p-size]="componentsSize" |
24 | | - (p-change)="getInputType($event)" |
25 | | - > |
26 | | - </po-radio-group> |
| 11 | + @switch (modalType) { |
| 12 | + @case ('email') { |
| 13 | + <div class="po-modal-password-recovery-content po-row"> |
| 14 | + <div class="po-modal-password-recovery-text po-md-12 po-mb-1"> |
| 15 | + {{ emailModalPhrases.firstPhrase }} |
27 | 16 | </div> |
| 17 | + <div class="po-mb-2 po-md-12"> |
| 18 | + <form #emailForm="ngForm"> |
| 19 | + @if (modalPasswordRecoveryTypeAll) { |
| 20 | + <div> |
| 21 | + <po-radio-group |
| 22 | + name="type" |
| 23 | + [(ngModel)]="chosenTypeFormOption" |
| 24 | + [p-options]="typeFormOptions" |
| 25 | + [p-size]="componentsSize" |
| 26 | + (p-change)="getInputType($event)" |
| 27 | + > |
| 28 | + </po-radio-group> |
| 29 | + </div> |
| 30 | + } |
28 | 31 |
|
29 | | - <div class="po-mt-1"> |
30 | | - <po-email |
31 | | - *ngIf="type === 'email' || type === 'all'" |
32 | | - name="email" |
33 | | - [(ngModel)]="email" |
34 | | - p-required |
35 | | - [p-label]="literals.insertEmail" |
36 | | - [p-size]="componentsSize" |
37 | | - (p-change-model)="formModelChangesCheck(emailForm)" |
38 | | - > |
39 | | - </po-email> |
| 32 | + <div class="po-mt-1"> |
| 33 | + @if (type === 'email' || type === 'all') { |
| 34 | + <po-email |
| 35 | + name="email" |
| 36 | + [(ngModel)]="email" |
| 37 | + p-required |
| 38 | + [p-label]="literals.insertEmail" |
| 39 | + [p-size]="componentsSize" |
| 40 | + (p-change-model)="formModelChangesCheck(emailForm)" |
| 41 | + > |
| 42 | + </po-email> |
| 43 | + } |
40 | 44 |
|
41 | | - <po-input |
42 | | - *ngIf="type === 'sms'" |
43 | | - name="sms" |
44 | | - [(ngModel)]="phone" |
45 | | - p-icon="ICON_TELEPHONE" |
46 | | - p-required |
47 | | - [p-label]="literals.insertPhone" |
48 | | - [p-mask]="phoneMask" |
49 | | - [p-maxlength]="maxLength" |
50 | | - [p-minlength]="minLength" |
51 | | - [p-size]="componentsSize" |
52 | | - (p-change-model)="formModelChangesCheck(emailForm)" |
53 | | - > |
54 | | - </po-input> |
55 | | - </div> |
| 45 | + @if (type === 'sms') { |
| 46 | + <po-input |
| 47 | + name="sms" |
| 48 | + [(ngModel)]="phone" |
| 49 | + p-icon="ICON_TELEPHONE" |
| 50 | + p-required |
| 51 | + [p-label]="literals.insertPhone" |
| 52 | + [p-mask]="phoneMask" |
| 53 | + [p-maxlength]="maxLength" |
| 54 | + [p-minlength]="minLength" |
| 55 | + [p-size]="componentsSize" |
| 56 | + (p-change-model)="formModelChangesCheck(emailForm)" |
| 57 | + > |
| 58 | + </po-input> |
| 59 | + } |
| 60 | + </div> |
56 | 61 |
|
57 | | - <div class="po-field-container-bottom po-field-container-error-container"> |
58 | | - <po-modal-password-recovery-error-message |
59 | | - *ngIf="invalidEmail && control.dirty" |
60 | | - [p-text]="type === 'sms' ? literals.phoneErrorMessagePhrase : literals.emailErrorMessagePhrase" |
61 | | - > |
62 | | - </po-modal-password-recovery-error-message> |
| 62 | + <div class="po-field-container-bottom po-field-container-error-container"> |
| 63 | + @if (invalidEmail && control.dirty) { |
| 64 | + <po-modal-password-recovery-error-message |
| 65 | + [p-text]="type === 'sms' ? literals.phoneErrorMessagePhrase : literals.emailErrorMessagePhrase" |
| 66 | + > |
| 67 | + </po-modal-password-recovery-error-message> |
| 68 | + } |
| 69 | + </div> |
| 70 | + </form> |
| 71 | + </div> |
| 72 | + <div class="po-modal-password-recovery-text po-md-12"> |
| 73 | + {{ emailModalPhrases.secondPhrase }} |
| 74 | + @if (contactEmail) { |
| 75 | + <span> |
| 76 | + {{ literals.prepositionIn }} |
| 77 | + <a class="po-modal-password-recovery-link" href="mailto:{{ contactEmail }}" target="_self"> |
| 78 | + {{ contactEmail }} |
| 79 | + </a> |
| 80 | + </span> |
| 81 | + } |
| 82 | + {{ endpoint }} |
63 | 83 | </div> |
64 | | - </form> |
65 | | - </div> |
66 | | - <div class="po-modal-password-recovery-text po-md-12"> |
67 | | - {{ emailModalPhrases.secondPhrase }} |
68 | | - <span *ngIf="contactEmail"> |
69 | | - {{ literals.prepositionIn }} |
70 | | - <a class="po-modal-password-recovery-link" href="mailto:{{ contactEmail }}" target="_self"> |
71 | | - {{ contactEmail }} |
72 | | - </a> |
73 | | - </span> |
74 | | - {{ endpoint }} |
75 | | - </div> |
76 | | - </div> |
| 84 | + </div> |
| 85 | + } |
77 | 86 |
|
78 | | - <div #smsCodeModal *ngSwitchCase="'smsCode'" class="po-modal-password-recovery-content po-row"> |
79 | | - <div class="po-modal-password-recovery-text po-md-12 po-mb-1">{{ literals.sentSmsCodePhrase }}</div> |
80 | | - <div class="po-mb-2 po-md-12"> |
81 | | - <form #smsCodeForm="ngForm"> |
82 | | - <po-input |
83 | | - name="sms" |
84 | | - [(ngModel)]="smsCode" |
85 | | - p-maxlength="11" |
86 | | - p-minlength="11" |
87 | | - p-required |
88 | | - [p-label]="literals.insertCode" |
89 | | - [p-mask]="codeMask" |
90 | | - [p-size]="componentsSize" |
91 | | - (p-change-model)="formModelChangesCheck(smsCodeForm)" |
92 | | - > |
93 | | - </po-input> |
94 | | - <div class="po-field-container-bottom po-field-container-error-container"> |
95 | | - <po-modal-password-recovery-error-message |
96 | | - *ngIf="invalidEmail" |
97 | | - [p-text]="smsCodeErrorMessage || this.literals.smsCodeErrorMessagePhrase" |
98 | | - > |
99 | | - </po-modal-password-recovery-error-message> |
100 | | - <po-modal-password-recovery-error-message *ngIf="showCustomCodeError" [p-text]="codeError"> |
101 | | - </po-modal-password-recovery-error-message> |
| 87 | + @case ('smsCode') { |
| 88 | + <div #smsCodeModal class="po-modal-password-recovery-content po-row"> |
| 89 | + <div class="po-modal-password-recovery-text po-md-12 po-mb-1">{{ literals.sentSmsCodePhrase }}</div> |
| 90 | + <div class="po-mb-2 po-md-12"> |
| 91 | + <form #smsCodeForm="ngForm"> |
| 92 | + <po-input |
| 93 | + name="sms" |
| 94 | + [(ngModel)]="smsCode" |
| 95 | + p-maxlength="11" |
| 96 | + p-minlength="11" |
| 97 | + p-required |
| 98 | + [p-label]="literals.insertCode" |
| 99 | + [p-mask]="codeMask" |
| 100 | + [p-size]="componentsSize" |
| 101 | + (p-change-model)="formModelChangesCheck(smsCodeForm)" |
| 102 | + > |
| 103 | + </po-input> |
| 104 | + <div class="po-field-container-bottom po-field-container-error-container"> |
| 105 | + @if (invalidEmail) { |
| 106 | + <po-modal-password-recovery-error-message |
| 107 | + [p-text]="smsCodeErrorMessage || this.literals.smsCodeErrorMessagePhrase" |
| 108 | + > |
| 109 | + </po-modal-password-recovery-error-message> |
| 110 | + } |
| 111 | + @if (showCustomCodeError) { |
| 112 | + <po-modal-password-recovery-error-message [p-text]="codeError"> |
| 113 | + </po-modal-password-recovery-error-message> |
| 114 | + } |
| 115 | + </div> |
| 116 | + </form> |
102 | 117 | </div> |
103 | | - </form> |
104 | | - </div> |
105 | | - <div class="po-modal-password-recovery-text po-md-12"> |
106 | | - {{ literals.sendAgainPhrase }} |
107 | | - <span class="po-modal-password-recovery-link" (click)="resendSmsCode()">{{ literals.sendAgain }}</span> |
108 | | - </div> |
109 | | - </div> |
| 118 | + <div class="po-modal-password-recovery-text po-md-12"> |
| 119 | + {{ literals.sendAgainPhrase }} |
| 120 | + <span class="po-modal-password-recovery-link" (click)="resendSmsCode()">{{ literals.sendAgain }}</span> |
| 121 | + </div> |
| 122 | + </div> |
| 123 | + } |
110 | 124 |
|
111 | | - <div #confirmationModal *ngSwitchCase="'confirmation'" class="po-modal-password-recovery-content po-row"> |
112 | | - <img class="po-modal-password-recovery-user-image po-mb-2" src="./assets/images/email-sent.svg" /> |
113 | | - <div class="po-modal-password-recovery-text"> |
114 | | - {{ literals.emailSentConfirmationPhrase }} |
115 | | - </div> |
116 | | - </div> |
| 125 | + @case ('confirmation') { |
| 126 | + <div #confirmationModal class="po-modal-password-recovery-content po-row"> |
| 127 | + <img class="po-modal-password-recovery-user-image po-mb-2" src="./assets/images/email-sent.svg" /> |
| 128 | + <div class="po-modal-password-recovery-text"> |
| 129 | + {{ literals.emailSentConfirmationPhrase }} |
| 130 | + </div> |
| 131 | + </div> |
| 132 | + } |
| 133 | + } |
117 | 134 | </div> |
118 | 135 | </po-modal> |
0 commit comments