/* 아리 — 결재함 (승인 큐) 위젯 아리가 미리 해둔 일 = 되돌리기만, 위험한 일 = 승인 대기. dash-v2.jsx에서 로 사용. */ (function () { const { useState, useEffect } = React; const A = window.AriApprovals; /* autonomy: "approve"(승인 우선) | "mixed"(혼합) | "auto"(완전 자율) */ function initStatus(autonomy) { const m = {}; A.items.forEach((it) => { if (autonomy === "auto") m[it.id] = "done"; else if (autonomy === "mixed") m[it.id] = it.risk === "low" ? "done" : "pending"; else m[it.id] = "pending"; }); return m; } function ApprovalCard({ I, autonomy, showLog }) { const [st, setSt] = useState(() => initStatus(autonomy)); useEffect(() => { setSt(initStatus(autonomy)); }, [autonomy]); const pending = A.items.filter((it) => st[it.id] === "pending"); const done = A.items.filter((it) => st[it.id] === "done"); const approve = (id) => setSt((s) => ({ ...s, [id]: "done" })); const undo = (id) => setSt((s) => ({ ...s, [id]: "pending" })); const approveAll = () => setSt((s) => { const n = { ...s }; pending.forEach((it) => { n[it.id] = "done"; }); return n; }); return (

아리 결재함

확인만 하면 끝 · 오늘 {A.savedToday} 아껴드렸어요
{pending.length > 0 ? 대기 {pending.length}건 : 모두 처리됨}
{/* ----- 승인 대기 ----- */} {pending.length === 0 ? (
결재할 게 없어요 — 아리가 알아서 하고 있어요. 아래에서 언제든 되돌릴 수 있어요.
) : (
{pending.map((it) => (
{it.title}
{it.detail}
))} {pending.length >= 2 && ( )}
)} {/* ----- 자동 처리됨 (되돌리기) ----- */} {done.length > 0 && (
처리됨 — 탭 한 번으로 되돌릴 수 있어요
{done.map((it) => (
{it.title} {it.time}
))}
)} {/* ----- 활동 로그 ----- */} {showLog && (
밤사이 조용히 한 일 {A.autoCountNight}건
{A.log.map((l, i) => (
{l.time} {l.text}
))}
)}
); } window.ApprovalCard = ApprovalCard; })();