-- Add password field to Employee Account form
BEGIN;

UPDATE forms
SET elements = $json$[
    {
        "label": "Full Name",
        "type_id": 1,
        "required": true,
        "field_name": "full_name",
        "data_column": "full_name",
        "order_index": 1
    },
    {
        "label": "Emails",
        "type_id": 16,
        "required": true,
        "field_name": "emails",
        "data_column": "emails",
        "order_index": 2
    },
    {
        "label": "Phones",
        "type_id": 16,
        "field_name": "phones",
        "data_column": "phones",
        "order_index": 3
    },
    {
        "type": "select",
        "label": "Location",
        "type_id": 4,
        "required": true,
        "help_text": "Select the branch where this employee will work",
        "field_name": "branch_id",
        "data_column": "branch_id",
        "order_index": 4,
        "options_table": "branches",
        "options_label_column": "name",
        "options_value_column": "branch_id"
    },
    {
        "label": "Password",
        "type_id": 16,
        "required": false,
        "field_name": "password",
        "data_column": "password_hash",
        "order_index": 5,
        "help_text": "Leave blank to keep existing password"
    }
]$json$,
updatedat = CURRENT_TIMESTAMP
WHERE id = 3
  AND name = 'Employee Account';

COMMIT;
