{
    "title":"Time Entries & Expenses",
    "header":[
      {"type":"filter-select",
        "options":{
          "source_table":"users",
          "source_column":"user_id",
          "display_column":"full_name",
          "default_label":"All",
          "data_column":"user_id",
          "search_fields":["full_name", "email"],
          "placeholder":"Search users..."
        }
      },
      {"type":"filter-select",
        "options":{
          "data_column":"approved",
          "options":[
            {"label":"All","value":""},
            {"label":"Approved","value":true},
            {"label":"Pending","value":false}
          ],
          "value": false
        }
      },
      {"type":"filter-date-range",
        "options":{"data_column":"date"}
      }
    ],
    "body":[
      {"type":"tabs",
        "tabs":[
          {"label":"Time Entries","elements":[
            {"type":"table","options":{
              "tableName":"time_entries",
              "inlineEdit":true,
              "showGlobalSearch":false,
              "addButton":false,
              "editFormId":38,
              "filterField":["user_id","approved","date"],
              "filters":{"approved":false},
              "columnsToShow":["date", "counsel", "client_name","case_name", "hours", "total", "description", "billable","approved","approval_comment"],
              "columnButtons":{
                "billable":{
                  "showValue":false,
                  "buttonMap":{
                    "true":{
                      "text":"✓ Billable",
                      "className":"badge badge-success badge-sm cursor-pointer",
                      "title":"Click to mark as non-billable",
                      "onClick":"genericToggle",
                      "dataset":{
                        "tableName":"time_entries",
                        "primaryKey":"time_entry_id",
                        "field":"billable",
                        "confirmTrue":"Mark as billable?",
                        "confirmFalse":"Mark as non-billable?",
                        "entityName":"entry"
                      }
                    },
                    "false":{
                      "text":"✗ Non-Billable",
                      "className":"badge badge-ghost badge-sm cursor-pointer",
                      "title":"Click to mark as billable",
                      "onClick":"genericToggle",
                      "dataset":{
                        "tableName":"time_entries",
                        "primaryKey":"time_entry_id",
                        "field":"billable",
                        "confirmTrue":"Mark as billable?",
                        "confirmFalse":"Mark as non-billable?",
                        "entityName":"entry"
                      }
                    }
                  }
                },
                "approved":{
                  "showValue":false,
                  "buttonMap":{
                    "true":{
                      "text":"✓ Approved",
                      "className":"badge badge-success badge-sm cursor-pointer",
                      "title":"Click to disapprove",
                      "onClick":"genericToggle",
                      "dataset":{
                        "tableName":"time_entries",
                        "primaryKey":"time_entry_id",
                        "field":"approved",
                        "confirmTrue":"Approve this entry?",
                        "confirmFalse":"Disapprove this entry?",
                        "entityName":"entry"
                      }
                    },
                    "false":{
                      "text":"⏳ Pending",
                      "className":"badge badge-warning badge-sm cursor-pointer",
                      "title":"Click to approve",
                      "onClick":"genericToggle",
                      "dataset":{
                        "tableName":"time_entries",
                        "primaryKey":"time_entry_id",
                        "field":"approved",
                        "confirmTrue":"Approve this entry?",
                        "confirmFalse":"Disapprove this entry?",
                        "entityName":"entry"
                      }
                    }
                  }
                }
              }
            }}
          ]},
          {"label":"Expenses","elements":[
            {"type":"table","options":{
              "tableName":"expenses",
              "inlineEdit":true,
              "showGlobalSearch":false,
              "addButton":false,
              "editFormId": 48,
              "filterField":["user_id","approved","date"],
              "filters":{"approved":false},
              "columnsToShow":["date", "counsel", "client_name","case_name","amount","description","billable","approved","approval_comment"],
              "columnButtons":{
                "billable":{
                  "showValue":false,
                  "buttonMap":{
                    "true":{
                      "text":"✓ Billable",
                      "className":"badge badge-success badge-sm cursor-pointer",
                      "title":"Click to mark as non-billable",
                      "onClick":"genericToggle",
                      "dataset":{
                        "tableName":"expenses",
                        "primaryKey":"expense_id",
                        "field":"billable",
                        "confirmTrue":"Mark as billable?",
                        "confirmFalse":"Mark as non-billable?",
                        "entityName":"expense"
                      }
                    },
                    "false":{
                      "text":"✗ Non-Billable",
                      "className":"badge badge-ghost badge-sm cursor-pointer",
                      "title":"Click to mark as billable",
                      "onClick":"genericToggle",
                      "dataset":{
                        "tableName":"expenses",
                        "primaryKey":"expense_id",
                        "field":"billable",
                        "confirmTrue":"Mark as billable?",
                        "confirmFalse":"Mark as non-billable?",
                        "entityName":"expense"
                      }
                    }
                  }
                },
                "approved":{
                  "showValue":false,
                  "buttonMap":{
                    "true":{
                      "text":"✓ Approved",
                      "className":"badge badge-success badge-sm cursor-pointer",
                      "title":"Click to disapprove",
                      "onClick":"genericToggle",
                      "dataset":{
                        "tableName":"expenses",
                        "primaryKey":"expense_id",
                        "field":"approved",
                        "confirmTrue":"Approve this expense?",
                        "confirmFalse":"Disapprove this expense?",
                        "entityName":"expense"
                      }
                    },
                    "false":{
                      "text":"⏳ Pending",
                      "className":"badge badge-warning badge-sm cursor-pointer",
                      "title":"Click to approve",
                      "onClick":"genericToggle",
                      "dataset":{
                        "tableName":"expenses",
                        "primaryKey":"expense_id",
                        "field":"approved",
                        "confirmTrue":"Approve this expense?",
                        "confirmFalse":"Disapprove this expense?",
                        "entityName":"expense"
                      }
                    }
                  }
                }
              }
            }}
          ]},
          {"label":"One Time Costs","elements":[
            {"type":"table","options":{
              "tableName":"one_time_service_costs",
              "inlineEdit":true,
              "editFormId": 58,
              "filterField":["user_id","approved","date"],
              "filters":{"approved":false},
              "columnsToShow":["date", "counsel", "client_name", "case_name","amount","description","billable","approved","comments"],
              "columnButtons":{
                "billable":{
                  "showValue":false,
                  "buttonMap":{
                    "true":{
                      "text":"✓ Billable",
                      "className":"badge badge-success badge-sm cursor-pointer",
                      "title":"Click to mark as non-billable",
                      "onClick":"genericToggle",
                      "dataset":{
                        "tableName":"one_time_service_costs",
                        "primaryKey":"one_time_service_cost_id",
                        "field":"billable",
                        "confirmTrue":"Mark as billable?",
                        "confirmFalse":"Mark as non-billable?",
                        "entityName":"cost"
                      }
                    },
                    "false":{
                      "text":"✗ Non-Billable",
                      "className":"badge badge-ghost badge-sm cursor-pointer",
                      "title":"Click to mark as billable",
                      "onClick":"genericToggle",
                      "dataset":{
                        "tableName":"one_time_service_costs",
                        "primaryKey":"one_time_service_cost_id",
                        "field":"billable",
                        "confirmTrue":"Mark as billable?",
                        "confirmFalse":"Mark as non-billable?",
                        "entityName":"cost"
                      }
                    }
                  }
                },
                "approved":{
                  "showValue":false,
                  "buttonMap":{
                    "true":{
                      "text":"✓ Approved",
                      "className":"badge badge-success badge-sm cursor-pointer",
                      "title":"Click to disapprove",
                      "onClick":"genericToggle",
                      "dataset":{
                        "tableName":"one_time_service_costs",
                        "primaryKey":"one_time_service_cost_id",
                        "field":"approved",
                        "confirmTrue":"Approve this cost?",
                        "confirmFalse":"Disapprove this cost?",
                        "entityName":"cost"
                      }
                    },
                    "false":{
                      "text":"⏳ Pending",
                      "className":"badge badge-warning badge-sm cursor-pointer",
                      "title":"Click to approve",
                      "onClick":"genericToggle",
                      "dataset":{
                        "tableName":"one_time_service_costs",
                        "primaryKey":"one_time_service_cost_id",
                        "field":"approved",
                        "confirmTrue":"Approve this cost?",
                        "confirmFalse":"Disapprove this cost?",
                        "entityName":"cost"
                      }
                    }
                  }
                }
              }
            }}
          ]}
        ]
      }
    ],
    "footer":[{"type":"button","label":"Close","onClick":"closeModal"}]
  }