Skip to content

Commit

Permalink
pr comments
Browse files Browse the repository at this point in the history
  • Loading branch information
anishfyle committed Dec 17, 2024
1 parent a14dcde commit 7890ba2
Show file tree
Hide file tree
Showing 16 changed files with 25 additions and 103 deletions.
1 change: 0 additions & 1 deletion src/app/core/models/enum/enum.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ export enum IntacctOnboardingState {

export enum QBOOnboardingState {
CONNECTION = 'CONNECTION',
MAP_EMPLOYEES = 'MAP_EMPLOYEES',
EXPORT_SETTINGS = 'EXPORT_SETTINGS',
IMPORT_SETTINGS = 'IMPORT_SETTINGS',
ADVANCED_CONFIGURATION = 'ADVANCED_CONFIGURATION',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,4 +301,12 @@ export class QBOExportSettingModel extends ExportSettingModel {

return exportSettingPayload;
}

static createEmployeeSettingsForm(existingEmployeeFieldMapping: EmployeeFieldMapping, autoMapEmployees: boolean): FormGroup {
return new FormGroup({
employeeMapping: new FormControl(existingEmployeeFieldMapping, Validators.required),
autoMapEmployee: new FormControl(autoMapEmployees),
searchOption: new FormControl('')
});
}
}
20 changes: 5 additions & 15 deletions src/app/core/models/qbo/qbo-configuration/qbo-onboarding.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { OnboardingStepper } from "../../misc/onboarding-stepper.model";

type QBOOnboardingStepperMap = {
[QBOOnboardingState.CONNECTION]: number,
[QBOOnboardingState.MAP_EMPLOYEES]: number,
[QBOOnboardingState.EXPORT_SETTINGS]: number,
[QBOOnboardingState.IMPORT_SETTINGS]: number,
[QBOOnboardingState.ADVANCED_CONFIGURATION]: number,
Expand All @@ -24,14 +23,6 @@ export class QBOOnboardingModel {
route: '/integrations/qbo/onboarding/connector',
styleClasses: ['step-name-connector--text']
},
{
active: false,
completed: false,
step: brandingContent.configuration.employeeSetting.stepName,
icon: 'mapping-medium',
route: '/integrations/qbo/onboarding/employee_settings',
styleClasses: ['step-name-export--text']
},
{
active: false,
completed: false,
Expand Down Expand Up @@ -60,12 +51,11 @@ export class QBOOnboardingModel {

private readonly onboardingStateStepMap: QBOOnboardingStepperMap = {
[QBOOnboardingState.CONNECTION]: 1,
[QBOOnboardingState.MAP_EMPLOYEES]: 2,
[QBOOnboardingState.EXPORT_SETTINGS]: 3,
[QBOOnboardingState.IMPORT_SETTINGS]: 4,
[QBOOnboardingState.ADVANCED_CONFIGURATION]: 5,
[QBOOnboardingState.COMPLETE]: 6,
[QBOOnboardingState.CLONE_SETTINGS]: 7
[QBOOnboardingState.EXPORT_SETTINGS]: 2,
[QBOOnboardingState.IMPORT_SETTINGS]: 3,
[QBOOnboardingState.ADVANCED_CONFIGURATION]: 4,
[QBOOnboardingState.COMPLETE]: 5,
[QBOOnboardingState.CLONE_SETTINGS]: 6
};

getOnboardingSteps(currentStep: string, onboardingState: QBOOnboardingState): OnboardingStepper[] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ export class QboCloneSettingsComponent implements OnInit {
acceptWarning(data: ConfigurationWarningOut): void {
this.isWarningDialogVisible = false;
if (data.hasAccepted) {
this.router.navigate([`/integrations/qbo/onboarding/employee_settings`]);
this.router.navigate([`/integrations/qbo/onboarding/export_settings`]);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export class QboOnboardingConnectorComponent implements OnInit, OnDestroy {
if (this.isContinueDisabled) {
return;
} else if (this.isCloneSettingsDisabled) {
this.router.navigate(['/integrations/qbo/onboarding/employee_settings']);
this.router.navigate(['/integrations/qbo/onboarding/export_settings']);
return;
}

Expand Down Expand Up @@ -145,7 +145,7 @@ export class QboOnboardingConnectorComponent implements OnInit, OnDestroy {
this.isContinueDisabled = false;
this.isCloneSettingsDisabled = true;
} else {
this.router.navigate(['/integrations/qbo/onboarding/employee_settings']);
this.router.navigate(['/integrations/qbo/onboarding/export_settings']);
}
});
}
Expand Down

This file was deleted.

Empty file.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { RouterModule, Routes } from '@angular/router';
import { QboOnboardingComponent } from './qbo-onboarding.component';
import { QboOnboardingLandingComponent } from './qbo-onboarding-landing/qbo-onboarding-landing.component';
import { QboOnboardingConnectorComponent } from './qbo-onboarding-connector/qbo-onboarding-connector.component';
import { QboOnboardingEmployeeSettingsComponent } from './qbo-onboarding-employee-settings/qbo-onboarding-employee-settings.component';
import { QboOnboardingExportSettingsComponent } from './qbo-onboarding-export-settings/qbo-onboarding-export-settings.component';
import { QboOnboardingImportSettingsComponent } from './qbo-onboarding-import-settings/qbo-onboarding-import-settings.component';
import { QboOnboardingAdvancedSettingsComponent } from './qbo-onboarding-advanced-settings/qbo-onboarding-advanced-settings.component';
Expand All @@ -24,11 +23,6 @@ const routes: Routes = [
path: 'connector',
component: QboOnboardingConnectorComponent
},
{
path: 'employee_settings',
component: QboOnboardingEmployeeSettingsComponent,
canActivate: [QboTokenGuard]
},
{
path: 'export_settings',
component: QboOnboardingExportSettingsComponent,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { QboOnboardingRoutingModule } from './qbo-onboarding-routing.module';
import { QboOnboardingComponent } from './qbo-onboarding.component';
import { QboOnboardingLandingComponent } from './qbo-onboarding-landing/qbo-onboarding-landing.component';
import { QboOnboardingConnectorComponent } from './qbo-onboarding-connector/qbo-onboarding-connector.component';
import { QboOnboardingEmployeeSettingsComponent } from './qbo-onboarding-employee-settings/qbo-onboarding-employee-settings.component';
import { QboOnboardingExportSettingsComponent } from './qbo-onboarding-export-settings/qbo-onboarding-export-settings.component';
import { QboOnboardingImportSettingsComponent } from './qbo-onboarding-import-settings/qbo-onboarding-import-settings.component';
import { QboOnboardingAdvancedSettingsComponent } from './qbo-onboarding-advanced-settings/qbo-onboarding-advanced-settings.component';
Expand All @@ -23,7 +22,6 @@ import { QboCloneSettingsComponent } from './qbo-clone-settings/qbo-clone-settin
QboOnboardingComponent,
QboOnboardingLandingComponent,
QboOnboardingConnectorComponent,
QboOnboardingEmployeeSettingsComponent,
QboOnboardingExportSettingsComponent,
QboOnboardingImportSettingsComponent,
QboOnboardingAdvancedSettingsComponent,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -780,15 +780,9 @@ describe('QboExportSettingsComponent', () => {
});

describe('navigateToPreviousStep', () => {
it('should navigate to employee_settings when mapEmployees feature flag is true', () => {
it('should navigate to connector when mapEmployees feature flag is true', () => {
mockBrandingConfig.featureFlags.mapEmployees = true;
component.navigateToPreviousStep();
expect(routerSpy.navigate).toHaveBeenCalledWith(['/integrations/qbo/onboarding/employee_settings']);
});

xit('should navigate to connector when mapEmployees feature flag is false', () => {
mockBrandingConfig.featureFlags.mapEmployees = false;
component.navigateToPreviousStep();
expect(routerSpy.navigate).toHaveBeenCalledWith(['/integrations/qbo/onboarding/connector']);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,7 @@ export class QboExportSettingsComponent implements OnInit {
}

navigateToPreviousStep(): void {
if (brandingFeatureConfig.featureFlags.mapEmployees) {
this.router.navigate([`/integrations/qbo/onboarding/employee_settings`]);
} else {
this.router.navigate([`/integrations/qbo/onboarding/connector`]);
}
this.router.navigate([`/integrations/qbo/onboarding/connector`]);
}

refreshDimensions() {
Expand Down Expand Up @@ -442,13 +438,12 @@ export class QboExportSettingsComponent implements OnInit {
forkJoin([
this.exportSettingService.getExportSettings(),
this.workspaceService.getWorkspaceGeneralSettings(),
this.employeeSettingService.getEmployeeSettings(),
this.employeeSettingService.getDistinctQBODestinationAttributes([FyleField.EMPLOYEE, FyleField.VENDOR]),
...groupedAttributes
]).subscribe(([exportSetting, workspaceGeneralSettings, employeeSettings, destinationAttributes, bankAccounts, cccAccounts, accountsPayables, vendors]) => {
]).subscribe(([exportSetting, workspaceGeneralSettings, destinationAttributes, bankAccounts, cccAccounts, accountsPayables, vendors]) => {

this.exportSettings = exportSetting;
this.employeeFieldMapping = employeeSettings.workspace_general_settings.employee_field_mapping;
this.employeeFieldMapping = workspaceGeneralSettings.employee_field_mapping;
this.setLiveEntityExample(destinationAttributes);
this.bankAccounts = bankAccounts.results.map((option) => QBOExportSettingModel.formatGeneralMappingPayload(option));
this.cccAccounts = cccAccounts.results.map((option) => QBOExportSettingModel.formatGeneralMappingPayload(option));
Expand All @@ -463,11 +458,10 @@ export class QboExportSettingsComponent implements OnInit {

this.addMissingOptions();
this.exportSettingForm = QBOExportSettingModel.mapAPIResponseToFormGroup(this.exportSettings, this.employeeFieldMapping);
this.employeeSettingForm = new FormGroup({
employeeMapping: new FormControl(this.existingEmployeeFieldMapping, Validators.required),
autoMapEmployee: new FormControl(employeeSettings.workspace_general_settings?.auto_map_employees),
searchOption: new FormControl('')
});
this.employeeSettingForm = QBOExportSettingModel.createEmployeeSettingsForm(
this.existingEmployeeFieldMapping,
workspaceGeneralSettings.auto_map_employees
);
if (!this.brandingFeatureConfig.featureFlags.exportSettings.reimbursableExpenses) {
this.exportSettingForm.controls.creditCardExpense.patchValue(true);
}
Expand Down
1 change: 0 additions & 1 deletion src/app/integrations/qbo/qbo.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ export class QboComponent implements OnInit {
if (pathName === '/integrations/qbo') {
const onboardingStateComponentMap = {
[QBOOnboardingState.CONNECTION]: '/integrations/qbo/onboarding/landing',
[QBOOnboardingState.MAP_EMPLOYEES]: '/integrations/qbo/onboarding/employee_settings',
[QBOOnboardingState.EXPORT_SETTINGS]: '/integrations/qbo/onboarding/export_settings',
[QBOOnboardingState.IMPORT_SETTINGS]: '/integrations/qbo/onboarding/import_settings',
[QBOOnboardingState.ADVANCED_CONFIGURATION]: '/integrations/qbo/onboarding/advanced_settings',
Expand Down
1 change: 0 additions & 1 deletion src/app/integrations/qbo/qbo.fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ export const mockQBOCredential = {

export const testOnboardingState = [
{ state: QBOOnboardingState.CONNECTION, route: '/integrations/qbo/onboarding/landing' },
{ state: QBOOnboardingState.MAP_EMPLOYEES, route: '/integrations/qbo/onboarding/employee_settings' },
{ state: QBOOnboardingState.EXPORT_SETTINGS, route: '/integrations/qbo/onboarding/export_settings' },
{ state: QBOOnboardingState.IMPORT_SETTINGS, route: '/integrations/qbo/onboarding/import_settings' },
{ state: QBOOnboardingState.ADVANCED_CONFIGURATION, route: '/integrations/qbo/onboarding/advanced_settings' },
Expand Down
3 changes: 1 addition & 2 deletions src/stories/SubMenu.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,10 @@ type Story = StoryObj<SubMenuComponent>;
export const simple: Story = {
args: {
modules: [
{label: 'Map Employees', routerLink: '/integrations/qbo/main/configuration/employee_settings'},
{label: 'Export Settings', routerLink: '/integrations/qbo/main/configuration/export_settings'},
{label: 'Import Settings', routerLink: '/integrations/qbo/main/configuration/import_settings'},
{label: 'Advanced Settings', routerLink: '/integrations/qbo/main/configuration/advanced_settings'}
],
activeModule: {label: 'Map Employees', routerLink: '/integrations/qbo/main/configuration/employee_settings'}
activeModule: {label: 'Export Settings', routerLink: '/integrations/qbo/main/configuration/export_settings'}
}
};

0 comments on commit 7890ba2

Please sign in to comment.