diff --git a/static/js/index.js b/static/js/index.js index 2d76093..af998a4 100644 --- a/static/js/index.js +++ b/static/js/index.js @@ -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, } diff --git a/templates/castle/index.html b/templates/castle/index.html index a198d25..25bef59 100644 --- a/templates/castle/index.html +++ b/templates/castle/index.html @@ -154,12 +154,12 @@ - +
Outstanding Balances by User