From b4e9e7841f0bb5b0c6da181135315ae20064f050 Mon Sep 17 00:00:00 2001 From: Tyagi-Sunny Date: Mon, 6 Jan 2025 14:49:13 +0530 Subject: [PATCH] feat(arc-saas): add communication mail in user data add communication mail in user data gh-0 --- .../tenant-registration.component.html | 273 ++++++------------ .../tenant-registration.component.ts | 46 +-- .../add-lead/add-lead.component.html | 177 ++++-------- .../components/add-lead/add-lead.component.ts | 30 +- .../src/app/shared/models/tenantLead.model.ts | 1 + 5 files changed, 195 insertions(+), 332 deletions(-) diff --git a/projects/saas-ui/src/app/main/components/tenant-registration/tenant-registration.component.html b/projects/saas-ui/src/app/main/components/tenant-registration/tenant-registration.component.html index 28b70ce..602b11e 100644 --- a/projects/saas-ui/src/app/main/components/tenant-registration/tenant-registration.component.html +++ b/projects/saas-ui/src/app/main/components/tenant-registration/tenant-registration.component.html @@ -13,26 +13,15 @@

Tenant Registration

- - + +
-
+ "> First Name must contain only characters.
@@ -44,26 +33,15 @@

Tenant Registration

- - + +
-
+ "> Last Name must contain only characters.
@@ -75,18 +53,9 @@

Tenant Registration

- - + +
@@ -98,42 +67,54 @@

Tenant Registration

- - + +
-
+ "> Email is required.
-
+ "> Invalid email format.
+ + +
+
+ Communication Email +
+
+
+ + +
+
+
+ + Use Email as Communication Email + +
+
+ Invalid email format. +
+
+
@@ -141,13 +122,8 @@

Tenant Registration

- +
@@ -158,31 +134,20 @@

Tenant Registration

- +
-
+ "> Zip code should only contain numbers.
-
+ "> Maximum length exceeded.
@@ -192,16 +157,9 @@

Tenant Registration

Country *
- - + + {{ option.label }} @@ -212,49 +170,31 @@

Tenant Registration

- Application Sub-Domain * + Application Sub-Domain *
- - + +
-
+ "> Sub-domain is required.
-
+ "> Maximum length exceeded.
-
+ "> Invalid characters used.
@@ -266,16 +206,9 @@

Tenant Registration

Payment Method *
- - + + {{ method | titlecase }} @@ -288,13 +221,8 @@

Tenant Registration

Payment Details
- +
@@ -304,31 +232,18 @@

Tenant Registration

Subscription Plan

- +
{{ plan.name }}
- +

{{ plan.description }}

{{ plan.tier }} - +

@@ -338,11 +253,7 @@

{{ plan.name }}
@@ -354,24 +265,12 @@
{{ plan.name }}
- -
@@ -382,4 +281,4 @@
{{ plan.name }}
- + \ No newline at end of file diff --git a/projects/saas-ui/src/app/main/components/tenant-registration/tenant-registration.component.ts b/projects/saas-ui/src/app/main/components/tenant-registration/tenant-registration.component.ts index e3d4f6a..ffd162f 100644 --- a/projects/saas-ui/src/app/main/components/tenant-registration/tenant-registration.component.ts +++ b/projects/saas-ui/src/app/main/components/tenant-registration/tenant-registration.component.ts @@ -1,4 +1,4 @@ -import {Component} from '@angular/core'; +import { Component } from '@angular/core'; import { FormGroup, FormBuilder, @@ -6,17 +6,17 @@ import { AbstractControl, ValidatorFn, } from '@angular/forms'; -import {ActivatedRoute, Router} from '@angular/router'; -import {NbToastrService} from '@nebular/theme'; -import {Location} from '@angular/common'; -import {BillingPlanService, OnBoardingService} from '../../../shared/services'; -import {AnyObject} from '@project-lib/core/api/backend-filter'; +import { ActivatedRoute, Router } from '@angular/router'; +import { NbToastrService } from '@nebular/theme'; +import { Location } from '@angular/common'; +import { BillingPlanService, OnBoardingService } from '../../../shared/services'; +import { AnyObject } from '@project-lib/core/api/backend-filter'; import { TenantLead, TenantLeadWithPaymentMethod, } from '../../../shared/models/tenantLead.model'; -import {keyValidator} from '@project-lib/core/validators'; -import {COUNTRIES} from '../../../shared/constants/countries.constant'; +import { keyValidator } from '@project-lib/core/validators'; +import { COUNTRIES } from '../../../shared/constants/countries.constant'; export enum PaymentMethod { Cash = 'cash', @@ -37,7 +37,6 @@ export class TenantRegistrationComponent { subscriptionPlans: AnyObject[]; leadId = ''; countryOptions = COUNTRIES; - isSubmitting = false; constructor( private route: ActivatedRoute, @@ -61,6 +60,7 @@ export class TenantRegistrationComponent { ], name: ['', [Validators.required]], // for company name email: ['', [Validators.required, Validators.email]], + communicationEmail: ['', [Validators.email]], // Add communicationEmail field address: [''], country: ['', [Validators.required]], zip: ['', [Validators.pattern('^[0-9]+$'), Validators.maxLength(9)]], @@ -77,20 +77,20 @@ export class TenantRegistrationComponent { paymentMethod: ['', Validators.required], comment: [''], }, - {validators: this.emailDomainMatchValidator}, + { validators: this.emailDomainMatchValidator }, ); } paymentMethods = Object.values(PaymentMethod); // Use Object.values() to get the enum values - emailDomainMatchValidator(group: FormGroup): {[key: string]: boolean} | null { + emailDomainMatchValidator(group: FormGroup): { [key: string]: boolean } | null { const email = group.get('email').value; const domain = group.get('domains').value; if (email && domain) { const emailDomain = email.substring(email.lastIndexOf('@') + 1); if (emailDomain !== domain) { - return {domainMismatch: true}; + return { domainMismatch: true }; } } return null; @@ -98,11 +98,11 @@ export class TenantRegistrationComponent { ngOnInit() { this.getRadioOptions(); - this.route.params.subscribe(params => { + this.route.params.subscribe((params) => { this.leadId = params['leadId']; }); // for automatically writing domain name from email - this.tenantRegForm.get('email').valueChanges.subscribe(email => { + this.tenantRegForm.get('email').valueChanges.subscribe((email) => { const emailDomain = email?.substring(email.lastIndexOf('@') + 1); if (emailDomain) { this.tenantRegForm.get('domains').setValue(emailDomain); @@ -111,7 +111,7 @@ export class TenantRegistrationComponent { } getRadioOptions() { - this.billingPlanService.getPlanOptions().subscribe(res => { + this.billingPlanService.getPlanOptions().subscribe((res) => { this.subscriptionPlans = res; }); } @@ -120,9 +120,18 @@ export class TenantRegistrationComponent { this.router.navigate(['main/onboard-tenant-list']); } + onCommunicationEmailCheckboxChange(event: boolean) { + if (event) { + this.tenantRegForm + .get('communicationEmail') + .setValue(this.tenantRegForm.get('email').value); + } else { + this.tenantRegForm.get('communicationEmail').setValue(''); + } + } + onSubmit() { if (this.tenantRegForm.valid) { - this.isSubmitting = true; const userData = this.tenantRegForm.value; const user: TenantLeadWithPaymentMethod = { name: userData.name, @@ -131,6 +140,7 @@ export class TenantRegistrationComponent { lastName: userData.lastName, email: userData.email, isPrimary: true, + communicationEmail: userData.communicationEmail, // Include communicationEmail }, address: userData.address, zip: userData.zip, @@ -152,8 +162,8 @@ export class TenantRegistrationComponent { 'Unable register tenant. Please check your input and try again.', 'Failure', ); - }, + } ); } } -} +} \ No newline at end of file diff --git a/projects/saas-ui/src/app/on-boarding/components/add-lead/add-lead.component.html b/projects/saas-ui/src/app/on-boarding/components/add-lead/add-lead.component.html index d76913e..2b4c01b 100644 --- a/projects/saas-ui/src/app/on-boarding/components/add-lead/add-lead.component.html +++ b/projects/saas-ui/src/app/on-boarding/components/add-lead/add-lead.component.html @@ -15,26 +15,15 @@

Signup to ARC-SaaS

- - + +
-
+ "> First Name must contain only characters.
@@ -46,26 +35,14 @@

Signup to ARC-SaaS

- - + +
-
+ "> Last Name must contain only characters.
@@ -77,18 +54,9 @@

Signup to ARC-SaaS

- - + +
@@ -100,43 +68,53 @@

Signup to ARC-SaaS

- - + +
-
+ "> Email is required.
-
+ "> Invalid email format.
+ +
+
+ Communication Email +
+
+
+ + +
+
+
+ + Use Email as Communication Email + +
+
+ Invalid email format. +
+
+
@@ -144,13 +122,8 @@

Signup to ARC-SaaS

- +
@@ -161,31 +134,19 @@

Signup to ARC-SaaS

- +
-
+ "> Zip code should only contain numbers.
-
+ "> Maximum length exceeded.
@@ -196,16 +157,9 @@

Signup to ARC-SaaS

Country *
- - + + {{ option.label }} @@ -215,21 +169,10 @@

Signup to ARC-SaaS

- -
@@ -237,4 +180,4 @@

Signup to ARC-SaaS

- + \ No newline at end of file diff --git a/projects/saas-ui/src/app/on-boarding/components/add-lead/add-lead.component.ts b/projects/saas-ui/src/app/on-boarding/components/add-lead/add-lead.component.ts index 8d3e5ed..6b732b6 100644 --- a/projects/saas-ui/src/app/on-boarding/components/add-lead/add-lead.component.ts +++ b/projects/saas-ui/src/app/on-boarding/components/add-lead/add-lead.component.ts @@ -1,12 +1,10 @@ -import {Component} from '@angular/core'; -import {ActivatedRoute, Router} from '@angular/router'; -import {NbToastrService} from '@nebular/theme'; -import {Location} from '@angular/common'; -import {FormBuilder, FormGroup, Validators} from '@angular/forms'; -import {OnBoardingService} from '../../../shared/services/on-boarding-service'; -import {id} from 'date-fns/locale'; -import {verifyHostBindings} from '@angular/compiler'; -import {COUNTRIES} from '../../../shared/constants/countries.constant'; +import { Component } from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; +import { NbToastrService } from '@nebular/theme'; +import { Location } from '@angular/common'; +import { FormBuilder, FormGroup, Validators } from '@angular/forms'; +import { OnBoardingService } from '../../../shared/services/on-boarding-service'; +import { COUNTRIES } from '../../../shared/constants/countries.constant'; @Component({ selector: 'app-add-lead', @@ -33,6 +31,7 @@ export class AddLeadComponent { address: [''], zip: ['', [Validators.pattern('^[0-9]+$'), Validators.maxLength(9)]], country: ['', [Validators.required, Validators.pattern('^[a-zA-Z]+$')]], + communicationEmail: ['', [Validators.email]], // Add communicationEmail field }); } @@ -40,6 +39,16 @@ export class AddLeadComponent { this.router.navigate(['auth/login']); } + onCommunicationEmailCheckboxChange(event: boolean) { + if (event) { + this.addLeadForm + .get('communicationEmail') + .setValue(this.addLeadForm.get('email').value); + } else { + this.addLeadForm.get('communicationEmail').setValue(''); + } + } + onSubmit() { if (this.addLeadForm.valid) { const userData = this.addLeadForm.value; @@ -53,6 +62,7 @@ export class AddLeadComponent { zip: userData.zip, country: userData.country, }, + communicationEmail: userData.communicationEmail, // Include communicationEmail }; this.onBoardingService.addLead(user).subscribe( () => { @@ -68,4 +78,4 @@ export class AddLeadComponent { ); } } -} +} \ No newline at end of file diff --git a/projects/saas-ui/src/app/shared/models/tenantLead.model.ts b/projects/saas-ui/src/app/shared/models/tenantLead.model.ts index 0b6c1e4..c8e3c67 100644 --- a/projects/saas-ui/src/app/shared/models/tenantLead.model.ts +++ b/projects/saas-ui/src/app/shared/models/tenantLead.model.ts @@ -5,6 +5,7 @@ export class TenantLead { lastName?: string; email?: string; isPrimary?: boolean; + communicationEmail?: string; }; address?: string; city?: string;