From d6614a1dac5a5de7edd18ab7d4ef5f6e9cda7284 Mon Sep 17 00:00:00 2001 From: Shwetabh Kumar Date: Tue, 16 Feb 2021 17:16:11 +0530 Subject: [PATCH] Auto Mappings of Employees (#44) --- src/app/core/services/settings.service.ts | 5 ++-- .../general-configuration.component.html | 23 +++++++++++++++++++ .../general-configuration.component.ts | 17 +++++++++++--- .../employee-mappings.component.html | 1 + .../employee-mappings.component.scss | 10 ++++++++ .../employee-mappings.component.ts | 3 ++- 6 files changed, 53 insertions(+), 6 deletions(-) diff --git a/src/app/core/services/settings.service.ts b/src/app/core/services/settings.service.ts index 011029de..cd67009f 100644 --- a/src/app/core/services/settings.service.ts +++ b/src/app/core/services/settings.service.ts @@ -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 }); } diff --git a/src/app/qbo/settings/configuration/general-configuration/general-configuration.component.html b/src/app/qbo/settings/configuration/general-configuration/general-configuration.component.html index 307f6167..c0940083 100644 --- a/src/app/qbo/settings/configuration/general-configuration/general-configuration.component.html +++ b/src/app/qbo/settings/configuration/general-configuration/general-configuration.component.html @@ -83,6 +83,29 @@ +
+ Auto Map Employees from Fyle +
+
+ + + + None + + + Match emails on Fyle and Quickbooks online + + + Match names on Fyle and Quickbooks Online + + + Match Fyle Employee Code to Quickbooks Online Name + + + +
+
Import Quickbooks Online Expense Accounts into Fyle
diff --git a/src/app/qbo/settings/configuration/general-configuration/general-configuration.component.ts b/src/app/qbo/settings/configuration/general-configuration/general-configuration.component.ts index 99749997..36f702e8 100644 --- a/src/app/qbo/settings/configuration/general-configuration/general-configuration.component.ts +++ b/src/app/qbo/settings/configuration/general-configuration/general-configuration.component.ts @@ -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) { @@ -131,7 +132,8 @@ export class GeneralConfigurationComponent implements OnInit { cccExpense: [null], importCategories: [false], importProjects: [false], - paymentsSync: [null] + paymentsSync: [null], + autoMapEmployees: [null] }); @@ -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; @@ -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 { diff --git a/src/app/qbo/settings/employee-mappings/employee-mappings.component.html b/src/app/qbo/settings/employee-mappings/employee-mappings.component.html index b11131f1..7be23977 100644 --- a/src/app/qbo/settings/employee-mappings/employee-mappings.component.html +++ b/src/app/qbo/settings/employee-mappings/employee-mappings.component.html @@ -25,6 +25,7 @@ Employee Email {{element.fyle_value}} + bolt diff --git a/src/app/qbo/settings/employee-mappings/employee-mappings.component.scss b/src/app/qbo/settings/employee-mappings/employee-mappings.component.scss index e69de29b..01fd5403 100644 --- a/src/app/qbo/settings/employee-mappings/employee-mappings.component.scss +++ b/src/app/qbo/settings/employee-mappings/employee-mappings.component.scss @@ -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; +} \ No newline at end of file diff --git a/src/app/qbo/settings/employee-mappings/employee-mappings.component.ts b/src/app/qbo/settings/employee-mappings/employee-mappings.component.ts index 56fb1427..0de7608e 100644 --- a/src/app/qbo/settings/employee-mappings/employee-mappings.component.ts +++ b/src/app/qbo/settings/employee-mappings/employee-mappings.component.ts @@ -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;