-- Migration: Add Time Clock Entry Form (Form 624)
-- Date: 2024-11-14
-- Purpose: Create a unified time clock entry form for quick clock in/out entries
-- Author: System Generated

-- Form 624: Quick Time Clock Entry
-- Simplified form for quick clock in/out entries with hidden pre-filled fields
INSERT INTO forms (id, name, description, mapped_table, elements, tenant_id, branch_id) VALUES (
  624,
  'Time Clock Entry',
  'Quick clock in/out entry for employees',
  'time_clocks',
  $json$[
    {
      "id": 1,
      "name": "user_id",
      "label": "Employee",
      "type": 16,
      "data_column": "user_id",
      "required": true,
      "order": 1,
      "hidden": true
    },
    {
      "id": 2,
      "name": "clock_type",
      "label": "Clock Type",
      "type": 16,
      "data_column": "clock_type",
      "required": true,
      "order": 2,
      "hidden": true
    },
    {
      "id": 3,
      "name": "clocked_at",
      "label": "Date & Time",
      "type": 10,
      "data_column": "clocked_at",
      "required": true,
      "order": 3
    }
  ]$json$::jsonb,
  NULL,
  NULL
) ON CONFLICT (id) DO UPDATE SET
  name = EXCLUDED.name,
  description = EXCLUDED.description,
  mapped_table = EXCLUDED.mapped_table,
  elements = EXCLUDED.elements;