{
        "title": "Invoices Management",
        "modulePath": "invoices",
        "header": [
            {
                "type": "button",
                "label": "New Invoice",
                "icon": "fa-plus",
                "class": "btn btn-primary",
                "action": {
                    "handler": "openInvoiceForm"
                },
                "ariaLabel": "Create new invoice"
            },
            {
                "type": "filter-select",
                "options": {
                    "data_column": "status",
                    "label": "Status",
                    "options": [
                        {"label": "All", "value": ""},
                        {"label": "Draft", "value": "draft"},
                        {"label": "Pending", "value": "pending"},
                        {"label": "Submitted", "value": "submitted"},
                        {"label": "Paid", "value": "paid"},
                        {"label": "Overdue", "value": "overdue"},
                        {"label": "Cancelled", "value": "cancelled"}
                    ]
                }
            },
            {
                "type": "filter-select",
                "options": {
                    "data_column": "is_proforma",
                    "label": "Type",
                    "options": [
                        {"label": "All", "value": ""},
                        {"label": "Standard", "value": "false"},
                        {"label": "Proforma", "value": "true"},
                        {"label": "Advance Payment", "value": "advance"},
                        {"label": "Refund", "value": "refund"}
                    ]
                }
            },
            {
                "type": "filter-date-range",
                "options": {
                    "data_column": "invoice_date",
                    "label": "Date Range"
                }
            },
            {
                "type": "button",
                "label": "Refresh",
                "icon": "fa-sync",
                "class": "btn btn-ghost",
                "action": "refresh",
                "ariaLabel": "Refresh invoices list"
            }
        ],
        "body": [
            {
                "type": "table",
                "id": "invoicesTable",
                "options": {
                    "tableName": "invoices",
                    "primaryKeyField": "invoice_id",
                    "showGlobalSearch": true,
                    "columnsToShow": [
                        "invoice_number",
                        "invoice_date",
                        "name",
                        "amount",
                        "amount_paid",
                        "status",
                        "is_proforma",
                        "taxcore_submission_id",
                        "sent_at"
                    ],
                    "columnLabels": {
                        "invoice_number": "Invoice #",
                        "invoice_date": "Date",
                        "name": "Customer",
                        "amount": "Amount",
                        "amount_paid": "Paid",
                        "status": "Status",
                        "is_proforma": "Proforma",
                        "taxcore_submission_id": "TaxCore ID",
                        "sent_at": "Sent"
                    },
                    "rowClick": "selectRecord",
                    "rowActions": [
                        {
                            "label": "View",
                            "icon": "fa-eye",
                            "class": "btn btn-info btn-xs",
                            "action": "openSelectedDetail",
                            "ariaLabel": "View invoice details"
                        },
                        {
                            "label": "Submit to TaxCore",
                            "icon": "fa-upload",
                            "class": "btn btn-primary btn-xs",
                            "action": "invoices:submit-taxcore",
                            "condition": "status == \"draft\" && taxcore_submission_id == null",
                            "confirm": "Submit this invoice to the tax authority?",
                            "ariaLabel": "Submit invoice to tax authority"
                        },
                        {
                            "label": "TaxCore Receipt",
                            "icon": "fa-receipt",
                            "class": "btn btn-success btn-xs",
                            "action": "invoices:taxcore-receipt",
                            "condition": "taxcore_submission_id != null",
                            "ariaLabel": "View TaxCore receipt"
                        },
                        {
                            "label": "Create Advance Payment",
                            "icon": "fa-money-bill",
                            "class": "btn btn-success btn-xs",
                            "action": "invoices:advance-payment",
                            "condition": "status == \"draft\" && is_advance_payment == false",
                            "confirm": "Create an advance payment invoice?",
                            "ariaLabel": "Create advance payment invoice"
                        },
                        {
                            "label": "Create Refund",
                            "icon": "fa-undo",
                            "class": "btn btn-warning btn-xs",
                            "action": "invoices:refund",
                            "condition": "status == \"paid\" && is_refund == false",
                            "confirm": "Create a refund invoice?",
                            "ariaLabel": "Create refund invoice"
                        },
                        {
                            "label": "Record Payment",
                            "icon": "fa-credit-card",
                            "class": "btn btn-success btn-xs",
                            "action": "payments:initiate",
                            "condition": "status != \"paid\" && status != \"cancelled\"",
                            "ariaLabel": "Record payment for invoice"
                        },
                        {
                            "label": "Payment Status",
                            "icon": "fa-info-circle",
                            "class": "btn btn-info btn-xs",
                            "action": "payments:status",
                            "condition": "amount_paid > 0",
                            "ariaLabel": "View payment status"
                        },
                        {
                            "label": "PDF",
                            "icon": "fa-file-pdf",
                            "class": "btn btn-secondary btn-xs",
                            "action": "invoices:pdf",
                            "ariaLabel": "Download invoice PDF"
                        },
                        {
                            "label": "Cancel",
                            "icon": "fa-ban",
                            "class": "btn btn-error btn-xs btn-outline",
                            "action": "records:cancel",
                            "condition": "status != \"paid\" && status != \"cancelled\"",
                            "confirm": "Are you sure you want to cancel this invoice?",
                            "ariaLabel": "Cancel invoice"
                        }
                    ]
                }
            }
        ],
        "footer": [
            {
                "type": "button",
                "label": "Close",
                "class": "btn btn-ghost",
                "action": "close",
                "ariaLabel": "Close invoices module"
            }
        ],
        "dataSources": {
            "invoices": {
                "table": "invoices",
                "syncPolicy": "default",
                "autoRefresh": true,
                "refreshInterval": 30000
            }
        }
    }