(function () { const OrgPortal = (window.OrgPortal = window.OrgPortal || {}); const { h } = OrgPortal.runtime; const { portalData } = OrgPortal.data; const store = OrgPortal.store; const permissions = OrgPortal.permissions; const actions = OrgPortal.actions; OrgPortal.componentFns = OrgPortal.componentFns || {}; OrgPortal.componentFns.TreasuryCard = function TreasuryCard() { const notice = store.getTreasuryNotice(); const creditLines = store.getCreditLines(); const allowTreasuryActions = permissions.canManageTreasury(); return h( "section", { className: "card org-panel org-span-5" }, h( "div", { className: "org-panel-head" }, h( "div", null, h("h2", { className: "org-panel-title" }, "Treasury"), h( "p", { className: "org-panel-subtitle" }, "Organization funds, reputation, and member payouts.", ), ), ), h( "div", { className: "org-finance-meta" }, h( "div", null, h("span", { className: "org-meta-label" }, "Funds"), h("strong", null, actions.formatCurrency(store.getFunds())), ), h( "div", null, h("span", { className: "org-meta-label" }, "Reputation"), h("strong", null, `${portalData.reputation}`), ), ), allowTreasuryActions ? h( "div", { className: "org-action-grid" }, h( "button", { type: "button", onClick: () => actions.openModal("payroll"), }, "Run Payroll", ), h( "button", { type: "button", className: "org-secondary-btn", onClick: () => actions.openModal("transfer"), }, "Send Funds", ), h( "button", { type: "button", className: "org-secondary-btn", onClick: () => actions.openModal("credit"), }, "Credit Line", ), ) : h( "p", { className: "org-access-note" }, "Only the organization leader or CEO can manage treasury actions.", ), notice.text ? h( "div", { className: notice.type === "error" ? "org-treasury-notice is-error" : "org-treasury-notice is-success", }, notice.text, ) : null, creditLines.length > 0 ? h( "div", { className: "org-credit-lines" }, h( "span", { className: "org-meta-label" }, "Active Credit Lines", ), h( "div", { className: "org-credit-list" }, ...creditLines.map((line) => h( "div", { className: "org-credit-row" }, h("span", null, line.member), h( "strong", null, actions.formatCurrency(line.amount), ), ), ), ), ) : null, ); }; })();