Files
Odoo-Modules/fusion_accounting/static/src/components/chat/approval_card.js
gsinghpal 3cc93b8783 changes
2026-04-04 15:37:16 -04:00

38 lines
1.1 KiB
JavaScript

/** @odoo-module **/
import { Component } from "@odoo/owl";
export class FusionApprovalCard extends Component {
static template = "fusion_accounting.ApprovalCard";
static props = ["approval", "onApprove", "onReject"];
get toolLabel() {
const name = this.props.approval.tool_name || "";
// Short labels for common tools
const labels = {
create_payroll_journal_entry: "Payroll JE",
create_vendor_bill: "Vendor Bill",
register_bill_payment: "Bill Payment",
create_expense_entry: "Expense",
register_hst_payment: "HST Payment",
apply_payment: "Payment",
send_followup: "Follow-up",
flag_entry: "Flag",
};
return labels[name] || name.replace(/_/g, " ").replace(/\b\w/g, c => c.toUpperCase());
}
formatAmount(val) {
if (!val) return "";
return Number(val).toLocaleString("en-CA", { minimumFractionDigits: 2, maximumFractionDigits: 2 });
}
approve() {
this.props.onApprove(this.props.approval.id);
}
reject() {
this.props.onReject(this.props.approval.id);
}
}