Skip to content

Commit

Permalink
Merge branch 'master' into move-emp-settings-to-export-settings
Browse files Browse the repository at this point in the history
  • Loading branch information
anishfyle committed Dec 13, 2024
2 parents eb73fbf + 204c5f7 commit 0498ad3
Show file tree
Hide file tree
Showing 21 changed files with 140 additions and 87 deletions.
11 changes: 0 additions & 11 deletions commits.tsv

This file was deleted.

2 changes: 0 additions & 2 deletions src/app/branding/c1-branding-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,7 @@ export const c1KbArticles: KbArticle[string] = {
IMPORT_SETTING: `${brandingConfig.helpArticleDomain}/en/articles/9082146-configure-the-capital-one-sage-intacct-integration#h_78e1747002`,
EXPORT_SETTING: `${brandingConfig.helpArticleDomain}/en/articles/9082146-configure-the-capital-one-sage-intacct-integration#h_eebe5df4b7`,
ADVANCED_SETTING: `${brandingConfig.helpArticleDomain}/en/articles/9082146-configure-the-capital-one-sage-intacct-integration#h_498f2acc61`,
LANDING: `${brandingConfig.helpArticleDomain}/en/articles/9082146-configure-the-capital-one-sage-intacct-integration`,
CONNECTOR: `${brandingConfig.helpArticleDomain}/en/articles/9081356-generate-credentials-to-connect-with-sage-intacct`,
SKIP_EXPORT: `${brandingConfig.helpArticleDomain}/en/articles/9082146-configure-the-capital-one-sage-intacct-integration`,
HELPER_ARTICLE: `${brandingConfig.helpArticleDomain}/en/articles/7882821-how-to-skip-exporting-specific-expenses-from-fyle-to-sage-intacct`
}
}
Expand Down
12 changes: 5 additions & 7 deletions src/app/branding/fyle-branding-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export const fyleKbArticles: KbArticle[string] = {
SAGE300: `${brandingConfig.helpArticleDomain}/en/articles/8948413-how-to-set-up-the-fyle-sage-300-cre-integration`,
BUSINESS_CENTRAL: `${brandingConfig.helpArticleDomain}/en/articles/8911018-how-to-configure-the-fyle-dynamics-365-business-central-integration`,
XERO: `${brandingConfig.helpArticleDomain}/en/articles/6721333-how-to-set-up-the-fyle-xero-integration`,
QBD_DIRECT: `${brandingConfig.helpArticleDomain}/en/collections/215867-integrations-with-fyle#quickbooks-desktop`
QBD_DIRECT: `${brandingConfig.helpArticleDomain}/en/articles/10259583-quickbooks-desktop-integration-beta`
},
onboardingArticles: {
INTACCT: {
Expand Down Expand Up @@ -126,12 +126,10 @@ export const fyleKbArticles: KbArticle[string] = {
ADVANCED_SETTING: `${brandingConfig.helpArticleDomain}/en/articles/6721333-how-to-set-up-the-fyle-xero-integration#h_d95b791edd`
},
QBD_DIRECT: {
IMPORT_SETTING: `${brandingConfig.helpArticleDomain}/en/articles/8394683-how-to-configure-the-fyle-sage-intacct-integration#h_85f929716c`,
EXPORT_SETTING: `${brandingConfig.helpArticleDomain}/en/articles/8394683-how-to-configure-the-fyle-sage-intacct-integration#h_6492c5038d`,
ADVANCED_SETTING: `${brandingConfig.helpArticleDomain}/en/articles/8394683-how-to-configure-the-fyle-sage-intacct-integration#h_3f6718633c`,
LANDING: `${brandingConfig.helpArticleDomain}/en/articles/8394683-how-to-configure-the-fyle-sage-intacct-integration`,
CONNECTOR: `${brandingConfig.helpArticleDomain}/en/articles/8394683-how-to-configure-the-fyle-sage-intacct-integration#h_38e0c9bea6`,
SKIP_EXPORT: `${brandingConfig.helpArticleDomain}/en/articles/7882821-how-to-skip-exporting-specific-expenses-from-fyle-to-sage-intacct`,
IMPORT_SETTING: `${brandingConfig.helpArticleDomain}/en/articles/10259583-quickbooks-desktop-integration-beta#h_a170c7d562`,
EXPORT_SETTING: `${brandingConfig.helpArticleDomain}/en/articles/10259583-quickbooks-desktop-integration-beta#h_1366df4107`,
ADVANCED_SETTING: `${brandingConfig.helpArticleDomain}/en/articles/10259583-quickbooks-desktop-integration-beta#h_b3850646c0`,
CONNECTOR: `${brandingConfig.helpArticleDomain}/en/articles/10259583-quickbooks-desktop-integration-beta#h_d3cc42849a`,
HELPER_ARTICLE: `${brandingConfig.helpArticleDomain}/en/articles/7882821-how-to-skip-exporting-specific-expenses-from-fyle-to-sage-intacct`
}
}
Expand Down
2 changes: 0 additions & 2 deletions src/app/core/models/branding/kb-article.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ export type KbArticle = {
IMPORT_SETTING: string;
EXPORT_SETTING: string;
ADVANCED_SETTING: string;
LANDING: string;
CONNECTOR: string;
SKIP_EXPORT: string;
HELPER_ARTICLE: string;
},
INTACCT: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ export type BusinessCentralExportSetting = {
credit_card_expense_date: ExportDateType,
default_bank_account_name: string,
default_bank_account_id: string,
default_ccc_bank_account_name: string,
default_ccc_bank_account_id: string,
name_in_journal_entry: string,
employee_field_mapping: string,
auto_map_employees: string,
Expand Down Expand Up @@ -184,6 +186,7 @@ export class BusinessCentralExportSettingModel {
cccExportDate: new FormControl(exportSettings?.credit_card_expense_date ? exportSettings?.credit_card_expense_date.toLowerCase() : null),
cccExportGroup: new FormControl(exportSettings?.credit_card_expense_grouped_by ? exportSettings?.credit_card_expense_grouped_by: null),
defaultBankName: new FormControl(exportSettings?.default_bank_account_name ? findObjectByDestinationId(accounts, exportSettings?.default_bank_account_id) : null),
cccDefaultBankName: new FormControl(exportSettings?.default_ccc_bank_account_name ? findObjectByDestinationId(accounts, exportSettings?.default_ccc_bank_account_id) : null),
reimbursableEmployeeMapping: new FormControl(exportSettings?.employee_field_mapping ? exportSettings?.employee_field_mapping : null, Validators.required),
journalEntryNamePreference: new FormControl(exportSettings?.name_in_journal_entry ? exportSettings?.name_in_journal_entry : null),
autoMapEmployee: new FormControl(exportSettings?.auto_map_employees ? exportSettings?.auto_map_employees : null),
Expand All @@ -204,6 +207,8 @@ export class BusinessCentralExportSettingModel {
credit_card_expense_date: exportSettingsForm.get('cccExportDate')?.value ? exportSettingsForm.get('cccExportDate')?.value.toUpperCase() : null,
default_bank_account_name: exportSettingsForm.get('defaultBankName')?.value ? exportSettingsForm.get('defaultBankName')?.value.value : null,
default_bank_account_id: exportSettingsForm.get('defaultBankName')?.value ? exportSettingsForm.get('defaultBankName')?.value.destination_id : null,
default_ccc_bank_account_name: exportSettingsForm.get('cccDefaultBankName')?.value ? exportSettingsForm.get('cccDefaultBankName')?.value.value : null,
default_ccc_bank_account_id: exportSettingsForm.get('cccDefaultBankName')?.value ? exportSettingsForm.get('cccDefaultBankName')?.value.destination_id : null,
name_in_journal_entry: exportSettingsForm.get('journalEntryNamePreference')?.value ? exportSettingsForm.get('journalEntryNamePreference')?.value : null,
employee_field_mapping: exportSettingsForm.get('reimbursableEmployeeMapping')?.value ? exportSettingsForm.get('reimbursableEmployeeMapping')?.value : null,
auto_map_employees: exportSettingsForm.get('autoMapEmployee')?.value ? exportSettingsForm.get('autoMapEmployee')?.value : null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class BusinessCentralImportSettingsModel extends ImportSettingsModel {
const expenseFieldsArray = importSettings?.mapping_settings ? this.constructFormArray(importSettings.mapping_settings, businessCentralFields) : [] ;
return new FormGroup({
importCategories: new FormControl(importSettings?.import_settings?.import_categories ?? false),
chartOfAccountTypes: new FormControl(importSettings?.import_settings.charts_of_accounts ? importSettings?.import_settings.charts_of_accounts : ['Expense']),
chartOfAccountTypes: new FormControl(importSettings?.import_settings?.charts_of_accounts ? importSettings?.import_settings?.charts_of_accounts : ['Expense']),
importVendorAsMerchant: new FormControl(importSettings?.import_settings?.import_vendors_as_merchants ?? false ),
expenseFields: new FormArray(expenseFieldsArray)
});
Expand Down
22 changes: 14 additions & 8 deletions src/app/core/models/common/advanced-settings.model.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { FormControl, FormGroup } from "@angular/forms";
import { JoinOption, Operator } from "../enum/enum.model";
import { AppName, JoinOption, Operator } from "../enum/enum.model";
import { environment } from "src/environments/environment";
import { ExportSettingGet } from "../intacct/intacct-configuration/export-settings.model";
import { QBOExportSettingGet } from "../qbo/qbo-configuration/qbo-export-setting.model";
import { NetSuiteExportSettingGet } from "../netsuite/netsuite-configuration/netsuite-export-setting.model";

import { IntacctConfiguration } from "../db/configuration.model";
import { brandingConfig } from 'src/app/branding/branding-config';
export type EmailOption = {
email: string;
name: string;
Expand Down Expand Up @@ -75,20 +76,25 @@ export class AdvancedSettingsModel {
return ['employee_email', 'employee_name', 'merchant', 'purpose', 'category', 'spent_on', 'report_number', 'expense_link', 'card_number'];
}

static getMemoOptions(exportSettings: ExportSettingGet | NetSuiteExportSettingGet | QBOExportSettingGet, appName: string): string[] {
static getMemoOptions(exportSettings: IntacctConfiguration | ExportSettingGet | NetSuiteExportSettingGet | QBOExportSettingGet, appName: string): string[] {
const defaultOptions = this.getDefaultMemoOptions();
let cccExportType: string | undefined;
// Handle both configurations and configuration properties
if ('configurations' in exportSettings) {
if (appName === AppName.INTACCT) {
cccExportType = (exportSettings as IntacctConfiguration).corporate_credit_card_expenses_object ?? undefined;
} else if ('configurations' in exportSettings) {
cccExportType = exportSettings.configurations?.corporate_credit_card_expenses_object ?? undefined;
} else if ('workspace_general_settings' in exportSettings) {
cccExportType = exportSettings.workspace_general_settings?.corporate_credit_card_expenses_object ?? undefined;
}
// Filter out options based on cccExportType and appName
if (cccExportType && ['netsuite', 'qbo', 'sage intacct'].includes(appName.toLowerCase())) {
return defaultOptions; // Allow all options including 'card_number'

if (brandingConfig.brandId === 'co') {
return defaultOptions.filter(option => option !== 'card_number' && option !== 'employee_name');
}
return defaultOptions.filter(option => option !== 'card_number'); // Omit 'card_number' for other apps
if (cccExportType && ['netsuite', 'quickbooks online', 'sage intacct'].includes(appName.toLowerCase()) && brandingConfig.brandId === 'fyle') {
return defaultOptions;
}
return defaultOptions.filter(option => option !== 'card_number');

}

Expand Down
3 changes: 1 addition & 2 deletions src/app/core/models/enum/enum.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -702,9 +702,8 @@ export enum Sage300ExportSettingDestinationOptionKey {
}

export enum BCExportSettingDestinationOptionKey {
ACCOUNT = 'ACCOUNT',
VENDOR = 'VENDOR',
REIMBURSABLE_BANK_ACCOUNT = 'REIMBURSABLE_BANK_ACCOUNT'
BANK_ACCOUNT = 'BANK_ACCOUNT'
}

export enum QbdDirectExportSettingDestinationOptionKey {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<div *ngIf="!isIncorrectQBOConnectedDialogVisible">
<div *ngIf="!isIncorrectBCConnectedDialogVisible">
<div>
<app-landing-page-header [logoWidth]="'65px'" [logoStyleClasses]="'tw-p-0'" [logoSectionStyleClasses]="''" [iconPath]="'assets/logos/BusinessCentral-logo.svg'" [appName]="'Dynamics 365 Business Central'" [appDescription]="'Import data from Dynamics 365 Business Central to ' + brandingConfig.brandName + ' and Export expenses from ' + brandingConfig.brandName + ' to Dynamics 365 Business Central. '" [isLoading]="false" [isIntegrationSetupInProgress]="businessCentralConnectionInProgress" [isIntegrationConnected]="isIntegrationConnected" [redirectLink]="redirectLink" [buttonText]="'Connect'" [postConnectionRoute]="'business_central/onboarding/connector'" (connectIntegration)="connectBusinessCentral()"></app-landing-page-header>
</div>
<div>
<app-landing-page-body [headlineText]="'Guide to setup your Integrations'" [headerText]="'A quick guide to help you set up the integration quick and easy.'" [svgPath]="'assets/flow-charts/ms-dynamics-flow-chart.svg'" [appName]="appName"></app-landing-page-body>
</div>
</div>
<app-configuration-confirmation-dialog *ngIf="isIncorrectQBOConnectedDialogVisible"
<app-configuration-confirmation-dialog *ngIf="isIncorrectBCConnectedDialogVisible"
(warningAccepted)="acceptWarning($event)"
[isWarningVisible]="isIncorrectQBOConnectedDialogVisible"
[isWarningVisible]="isIncorrectBCConnectedDialogVisible"
[headerText]="'Incorrect account selected'"
[contextText]="'You had previously set up the integration with a different Dynamic 365 Business Central account. Please choose the same to restore the settings'"
[confirmBtnText]="'Re connect'"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class BusinessCentralOnboardingLandingComponent implements OnInit, OnDest

private oauthCallbackSubscription: Subscription;

isIncorrectQBOConnectedDialogVisible: boolean;
isIncorrectBCConnectedDialogVisible: boolean;

constructor(
private helperService: HelperService,
Expand All @@ -45,9 +45,9 @@ export class BusinessCentralOnboardingLandingComponent implements OnInit, OnDest
) { }

acceptWarning(data: ConfigurationWarningOut): void {
this.isIncorrectQBOConnectedDialogVisible = false;
this.isIncorrectBCConnectedDialogVisible = false;
if (data.hasAccepted) {
this.router.navigate([`/integrations/qbo/onboarding/landing`]);
this.router.navigate([`/integrations/business_central/onboarding/landing`]);
}
}

Expand All @@ -72,7 +72,7 @@ export class BusinessCentralOnboardingLandingComponent implements OnInit, OnDest
}, (error) => {
const errorMessage = 'message' in error.error ? error.error.message : 'Failed to connect to Dynamic 365 Business Central. Please try again';
if (errorMessage === 'Please choose the correct Dynamic 365 Business Central account') {
this.isIncorrectQBOConnectedDialogVisible = false;
this.isIncorrectBCConnectedDialogVisible = true;
} else {
this.toastService.displayToastMessage(ToastSeverity.ERROR, errorMessage);
this.router.navigate([`/integrations/business_central/onboarding/landing`]);
Expand Down
Loading

0 comments on commit 0498ad3

Please sign in to comment.