{
        "title": "POS Sessions Management",
        "table": "pos_sessions",
        "primaryKey": "session_id",
        "header": [
            {
                "type": "button",
                "label": "Refresh",
                "onClick": "refreshData",
                "icon": "fa-refresh"
            },
            {
                "type": "filter-select",
                "label": "Status",
                "options": {
                    "data_column": "status",
                    "options": [
                        {"label": "All", "value": ""},
                        {"label": "Active", "value": "active"},
                        {"label": "Closed", "value": "closed"},
                        {"label": "Abandoned", "value": "abandoned"}
                    ]
                }
            },
            {
                "type": "filter-date-range",
                "label": "Session Date",
                "options": {
                    "data_column": "session_start"
                }
            }
        ],
        "body": [
            {
                "type": "table",
                "id": "posSessionsTable",
                "options": {
                    "tableName": "pos_sessions",
                    "dataSource": "/api/pos_sessions",
                    "showGlobalSearch": true,
                    "addButton": false,
                    "rowClick": "selectRecord",
                    "columnsToShow": [
                        "cashier_name",
                        "session_start",
                        "session_end",
                        "status",
                        "opening_float",
                        "closing_cash_expected",
                        "closing_cash_declared",
                        "variance"
                    ],
                    "columnLabels": {
                        "cashier_name": "Cashier",
                        "session_start": "Start Time",
                        "session_end": "End Time",
                        "status": "Status",
                        "opening_float": "Opening Float",
                        "closing_cash_expected": "Expected Cash",
                        "closing_cash_declared": "Declared Cash",
                        "variance": "Variance"
                    },
                    "rowActions": [
                        {
                            "label": "View Details",
                            "icon": "fa-eye",
                            "onClick": "openSelectedDetail"
                        },
                        {
                            "label": "Close Session",
                            "icon": "fa-lock",
                            "action": "pos:closeSession",
                            "condition": "status == \"active\"",
                            "confirm": "Are you sure you want to close this session?"
                        },
                        {
                            "label": "Reopen Session",
                            "icon": "fa-unlock",
                            "action": "pos:reopenSession",
                            "condition": "status == \"closed\"",
                            "confirm": "Are you sure you want to reopen this session?"
                        }
                    ],
                    "sortBy": "session_start",
                    "sortOrder": "desc"
                }
            }
        ],
        "detail": {
            "modalId": "posSessionDetail",
            "title": "Session Details",
            "sections": [
                {
                    "title": "Session Information",
                    "type": "form",
                    "fields": [
                        {
                            "name": "cashier_name",
                            "label": "Cashier",
                            "type": "text",
                            "readonly": true
                        },
                        {
                            "name": "session_start",
                            "label": "Session Start",
                            "type": "datetime-local",
                            "readonly": true
                        },
                        {
                            "name": "session_end",
                            "label": "Session End",
                            "type": "datetime-local",
                            "readonly": true
                        },
                        {
                            "name": "status",
                            "label": "Status",
                            "type": "select",
                            "options": [
                                {"value": "active", "label": "Active"},
                                {"value": "closed", "label": "Closed"},
                                {"value": "abandoned", "label": "Abandoned"}
                            ],
                            "readonly": true
                        },
                        {
                            "name": "branch_id",
                            "label": "Branch",
                            "type": "text",
                            "readonly": true
                        },
                        {
                            "name": "pos_number",
                            "label": "POS Number",
                            "type": "text",
                            "readonly": true
                        }
                    ]
                },
                {
                    "title": "Financial Summary",
                    "type": "form",
                    "fields": [
                        {
                            "name": "opening_float",
                            "label": "Opening Float",
                            "type": "number",
                            "readonly": true,
                            "prefix": "$"
                        },
                        {
                            "name": "closing_cash_expected",
                            "label": "Expected Cash",
                            "type": "number",
                            "readonly": true,
                            "prefix": "$"
                        },
                        {
                            "name": "closing_cash_declared",
                            "label": "Declared Cash",
                            "type": "number",
                            "readonly": true,
                            "prefix": "$"
                        },
                        {
                            "name": "variance",
                            "label": "Variance",
                            "type": "number",
                            "readonly": true,
                            "prefix": "$",
                            "className": "text-red-600 font-bold"
                        }
                    ]
                },
                {
                    "title": "Session Transactions",
                    "type": "table",
                    "options": {
                        "tableName": "sales_receipts",
                        "dataSource": "/api/sales_receipts",
                        "filterField": "session_id",
                        "filterValue": "{session_id}",
                        "columnsToShow": [
                            "sales_receipt_id",
                            "sdcdatetime",
                            "transactiontype",
                            "total"
                        ],
                        "columnLabels": {
                            "sales_receipt_id": "Receipt ID",
                            "sdcdatetime": "Date/Time",
                            "transactiontype": "Type",
                            "total": "Total"
                        },
                        "addButton": false,
                        "showGlobalSearch": false
                    }
                }
            ],
            "actions": [
                {
                    "label": "Close Session",
                    "action": "pos:closeSession",
                    "condition": "status == \"active\"",
                    "confirm": "Close this session?",
                    "className": "btn-error"
                },
                {
                    "label": "Print Summary",
                    "action": "pos:printSessionSummary",
                    "icon": "fa-print",
                    "className": "btn-secondary"
                },
                {
                    "label": "Close",
                    "onClick": "closeModal",
                    "className": "btn-ghost"
                }
            ]
        },
        "footer": [
            {
                "type": "button",
                "label": "Close",
                "onClick": "closeModal"
            }
        ]
    }