-- Update Safety Incident Classification form location dropdown and button

UPDATE forms
SET elements = $json$
[{"label":"Incident Type","field_name":"incident_type","data_column":"incident_type","type_id":4,"options_table":"safety_incident_types","options_label_column":"name","options_value_column":"id","order_index":1},
 {"label":"Location","field_name":"location","data_column":"location","type_id":4,"options_table":"locations","options_label_column":"name","options_value_column":"name","order_index":2}]
$json$
WHERE id = 107;

UPDATE form_buttons
SET action_payload = '{"lookupTable":"safety_incident_types","lookupField":"incident_type","valueColumn":"id","formColumn":"form_id","prefillFields":["incident_type","location"]}'
WHERE form_id = 107 AND label = 'Open Form';
