DELETE FROM modules WHERE module_id = '442d22f0-a2c9-4b29-a741-ce90111ccfa4'::uuid;
INSERT INTO modules (module_id, name, config, org_id, branch_id, icon, aria_label, description) VALUES (
  '442d22f0-a2c9-4b29-a741-ce90111ccfa4'::uuid,
  'leave_management',
  '{"title":
    "Leave Management",
    "modulePath":"modules/leave/leaveManagement",
    
  "header":[
    {"type":
      "button",
      "label":"Apply for Leave",
      "formId":1
    },
    
    {"type":"filter-select",
      "options":{
        "data_column":"status",
      
      "options":[
        {"label":"All",
        "value":""
        },
        
    {"label":"Pending",
      "value":"Pending"
    },
    
    {"label":"Approved",
      "value":"Approved"
    },
      
    {"label":"Rejected",
      "value":"Rejected"
    }
      ]
        }
          },
          
    {"type":
      "filter-date-range",
    
    "options":{
      "data_column":"startdate"
    }
      }
        ],
        
    "body":[
      {"type":
        "table",
        "id":"leaveRequestsTable",
        "options":{"tableName":"leave_requests",

        "columnsToShow":
          ["leavetype",
            "startdate",
            "enddate",
            "reason",
            "status",
            "approvedAt",
            "approvedBy",
            "user_name"
          ],

        "columnLabels":
          {"leavetype":
            "Type",
            "startdate":"Start Date",
            "enddate":"End Date",
            "reason":"Reason",
            "status":"Status"
          },
          
        "showGlobalSearch":false,
          "rowActions":[
            {"label":"Approve",
              "type":"Confirm",
              "prompt":"Do you want to Approve the Leave",
              "columns":{
                "status":"approved"
              }
            }
              ]
                }
                  }
                    ],
                    
          "footer":[
            {"type":
                "button",
                "label":"Close",
                "onClick":"closeModal"
            }
              ]
                }'::jsonb,
  NULL,
  NULL,
  'fa-calendar-check',
  'Leave Management',
  'Leave Requests'
);