Skip to content

Commit

Permalink
Merge pull request #498 from jesusantguerrero/feat/pay-credits-v2
Browse files Browse the repository at this point in the history
fix: return absolute value of difference in reconciliation
  • Loading branch information
jesusantguerrero authored Nov 10, 2024
2 parents 1ffcbc7 + 66508d1 commit 98d6530
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const { account } = defineProps<{
}>();
const goToReconciliation = () => {
router.visit(`/finance/reconciliation/${account?.reconciliation_last.id}`)
router.visit(`/finance/reconciliation/${account?.reconciliation_last?.id}`)
}
const isMatched = computed(() => {
Expand All @@ -28,14 +28,14 @@ const adjustmentForm = useForm({
})
const adjustAndFinish = () => {
if (!isMatched.value) {
adjustmentForm.put(`/finance/reconciliation/${account?.reconciliation_last.id}/save-adjustment`)
adjustmentForm.put(`/finance/reconciliation/${account?.reconciliation_last?.id}/save-adjustment`)
} else {
adjustmentForm
.transform((data) => ({
...data,
date: account.reconciliation_last?.date,
}))
.put(`/finance/reconciliation/${account.reconciliation_last.id}`, {
.put(`/finance/reconciliation/${account.reconciliation_last?.id}`, {
onFinish() {
adjustmentForm.reset();
},
Expand All @@ -48,11 +48,11 @@ const differenceStateText = computed(() => {
})
const differenceAmount = computed(() => {
return account.reconciliation_last?.amount - account.balance
return Math.abs(account.reconciliation_last?.amount ?? 0 - account.balance)
})
const hasPendingReconciliation = computed(() => {
return account.reconciliation_last?.status == 'pending';
return account.reconciliation_last?.status == 'pending';
})
</script>
Expand Down
1 change: 1 addition & 0 deletions resources/js/domains/transactions/models/transactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export interface IReconciliation {
difference: number;
amount: number;
date: string;
status: string;
}
export interface IPayee {
id: number;
Expand Down

0 comments on commit 98d6530

Please sign in to comment.