diff --git a/static/js/index.js b/static/js/index.js index cee8e08..3735438 100644 --- a/static/js/index.js +++ b/static/js/index.js @@ -646,6 +646,23 @@ window.app = Vue.createApp({ } } return false + }, + isPayable(entry) { + // Check if this is a payable entry (castle owes user) + // Payables have a credit to an "Accounts Payable" account with the user's ID + if (!entry.lines || entry.lines.length === 0) return false + + for (const line of entry.lines) { + // Look for a line with positive credit on an accounts payable account + if (line.credit > 0) { + // Check if the account is associated with this user's payables + const account = this.accounts.find(a => a.id === line.account_id) + if (account && account.name && account.name.includes('Accounts Payable') && account.account_type === 'liability') { + return true + } + } + } + return false } }, async created() { diff --git a/templates/castle/index.html b/templates/castle/index.html index 771cb06..68ef696 100644 --- a/templates/castle/index.html +++ b/templates/castle/index.html @@ -76,7 +76,7 @@