|
1 | 1 | import { FormControl, FormGroup } from "@angular/forms"; |
2 | | -import { JoinOption, Operator } from "../enum/enum.model"; |
| 2 | +import { AppName, JoinOption, Operator } from "../enum/enum.model"; |
3 | 3 | import { environment } from "src/environments/environment"; |
4 | 4 | import { ExportSettingGet } from "../intacct/intacct-configuration/export-settings.model"; |
5 | 5 | import { QBOExportSettingGet } from "../qbo/qbo-configuration/qbo-export-setting.model"; |
6 | 6 | import { NetSuiteExportSettingGet } from "../netsuite/netsuite-configuration/netsuite-export-setting.model"; |
| 7 | +import { IntacctConfiguration } from "../db/configuration.model"; |
7 | 8 |
|
8 | 9 | export type EmailOption = { |
9 | 10 | email: string; |
@@ -75,17 +76,19 @@ export class AdvancedSettingsModel { |
75 | 76 | return ['employee_email', 'employee_name', 'merchant', 'purpose', 'category', 'spent_on', 'report_number', 'expense_link', 'card_number']; |
76 | 77 | } |
77 | 78 |
|
78 | | - static getMemoOptions(exportSettings: ExportSettingGet | NetSuiteExportSettingGet | QBOExportSettingGet, appName: string): string[] { |
| 79 | + static getMemoOptions(exportSettings: IntacctConfiguration | ExportSettingGet | NetSuiteExportSettingGet | QBOExportSettingGet, appName: string): string[] { |
79 | 80 | const defaultOptions = this.getDefaultMemoOptions(); |
80 | 81 | let cccExportType: string | undefined; |
81 | 82 | // Handle both configurations and configuration properties |
82 | | - if ('configurations' in exportSettings) { |
| 83 | + if (appName === AppName.INTACCT) { |
| 84 | + cccExportType = (exportSettings as IntacctConfiguration).corporate_credit_card_expenses_object ?? undefined; |
| 85 | + } else if ('configurations' in exportSettings) { |
83 | 86 | cccExportType = exportSettings.configurations?.corporate_credit_card_expenses_object ?? undefined; |
84 | 87 | } else if ('workspace_general_settings' in exportSettings) { |
85 | 88 | cccExportType = exportSettings.workspace_general_settings?.corporate_credit_card_expenses_object ?? undefined; |
86 | 89 | } |
87 | 90 | // Filter out options based on cccExportType and appName |
88 | | - if (cccExportType && ['netsuite', 'qbo', 'sage intacct'].includes(appName.toLowerCase())) { |
| 91 | + if (cccExportType && ['netsuite', 'quickbooks online', 'sage intacct'].includes(appName.toLowerCase())) { |
89 | 92 | return defaultOptions; // Allow all options including 'card_number' |
90 | 93 | } |
91 | 94 | return defaultOptions.filter(option => option !== 'card_number'); // Omit 'card_number' for other apps |
|
0 commit comments