Skip to content

Commit

Permalink
qbo code prepend changes
Browse files Browse the repository at this point in the history
  • Loading branch information
DhaaraniCIT committed Sep 17, 2024
1 parent f17a54d commit 082131b
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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))
});
}

Expand All @@ -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: {
Expand Down
2 changes: 1 addition & 1 deletion src/app/core/services/common/mapping.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()">
</app-generic-mapping-v2>
Original file line number Diff line number Diff line change
Expand Up @@ -87,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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@
[tooltipText]="'By default expense will be selected. Open the dropdown to select more as per your requirements'">
</app-clone-setting-field>
</div>
<!-- <div class="clone-setting--dependent-field" *ngIf="brandingFeatureConfig.featureFlags.importSettings.allowImportCode && importSettingForm.value.importCategories && qboImportCodeFieldCodeConfig[DefaultImportFields.ACCOUNT]">
<div class="clone-setting--dependent-field" *ngIf="brandingFeatureConfig.featureFlags.importSettings.allowImportCode && importSettingForm.value.importCategories && qboImportCodeFieldCodeConfig[DefaultImportFields.ACCOUNT]">
<app-clone-setting-field
[form]="importSettingForm"
[options]="importCodeSelectorOptions[DefaultImportFields.ACCOUNT]"
Expand All @@ -323,7 +323,7 @@
[dropdownDisplayKey]="'label'"
[formControllerName]="'importCategoryCode'">
</app-clone-setting-field>
</div> -->
</div>
</div>

<div class="clone-setting--field" *ngIf="cloneSetting.export_settings.workspace_general_settings.reimbursable_expenses_object !== QBOReimbursableExpensesObject.JOURNAL_ENTRY && cloneSetting.export_settings.workspace_general_settings.corporate_credit_card_expenses_object !== QBOCorporateCreditCardExpensesObject.JOURNAL_ENTRY">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
// }
});
}

Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -488,8 +487,8 @@ export class QboCloneSettingsComponent implements OnInit {
if (qboCredentials && qboCredentials.country !== 'US') {
this.isTaxGroupSyncAllowed = true;
}
// This.qboImportCodeFieldCodeConfig = qboImportCodeFieldCodeConfig;
// This.cloneQboImportCodeFieldCodeConfig = cloneQboImportCodeFieldCodeConfig;
this.qboImportCodeFieldCodeConfig = qboImportCodeFieldCodeConfig;
this.cloneQboImportCodeFieldCodeConfig = cloneQboImportCodeFieldCodeConfig;
this.importSettingForm = QBOImportSettingModel.mapAPIResponseToFormGroup(cloneSetting.import_settings, this.qboFields, this.cloneQboImportCodeFieldCodeConfig);
this.fyleFields = fyleFieldsResponse;
this.fyleFields.push({ attribute_type: 'custom_field', display_name: 'Create a Custom Field', is_dependent: false });
Expand All @@ -508,7 +507,7 @@ export class QboCloneSettingsComponent implements OnInit {
this.setupAdvancedSettingFormWatcher();

this.isLoading = false;
// });
});
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ 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.isMultilineOption = brandingConfig.brandId !== 'co' ? true : false;

this.setupCustomWatchers();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
[iconPath]="'arrow-tail-down'">
</app-configuration-toggle-field>

<div class="tw-pr-24-px tw-pl-64-px tw-pt-0 tw-pb-24-px" *ngIf="importSettingForm.value.importCategories">
<div class="tw-pr-24-px tw-pl-64-px tw-py-0" *ngIf="importSettingForm.value.importCategories" [ngClass]="{'tw-pb-24-px': !(brandingFeatureConfig.featureFlags.importSettings.allowImportCode && importSettingForm.value.importCategories && qboImportCodeFieldCodeConfig[DefaultImportFields.ACCOUNT])}">
<div class="tw-flex tw-justify-between tw-items-center">
<h5 class="lg:tw-w-3/5 md:tw-w-1/2 tw-text-slightly-normal-text-color tw-text-14-px !tw-font-500">
{{brandingContent.chartOfAccountTypes}}
Expand All @@ -43,7 +43,7 @@ <h5 class="lg:tw-w-3/5 md:tw-w-1/2 tw-text-slightly-normal-text-color tw-text-14
</div>
</div>

<!-- <div *ngIf="brandingFeatureConfig.featureFlags.importSettings.allowImportCode && importSettingForm.value.importCategories && qboImportCodeFieldCodeConfig[DefaultImportFields.ACCOUNT]">
<div *ngIf="brandingFeatureConfig.featureFlags.importSettings.allowImportCode && importSettingForm.value.importCategories && qboImportCodeFieldCodeConfig[DefaultImportFields.ACCOUNT]">
<app-configuration-select-field
[appName]="appName"
[form]="importSettingForm"
Expand All @@ -58,7 +58,7 @@ <h5 class="lg:tw-w-3/5 md:tw-w-1/2 tw-text-slightly-normal-text-color tw-text-14
[isDisabled]="!qboImportCodeFieldCodeConfig[DefaultImportFields.ACCOUNT]"
[formControllerName]="'importCategoryCode'">
</app-configuration-select-field>
</div> -->
</div>
</div>

<div class="tw-rounded-lg tw-border-border-tertiary tw-border tw-mt-24-px" *ngIf="workspaceGeneralSettings.reimbursable_expenses_object !== QBOReimbursableExpensesObject.JOURNAL_ENTRY && workspaceGeneralSettings.corporate_credit_card_expenses_object !== QBOCorporateCreditCardExpensesObject.JOURNAL_ENTRY">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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`]);
Expand Down Expand Up @@ -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');
// }
});
}

Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 082131b

Please sign in to comment.