Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions src/app/branding/fyle-contents-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,33 +71,33 @@ export const fyleContents = {
importItemsLabel: 'Import Products/Services from QuickBooks Desktop',
importItemsSubLabel: 'Products/services from QuickBooks Desktop will be imported as Categories in ' + brandingConfig.brandName + '.',
importVendorsAsMerchantsLabel: 'Import Vendors as Merchants in Fyle',
chartOfAccountTypes: 'Select the accounts from QuickBooks Desktop to import as categories in ' + brandingConfig.brandName,
chartOfAccountTypesSubLabel: 'By default expense will be selected. Open the dropdown to select more as per your requirements.'
chartOfAccountTypes: 'Choose the type of accounts to be imported',
chartOfAccountTypesSubLabel: 'By default \'Expense\' type accounts will be imported. Open the dropdown to add or modify selections based on your needs.'
},
advancedSettings: {
stepName: 'Advanced Settings',
contentText: 'In this section, you can customize the integration based on your accounting requirements. ',
automationLabel: 'Automation',
automationSubLabel: 'You can automate the export and sync of your data in this section.',
customizeSectionLabel: 'Customization',
customizeSectionSubLabel: 'In this section, you can customize the data that you\'d like to export from Fyle to QuickBooks Desktop You can choose what data points need to be exported and what shouldn\'t be.',
customizeSectionSubLabel: 'In this section, you can customize the data that you\'d like to export from Fyle to QuickBooks Desktop.',
scheduleAutoExportLabel: 'Schedule automatic export',
scheduleAutoExportSubLabel: 'Set up a schedule to frequently automate the export of expenses from ' + brandingConfig.brandName + ' to QuickBooks Desktop.',
autoExportfrequencyLabel: 'Set up export frequency',
autoExportfrequencySubLabel: 'Set a frequency based on how often you want your expenses in Fyle to be exported to QuickBooks Desktop.',
topLevelMemoStructureLabel: 'Select the top level memo field data for QuickBooks Desktop',
topLevelMemoStructureSubLabel: 'You can customize the <b>data point</b> you would like to export to QuickBooks Desktop\’s <b>top-level memo</b> field while exporting expenses from ' + brandingConfig.brandName + '.',
memoStructureLabel: 'Set the line-item level memo field data for QuickBooks Desktop.',
memoStructureSubLabel: 'You can customize the data set you would like to export to QuickBooks Desktop\’s <b>transaction line-item level memo</b> field while exporting expenses from ' + brandingConfig.brandName + '.',
topLevelMemoStructureLabel: 'Customize the Top-Level Memo Field',
topLevelMemoStructureSubLabel: 'Select the datapoints you\'d like to export to QuickBooks Desktop’s top-level memo field when exporting expenses from Fyle.',
memoStructureLabel: 'Customize the Line-Item Level Memo Field',
memoStructureSubLabel: 'Select the datapoints you\'d like to export to QuickBooks Desktop\’s line-item level memo field when exporting expenses from Fyle.',
previewDescriptionFieldLabel: 'Preview of the Description Field',
otherPreferencesLabel: 'Other preferences',
otherPreferencesSubLabel: 'Based on your preference, you can choose whether you want to create any new records in QuickBooks Desktop from ' + brandingConfig.brandName + '.',
autoCreateMerchantsAsVendorsLabel: 'Auto-create merchants as vendors',
autoCreateMerchantsAsVendorsSubLabel: 'Fyle will auto-create a new vendor in QuickBooks Desktop if a merchant added by an employee does not have a corresponding match in QuickBooks Desktop. ',
skipExportLabel: 'Skip export of specific expenses from ' + brandingConfig.brandName + ' to QuickBooks Desktop',
skipExportSubLabel: 'You could choose to skip expenses from ' + brandingConfig.brandName + ' to QuickBooks Desktop by setting up a conditional rule. ',
autoCreateReimbursableEnitityLabel: 'Auto create reimbursable enitity',
autoCreateReimbursableEnititySubLabel: 'Do you want to create a reimbursable enitity if not present',
skipExportLabel: 'Skip Export of Specific Expenses from Fyle to QuickBooks Desktop',
skipExportSubLabel: 'Set up a conditional rule to selectively skip exporting certain expenses from Fyle to QuickBooks Desktop. ',
autoCreateReimbursableEnitityLabel: 'Auto-create fyle employees as ',
autoCreateReimbursableEnititySubLabel: 'If an employee in Fyle has no corresponding record in QuickBooks Desktop, the integration will automatically create a ',
accountingPeriodLabel: 'Post entries in the current accounting period',
accountingPeriodSubLabel: 'If there are expenses for which the accounting period is closed in QuickBooks Desktop, you can export those to the current month by enabling this option.'
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/core/models/common/advanced-settings.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export class AdvancedSettingsModel {
merchant: 'Pizza Hut',
report_number: 'C/2021/12/R/1',
spent_on: today.toLocaleDateString(),
expence_key: 'txDdlUFWkahX',
expense_key: 'txDdlUFWkahX',
expense_link: `${environment.fyle_app_url}/app/main/#/enterprise/view_expense/`
};
let memoPreviewText = '';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class QbdDirectAdvancedSettingsModel extends AdvancedSettingsModel {
}

static defaultTopMemoOptions(): string[] {
return ["employee_name", "expense_key"];
return ["employee_name", "Expense/Report ID"];
}

static formatMemoStructure(memoStructure: string[], defaultMemoOptions: string[]): string[] {
Expand Down Expand Up @@ -58,6 +58,9 @@ export class QbdDirectAdvancedSettingsModel extends AdvancedSettingsModel {

const topMemo: string[] = advancedSettingForm.controls.topMemoStructure.value;

const index = topMemo.indexOf('Expense/Report ID');
topMemo[index] = 'expense_key';

Comment on lines +61 to +63
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Implement more robust string replacement logic

The current implementation using array index manipulation could be fragile if the array structure changes or if the string is not found. Consider implementing a more robust mapping approach.

- const index = topMemo.indexOf('Expense/Report ID');
- topMemo[index] = 'expense_key';

+ // Map UI display values to API values
+ const topMemoMapped = topMemo.map(memo => 
+   memo === 'Expense/Report ID' ? 'expense_key' : memo
+ );
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const index = topMemo.indexOf('Expense/Report ID');
topMemo[index] = 'expense_key';
// Map UI display values to API values
const topMemoMapped = topMemo.map(memo =>
memo === 'Expense/Report ID' ? 'expense_key' : memo
);

const allSelectedEmails: EmailOption[] = advancedSettingForm.get('email')?.value;

const selectedEmailsEmails = allSelectedEmails?.filter((email: EmailOption) => adminEmails.includes(email));
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
<p>qbd-direct-onboarding-advanced-settings works!</p>
<div class="tw-pb-48-px">
<app-onboarding-steppers [onboardingSteps]="onboardingSteps"></app-onboarding-steppers>
<app-qbd-direct-advanced-settings></app-qbd-direct-advanced-settings>
</div>
Original file line number Diff line number Diff line change
@@ -1,12 +1,31 @@
import { Component } from '@angular/core';
import { CommonModule } from '@angular/common';
import { Component, OnInit } from '@angular/core';
import { QbdDirectSharedModule } from '../../qbd-direct-shared/qbd-direct-shared.module';
import { SharedModule } from 'src/app/shared/shared.module';
import { QbdDirectAdvancedSettingsComponent } from "../../qbd-direct-shared/qbd-direct-advanced-settings/qbd-direct-advanced-settings.component";
import { QbdDirectOnboardingModel } from 'src/app/core/models/qbd-direct/qbd-direct-configuration/qbd-direct-onboarding.model';
import { brandingContent } from 'src/app/branding/branding-config';
import { OnboardingStepper } from 'src/app/core/models/misc/onboarding-stepper.model';
import { WorkspaceService } from 'src/app/core/services/common/workspace.service';

@Component({
selector: 'app-qbd-direct-onboarding-advanced-settings',
standalone: true,
imports: [],
imports: [CommonModule, QbdDirectSharedModule, SharedModule, QbdDirectAdvancedSettingsComponent],
templateUrl: './qbd-direct-onboarding-advanced-settings.component.html',
styleUrl: './qbd-direct-onboarding-advanced-settings.component.scss'
})
export class QbdDirectOnboardingAdvancedSettingsComponent {
export class QbdDirectOnboardingAdvancedSettingsComponent implements OnInit {

brandingContent = brandingContent.configuration.advancedSettings;

onboardingSteps: OnboardingStepper[] = new QbdDirectOnboardingModel().getOnboardingSteps(this.brandingContent.stepName, this.workspaceService.getOnboardingState());
Comment on lines +20 to +22
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Move complex initialization to ngOnInit.

The onboardingSteps initialization involves multiple service calls and complex operations. Consider moving this to ngOnInit for better lifecycle management and error handling.

-  onboardingSteps: OnboardingStepper[] = new QbdDirectOnboardingModel().getOnboardingSteps(this.brandingContent.stepName, this.workspaceService.getOnboardingState());
+  onboardingSteps: OnboardingStepper[] = [];
+
+  ngOnInit(): void {
+    try {
+      const onboardingState = this.workspaceService.getOnboardingState();
+      this.onboardingSteps = new QbdDirectOnboardingModel().getOnboardingSteps(
+        this.brandingContent.stepName,
+        onboardingState
+      );
+    } catch (error) {
+      console.error('Failed to initialize onboarding steps:', error);
+      // Handle error appropriately
+    }
+  }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
brandingContent = brandingContent.configuration.advancedSettings;
onboardingSteps: OnboardingStepper[] = new QbdDirectOnboardingModel().getOnboardingSteps(this.brandingContent.stepName, this.workspaceService.getOnboardingState());
brandingContent = brandingContent.configuration.advancedSettings;
onboardingSteps: OnboardingStepper[] = [];
ngOnInit(): void {
try {
const onboardingState = this.workspaceService.getOnboardingState();
this.onboardingSteps = new QbdDirectOnboardingModel().getOnboardingSteps(
this.brandingContent.stepName,
onboardingState
);
} catch (error) {
console.error('Failed to initialize onboarding steps:', error);
// Handle error appropriately
}
}


constructor(
private workspaceService: WorkspaceService
) { }

ngOnInit(): void {
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@

<app-configuration-toggle-field *ngIf="isReimbursableExportTypePresent"
[form]="advancedSettingsForm"
[label]="brandingContent.autoCreateReimbursableEnitityLabel"
[label]="brandingContent.autoCreateReimbursableEnitityLabel + (employeeMapping | snakeCaseToSpaceCase | lowercase) + 's in QuickBooks Desktop'"
[iconPath]="'user-plus'"
[subLabel]="brandingContent.autoCreateReimbursableEnititySubLabel"
[subLabel]="brandingContent.autoCreateReimbursableEnititySubLabel + (employeeMapping | snakeCaseToSpaceCase | lowercase) + ' record for them, ensuring expenses are posted to this new record.'"
[formControllerName]="'autoCreateReimbursableEnitity'">
</app-configuration-toggle-field>

Expand Down Expand Up @@ -128,7 +128,7 @@
</div>

</div>
<app-configuration-step-footer [ctaText]="!saveInProgress ? (isOnboarding ? ConfigurationCtaText.SAVE_AND_CONTINUE : ConfigurationCtaText.SAVE) : ConfigurationCtaText.SAVING" [isButtonDisabled]="!advancedSettingsForm.valid || saveInProgress || !skipExportForm.valid" (save)="save()"></app-configuration-step-footer>
<app-configuration-step-footer [ctaText]="!saveInProgress ? (isOnboarding ? ConfigurationCtaText.SAVE_AND_CONTINUE : ConfigurationCtaText.SAVE) : ConfigurationCtaText.SAVING" [isButtonDisabled]="!advancedSettingsForm.valid || saveInProgress || !skipExportForm.valid" (save)="save()" [showBackButton]="true" (navigateToPreviousStep)="navigateToPreviousStep()"></app-configuration-step-footer>
</form>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ export class QbdDirectAdvancedSettingsComponent implements OnInit {
}
}

navigateToPreviousStep() {
this.router.navigate([`/integrations/qbd_direct/onboarding/import_settings`]);
}

save() {
this.saveInProgress = true;
this.saveSkipExport();
Expand Down
Loading