Skip to content

Commit

Permalink
revert qbo code prepend changes (#945)
Browse files Browse the repository at this point in the history
  • Loading branch information
DhaaraniCIT authored Sep 10, 2024
1 parent 74b5dc8 commit f46c670
Show file tree
Hide file tree
Showing 10 changed files with 36 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,7 +54,8 @@ 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(this.getImportCodeField(importCode, 'ACCOUNT', qboImportCodeFieldCodeConfig))
importCategoryCode: new FormControl(null)
});
}

Expand All @@ -69,8 +70,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, AppName.QBO] as string[]).includes(appName)) {
if (appName && ([AppName.SAGE300] 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 @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@
[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,10 +359,11 @@ 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));
} if (isImportCategoriesEnabled) {
this.helperService.markControllerAsRequired(this.importSettingForm, 'importCategoryCode');
// 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');
// }
});
}

Expand Down Expand Up @@ -433,14 +434,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, qboImportCodeFieldCodeConfig]) => {
this.qboImportSettingsService.getQBOFields()
// This.qboImportSettingsService.getImportCodeFieldConfig()
]).subscribe(([cloneSetting, destinationAttributes, fyleFieldsResponse, qboCredentials, adminEmails, qboFields]) => {

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 @@ -487,9 +488,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, 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 });
this.setupImportSettingFormWatcher();
Expand All @@ -507,7 +508,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-py-0" *ngIf="importSettingForm.value.importCategories" [ngClass]="{'tw-pb-24-px': !(brandingFeatureConfig.featureFlags.importSettings.allowImportCode && importSettingForm.value.importCategories && qboImportCodeFieldCodeConfig[DefaultImportFields.ACCOUNT])}">
<div class="tw-pr-24-px tw-pl-64-px tw-pt-0 tw-pb-24-px" *ngIf="importSettingForm.value.importCategories">
<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,10 +220,11 @@ 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));
} if (isImportCategoriesEnabled) {
this.helper.markControllerAsRequired(this.importSettingForm, 'importCategoryCode');
// 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');
// }
});
}

Expand Down Expand Up @@ -268,9 +269,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, importCodeFieldConfig]) => {
this.importSettingService.getQBOFields()
// This.importSettingService.getImportCodeFieldConfig()
]).subscribe(([importSettingsResponse, fyleFieldsResponse, workspaceGeneralSettings, qboCredentials, taxCodes, qboFields]) => {
this.qboFields = qboFields;
this.importSettings = importSettingsResponse;
this.workspaceGeneralSettings = workspaceGeneralSettings;
Expand All @@ -281,11 +282,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 f46c670

Please sign in to comment.