Improves receivable settlement and balance display.
Enhances the receivable settlement dialog by providing a default description based on the selected payment method, improving clarity for users. Filters the user balance display to only show users with outstanding balances, making the interface cleaner and more focused for super users.
This commit is contained in:
parent
b4408cd53d
commit
f0257e7c7f
2 changed files with 29 additions and 7 deletions
|
|
@ -203,6 +203,10 @@ window.app = Vue.createApp({
|
|||
failedAssertions() {
|
||||
return this.balanceAssertions.filter(a => a.status === 'failed')
|
||||
},
|
||||
outstandingUserBalances() {
|
||||
// Filter to only show users with non-zero balances
|
||||
return this.allUserBalances.filter(user => user.balance !== 0)
|
||||
},
|
||||
passedAssertions() {
|
||||
return this.balanceAssertions.filter(a => a.status === 'passed')
|
||||
},
|
||||
|
|
@ -942,7 +946,7 @@ window.app = Vue.createApp({
|
|||
fiatCurrency: fiatCurrency, // 'EUR', 'USD', etc.
|
||||
amount: fiatCurrency ? fiatAmount : Math.abs(userBalance.balance), // Default to fiat if available, otherwise sats
|
||||
payment_method: fiatCurrency ? 'cash' : 'lightning', // Default to cash if fiat balance exists
|
||||
description: `Payment from ${userBalance.username}`,
|
||||
description: '', // Will be auto-generated based on payment method if left empty
|
||||
reference: '',
|
||||
loading: false,
|
||||
invoice: null,
|
||||
|
|
@ -1077,11 +1081,23 @@ window.app = Vue.createApp({
|
|||
this.settleReceivableDialog.payment_method
|
||||
)
|
||||
|
||||
// Create description with payment method
|
||||
const paymentMethodLabels = {
|
||||
'cash': 'Cash payment',
|
||||
'bank_transfer': 'Bank transfer',
|
||||
'check': 'Check payment',
|
||||
'lightning': 'Lightning payment',
|
||||
'other': 'Payment'
|
||||
}
|
||||
const methodLabel = paymentMethodLabels[this.settleReceivableDialog.payment_method] || 'Payment'
|
||||
const description = this.settleReceivableDialog.description ||
|
||||
`${methodLabel} from ${this.settleReceivableDialog.username}`
|
||||
|
||||
const payload = {
|
||||
user_id: this.settleReceivableDialog.user_id,
|
||||
amount: this.settleReceivableDialog.amount,
|
||||
payment_method: this.settleReceivableDialog.payment_method,
|
||||
description: this.settleReceivableDialog.description,
|
||||
description: description,
|
||||
reference: this.settleReceivableDialog.reference || null,
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -154,12 +154,12 @@
|
|||
</q-card>
|
||||
|
||||
<!-- User Balances Breakdown (Super User Only) -->
|
||||
<q-card v-if="isSuperUser && allUserBalances.length > 0">
|
||||
<q-card v-if="isSuperUser && outstandingUserBalances.length > 0">
|
||||
<q-card-section>
|
||||
<h6 class="q-my-none q-mb-md">Outstanding Balances by User</h6>
|
||||
<q-table
|
||||
flat
|
||||
:rows="allUserBalances"
|
||||
:rows="outstandingUserBalances"
|
||||
:columns="[
|
||||
{name: 'user', label: 'User', field: 'username', align: 'left'},
|
||||
{name: 'balance', label: 'Amount Owed', field: 'balance', align: 'right'},
|
||||
|
|
@ -1204,9 +1204,15 @@
|
|||
dense
|
||||
v-model="settleReceivableDialog.description"
|
||||
type="text"
|
||||
label="Description *"
|
||||
hint="Description of the payment"
|
||||
:rules="[val => !!val || 'Description is required']"
|
||||
label="Description (optional)"
|
||||
:placeholder="settleReceivableDialog.payment_method === 'cash' ?
|
||||
`Cash payment from ${settleReceivableDialog.username}` :
|
||||
settleReceivableDialog.payment_method === 'bank_transfer' ?
|
||||
`Bank transfer from ${settleReceivableDialog.username}` :
|
||||
settleReceivableDialog.payment_method === 'check' ?
|
||||
`Check payment from ${settleReceivableDialog.username}` :
|
||||
`Payment from ${settleReceivableDialog.username}`"
|
||||
hint="Auto-generated if left empty"
|
||||
></q-input>
|
||||
|
||||
<q-input
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue