From 22f671dddba4af82d2d5d050306f4e8f7b7f6469 Mon Sep 17 00:00:00 2001 From: Anish Kr Singh <116036738+anishfyle@users.noreply.github.com> Date: Wed, 28 Aug 2024 12:06:09 +0530 Subject: [PATCH] fix: advanced settings validators (#929) * fix: advanced settings validators * !== * fix for qbo * fix for netsuite * [isFieldMandatory] * [mandatoryErrorListName]="'payment account'" --- .../netsuite-advanced-settings.model.ts | 6 +++--- .../qbo/qbo-configuration/qbo-advanced-setting.model.ts | 2 +- .../netsuite-advanced-settings.component.html | 2 ++ 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/app/core/models/netsuite/netsuite-configuration/netsuite-advanced-settings.model.ts b/src/app/core/models/netsuite/netsuite-configuration/netsuite-advanced-settings.model.ts index 7dbcbfb69..99ec7f324 100644 --- a/src/app/core/models/netsuite/netsuite-configuration/netsuite-advanced-settings.model.ts +++ b/src/app/core/models/netsuite/netsuite-configuration/netsuite-advanced-settings.model.ts @@ -1,7 +1,7 @@ import { FormControl, FormGroup } from "@angular/forms"; import { EmailOption, SelectFormOption } from "../../common/select-form-option.model"; import { DefaultDestinationAttribute } from "../../db/destination-attribute.model"; -import { NetsuiteDefaultLevelOptions, NetsuitePaymentSyncDirection, QBOPaymentSyncDirection } from "../../enum/enum.model"; +import { NetsuiteDefaultLevelOptions, NetsuitePaymentSyncDirection, PaymentSyncDirection } from "../../enum/enum.model"; import { AdvancedSettingValidatorRule, AdvancedSettingsModel } from "../../common/advanced-settings.model"; import { HelperUtility } from "../../common/helper.model"; import { brandingConfig } from "src/app/branding/branding-config"; @@ -101,7 +101,7 @@ export class NetsuiteAdvancedSettingModel extends HelperUtility { static getValidators(): AdvancedSettingValidatorRule { return { - paymentSync: 'billPaymentAccount', + paymentSync: 'paymentAccount', exportSchedule: 'exportScheduleFrequency' }; } @@ -112,7 +112,7 @@ export class NetsuiteAdvancedSettingModel extends HelperUtility { Object.values(validatorRule).forEach((value, index) => { form.controls[keys[index]].valueChanges.subscribe((selectedValue) => { - if (selectedValue) { + if (selectedValue && ((keys[index] === 'paymentSync' && selectedValue === NetsuitePaymentSyncDirection.FYLE_TO_NETSUITE) || (keys[index] !== 'paymentSync'))) { this.markControllerAsRequired(form, value); } else { this.clearValidatorAndResetValue(form, value); diff --git a/src/app/core/models/qbo/qbo-configuration/qbo-advanced-setting.model.ts b/src/app/core/models/qbo/qbo-configuration/qbo-advanced-setting.model.ts index 5e1248b47..4298b21e1 100644 --- a/src/app/core/models/qbo/qbo-configuration/qbo-advanced-setting.model.ts +++ b/src/app/core/models/qbo/qbo-configuration/qbo-advanced-setting.model.ts @@ -83,7 +83,7 @@ export class QBOAdvancedSettingModel extends HelperUtility { Object.values(validatorRule).forEach((value, index) => { form.controls[keys[index]].valueChanges.subscribe((selectedValue) => { - if (selectedValue) { + if (selectedValue && ((keys[index] === 'paymentSync' && selectedValue === QBOPaymentSyncDirection.FYLE_TO_QBO) || (keys[index] !== 'paymentSync'))) { this.markControllerAsRequired(form, value); } else { this.clearValidatorAndResetValue(form, value); diff --git a/src/app/integrations/netsuite/netsuite-shared/netsuite-advanced-settings/netsuite-advanced-settings.component.html b/src/app/integrations/netsuite/netsuite-shared/netsuite-advanced-settings/netsuite-advanced-settings.component.html index 2d7170667..721f4dd75 100644 --- a/src/app/integrations/netsuite/netsuite-shared/netsuite-advanced-settings/netsuite-advanced-settings.component.html +++ b/src/app/integrations/netsuite/netsuite-shared/netsuite-advanced-settings/netsuite-advanced-settings.component.html @@ -60,6 +60,8 @@