Skip to content

Commit dbf2148

Browse files
authored
testing fixes (#443)
testing fixes
1 parent 868a01f commit dbf2148

File tree

17 files changed

+76
-69
lines changed

17 files changed

+76
-69
lines changed

src/app/integrations/qbo/qbo-onboarding/qbo-clone-settings/qbo-clone-settings.component.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
align-items: center;
2424
position: absolute;
2525
left: 8px;
26-
bottom: 1px;
26+
bottom: 0px;
2727
font-size: 12px;
2828
color: white;
2929
font-weight: 500;
@@ -36,7 +36,7 @@
3636
align-items: center;
3737
position: absolute;
3838
left: 24px;
39-
bottom: 1px;
39+
bottom: 0px;
4040
font-size: 12px;
4141
color: white;
4242
font-weight: 500;

src/app/integrations/sage300/sage300-main/sage300-mapping/sage300-base-mapping/sage300-base-mapping.component.ts

Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { Component, OnInit } from '@angular/core';
22
import { ActivatedRoute } from '@angular/router';
3+
import { forkJoin } from 'rxjs';
34
import { DestinationAttribute } from 'src/app/core/models/db/destination-attribute.model';
5+
import { MappingSetting } from 'src/app/core/models/db/mapping-setting.model';
46
import { AppName, FyleField, IntegrationName, ToastSeverity } from 'src/app/core/models/enum/enum.model';
57
import { IntegrationsToastService } from 'src/app/core/services/common/integrations-toast.service';
68
import { MappingService } from 'src/app/core/services/common/mapping.service';
@@ -47,39 +49,28 @@ export class Sage300BaseMappingComponent implements OnInit {
4749
});
4850
}
4951

50-
getSourceType() {
52+
getSourceType(results: MappingSetting[]) {
5153
if (this.sourceField==='EMPLOYEE') {
5254
return 'VENDOR';
53-
}
54-
55-
if (this.sourceField==='CATEGORY') {
55+
} else if (this.sourceField==='CATEGORY') {
5656
return 'ACCOUNT';
5757
}
58-
59-
return '';
58+
const destinationField = results.find((field) => field.source_field === this.sourceField)?.destination_field;
59+
return destinationField ? destinationField : '';
6060
}
6161

6262
setupPage(): void {
6363
this.sourceField = this.route.snapshot.params.source_field.toUpperCase();
64-
this.mappingService.getExportSettings().subscribe((response) => {
65-
this.reimbursableExpenseObject = response.reimbursable_expenses_object;
66-
this.cccExpenseObject = response.corporate_credit_card_expenses_object;
67-
68-
this.showAutoMapEmployee = response.auto_map_employees ? true : false;
69-
70-
this.destinationField = this.getSourceType();
71-
this.mappingService.getGroupedDestinationAttributes([this.destinationField], 'v2').subscribe((response: any) => {
72-
if (this.sourceField===FyleField.EMPLOYEE) {
73-
this.destinationOptions = this.destinationField===FyleField.EMPLOYEE ? response.EMPLOYEE : response.VENDOR;
74-
}
75-
if (this.sourceField==='CATEGORY') {
76-
if (this.destinationField === 'EXPENSE_TYPE') {
77-
this.destinationOptions = response.EXPENSE_TYPE;
78-
} else {
79-
this.destinationOptions = response.ACCOUNT;
80-
}
81-
}
82-
64+
forkJoin(
65+
this.mappingService.getExportSettings(),
66+
this.mappingService.getMappingSettings()
67+
).subscribe(([exportSettingsResponse, mappingSettingsResponse]) => {
68+
this.reimbursableExpenseObject = exportSettingsResponse.reimbursable_expenses_object;
69+
this.cccExpenseObject = exportSettingsResponse.corporate_credit_card_expenses_object;
70+
this.showAutoMapEmployee = exportSettingsResponse.auto_map_employees ? true : false;
71+
this.destinationField = this.getSourceType(mappingSettingsResponse.results);
72+
this.mappingService.getDestinationAttributes([this.destinationField], 'v2').subscribe((response: any) => {
73+
this.destinationOptions = response;
8374
this.isLoading = false;
8475
});
8576
});

src/app/integrations/sage300/sage300-onboarding/sage300-onboarding-connector/sage300-onboarding-connector.component.ts

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ export class Sage300OnboardingConnectorComponent implements OnInit {
3232

3333
readonly brandingConfig = brandingConfig;
3434

35+
isSage300Connected: boolean = false;
36+
3537
constructor(
3638
private onboardingService: Sage300OnboardingService,
3739
private router: Router,
@@ -42,7 +44,7 @@ export class Sage300OnboardingConnectorComponent implements OnInit {
4244
private mappingService: Sage300MappingService
4345
) { }
4446

45-
save() {
47+
private saveConnection() {
4648
const userID = this.connectSage300Form.value.userID;
4749
const companyID = this.connectSage300Form.value.companyID;
4850
const userPassword = this.connectSage300Form.value.userPassword;
@@ -54,24 +56,35 @@ export class Sage300OnboardingConnectorComponent implements OnInit {
5456
password: userPassword,
5557
workspace: this.workspaceService.getWorkspaceId()
5658
}).subscribe((response) => {
57-
this.isLoading = false;
58-
this.toastService.displayToastMessage(ToastSeverity.SUCCESS, 'Connection Successful.');
59-
this.workspaceService.setOnboardingState(Sage300OnboardingState.EXPORT_SETTINGS);
60-
this.mappingService.importSage300Attributes(true).subscribe();
61-
this.router.navigate([this.onboardingSteps[1].route]);
59+
this.mappingService.importSage300Attributes(true).subscribe(() => {
60+
this.isLoading = false;
61+
this.toastService.displayToastMessage(ToastSeverity.SUCCESS, 'Connection Successful.');
62+
this.workspaceService.setOnboardingState(Sage300OnboardingState.EXPORT_SETTINGS);
63+
this.router.navigate([this.onboardingSteps[1].route]);
64+
});
6265
}, () => {
6366
this.isLoading = false;
6467
this.toastService.displayToastMessage(ToastSeverity.ERROR, 'Error while connecting, please try again later.');
6568
});
6669
}
6770

71+
save() {
72+
if (this.isSage300Connected) {
73+
this.router.navigate([this.onboardingSteps[1].route]);
74+
} else {
75+
this.saveConnection();
76+
}
77+
}
78+
79+
6880
private setupPage(): void {
6981
this.connectorService.getSage300Credential().subscribe((sage300Cred: Sage300Credential) => {
7082
this.connectSage300Form = this.formBuilder.group({
7183
userID: [sage300Cred.username, Validators.required],
7284
companyID: [sage300Cred.identifier, Validators.required],
73-
userPassword: ['', Validators.required]
85+
userPassword: [{value: sage300Cred.password, disabled: true}]
7486
});
87+
this.isSage300Connected = true;
7588
this.isLoading = false;
7689
}, () => {
7790
this.connectSage300Form = this.formBuilder.group({

src/app/integrations/sage300/sage300-shared/sage300-advanced-settings/sage300-advanced-settings.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ <h4 class="tw-mb-12-px">Preview of the Description Field</h4>
105105
</div> -->
106106
</div>
107107
<div>
108-
<app-configuration-step-footer [ctaText] = "!isSaveInProgress ? (isOnboarding ? ConfigurationCtaText.SAVE_AND_CONTINUE : ConfigurationCtaText.SAVE) : ConfigurationCtaText.SAVING" (save)="save()" [isButtonDisabled]="!advancedSettingForm.valid"></app-configuration-step-footer>
108+
<app-configuration-step-footer [ctaText] = "!isSaveInProgress ? (isOnboarding ? ConfigurationCtaText.SAVE_AND_CONTINUE : ConfigurationCtaText.SAVE) : ConfigurationCtaText.SAVING" (save)="save()" [isButtonDisabled]="!advancedSettingForm.valid || !skipExportForm.valid || !getSkipExportValue()"></app-configuration-step-footer>
109109
</div>
110110
</form>
111111
</div>

src/app/integrations/sage300/sage300-shared/sage300-advanced-settings/sage300-advanced-settings.component.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Component, OnInit } from '@angular/core';
22
import { FormGroup } from '@angular/forms';
33
import { catchError, forkJoin, of } from 'rxjs';
44
import { ConditionField, EmailOption, ExpenseFilterResponse, ExpenseFilter, HourOption, SkipExportModel, ExpenseFilterPayload, SkipExportValidatorRule } from 'src/app/core/models/common/advanced-settings.model';
5-
import { AppName, ConfigurationCta, Page, Sage300OnboardingState, Sage300UpdateEvent, ToastSeverity, TrackingApp } from 'src/app/core/models/enum/enum.model';
5+
import { AppName, ConfigurationCta, CustomOperatorOption, Page, Sage300OnboardingState, Sage300UpdateEvent, ToastSeverity, TrackingApp } from 'src/app/core/models/enum/enum.model';
66
import { Sage300AdvancedSettingGet, Sage300AdvancedSettingModel } from 'src/app/core/models/sage300/sage300-configuration/sage300-advanced-settings.model';
77
import { HelperService } from 'src/app/core/services/common/helper.service';
88
import { Sage300AdvancedSettingsService } from 'src/app/core/services/sage300/sage300-configuration/sage300-advanced-settings.service';
@@ -106,6 +106,18 @@ export class Sage300AdvancedSettingsComponent implements OnInit {
106106
});
107107
}
108108

109+
getSkipExportValue() {
110+
if (this.advancedSettingForm.controls.skipExport) {
111+
if (this.skipExportForm.controls.condition1.value) {
112+
if (this.skipExportForm.controls.condition2.value) {
113+
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;
114+
}
115+
return this.skipExportForm.controls.value1.value || this.skipExportForm.controls.operator1.value === CustomOperatorOption.IsEmpty ? true : false;
116+
}
117+
}
118+
return true;
119+
}
120+
109121
refreshDimensions(isRefresh: boolean) {
110122
this.helperService.importAttributes(isRefresh);
111123
}

src/app/integrations/sage300/sage300-shared/sage300-export-settings/sage300-export-settings.component.html

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,6 @@
4141
[appName]="appName"
4242
[isDisabled]="true">
4343
</app-configuration-select-field>
44-
<div *ngIf="exportSettingForm.value.reimbursableExportType===Sage300ExportType.PURCHASE_INVOICE">
45-
<app-configuration-select-field
46-
[form]="exportSettingForm"
47-
[isFieldMandatory]="true"
48-
[mandatoryErrorListName]="'Default Vendor Name'"
49-
[label]="'Set the Default Vendor as?'"
50-
[subLabel]="'The integration will assign the Corporate Card Expenses that is exported as Purchase invoice to the vendor selected here.'"
51-
[destinationAttributes]="vendorOptions"
52-
[iconPath]="'expense'"
53-
[placeholder]="'Select default vendor'"
54-
[appName]="appName"
55-
[formControllerName]="'defaultVendorName'">
56-
</app-configuration-select-field>
57-
</div>
5844
<div *ngIf="exportSettingForm?.value.reimbursableExportType===Sage300ExportType.DIRECT_COST">
5945
<app-configuration-select-field
6046
[form]="exportSettingForm"
@@ -203,7 +189,7 @@
203189
</app-configuration-select-field>
204190
</div>
205191
</div>
206-
<div *ngIf="exportSettingForm.value.cccExportType===Sage300ExportType.PURCHASE_INVOICE && exportSettingForm.value.reimbursableExportType!==Sage300ExportType.PURCHASE_INVOICE">
192+
<div *ngIf="exportSettingForm.value.cccExportType===Sage300ExportType.PURCHASE_INVOICE">
207193
<app-configuration-select-field
208194
[form]="exportSettingForm"
209195
[isFieldMandatory]="true"

src/app/integrations/sage300/sage300-shared/sage300-export-settings/sage300-export-settings.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ export class Sage300ExportSettingsComponent implements OnInit {
141141
'formController': 'reimbursableExportType',
142142
'requiredValue': {
143143
'DIRECT_COST': ['defaultReimbursableCCCAccountName', 'defaultDebitCardAccountName', 'defaultJobName'],
144-
'PURCHASE_INVOICE': ['defaultVendorName']
144+
'PURCHASE_INVOICE': []
145145
}
146146
},
147147
{

src/app/shared/components/configuration/configuration-import-field/configuration-import-field.component.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@
5555
}
5656

5757
:host ::ng-deep .p-inputswitch.p-inputswitch-checked .p-inputswitch-slider::after {
58-
@apply tw-content-yes tw-flex tw-justify-center tw-items-center tw-absolute tw-text-12-px tw-text-white tw-font-500 tw-left-2 tw-bottom-px ;
58+
@apply tw-content-yes tw-flex tw-justify-center tw-items-center tw-absolute tw-text-12-px tw-text-white tw-font-500 tw-left-2 ;
5959
}
6060

6161
:host ::ng-deep .p-inputswitch:not(.p-inputswitch-checked) .p-inputswitch-slider::after {
62-
@apply tw-content-no tw-flex tw-justify-center tw-items-center tw-absolute tw-text-12-px tw-text-white tw-font-500 tw-left-6 tw-bottom-px ;
62+
@apply tw-content-no tw-flex tw-justify-center tw-items-center tw-absolute tw-text-12-px tw-text-white tw-font-500 tw-left-6 ;
6363
}
6464

6565
.add-button-container {

src/app/shared/components/configuration/configuration-skip-export/configuration-skip-export.component.html

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@
8989
</p-dropdown>
9090
<app-mandatory-error-message *ngIf="skipExportForm.controls.condition2.touched && !skipExportForm.controls.condition2.valid"
9191
[customErrorMessage]="'Please select the condition'"></app-mandatory-error-message>
92+
<app-mandatory-error-message *ngIf="checkValidationCondition()"
93+
[customErrorMessage]="'Condition selected should be distinct.'"></app-mandatory-error-message>
9294
</div>
9395
<div class="tw-mr-24-px">
9496
<p-dropdown appendTo="body" [options]="operatorFieldOptions2" formControlName="operator2" placeholder="Select Operator"></p-dropdown>
@@ -107,9 +109,6 @@
107109
</div>
108110
<img class="delete-icon" src="assets/icons/delete.svg" (click)="remCondition()" p-tooltip="Remove Condition">
109111
</div>
110-
<div class=" tw-text-mandatory-field-color" *ngIf="checkValidationCondition()">
111-
<p>*Condition selected should be distinct.</p>
112-
</div>
113112
</div>
114113
<div class="tw-flex items-center tw-text-mandatory-field-color tw-pt-12-px tw-pb-24-px" *ngIf="showAddButton">
115114
<img src="assets/icons/add.svg" (click)="updateAdditionalFilterVisibility(true)">

src/app/shared/components/configuration/configuration-toggle-field/configuration-toggle-field.component.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
align-items: center;
66
position: absolute;
77
left: 8px;
8-
bottom: 1px;
8+
bottom: 0px;
99
font-size: 12px;
1010
color: white;
1111
font-weight: 500;
@@ -18,7 +18,7 @@
1818
align-items: center;
1919
position: absolute;
2020
left: 24px;
21-
bottom: 1px;
21+
bottom: 0px;
2222
font-size: 12px;
2323
color: white;
2424
font-weight: 500;

0 commit comments

Comments
 (0)