Skip to content

Commit

Permalink
Few bug fixes from QBO (#512)
Browse files Browse the repository at this point in the history
* Few bug fixes from QBO

* progress bar
  • Loading branch information
ashwin1111 authored Feb 2, 2024
1 parent ba6e7df commit dbf909a
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 14 deletions.
2 changes: 2 additions & 0 deletions src/app/core/services/common/accounting-export.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { WorkspaceService } from './workspace.service';
import { HelperService } from './helper.service';
import { AccountingExportCount, AccountingExportGetParam } from '../../models/db/accounting-export.model';
import { SelectedDateFilter } from '../../models/qbd/misc/date-filter.model';
import { Cacheable } from 'ts-cacheable';

@Injectable({
providedIn: 'root'
Expand Down Expand Up @@ -64,6 +65,7 @@ export class AccountingExportService {
return this.apiService.get(`/workspaces/${this.workspaceId}/accounting_exports/`, apiParams);
}

@Cacheable()
importExpensesFromFyle(version?: 'v1'): Observable<{}> {
return this.apiService.post(`/workspaces/${this.workspaceId}/fyle/${version === 'v1' ? 'expense_groups' : 'accounting_exports'}/sync/`, {});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,18 @@ export class BusinessCentralDashboardComponent implements OnInit {
this.reimbursableImportState = responses[4].reimbursable_expenses_export_type ? this.reimbursableExpenseImportStateMap[responses[4].reimbursable_expense_state] : null;
this.cccImportState = responses[4].credit_card_expense_export_type ? this.cccExpenseImportStateMap[responses[4].credit_card_expense_state] : null;

this.isLoading = false;

if (queuedTasks.length) {
this.isImportInProgress = false;
this.isExportInProgress = true;
this.pollExportStatus();
this.isLoading = false;
} else {
this.accountingExportService.importExpensesFromFyle().subscribe(() => {
this.isImportInProgress = false;
this.isLoading = false;
this.dashboardService.getExportableAccountingExportIds().subscribe((exportableAccountingExportIds) => {
this.exportableAccountingExportIds = exportableAccountingExportIds.exportable_accounting_export_ids ?? [];
this.isImportInProgress = false;
});
});
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export class QboDashboardComponent implements OnInit {

private pollExportStatus(exportableAccountingExportIds: number[] = []): void {
interval(3000).pipe(
switchMap(() => from(this.dashboardService.getAllTasks([TaskLogState.ENQUEUED, TaskLogState.IN_PROGRESS, TaskLogState.FAILED], exportableAccountingExportIds, this.accountingExportType))),
switchMap(() => from(this.dashboardService.getAllTasks([], exportableAccountingExportIds, this.accountingExportType))),
takeWhile((response: QBOTaskResponse) =>
response.results.filter(task =>
(task.status === TaskLogState.IN_PROGRESS || task.status === TaskLogState.ENQUEUED)
Expand All @@ -106,7 +106,7 @@ export class QboDashboardComponent implements OnInit {

this.failedExpenseGroupCount = res.results.filter(task => task.status === TaskLogState.FAILED || task.status === TaskLogState.FATAL).length;

this.exportableAccountingExportIds = res.results.filter(task => task.status === TaskLogState.FAILED || task.status === TaskLogState.FATAL).map(taskLog => taskLog.id);
this.exportableAccountingExportIds = res.results.filter(task => task.status === TaskLogState.FAILED || task.status === TaskLogState.FATAL).map(taskLog => taskLog.expense_group);

this.isExportInProgress = false;
this.exportProgressPercentage = 0;
Expand Down Expand Up @@ -150,7 +150,10 @@ export class QboDashboardComponent implements OnInit {
this.pollExportStatus();
} else {
this.accountingExportService.importExpensesFromFyle('v1').subscribe(() => {
this.isImportInProgress = false;
this.dashboardService.getExportableAccountingExportIds('v1').subscribe((exportableAccountingExportIds) => {
this.exportableAccountingExportIds = exportableAccountingExportIds.exportable_expense_group_ids;
this.isImportInProgress = false;
});
});
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,18 @@ export class Sage300DashboardComponent implements OnInit {
this.reimbursableImportState = responses[4].reimbursable_expenses_export_type ? this.reimbursableExpenseImportStateMap[responses[4].reimbursable_expense_state] : null;
this.cccImportState = responses[4].credit_card_expense_export_type ? this.cccExpenseImportStateMap[responses[4].credit_card_expense_state] : null;

this.isLoading = false;

if (queuedTasks.length) {
this.isImportInProgress = false;
this.isExportInProgress = true;
this.pollExportStatus();
this.isLoading = false;
} else {
this.accountingExportService.importExpensesFromFyle().subscribe(() => {
this.isImportInProgress = false;
this.isLoading = false;
this.dashboardService.getExportableAccountingExportIds().subscribe((exportableAccountingExportIds) => {
this.exportableAccountingExportIds = exportableAccountingExportIds.exportable_accounting_export_ids;
this.isImportInProgress = false;
});
});
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ <h5 class="!tw-text-faded-text-color tw-text-14-px tw-pt-10-px !tw-font-400 !tw-
<button *ngIf="!groupedErrorStat.EMPLOYEE_MAPPING || (groupedErrorStat.EMPLOYEE_MAPPING && groupedErrorStat.EMPLOYEE_MAPPING.resolvedCount !== groupedErrorStat.EMPLOYEE_MAPPING.totalCount)" type="button" (click)="showMappingResolve(IntacctErrorType.EMPLOYEE_MAPPING, errors.EMPLOYEE_MAPPING)" class="tw-text-white tw-text-500 tw-text-12-px tw-px-12-px tw-py-6-px tw-bg-slightly-normal-text-color tw-rounded-4-px tw-w-100-px tw-font-500">
Resolve
</button>
<div class="tw-flex" *ngIf="groupedErrorStat.EMPLOYEE_MAPPING && groupedErrorStat.EMPLOYEE_MAPPING.resolvedCount === groupedErrorStat.EMPLOYEE_MAPPING.totalCount">
<div class="tw-flex tw-items-center" *ngIf="groupedErrorStat.EMPLOYEE_MAPPING && groupedErrorStat.EMPLOYEE_MAPPING.resolvedCount === groupedErrorStat.EMPLOYEE_MAPPING.totalCount">
<app-svg-icon [svgSource]="'check-circle-outline'" [width]="'24px'" [height]="'24px'" [styleClasses]="'tw-text-success-toast tw-pr-6-px'"></app-svg-icon>
<p class="tw-text-faded-text-color tw-text-14-px">
Resolved
Expand All @@ -165,7 +165,7 @@ <h5 class="!tw-text-faded-text-color tw-text-14-px tw-pt-10-px !tw-font-400 !tw-
<button *ngIf="!groupedErrorStat.CATEGORY_MAPPING || (groupedErrorStat.CATEGORY_MAPPING && groupedErrorStat.CATEGORY_MAPPING.resolvedCount !== groupedErrorStat.CATEGORY_MAPPING.totalCount)" type="button" (click)="showMappingResolve(IntacctErrorType.CATEGORY_MAPPING, errors.CATEGORY_MAPPING)" class="tw-text-white tw-text-500 tw-text-12-px tw-px-12-px tw-py-6-px tw-bg-slightly-normal-text-color tw-rounded-4-px tw-w-100-px tw-font-500">
Resolve
</button>
<div class="tw-flex" *ngIf="groupedErrorStat.CATEGORY_MAPPING && groupedErrorStat.CATEGORY_MAPPING.resolvedCount === groupedErrorStat.CATEGORY_MAPPING.totalCount">
<div class="tw-flex tw-items-center" *ngIf="groupedErrorStat.CATEGORY_MAPPING && groupedErrorStat.CATEGORY_MAPPING.resolvedCount === groupedErrorStat.CATEGORY_MAPPING.totalCount">
<app-svg-icon [svgSource]="'check-circle-outline'" [width]="'24px'" [height]="'24px'" [styleClasses]="'tw-text-success-toast tw-pr-6-px'"></app-svg-icon>
<p class="tw-text-faded-text-color tw-text-14-px">
Resolved
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ <h5 class="!tw-text-faded-text-color tw-text-14-px tw-pt-10-px !tw-font-400 !tw-
<button *ngIf="!groupedErrorStat.EMPLOYEE_MAPPING || (groupedErrorStat.EMPLOYEE_MAPPING && groupedErrorStat.EMPLOYEE_MAPPING.resolvedCount !== groupedErrorStat.EMPLOYEE_MAPPING.totalCount)" type="button" (click)="showMappingResolve(ErrorType.EMPLOYEE_MAPPING, errors.EMPLOYEE_MAPPING, ExportErrorSourceType.EMPLOYEE)" class="tw-text-white tw-text-500 tw-text-12-px tw-px-12-px tw-py-6-px tw-bg-slightly-normal-text-color tw-rounded-4-px tw-w-100-px tw-font-500">
Resolve
</button>
<div class="tw-flex" *ngIf="groupedErrorStat.EMPLOYEE_MAPPING && groupedErrorStat.EMPLOYEE_MAPPING.resolvedCount === groupedErrorStat.EMPLOYEE_MAPPING.totalCount">
<div class="tw-flex tw-items-center" *ngIf="groupedErrorStat.EMPLOYEE_MAPPING && groupedErrorStat.EMPLOYEE_MAPPING.resolvedCount === groupedErrorStat.EMPLOYEE_MAPPING.totalCount">
<app-svg-icon [svgSource]="'check-circle-outline'" [width]="'24px'" [height]="'24px'" [styleClasses]="'tw-text-success-toast tw-pr-6-px'"></app-svg-icon>
<p class="tw-text-faded-text-color tw-text-14-px">
Resolved
Expand All @@ -48,7 +48,7 @@ <h5 class="!tw-text-faded-text-color tw-text-14-px tw-pt-10-px !tw-font-400 !tw-
<button *ngIf="!groupedErrorStat.CATEGORY_MAPPING || (groupedErrorStat.CATEGORY_MAPPING && groupedErrorStat.CATEGORY_MAPPING.resolvedCount !== groupedErrorStat.CATEGORY_MAPPING.totalCount)" type="button" (click)="showMappingResolve(ErrorType.CATEGORY_MAPPING, errors.CATEGORY_MAPPING, ExportErrorSourceType.CATEGORY)" class="tw-text-white tw-text-500 tw-text-12-px tw-px-12-px tw-py-6-px tw-bg-slightly-normal-text-color tw-rounded-4-px tw-w-100-px tw-font-500">
Resolve
</button>
<div class="tw-flex" *ngIf="groupedErrorStat.CATEGORY_MAPPING && groupedErrorStat.CATEGORY_MAPPING.resolvedCount === groupedErrorStat.CATEGORY_MAPPING.totalCount">
<div class="tw-flex tw-items-center" *ngIf="groupedErrorStat.CATEGORY_MAPPING && groupedErrorStat.CATEGORY_MAPPING.resolvedCount === groupedErrorStat.CATEGORY_MAPPING.totalCount">
<app-svg-icon [svgSource]="'check-circle-outline'" [width]="'24px'" [height]="'24px'" [styleClasses]="'tw-text-success-toast tw-pr-6-px'"></app-svg-icon>
<p class="tw-text-faded-text-color tw-text-14-px">
Resolved
Expand Down
2 changes: 1 addition & 1 deletion src/assets/themes/theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
--success-toast: #24A148;
--alert-toast: #DA1E28;
--line-inactive: #CCCDD7;
--progress-bar-bg: #015884;
--progress-bar-bg: var(--white);
--mapped-green-border: #D9EBE1;
--mapped-green-bg: #EEF8F2;
--unmapped-red-border: #F5C0C3;
Expand Down

0 comments on commit dbf909a

Please sign in to comment.