-- Update Case Hour Entry modal config to remove duplicate editFormId
UPDATE ui_modals
SET config = '{"title":"Case Hour Entry","header":[{"type":"button","label":"Add Hour","formName":"Case Hour"}],"body":[{"type":"table","options":{"tableName":"case_hours","tableUrl":"../api/case_hours","showGlobalSearch":false,"addButton":false,"editFormId":38}}],"footer":[{"type":"button","label":"Close","onClick":"closeModal"}]}'
WHERE name = 'Case Hour Entry';

INSERT INTO ui_modals (name, config, tenant_id, branch_id)
SELECT 'Case Hour Entry', '{"title":"Case Hour Entry","header":[{"type":"button","label":"Add Hour","formName":"Case Hour"}],"body":[{"type":"table","options":{"tableName":"case_hours","tableUrl":"../api/case_hours","showGlobalSearch":false,"addButton":false,"editFormId":38}}],"footer":[{"type":"button","label":"Close","onClick":"closeModal"}]}' , NULL, NULL
WHERE NOT EXISTS (SELECT 1 FROM ui_modals WHERE name = 'Case Hour Entry');
