Skip to content

Commit

Permalink
Revert "feat: add advanced search to ccc export settings fields in ne…
Browse files Browse the repository at this point in the history
…tsuite (#867)" (#874)

This reverts commit ce6b051.
  • Loading branch information
ashwin1111 committed Jul 15, 2024
1 parent 0eabfb6 commit 5870d25
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 151 deletions.
8 changes: 1 addition & 7 deletions src/app/core/models/common/export-settings.model.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DefaultDestinationAttribute, DestinationAttribute } from "../db/destination-attribute.model";
import { ExpenseGroupingFieldOption, ExportDateType, IntacctCorporateCreditCardExpensesObject, IntacctExportSettingDestinationOptionKey, IntacctReimbursableExpensesObject, NetsuiteExportSettingDestinationOptionKey, SplitExpenseGrouping } from "../enum/enum.model";
import { ExpenseGroupingFieldOption, ExportDateType, IntacctCorporateCreditCardExpensesObject, IntacctReimbursableExpensesObject, SplitExpenseGrouping } from "../enum/enum.model";
import { SelectFormOption } from "./select-form-option.model";

export type ExportSettingValidatorRule = {
Expand All @@ -12,12 +12,6 @@ export type ExportModuleRule = {
requiredValue: Record<string, string[]>
};

export type ExportSettingOptionSearch = {
searchTerm: string,
destinationAttributes: any[],
destinationOptionKey: IntacctExportSettingDestinationOptionKey | NetsuiteExportSettingDestinationOptionKey;
};

export class ExportSettingModel {
static getSplitExpenseGroupingOptions(): SelectFormOption[] {
return [
Expand Down
7 changes: 0 additions & 7 deletions src/app/core/models/enum/enum.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -627,13 +627,6 @@ export enum IntacctExportSettingDestinationOptionKey {
CHARGE_CARD = 'CHARGE_CARD'
}

export enum NetsuiteExportSettingDestinationOptionKey {
VENDOR = 'VENDOR',
ACCOUNTS_PAYABLE = 'ACCOUNTS_PAYABLE',
BANK_ACCOUNT = 'BANK_ACCOUNT',
CREDIT_CARD_ACCOUNT = 'CREDIT_CARD_ACCOUNT',
}

export enum IntegrationName {
SAGE300 = 'SAGE300'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { DefaultDestinationAttribute, DestinationAttribute } from "../../db/dest
import { IntacctDestinationAttribute } from "../db/destination-attribute.model";
import { SelectFormOption } from "../../common/select-form-option.model";
import { brandingConfig, brandingContent, brandingFeatureConfig } from "src/app/branding/branding-config";
import { ExportSettingOptionSearch } from "../../common/export-settings.model";

export type ExportSettingFormOption = {
label: string,
Expand Down Expand Up @@ -56,7 +55,9 @@ export type ExportSettingPost = {
general_mappings: ExportSettingGeneralMapping
}

export interface IntacctExportSettingOptionSearch extends ExportSettingOptionSearch {
export type ExportSettingOptionSearch = {
searchTerm: string,
destinationAttributes: any[],
destinationOptionKey: IntacctExportSettingDestinationOptionKey
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import { DomSanitizer } from '@angular/platform-browser';
import { Router } from '@angular/router';
import { Observable, Subject, debounceTime, filter, forkJoin } from 'rxjs';
import { brandingConfig, brandingContent, brandingFeatureConfig, brandingKbArticles } from 'src/app/branding/branding-config';
import { ExportSettingModel, ExportSettingOptionSearch } from 'src/app/core/models/common/export-settings.model';
import { ExportSettingModel } from 'src/app/core/models/common/export-settings.model';
import { DefaultDestinationAttribute } from 'src/app/core/models/db/destination-attribute.model';
import { CCCExpenseState, ConfigurationCta, IntacctCorporateCreditCardExpensesObject, FyleField, ExpenseGroupedBy, ExpenseState, ExportDateType, IntacctReimbursableExpensesObject, ExpenseGroupingFieldOption, Page, ToastSeverity, IntacctOnboardingState, ProgressPhase, IntacctUpdateEvent, AppName, IntacctExportSettingDestinationOptionKey, TrackingApp, EmployeeFieldMapping } from 'src/app/core/models/enum/enum.model';
import { ExportSettingDestinationAttributeOption, IntacctDestinationAttribute, PaginatedintacctDestinationAttribute } from 'src/app/core/models/intacct/db/destination-attribute.model';
import { ExportSettingFormOption, ExportSettingGet, ExportSettingModel as IntacctExportSettingModel, IntacctExportSettingOptionSearch } from 'src/app/core/models/intacct/intacct-configuration/export-settings.model';
import { ExportSettingFormOption, ExportSettingGet, ExportSettingModel as IntacctExportSettingModel, ExportSettingOptionSearch } from 'src/app/core/models/intacct/intacct-configuration/export-settings.model';
import { IntegrationsToastService } from 'src/app/core/services/common/integrations-toast.service';
import { TrackingService } from 'src/app/core/services/integration/tracking.service';
import { SiExportSettingService } from 'src/app/core/services/si/si-configuration/si-export-setting.service';
Expand Down Expand Up @@ -146,7 +146,7 @@ export class IntacctExportSettingsComponent implements OnInit {
}
];

private optionSearchUpdate = new Subject<IntacctExportSettingOptionSearch>();
private optionSearchUpdate = new Subject<ExportSettingOptionSearch>();

readonly brandingFeatureConfig = brandingFeatureConfig;

Expand Down Expand Up @@ -589,7 +589,7 @@ export class IntacctExportSettingsComponent implements OnInit {
private optionSearchWatcher(): void {
this.optionSearchUpdate.pipe(
debounceTime(1000)
).subscribe((event: IntacctExportSettingOptionSearch) => {
).subscribe((event: ExportSettingOptionSearch) => {
const existingOptions = this.destinationOptions[event.destinationOptionKey].concat();
const newOptions: IntacctDestinationAttribute[] = [];

Expand Down Expand Up @@ -623,8 +623,7 @@ export class IntacctExportSettingsComponent implements OnInit {
});
}

searchOptionsDropdown(_event: ExportSettingOptionSearch): void {
const event = _event as IntacctExportSettingOptionSearch;
searchOptionsDropdown(event: ExportSettingOptionSearch): void {
if (event.searchTerm) {
this.isOptionSearchInProgress = true;
this.optionSearchUpdate.next(event);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,37 +48,29 @@
<app-configuration-select-field
[form]="exportSettingForm"
[destinationAttributes]="bankAccounts"
[destinationOptionKey]="NetsuiteExportSettingDestinationOptionKey.BANK_ACCOUNT"
[isOptionSearchInProgress]="isOptionSearchInProgress"
[optionLabel]="'name'"
[iconPath]="'list'"
[isFieldMandatory]="true"
[mandatoryErrorListName]="'Employee Payables Account'"
[label]="brandingContent.corporateCard.defaultDebitCardAccountLabel"
[subLabel]="'Post all your reimbursable expenses to a default employee payables account.'"
[placeholder]="'Select a Employee Payables Account'"
[formControllerName]="'bankAccount'"
[isAdvanceSearchEnabled]="true"
(searchOptionsDropdown)="searchOptionsDropdown($event)">
[formControllerName]="'bankAccount'">
</app-configuration-select-field>
</div>

<div *ngIf="exportSettingForm.value.reimbursableExportType && helperService.isFieldRequired(exportSettingForm, 'accountsPayable')">
<app-configuration-select-field
[form]="exportSettingForm"
[destinationAttributes]="accountsPayables"
[destinationOptionKey]="NetsuiteExportSettingDestinationOptionKey.ACCOUNTS_PAYABLE"
[isOptionSearchInProgress]="isOptionSearchInProgress"
[optionLabel]="'name'"
[iconPath]="'list'"
[isFieldMandatory]="true"
[mandatoryErrorListName]="'Vendor Payables Account'"
[label]="brandingContent.corporateCard.accountsPayableLabel"
[subLabel]="'Post all your reimbursable expenses to a default vendor payables account.'"
[placeholder]="'Select Vendor Payable Account'"
[formControllerName]="'accountsPayable'"
[isAdvanceSearchEnabled]="true"
(searchOptionsDropdown)="searchOptionsDropdown($event)">
[formControllerName]="'accountsPayable'">
</app-configuration-select-field>
</div>
</div>
Expand Down Expand Up @@ -194,75 +186,59 @@
<app-configuration-select-field
[form]="exportSettingForm"
[destinationAttributes]="accountsPayables"
[destinationOptionKey]="NetsuiteExportSettingDestinationOptionKey.ACCOUNTS_PAYABLE"
[isOptionSearchInProgress]="isOptionSearchInProgress"
[optionLabel]="'name'"
[iconPath]="'list'"
[isFieldMandatory]="true"
[mandatoryErrorListName]="'Vendor Payables Account'"
[label]="brandingContent.corporateCard.accountsPayableLabel"
[subLabel]="'Post all your company corporate card transactions to a default vendor payables account.'"
[placeholder]="helperService.sentenseCaseConversion('Select Vendor Payable Account')"
[formControllerName]="'accountsPayable'"
[isAdvanceSearchEnabled]="true"
(searchOptionsDropdown)="searchOptionsDropdown($event)">
[formControllerName]="'accountsPayable'">
</app-configuration-select-field>
</div>

<div *ngIf="(!exportSettingForm.value.reimbursableExportType || brandingConfig.brandId === 'co') && helperService.isFieldRequired(exportSettingForm, 'bankAccount')">
<app-configuration-select-field
[form]="exportSettingForm"
[destinationAttributes]="bankAccounts"
[destinationOptionKey]="NetsuiteExportSettingDestinationOptionKey.BANK_ACCOUNT"
[isOptionSearchInProgress]="isOptionSearchInProgress"
[optionLabel]="'name'"
[iconPath]="'list'"
[isFieldMandatory]="true"
[mandatoryErrorListName]="'Employee Payables Account'"
[label]="brandingContent.corporateCard.defaultDebitCardAccountLabel"
[subLabel]="'Post all your company corporate card transactions to a default employee payables account.'"
[placeholder]="helperService.sentenseCaseConversion('Select a Employee Payables Account')"
[formControllerName]="'bankAccount'"
[isAdvanceSearchEnabled]="true"
(searchOptionsDropdown)="searchOptionsDropdown($event)">
[formControllerName]="'bankAccount'">
</app-configuration-select-field>
</div>

<div *ngIf="exportSettingForm.value.creditCardExportType && helperService.isFieldRequired(exportSettingForm, 'creditCardAccount')">
<app-configuration-select-field
[form]="exportSettingForm"
[destinationAttributes]="cccAccounts"
[destinationOptionKey]="NetsuiteExportSettingDestinationOptionKey.CREDIT_CARD_ACCOUNT"
[isOptionSearchInProgress]="isOptionSearchInProgress"
[optionLabel]="'name'"
[iconPath]="'list'"
[isFieldMandatory]="true"
[mandatoryErrorListName]="'credit card account'"
[label]="brandingContent.corporateCard.defaultCCCAccountLabel"
[subLabel]="'Post all your company corporate card transactions to a default credit card account.'"
[placeholder]="brandingContent.corporateCard.defaultCCCAccountPlaceholder"
[formControllerName]="'creditCardAccount'"
[isAdvanceSearchEnabled]="true"
(searchOptionsDropdown)="searchOptionsDropdown($event)">
[formControllerName]="'creditCardAccount'">
</app-configuration-select-field>
</div>

<div *ngIf="exportSettingForm.value.creditCardExportType && helperService.isFieldRequired(exportSettingForm, 'defaultCreditCardVendor')">
<app-configuration-select-field
[form]="exportSettingForm"
[destinationAttributes]="creditCardVendors"
[destinationOptionKey]="NetsuiteExportSettingDestinationOptionKey.VENDOR"
[isOptionSearchInProgress]="isOptionSearchInProgress"
[optionLabel]="'name'"
[iconPath]="'list'"
[isFieldMandatory]="true"
[mandatoryErrorListName]="'credit card vendor'"
[label]="brandingContent.corporateCard.defaultCCCVendorLabel"
[subLabel]="'Post your company corporate card transactions to a default credit card vendor when a match is not found in NetSuite and auto creation is switched off.'"
[placeholder]="'Select default credit card vendor'"
[formControllerName]="'defaultCreditCardVendor'"
[isAdvanceSearchEnabled]="true"
(searchOptionsDropdown)="searchOptionsDropdown($event)">
[formControllerName]="'defaultCreditCardVendor'">
</app-configuration-select-field>
</div>

Expand Down
Loading

0 comments on commit 5870d25

Please sign in to comment.