This commit is contained in:
gsinghpal
2026-04-04 15:37:16 -04:00
parent c66bdf5089
commit 3cc93b8783
36 changed files with 3278 additions and 548 deletions

View File

@@ -36,12 +36,22 @@ export class FusionDashboard extends Component {
this.state.loading = false;
}
async onCardClick(domain) {
if (!this.state.chatSessionId) {
const session = await rpc("/fusion_accounting/session/create", {
context_domain: domain,
});
this.state.chatSessionId = session.session_id;
async onAttentionClick(domain, prompt) {
// Type the prompt into the chat input and send
if (!prompt) return;
const textarea = this.el?.querySelector('.fusion_chat_input textarea');
if (textarea) {
// Set value and trigger OWL's model update via input event
const nativeInputValueSetter = Object.getOwnPropertyDescriptor(
window.HTMLTextAreaElement.prototype, 'value'
).set;
nativeInputValueSetter.call(textarea, prompt);
textarea.dispatchEvent(new Event('input', { bubbles: true }));
// Click send button
setTimeout(() => {
const sendBtn = this.el?.querySelector('.fusion_chat_input .btn-primary');
if (sendBtn) sendBtn.click();
}, 50);
}
}
@@ -52,27 +62,27 @@ export class FusionDashboard extends Component {
{
title: "Bank Reconciliation",
metric: `${d.bank_recon.count} unmatched`,
subtext: `$${(d.bank_recon.amount || 0).toFixed(2)} total`,
subtext: `$${(d.bank_recon.amount || 0).toLocaleString('en-CA', {minimumFractionDigits: 0})} total`,
domain: "bank_reconciliation",
status: d.bank_recon.count === 0 ? "green" : d.bank_recon.count < 10 ? "yellow" : "red",
},
{
title: "AR Outstanding",
metric: `$${(d.ar.total || 0).toFixed(2)}`,
metric: `$${Math.abs(d.ar.total || 0).toLocaleString('en-CA', {minimumFractionDigits: 0})}`,
subtext: `${d.ar.overdue_count} overdue`,
domain: "accounts_receivable",
status: d.ar.overdue_count === 0 ? "green" : d.ar.overdue_count < 5 ? "yellow" : "red",
},
{
title: "AP Due",
metric: `$${(d.ap.total || 0).toFixed(2)}`,
metric: `$${(d.ap.total || 0).toLocaleString('en-CA', {minimumFractionDigits: 0})}`,
subtext: `${d.ap.due_this_week} due this week`,
domain: "accounts_payable",
status: d.ap.due_this_week === 0 ? "green" : "yellow",
},
{
title: "HST Balance",
metric: `$${(d.hst.balance || 0).toFixed(2)}`,
metric: `$${(d.hst.balance || 0).toLocaleString('en-CA', {minimumFractionDigits: 0})}`,
subtext: d.hst.balance > 0 ? "Owing to CRA" : "Refund expected",
domain: "hst_management",
status: "blue",