Skip to content

Commit 7350894

Browse files
committed
Revert "feat: reconciliation - disable editing of currency, amount and spend …" (#4003)
This reverts commit 60923ff.
1 parent 60923ff commit 7350894

File tree

9 files changed

+8
-47
lines changed

9 files changed

+8
-47
lines changed

src/app/core/models/platform/v1/expense.model.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,5 +117,4 @@ export interface Expense {
117117
commute_deduction?: CommuteDeduction;
118118
commute_details?: CommuteDetails;
119119
commute_details_id?: number;
120-
is_reconciled?: boolean;
121120
}

src/app/fyle/add-edit-expense/add-edit-expense-6.spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,6 @@ export function TestCases6(getTestBed) {
155155
Object.defineProperty(component.fg, 'value', {
156156
get: () => null,
157157
});
158-
spyOn(component.fg, 'getRawValue').and.returnValue(null);
159158
}
160159

161160
beforeEach(() => {

src/app/fyle/add-edit-expense/add-edit-expense.page.html

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -135,15 +135,6 @@
135135
@if (fg && !isLoading) {
136136
<form #formContainer [formGroup]="fg" class="add-edit-expense--form">
137137
<div>
138-
@if (isReconciledExpense()) {
139-
<div class="add-edit-expense--alert-offline">
140-
<app-fy-alert-info
141-
[message]="'addEditExpense.reconciledInfo' | transloco"
142-
[type]="'information'"
143-
></app-fy-alert-info>
144-
</div>
145-
}
146-
147138
@if (showReceiptMandatoryError) {
148139
<div class="add-edit-expense--alert-offline receipt-mandatory-error">
149140
<app-fy-alert-info
@@ -370,7 +361,6 @@
370361
[touchedInParent]="fg?.controls?.currencyObj?.touched"
371362
[validInParent]="fg?.controls?.currencyObj?.valid"
372363
[autoCodedData]="autoCodedData"
373-
[disable]="isReconciledExpense()"
374364
>
375365
</app-currency>
376366
@if (fg.controls.currencyObj.touched && !fg.controls.currencyObj.valid) {

src/app/fyle/add-edit-expense/add-edit-expense.page.ts

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -669,8 +669,6 @@ export class AddEditExpensePage implements OnInit {
669669

670670
isLoading = true;
671671

672-
readonly isReconciledExpense = signal<boolean>(false);
673-
674672
readonly isPendingGasCharge = signal<boolean>(false);
675673

676674
readonly isSelectedProjectDisabled = signal(false);
@@ -709,8 +707,7 @@ export class AddEditExpensePage implements OnInit {
709707
}
710708

711709
getFormValues(): FormValue {
712-
// getRawValue is used to get the value of the form fields including the disabled fields
713-
return this.fg.getRawValue() as FormValue;
710+
return this.fg.value as FormValue;
714711
}
715712

716713
getFormControl(name: string): AbstractControl {
@@ -2863,18 +2860,12 @@ export class AddEditExpensePage implements OnInit {
28632860
switchMap((expense) => {
28642861
const etxn = this.transactionService.transformExpense(expense);
28652862
this.isPendingGasCharge.set(this.sharedExpensesService.isPendingGasCharge(expense));
2863+
28662864
if (etxn && etxn.tx.extracted_data) {
28672865
this.autoCodedData = etxn.tx.extracted_data;
28682866
this.autoCodedData.vendor_name = etxn.tx.extracted_data.vendor;
28692867
}
28702868

2871-
this.isReconciledExpense.set(expense.is_reconciled);
2872-
2873-
if (this.isReconciledExpense()) {
2874-
this.fg.controls.dateOfSpend.disable();
2875-
this.fg.controls.currencyObj.disable();
2876-
}
2877-
28782869
this.isIncompleteExpense = etxn.tx.state === 'DRAFT';
28792870
this.source = etxn.tx.source || 'MOBILE';
28802871
if (etxn.tx.state === 'DRAFT' && etxn.tx.extracted_data) {

src/app/shared/components/fy-currency/fy-currency.component.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
[placeholder]="'fyCurrency.amountPlaceholder' | transloco"
3131
formControlName="amount"
3232
[isAmount]="true"
33-
[disabled]="disable()"
3433
>
3534
</app-fy-number>
3635
</div>

src/app/shared/components/fy-currency/fy-currency.component.ts

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, OnInit, forwardRef, Input, SimpleChanges, OnChanges, inject, input, effect } from '@angular/core';
1+
import { Component, OnInit, forwardRef, Input, SimpleChanges, OnChanges, inject } from '@angular/core';
22

33
import {
44
NG_VALUE_ACCESSOR,
@@ -59,19 +59,6 @@ export class FyCurrencyComponent implements ControlValueAccessor, OnInit, OnChan
5959

6060
private translocoService = inject(TranslocoService);
6161

62-
constructor() {
63-
effect(() => {
64-
const isDisabled = this.disable();
65-
if (this.fg) {
66-
if (isDisabled) {
67-
this.fg.disable();
68-
} else if (this.fg.disabled) {
69-
this.fg.enable();
70-
}
71-
}
72-
});
73-
}
74-
7562
// TODO: Skipped for migration because:
7663
// Your application code writes to the input. This prevents migration.
7764
@Input() txnDt: Date;
@@ -100,8 +87,6 @@ export class FyCurrencyComponent implements ControlValueAccessor, OnInit, OnChan
10087
// Your application code writes to the input. This prevents migration.
10188
@Input() autoCodedData: ParsedResponse;
10289

103-
readonly disable = input<boolean>(false);
104-
10590
currencyAutoCodeMessage = '';
10691

10792
amountAutoCodeMessage = '';

src/app/shared/components/fy-number/fy-number.component.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
<input
33
class="fy-number--input smartlook-show"
44
[min]="min()"
5+
[disabled]="disabled()"
56
[formControl]="fc"
67
[placeholder]="placeholder() || ''"
78
(blur)="(onBlur)"
@@ -14,6 +15,7 @@
1415
<input
1516
class="fy-number--input smartlook-show"
1617
[min]="min()"
18+
[disabled]="disabled()"
1719
[formControl]="fc"
1820
[placeholder]="placeholder() || ''"
1921
(blur)="(onBlur)"
@@ -26,6 +28,7 @@
2628
<input
2729
class="fy-number--input smartlook-show"
2830
[min]="min()"
31+
[disabled]="disabled()"
2932
[formControl]="fc"
3033
[placeholder]="placeholder() || ''"
3134
(blur)="(onBlur)"
@@ -37,6 +40,7 @@
3740
<input
3841
class="fy-number--input smartlook-show"
3942
[min]="min()"
43+
[disabled]="disabled()"
4044
[formControl]="fc"
4145
[placeholder]="placeholder() || ''"
4246
(blur)="(onBlur)"

src/app/shared/components/fy-number/fy-number.component.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,6 @@ export class FyNumberComponent implements ControlValueAccessor, OnInit, AfterVie
105105

106106
setDisabledState?(isDisabled: boolean): void {
107107
this.isDisabled = isDisabled;
108-
if (isDisabled) {
109-
this.fc?.disable();
110-
} else {
111-
this.fc?.enable();
112-
}
113108
}
114109

115110
onBlur(): void {

src/assets/i18n/en.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1576,8 +1576,7 @@
15761576
"projectDisabledError": "Project disabled, select a different one.",
15771577
"pleaseSelectProjectError": "Please select a project.",
15781578
"billableLabel": "Billable",
1579-
"cancelButton": "Cancel",
1580-
"reconciledInfo": "Some details can't be edited because this expense is already reconciled."
1579+
"cancelButton": "Cancel"
15811580
},
15821581
"myExpensesPage": {
15831582
"title": "My expenses",

0 commit comments

Comments
 (0)