feat: migrate contact deletion in ContactFormComponent to Django REST; update phone number input error message
This commit is contained in:
parent
7b028ab843
commit
5da2cc0237
4 changed files with 14 additions and 6 deletions
|
|
@ -113,7 +113,6 @@
|
||||||
[(ngModel)]="contactData.phone"
|
[(ngModel)]="contactData.phone"
|
||||||
pattern="[\d\+\-\(\)\/]{10,15}"
|
pattern="[\d\+\-\(\)\/]{10,15}"
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
required
|
|
||||||
/>
|
/>
|
||||||
<div class="error-msg">
|
<div class="error-msg">
|
||||||
@if (!phone.valid && phone.touched) {
|
@if (!phone.valid && phone.touched) {
|
||||||
|
|
@ -126,7 +125,7 @@
|
||||||
class="btn-delete"
|
class="btn-delete"
|
||||||
type="button"
|
type="button"
|
||||||
value="{{ 'contactDialogForm.btnDelete' | translate }}"
|
value="{{ 'contactDialogForm.btnDelete' | translate }}"
|
||||||
(click)="closeDialog()"
|
(click)="deleteContact(selectedUser.id)"
|
||||||
></app-form-btn>
|
></app-form-btn>
|
||||||
} @else {
|
} @else {
|
||||||
<app-form-btn
|
<app-form-btn
|
||||||
|
|
@ -149,8 +148,6 @@
|
||||||
!contactData.lastName ||
|
!contactData.lastName ||
|
||||||
email.invalid ||
|
email.invalid ||
|
||||||
!contactData.email ||
|
!contactData.email ||
|
||||||
phone.invalid ||
|
|
||||||
!contactData.phone ||
|
|
||||||
!checkIfUserEmailIsValid(contactData.email)
|
!checkIfUserEmailIsValid(contactData.email)
|
||||||
"
|
"
|
||||||
></app-form-btn>
|
></app-form-btn>
|
||||||
|
|
|
||||||
|
|
@ -273,6 +273,17 @@ export class ContactFormComponent implements OnInit, OnChanges {
|
||||||
return newObj;
|
return newObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async deleteContact(userId: string) {
|
||||||
|
try {
|
||||||
|
await lastValueFrom(this.apiService.deleteUserById(userId));
|
||||||
|
this.toastNotificationService.deleteContactSuccessToast();
|
||||||
|
this.updateNotifierService.notifyUpdate('contact');
|
||||||
|
this.closeDialog();
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
closeDialog() {
|
closeDialog() {
|
||||||
this.closeDialogEmitter.emit('');
|
this.closeDialogEmitter.emit('');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@
|
||||||
"invalidMail0": "Sie müssen eine E-Mail Adresse eingeben!",
|
"invalidMail0": "Sie müssen eine E-Mail Adresse eingeben!",
|
||||||
"invalidMail1": "Dies ist kein gültiges E-Mail-Format!",
|
"invalidMail1": "Dies ist kein gültiges E-Mail-Format!",
|
||||||
"invalidMail2": "Diese E-Mail existiert bereits!",
|
"invalidMail2": "Diese E-Mail existiert bereits!",
|
||||||
"invalidPhone": "Eine Telefonnummer ist erforderlich!",
|
"invalidPhone": "Ungültige Telefonnummer (10–15 Zeichen, Ziffern + ()-/ erlaubt)",
|
||||||
"firstName": "Vorname",
|
"firstName": "Vorname",
|
||||||
"lastName": "Nachname",
|
"lastName": "Nachname",
|
||||||
"email": "E-Mail",
|
"email": "E-Mail",
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@
|
||||||
"invalidMail0": "You must enter a mail!",
|
"invalidMail0": "You must enter a mail!",
|
||||||
"invalidMail1": "This is not a valid email format!",
|
"invalidMail1": "This is not a valid email format!",
|
||||||
"invalidMail2": "This email already exists!",
|
"invalidMail2": "This email already exists!",
|
||||||
"invalidPhone": "A phone number is required!",
|
"invalidPhone": "Invalid phone number (10–15 chars, digits + ()-/ allowed)",
|
||||||
"firstName": "First name",
|
"firstName": "First name",
|
||||||
"lastName": "Last name",
|
"lastName": "Last name",
|
||||||
"email": "Email",
|
"email": "Email",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue