-- Add Case Hours & Expenses modal
INSERT INTO ui_modals (name, config, tenant_id, branch_id, icon, aria_label, description)
SELECT
  'case_hours_expenses',
  '{"title":"Case Hours & Expenses","header":[{"type":"filter-select","options":{"source_table":"users","source_column":"id","display_column":"name","default_label":"All","data_column":"user_id"}},{"type":"filter-select","options":{"data_column":"status","options":[{"label":"All","value":""},{"label":"approved","value":"approved"},{"label":"pending","value":"pending"}]}},{"type":"filter-date-range","options":{"data_column":"logged_date"}}],"body":[{"type":"tabs","tabs":[{"label":"Case Hours","elements":[{"type":"table","options":{"tableName":"case_hours","showGlobalSearch":false,"addButton":false,"filterField":["user_id","status","logged_date"]}}]},{"label":"Expenses","elements":[{"type":"table","options":{"tableName":"expenses","showGlobalSearch":false,"addButton":false,"filterField":["user_id","status","logged_date"],"filters":{"case_id":null}}}]}]}],"footer":[{"type":"button","label":"Close","onClick":"closeModal"}]}',
  NULL, NULL, 'fa-clock', 'Case Hours & Expenses', 'Case Hours & Expenses'
WHERE NOT EXISTS (
  SELECT 1 FROM ui_modals WHERE name = 'case_hours_expenses'
);
