-- Update Case Details view with overview and client info panels
UPDATE detail_views
SET config = '{"name": "Case Details", "items": [{"type": "html", "id": "caseOverview", "html": "<div class=''card bg-base-100 shadow mb-4''><div class=''card-body space-y-1''><h2 class=''card-title''>Case Overview</h2><p><span id=''dvCaseNumber''></span> - <span id=''dvTitle''></span></p><p>Status: <span id=''dvStatus''></span></p><p>Lead Rep: <span id=''dvLeadRep''></span></p><p>Opened: <span id=''dvOpenedAt''></span></p><p>Closed: <span id=''dvClosedAt''></span></p><div class=''card-actions''><button id=''dvEditCase'' class=''btn btn-sm''>Edit Case</button><button id=''dvAddEntry'' class=''btn btn-sm''>Add Entry</button><button id=''dvCloseCase'' class=''btn btn-sm''>Close Case</button></div></div></div>"}, {"type": "html", "id": "clientInfo", "html": "<div class=''card bg-base-100 shadow mb-4''><div class=''card-body space-y-1''><h2 class=''card-title''>Client Information</h2><p><a id=''dvClientName'' class=''link'' href=''#''></a></p><p>Phone: <span id=''dvClientPhone''></span></p><p>Email: <span id=''dvClientEmail''></span></p><p><span id=''dvClientAddress''></span></p><p><span id=''dvClientCity''></span>, <span id=''dvClientCountry''></span></p><p><span id=''dvClientNotes''></span></p><div id=''dvClientDocs''></div></div></div>"}, {"type": "heading", "data_column": "title"}, {"type": "paragraph", "data_column": "client_id"}, {"type": "paragraph", "data_column": "status_id"}, {"type": "paragraph", "data_column": "opened_at"}, {"type": "paragraph", "data_column": "closed_at"}, {"type": "paragraph", "data_column": "lead_rep_id"}, {"type": "paragraph", "data_column": "description"}, {"type": "paragraph", "data_column": "initial_instructions"}, {"type": "aggregate", "table": "case_hours", "column": "hours", "function": "sum", "filterField": "case_id"}, {"type": "aggregate", "table": "case_hours", "column": "hours*rate", "function": "sum", "filterField": "case_id"}, {"type": "aggregate", "table": "expenses", "column": "amount", "function": "sum", "filterField": "reference_id"}]}'
WHERE id = 2;
