Skip to content

Commit

Permalink
testing fixes (#443)
Browse files Browse the repository at this point in the history
testing fixes
  • Loading branch information
DhaaraniCIT authored Jan 18, 2024
1 parent 868a01f commit dbf2148
Show file tree
Hide file tree
Showing 17 changed files with 76 additions and 69 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
align-items: center;
position: absolute;
left: 8px;
bottom: 1px;
bottom: 0px;
font-size: 12px;
color: white;
font-weight: 500;
Expand All @@ -36,7 +36,7 @@
align-items: center;
position: absolute;
left: 24px;
bottom: 1px;
bottom: 0px;
font-size: 12px;
color: white;
font-weight: 500;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { forkJoin } from 'rxjs';
import { DestinationAttribute } from 'src/app/core/models/db/destination-attribute.model';
import { MappingSetting } from 'src/app/core/models/db/mapping-setting.model';
import { AppName, FyleField, IntegrationName, ToastSeverity } from 'src/app/core/models/enum/enum.model';
import { IntegrationsToastService } from 'src/app/core/services/common/integrations-toast.service';
import { MappingService } from 'src/app/core/services/common/mapping.service';
Expand Down Expand Up @@ -47,39 +49,28 @@ export class Sage300BaseMappingComponent implements OnInit {
});
}

getSourceType() {
getSourceType(results: MappingSetting[]) {
if (this.sourceField==='EMPLOYEE') {
return 'VENDOR';
}

if (this.sourceField==='CATEGORY') {
} else if (this.sourceField==='CATEGORY') {
return 'ACCOUNT';
}

return '';
const destinationField = results.find((field) => field.source_field === this.sourceField)?.destination_field;
return destinationField ? destinationField : '';
}

setupPage(): void {
this.sourceField = this.route.snapshot.params.source_field.toUpperCase();
this.mappingService.getExportSettings().subscribe((response) => {
this.reimbursableExpenseObject = response.reimbursable_expenses_object;
this.cccExpenseObject = response.corporate_credit_card_expenses_object;

this.showAutoMapEmployee = response.auto_map_employees ? true : false;

this.destinationField = this.getSourceType();
this.mappingService.getGroupedDestinationAttributes([this.destinationField], 'v2').subscribe((response: any) => {
if (this.sourceField===FyleField.EMPLOYEE) {
this.destinationOptions = this.destinationField===FyleField.EMPLOYEE ? response.EMPLOYEE : response.VENDOR;
}
if (this.sourceField==='CATEGORY') {
if (this.destinationField === 'EXPENSE_TYPE') {
this.destinationOptions = response.EXPENSE_TYPE;
} else {
this.destinationOptions = response.ACCOUNT;
}
}

forkJoin(
this.mappingService.getExportSettings(),
this.mappingService.getMappingSettings()
).subscribe(([exportSettingsResponse, mappingSettingsResponse]) => {
this.reimbursableExpenseObject = exportSettingsResponse.reimbursable_expenses_object;
this.cccExpenseObject = exportSettingsResponse.corporate_credit_card_expenses_object;
this.showAutoMapEmployee = exportSettingsResponse.auto_map_employees ? true : false;
this.destinationField = this.getSourceType(mappingSettingsResponse.results);
this.mappingService.getDestinationAttributes([this.destinationField], 'v2').subscribe((response: any) => {
this.destinationOptions = response;
this.isLoading = false;
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ export class Sage300OnboardingConnectorComponent implements OnInit {

readonly brandingConfig = brandingConfig;

isSage300Connected: boolean = false;

constructor(
private onboardingService: Sage300OnboardingService,
private router: Router,
Expand All @@ -42,7 +44,7 @@ export class Sage300OnboardingConnectorComponent implements OnInit {
private mappingService: Sage300MappingService
) { }

save() {
private saveConnection() {
const userID = this.connectSage300Form.value.userID;
const companyID = this.connectSage300Form.value.companyID;
const userPassword = this.connectSage300Form.value.userPassword;
Expand All @@ -54,24 +56,35 @@ export class Sage300OnboardingConnectorComponent implements OnInit {
password: userPassword,
workspace: this.workspaceService.getWorkspaceId()
}).subscribe((response) => {
this.isLoading = false;
this.toastService.displayToastMessage(ToastSeverity.SUCCESS, 'Connection Successful.');
this.workspaceService.setOnboardingState(Sage300OnboardingState.EXPORT_SETTINGS);
this.mappingService.importSage300Attributes(true).subscribe();
this.router.navigate([this.onboardingSteps[1].route]);
this.mappingService.importSage300Attributes(true).subscribe(() => {
this.isLoading = false;
this.toastService.displayToastMessage(ToastSeverity.SUCCESS, 'Connection Successful.');
this.workspaceService.setOnboardingState(Sage300OnboardingState.EXPORT_SETTINGS);
this.router.navigate([this.onboardingSteps[1].route]);
});
}, () => {
this.isLoading = false;
this.toastService.displayToastMessage(ToastSeverity.ERROR, 'Error while connecting, please try again later.');
});
}

save() {
if (this.isSage300Connected) {
this.router.navigate([this.onboardingSteps[1].route]);
} else {
this.saveConnection();
}
}


private setupPage(): void {
this.connectorService.getSage300Credential().subscribe((sage300Cred: Sage300Credential) => {
this.connectSage300Form = this.formBuilder.group({
userID: [sage300Cred.username, Validators.required],
companyID: [sage300Cred.identifier, Validators.required],
userPassword: ['', Validators.required]
userPassword: [{value: sage300Cred.password, disabled: true}]
});
this.isSage300Connected = true;
this.isLoading = false;
}, () => {
this.connectSage300Form = this.formBuilder.group({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ <h4 class="tw-mb-12-px">Preview of the Description Field</h4>
</div> -->
</div>
<div>
<app-configuration-step-footer [ctaText] = "!isSaveInProgress ? (isOnboarding ? ConfigurationCtaText.SAVE_AND_CONTINUE : ConfigurationCtaText.SAVE) : ConfigurationCtaText.SAVING" (save)="save()" [isButtonDisabled]="!advancedSettingForm.valid"></app-configuration-step-footer>
<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>
</div>
</form>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Component, OnInit } from '@angular/core';
import { FormGroup } from '@angular/forms';
import { catchError, forkJoin, of } from 'rxjs';
import { ConditionField, EmailOption, ExpenseFilterResponse, ExpenseFilter, HourOption, SkipExportModel, ExpenseFilterPayload, SkipExportValidatorRule } from 'src/app/core/models/common/advanced-settings.model';
import { AppName, ConfigurationCta, Page, Sage300OnboardingState, Sage300UpdateEvent, ToastSeverity, TrackingApp } from 'src/app/core/models/enum/enum.model';
import { AppName, ConfigurationCta, CustomOperatorOption, Page, Sage300OnboardingState, Sage300UpdateEvent, ToastSeverity, TrackingApp } from 'src/app/core/models/enum/enum.model';
import { Sage300AdvancedSettingGet, Sage300AdvancedSettingModel } from 'src/app/core/models/sage300/sage300-configuration/sage300-advanced-settings.model';
import { HelperService } from 'src/app/core/services/common/helper.service';
import { Sage300AdvancedSettingsService } from 'src/app/core/services/sage300/sage300-configuration/sage300-advanced-settings.service';
Expand Down Expand Up @@ -106,6 +106,18 @@ export class Sage300AdvancedSettingsComponent implements OnInit {
});
}

getSkipExportValue() {
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 ? true : false;
}
}
return true;
}

refreshDimensions(isRefresh: boolean) {
this.helperService.importAttributes(isRefresh);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,6 @@
[appName]="appName"
[isDisabled]="true">
</app-configuration-select-field>
<div *ngIf="exportSettingForm.value.reimbursableExportType===Sage300ExportType.PURCHASE_INVOICE">
<app-configuration-select-field
[form]="exportSettingForm"
[isFieldMandatory]="true"
[mandatoryErrorListName]="'Default Vendor Name'"
[label]="'Set the Default Vendor as?'"
[subLabel]="'The integration will assign the Corporate Card Expenses that is exported as Purchase invoice to the vendor selected here.'"
[destinationAttributes]="vendorOptions"
[iconPath]="'expense'"
[placeholder]="'Select default vendor'"
[appName]="appName"
[formControllerName]="'defaultVendorName'">
</app-configuration-select-field>
</div>
<div *ngIf="exportSettingForm?.value.reimbursableExportType===Sage300ExportType.DIRECT_COST">
<app-configuration-select-field
[form]="exportSettingForm"
Expand Down Expand Up @@ -203,7 +189,7 @@
</app-configuration-select-field>
</div>
</div>
<div *ngIf="exportSettingForm.value.cccExportType===Sage300ExportType.PURCHASE_INVOICE && exportSettingForm.value.reimbursableExportType!==Sage300ExportType.PURCHASE_INVOICE">
<div *ngIf="exportSettingForm.value.cccExportType===Sage300ExportType.PURCHASE_INVOICE">
<app-configuration-select-field
[form]="exportSettingForm"
[isFieldMandatory]="true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export class Sage300ExportSettingsComponent implements OnInit {
'formController': 'reimbursableExportType',
'requiredValue': {
'DIRECT_COST': ['defaultReimbursableCCCAccountName', 'defaultDebitCardAccountName', 'defaultJobName'],
'PURCHASE_INVOICE': ['defaultVendorName']
'PURCHASE_INVOICE': []
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@
}

:host ::ng-deep .p-inputswitch.p-inputswitch-checked .p-inputswitch-slider::after {
@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 ;
@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 ;
}

:host ::ng-deep .p-inputswitch:not(.p-inputswitch-checked) .p-inputswitch-slider::after {
@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 ;
@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 ;
}

.add-button-container {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@
</p-dropdown>
<app-mandatory-error-message *ngIf="skipExportForm.controls.condition2.touched && !skipExportForm.controls.condition2.valid"
[customErrorMessage]="'Please select the condition'"></app-mandatory-error-message>
<app-mandatory-error-message *ngIf="checkValidationCondition()"
[customErrorMessage]="'Condition selected should be distinct.'"></app-mandatory-error-message>
</div>
<div class="tw-mr-24-px">
<p-dropdown appendTo="body" [options]="operatorFieldOptions2" formControlName="operator2" placeholder="Select Operator"></p-dropdown>
Expand All @@ -107,9 +109,6 @@
</div>
<img class="delete-icon" src="assets/icons/delete.svg" (click)="remCondition()" p-tooltip="Remove Condition">
</div>
<div class=" tw-text-mandatory-field-color" *ngIf="checkValidationCondition()">
<p>*Condition selected should be distinct.</p>
</div>
</div>
<div class="tw-flex items-center tw-text-mandatory-field-color tw-pt-12-px tw-pb-24-px" *ngIf="showAddButton">
<img src="assets/icons/add.svg" (click)="updateAdditionalFilterVisibility(true)">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
align-items: center;
position: absolute;
left: 8px;
bottom: 1px;
bottom: 0px;
font-size: 12px;
color: white;
font-weight: 500;
Expand All @@ -18,7 +18,7 @@
align-items: center;
position: absolute;
left: 24px;
bottom: 1px;
bottom: 0px;
font-size: 12px;
color: white;
font-weight: 500;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ <h5 class="!tw-text-faded-text-color tw-text-14-px tw-pt-8-px !tw-font-400 !tw-l
<ng-template pTemplate="filter" let-options="options">
<div *ngIf="emails.length" class="p-inputgroup">
<div class="p-input-icon-left p-input-icon-right">
<i class="pi pi-search"></i>
<i class="pi pi-search !tw-text-placeholder"></i>
<input type="text" class="!tw-h-32-px !tw-w-270-px" (keyup)="options.filter($event)"
pInputText placeholder="Search by Name / Email" formControlName="search" />
<i class="pi pi-times tw-cursor-pointer tw-pt-2-px" style="font-size: 14px" (click)="clearSearch(options)"></i>
<i class="pi pi-times tw-cursor-pointer tw-text-16-px" (click)="clearSearch(options)"></i>
</div>
</div>
</ng-template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,8 @@
:host ::ng-deep .normal-box, :host ::ng-deep .error-box{
@apply tw-w-full #{!important};
}

:host ::ng-deep .pi-times:before {
content: "\e90b" !important;
font-size: 16px !important;
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ export class ExportLogTableComponent implements OnInit {

isChildTableVisible: boolean = false;

AppName = AppName;

constructor(
private windowService: WindowService
) { }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { FormControl, UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
import { debounceTime } from 'rxjs';
import { UntypedFormBuilder, UntypedFormGroup } from '@angular/forms';
import { SelectFormOption } from 'src/app/core/models/common/select-form-option.model';
import { AppName, MappingState } from 'src/app/core/models/enum/enum.model';
import { MappingAlphabeticalFilterAdditionalProperty, trackingAppMap } from 'src/app/core/models/misc/tracking.model';
import { Mapping } from 'src/app/core/models/qbd/db/mapping.model';
import { TrackingService } from 'src/app/core/services/integration/tracking.service';

@Component({
Expand Down
5 changes: 3 additions & 2 deletions src/app/shared/components/input/toggle/toggle.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
align-items: center;
position: absolute;
left: 8px;
bottom: 1px;
bottom: 0px;
font-size: 12px;
color: white;
font-weight: 500;
Expand All @@ -18,8 +18,9 @@
align-items: center;
position: absolute;
left: 24px;
bottom: 1px;
bottom: 0px;
font-size: 12px;
color: white;
font-weight: 500;
}

Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
align-items: center;
position: absolute;
left: 8px;
bottom: 1px;
bottom: 0px;
font-size: 12px;
color: white;
font-weight: 500;
Expand All @@ -105,7 +105,7 @@
align-items: center;
position: absolute;
left: 24px;
bottom: 1px;
bottom: 0px;
font-size: 12px;
color: white;
font-weight: 500;
Expand Down
2 changes: 1 addition & 1 deletion src/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ p {
}

.p-multiselect-panel {
@apply tw-w-320-px ;
@apply tw-w-300-px ;
}

.p-dropdown .p-dropdown-label.p-placeholder {
Expand Down

0 comments on commit dbf2148

Please sign in to comment.