From fe8f02d66941ef23e7930559272399436aeee47e Mon Sep 17 00:00:00 2001 From: aastha Date: Thu, 2 Jan 2025 11:04:50 +0530 Subject: [PATCH] Minor --- ...nboarding-connect-card-step.component.html | 5 ++- ...-onboarding-connect-card-step.component.ts | 35 +++---------------- .../spender-onboarding.module.ts | 4 +++ .../spender-onboarding.page.ts | 4 +++ 4 files changed, 16 insertions(+), 32 deletions(-) diff --git a/src/app/fyle/spender-onboarding/spender-onboarding-connect-card-step/spender-onboarding-connect-card-step.component.html b/src/app/fyle/spender-onboarding/spender-onboarding-connect-card-step/spender-onboarding-connect-card-step.component.html index 7e2b8dce58..0ef099030a 100644 --- a/src/app/fyle/spender-onboarding/spender-onboarding-connect-card-step/spender-onboarding-connect-card-step.component.html +++ b/src/app/fyle/spender-onboarding/spender-onboarding-connect-card-step/spender-onboarding-connect-card-step.component.html @@ -22,6 +22,7 @@ 0) { this.cardValuesMap[card.id].card_type = this.realTimeFeedService.getCardTypeFromNumber( this.fg.controls[`card_number_${card.id}`].value as string @@ -236,23 +220,12 @@ export class SpenderOnboardingConnectCardStepComponent implements OnInit, OnChan } } - formatCardNumber(input: AbstractControl): void { - // Remove all non-numeric characters - let value = (input.value as string).replace(/\D/g, ''); - - // Format the value in groups of 4 - value = value.replace(/(\d{4})(?=\d)/g, '$1 '); - - // Set the formatted value back to the input - input.setValue(value); - } - private cardNumberValidator(control: AbstractControl): ValidationErrors { // Reactive forms are not strongly typed in Angular 13, so we need to cast the value to string // TODO (Angular 14 >): Remove the type casting and directly use string type for the form control const cardNumber = control.value as string; - const isValid = this.realTimeFeedService.isCardNumberValid(cardNumber); + const isValid = this.realTimeFeedService.isCardNumberValid(cardNumber.replace(/ /g, '')); const cardType = this.realTimeFeedService.getCardTypeFromNumber(cardNumber); if (cardType === CardNetworkType.VISA || cardType === CardNetworkType.MASTERCARD) { diff --git a/src/app/fyle/spender-onboarding/spender-onboarding.module.ts b/src/app/fyle/spender-onboarding/spender-onboarding.module.ts index b1b3b09128..935cc77298 100644 --- a/src/app/fyle/spender-onboarding/spender-onboarding.module.ts +++ b/src/app/fyle/spender-onboarding/spender-onboarding.module.ts @@ -7,6 +7,7 @@ import { CommonModule } from '@angular/common'; import { SpenderOnboardingRoutingModule } from './spender-onboarding-routing.module'; import { MatButtonModule } from '@angular/material/button'; import { SpenderOnboardingConnectCardStepComponent } from './spender-onboarding-connect-card-step/spender-onboarding-connect-card-step.component'; +import { NgxMaskModule } from 'ngx-mask'; @NgModule({ imports: [ @@ -18,6 +19,9 @@ import { SpenderOnboardingConnectCardStepComponent } from './spender-onboarding- SpenderOnboardingRoutingModule, FormsModule, ReactiveFormsModule, + NgxMaskModule.forRoot({ + validation: false, + }), ], declarations: [SpenderOnboardingPage, SpenderOnboardingConnectCardStepComponent], }) diff --git a/src/app/fyle/spender-onboarding/spender-onboarding.page.ts b/src/app/fyle/spender-onboarding/spender-onboarding.page.ts index 2d60dafc73..6f45327426 100644 --- a/src/app/fyle/spender-onboarding/spender-onboarding.page.ts +++ b/src/app/fyle/spender-onboarding/spender-onboarding.page.ts @@ -8,6 +8,7 @@ import { SpenderOnboardingService } from 'src/app/core/services/spender-onboardi import { OrgSettingsService } from 'src/app/core/services/org-settings.service'; import { Router } from '@angular/router'; import { CorporateCreditCardExpenseService } from 'src/app/core/services/corporate-credit-card-expense.service'; +import { OrgSettings } from 'src/app/core/models/org-settings.model'; @Component({ selector: 'app-spender-onboarding', @@ -25,6 +26,8 @@ export class SpenderOnboardingPage { onboardingStep: typeof OnboardingStep = OnboardingStep; + orgSettings: OrgSettings; + constructor( private loaderService: LoaderService, private orgUserService: OrgUserService, @@ -48,6 +51,7 @@ export class SpenderOnboardingPage { ), map(([eou, orgSettings, onboardingStatus, corporateCards]) => { this.userFullName = eou.us.full_name; + this.orgSettings = orgSettings; const isRtfEnabled = orgSettings.visa_enrollment_settings.enabled && orgSettings.mastercard_enrollment_settings.enabled; const isAmexFeedEnabled = orgSettings.amex_feed_enrollment_settings.enabled;