From 40759a3f31896d5b52b8f9ba9008dea053a5eb63 Mon Sep 17 00:00:00 2001
From: Dhaarani <55541808+DhaaraniCIT@users.noreply.github.com>
Date: Wed, 4 Sep 2024 14:20:17 +0530
Subject: [PATCH] qbo prepend code changes (#933)
* qbo prepend code changes
---
.../qbo-import-setting.model.ts | 9 ++++----
.../core/services/common/mapping.service.ts | 2 +-
.../qbo-dashboard.component.html | 1 +
.../qbo-dashboard/qbo-dashboard.component.ts | 2 +-
.../qbo-base-mapping.component.html | 1 +
.../qbo-base-mapping.component.ts | 5 +++-
.../qbo-clone-settings.component.html | 4 ++--
.../qbo-clone-settings.component.ts | 23 +++++++++----------
.../qbo-export-settings.component.html | 6 +++++
.../qbo-export-settings.component.ts | 4 ++++
.../qbo-import-settings.component.html | 6 ++---
.../qbo-import-settings.component.ts | 19 ++++++++-------
.../configuration-import-field.component.html | 6 ++---
13 files changed, 50 insertions(+), 38 deletions(-)
diff --git a/src/app/core/models/qbo/qbo-configuration/qbo-import-setting.model.ts b/src/app/core/models/qbo/qbo-configuration/qbo-import-setting.model.ts
index a1aff99bf..97b7bf108 100644
--- a/src/app/core/models/qbo/qbo-configuration/qbo-import-setting.model.ts
+++ b/src/app/core/models/qbo/qbo-configuration/qbo-import-setting.model.ts
@@ -10,7 +10,7 @@ export type QBOImportSettingWorkspaceGeneralSetting = {
import_vendors_as_merchants: boolean,
charts_of_accounts: string[],
import_tax_codes: boolean,
- import_code_fields?: string[]
+ import_code_fields: string[]
}
export type QBOImportSettingGeneralMapping = {
@@ -54,8 +54,7 @@ export class QBOImportSettingModel extends ImportSettingsModel {
defaultTaxCode: new FormControl(importSettings?.general_mappings?.default_tax_code?.id ? importSettings.general_mappings.default_tax_code : null),
searchOption: new FormControl(''),
importCodeFields: new FormControl( importSettings?.workspace_general_settings?.import_code_fields ? importSettings.workspace_general_settings.import_code_fields : null),
- // ImportCategoryCode: new FormControl(this.getImportCodeField(importCode, 'ACCOUNT', qboImportCodeFieldCodeConfig))
- importCategoryCode: new FormControl(null)
+ importCategoryCode: new FormControl(this.getImportCodeField(importCode, 'ACCOUNT', qboImportCodeFieldCodeConfig))
});
}
@@ -70,8 +69,8 @@ export class QBOImportSettingModel extends ImportSettingsModel {
import_items: importSettingsForm.get('importItems')?.value,
charts_of_accounts: importSettingsForm.get('chartOfAccountTypes')?.value,
import_tax_codes: importSettingsForm.get('taxCode')?.value,
- import_vendors_as_merchants: importSettingsForm.get('importVendorsAsMerchants')?.value
- // Import_code_fields: importSettingsForm.get('importCodeFields')?.value
+ import_vendors_as_merchants: importSettingsForm.get('importVendorsAsMerchants')?.value,
+ import_code_fields: importSettingsForm.get('importCodeFields')?.value
},
mapping_settings: mappingSettings,
general_mappings: {
diff --git a/src/app/core/services/common/mapping.service.ts b/src/app/core/services/common/mapping.service.ts
index 5eb2ddef5..3288a0e40 100644
--- a/src/app/core/services/common/mapping.service.ts
+++ b/src/app/core/services/common/mapping.service.ts
@@ -180,7 +180,7 @@ export class MappingService {
};
if (value) {
- if (appName && ([AppName.SAGE300] as string[]).includes(appName)) {
+ if (appName && ([AppName.SAGE300, AppName.QBO] as string[]).includes(appName)) {
params.value = value;
} else {
params.value__icontains = value;
diff --git a/src/app/integrations/qbo/qbo-main/qbo-dashboard/qbo-dashboard.component.html b/src/app/integrations/qbo/qbo-main/qbo-dashboard/qbo-dashboard.component.html
index ba4d04684..eba043740 100644
--- a/src/app/integrations/qbo/qbo-main/qbo-dashboard/qbo-dashboard.component.html
+++ b/src/app/integrations/qbo/qbo-main/qbo-dashboard/qbo-dashboard.component.html
@@ -42,6 +42,7 @@
[isCategoryMappingGeneric]="true"
[isImportItemsEnabled]="isImportItemsEnabled"
[destinationOptionsVersion]="'v1'"
+ [importCodeFields]="importCodeFields"
[errorsVersion]="'v1'">
diff --git a/src/app/integrations/qbo/qbo-main/qbo-dashboard/qbo-dashboard.component.ts b/src/app/integrations/qbo/qbo-main/qbo-dashboard/qbo-dashboard.component.ts
index bda7c3d92..7da93d238 100644
--- a/src/app/integrations/qbo/qbo-main/qbo-dashboard/qbo-dashboard.component.ts
+++ b/src/app/integrations/qbo/qbo-main/qbo-dashboard/qbo-dashboard.component.ts
@@ -142,7 +142,7 @@ export class QboDashboardComponent implements OnInit {
this.isLoading = false;
- this.importCodeFields = responses[6].workspace_general_settings?.import_code_fields;
+ this.importCodeFields = responses[6].workspace_general_settings.import_code_fields;
const queuedTasks: QBOTaskLog[] = responses[2].results.filter((task: QBOTaskLog) => task.status === TaskLogState.ENQUEUED || task.status === TaskLogState.IN_PROGRESS);
this.failedExpenseGroupCount = responses[2].results.filter((task: QBOTaskLog) => task.status === TaskLogState.FAILED || task.status === TaskLogState.FATAL).length;
diff --git a/src/app/integrations/qbo/qbo-main/qbo-mapping/qbo-base-mapping/qbo-base-mapping.component.html b/src/app/integrations/qbo/qbo-main/qbo-mapping/qbo-base-mapping/qbo-base-mapping.component.html
index 3f96e4bb3..216b0bdb2 100644
--- a/src/app/integrations/qbo/qbo-main/qbo-mapping/qbo-base-mapping/qbo-base-mapping.component.html
+++ b/src/app/integrations/qbo/qbo-main/qbo-mapping/qbo-base-mapping/qbo-base-mapping.component.html
@@ -8,5 +8,6 @@
[appName]="AppName.QBO"
[isCategoryMappingGeneric]="sourceField === FyleField.CATEGORY ? true : false"
[displayName]="displayName"
+ [isMultiLineOption]="sourceField === FyleField.CATEGORY && brandingConfig.brandId !== 'co' ? true : false"
(triggerAutoMapEmployee)="triggerAutoMapEmployees()">
diff --git a/src/app/integrations/qbo/qbo-main/qbo-mapping/qbo-base-mapping/qbo-base-mapping.component.ts b/src/app/integrations/qbo/qbo-main/qbo-mapping/qbo-base-mapping/qbo-base-mapping.component.ts
index c71be0c1c..b9a067332 100644
--- a/src/app/integrations/qbo/qbo-main/qbo-mapping/qbo-base-mapping/qbo-base-mapping.component.ts
+++ b/src/app/integrations/qbo/qbo-main/qbo-mapping/qbo-base-mapping/qbo-base-mapping.component.ts
@@ -1,6 +1,7 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { forkJoin } from 'rxjs';
+import { brandingConfig } from 'src/app/branding/branding-config';
import { DestinationAttribute } from 'src/app/core/models/db/destination-attribute.model';
import { MappingSetting } from 'src/app/core/models/db/mapping-setting.model';
import { AccountingDisplayName, AccountingField, AppName, FyleField, QBOCorporateCreditCardExpensesObject, QBOReimbursableExpensesObject, ToastSeverity } from 'src/app/core/models/enum/enum.model';
@@ -41,6 +42,8 @@ export class QboBaseMappingComponent implements OnInit {
isMultiLineOption: boolean;
+ brandingConfig = brandingConfig;
+
constructor(
private route: ActivatedRoute,
private mappingService: MappingService,
@@ -84,7 +87,7 @@ export class QboBaseMappingComponent implements OnInit {
this.destinationField = this.getDestinationField(responses[0], responses[1].results);
- // This.isMultiLineOption = responses[2].workspace_general_settings.import_code_fields?.includes(this.destinationField);
+ this.isMultiLineOption = responses[2].workspace_general_settings.import_code_fields?.includes(this.destinationField);
if (this.destinationField === AccountingField.ACCOUNT) {
this.displayName = responses[0].import_items ? `${AccountingDisplayName.ITEM},${AccountingDisplayName.ACCOUNT}` : AccountingDisplayName.ACCOUNT;
diff --git a/src/app/integrations/qbo/qbo-onboarding/qbo-clone-settings/qbo-clone-settings.component.html b/src/app/integrations/qbo/qbo-onboarding/qbo-clone-settings/qbo-clone-settings.component.html
index 4ad329515..349c78d3c 100644
--- a/src/app/integrations/qbo/qbo-onboarding/qbo-clone-settings/qbo-clone-settings.component.html
+++ b/src/app/integrations/qbo/qbo-onboarding/qbo-clone-settings/qbo-clone-settings.component.html
@@ -311,7 +311,7 @@
[tooltipText]="'By default expense will be selected. Open the dropdown to select more as per your requirements'">
-
+
diff --git a/src/app/integrations/qbo/qbo-onboarding/qbo-clone-settings/qbo-clone-settings.component.ts b/src/app/integrations/qbo/qbo-onboarding/qbo-clone-settings/qbo-clone-settings.component.ts
index cf627096d..d11b1f590 100644
--- a/src/app/integrations/qbo/qbo-onboarding/qbo-clone-settings/qbo-clone-settings.component.ts
+++ b/src/app/integrations/qbo/qbo-onboarding/qbo-clone-settings/qbo-clone-settings.component.ts
@@ -359,11 +359,10 @@ export class QboCloneSettingsComponent implements OnInit {
if (!isImportCategoriesEnabled) {
this.importSettingForm.controls.chartOfAccountTypes.setValue(['Expense']);
this.importSettingForm.controls.importCategoryCode.clearValidators();
- // This.importSettingForm.controls.importCategoryCode.setValue(ImportSettingsModel.getImportCodeField(this.cloneSetting.import_settings.workspace_general_settings.import_code_fields, DefaultImportFields.ACCOUNT, this.cloneQboImportCodeFieldCodeConfig));
+ this.importSettingForm.controls.importCategoryCode.setValue(ImportSettingsModel.getImportCodeField(this.cloneSetting.import_settings.workspace_general_settings.import_code_fields, DefaultImportFields.ACCOUNT, this.cloneQboImportCodeFieldCodeConfig));
+ } if (isImportCategoriesEnabled) {
+ this.helperService.markControllerAsRequired(this.importSettingForm, 'importCategoryCode');
}
- // If (isImportCategoriesEnabled) {
- // This.helperService.markControllerAsRequired(this.importSettingForm, 'importCategoryCode');
- // }
});
}
@@ -434,14 +433,14 @@ export class QboCloneSettingsComponent implements OnInit {
this.mappingService.getFyleFields('v1'),
this.qboConnectorService.getQBOCredentials(),
this.configurationService.getAdditionalEmails(),
- this.qboImportSettingsService.getQBOFields()
- // This.qboImportSettingsService.getImportCodeFieldConfig()
- ]).subscribe(([cloneSetting, destinationAttributes, fyleFieldsResponse, qboCredentials, adminEmails, qboFields]) => {
+ this.qboImportSettingsService.getQBOFields(),
+ this.qboImportSettingsService.getImportCodeFieldConfig()
+ ]).subscribe(([cloneSetting, destinationAttributes, fyleFieldsResponse, qboCredentials, adminEmails, qboFields, qboImportCodeFieldCodeConfig]) => {
const workspaceId = +this.workspaceService.getWorkspaceId();
this.workspaceService.setWorkspaceId(cloneSetting.workspace_id);
- // This.qboImportSettingsService.getImportCodeFieldConfig().subscribe((cloneQboImportCodeFieldCodeConfig) => {
+ this.qboImportSettingsService.getImportCodeFieldConfig().subscribe((cloneQboImportCodeFieldCodeConfig) => {
this.cloneSetting = cloneSetting;
this.workspaceService.setWorkspaceId(workspaceId);
@@ -488,9 +487,9 @@ export class QboCloneSettingsComponent implements OnInit {
if (qboCredentials && qboCredentials.country !== 'US') {
this.isTaxGroupSyncAllowed = true;
}
- // This.qboImportCodeFieldCodeConfig = qboImportCodeFieldCodeConfig;
- // This.cloneQboImportCodeFieldCodeConfig = cloneQboImportCodeFieldCodeConfig;
- this.importSettingForm = QBOImportSettingModel.mapAPIResponseToFormGroup(cloneSetting.import_settings, this.qboFields, this.cloneQboImportCodeFieldCodeConfig);
+ this.qboImportCodeFieldCodeConfig = qboImportCodeFieldCodeConfig;
+ this.cloneQboImportCodeFieldCodeConfig = cloneQboImportCodeFieldCodeConfig;
+ this.importSettingForm = QBOImportSettingModel.mapAPIResponseToFormGroup(cloneSetting.import_settings, this.qboFields, cloneQboImportCodeFieldCodeConfig);
this.fyleFields = fyleFieldsResponse;
this.fyleFields.push({ attribute_type: 'custom_field', display_name: 'Create a Custom Field', is_dependent: false });
this.setupImportSettingFormWatcher();
@@ -509,7 +508,7 @@ export class QboCloneSettingsComponent implements OnInit {
this.isLoading = false;
});
- // });
+ });
}
ngOnInit(): void {
diff --git a/src/app/integrations/qbo/qbo-shared/qbo-export-settings/qbo-export-settings.component.html b/src/app/integrations/qbo/qbo-shared/qbo-export-settings/qbo-export-settings.component.html
index 04174de18..0d6ad11b9 100644
--- a/src/app/integrations/qbo/qbo-shared/qbo-export-settings/qbo-export-settings.component.html
+++ b/src/app/integrations/qbo/qbo-shared/qbo-export-settings/qbo-export-settings.component.html
@@ -55,6 +55,7 @@
(searchOptionsDropdown)="searchOptionsDropdown($event)"
[optionLabel]="'name'"
[iconPath]="'list'"
+ [isMultiLineOption]="isMultilineOption"
[placeholder]="'Select bank account'"
[formControllerName]="'bankAccount'">
@@ -74,6 +75,7 @@
(searchOptionsDropdown)="searchOptionsDropdown($event)"
[optionLabel]="'name'"
[iconPath]="'list'"
+ [isMultiLineOption]="isMultilineOption"
[placeholder]="'Select Expense Account'"
[formControllerName]="'qboExpenseAccount'">
@@ -94,6 +96,7 @@
[subLabel]="'The integration will post the offset credit entry in ' + (exportSettingForm.value.reimbursableExportType | snakeCaseToSpaceCase | titlecase) + ' to the selected accounts payable account.'"
[iconPath]="'list'"
[placeholder]="'Select accounts payable'"
+ [isMultiLineOption]="isMultilineOption"
[formControllerName]="'accountsPayable'">
@@ -202,6 +205,7 @@
[label]="brandingContent.corporateCard.defaultCCCAccountLabel"
[subLabel]="'Post all your company corporate card transactions to a default credit card account.'"
[placeholder]="brandingContent.corporateCard.defaultCCCAccountPlaceholder"
+ [isMultiLineOption]="isMultilineOption"
[formControllerName]="'defaultCCCAccount'">
@@ -221,6 +225,7 @@
[label]="brandingContent.corporateCard.defaultDebitCardAccountLabel"
[subLabel]="'Post all your company debit card transactions to a default debit card account.'"
[placeholder]="brandingContent.corporateCard.defaultDebitCardAccountPlaceholder"
+ [isMultiLineOption]="isMultilineOption"
[formControllerName]="'defaultDebitCardAccount'">
@@ -259,6 +264,7 @@
[label]="brandingContent.corporateCard.accountsPayableLabel + (exportSettingForm.value.creditCardExportType | snakeCaseToSpaceCase | titlecase) + ' be posted to?'"
[subLabel]="'The integration will post the offset credit entry in ' + (exportSettingForm.value.creditCardExportType | snakeCaseToSpaceCase | titlecase) + brandingContent.corporateCard.accountsPayableSubLabel"
[placeholder]="'Select accounts payable'"
+ [isMultiLineOption]="isMultilineOption"
[formControllerName]="'accountsPayable'">
diff --git a/src/app/integrations/qbo/qbo-shared/qbo-export-settings/qbo-export-settings.component.ts b/src/app/integrations/qbo/qbo-shared/qbo-export-settings/qbo-export-settings.component.ts
index f086f9c35..a91eecc1e 100644
--- a/src/app/integrations/qbo/qbo-shared/qbo-export-settings/qbo-export-settings.component.ts
+++ b/src/app/integrations/qbo/qbo-shared/qbo-export-settings/qbo-export-settings.component.ts
@@ -113,6 +113,8 @@ export class QboExportSettingsComponent implements OnInit {
readonly brandingContent = brandingContent.configuration.exportSetting;
+ isMultilineOption: boolean;
+
constructor(
private exportSettingService: QboExportSettingsService,
public helperService: HelperService,
@@ -448,6 +450,8 @@ export class QboExportSettingsComponent implements OnInit {
this.helperService.setOrClearValidators(this.exportSettings.workspace_general_settings.corporate_credit_card_expenses_object, exportSettingValidatorRule.creditCardExpense, this.exportSettingForm);
}
+ this.isMultilineOption = brandingConfig.brandId !== 'co' ? true : false;
+
this.setupCustomWatchers();
this.setupCustomDateOptionWatchers();
diff --git a/src/app/integrations/qbo/qbo-shared/qbo-import-settings/qbo-import-settings.component.html b/src/app/integrations/qbo/qbo-shared/qbo-import-settings/qbo-import-settings.component.html
index 254ae176a..da35b4a3d 100644
--- a/src/app/integrations/qbo/qbo-shared/qbo-import-settings/qbo-import-settings.component.html
+++ b/src/app/integrations/qbo/qbo-shared/qbo-import-settings/qbo-import-settings.component.html
@@ -22,7 +22,7 @@
[iconPath]="'arrow-tail-down'">
-
+
{{brandingContent.chartOfAccountTypes}}
@@ -43,7 +43,7 @@
+ -->
+
diff --git a/src/app/integrations/qbo/qbo-shared/qbo-import-settings/qbo-import-settings.component.ts b/src/app/integrations/qbo/qbo-shared/qbo-import-settings/qbo-import-settings.component.ts
index 7411d8aaa..3f3f2c0e8 100644
--- a/src/app/integrations/qbo/qbo-shared/qbo-import-settings/qbo-import-settings.component.ts
+++ b/src/app/integrations/qbo/qbo-shared/qbo-import-settings/qbo-import-settings.component.ts
@@ -152,7 +152,7 @@ export class QboImportSettingsComponent implements OnInit {
this.importSettingService.postImportSettings(importSettingPayload).subscribe(() => {
this.isSaveInProgress = false;
this.toastService.displayToastMessage(ToastSeverity.SUCCESS, 'Import settings saved successfully');
- // This.updateImportCodeFieldConfig();
+ this.updateImportCodeFieldConfig();
if (this.isOnboarding) {
this.workspaceService.setOnboardingState(QBOOnboardingState.ADVANCED_CONFIGURATION);
this.router.navigate([`/integrations/qbo/onboarding/advanced_settings`]);
@@ -220,11 +220,10 @@ export class QboImportSettingsComponent implements OnInit {
if (!isImportCategoriesEnabled) {
this.importSettingForm.controls.chartOfAccountTypes.setValue(['Expense']);
this.importSettingForm.controls.importCategoryCode.clearValidators();
- // This.importSettingForm.controls.importCategoryCode.setValue(ImportSettingsModel.getImportCodeField(this.importSettings.workspace_general_settings.import_code_fields, DefaultImportFields.ACCOUNT, this.qboImportCodeFieldCodeConfig));
+ this.importSettingForm.controls.importCategoryCode.setValue(ImportSettingsModel.getImportCodeField(this.importSettings.workspace_general_settings.import_code_fields, DefaultImportFields.ACCOUNT, this.qboImportCodeFieldCodeConfig));
+ } if (isImportCategoriesEnabled) {
+ this.helper.markControllerAsRequired(this.importSettingForm, 'importCategoryCode');
}
- // If (isImportCategoriesEnabled) {
- // This.helper.markControllerAsRequired(this.importSettingForm, 'importCategoryCode');
- // }
});
}
@@ -269,9 +268,9 @@ export class QboImportSettingsComponent implements OnInit {
this.workspaceService.getWorkspaceGeneralSettings(),
this.qboConnectorService.getQBOCredentials(),
this.mappingService.getDestinationAttributes(QBOField.TAX_CODE, 'v1', 'qbo'),
- this.importSettingService.getQBOFields()
- // This.importSettingService.getImportCodeFieldConfig()
- ]).subscribe(([importSettingsResponse, fyleFieldsResponse, workspaceGeneralSettings, qboCredentials, taxCodes, qboFields]) => {
+ this.importSettingService.getQBOFields(),
+ this.importSettingService.getImportCodeFieldConfig()
+ ]).subscribe(([importSettingsResponse, fyleFieldsResponse, workspaceGeneralSettings, qboCredentials, taxCodes, qboFields, importCodeFieldConfig]) => {
this.qboFields = qboFields;
this.importSettings = importSettingsResponse;
this.workspaceGeneralSettings = workspaceGeneralSettings;
@@ -282,11 +281,11 @@ export class QboImportSettingsComponent implements OnInit {
this.isTaxGroupSyncAllowed = true;
}
- // This.qboImportCodeFieldCodeConfig = importCodeFieldConfig;
+ this.qboImportCodeFieldCodeConfig = importCodeFieldConfig;
this.importSettingForm = QBOImportSettingModel.mapAPIResponseToFormGroup(this.importSettings, this.qboFields, this.qboImportCodeFieldCodeConfig);
this.fyleFields = fyleFieldsResponse;
this.fyleFields.push({ attribute_type: 'custom_field', display_name: 'Create a Custom Field', is_dependent: false });
- // This.updateImportCodeFieldConfig();
+ this.updateImportCodeFieldConfig();
this.setupFormWatchers();
this.initializeCustomFieldForm(false);
this.isLoading = false;
diff --git a/src/app/shared/components/configuration/configuration-import-field/configuration-import-field.component.html b/src/app/shared/components/configuration/configuration-import-field/configuration-import-field.component.html
index 839815153..d6fb8fa47 100644
--- a/src/app/shared/components/configuration/configuration-import-field/configuration-import-field.component.html
+++ b/src/app/shared/components/configuration/configuration-import-field/configuration-import-field.component.html
@@ -49,7 +49,7 @@
-
+
@@ -95,9 +95,9 @@
-
+
{{brandingConfig.brandName}} Fields should be unique
-
+