Skip to content

Commit

Permalink
export settings page fixes (#464)
Browse files Browse the repository at this point in the history
* export settings page fixes

* CSS fixes

* CSS fixes

* fixes

* 365

* 365 v2

* not showing submit feedback

* show dropdown true

* click here fix

* expose business central

* date changes

* show ms dynamics

* changed order

* removed dup div

* image update

* image update

* click here update

* PR Comments

* lint fix

* revert changes

---------

Co-authored-by: Fyle <[email protected]>
Co-authored-by: anishfyle <[email protected]>
  • Loading branch information
3 people authored Jan 25, 2024
1 parent feb7e07 commit 08849e1
Show file tree
Hide file tree
Showing 46 changed files with 289 additions and 139 deletions.
2 changes: 1 addition & 1 deletion src/app/core/guard/business-central-token.guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class BusinessCentralTokenGuard implements CanActivate {
catchError(error => {
if (error.status === 400) {
globalCacheBusterNotifier.next();
this.toastService.displayToastMessage(ToastSeverity.ERROR, 'Oops! Your Dynamic 360 Business Central connection expired, please connect again');
this.toastService.displayToastMessage(ToastSeverity.ERROR, 'Oops! Your Dynamic 365 Business Central connection expired, please connect again');

const onboardingState: BusinessCentralOnboardingState = this.workspaceService.getOnboardingState();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FormGroup, FormControl } from "@angular/forms";
import { FormGroup, FormControl, Validators } from "@angular/forms";
import { AutoMapEmployeeOptions, BusinessCentralExportType, CCCExpenseState, ExpenseGroupedBy, ExpenseState, ExportDateType, FyleField, NameInJEField } from "../../enum/enum.model";
import { BusinessCentralDestinationAttributes } from "../db/business-central-destination-attribute.model";
import { GroupedDestinationAttribute } from "../../db/destination-attribute.model";
Expand Down Expand Up @@ -56,22 +56,26 @@ export class BusinessCentralExportSettingModel {
label: 'Card Transaction Post date',
value: ExportDateType.POSTED_AT
},
{
label: 'Current Date',
value: ExportDateType.CURRENT_DATE
},
{
label: 'Last Spent Date',
value: ExportDateType.LAST_SPENT_AT
},
{
label: 'Created At',
value: ExportDateType.CREATED_AT
label: 'Spent Date',
value: ExportDateType.SPENT_AT
}
];
}

static getReimbursableExpenseGroupingDateOptions(): BusinessCentralExportSettingFormOption[] {
return [
{
label: 'Created At',
value: ExportDateType.CREATED_AT
label: 'Current Date',
value: ExportDateType.CURRENT_DATE
},
{
label: 'Spent Date',
Expand Down Expand Up @@ -106,19 +110,32 @@ export class BusinessCentralExportSettingModel {
];
}

static getExpenseState(): BusinessCentralExportSettingFormOption[] {
return [
{
label: 'Processing',
value: ExpenseState.PAYMENT_PROCESSING
},
{
label: 'Closed',
value: ExpenseState.PAID
}
];
static getCCCExpenseState(): BusinessCentralExportSettingFormOption[] {
return [
{
label: 'Approved',
value: CCCExpenseState.APPROVED
},
{
label: 'Closed',
value: CCCExpenseState.PAID
}
];
}

static getReimbursableExpenseState(): BusinessCentralExportSettingFormOption[] {
return [
{
label: 'Processing',
value: ExpenseState.PAYMENT_PROCESSING
},
{
label: 'Closed',
value: ExpenseState.PAID
}
];
}

static getEntityOptions(): BusinessCentralExportSettingFormOption[] {
return [
{
Expand Down Expand Up @@ -166,7 +183,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(destinationAttribute.ACCOUNT, exportSettings?.default_bank_account_id) : null),
reimbursableEmployeeMapping: new FormControl(exportSettings?.employee_field_mapping ? exportSettings?.employee_field_mapping : 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),
defaultVendorName: new FormControl(exportSettings?.default_vendor_name ? findObjectByDestinationId(destinationAttribute.VENDOR, exportSettings?.default_vendor_id) : null)
Expand Down
2 changes: 1 addition & 1 deletion src/app/core/models/enum/enum.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export enum ClickEvent {
PREVIEW_INTACCT_EXPORT = 'Preview Sage Intacct Export',
INTACCT_EXPORT = 'Export Sage Intacct',
CONNECT_SAGE300 = 'Connect Sage 300 CRE',
CONNECT_BUSINESS_CENTRAL = 'Connect Dynamic 360 Business Central'
CONNECT_BUSINESS_CENTRAL = 'Connect Dynamic 365 Business Central'
}

export enum ProgressPhase {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ export class BusinessCentralHelperService {
importAttributes(isRefresh: boolean): void {
this.workspaceService.importFyleAttributes(isRefresh).subscribe();
this.mappingService.importBusinessCentralAttributes(isRefresh).subscribe();
this.toastService.displayToastMessage(ToastSeverity.SUCCESS, 'Refreshing data dimensions from Dynamics 360 Business Central');
this.toastService.displayToastMessage(ToastSeverity.SUCCESS, 'Refreshing data dimensions from Dynamics 365 Business Central');
}
}
14 changes: 10 additions & 4 deletions src/app/core/services/common/helper.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,15 @@ export class HelperService {
form.controls[controllerName].addValidators(Validators.required);
}

clearValidatorAndResetValue(form: FormGroup, controllerName: string): void {
clearValidatorAndResetValue(form: FormGroup, controllerName: string, commonFormFields: string[] | void): void {
form.controls[controllerName].clearValidators();
form.controls[controllerName].setValue(null);
if (commonFormFields) {
if (commonFormFields.indexOf(controllerName) === -1) {
form.controls[controllerName].reset();
}
} else {
form.controls[controllerName].reset();
}
}

setSage300ExportTypeControllerValue(form: FormGroup, controllerName: string): void {
Expand Down Expand Up @@ -109,7 +115,7 @@ export class HelperService {
});
}

setExportTypeValidatorsAndWatchers(exportTypeValidatorRule: ExportModuleRule[], form: FormGroup): void {
setExportTypeValidatorsAndWatchers(exportTypeValidatorRule: ExportModuleRule[], form: FormGroup, commonFormFields: string[] | void): void {
Object.values(exportTypeValidatorRule).forEach((values) => {
form.controls[values.formController].valueChanges.subscribe((isSelected) => {
const urlSplit = this.router.url.split('/');
Expand All @@ -123,7 +129,7 @@ export class HelperService {
});
} else {
value.forEach((element: any) => {
this.clearValidatorAndResetValue(form, element);
this.clearValidatorAndResetValue(form, element, commonFormFields);
});
}
});
Expand Down
2 changes: 1 addition & 1 deletion src/app/integrations/bamboo-hr/bamboo-hr.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
(syncEmployees)="syncEmployees()"
></app-landing-page-header>

<app-landing-page-body *ngIf="!isLoading && !isBambooConnected && !showErrorScreen" [headerText]="'Auto sync employee details between Bamboo HR and ' + brandingConfig.brandName + '.'" [svgPath]="'assets/flow-charts/bamboo-hr-flow-chart.svg'" [redirectLink]="brandingKbArticles.topLevelArticles.BAMBOO_HR"></app-landing-page-body>
<app-landing-page-body *ngIf="!isLoading && !isBambooConnected && !showErrorScreen" [headerText]="'Auto sync employee details between Bamboo HR and ' + brandingConfig.brandName + '.'" [svgPath]="'assets/flow-charts/bamboo-hr-flow-chart.svg'" [redirectLink]="brandingKbArticles.topLevelArticles.BAMBOO_HR" [appName]="appName"></app-landing-page-body>

<app-error *ngIf="showErrorScreen"></app-error>

Expand Down
4 changes: 3 additions & 1 deletion src/app/integrations/bamboo-hr/bamboo-hr.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { MessageService } from 'primeng/api';
import { catchError, concat, merge, of, toArray } from 'rxjs';
import { brandingConfig, brandingKbArticles } from 'src/app/branding/branding-config';
import { BambooHr, BambooHRConfiguration, BambooHRConfigurationPost, BambooHrModel, EmailOption } from 'src/app/core/models/bamboo-hr/bamboo-hr.model';
import { ClickEvent, Page, ToastSeverity, TrackingApp } from 'src/app/core/models/enum/enum.model';
import { AppName, ClickEvent, Page, ToastSeverity, TrackingApp } from 'src/app/core/models/enum/enum.model';
import { Org } from 'src/app/core/models/org/org.model';
import { BambooHrService } from 'src/app/core/services/bamboo-hr/bamboo-hr.service';
import { TrackingService } from 'src/app/core/services/integration/tracking.service';
Expand All @@ -27,6 +27,8 @@ export class BambooHrComponent implements OnInit {

isLoading: boolean = true;

appName: AppName = AppName.BAMBOO_HR;

hideRefreshIcon: boolean = true;

isConfigurationSaveInProgress: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { MenuItem } from 'primeng/api';
import { AppName } from 'src/app/core/models/enum/enum.model';
import { BusinessCentralHelperService } from 'src/app/core/services/business-central/business-central-core/business-central-helper.service';
import { AccountingExportService } from 'src/app/core/services/common/accounting-export.service';
import { HelperService } from 'src/app/core/services/common/helper.service';
import { Sage300HelperService } from 'src/app/core/services/sage300/sage300-helper/sage300-helper.service';

@Component({
selector: 'app-business-central-main',
Expand All @@ -27,7 +26,7 @@ export class BusinessCentralMainComponent implements OnInit {
constructor(
private accountingExportService: AccountingExportService,
private router: Router,
private helperService: Sage300HelperService
private helperService: BusinessCentralHelperService
) { }

refreshDimensions(isRefresh: boolean) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
(warningAccepted)="acceptWarning($event)"
[isWarningVisible]="isIncorrectBusinessCentralConnectedDialogVisible"
[headerText]="'Incorrect account selected'"
[contextText]="'You had previously set up the integration with a different Dynamic 360 Business Central account. Please choose the same to restore the settings'"
[contextText]="'You had previously set up the integration with a different Dynamic 365 Business Central account. Please choose the same to restore the settings'"
[iconPath]="'assets/icons/alert_dialog.svg'"
[confirmBtnText]="'Re connect'"
[showSecondaryCTA]="false">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ export class BusinessCentralOnboardingConnectorComponent implements OnInit, OnDe
this.businessCentralConnectorService.connectBusinessCentral(payload).subscribe((businessCentralCredential: BusinessCentralCredential) => {
this.getCompanyDetails();
}, (error) => {
const errorMessage = 'message' in error ? error.message : 'Failed to connect to Dynamic 360 Business Central. Please try again';
if (errorMessage === 'Please choose the correct Dynamic 360 Business Central account') {
const errorMessage = 'message' in 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.isIncorrectBusinessCentralConnectedDialogVisible = true;
} else {
this.toastService.displayToastMessage(ToastSeverity.ERROR, errorMessage);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
<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.'" [embedVideo]="embedVideoLink" [svgPath]="'assets/flow-charts/sage300-flow-chart.svg'"></app-landing-page-body>
<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'" [embedVideo]="''" [appName]="appName"></app-landing-page-body>
</div>
</div>
<app-configuration-confirmation-dialog *ngIf="isIncorrectQBOConnectedDialogVisible"
(warningAccepted)="acceptWarning($event)"
[isWarningVisible]="isIncorrectQBOConnectedDialogVisible"
[headerText]="'Incorrect account selected'"
[contextText]="'You had previously set up the integration with a different Dynamic 360 Business Central account. Please choose the same to restore the settings'"
[contextText]="'You had previously set up the integration with a different Dynamic 365 Business Central account. Please choose the same to restore the settings'"
[iconPath]="'assets/icons/alert_dialog.svg'"
[confirmBtnText]="'Re connect'"
[showSecondaryCTA]="false">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { NavigationExtras, Router } from '@angular/router';
import { Subscription } from 'rxjs';
import { brandingConfig, brandingDemoVideoLinks, brandingKbArticles } from 'src/app/branding/branding-config';
import { BusinessCentralConnectorPost, BusinessCentralConnectorModel } from 'src/app/core/models/business-central/business-central-configuration/business-central-connector.model';
import { BusinessCentralOnboardingState, ToastSeverity } from 'src/app/core/models/enum/enum.model';
import { AppName, BusinessCentralOnboardingState, ToastSeverity } from 'src/app/core/models/enum/enum.model';
import { ConfigurationWarningOut } from 'src/app/core/models/misc/configuration-warning.model';
import { BusinessCentralConnectorService } from 'src/app/core/services/business-central/business-central-configuration/business-central-connector.service';
import { BusinessCentralHelperService } from 'src/app/core/services/business-central/business-central-core/business-central-helper.service';
Expand All @@ -19,6 +19,8 @@ import { environment } from 'src/environments/environment';
})
export class BusinessCentralOnboardingLandingComponent implements OnInit, OnDestroy {

appName: AppName = AppName.BUSINESS_CENTRAL;

redirectLink = brandingKbArticles.onboardingArticles.BUSINESS_CENTRAL.LANDING;

embedVideoLink = brandingDemoVideoLinks.onboarding.BUSINESS_CENTRAL;
Expand Down Expand Up @@ -68,8 +70,8 @@ export class BusinessCentralOnboardingLandingComponent implements OnInit, OnDest
this.checkProgressAndRedirect(code);
});
}, (error) => {
const errorMessage = 'message' in error.error ? error.error.message : 'Failed to connect to Dynamic 360 Business Central. Please try again';
if (errorMessage === 'Please choose the correct Dynamic 360 Business Central account') {
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;
} else {
this.toastService.displayToastMessage(ToastSeverity.ERROR, errorMessage);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.preview-text {
@apply tw-text-14-px tw-font-400 tw-text-faded-text-color tw-pb-24-px tw-pl-62-px tw-pr-24-px #{!important} ;
@apply tw-text-14-px tw-font-400 tw-text-faded-text-color tw-pb-24-px tw-pl-62-px tw-pr-24-px tw-pt-0 #{!important} ;
}

.preview-box {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ export class BusinessCentralAdvancedSettingsComponent implements OnInit {
if (this.advancedSettingForm.controls.skipExport) {
if (this.skipExportForm.controls.condition1.value) {
if (this.skipExportForm.controls.condition2.value) {
return (this.skipExportForm.controls.value1.value || this.skipExportForm.controls.operator1.value === CustomOperatorOption.IsEmpty) && (this.skipExportForm.controls.value2.value || this.skipExportForm.controls.operator2.value === CustomOperatorOption.IsEmpty) ? true : false;
return (this.skipExportForm.controls.value1.value || this.skipExportForm.controls.operator1.value === CustomOperatorOption.IsEmpty || this.skipExportForm.controls.operator1.value === CustomOperatorOption.IsNotEmpty) && (this.skipExportForm.controls.value2.value || this.skipExportForm.controls.operator2.value === CustomOperatorOption.IsEmpty || this.skipExportForm.controls.operator2.value === CustomOperatorOption.IsNotEmpty) ? true : false;
}
return this.skipExportForm.controls.value1.value || this.skipExportForm.controls.operator1.value === CustomOperatorOption.IsEmpty ? true : false;
return this.skipExportForm.controls.value1.value || this.skipExportForm.controls.operator1.value === CustomOperatorOption.IsEmpty || this.skipExportForm.controls.operator1.value === CustomOperatorOption.IsNotEmpty ? true : false;
}
}
return true;
Expand Down
Loading

0 comments on commit 08849e1

Please sign in to comment.