IbrahimNour 11 月之前
父節點
當前提交
df09f6174d

+ 5 - 3
src/app/authentication/auth-sign-in/forget-password/forget-password.component.ts

@@ -5,7 +5,7 @@ import {
   UntypedFormGroup,
   Validators,
 } from '@angular/forms';
-import { Router } from '@angular/router';
+import { Router, ActivatedRoute } from '@angular/router';
 import { BaseForm } from '@core/base/base-form';
 import { ComponentBase } from '@core/base/common-base';
 import { AuthService } from '@core/services/authentication/auth.service';
@@ -25,7 +25,8 @@ export class ForgetPasswordComponent
   constructor(
     private readonly toastr: ToastrService,
     private readonly router: Router,
-    private readonly authService: AuthService
+    private readonly authService: AuthService,
+    private readonly route: ActivatedRoute
   ) {
     super();
   }
@@ -51,8 +52,9 @@ export class ForgetPasswordComponent
         .pipe(takeUntil(this.destroy$))
         .subscribe(
           (response) => {
+            this.loading = false;
             this.toastr.success('Successfully !');
-            this.router.navigate(['../verify']);
+            this.router.navigate(['../verify'], { relativeTo: this.route });
           },
           (error) => {
             console.log(error);

+ 14 - 52
src/app/authentication/auth-sign-up/signup-contractor/signup-contractor.component.ts

@@ -144,59 +144,21 @@ export class SignupContractorComponent
   }
 
   onSubmit(): void {
-    this.multiPartForm.append('firstName', this.form.get('firstName')?.value);
-    this.multiPartForm.append('lastName', this.form.get('lastName')?.value);
-    this.multiPartForm.append(
-      'dateOfBirth',
-      this.form.get('dateOfBirth')?.value
-    );
-    this.multiPartForm.append('email', this.form.get('email')?.value);
-    this.multiPartForm.append('idNumber', this.form.get('idNumber')?.value);
-    this.multiPartForm.append(
-      'phoneNumber',
-      this.form.get('phoneNumber')?.value
-    );
-
-    this.multiPartForm.append('userType', this.form.get('userType')?.value);
-    this.multiPartForm.append(
-      'favoriteName',
-      this.form.get('favoriteName')?.value
-    );
-    this.multiPartForm.append(
-      'passportNumber',
-      this.form.get('passportNumber')?.value
-    );
-    this.multiPartForm.append(
-      'qualificationId',
-      this.form.get('qualificationId')?.value
-    );
-    this.multiPartForm.append(
-      'universityId',
-      this.form.get('universityId')?.value
-    );
-    this.multiPartForm.append('jobTitleId', this.form.get('jobTitleId')?.value);
-    this.multiPartForm.append('industryId', this.form.get('industryId')?.value);
-    this.multiPartForm.append('taxNumber', this.form.get('taxNumber')?.value);
-    this.multiPartForm.append(
-      'incomeTaxValue',
-      this.form.get('incomeTaxValue')?.value
-    );
-    this.multiPartForm.append('userName', this.form.get('userName')?.value);
-    this.multiPartForm.append('password', this.form.get('password')?.value);
-    this.multiPartForm.append(
-      'linkedInLink',
-      this.form.get('linkedInLink')?.value
-    );
+    for (const key in this.form.value) {
+      if (this.form.value.hasOwnProperty(key)) {
+        this.multiPartForm.append(key, this.form.value[key]);
+      }
+    }
 
-    this.multiPartForm.append(
-      'userAddress',
-      JSON.stringify({
-        countryId: this.form.get('countryId')?.value,
-        cityId: 1,
-        postalCode: this.form.get('postalCode')?.value,
-        addressDesc: this.form.get('addressDesc')?.value,
-      })
-    );
+    // this.multiPartForm.append(
+    //   'userAddress',
+    //   JSON.stringify({
+    //     countryId: this.form.get('countryId')?.value,
+    //     cityId: 1,
+    //     postalCode: this.form.get('postalCode')?.value,
+    //     addressDesc: this.form.get('addressDesc')?.value,
+    //   })
+    // );
 
     this.authService
       .addEmployee(this.multiPartForm)

+ 15 - 52
src/app/authentication/auth-sign-up/signup-employee/signup-employee.component.ts

@@ -145,59 +145,22 @@ export class SignupEmployeeComponent
   }
 
   onSubmit(): void {
-    this.multiPartForm.append('firstName', this.form.get('firstName')?.value);
-    this.multiPartForm.append('lastName', this.form.get('lastName')?.value);
-    this.multiPartForm.append(
-      'dateOfBirth',
-      this.form.get('dateOfBirth')?.value
-    );
-    this.multiPartForm.append('email', this.form.get('email')?.value);
-    this.multiPartForm.append('idNumber', this.form.get('idNumber')?.value);
-    this.multiPartForm.append(
-      'phoneNumber',
-      this.form.get('phoneNumber')?.value
-    );
-
-    this.multiPartForm.append('userType', this.form.get('userType')?.value);
-    this.multiPartForm.append(
-      'favoriteName',
-      this.form.get('favoriteName')?.value
-    );
-    this.multiPartForm.append(
-      'passportNumber',
-      this.form.get('passportNumber')?.value
-    );
-    this.multiPartForm.append(
-      'qualificationId',
-      this.form.get('qualificationId')?.value
-    );
-    this.multiPartForm.append(
-      'universityId',
-      this.form.get('universityId')?.value
-    );
-    this.multiPartForm.append('jobTitleId', this.form.get('jobTitleId')?.value);
-    this.multiPartForm.append('industryId', this.form.get('industryId')?.value);
-    this.multiPartForm.append('taxNumber', this.form.get('taxNumber')?.value);
-    this.multiPartForm.append(
-      'incomeTaxValue',
-      this.form.get('incomeTaxValue')?.value
-    );
-    this.multiPartForm.append('userName', this.form.get('userName')?.value);
-    this.multiPartForm.append('password', this.form.get('password')?.value);
-    this.multiPartForm.append(
-      'linkedInLink',
-      this.form.get('linkedInLink')?.value
-    );
+    console.log(this.form.get('userName')?.value);
+    for (const key in this.form.value) {
+      if (this.form.value.hasOwnProperty(key)) {
+        this.multiPartForm.append(key, this.form.value[key]);
+      }
+    }
 
-    this.multiPartForm.append(
-      'userAddress',
-      JSON.stringify({
-        countryId: this.form.get('countryId')?.value,
-        cityId: 1,
-        postalCode: this.form.get('postalCode')?.value,
-        addressDesc: this.form.get('addressDesc')?.value,
-      })
-    );
+    // this.multiPartForm.append(
+    //   'userAddress',
+    //   JSON.stringify({
+    //     countryId: this.form.get('countryId')?.value,
+    //     cityId: 1,
+    //     postalCode: this.form.get('postalCode')?.value,
+    //     addressDesc: this.form.get('addressDesc')?.value,
+    //   })
+    // );
 
     this.authService
       .addEmployee(this.multiPartForm)