diff --git a/src/app/fyle/add-edit-expense/add-edit-expense-5.spec.ts b/src/app/fyle/add-edit-expense/add-edit-expense-5.spec.ts index e5bad185b9..4b820c77ee 100644 --- a/src/app/fyle/add-edit-expense/add-edit-expense-5.spec.ts +++ b/src/app/fyle/add-edit-expense/add-edit-expense-5.spec.ts @@ -1470,6 +1470,10 @@ export function TestCases5(getTestBed) { expect(expense).toEqual(expenseData); }); + component.pendingTransactionRestrictionEnabled = true; + + expect(component.pendingTransactionAllowedToReportAndSplit).toBeTrue(); + expect(expensesService.getExpenseById).toHaveBeenCalledOnceWith('txyeiYbLDSOy'); component.attachments$.subscribe((res) => { @@ -1754,6 +1758,7 @@ export function TestCases5(getTestBed) { }); expect(component.platformExpense$).toBeUndefined(); + expect(component.pendingTransactionAllowedToReportAndSplit).toBeTrue(); expect(expensesService.getExpenseById).not.toHaveBeenCalled(); component.attachments$.subscribe((res) => { diff --git a/src/app/fyle/add-edit-expense/add-edit-expense.page.html b/src/app/fyle/add-edit-expense/add-edit-expense.page.html index 4690918bea..cb9eeac42e 100644 --- a/src/app/fyle/add-edit-expense/add-edit-expense.page.html +++ b/src/app/fyle/add-edit-expense/add-edit-expense.page.html @@ -1127,15 +1127,17 @@ -
- -
+ +
+ +
+
diff --git a/src/app/fyle/add-edit-expense/add-edit-expense.page.ts b/src/app/fyle/add-edit-expense/add-edit-expense.page.ts index 025ab7c36e..67b50bbe5e 100644 --- a/src/app/fyle/add-edit-expense/add-edit-expense.page.ts +++ b/src/app/fyle/add-edit-expense/add-edit-expense.page.ts @@ -423,6 +423,11 @@ export class AddEditExpensePage implements OnInit { isRTFEnabled$: Observable; + pendingTransactionAllowedToReportAndSplit = true; + + //TODO : Assign its value from org settings + pendingTransactionRestrictionEnabled = false; + constructor( private activatedRoute: ActivatedRoute, private accountsService: AccountsService, @@ -3078,6 +3083,16 @@ export class AddEditExpensePage implements OnInit { if (this.activatedRoute.snapshot.params.id) { const id = this.activatedRoute.snapshot.params.id as string; this.platformExpense$ = this.expensesService.getExpenseById(id); + if (this.pendingTransactionRestrictionEnabled) { + this.platformExpense$.pipe(take(1)).subscribe((transaction) => { + if ( + transaction.matched_corporate_card_transactions?.length && + transaction.matched_corporate_card_transactions[0]?.status === TransactionStatus.PENDING + ) { + this.pendingTransactionAllowedToReportAndSplit = false; + } + }); + } } this.attachments$ = this.loadAttachments$.pipe(