Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

Commit

Permalink
Auto Mappings of Employees (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
Shwetabhk authored Feb 16, 2021
1 parent 2166074 commit d6614a1
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 6 deletions.
5 changes: 3 additions & 2 deletions src/app/core/services/settings.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,15 @@ export class SettingsService {
@CacheBuster({
cacheBusterNotifier: generalSettingsCache
})
postGeneralSettings(workspaceId: number, reimbursableExpensesObject: string, corporateCreditCardExpensesObject: string, importCategories: boolean, importProjects: boolean, fyleToQuickBooks: boolean, quickbooksToFyle: boolean) {
postGeneralSettings(workspaceId: number, reimbursableExpensesObject: string, corporateCreditCardExpensesObject: string, importCategories: boolean, importProjects: boolean, fyleToQuickBooks: boolean, quickbooksToFyle: boolean, autoMapEmployees: string = null) {
return this.apiService.post(`/workspaces/${workspaceId}/settings/general/`, {
reimbursable_expenses_object: reimbursableExpensesObject,
corporate_credit_card_expenses_object: corporateCreditCardExpensesObject,
import_categories: importCategories,
import_projects: importProjects,
sync_fyle_to_qbo_payments: fyleToQuickBooks,
sync_qbo_to_fyle_payments: quickbooksToFyle
sync_qbo_to_fyle_payments: quickbooksToFyle,
auto_map_employees: autoMapEmployees
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,29 @@
</mat-form-field>
</div>

<div class="configurations--label">
Auto Map Employees from Fyle
</div>
<div fxLayout="row" fxLayoutAlign="start center">
<mat-form-field floatLabel="always" appearance="outline" fxFlex="100">
<mat-select placeholder="Choose how to auto map employees between Fyle and NetSuite"
formControlName="autoMapEmployees">
<mat-option>
None
</mat-option>
<mat-option [value]="'EMAIL'">
Match emails on Fyle and Quickbooks online
</mat-option>
<mat-option [value]="'NAME'">
Match names on Fyle and Quickbooks Online
</mat-option>
<mat-option [value]="'EMPLOYEE_CODE'">
Match Fyle Employee Code to Quickbooks Online Name
</mat-option>
</mat-select>
</mat-form-field>
</div>

<mat-slide-toggle color="primary" class="schedule" formControlName="importCategories">
<div class="schedule--toggle-text">Import Quickbooks Online Expense Accounts into Fyle</div>
</mat-slide-toggle>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ export class GeneralConfigurationComponent implements OnInit {
employees: [that.employeeFieldMapping ? that.employeeFieldMapping.destination_field : ''],
importCategories: [that.generalSettings.import_categories],
importProjects: [that.generalSettings.import_projects],
paymentsSync: [paymentsSyncOption]
paymentsSync: [paymentsSyncOption],
autoMapEmployees: [that.generalSettings.auto_map_employees]
});

if (that.generalSettings.reimbursable_expenses_object) {
Expand Down Expand Up @@ -131,7 +132,8 @@ export class GeneralConfigurationComponent implements OnInit {
cccExpense: [null],
importCategories: [false],
importProjects: [false],
paymentsSync: [null]
paymentsSync: [null],
autoMapEmployees: [null]
});


Expand Down Expand Up @@ -159,6 +161,8 @@ export class GeneralConfigurationComponent implements OnInit {
const employeeMappingsObject = that.generalSettingsForm.value.employees || (that.employeeFieldMapping && that.employeeFieldMapping.destination_field);
const importCategories = that.generalSettingsForm.value.importCategories;
const importProjects = that.generalSettingsForm.value.importProjects;
const autoMapEmployees = that.generalSettingsForm.value.autoMapEmployees ? that.generalSettingsForm.value.autoMapEmployees : null;

let fyleToQuickbooks = false;
let quickbooksToFyle = false;

Expand All @@ -183,11 +187,18 @@ export class GeneralConfigurationComponent implements OnInit {
forkJoin(
[
that.settingsService.postMappingSettings(that.workspaceId, mappingsSettingsPayload),
that.settingsService.postGeneralSettings(that.workspaceId, reimbursableExpensesObject, cccExpensesObject, importCategories, importProjects, fyleToQuickbooks, quickbooksToFyle)
that.settingsService.postGeneralSettings(that.workspaceId, reimbursableExpensesObject, cccExpensesObject, importCategories, importProjects, fyleToQuickbooks, quickbooksToFyle, autoMapEmployees)
]
).subscribe(responses => {
that.isLoading = true;
that.snackBar.open('Configuration saved successfully');

if (autoMapEmployees) {
setTimeout(() => {
that.snackBar.open('Auto mapping of employees may take up to 10 minutes');
}, 1500);
}

that.router.navigateByUrl(`workspaces/${that.workspaceId}/dashboard`);
});
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<th mat-header-cell *matHeaderCellDef> Employee Email </th>
<td mat-cell *matCellDef="let element">
{{element.fyle_value}}
<mat-icon class="auto-map" [inline]="true" matTooltip="Employee auto mapped by integration" matTooltipPosition="after" *ngIf="element.auto_mapped">bolt</mat-icon>
</td>
</ng-container>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.auto-map {
text-align: center;
cursor: pointer;
padding-left: 5px;
padding-bottom: 5px;
max-width: 24px;
max-height: 24px;
font-size: 20px;
vertical-align: middle;
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ export class EmployeeMappingsComponent implements OnInit {
mappings.push({
fyle_value: employeeEVMapping.source.value,
qbo_value: employeeEVMapping.destination.value,
ccc_account: that.getCCCAccount(that.employeeMappings, employeeEVMapping)
ccc_account: that.getCCCAccount(that.employeeMappings, employeeEVMapping),
auto_mapped: employeeEVMapping.source.auto_mapped
});
});
that.employeeMappings = mappings;
Expand Down

0 comments on commit d6614a1

Please sign in to comment.