-- Add Certification Tracking modal
UPDATE ui_modals
SET config = '{"title":"Certification Tracking","header":[{"type":"button","label":"Add New","formName":"Training Certificate"}],"body":[{"type":"table","options":{"tableName":"training_certificates","columnsToShow":["course_id","category_id","employee_id","issued_at","expiry_date"],"showGlobalSearch":true}}],"footer":[{"type":"button","label":"Close","onClick":"closeModal"}]}'
WHERE name = 'Certification Tracking';

INSERT INTO ui_modals (name, config, tenant_id, branch_id, icon, aria_label, description)
SELECT 'Certification Tracking', '{"title":"Certification Tracking","header":[{"type":"button","label":"Add New","formName":"Training Certificate"}],"body":[{"type":"table","options":{"tableName":"training_certificates","columnsToShow":["course_id","category_id","employee_id","issued_at","expiry_date"],"showGlobalSearch":true}}],"footer":[{"type":"button","label":"Close","onClick":"closeModal"}]}' , NULL, NULL, 'fa-certificate', 'Certification Tracking', 'Certification Tracking'
WHERE NOT EXISTS (SELECT 1 FROM ui_modals WHERE name = 'Certification Tracking');
