[
  {
    "name": "Geofence List",
    "entity_name": "geo_fencing",
    "entity_type": "grid_builder_module",
    "static_page_content": null,
    "primary_table": "geofences",
    "associated_tables": [
      {
        "table": "customer_geofence_mapping",
        "where_clause": "geofence_id = $1"
      }
    ],
    "query_information": {
      "group_by": [
        "geofences.id",
        "geofences.uuid",
        "geofences.zone_name",
        "geofences.zone_type",
        "geofences.category",
        "geofences.radius",
        "geofences.updated_at"
      ],
      "search_all": [
        {
          "value": 3,
          "operator": "!=",
          "column_name": "geofences.status_id"
        }
      ],
      "sort_columns": [
        [
          "geofences.id",
          "desc"
        ]
      ],
      "includes": [
        {
          "table_name": "customer_geofence_mapping",
          "join_type": "LEFT",
          "join_condition": "geofences.id = customer_geofence_mapping.geofence_id"
        }
      ],
      "print_query": false
    },
    "company_id": 1,
    "lineitems": [
      {
        "master_grid_id": 0,
        "field_name": "geofences.id",
        "display_name": "id",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "geofences.uuid",
        "display_name": "uuid",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "geofences.zone_name",
        "display_name": "name",
        "order_no": 1,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "geofences.zone_type",
        "display_name": "zone_type",
        "order_no": 3,
        "is_grid_column": true,
        "is_searchable": false,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "geofences.radius",
        "display_name": "radius",
        "order_no": 4,
        "is_grid_column": true,
        "is_searchable": false,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "geofences.category",
        "display_name": "category",
        "order_no": 5,
        "is_grid_column": true,
        "is_searchable": false,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "geofences.updated_at",
        "display_name": "last_updated_at",
        "order_no": 5,
        "is_grid_column": true,
        "is_searchable": false,
        "is_sortable": true,
        "field_type_id": 7,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "count(customer_geofence_mapping.id)",
        "display_name": "customer_mapped_count",
        "order_no": 5,
        "is_grid_column": true,
        "is_searchable": false,
        "is_sortable": true,
        "field_type_id": 7,
        "company_id": 1
      }
    ]
  },
  {
    "name": "Overall Delivery Notes By Customer",
    "entity_name": "delivery_notes",
    "entity_type": "grid_builder_module",
    "static_page_content": null,
    "primary_table": "delivery_notes",
    "associated_tables": [],
    "query_information": {
      "group_by": [
        "users.id",
        "users.uuid",
        "user_details.first_name",
        "user_details.code",
        "roles.name"
      ],
      "includes": [
        {
          "join_type": "LEFT",
          "table_name": "users",
          "join_condition": "delivery_notes.customer_id = users.id"
        },
        {
          "join_type": "INNER",
          "table_name": "user_details",
          "join_condition": "user_details.user_id = users.id"
        },
        {
          "join_type": "LEFT",
          "table_name": "user_roles",
          "join_condition": "users.id = user_roles.user_id"
        },
        {
          "join_type": "LEFT",
          "table_name": "roles",
          "join_condition": "roles.id = user_roles.role_id"
        },
        {
          "join_type": "LEFT",
          "table_name": "customers_delivery_addresses",
          "join_condition": "customers_delivery_addresses.id = delivery_notes.customer_delivery_address_id"
        },
        {
          "join_type": "LEFT",
          "table_name": "delivery_note_line_items",
          "join_condition": "delivery_notes.id = delivery_note_line_items.delivery_note_id"
        }
      ],
      "search_all": [
        {
          "value": 3,
          "operator": "!=",
          "column_name": "users.status_id"
        },
        {
          "value": "Customer",
          "operator": "=",
          "column_name": "roles.name"
        }
      ],
      "print_query": false,
      "sort_columns": [
        [
          "users.id",
          "desc"
        ]
      ]
    },
    "company_id": 1,
    "lineitems": [
      {
        "master_grid_id": 0,
        "field_name": "users.id",
        "display_name": "id",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "users.uuid",
        "display_name": "uuid",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "users.uuid",
        "display_name": "gparam_1",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "user_details.first_name",
        "display_name": "customer",
        "order_no": 2,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "count(DISTINCT delivery_notes.id)",
        "display_name": "no_of_dns",
        "order_no": 3,
        "clause_type": "having",
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "count(DISTINCT customers_delivery_addresses.id)",
        "display_name": "no_of_dls",
        "order_no": 4,
        "clause_type": "having",
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "user_details.code",
        "display_name": "customer_code",
        "order_no": 1,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      }
    ]
  },
  {
    "name": "Delivery Location Details",
    "entity_name": "delivery_location_details",
    "entity_type": "grid_builder_module",
    "static_page_content": null,
    "primary_table": "customers_delivery_addresses",
    "associated_tables": [],
    "query_information": {
      "group_by": [
        "customers_delivery_addresses.id",
        "customers_delivery_addresses.uuid",
        "customers_delivery_addresses.delivery_location",
        "customers_delivery_addresses.customer_contact_no"
      ],
      "includes": [
        {
          "join_type": "INNER",
          "table_name": "delivery_notes",
          "join_condition": "customers_delivery_addresses.id = delivery_notes.customer_delivery_address_id"
        },
        {
          "join_type": "INNER",
          "table_name": "users",
          "join_condition": "users.id = delivery_notes.customer_id"
        }
      ],
      "search_all": [
        {
          "value": 3,
          "operator": "!=",
          "column_name": "customers_delivery_addresses.status_id"
        },
        {
          "value": "$gparam_1",
          "operator": "=",
          "column_name": "users.uuid"
        }
      ],
      "print_query": false,
      "sort_columns": [
        [
          "customers_delivery_addresses.id",
          "desc"
        ]
      ]
    },
    "company_id": 1,
    "lineitems": [
      {
        "master_grid_id": 0,
        "field_name": "customers_delivery_addresses.id",
        "display_name": "id",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "customers_delivery_addresses.uuid",
        "display_name": "uuid",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "customers_delivery_addresses.uuid",
        "display_name": "gparam_1",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "customers_delivery_addresses.delivery_location",
        "display_name": "Delivery Location",
        "order_no": 1,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "count(delivery_notes.id)",
        "display_name": "no_of_dns",
        "order_no": 3,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "customers_delivery_addresses.customer_contact_no",
        "display_name": "customer_contact_number",
        "order_no": 4,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      }
    ]
  },
  {
    "name": "Deliver Notes List",
    "entity_name": "delivery_note_list",
    "entity_type": "grid_builder_module",
    "static_page_content": null,
    "primary_table": "delivery_notes",
    "associated_tables": [],
    "query_information": {
      "group_by": [
        "delivery_notes.id",
        "delivery_notes.uuid",
        "delivery_notes.delivery_note_number",
        "customers_delivery_addresses.id",
        "delivery_notes.customer_delivery_contact_name",
        "delivery_notes.customer_delivery_contact_number",
        "delivery_notes.customer_delivery_contact_email"
      ],
      "includes": [
        {
          "join_type": "INNER",
          "table_name": "customers_delivery_addresses",
          "join_condition": "customers_delivery_addresses.id = delivery_notes.customer_delivery_address_id"
        },
        {
          "join_type": "INNER",
          "table_name": "users",
          "join_condition": "users.id = delivery_notes.customer_id"
        },
        {
          "join_type": "LEFT",
          "table_name": "delivery_note_line_items",
          "join_condition": "delivery_notes.id = delivery_note_line_items.delivery_note_id"
        }
      ],
      "search_all": [
        {
          "value": 3,
          "operator": "!=",
          "column_name": "delivery_notes.status_id"
        },
        {
          "value": "$gparam_1",
          "operator": "=",
          "column_name": "customers_delivery_addresses.uuid"
        }
      ],
      "print_query": false,
      "sort_columns": [
        [
          "customers_delivery_addresses.id",
          "desc"
        ]
      ]
    },
    "company_id": 1,
    "lineitems": [
      {
        "master_grid_id": 0,
        "field_name": "delivery_notes.id",
        "display_name": "id",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "delivery_notes.uuid",
        "display_name": "uuid",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "delivery_notes.id",
        "display_name": "gparam_1",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "delivery_notes.delivery_note_number",
        "display_name": "delivery_note_number",
        "order_no": 1,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "delivery_notes.reference_number",
        "display_name": "reference_number",
        "order_no": 3,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "delivery_notes.date_of_issue",
        "display_name": "date_of_issue",
        "order_no": 4,
        "is_grid_column": true,
        "is_searchable": false,
        "is_sortable": true,
        "field_type_id": 7,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "delivery_notes.customer_delivery_contact_name",
        "display_name": "delivery_contact_name",
        "order_no": 5,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "delivery_notes.customer_delivery_contact_email",
        "display_name": "delivery_contact_email",
        "order_no": 6,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "delivery_notes.customer_delivery_contact_number",
        "display_name": "delivery_contact_number",
        "order_no": 7,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "count(delivery_note_line_items.id)",
        "display_name": "no_of_items",
        "order_no": 2,
        "is_grid_column": true,
        "is_searchable": false,
        "is_sortable": true,
        "field_type_id": 1,
        "company_id": 1
      }
    ]
  },
  {
    "name": "Customers List",
    "entity_name": "customers",
    "entity_type": "grid_builder_module",
    "static_page_content": null,
    "primary_table": "users",
    "associated_tables": [],
    "query_information": {
      "primary_table": "users",
      "group_by": [
        "users.id",
        "users.uuid",
        "users.username",
        "users.email",
        "user_details.phone_number",
        "user_details.code",
        "roles.name"
      ],
      "search_all": [
        {
          "value": 3,
          "operator": "!=",
          "column_name": "users.status_id"
        },
        {
          "value": "Customer",
          "operator": "=",
          "column_name": "roles.name"
        }
      ],
      "sort_columns": [
        [
          "users.id",
          "desc"
        ]
      ],
      "includes": [
        {
          "join_type": "INNER",
          "table_name": "user_details",
          "join_condition": "user_details.user_id = users.id"
        },
        {
          "table_name": "user_roles",
          "join_type": "LEFT",
          "join_condition": "users.id = user_roles.user_id"
        },
        {
          "table_name": "roles",
          "join_type": "LEFT",
          "join_condition": "roles.id = user_roles.role_id"
        },
        {
          "table_name": "customer_geofence_mapping",
          "join_type": "LEFT",
          "join_condition": "customer_geofence_mapping.customer_id = users.id"
        }
      ],
      "print_query": false
    },
    "company_id": 1,
    "lineitems": [
      {
        "master_grid_id": 0,
        "field_name": "users.id",
        "display_name": "id",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "users.uuid",
        "display_name": "uuid",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "users.username",
        "display_name": "customer_name",
        "order_no": 2,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "user_details.phone_number",
        "display_name": "customer_phone_number",
        "order_no": 3,
        "clause_type": "having",
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "users.email",
        "display_name": "customer_email",
        "order_no": 4,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "COUNT(customer_geofence_mapping.customer_id)",
        "display_name": "customer_geofence_mappping_count",
        "order_no": 5,
        "clause_type": "having",
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "user_details.code",
        "display_name": "customer_code",
        "order_no": 1,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      }
    ]
  },
  {
    "name": "Erp Logs",
    "entity_name": "erp_logs",
    "entity_type": "grid_builder_module",
    "static_page_content": null,
    "primary_table": "erp_logs",
    "associated_tables": [],
    "query_information": {
      "group_by": [
        "erp_logs.id"
      ],
      "includes": [
        {
          "join_type": "LEFT",
          "table_name": "erp_logs_line_items",
          "join_condition": "erp_logs_line_items.erp_logs_id = erp_logs.id AND erp_logs_line_items.deleted_at IS NULL"
        }
      ],
      "company_id": 1,
      "search_all": [
        {
          "value": 1,
          "operator": "=",
          "column_name": "erp_logs.company_id"
        },
        {
          "value": 3,
          "operator": "!=",
          "column_name": "erp_logs.status_id"
        }
      ],
      "print_query": false,
      "sort_columns": [
        [
          "erp_logs.id",
          "desc"
        ]
      ]
    },
    "company_id": 1,
    "lineitems": [
      {
        "master_grid_id": 0,
        "field_name": "erp_logs.uuid",
        "display_name": "uuid",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "erp_logs.id",
        "display_name": "gparam_1",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "erp_logs.sync_status",
        "display_name": "sync_status",
        "order_no": 2,
        "is_grid_column": true,
        "is_searchable": false,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "erp_logs.created_at",
        "display_name": "sync_date",
        "order_no": 4,
        "is_grid_column": true,
        "is_searchable": false,
        "is_sortable": true,
        "field_type_id": 7,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "jsonb_pretty(erp_logs.response_object::jsonb)",
        "display_name": "response",
        "order_no": 5,
        "is_grid_column": true,
        "is_searchable": false,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "jsonb_pretty(erp_logs.req_body::jsonb)",
        "display_name": "request",
        "order_no": 6,
        "is_grid_column": true,
        "is_searchable": false,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "CASE     WHEN (ERP_LOGS.RESPONSE_OBJECT::JSONB ->> 'code')::INT = 200     THEN JSONB_ARRAY_LENGTH(ERP_LOGS.RESPONSE_OBJECT::JSONB -> 'data')     ELSE 0 END",
        "display_name": "no_of_dns",
        "order_no": 7,
        "clause_type": "having",
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "erp_logs.sync_number",
        "display_name": "sync_number",
        "order_no": 1,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "COUNT(*) FILTER ( WHERE ERP_LOGS_LINE_ITEMS.LINE_ITEM_SYNC_STATUS = 'inserted' )",
        "display_name": "inserted",
        "order_no": 8,
        "is_grid_column": true,
        "is_searchable": false,
        "is_sortable": true,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "COUNT(*) FILTER ( WHERE ERP_LOGS_LINE_ITEMS.LINE_ITEM_SYNC_STATUS = 'already_present' )",
        "display_name": "already_present",
        "order_no": 9,
        "is_grid_column": true,
        "is_searchable": false,
        "is_sortable": true,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "COUNT(*) FILTER ( WHERE ERP_LOGS_LINE_ITEMS.LINE_ITEM_SYNC_STATUS = 'failed' )",
        "display_name": "failed",
        "order_no": 10,
        "is_grid_column": true,
        "is_searchable": false,
        "is_sortable": true,
        "field_type_id": 1,
        "company_id": 1
      }
    ]
  },
  {
    "name": "Erp Logs Line Items",
    "entity_name": "erp_logs_line_items",
    "entity_type": "grid_builder_module",
    "static_page_content": null,
    "primary_table": "erp_logs_line_items",
    "associated_tables": [],
    "query_information": {
      "includes": [
        {
          "join_type": "LEFT",
          "table_name": "erp_logs",
          "join_condition": "erp_logs_line_items.erp_logs_id = erp_logs.id"
        }
      ],
      "search_all": [
        {
          "value": "$gparam_1",
          "operator": "=",
          "column_name": "erp_logs_line_items.erp_logs_id"
        }
      ],
      "print_query": false,
      "sort_columns": [
        [
          "erp_logs_line_items.id",
          "desc"
        ]
      ]
    },
    "company_id": 1,
    "lineitems": [
      {
        "master_grid_id": 0,
        "field_name": "erp_logs_line_items.id",
        "display_name": "id",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "erp_logs_line_items.uuid",
        "display_name": "uuid",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "erp_logs_line_items.delivery_note_number",
        "display_name": "delivery_note_number",
        "order_no": 1,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "erp_logs_line_items.date_of_issue",
        "display_name": "date_of_issue",
        "order_no": 2,
        "is_grid_column": true,
        "is_searchable": false,
        "is_sortable": true,
        "field_type_id": 7,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "erp_logs_line_items.customer_order_number",
        "display_name": "customer_order_number",
        "order_no": 3,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "erp_logs_line_items.reference_number",
        "display_name": "reference_number",
        "order_no": 4,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "erp_logs_line_items.supply_agreement",
        "display_name": "supply_agreement",
        "order_no": 5,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "erp_logs_line_items.purchase_reference",
        "display_name": "purchase_reference",
        "order_no": 6,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "erp_logs_line_items.alloy",
        "display_name": "alloy",
        "order_no": 8,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "erp_logs_line_items.temper",
        "display_name": "temper",
        "order_no": 9,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "erp_logs_line_items.color",
        "display_name": "color",
        "order_no": 10,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "erp_logs_line_items.aluminium_profiles",
        "display_name": "aluminium_profiles",
        "order_no": 11,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "erp_logs_line_items.number_of_boxes",
        "display_name": "number_of_boxes",
        "order_no": 12,
        "is_grid_column": true,
        "is_searchable": false,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "erp_logs_line_items.number_of_bundles",
        "display_name": "number_of_bundles",
        "order_no": 13,
        "is_grid_column": true,
        "is_searchable": false,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "jsonb_pretty(erp_logs_line_items.line_item::jsonb)",
        "display_name": "line_items",
        "order_no": 14,
        "is_grid_column": true,
        "is_searchable": false,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "erp_logs_line_items.shipment_type",
        "display_name": "shipment_types",
        "order_no": 15,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "erp_logs_line_items.line_item_sync_status",
        "display_name": "sync_status",
        "order_no": 1,
        "is_grid_column": true,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 3,
        "company_id": 1
      }
    ]
  },
  {
    "name": "Erp Logs Details Page",
    "entity_name": "page_erp_logs_details",
    "entity_type": "static_page_builder_module",
    "static_page_content": "<div class=\"grid grid-cols-1 gap-6 p-4\"><div class=\"grid grid-cols-1 sm:grid-cols-3 gap-6\"><div class=\"flex flex-col\"><label class=\"font-medium text-gray-700 dark:text-gray-300 mb-1\">Req Number:</label><div class=\"bg-gray-100 dark:bg-gray-800 p-2 rounded-md text-gray-900 dark:text-white-light\">{{result_data.req_number}}</div></div><div class=\"flex flex-col\"><label class=\"font-medium text-gray-700 dark:text-gray-300 mb-1\">Sync Status:</label><div class=\"bg-gray-100 dark:bg-gray-800 p-2 rounded-md text-gray-900 dark:text-white-light\">{{result_data.sync_status}}</div></div><div class=\"flex flex-col\"><label class=\"font-medium text-gray-700 dark:text-gray-300 mb-1\">Sync Number:</label><div class=\"bg-gray-100 dark:bg-gray-800 p-2 rounded-md text-gray-900 dark:text-white-light\">{{result_data.sync_number}}</div></div><div class=\"flex flex-col\"><label class=\"font-medium text-gray-700 dark:text-gray-300 mb-1\">Sync Date:</label><div class=\"bg-gray-100 dark:bg-gray-800 p-2 rounded-md text-gray-900 dark:text-white-light\">{{result_data.sync_date}}</div></div></div>{{#each result_data.erp_logs_line_items}}<hr class=\"border-t-2 border-gray-300 dark:border-gray-700 my-6 col-span-full\" /><div class=\"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-6 my-4\"><div class=\"flex flex-col\"><label class=\"font-medium text-gray-700 dark:text-gray-300 mb-1\">Delivery Note Number:</label><div class=\"bg-gray-100 dark:bg-gray-800 p-2 rounded-md text-gray-900 dark:text-white-light\">{{line_item.delivery_note_number}}</div></div><div class=\"flex flex-col\"><label class=\"font-medium text-gray-700 dark:text-gray-300 mb-1\">Order Number:</label><div class=\"bg-gray-100 dark:bg-gray-800 p-2 rounded-md text-gray-900 dark:text-white-light\">{{line_item.order_number}}</div></div><div class=\"flex flex-col\"><label class=\"font-medium text-gray-700 dark:text-gray-300 mb-1\">Reference Number:</label><div class=\"bg-gray-100 dark:bg-gray-800 p-2 rounded-md text-gray-900 dark:text-white-light\">{{line_item.reference_number}}</div></div><div class=\"flex flex-col\"><label class=\"font-medium text-gray-700 dark:text-gray-300 mb-1\">No Of Boxes:</label><div class=\"bg-gray-100 dark:bg-gray-800 p-2 rounded-md text-gray-900 dark:text-white-light\">{{line_item.number_of_boxes}}</div></div><div class=\"flex flex-col\"><label class=\"font-medium text-gray-700 dark:text-gray-300 mb-1\">No Of Bundles:</label><div class=\"bg-gray-100 dark:bg-gray-800 p-2 rounded-md text-gray-900 dark:text-white-light\">{{line_item.number_of_bundles}}</div></div></div><div class=\"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-6\"><div class=\"flex flex-col\"><label class=\"font-medium text-gray-700 dark:text-gray-300 mb-1\">Customer Company Name:</label><div class=\"bg-gray-100 dark:bg-gray-800 p-2 rounded-md text-gray-900 dark:text-white-light\">{{line_item.customer_company_name}}</div></div><div class=\"flex flex-col\"><label class=\"font-medium text-gray-700 dark:text-gray-300 mb-1\">Customer Code:</label><div class=\"bg-gray-100 dark:bg-gray-800 p-2 rounded-md text-gray-900 dark:text-white-light\">{{line_item.customer_code}}</div></div><div class=\"flex flex-col\"><label class=\"font-medium text-gray-700 dark:text-gray-300 mb-1\">Customer Email:</label><div class=\"bg-gray-100 dark:bg-gray-800 p-2 rounded-md text-gray-900 dark:text-white-light\">{{line_item.customer_email}}</div></div><div class=\"flex flex-col\"><label class=\"font-medium text-gray-700 dark:text-gray-300 mb-1\">Customer Delivery Address:</label><div class=\"bg-gray-100 dark:bg-gray-800 p-2 rounded-md text-gray-900 dark:text-white-light\">{{line_item.customer_delivery_address}}</div></div><div class=\"flex flex-col\"><label class=\"font-medium text-gray-700 dark:text-gray-300 mb-1\">Customer Delivery Address Code:</label><div class=\"bg-gray-100 dark:bg-gray-800 p-2 rounded-md text-gray-900 dark:text-white-light\">{{line_item.customer_delivery_address_code}}</div></div><div class=\"flex flex-col\"><label class=\"font-medium text-gray-700 dark:text-gray-300 mb-1\">Customer Delivery Contact Info:</label><div class=\"bg-gray-100 dark:bg-gray-800 p-2 rounded-md text-gray-900 dark:text-white-light\">{{line_item.customer_delivery_contact_info}}</div></div><div class=\"flex flex-col\"><label class=\"font-medium text-gray-700 dark:text-gray-300 mb-1\">Customer Delivery Contact Name:</label><div class=\"bg-gray-100 dark:bg-gray-800 p-2 rounded-md text-gray-900 dark:text-white-light\">{{line_item.customer_delivery_contact_name}}</div></div><div class=\"flex flex-col\"><label class=\"font-medium text-gray-700 dark:text-gray-300 mb-1\">Customer Delivery Contact Number:</label><div class=\"bg-gray-100 dark:bg-gray-800 p-2 rounded-md text-gray-900 dark:text-white-light\">{{line_item.customer_delivery_contact_number}}</div></div><div class=\"flex flex-col\"><label class=\"font-medium text-gray-700 dark:text-gray-300 mb-1\">Customer Delivery Contact Email:</label><div class=\"bg-gray-100 dark:bg-gray-800 p-2 rounded-md text-gray-900 dark:text-white-light\">{{line_item.customer_delivery_contact_email}}</div></div><div class=\"flex flex-col\"><label class=\"font-medium text-gray-700 dark:text-gray-300 mb-1\">Date Of Issue:</label><div class=\"bg-gray-100 dark:bg-gray-800 p-2 rounded-md text-gray-900 dark:text-white-light\">{{line_item.date_of_issue}}</div></div><div class=\"flex flex-col\"><label class=\"font-medium text-gray-700 dark:text-gray-300 mb-1\">Shipment Type:</label><div class=\"bg-gray-100 dark:bg-gray-800 p-2 rounded-md text-gray-900 dark:text-white-light\">{{line_item.shipment_type}}</div></div><div class=\"flex flex-col\"><label class=\"font-medium text-gray-700 dark:text-gray-300 mb-1\">Supply Agreement:</label><div class=\"bg-gray-100 dark:bg-gray-800 p-2 rounded-md text-gray-900 dark:text-white-light\">{{line_item.supply_agreement}}</div></div><div class=\"flex flex-col\"><label class=\"font-medium text-gray-700 dark:text-gray-300 mb-1\">Aluminium Profiles:</label><div class=\"bg-gray-100 dark:bg-gray-800 p-2 rounded-md text-gray-900 dark:text-white-light\">{{line_item.aluminium_profiles}}</div></div><div class=\"flex flex-col\"><label class=\"font-medium text-gray-700 dark:text-gray-300 mb-1\">Alloy:</label><div class=\"bg-gray-100 dark:bg-gray-800 p-2 rounded-md text-gray-900 dark:text-white-light\">{{line_item.alloy}}</div></div><div class=\"flex flex-col\"><label class=\"font-medium text-gray-700 dark:text-gray-300 mb-1\">Temper:</label><div class=\"bg-gray-100 dark:bg-gray-800 p-2 rounded-md text-gray-900 dark:text-white-light\">{{line_item.temper}}</div></div><div class=\"flex flex-col\"><label class=\"font-medium text-gray-700 dark:text-gray-300 mb-1\">Color:</label><div class=\"bg-gray-100 dark:bg-gray-800 p-2 rounded-md text-gray-900 dark:text-white-light\">{{line_item.color}}</div></div></div><div class=\"mb-6\"><label class=\"font-medium text-gray-700 dark:text-gray-300 mb-2 block\">Line Items:</label><div class=\"overflow-x-auto\"><table class=\"min-w-full border border-gray-300 dark:border-gray-700 text-sm\"><thead class=\"bg-gray-200 dark:bg-gray-700\"><tr><th class=\"px-4 py-2 border\">S.No</th><th class=\"px-4 py-2 border\">Item Code</th><th class=\"px-4 py-2 border\">Description</th><th class=\"px-4 py-2 border\">Quantity</th><th class=\"px-4 py-2 border\">Weight</th><th class=\"px-4 py-2 border\">Slip No</th><th class=\"px-4 py-2 border\">Section No</th><th class=\"px-4 py-2 border\">Length</th></tr></thead><tbody>{{#each line_item.delivery_note_items}}<tr class=\"odd:bg-gray-50 dark:odd:bg-gray-800\"><td class=\"px-4 py-2 border\">{{hbp_inc @index}}</td><td class=\"px-4 py-2 border\">{{item_code}}</td><td class=\"px-4 py-2 border\">{{item_description}}</td><td class=\"px-4 py-2 border\">{{quantity}}</td><td class=\"px-4 py-2 border\">{{weight}}</td><td class=\"px-4 py-2 border\">{{slip_number}}</td><td class=\"px-4 py-2 border\">{{section_number}}</td><td class=\"px-4 py-2 border\">{{length_in_meters}}</td></tr>{{/each}}</tbody></table></div></div>{{/each}}</div><div class=\"grid grid-cols-2 gap-2 p-2\"><div class=\"flex flex-col\"><label class=\"font-medium text-gray-700 dark:text-gray-300 mb-1\">Request:</label><div class=\"bg-gray-100 dark:bg-gray-800 p-2 rounded-md text-gray-900 dark:text-white-light\">{{result_data.request}}</div></div><div class=\"flex flex-col\"><label class=\"font-medium text-gray-700 dark:text-gray-300 mb-1\">Response:</label><div class=\"bg-gray-100 dark:bg-gray-800 p-2 rounded-md text-gray-900 dark:text-white-light\">{{result_data.response}}</div></div></div>",
    "query_information": {
      "includes": [
        {
          "join_type": "INNER",
          "table_name": "statuses",
          "join_condition": "erp_logs.status_id = statuses.id"
        },
        {
          "join_type": "LEFT",
          "table_name": "erp_logs_line_items",
          "join_condition": "erp_logs_line_items.erp_logs_id = erp_logs.id"
        }
      ],
      "company_id": 1,
      "search_all": [
        {
          "value": "$unique_id",
          "operator": "=",
          "column_name": "erp_logs.uuid"
        },
        {
          "value": "3",
          "operator": "!=",
          "column_name": "erp_logs.status_id"
        }
      ],
      "limit_range": 1,
      "print_query": false,
      "start_index": 0,
      "sort_columns": [
        [
          "erp_logs.id",
          "desc"
        ]
      ],
      "primary_table": "erp_logs",
      "select_columns": [
        [
          "'REQ' || LPAD(erp_logs.id::text, 7, '0')",
          "req_number"
        ],
        [
          "erp_logs.sync_number",
          "sync_number"
        ],
        [
          "erp_logs.sync_status",
          "sync_status"
        ],
        [
          "erp_logs.created_at",
          "sync_date"
        ],
        [
          "jsonb_pretty(erp_logs.req_body::jsonb)",
          "request"
        ],
        [
          "jsonb_pretty(erp_logs.response_object::jsonb)",
          "response"
        ],
        [
          "COALESCE((SELECT JSON_AGG(JSON_BUILD_OBJECT('delivery_note_number', elli.delivery_note_number, 'customer_order_number', elli.customer_order_number, 'reference_number', elli.reference_number, 'supply_agreement' , elli.supply_agreement,'purchase_reference', elli.purchase_reference, 'alloy', elli.alloy, 'temper', elli.temper, 'color', elli.color, 'aluminium_profiles', elli.aluminium_profiles, 'number_of_boxes', elli.number_of_boxes, 'number_of_bundles', elli.number_of_bundles, 'shipment_type', elli.shipment_type , 'line_item', elli.line_item)) FROM erp_logs_line_items AS elli WHERE elli.erp_logs_id = erp_logs.id), '[]')",
          "erp_logs_line_items"
        ]
      ]
    }
  },
  {
    "name": "Shipment List",
    "entity_name": "shipment_management",
    "entity_type": "grid_builder_module",
    "static_page_content": null,
    "primary_table": "shipments",
    "associated_tables": [],
    "query_information": {
      "group_by": [
        "shipments.id",
        "shipments.uuid",
        "user_details.full_name",
        "driver_details.full_name",
        "vehicles.vehicle_plate_number",
        "shipment_status.name"
      ],
      "includes": [
        {
          "join_type": "INNER",
          "table_name": "USER_INFORMATION AS user_details",
          "join_condition": "user_details.user_id = shipments.created_by"
        },
        {
          "join_type": "INNER",
          "table_name": "USER_INFORMATION AS driver_details",
          "join_condition": "driver_details.user_id = shipments.driver_id"
        },
        {
          "join_type": "INNER",
          "table_name": "vehicles",
          "join_condition": "vehicles.id = shipments.vehicle_id"
        },
        {
          "join_type": "INNER",
          "table_name": "shipment_status",
          "join_condition": "shipment_status.id = shipments.shipment_status_id"
        },
        {
          "join_type": "INNER",
          "table_name": "shipment_customers",
          "join_condition": "shipment_customers.shipment_id = shipments.id"
        },
        {
          "join_type": "INNER",
          "table_name": "shipment_location",
          "join_condition": "shipment_location.shipment_customer_uid = shipment_customers.shipment_customer_uid"
        },
        {
          "join_type": "INNER",
          "table_name": "shipment_delivery_notes",
          "join_condition": "shipment_delivery_notes.shipment_location_uid = shipment_location.shipment_location_uid"
        },
        {
          "join_type": "LEFT",
          "table_name": "vehicle_geofence_history",
          "join_condition": "vehicle_geofence_history.shipment_id = shipments.id"
        },
        {
          "join_type": "LEFT",
          "table_name": "geofences",
          "join_condition": "geofences.id = vehicle_geofence_history.geofence_id"
        },
        {
          "join_type": "LEFT",
          "table_name": "shipment_timeline_view",
          "join_condition": "shipment_timeline_view.shipment_id = shipments.id"
        }
      ],
      "company_id": 1,
      "search_all": [
        {
          "value": 1,
          "operator": "=",
          "column_name": "shipments.company_id"
        },
        {
          "value": 3,
          "operator": "!=",
          "column_name": "shipments.status_id"
        }
      ],
      "limit_range": 15,
      "print_query": false,
      "start_index": 0,
      "sort_columns": [
        [
          "shipments.id",
          "desc"
        ]
      ],
      "primary_table": "shipments"
    },
    "company_id": 1,
    "lineitems": [
      {
        "master_grid_id": 0,
        "field_name": "shipments.uuid",
        "display_name": "uuid",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "shipments.shipment_number",
        "display_name": "shipment_number",
        "order_no": 1,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1,
        "link_action": "shipment_history_status",
        "link_mode": "none",
        "link_type": "popup_grid",
        "enum_values": {
          "type": "autocomplete",
          "optionKey": "shipment_number",
          "optionValue": "shipment_number",
          "value": {
            "company_id": 1,
            "limit_range": 20,
            "primary_table": "shipments",
            "sort_columns": [
              [
                "shipments.shipment_number",
                "asc"
              ]
            ],
            "search_all": [
              {
                "column_name": "shipments.shipment_number",
                "value": "%searchTerm%",
                "operator": "ILIKE"
              }
            ],
            "select_columns": [
              [
                "shipments.shipment_number"
              ]
            ]
          }
        }
      },
      {
        "master_grid_id": 0,
        "field_name": "COUNT(DISTINCT shipment_delivery_notes.id)",
        "display_name": "no_of_dns",
        "order_no": 4,
        "is_grid_column": true,
        "is_searchable": false,
        "is_sortable": true,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "COUNT(DISTINCT shipment_location.id)",
        "display_name": "no_of_dls",
        "order_no": 3,
        "is_grid_column": true,
        "is_searchable": false,
        "is_sortable": true,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "vehicles.vehicle_plate_number",
        "display_name": "vehicle_plate_number",
        "order_no": 5,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1,
        "link_action": "grid_shipment_vehicle_tracking",
        "link_mode": "none",
        "link_type": "popup_grid",
        "field_html_content": "<span>{{ row_object.vehicle_plate_number }} (Count: {{row_object.gparam_2}})</span>"
      },
      {
        "master_grid_id": 0,
        "field_name": "driver_details.full_name",
        "display_name": "driver_name",
        "order_no": 6,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "user_details.full_name",
        "display_name": "created_by",
        "order_no": 7,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "shipments.created_at",
        "display_name": "created_at",
        "order_no": 8,
        "is_grid_column": true,
        "is_searchable": false,
        "is_sortable": true,
        "field_type_id": 7,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "shipment_status.name",
        "display_name": "status_name",
        "order_no": 9,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1,
        "enum_values": {
          "type": "array",
          "value": [
            "Scheduled",
            "Loaded",
            "In Transit",
            "Delivered",
            "Dissolved"
          ]
        }
      },
      {
        "master_grid_id": 0,
        "field_name": "shipments.id",
        "display_name": "gparam_1",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "COUNT(DISTINCT shipment_customers.customer_id)",
        "display_name": "no_of_customers",
        "order_no": 2,
        "clause_type": "having",
        "is_grid_column": true,
        "is_searchable": false,
        "is_sortable": true,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "( SELECT COUNT(*)  FROM SHIPMENT_TIMELINE_VIEW st  WHERE st.SHIPMENT_ID = SHIPMENTS.ID  AND st.COMPANY_ID = '1' AND st.STATUS_ID != '3' )",
        "display_name": "gparam_2",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "(CASE WHEN shipments.reason IS NOT NULL AND shipments.reason <> '' THEN 'Yes' ELSE 'No' END)",
        "display_name": "manually_closed",
        "order_no": 10,
        "is_grid_column": true,
        "is_searchable": false,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "(CASE WHEN shipments.mobile_build_version IS NOT NULL AND shipments.mobile_build_version <> '' THEN shipments.mobile_build_version ELSE '1.0.13' END)",
        "display_name": "mobile_version",
        "order_no": 11,
        "is_grid_column": true,
        "is_searchable": false,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      }
    ]
  },
  {
    "name": "Shipment Customer List",
    "entity_name": "shipment_customers",
    "entity_type": "grid_builder_module",
    "static_page_content": null,
    "primary_table": "shipment_customers",
    "associated_tables": [],
    "query_information": {
      "search_all": [
        {
          "value": 1,
          "operator": "=",
          "column_name": "shipment_customers.status_id"
        },
        {
          "value": "$gparam_1",
          "operator": "=",
          "column_name": "shipment_customers.shipment_id"
        }
      ],
      "sort_columns": [
        [
          "shipment_customers.id",
          "desc"
        ]
      ],
      "includes": [
        {
          "join_type": "INNER",
          "table_name": "users",
          "join_condition": "users.id = shipment_customers.customer_id"
        },
        {
          "join_type": "LEFT",
          "table_name": "shipment_location",
          "join_condition": "shipment_location.shipment_customer_uid = shipment_customers.shipment_customer_uid"
        },
        {
          "join_type": "LEFT",
          "table_name": "shipment_delivery_notes",
          "join_condition": "shipment_delivery_notes.shipment_location_uid = shipment_location.shipment_location_uid"
        },
        {
          "join_type": "INNER",
          "table_name": "shipment_status",
          "join_condition": "shipment_status.id = shipment_customers.shipment_status_id"
        },
        {
          "join_type": "INNER",
          "table_name": "user_details",
          "join_condition": "users.id = user_details.user_id"
        }
      ],
      "group_by": [
        "shipment_customers.id",
        "shipment_customers.uuid",
        "users.id",
        "users.username",
        "shipment_status.name",
        "user_details.code"
      ],
      "print_query": false
    },
    "company_id": 1,
    "lineitems": [
      {
        "master_grid_id": 0,
        "field_name": "shipment_customers.uuid",
        "display_name": "uuid",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "users.username",
        "display_name": "customer_name",
        "order_no": 1,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "COUNT(DISTINCT shipment_delivery_notes.id)",
        "display_name": "no_of_dns",
        "order_no": 3,
        "is_grid_column": true,
        "is_searchable": false,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "shipment_status.name",
        "display_name": "status_name",
        "order_no": 5,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "shipment_customers.shipment_customer_uid",
        "display_name": "gparam_1",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "shipment_customers.shipment_id",
        "display_name": "gparam_2",
        "order_no": 6,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "COUNT(DISTINCT shipment_location.id)",
        "display_name": "no_of_dls",
        "order_no": 2,
        "is_grid_column": true,
        "is_searchable": false,
        "is_sortable": true,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "user_details.code",
        "display_name": "customer_code",
        "order_no": 1,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      }
    ]
  },
  {
    "name": "Shipment Location List",
    "entity_name": "shipment_location",
    "entity_type": "grid_builder_module",
    "static_page_content": null,
    "primary_table": "shipment_location",
    "associated_tables": [],
    "query_information": {
      "group_by": [
        "shipment_location.id",
        "shipment_location.uuid",
        "customers_delivery_addresses.delivery_location",
        "customers_delivery_addresses.customer_contact_no",
        "shipment_status.name",
        "pod_status.name",
        "pod_status.status_color_code",
        "shipment_status.name",
        "shipment_status.status_color_code",
        "customers_delivery_addresses.uuid"
      ],
      "includes": [
        {
          "join_type": "INNER",
          "table_name": "customers_delivery_addresses",
          "join_condition": "customers_delivery_addresses.id = shipment_location.customer_address_id"
        },
        {
          "join_type": "INNER",
          "table_name": "shipment_status",
          "join_condition": "shipment_status.id = shipment_location.shipment_status_id"
        },
        {
          "join_type": "LEFT",
          "table_name": "shipment_delivery_notes",
          "join_condition": "shipment_delivery_notes.shipment_location_uid = shipment_location.shipment_location_uid"
        },
        {
          "join_type": "LEFT",
          "table_name": "pod_status",
          "join_condition": "pod_status.id = shipment_location.pod_status_id"
        }
      ],
      "search_all": [
        {
          "value": 1,
          "operator": "=",
          "column_name": "shipment_location.status_id"
        },
        {
          "value": "$gparam_1",
          "operator": "=",
          "column_name": "shipment_location.shipment_customer_uid"
        }
      ],
      "print_query": false,
      "sort_columns": [
        [
          "shipment_location.id",
          "desc"
        ]
      ]
    },
    "company_id": 1,
    "lineitems": [
      {
        "master_grid_id": 0,
        "field_name": "shipment_location.uuid",
        "display_name": "uuid",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "customers_delivery_addresses.delivery_location",
        "display_name": "delivery_location",
        "order_no": 1,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "pod_status.name",
        "display_name": "pod_status",
        "order_no": 5,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1,
        "link_type": "component",
        "link_mode": "popup_details",
        "link_action": "customer_pod_details",
        "field_html_content": "<span class=\"p-4 m-4 text-xs rounded-full border\" style=\"background-color:{{row_object.gparam_3}}\"> {{ row_object.pod_status }}</span>"
      },
      {
        "master_grid_id": 0,
        "field_name": "shipment_location.shipment_location_uid",
        "display_name": "gparam_1",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "shipment_status.name",
        "display_name": "load_status",
        "order_no": 6,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1,
        "link_type": "component",
        "link_mode": "popup_details",
        "link_action": "shipment_load_details",
        "field_html_content": "<span class=\"p-4 m-4 text-xs rounded-full border\" style=\"background-color:{{row_object.gparam_4}}\"> {{ row_object.load_status }}</span>"
      },
      {
        "master_grid_id": 0,
        "field_name": "shipment_location.id",
        "display_name": "gparam_2",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "COUNT(DISTINCT shipment_delivery_notes.id)",
        "display_name": "no_of_dns",
        "order_no": 7,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "pod_status.status_color_code",
        "display_name": "gparam_3",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "shipment_status.status_color_code",
        "display_name": "gparam_4",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "shipment_location.customer_delivery_contact_name",
        "display_name": "delivery_contact_name",
        "order_no": 2,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "shipment_location.customer_delivery_contact_email",
        "display_name": "delivery_contact_email",
        "order_no": 3,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "shipment_location.customer_delivery_contact_number",
        "display_name": "delivery_contact_number",
        "order_no": 4,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "shipment_location.otp_number",
        "display_name": "otp_number",
        "order_no": 8,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "shipment_location.latest_otp_generated_at",
        "display_name": "latest_otp_generated_at",
        "order_no": 9,
        "is_grid_column": true,
        "is_searchable": false,
        "is_sortable": true,
        "field_type_id": 7,
        "company_id": 1
      }
    ]
  },
  {
    "name": "Shipment Delivery Note List",
    "entity_name": "shipment_delivery_note_list",
    "entity_type": "grid_builder_module",
    "static_page_content": null,
    "primary_table": "shipment_delivery_notes",
    "associated_tables": [],
    "query_information": {
      "group_by": [
        "shipment_delivery_notes.id",
        "shipment_delivery_notes.uuid",
        "delivery_notes.delivery_note_number",
        "delivery_notes.date_of_issue",
        "delivery_notes.customer_order_number",
        "delivery_notes.reference_number",
        "delivery_notes.shipment_type",
        "delivery_notes.uuid",
        "delivery_notes.id",
        "shipment_status.name",
        "delivery_notes.customer_delivery_contact_name",
        "delivery_notes.customer_delivery_contact_number",
        "delivery_notes.customer_delivery_contact_email"
      ],
      "includes": [
        {
          "join_type": "INNER",
          "table_name": "shipment_location",
          "join_condition": "shipment_delivery_notes.shipment_location_uid = shipment_location.shipment_location_uid"
        },
        {
          "join_type": "INNER",
          "table_name": "delivery_notes",
          "join_condition": "shipment_delivery_notes.delivery_note_id = delivery_notes.id"
        },
        {
          "join_type": "INNER",
          "table_name": "shipment_status",
          "join_condition": "shipment_status.id = shipment_delivery_notes.shipment_status_id"
        },
        {
          "join_type": "LEFT",
          "table_name": "delivery_note_line_items",
          "join_condition": "delivery_notes.id = delivery_note_line_items.delivery_note_id"
        }
      ],
      "search_all": [
        {
          "value": 1,
          "operator": "=",
          "column_name": "shipment_delivery_notes.status_id"
        },
        {
          "value": "$gparam_1",
          "operator": "=",
          "column_name": "shipment_delivery_notes.shipment_location_uid"
        }
      ],
      "print_query": false,
      "sort_columns": [
        [
          "shipment_delivery_notes.id",
          "desc"
        ]
      ]
    },
    "company_id": 1,
    "lineitems": [
      {
        "master_grid_id": 0,
        "field_name": "shipment_delivery_notes.uuid",
        "display_name": "uuid",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "delivery_notes.delivery_note_number",
        "display_name": "delivery_note_number",
        "order_no": 1,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "delivery_notes.date_of_issue",
        "display_name": "date_of_issue",
        "order_no": 3,
        "is_grid_column": true,
        "is_searchable": false,
        "is_sortable": true,
        "field_type_id": 7,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "delivery_notes.customer_order_number",
        "display_name": "customer_order_number",
        "order_no": 4,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "delivery_notes.reference_number",
        "display_name": "reference_number",
        "order_no": 5,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "delivery_notes.shipment_type",
        "display_name": "shipment_type",
        "order_no": 6,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "shipment_status.name",
        "display_name": "status_name",
        "order_no": 10,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "delivery_notes.id",
        "display_name": "gparam_1",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "delivery_notes.customer_delivery_contact_name",
        "display_name": "delivery_contact_name",
        "order_no": 7,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "delivery_notes.customer_delivery_contact_email",
        "display_name": "delivery_contact_email",
        "order_no": 8,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "delivery_notes.customer_delivery_contact_number",
        "display_name": "delivery_contact_number",
        "order_no": 9,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "count(delivery_note_line_items.id)",
        "display_name": "no_of_items",
        "order_no": 2,
        "is_grid_column": true,
        "is_searchable": false,
        "is_sortable": true,
        "field_type_id": 1,
        "company_id": 1
      }
    ]
  },
  {
    "name": "Vehicle Geofence History List",
    "entity_name": "historical_geofence_log",
    "entity_type": "grid_builder_module",
    "static_page_content": null,
    "primary_table": "vehicle_geofence_history",
    "associated_tables": [],
    "query_information": {
      "search_all": [
        {
          "value": 1,
          "operator": "=",
          "column_name": "vehicle_geofence_history.status_id"
        },
        {
          "value": "$gparam_1",
          "operator": "=",
          "column_name": "vehicle_geofence_history.shipment_id"
        }
      ],
      "sort_columns": [
        [
          "vehicle_geofence_history.id",
          "desc"
        ]
      ],
      "includes": [
        {
          "join_type": "INNER",
          "table_name": "shipments",
          "join_condition": "vehicle_geofence_history.shipment_id = shipments.id"
        },
        {
          "join_type": "INNER",
          "table_name": "vehicles",
          "join_condition": "vehicle_geofence_history.vehicle_id = vehicles.id"
        },
        {
          "join_type": "INNER",
          "table_name": "geofences",
          "join_condition": "vehicle_geofence_history.geofence_id = geofences.id"
        }
      ],
      "group_by": [
        "vehicle_geofence_history.id",
        "vehicles.vehicle_register_number",
        "vehicles.vehicle_plate_number",
        "geofences.zone_name",
        "geofences.zone_type",
        "geofences.category",
        "vehicle_geofence_history.event_timestamp",
        "vehicle_geofence_history.event_type"
      ],
      "print_query": false
    },
    "company_id": 1,
    "lineitems": [
      {
        "master_grid_id": 0,
        "field_name": "vehicle_geofence_history.id",
        "display_name": "id",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "vehicles.vehicle_register_number",
        "display_name": "vehicle_register_number",
        "order_no": 1,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "vehicles.vehicle_plate_number",
        "display_name": "vehicle_plate_number",
        "order_no": 2,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "geofences.zone_name",
        "display_name": "geofence_name",
        "order_no": 3,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "geofences.zone_type",
        "display_name": "geofence_type",
        "order_no": 4,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "geofences.category",
        "display_name": "geofence_category",
        "order_no": 5,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "geofences.category",
        "display_name": "geofence_category",
        "order_no": 5,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "geofences.category",
        "display_name": "geofence_category",
        "order_no": 5,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "vehicle_geofence_history.event_timestamp",
        "display_name": "event_timestamp",
        "order_no": 6,
        "is_grid_column": true,
        "is_searchable": false,
        "is_sortable": true,
        "field_type_id": 7,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "vehicle_geofence_history.event_type",
        "display_name": "event_type",
        "order_no": 7,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      }
    ]
  },
  {
    "name": "Shipment Details Page",
    "entity_name": "shipment_details_page",
    "entity_type": "static_page_builder_module",
    "static_page_content": "\r\n<div class=\"grid grid-cols-1 gap-6 p-4\">\r\n  <div class=\"grid grid-cols-1 sm:grid-cols-3 gap-6\">\r\n    <!-- Shipment Number -->\r\n    <div class=\"flex flex-col\">\r\n      <label class=\"font-medium text-gray-700 dark:text-gray-300 mb-1\">Shipment Number:</label>\r\n      <div class=\"bg-gray-100 dark:bg-gray-800 p-2 rounded-md text-gray-900 dark:text-white-light\">\r\n        {{result_data.shipment_number}}\r\n      </div>\r\n    </div>\r\n\r\n    <!-- Created By -->\r\n    <div class=\"flex flex-col\">\r\n      <label class=\"font-medium text-gray-700 dark:text-gray-300 mb-1\">Created By:</label>\r\n      <div class=\"bg-gray-100 dark:bg-gray-800 p-2 rounded-md text-gray-900 dark:text-white-light\">\r\n        {{result_data.created_by}}\r\n      </div>\r\n    </div>\r\n\r\n    <!-- Created At -->\r\n    <div class=\"flex flex-col\">\r\n      <label class=\"font-medium text-gray-700 dark:text-gray-300 mb-1\">Created At:</label>\r\n      <div class=\"bg-gray-100 dark:bg-gray-800 p-2 rounded-md text-gray-900 dark:text-white-light\">\r\n        {{result_data.created_at}}\r\n      </div>\r\n    </div>\r\n\r\n    <!-- No of Delivery Notes -->\r\n    <div class=\"flex flex-col\">\r\n      <label class=\"font-medium text-gray-700 dark:text-gray-300 mb-1\">No of Delivery Notes:</label>\r\n      <div class=\"bg-gray-100 dark:bg-gray-800 p-2 rounded-md text-gray-900 dark:text-white-light\">\r\n        {{result_data.no_of_dns}}\r\n      </div>\r\n    </div>\r\n\r\n    <!-- No of Locations -->\r\n    <div class=\"flex flex-col\">\r\n      <label class=\"font-medium text-gray-700 dark:text-gray-300 mb-1\">No of Locations:</label>\r\n      <div class=\"bg-gray-100 dark:bg-gray-800 p-2 rounded-md text-gray-900 dark:text-white-light\">\r\n        {{result_data.no_of_dls}}\r\n      </div>\r\n    </div>\r\n\r\n    <!-- Vehicle Number -->\r\n    <div class=\"flex flex-col\">\r\n      <label class=\"font-medium text-gray-700 dark:text-gray-300 mb-1\">Vehicle Number:</label>\r\n      <div class=\"bg-gray-100 dark:bg-gray-800 p-2 rounded-md text-gray-900 dark:text-white-light\">\r\n        {{result_data.vehicle_plate_number}}\r\n      </div>\r\n    </div>\r\n\r\n    <!-- Driver Name -->\r\n    <div class=\"flex flex-col\">\r\n      <label class=\"font-medium text-gray-700 dark:text-gray-300 mb-1\">Driver Name:</label>\r\n      <div class=\"bg-gray-100 dark:bg-gray-800 p-2 rounded-md text-gray-900 dark:text-white-light\">\r\n        {{result_data.driver_name}}\r\n      </div>\r\n    </div>\r\n  </div>\r\n\r\n  <!-- Line Items -->\r\n    <div class=\"mb-6\">\r\n      <label class=\"font-medium text-gray-700 dark:text-gray-300 mb-2 block\">Cutomers :</label>\r\n      <div class=\"overflow-x-auto\">\r\n        <table class=\"min-w-full border border-gray-300 dark:border-gray-700 text-sm\">\r\n          <thead class=\"bg-gray-200 dark:bg-gray-700\">\r\n            <tr>\r\n              <th class=\"px-4 py-2 border\">S.No</th>\r\n              <th class=\"px-4 py-2 border\">Customer Name</th>\r\n              <th class=\"px-4 py-2 border\">No of Delivery Notes</th>\r\n              <th class=\"px-4 py-2 border\">No of Delivery Locations</th>\r\n            </tr>\r\n          </thead>\r\n          <tbody>\r\n            {{#each result_data.shipment_customers}}\r\n              <tr class=\"odd:bg-gray-50 dark:odd:bg-gray-800\">\r\n                <td class=\"px-4 py-2 border\">{{hbp_inc @index}}</td>\r\n                <td class=\"px-4 py-2 border\">{{customer_name}}</td>\r\n                <td class=\"px-4 py-2 border\">{{no_of_dns}}</td>\r\n                <td class=\"px-4 py-2 border\">{{no_of_locations}}</td>\r\n              </tr>\r\n            {{/each}}\r\n          </tbody>\r\n        </table>\r\n      </div>\r\n    </div>\r\n</div>",
    "query_information": {
      "primary_table": "shipments",
      "company_id": 1,
      "search_all": [
        {
          "value": 1,
          "operator": "=",
          "column_name": "shipments.status_id"
        },
        {
          "value": "$unique_id",
          "operator": "=",
          "column_name": "shipments.uuid"
        }
      ],
      "sort_columns": [
        [
          "shipments.id",
          "desc"
        ]
      ],
      "includes": [
        {
          "join_type": "INNER",
          "table_name": "users",
          "join_condition": "users.id = shipments.created_by"
        },
        {
          "join_type": "INNER",
          "table_name": "vehicles",
          "join_condition": "vehicles.id = shipments.vehicle_id"
        },
        {
          "join_type": "LEFT",
          "table_name": "vehicle_user_mapping",
          "join_condition": "vehicle_user_mapping.vehicle_id = shipments.vehicle_id AND vehicle_user_mapping.status_id = 1"
        },
        {
          "join_type": "LEFT",
          "table_name": "users as u",
          "join_condition": "u.id = vehicle_user_mapping.user_id"
        },
        {
          "join_type": "INNER",
          "table_name": "user_details as ud",
          "join_condition": "ud.user_id = u.id"
        },
        {
          "join_type": "LEFT",
          "table_name": "shipment_customers",
          "join_condition": "shipment_customers.shipment_id = shipments.id"
        },
        {
          "join_type": "LEFT",
          "table_name": "shipment_location",
          "join_condition": "shipment_location.shipment_customer_uid = shipment_customers.shipment_customer_uid"
        },
        {
          "join_type": "LEFT",
          "table_name": "shipment_delivery_notes",
          "join_condition": "shipment_delivery_notes.shipment_location_uid = shipment_location.shipment_location_uid"
        }
      ],
      "group_by": [
        "shipments.id",
        "shipments.uuid",
        "users.id",
        "users.username",
        "u.username",
        "vehicles.vehicle_plate_number",
        "ud.first_name"
      ],
      "print_query": false,
      "select_columns": [
        [
          "shipments.shipment_number",
          "shipment_number"
        ],
        [
          "users.username",
          "created_by"
        ],
        [
          "shipments.created_at",
          "created_at"
        ],
        [
          "COUNT(DISTINCT shipment_delivery_notes.id)",
          "no_of_dns"
        ],
        [
          "COUNT(DISTINCT shipment_location.id)",
          "no_of_dls"
        ],
        [
          "vehicles.vehicle_plate_number",
          "vehicle_plate_number"
        ],
        [
          "ud.first_name",
          "driver_name"
        ],
        [
          "COALESCE( ( SELECT JSON_AGG(T) FROM ( SELECT SC.ID AS ID, SC.UUID AS UUID, U.USERNAME AS CUSTOMER_NAME, COUNT(DISTINCT SDN.ID) AS NO_OF_DNS, COUNT(DISTINCT SL.ID) AS NO_OF_LOCATIONS, COALESCE( ( SELECT JSON_AGG(L) FROM ( SELECT SL2.ID AS ID, SL2.UUID AS UUID, CDA.CUSTOMER_CONTACT_NO AS CUSTOMER_CONTACT, CDA.DELIVERY_LOCATION AS DELIVERY_LOCATION, SL2.POD_STATUS AS POD_STATUS, COALESCE( ( SELECT JSON_AGG(DN) FROM ( SELECT DN.ID AS ID, DN.UUID AS UUID, DN.DELIVERY_NOTE_NUMBER AS DELIVERY_NOTE_NUMBER, DN.DATE_OF_ISSUE AS DATE_OF_ISSUE, DN.CUSTOMER_ORDER_NUMBER AS CUSTOMER_ORDER_NUMBER, DN.REFERENCE_NUMBER AS REFERENCE_NUMBER, DN.SHIPMENT_TYPE AS SHIPMENT_TYPE FROM SHIPMENT_DELIVERY_NOTES SDN2 INNER JOIN DELIVERY_NOTES DN ON SDN2.DELIVERY_NOTE_ID = DN.ID WHERE SDN2.COMPANY_ID = '1' AND SDN2.STATUS_ID = '1' AND SDN2.shipment_location_uid = SL2.shipment_location_uid ORDER BY SDN2.ID ASC LIMIT 10 OFFSET 0 ) DN ), '[]' ) AS DELIVERY_NOTES FROM SHIPMENT_LOCATION SL2 INNER JOIN CUSTOMERS_DELIVERY_ADDRESSES CDA ON CDA.ID = SL2.CUSTOMER_ADDRESS_ID WHERE SL2.COMPANY_ID = '1' AND SL2.STATUS_ID = '1' AND SL2.shipment_customer_uid = SC.SHIPMENT_CUSTOMER_UID ORDER BY SL2.ID ASC LIMIT 10 OFFSET 0 ) L ), '[]' ) AS LOCATIONS FROM SHIPMENT_CUSTOMERS SC INNER JOIN USERS U ON U.ID = SC.CUSTOMER_ID LEFT JOIN SHIPMENT_LOCATION SL ON SL.shipment_customer_uid = SC.shipment_customer_uid LEFT JOIN SHIPMENT_DELIVERY_NOTES SDN ON SDN.shipment_location_uid = SL.shipment_location_uid WHERE SC.COMPANY_ID = '1' AND SC.STATUS_ID = '1' AND SC.SHIPMENT_ID = SHIPMENTS.ID GROUP BY SC.ID, SC.UUID, U.ID, U.USERNAME ORDER BY SC.ID ASC LIMIT 10 OFFSET 0 ) T ), '[]' )",
          "shipment_customers"
        ]
      ]
    }
  },
  {
    "name": "All Customer List",
    "entity_name": "all_customers",
    "entity_type": "grid_builder_module",
    "static_page_content": null,
    "primary_table": "delivery_notes",
    "associated_tables": [],
    "query_information": {
      "group_by": [
        "users.id",
        "users.uuid",
        "user_details.first_name",
        "roles.name"
      ],
      "includes": [
        {
          "join_type": "LEFT",
          "table_name": "users",
          "join_condition": "delivery_notes.customer_id = users.id"
        },
        {
          "join_type": "INNER",
          "table_name": "user_details",
          "join_condition": "user_details.user_id = users.id"
        },
        {
          "join_type": "LEFT",
          "table_name": "user_roles",
          "join_condition": "users.id = user_roles.user_id"
        },
        {
          "join_type": "LEFT",
          "table_name": "roles",
          "join_condition": "roles.id = user_roles.role_id"
        },
        {
          "join_type": "LEFT",
          "table_name": "customers_delivery_addresses",
          "join_condition": "customers_delivery_addresses.id = delivery_notes.customer_delivery_address_id"
        }
      ],
      "search_all": [
        {
          "value": 3,
          "operator": "!=",
          "column_name": "users.status_id"
        },
        {
          "value": "Customer",
          "operator": "=",
          "column_name": "roles.name"
        }
      ],
      "print_query": false,
      "sort_columns": [
        [
          "users.id",
          "desc"
        ]
      ]
    },
    "company_id": 1,
    "lineitems": [
      {
        "master_grid_id": 0,
        "field_name": "users.id",
        "display_name": "id",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "users.uuid",
        "display_name": "uuid",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "users.uuid",
        "display_name": "gparam_1",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "user_details.first_name",
        "display_name": "customer",
        "order_no": 1,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "count(delivery_notes.id)",
        "display_name": "no_of_dns",
        "order_no": 2,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "count(DISTINCT customers_delivery_addresses.id)",
        "display_name": "no_of_delivery_locations",
        "order_no": 3,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      }
    ]
  },
  {
    "name": "Unmapped Delivery Note",
    "entity_name": "unmapped_delivery_notes",
    "entity_type": "grid_builder_module",
    "static_page_content": null,
    "primary_table": "unmapped_delivery_notes",
    "associated_tables": [],
    "query_information": {
      "print_query": false
    },
    "company_id": 1,
    "lineitems": [
      {
        "master_grid_id": 0,
        "field_name": "unmapped_delivery_notes.delivery_note_id",
        "display_name": "id",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "unmapped_delivery_notes.delivery_note_uuid",
        "display_name": "uuid",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "unmapped_delivery_notes.delivery_note_id",
        "display_name": "gparam_1",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "unmapped_delivery_notes.delivery_note_number",
        "display_name": "delivery_note_number",
        "order_no": 1,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1,
        "link_mode": "child_details",
        "link_action": "shipment_delivery_note_line_items",
        "link_type": "child_grid"
      },
      {
        "master_grid_id": 0,
        "field_name": "unmapped_delivery_notes.customer_name",
        "display_name": "customer_name",
        "order_no": 4,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "unmapped_delivery_notes.delivery_location",
        "display_name": "delivery_location",
        "order_no": 5,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "unmapped_delivery_notes.reference_number",
        "display_name": "reference_number",
        "order_no": 6,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "unmapped_delivery_notes.date_of_issue",
        "display_name": "date_of_issue",
        "order_no": 7,
        "is_grid_column": true,
        "is_searchable": false,
        "is_sortable": true,
        "field_type_id": 7,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "unmapped_delivery_notes.customers_delivery_addresses_id",
        "display_name": "gparam_2",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "unmapped_delivery_notes.no_of_items",
        "display_name": "no_of_items",
        "order_no": 2,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "unmapped_delivery_notes.customer_id",
        "display_name": "gparam_3",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "unmapped_delivery_notes.customer_code",
        "display_name": "customer_code",
        "order_no": 3,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "unmapped_delivery_notes.customer_order_number",
        "display_name": "customer_order_number",
        "order_no": 4,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "unmapped_delivery_notes.customer_delivery_contact_name",
        "display_name": "gparam_4",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "unmapped_delivery_notes.customer_delivery_contact_email",
        "display_name": "gparam_5",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "unmapped_delivery_notes.customer_delivery_contact_number",
        "display_name": "customer_order_number",
        "order_no": 4,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      }
    ]
  },
  {
    "name": "Shipment Delivery Location Details",
    "entity_name": "create_shipment_delivery_location",
    "entity_type": "grid_builder_module",
    "static_page_content": null,
    "primary_table": "customers_delivery_addresses",
    "associated_tables": [],
    "query_information": {
      "group_by": [
        "customers_delivery_addresses.id",
        "customers_delivery_addresses.uuid",
        "customers_delivery_addresses.delivery_location",
        "customers_delivery_addresses.customer_contact_no"
      ],
      "includes": [
        {
          "join_type": "INNER",
          "table_name": "delivery_notes",
          "join_condition": "customers_delivery_addresses.id = delivery_notes.customer_delivery_address_id"
        },
        {
          "join_type": "INNER",
          "table_name": "users",
          "join_condition": "users.id = delivery_notes.customer_id"
        }
      ],
      "search_all": [
        {
          "value": 3,
          "operator": "!=",
          "column_name": "customers_delivery_addresses.status_id"
        },
        {
          "value": "$gparam_1",
          "operator": "=",
          "column_name": "users.uuid"
        }
      ],
      "print_query": false,
      "sort_columns": [
        [
          "customers_delivery_addresses.id",
          "desc"
        ]
      ]
    },
    "company_id": 1,
    "lineitems": [
      {
        "master_grid_id": 0,
        "field_name": "customers_delivery_addresses.id",
        "display_name": "id",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "customers_delivery_addresses.uuid",
        "display_name": "uuid",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "customers_delivery_addresses.uuid",
        "display_name": "gparam_1",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "customers_delivery_addresses.delivery_location",
        "display_name": "Delivery Location",
        "order_no": 1,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "customers_delivery_addresses.customer_contact_no",
        "display_name": "Customer Contact",
        "order_no": 2,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      }
    ]
  },
  {
    "name": "Shipment Selection Items",
    "entity_name": "shipment_selection_items",
    "entity_type": "grid_builder_module",
    "static_page_content": null,
    "primary_table": "temp_session_data",
    "associated_tables": [],
    "query_information": {
      "group_by": [
        "temp_session_data.id",
        "temp_session_data.uuid",
        "temp_session_data.session_id",
        "user_details.code"
      ],
      "includes": [
        {
          "table_name": "user_details",
          "join_type": "INNER",
          "join_condition": "temp_session_data.customer_id = user_details.user_id"
        }
      ],
      "search_all": [
        {
          "value": 3,
          "operator": "!=",
          "column_name": "temp_session_data.status_id"
        },
        {
          "value": "$gparam_1",
          "operator": "=",
          "column_name": "temp_session_data.session_id"
        }
      ],
      "print_query": false,
      "sort_columns": [
        [
          "temp_session_data.id",
          "desc"
        ]
      ]
    },
    "company_id": 1,
    "lineitems": [
      {
        "master_grid_id": 0,
        "field_name": "temp_session_data.id",
        "display_name": "id",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "temp_session_data.uuid",
        "display_name": "uuid",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "temp_session_data.session_id",
        "display_name": "session_id",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "temp_session_data.delivery_note_number",
        "display_name": "delivery_note_number",
        "order_no": 1,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "temp_session_data.first_name",
        "display_name": "customer_name",
        "order_no": 3,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "temp_session_data.delivery_location",
        "display_name": "delivery_location",
        "order_no": 4,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "temp_session_data.reference_number",
        "display_name": "reference_number",
        "order_no": 5,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "temp_session_data.date_of_issue",
        "display_name": "date_of_issue",
        "order_no": 6,
        "is_grid_column": true,
        "is_searchable": false,
        "is_sortable": true,
        "field_type_id": 7,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "user_details.code",
        "display_name": "customer_code",
        "order_no": 2,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      }
    ]
  },
  {
    "name": "Shipment Delivery Note Lineitem List",
    "entity_name": "shipment_delivery_note_line_items",
    "entity_type": "grid_builder_module",
    "static_page_content": null,
    "primary_table": "delivery_note_line_items",
    "associated_tables": [],
    "query_information": {
      "group_by": [
        "delivery_note_line_items.id",
        "delivery_note_line_items.uuid",
        "delivery_note_line_items.item_code",
        "delivery_note_line_items.slip_no",
        "delivery_note_line_items.section_number",
        "delivery_note_line_items.quantity",
        "delivery_note_line_items.weight",
        "delivery_note_line_items.item_description",
        "delivery_note_line_items.length"
      ],
      "includes": [],
      "search_all": [
        {
          "value": 1,
          "operator": "=",
          "column_name": "delivery_note_line_items.status_id"
        },
        {
          "value": "$gparam_1",
          "operator": "=",
          "column_name": "delivery_note_line_items.delivery_note_id"
        }
      ],
      "print_query": false,
      "sort_columns": [
        [
          "delivery_note_line_items.id",
          "desc"
        ]
      ]
    },
    "company_id": 1,
    "lineitems": [
      {
        "master_grid_id": 0,
        "field_name": "delivery_note_line_items.uuid",
        "display_name": "uuid",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "delivery_note_line_items.item_code",
        "display_name": "item_code",
        "order_no": 1,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "delivery_note_line_items.item_description",
        "display_name": "item_description",
        "order_no": 2,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "delivery_note_line_items.slip_no",
        "display_name": "slip_no",
        "order_no": 3,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "delivery_note_line_items.section_number",
        "display_name": "section_number",
        "order_no": 4,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "delivery_note_line_items.quantity",
        "display_name": "quantity",
        "order_no": 5,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "delivery_note_line_items.length",
        "display_name": "length",
        "order_no": 6,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "delivery_note_line_items.weight",
        "display_name": "weight",
        "order_no": 7,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 1,
        "company_id": 1
      }
    ]
  },
  {
    "name": "Driver & Vehicle Grid",
    "entity_name": "grid_drivers",
    "entity_type": "grid_builder_module",
    "static_page_content": null,
    "primary_table": "users",
    "associated_tables": [],
    "query_information": {
      "includes": [
        {
          "join_type": "INNER",
          "table_name": "vehicle_user_mapping",
          "join_condition": "users.id = vehicle_user_mapping.user_id"
        },
        {
          "join_type": "LEFT",
          "table_name": "user_details",
          "join_condition": "user_details.user_id = users.id"
        },
        {
          "join_type": "LEFT",
          "table_name": "vehicles",
          "join_condition": "vehicles.id = vehicle_user_mapping.vehicle_id"
        }
      ],
      "search_all": [
        {
          "value": 3,
          "operator": "!=",
          "column_name": "users.status_id"
        },
        {
          "value": 3,
          "operator": "!=",
          "column_name": "vehicles.status_id"
        },
        {
          "value": 3,
          "operator": "!=",
          "column_name": "vehicle_user_mapping.status_id"
        }
      ],
      "sort_columns": [
        [
          "user_details.first_name",
          "desc"
        ]
      ]
    },
    "company_id": 1,
    "lineitems": [
      {
        "master_grid_id": 0,
        "field_name": "users.id",
        "display_name": "id",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "users.uuid",
        "display_name": "uuid",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "CONCAT(user_details.first_name, ' ', COALESCE(user_details.last_name, ''))",
        "display_name": "full_name",
        "order_no": 1,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "users.email",
        "display_name": "email",
        "order_no": 2,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "concat(user_details.country_code, ' ', user_details.phone_number)",
        "display_name": "phone_number",
        "order_no": 3,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "vehicles.vehicle_plate_number",
        "display_name": "vehicle_plate_number",
        "order_no": 4,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "vehicles.vehicle_register_number",
        "display_name": "vehicle_register_number",
        "order_no": 5,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "vehicle_user_mapping.status_id",
        "display_name": "status",
        "order_no": 6,
        "is_grid_column": true,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 3,
        "company_id": 1
      }
    ]
  },
  {
    "name": "Shipment Status History",
    "entity_name": "shipment_history_status",
    "entity_type": "grid_builder_module",
    "static_page_content": null,
    "primary_table": "shipment_status_history",
    "associated_tables": [],
    "query_information": {
      "group_by": [
        "udd.code",
        "ud.first_name",
        "shipment_status_history.id",
        "uss.username",
        "cda.delivery_location",
        "dn.delivery_note_number",
        "ss_from.name",
        "ss_to.name",
        "ud.last_name",
        "ss_from.id"
      ],
      "cte": "WITH delivery_notes AS ( SELECT dn.id,dn.delivery_note_number,dn.reference_number,dn.customer_id FROM shipment_delivery_notes sdn JOIN delivery_notes dn on sdn.delivery_note_id = dn.id WHERE sdn.shipment_id = '$gparam_1' )",
      "includes": [
        {
          "join_type": "INNER",
          "table_name": "shipment_delivery_notes sdn",
          "join_condition": "shipment_status_history.ref_id = sdn.id AND shipment_status_history.table_name = 'shipment_delivery_notes'"
        },
        {
          "join_type": "INNER",
          "table_name": "delivery_notes dn",
          "join_condition": "sdn.delivery_note_id = dn.id"
        },
        {
          "join_type": "INNER",
          "table_name": "users us",
          "join_condition": "shipment_status_history.changed_by = us.id"
        },
        {
          "join_type": "LEFT",
          "table_name": "user_details ud",
          "join_condition": "ud.user_id = us.id"
        },
        {
          "join_type": "LEFT",
          "table_name": "shipment_status ss_from",
          "join_condition": "shipment_status_history.from_state = ss_from.id"
        },
        {
          "join_type": "LEFT",
          "table_name": "shipment_status ss_to",
          "join_condition": "shipment_status_history.to_state = ss_to.id"
        },
        {
          "join_type": "INNER",
          "table_name": "shipments",
          "join_condition": "shipments.id = sdn.shipment_id"
        },
        {
          "join_type": "INNER",
          "table_name": "shipment_customers sc",
          "join_condition": "sc.shipment_id = shipments.id AND sc.customer_id = dn.customer_id"
        },
        {
          "join_type": "INNER",
          "table_name": "USERS uss",
          "join_condition": "uss.id = sc.customer_id"
        },
        {
          "join_type": "LEFT",
          "table_name": "USER_DETAILS udd",
          "join_condition": "udd.user_id = sc.customer_id"
        },
        {
          "join_type": "INNER",
          "table_name": "shipment_location sl",
          "join_condition": "sl.shipment_id = sdn.shipment_id AND sl.shipment_customer_uid = sc.shipment_customer_uid AND sdn.shipment_location_uid = sl.shipment_location_uid"
        },
        {
          "join_type": "INNER",
          "table_name": "customers_delivery_addresses cda",
          "join_condition": "cda.id = sl.customer_address_id"
        }
      ],
      "company_id": 1,
      "print_query": false,
      "sort_columns": [
        [
          "dn.delivery_note_number",
          "asc"
        ],
        [
          "ss_from.id",
          "asc"
        ]
      ]
    },
    "company_id": 1,
    "lineitems": [
      {
        "master_grid_id": 0,
        "field_name": "shipment_status_history.id",
        "display_name": "id",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "shipment_status_history.uuid",
        "display_name": "uuid",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "dn.delivery_note_number",
        "display_name": "delivery_note_number",
        "order_no": 4,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "ss_from.name",
        "display_name": "from_status",
        "order_no": 6,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "ss_to.name",
        "display_name": "to_status",
        "order_no": 7,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "shipment_status_history.changed_at",
        "display_name": "changed_at",
        "order_no": 7,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 7,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "COALESCE(ud.first_name, '') || ' ' || COALESCE(ud.last_name, '')",
        "display_name": "changed_by",
        "order_no": 8,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 7,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "uss.username",
        "display_name": "customer_name",
        "order_no": 1,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "cda.delivery_location",
        "display_name": "customer_location",
        "order_no": 2,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "udd.code",
        "display_name": "customer_code",
        "order_no": 1,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      }
    ]
  },
  {
    "name": "Shipment Vehicle Tracking",
    "entity_name": "grid_shipment_vehicle_tracking",
    "entity_type": "grid_builder_module",
    "static_page_content": null,
    "primary_table": "shipment_timeline_view",
    "associated_tables": [],
    "query_information": {
      "search_all": [
        {
          "value": "$gparam_1",
          "operator": "=",
          "column_name": "shipment_timeline_view.shipment_id"
        }
      ],
      "print_query": false,
      "sort_columns": [
        [
          "shipment_timeline_view.date",
          "asc"
        ]
      ]
    },
    "company_id": 1,
    "lineitems": [
      {
        "master_grid_id": 0,
        "field_name": "shipment_timeline_view.shipment_id",
        "display_name": "id",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "shipment_timeline_view.zone_name",
        "display_name": "zone_name",
        "order_no": 1,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "shipment_timeline_view.zone_category",
        "display_name": "zone_category",
        "order_no": 2,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "shipment_timeline_view.state",
        "display_name": "state",
        "order_no": 3,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "shipment_timeline_view.date",
        "display_name": "date",
        "order_no": 4,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 7,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "shipment_timeline_view.latitude_longitude",
        "display_name": "latitude_longitude",
        "order_no": 5,
        "is_grid_column": true,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 3,
        "company_id": 1,
        "field_html_content": "<a class=\"inline-flex items-center gap-1 px-2 py-0.5 text-xs rounded-full bg-sky-50 text-sky-700 border border-sky-200 hover:bg-sky-100\" href=\"https://www.google.com/maps?q={{ row_object.latitude_longitude }}\" target=\"_blank\">{{row_object.latitude_longitude}}</a>"
      },
      {
        "master_grid_id": 0,
        "field_name": "shipment_timeline_view.delivery_location",
        "display_name": "location",
        "order_no": 6,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      }
    ]
  },
  {
    "name": "Customer POD Details",
    "entity_name": "customer_pod_details",
    "entity_type": "static_page_builder_module",
    "static_page_content": "<div> {{#if result_data.[0]}} <div> {{!-- LOCATION BLOCK --}} {{#if result_data.[0].delivery_location}} <div class='flex items-start justify-between mb-4'><div class='flex flex-col gap-1'> {{!-- CUSTOMER NAME FIRST --}} {{#if result_data.[0].customer_username}} <div class='text-sm text-gray-800 ml-6'> Customer Name: <span class='font-semibold text-gray-900'> {{result_data.[0].customer_username}} </span> </div> {{/if}} <div class='flex items-start gap-2'><div class='text-gray-800 text-sm'> Delivery Location: </div><div class='text-gray-700 text-sm leading-snug'> {{result_data.[0].delivery_location}} </div></div> {{#if result_data.[0].delivery_date}} <div class='text-sm text-gray-800 ml-6'> Delivery Date: <span class='font-semibold text-gray-800'> {{result_data.[0].delivery_date}} </span> </div> {{/if}} <div class='text-sm text-gray-800 ml-6'> POD Lat-Long: {{#if result_data.[0].shipment_location_lat_long}} <a href=\"https://maps.google.com/?q={{result_data.[0].shipment_location_lat_long}}\" target=\"_blank\" class=\"font-semibold text-blue-600 underline hover:text-blue-800\"> {{result_data.[0].shipment_location_lat_long}} </a> {{else}} <span class='font-semibold text-gray-500'>N / A</span> {{/if}} </div></div><button class='btn btn-primary rounded-half' id='redirectBtn'> <i class='fa-solid fa-download text-white text-lg'></i> </button></div> {{/if}} {{!-- DELIVERY NOTE LIST --}} {{#each result_data}} <div class='bg-gray-50 border rounded-lg p-3 mb-3 shadow-sm'><div class='flex justify-between items-center bg-white border rounded-full px-3 py-1 text-sm shadow-sm'><span class='text-gray-700 font-medium'> DN No: {{delivery_note_number}} </span><span class='bg-green-100 text-green-700 text-sm font-semibold px-2 py-1 rounded-full'> {{shipment_status}} </span></div></div> {{/each}} {{!-- POD IMAGES --}} {{#if result_data.[0].pod_images}} <div class='border-t border-dotted pt-3 mb-4'><strong class='block mb-2 text-gray-800 text-sm'>Dispatched Item Images</strong><div class='flex flex-wrap gap-3'> {{#each result_data.[0].pod_images}} <div class='w-20 h-20 rounded-lg overflow-hidden border shadow-sm'> <img src='https://deliveryapp.altaiseer.com/lcp-altaiseer-api/{{image}}' alt='POD Image' class='w-full h-full object-cover hover:scale-105 transition-transform' /> </div> {{/each}} </div></div> {{/if}} {{!-- OTP STATUS --}} {{#if result_data.[0].otp_status}} <div class='border-t border-dotted pt-3 mb-4'><div class='flex justify-between items-center'><strong class='text-gray-800 text-sm'>OTP Verification Status</strong><div class='flex items-center gap-2'> <i class='fa-solid fa-circle-check text-green-600'></i><span class='text-green-600 font-semibold text-sm'> {{result_data.[0].otp_status}} </span> </div></div> {{#if result_data.[0].otp_number}} <div class='text-sm text-gray-700 mt-2'> OTP Number: <span class='font-semibold text-gray-900'> {{result_data.[0].otp_number}} </span> </div> {{/if}}</div> {{/if}} {{!-- CUSTOMER SIGNATURE --}} {{#if result_data.[0].customer_signature}} <div class='border-t border-dotted pt-3 mb-4'><strong class='block mb-2 text-gray-800 text-sm'> Captured Customer Signature </strong><div class='bg-gray-50 border rounded-lg p-2 flex justify-center'> <img src='https://deliveryapp.altaiseer.com/lcp-altaiseer-api/{{result_data.[0].customer_signature}}' alt='Customer Signature' class='max-h-28 object-contain' /> </div></div> {{/if}} </div> {{else}} <div> {{!-- LOCATION BLOCK --}} {{#if result_data.delivery_location}} <div class='flex items-start justify-between mb-4'><div class='flex flex-col gap-1'> {{!-- CUSTOMER NAME FIRST --}} {{#if result_data.customer_username}} <div class='text-sm text-gray-800 ml-6'> Customer Name: <span class='font-semibold text-gray-900'> {{result_data.customer_username}} </span> </div> {{/if}} <div class='flex items-start gap-2'><div class='text-gray-800 text-sm'> Delivery Location: </div><div class='text-gray-700 text-sm leading-snug'> {{result_data.delivery_location}} </div></div> {{#if result_data.delivery_date}} <div class='text-sm text-gray-800 ml-6'> Delivery Date: <span class='font-semibold text-gray-800'> {{result_data.delivery_date}} </span> </div> {{/if}} <div class='text-sm text-gray-800 ml-6'> POD Lat - Long : {{#if result_data.shipment_location_lat_long}} <a href=\"https://maps.google.com/?q={{result_data.shipment_location_lat_long}}\" target=\"_blank\" class=\"font-semibold text-blue-600 underline hover:text-blue-800\"> {{result_data.shipment_location_lat_long}} </a> {{else}} <span class='font-semibold text-gray-500'>N / A</span> {{/if}} </div></div><button class='btn btn-primary p-2 rounded-half' id='redirectBtn'> <i class='fa-solid fa-download text-white text-lg'></i> </button></div> {{/if}} <div class='bg-gray-50 border rounded-lg p-3 mb-4'><div class='flex justify-between items-center bg-white border rounded-full px-3 py-1 text-sm shadow-sm'><span class='text-gray-700 font-medium'> DN No: {{result_data.delivery_note_number}} </span><span class='bg-green-100 text-green-700 text-sm font-semibold px-2 py-1 rounded-full'> {{result_data.shipment_status}} </span></div></div> {{!-- POD IMAGES --}} {{#if result_data.pod_images}} <div class='border-t border-dotted pt-3 mb-4'><strong class='block mb-2 text-gray-800 text-sm'>Dispatched Item Images</strong><div class='flex flex-wrap gap-3'> {{#each result_data.pod_images}} <div class='w-20 h-20 rounded-lg overflow-hidden border shadow-sm'> <img src='https://deliveryapp.altaiseer.com/lcp-altaiseer-api/{{image}}' alt='POD Image' class='w-full h-full object-cover hover:scale-105 transition-transform' /> </div> {{/each}} </div></div> {{/if}} {{!-- OTP STATUS --}} {{#if result_data.otp_status}} <div class='border-t border-dotted pt-3 mb-4'><div class='flex justify-between items-center'><strong class='text-gray-800 text-sm'>OTP Verification Status</strong><div class='flex items-center gap-2'> <i class='fa-solid fa-circle-check text-green-600'></i><span class='text-green-600 font-semibold text-sm'> {{result_data.otp_status}} </span> </div></div> {{#if result_data.otp_number}} <div class='text-sm text-gray-700 mt-2'> OTP Number : <span class='font-semibold text-gray-900'> {{result_data.otp_number}} </span> </div> {{/if}}</div> {{/if}} {{!-- CUSTOMER SIGNATURE --}} {{#if result_data.customer_signature}} <div class='border-t border-dotted pt-3 mb-4'><strong class='block mb-2 text-gray-800 text-sm'> Captured Customer Signature </strong><div class='bg-gray-50 border rounded-lg p-2 flex justify-center'> <img src='https://deliveryapp.altaiseer.com/lcp-altaiseer-api/{{result_data.customer_signature}}' alt='Customer Signature' class='max-h-28 object-contain' /> </div></div> {{/if}} </div> {{/if}} </div>",
    "primary_table": "shipment_location",
    "query_information": {
      "includes": [
        {
          "join_type": "INNER",
          "table_name": "customers_delivery_addresses",
          "join_condition": "shipment_location.customer_address_id = customers_delivery_addresses.id"
        },
        {
          "join_type": "INNER",
          "table_name": "shipment_delivery_notes",
          "join_condition": "shipment_location.shipment_location_uid = shipment_delivery_notes.shipment_location_uid"
        },
        {
          "join_type": "INNER",
          "table_name": "delivery_notes",
          "join_condition": "shipment_delivery_notes.delivery_note_id = delivery_notes.id"
        },
        {
          "join_type": "INNER",
          "table_name": "shipment_status",
          "join_condition": "shipment_delivery_notes.shipment_status_id = shipment_status.id"
        },
        {
          "join_type": "INNER",
          "table_name": "users",
          "join_condition": "delivery_notes.customer_id = users.id"
        }
      ],
      "company_id": 1,
      "search_all": [
        {
          "value": "$gparam_2",
          "operator": "=",
          "column_name": "shipment_location.id"
        }
      ],
      "print_query": false,
      "primary_table": "shipment_location",
      "select_columns": [
        [
          "shipment_location.otp_status",
          "otp_status"
        ],
        [
          "shipment_location.otp_number",
          "otp_number"
        ],
        [
          "COALESCE((SELECT JSON_AGG(JSON_BUILD_OBJECT('image', img)) FROM unnest(string_to_array(shipment_location.pod_images, ',')) AS img), '[]')",
          "pod_images"
        ],
        [
          "shipment_location.customer_signature",
          "customer_signature"
        ],
        [
          "customers_delivery_addresses.delivery_location",
          "delivery_location"
        ],
        [
          "delivery_notes.delivery_note_number",
          "delivery_note_number"
        ],
        [
          "shipment_status.name",
          "shipment_status"
        ],
        [
          "shipment_location.pod_at",
          "delivery_date"
        ],
        [
          "customers_delivery_addresses.delivery_address_lat_long",
          "delivery_address_lat_long"
        ],
        [
          "shipment_location.shipment_location_lat_long",
          "shipment_location_lat_long"
        ],
        [
          "users.username",
          "customer_username"
        ]
      ]
    }
  },
  {
    "name": "Shipment Load Details",
    "entity_name": "shipment_load_details",
    "entity_type": "static_page_builder_module",
    "static_page_content": "<div>{{!-- MULTIPLE RESULT CASE --}}{{#if result_data.[0]}}<div class=\"bg-gray-50 border rounded-lg p-4 shadow-sm\">{{!-- LOCATION (only once) --}}{{#if result_data.[0].address}}<div class=\"flex items-start justify-between mb-4\"><div class=\"flex flex-col gap-1\"><div class=\"flex items-start gap-2\"><div class=\"text-gray-600 text-sm\">Delivery Location:</div><div class=\"text-gray-700 text-sm leading-snug\">{{result_data.[0].address}}</div></div>{{!-- DATE --}}{{#if result_data.[0].delivery_date}}<div class=\"text-xs text-gray-500 ml-6\">Loaded Date : {{result_data.[0].delivery_date}}</div>{{/if}}</div><button class=\"btn btn-primary rounded-half\" id=\"redirectBtn\"><i class=\"fa-solid fa-download text-white text-lg\"></i></button></div>{{/if}}{{!-- MULTIPLE DELIVERY NOTE NUMBERS --}}{{#each result_data}}<div class=\"flex justify-between items-center bg-white border rounded-full px-3 py-1 text-sm shadow-sm mb-2\"><span class=\"text-gray-700 font-medium\">DN No: {{delivery_note_number}}</span><span class=\"bg-green-100 text-green-700 text-xs font-semibold px-2 py-1 rounded-full\">{{shipment_status}}</span></div>{{/each}}{{!-- IMAGES --}}{{#if result_data.[0].loaded_images}}<div class=\"border-t border-dotted pt-3 mt-3\"><strong class=\"block mb-2 text-gray-800 text-sm\">Loaded Item Images</strong><div class=\"flex flex-wrap gap-3\">{{#each result_data.[0].loaded_images}}<div class=\"w-20 h-20 rounded-lg overflow-hidden border shadow-sm\"><img src=\"https://deliveryapp.altaiseer.com/lcp-altaiseer-api/{{image}}\" class=\"w-full h-full object-cover hover:scale-105 transition-transform\" /></div>{{/each}}</div></div>{{/if}}</div>{{else}}{{!-- SINGLE RESULT CASE --}}<div class=\"bg-gray-50 border rounded-lg p-4 shadow-sm\"><div class=\"flex items-start justify-between mb-4\"><div class=\"flex flex-col gap-1\"><div class=\"flex items-start gap-2\"><div class=\"text-gray-600 text-sm\">Delivery Location:</div><div class=\"text-gray-700 text-sm leading-snug\">{{result_data.address}}</div></div>{{!-- DATE --}}{{#if result_data.delivery_date}}<div class=\"text-xs text-gray-500 ml-6\">Loaded Date : {{result_data.delivery_date}}</div>{{/if}}</div><button class=\"btn btn-primary rounded-full\" id=\"redirectBtn\"><i class=\"fa-solid fa-download text-white text-lg\"></i></button></div><div class=\"flex justify-between items-center bg-white border rounded-full px-3 py-1 text-sm shadow-sm mb-2\"><span class=\"text-gray-700 font-medium\">DN No: {{result_data.delivery_note_number}}</span><span class=\"bg-green-100 text-green-700 text-xs font-semibold px-2 py-1 rounded-full\">{{result_data.shipment_status}}</span></div><div class=\"border-t border-dotted pt-3 mt-3\"><strong class=\"block mb-2 text-gray-800 text-sm\">Loaded Item Images</strong><div class=\"flex flex-wrap gap-3\">{{#each result_data.loaded_images}}<div class=\"w-20 h-20 rounded-lg overflow-hidden border shadow-sm\"><img src=\"https://deliveryapp.altaiseer.com/lcp-altaiseer-api/{{image}}\" class=\"w-full h-full object-cover hover:scale-105 transition-transform\" /></div>{{/each}}</div></div></div>{{/if}}</div>",
    "primary_table": "shipment_customers",
    "query_information": {
      "includes": [
        {
          "join_type": "INNER",
          "table_name": "customers_delivery_addresses cda",
          "join_condition": "shipment_location.customer_address_id = cda.id"
        },
        {
          "join_type": "INNER",
          "table_name": "shipment_delivery_notes sdn",
          "join_condition": "shipment_location.shipment_location_uid = sdn.shipment_location_uid"
        },
        {
          "join_type": "INNER",
          "table_name": "delivery_notes dn",
          "join_condition": "sdn.delivery_note_id = dn.id"
        },
        {
          "join_type": "INNER",
          "table_name": "shipment_status",
          "join_condition": "sdn.shipment_status_id = shipment_status.id"
        }
      ],
      "company_id": 1,
      "search_all": [
        {
          "value": "$gparam_2",
          "operator": "=",
          "column_name": "shipment_location.id"
        }
      ],
      "limit_range": 10,
      "print_query": false,
      "primary_table": "shipment_location",
      "select_columns": [
        [
          "COALESCE((SELECT JSON_AGG(JSON_BUILD_OBJECT('image', img)) FROM unnest(string_to_array(shipment_location.loaded_images, ',')) AS img), '[]')",
          "loaded_images"
        ],
        [
          "cda.delivery_location",
          "address"
        ],
        [
          "dn.delivery_note_number",
          "delivery_note_number"
        ],
        [
          "shipment_status.name",
          "shipment_status"
        ],
        [
          "shipment_location.loaded_at",
          "delivery_date"
        ]
      ]
    }
  },
  {
    "name": "Shipment Edit Page",
    "entity_name": "edit_shipment_management",
    "entity_type": "shipment_edit_page_module",
    "is_admin_module": true,
    "static_page_content": null,
    "primary_table": null,
    "query_information": null,
    "company_id": 1,
    "lineitems": []
  },
  {
    "name": "Reset Password Driver Job",
    "entity_name": "reset_password_grid_drivers",
    "entity_type": "common_permission_module",
    "is_admin_module": true,
    "static_page_content": null,
    "primary_table": null,
    "query_information": null,
    "company_id": 1,
    "lineitems": []
  },
  {
    "name": "Reset Password Driver",
    "entity_name": "reset_password_driver_list",
    "entity_type": "common_permission_module",
    "is_admin_module": true,
    "static_page_content": null,
    "primary_table": null,
    "query_information": null,
    "company_id": 1,
    "lineitems": []
  },
  {
    "name": "Vehicle GPS Tracking Data",
    "entity_name": "vehicle_gps_tracking_data",
    "entity_type": "grid_builder_module",
    "static_page_content": null,
    "primary_table": "vehicle_gps_data",
    "query_information": {
      "includes": [
        {
          "join_type": "INNER",
          "table_name": "vehicles vs",
          "join_condition": "vs.id = vehicle_gps_data.vehicle_id"
        },
        {
          "join_type": "INNER",
          "table_name": "users u",
          "join_condition": "u.id = vehicle_gps_data.driver_id"
        },
        {
          "join_type": "INNER",
          "table_name": "user_details ud",
          "join_condition": "ud.user_id = u.id"
        },
        {
          "join_type": "LEFT",
          "table_name": "shipments",
          "join_condition": "shipments.id = vehicle_gps_data.shipment_id"
        }
      ],
      "print_query": false,
      "sort_columns": [
        [
          "vehicle_gps_data.id",
          "desc"
        ]
      ]
    },
    "company_id": 1,
    "lineitems": [
      {
        "master_grid_id": 0,
        "field_name": "vehicle_gps_data.id",
        "display_name": "id",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "vehicle_gps_data.uuid",
        "display_name": "uuid",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "COALESCE(ud.first_name || ' ' || ud.last_name)",
        "display_name": "driver_name",
        "order_no": 1,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "vs.vehicle_plate_number",
        "display_name": "vehicle_plate_number",
        "order_no": 2,
        "is_grid_column": true,
        "is_searchable": false,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "vs.vehicle_register_number",
        "display_name": "vehicle_register_number",
        "order_no": 3,
        "is_grid_column": true,
        "is_searchable": false,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "CONCAT(vehicle_gps_data.latitude, ',', vehicle_gps_data.longitude)",
        "display_name": "latitude_longitude",
        "order_no": 4,
        "is_grid_column": true,
        "is_searchable": false,
        "is_sortable": true,
        "field_type_id": 1,
        "company_id": 1,
        "field_html_content": "<a class=\"inline-flex items-center gap-1 px-2 py-0.5 text-xs rounded-full bg-sky-50 text-sky-700 border border-sky-200 hover:bg-sky-100\" href=\"https://www.google.com/maps?q={{ row_object.latitude_longitude }}\" target=\"_blank\">{{row_object.latitude_longitude}}</a>"
      },
      {
        "master_grid_id": 0,
        "field_name": "vehicle_gps_data.gps_timestamp",
        "display_name": "GPS Timestamp",
        "order_no": 5,
        "is_grid_column": true,
        "is_searchable": false,
        "is_sortable": true,
        "field_type_id": 7,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "shipments.shipment_number",
        "display_name": "shipment_number",
        "order_no": 6,
        "is_grid_column": true,
        "is_searchable": false,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      }
    ]
  },
  {
    "name": "Popup Details For Shipment Location",
    "entity_name": "popup_details_for_shipment_location",
    "entity_type": "static_page_builder_module",
    "static_page_content": "<div> {{#if result_data.[0]}} <div> {{!-- LOCATION & CUSTOMER BLOCK --}} {{#if result_data.[0].delivery_location}} <div class=\"flex items-start justify-between mb-4\"> <div class=\"flex flex-col gap-1\"> {{!-- CUSTOMER NAME --}} {{#if result_data.[0].customer_name}} <div class=\"text-sm text-gray-800 ml-6\"> Customer Name: <span class=\"font-semibold text-gray-900\"> {{result_data.[0].customer_name}} </span> </div> {{/if}} {{!-- DELIVERY LOCATION --}} <div class=\"flex items-start gap-2\"> <div class=\"text-gray-800 text-sm\">Delivery Location:</div> <div class=\"text-gray-700 text-sm leading-snug\"> {{result_data.[0].delivery_location}} </div> </div> {{!-- OTP --}} {{#if result_data.[0].otp}} <div class=\"text-sm text-gray-800 ml-6\"> OTP: <span class=\"font-semibold text-gray-900\"> {{result_data.[0].otp}} </span> </div> {{/if}} </div> <button class=\"btn btn-primary rounded-half\" id=\"redirectBtn\"> <i class=\"fa-solid fa-download text-white text-lg\"></i> </button> </div> {{/if}} {{!-- DELIVERY NOTE NUMBERS --}} {{#each result_data}} <div class=\"bg-gray-50 border rounded-lg p-3 mb-3 shadow-sm\"> <div class=\"flex justify-between items-center bg-white border rounded-full px-3 py-1 text-sm shadow-sm\"> <span class=\"text-gray-700 font-medium\"> Shipment No: {{shipment_number}} </span> <span class=\"bg-blue-100 text-blue-700 text-sm font-semibold px-2 py-1 rounded-full\"> {{delivery_note_numbers}} </span> </div> </div> {{/each}} </div> {{else}} {{!-- SINGLE RESULT FALLBACK --}} <div> {{#if result_data.delivery_location}} <div class=\"flex items-start justify-between mb-4\"> <div class=\"flex flex-col gap-1\"> {{#if result_data.customer_name}} <div class=\"text-sm text-gray-800 ml-6\"> Customer Name: <span class=\"font-semibold text-gray-900\"> {{result_data.customer_name}} </span> </div> {{/if}} <div class=\"flex items-start gap-2\"> <div class=\"text-gray-800 text-sm\">Delivery Location:</div> <div class=\"text-gray-700 text-sm leading-snug\"> {{result_data.delivery_location}} </div> </div> {{#if result_data.otp}} <div class=\"text-sm text-gray-800 ml-6\"> OTP: <span class=\"font-semibold text-gray-900\"> {{result_data.otp}} </span> </div> {{/if}} </div> <button class=\"btn btn-primary p-2 rounded-half\" id=\"redirectBtn\"> <i class=\"fa-solid fa-download text-white text-lg\"></i> </button> </div> {{/if}} <div class=\"bg-gray-50 border rounded-lg p-3 mb-4\"> <div class=\"flex justify-between items-center bg-white border rounded-full px-3 py-1 text-sm shadow-sm\"> <span class=\"text-gray-700 font-medium\"> Shipment No: {{result_data.shipment_number}} </span> <span class=\"bg-blue-100 text-blue-700 text-sm font-semibold px-2 py-1 rounded-full\"> {{result_data.delivery_note_numbers}} </span> </div> </div> </div> {{/if}} </div>",
    "query_information": {
      "group_by": [
        "shipments.id",
        "shipments.uuid",
        "shipments.shipment_number",
        "user_details.code",
        "user_details.first_name",
        "user_details.last_name",
        "customers_delivery_addresses.delivery_location",
        "shipment_location.pod_images",
        "shipment_location.customer_signature",
        "shipment_location.shipment_location_uid",
        "shipment_location.otp_number"
      ],
      "includes": [
        {
          "join_type": "LEFT",
          "table_name": "shipment_customers",
          "join_condition": "shipment_customers.shipment_id = shipments.id AND shipment_customers.company_id = shipments.company_id"
        },
        {
          "join_type": "LEFT",
          "table_name": "user_details",
          "join_condition": "user_details.user_id = shipment_customers.customer_id AND user_details.company_id = shipments.company_id"
        },
        {
          "join_type": "LEFT",
          "table_name": "shipment_location",
          "join_condition": "shipment_location.shipment_id = shipments.id AND shipment_location.shipment_customer_uid = shipment_customers.shipment_customer_uid AND shipment_location.company_id = shipments.company_id"
        },
        {
          "join_type": "LEFT",
          "table_name": "customers_delivery_addresses",
          "join_condition": "customers_delivery_addresses.id = shipment_location.customer_address_id AND customers_delivery_addresses.company_id = shipments.company_id"
        },
        {
          "join_type": "LEFT",
          "table_name": "shipment_delivery_notes",
          "join_condition": "shipment_delivery_notes.shipment_id = shipments.id AND shipment_delivery_notes.shipment_location_uid = shipment_location.shipment_location_uid AND shipment_delivery_notes.company_id = shipments.company_id AND shipment_delivery_notes.deleted_at IS NULL"
        },
        {
          "join_type": "LEFT",
          "table_name": "delivery_notes",
          "join_condition": "delivery_notes.id = shipment_delivery_notes.delivery_note_id AND delivery_notes.company_id = shipments.company_id AND delivery_notes.deleted_at IS NULL"
        },
        {
          "join_type": "LEFT",
          "table_name": "delivery_note_line_items",
          "join_condition": "delivery_note_line_items.delivery_note_id = delivery_notes.id AND delivery_note_line_items.company_id = shipments.company_id AND delivery_note_line_items.deleted_at IS NULL"
        }
      ],
      "company_id": 1,
      "search_all": [
        {
          "value": "1",
          "operator": "=",
          "column_name": "shipments.company_id"
        },
        {
          "value": "3",
          "operator": "!=",
          "column_name": "shipments.status_id"
        },
        {
          "value": "6",
          "operator": "=",
          "column_name": "shipments.shipment_status_id"
        },
        {
          "value": "$unique_id",
          "operator": "=",
          "column_name": "shipments.uuid"
        }
      ],
      "print_query": false,
      "sort_columns": [
        [
          "shipments.shipment_number",
          "desc"
        ]
      ],
      "primary_table": "shipments",
      "select_columns": [
        [
          "shipment_location.shipment_location_uid",
          "gparam_2"
        ],
        [
          "shipments.uuid",
          "uuid"
        ],
        [
          "shipment_location.shipment_location_uid",
          "gparam_1"
        ],
        [
          "shipments.shipment_number",
          "shipment_number"
        ],
        [
          "user_details.code",
          "customer_code"
        ],
        [
          "user_details.first_name || ' ' || COALESCE(user_details.last_name, '')",
          "customer_name"
        ],
        [
          "customers_delivery_addresses.delivery_location",
          "delivery_location"
        ],
        [
          "STRING_AGG(DISTINCT delivery_notes.delivery_note_number, ', ')",
          "delivery_note_numbers"
        ],
        [
          "shipment_location.otp_number",
          "otp"
        ]
      ]
    }
  },
  {
    "name": "Popup Details For Shipment List",
    "entity_name": "popup_details_for_shipment_list",
    "entity_type": "static_page_builder_module",
    "static_page_content": "<div> {{#if result_data.[0]}} <div> {{!-- LOCATION & CUSTOMER BLOCK --}} {{#if result_data.[0].delivery_location}} <div class=\"flex items-start justify-between mb-4\"> <div class=\"flex flex-col gap-1\"> {{!-- CUSTOMER NAME --}} {{#if result_data.[0].customer_name}} <div class=\"text-sm text-gray-800 ml-6\"> Customer Name: <span class=\"font-semibold text-gray-900\"> {{result_data.[0].customer_name}} </span> </div> {{/if}} {{!-- DELIVERY LOCATION --}} <div class=\"flex items-start gap-2\"> <div class=\"text-gray-800 text-sm\">Delivery Location:</div> <div class=\"text-gray-700 text-sm leading-snug\"> {{result_data.[0].delivery_location}} </div> </div> {{!-- OTP --}} {{#if result_data.[0].otp}} <div class=\"text-sm text-gray-800 ml-6\"> OTP: <span class=\"font-semibold text-gray-900\"> {{result_data.[0].otp}} </span> </div> {{/if}} </div> <button class=\"btn btn-primary rounded-half\" id=\"redirectBtn\"> <i class=\"fa-solid fa-download text-white text-lg\"></i> </button> </div> {{/if}} {{!-- DELIVERY NOTE NUMBERS --}} {{#each result_data}} <div class=\"bg-gray-50 border rounded-lg p-3 mb-3 shadow-sm\"> <div class=\"flex justify-between items-center bg-white border rounded-full px-3 py-1 text-sm shadow-sm\"> <span class=\"text-gray-700 font-medium\"> Shipment No: {{shipment_number}} </span> <span class=\"bg-blue-100 text-blue-700 text-sm font-semibold px-2 py-1 rounded-full\"> {{delivery_note_numbers}} </span> </div> </div> {{/each}} </div> {{else}} {{!-- SINGLE RESULT FALLBACK --}} <div> {{#if result_data.delivery_location}} <div class=\"flex items-start justify-between mb-4\"> <div class=\"flex flex-col gap-1\"> {{#if result_data.customer_name}} <div class=\"text-sm text-gray-800 ml-6\"> Customer Name: <span class=\"font-semibold text-gray-900\"> {{result_data.customer_name}} </span> </div> {{/if}} <div class=\"flex items-start gap-2\"> <div class=\"text-gray-800 text-sm\">Delivery Location:</div> <div class=\"text-gray-700 text-sm leading-snug\"> {{result_data.delivery_location}} </div> </div> {{#if result_data.otp}} <div class=\"text-sm text-gray-800 ml-6\"> OTP: <span class=\"font-semibold text-gray-900\"> {{result_data.otp}} </span> </div> {{/if}} </div> <button class=\"btn btn-primary p-2 rounded-half\" id=\"redirectBtn\"> <i class=\"fa-solid fa-download text-white text-lg\"></i> </button> </div> {{/if}} <div class=\"bg-gray-50 border rounded-lg p-3 mb-4\"> <div class=\"flex justify-between items-center bg-white border rounded-full px-3 py-1 text-sm shadow-sm\"> <span class=\"text-gray-700 font-medium\"> Shipment No: {{result_data.shipment_number}} </span> <span class=\"bg-blue-100 text-blue-700 text-sm font-semibold px-2 py-1 rounded-full\"> {{result_data.delivery_note_numbers}} </span> </div> </div> </div> {{/if}} </div>",
    "query_information": {
      "group_by": [
        "shipments.id",
        "shipments.uuid",
        "shipments.shipment_number",
        "user_details.code",
        "user_details.first_name",
        "user_details.last_name",
        "customers_delivery_addresses.delivery_location",
        "shipment_location.pod_images",
        "shipment_location.customer_signature",
        "shipment_location.shipment_location_uid",
        "shipment_location.otp_number"
      ],
      "includes": [
        {
          "join_type": "LEFT",
          "table_name": "shipment_customers",
          "join_condition": "shipment_customers.shipment_id = shipments.id AND shipment_customers.company_id = shipments.company_id"
        },
        {
          "join_type": "LEFT",
          "table_name": "user_details",
          "join_condition": "user_details.user_id = shipment_customers.customer_id AND user_details.company_id = shipments.company_id"
        },
        {
          "join_type": "LEFT",
          "table_name": "shipment_location",
          "join_condition": "shipment_location.shipment_id = shipments.id AND shipment_location.shipment_customer_uid = shipment_customers.shipment_customer_uid AND shipment_location.company_id = shipments.company_id"
        },
        {
          "join_type": "LEFT",
          "table_name": "customers_delivery_addresses",
          "join_condition": "customers_delivery_addresses.id = shipment_location.customer_address_id AND customers_delivery_addresses.company_id = shipments.company_id"
        },
        {
          "join_type": "LEFT",
          "table_name": "shipment_delivery_notes",
          "join_condition": "shipment_delivery_notes.shipment_id = shipments.id AND shipment_delivery_notes.shipment_location_uid = shipment_location.shipment_location_uid AND shipment_delivery_notes.company_id = shipments.company_id AND shipment_delivery_notes.deleted_at IS NULL"
        },
        {
          "join_type": "LEFT",
          "table_name": "delivery_notes",
          "join_condition": "delivery_notes.id = shipment_delivery_notes.delivery_note_id AND delivery_notes.company_id = shipments.company_id AND delivery_notes.deleted_at IS NULL"
        },
        {
          "join_type": "LEFT",
          "table_name": "delivery_note_line_items",
          "join_condition": "delivery_note_line_items.delivery_note_id = delivery_notes.id AND delivery_note_line_items.company_id = shipments.company_id AND delivery_note_line_items.deleted_at IS NULL"
        }
      ],
      "company_id": 1,
      "search_all": [
        {
          "value": "1",
          "operator": "=",
          "column_name": "shipments.company_id"
        },
        {
          "value": "3",
          "operator": "!=",
          "column_name": "shipments.status_id"
        },
        {
          "value": "6",
          "operator": "=",
          "column_name": "shipments.shipment_status_id"
        },
        {
          "value": "$unique_id",
          "operator": "=",
          "column_name": "shipments.uuid"
        }
      ],
      "print_query": false,
      "sort_columns": [
        [
          "shipments.shipment_number",
          "desc"
        ]
      ],
      "primary_table": "shipments",
      "select_columns": [
        [
          "shipments.shipment_number",
          "shipment_number"
        ],
        [
          "user_details.code",
          "customer_code"
        ],
        [
          "user_details.first_name || ' ' || COALESCE(user_details.last_name, '')",
          "customer_name"
        ],
        [
          "customers_delivery_addresses.delivery_location",
          "delivery_location"
        ],
        [
          "STRING_AGG(DISTINCT delivery_notes.delivery_note_number, ', ')",
          "delivery_note_numbers"
        ],
        [
          "shipment_location.otp_number",
          "otp"
        ]
      ]
    }
  },
  {
    "name": "No of DNs Received and Delivered",
    "entity_name": "no_of_dns_received_delivered",
    "entity_type": "grid_builder_module",
    "static_page_content": null,
    "primary_table": "view_shipments_delivery_notes_summary",
    "associated_tables": [],
    "query_information": {},
    "company_id": 1,
    "lineitems": [
      {
        "master_grid_id": 0,
        "field_name": "view_shipments_delivery_notes_summary.date",
        "display_name": "date",
        "order_no": 1,
        "is_grid_column": true,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 5,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "view_shipments_delivery_notes_summary.no_of_dn_delivered",
        "display_name": "dn_delivered",
        "order_no": 2,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "view_shipments_delivery_notes_summary.no_of_dn_received",
        "display_name": "dn_received",
        "order_no": 3,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 1,
        "company_id": 1
      }
    ]
  },
  {
    "name": "No of Dns Age",
    "entity_name": "no_of_dns_age",
    "entity_type": "grid_builder_module",
    "static_page_content": null,
    "primary_table": "delivery_notes",
    "associated_tables": [],
    "query_information": {
      "cte": "WITH selected_shipment_dns AS ( SELECT sdn.* FROM shipment_delivery_notes sdn JOIN shipments s ON s.id = sdn.shipment_id AND s.shipment_status_id != 8 )",
      "company_id": 1,
      "print_query": false,
      "includes": [
        {
          "table_name": "selected_shipment_dns ssdn",
          "join_type": "LEFT",
          "join_condition": "delivery_notes.id = ssdn.delivery_note_id"
        }
      ],
      "group_by": [
        "DATE(delivery_notes.date_of_issue)"
      ],
      "having_conditions": [
        {
          "column_name": "SUM(CASE WHEN ssdn.delivery_note_id IS NULL THEN 1 ELSE 0 END)",
          "value": 0,
          "operator": ">"
        }
      ],
      "sort_columns": [
        [
          "date_of_issue",
          "desc"
        ]
      ]
    },
    "company_id": 1,
    "lineitems": [
      {
        "master_grid_id": 0,
        "field_name": "DATE(delivery_notes.date_of_issue)",
        "display_name": "gparam_1",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 5,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "DATE(delivery_notes.date_of_issue)",
        "display_name": "date_of_issue",
        "order_no": 1,
        "is_grid_column": true,
        "is_searchable": false,
        "is_sortable": true,
        "field_type_id": 5,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "CURRENT_DATE - DATE(delivery_notes.date_of_issue)",
        "display_name": "age",
        "order_no": 2,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 1,
        "company_id": 1,
        "clause_type": "having"
      },
      {
        "master_grid_id": 0,
        "field_name": "COUNT(*) FILTER (WHERE ssdn.delivery_note_id IS NULL)",
        "display_name": "no_of_dns",
        "order_no": 3,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 1,
        "clause_type": "having",
        "company_id": 1,
        "link_type": "child_grid",
        "link_action": "dashboard_delivery_notes_list",
        "link_mode": "child_details"
      }
    ]
  },
  {
    "name": "Vehicle List",
    "entity_name": "vehicle_list",
    "entity_type": "grid_builder_module",
    "static_page_content": null,
    "primary_table": "vehicles",
    "query_information": {
      "group_by": [
        "vehicles.id",
        "vehicles.uuid",
        "vehicles.vehicle_plate_number",
        "vehicles.vehicle_register_number"
      ],
      "includes": [
        {
          "join_type": "INNER",
          "table_name": "vehicle_user_mapping",
          "join_condition": "vehicles.id = vehicle_user_mapping.vehicle_id"
        }
      ],
      "print_query": false
    },
    "company_id": 1,
    "lineitems": [
      {
        "master_grid_id": 0,
        "field_name": "vehicles.id",
        "display_name": "id",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "vehicles.id",
        "display_name": "gparam_1",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "vehicles.uuid",
        "display_name": "uuid",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "vehicles.vehicle_plate_number",
        "display_name": "vehicle_plate_number",
        "order_no": 1,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "vehicles.vehicle_register_number",
        "display_name": "vehicle_register_number",
        "order_no": 2,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      }
    ]
  },
  {
    "name": "Driver List",
    "entity_name": "driver_list",
    "entity_type": "grid_builder_module",
    "static_page_content": null,
    "primary_table": "users",
    "query_information": {
      "includes": [
        {
          "join_type": "INNER",
          "table_name": "vehicle_user_mapping",
          "join_condition": "users.id = vehicle_user_mapping.user_id"
        },
        {
          "join_type": "LEFT",
          "table_name": "user_details",
          "join_condition": "user_details.user_id = users.id"
        },
        {
          "join_type": "LEFT",
          "table_name": "vehicles",
          "join_condition": "vehicles.id = vehicle_user_mapping.vehicle_id"
        }
      ],
      "search_all": [
        {
          "value": "$gparam_1",
          "operator": "=",
          "column_name": "vehicle_user_mapping.vehicle_id"
        }
      ],
      "print_query": false,
      "sort_columns": [
        [
          "users.id",
          "desc"
        ]
      ]
    },
    "company_id": 1,
    "lineitems": [
      {
        "master_grid_id": 0,
        "field_name": "users.id",
        "display_name": "id",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "users.uuid",
        "display_name": "uuid",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "users.id",
        "display_name": "gparam_1",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "CONCAT(user_details.first_name, ' ', COALESCE(user_details.last_name, ''))",
        "display_name": "full_name",
        "order_no": 1,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "users.email",
        "display_name": "email",
        "order_no": 2,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "concat(user_details.country_code, ' ', user_details.phone_number)",
        "display_name": "phone_number",
        "order_no": 3,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "user_details.passport_number",
        "display_name": "passport_number",
        "order_no": 4,
        "is_grid_column": true,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "vehicle_user_mapping.status_id",
        "display_name": "status",
        "order_no": 5,
        "is_grid_column": true,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 1,
        "company_id": 1
      }
    ]
  },
  {
    "name": "Overall Delivery Notes",
    "entity_name": "overall_delivery_notes",
    "entity_type": "grid_builder_module",
    "static_page_content": null,
    "primary_table": "delivery_notes",
    "associated_tables": [],
    "query_information": {
      "cte": "WITH ShipmentFilteredDeliveryNotes AS ( SELECT shipment_delivery_notes.* FROM shipments JOIN shipment_delivery_notes ON shipments.id = shipment_delivery_notes.shipment_id WHERE shipments.shipment_status_id != 8 )",
      "includes": [
        {
          "join_type": "LEFT",
          "table_name": "ShipmentFilteredDeliveryNotes",
          "join_condition": "ShipmentFilteredDeliveryNotes.delivery_note_id = delivery_notes.id AND ShipmentFilteredDeliveryNotes.company_id = delivery_notes.company_id"
        },
        {
          "join_type": "LEFT",
          "table_name": "shipments",
          "join_condition": "shipments.id = ShipmentFilteredDeliveryNotes.shipment_id AND shipments.company_id = ShipmentFilteredDeliveryNotes.company_id"
        },
        {
          "join_type": "LEFT",
          "table_name": "shipment_status",
          "join_condition": "shipment_status.id = shipments.shipment_status_id"
        }
      ],
      "company_id": 1,
      "search_all": [
        {
          "value": 1,
          "operator": "=",
          "column_name": "delivery_notes.company_id"
        },
        {
          "value": 3,
          "operator": "!=",
          "column_name": "delivery_notes.status_id"
        }
      ],
      "print_query": false,
      "sort_columns": [
        [
          "delivery_notes.id",
          "desc"
        ]
      ]
    },
    "company_id": 1,
    "lineitems": [
      {
        "master_grid_id": 0,
        "field_name": "delivery_notes.id",
        "display_name": "id",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "delivery_notes.uuid",
        "display_name": "uuid",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "delivery_notes.delivery_note_number",
        "display_name": "delivery_note_number",
        "order_no": 1,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "delivery_notes.date_of_issue",
        "display_name": "date_of_issue",
        "order_no": 2,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 7,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "delivery_notes.customer_order_number",
        "display_name": "customer_order_number",
        "order_no": 3,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "delivery_notes.reference_number",
        "display_name": "reference_number",
        "order_no": 4,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "delivery_notes.shipment_type",
        "display_name": "shipment_type",
        "order_no": 5,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "delivery_notes.supply_agreement",
        "display_name": "supply_agreement",
        "order_no": 6,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "delivery_notes.purchase_reference",
        "display_name": "purchase_reference",
        "order_no": 7,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "shipments.shipment_number",
        "display_name": "shipment_number",
        "order_no": 8,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "shipment_status.name",
        "display_name": "shipment_status",
        "order_no": 9,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      }
    ]
  },
  {
    "name": "Dashboard Delivery Notes List",
    "entity_name": "dashboard_delivery_notes_list",
    "entity_type": "grid_builder_module",
    "static_page_content": null,
    "primary_table": "delivery_notes",
    "associated_tables": [],
    "query_information": {
      "group_by": [
        "delivery_notes.id"
      ],
      "includes": [
        {
          "join_type": "LEFT",
          "table_name": "delivery_note_line_items",
          "join_condition": "delivery_notes.id = delivery_note_line_items.delivery_note_id"
        },
        {
          "join_type": "LEFT",
          "table_name": "shipment_delivery_notes",
          "join_condition": "delivery_notes.id = shipment_delivery_notes.delivery_note_id"
        },
        {
          "join_type": "LEFT",
          "table_name": "shipments",
          "join_condition": "shipments.id = shipment_delivery_notes.shipment_id AND shipments.shipment_status_id = 6"
        }
      ],
      "company_id": 1,
      "search_all": [
        {
          "value": "$gparam_1",
          "operator": "=",
          "column_name": "DATE(delivery_notes.date_of_issue)"
        },
        {
          "column_name": "shipment_delivery_notes.delivery_note_id",
          "operator": "IS",
          "value": null
        }
      ],
      "print_query": false
    },
    "company_id": 1,
    "lineitems": [
      {
        "master_grid_id": 0,
        "field_name": "delivery_notes.id",
        "display_name": "id",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "delivery_notes.uuid",
        "display_name": "uuid",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "delivery_notes.id",
        "display_name": "gparam_1",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "delivery_notes.delivery_note_number",
        "display_name": "delivery_note_number",
        "order_no": 1,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "delivery_notes.reference_number",
        "display_name": "reference_number",
        "order_no": 3,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "delivery_notes.date_of_issue",
        "display_name": "date_of_issue",
        "order_no": 4,
        "is_grid_column": true,
        "is_searchable": false,
        "is_sortable": true,
        "field_type_id": 7,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "delivery_notes.customer_delivery_contact_name",
        "display_name": "delivery_contact_name",
        "order_no": 5,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "delivery_notes.customer_delivery_contact_email",
        "display_name": "delivery_contact_email",
        "order_no": 6,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "delivery_notes.customer_delivery_contact_number",
        "display_name": "delivery_contact_number",
        "order_no": 7,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "count(delivery_note_line_items.id)",
        "display_name": "no_of_items",
        "order_no": 2,
        "is_grid_column": true,
        "is_searchable": false,
        "is_sortable": true,
        "field_type_id": 1,
        "company_id": 1
      }
    ]
  },
  {
    "name": "Detailed Shipment List",
    "entity_name": "detailed_shipment_list",
    "entity_type": "grid_builder_module",
    "static_page_content": null,
    "primary_table": "shipments",
    "associated_tables": [],
    "query_information": {
      "group_by": [
        "shipments.id",
        "shipments.uuid",
        "shipments.shipment_number",
        "user_details.code",
        "user_details.first_name",
        "user_details.last_name",
        "customers_delivery_addresses.delivery_location",
        "customers_delivery_addresses.customer_contact_no",
        "delivery_notes.delivery_note_number",
        "delivery_notes.date_of_issue",
        "delivery_notes.customer_order_number",
        "delivery_notes.reference_number",
        "delivery_notes.shipment_type",
        "delivery_notes.customer_delivery_contact_name",
        "delivery_notes.customer_delivery_contact_number",
        "delivery_notes.customer_delivery_contact_email",
        "delivery_note_line_items.item_code",
        "delivery_note_line_items.slip_no",
        "delivery_note_line_items.section_number",
        "delivery_note_line_items.quantity",
        "delivery_note_line_items.weight",
        "delivery_note_line_items.item_description",
        "delivery_note_line_items.length"
      ],
      "includes": [
        {
          "join_type": "INNER",
          "table_name": "shipment_customers",
          "join_condition": "shipment_customers.shipment_id = shipments.id AND shipment_customers.company_id = shipments.company_id"
        },
        {
          "join_type": "INNER",
          "table_name": "user_details",
          "join_condition": "user_details.user_id = shipment_customers.customer_id AND user_details.company_id = shipments.company_id"
        },
        {
          "join_type": "INNER",
          "table_name": "shipment_location",
          "join_condition": "shipment_location.shipment_id = shipments.id AND shipment_location.shipment_customer_uid = shipment_customers.shipment_customer_uid AND shipment_location.company_id = shipments.company_id"
        },
        {
          "join_type": "INNER",
          "table_name": "customers_delivery_addresses",
          "join_condition": "customers_delivery_addresses.id = shipment_location.customer_address_id AND customers_delivery_addresses.company_id = shipments.company_id"
        },
        {
          "join_type": "INNER",
          "table_name": "shipment_delivery_notes",
          "join_condition": "shipment_delivery_notes.shipment_id = shipments.id AND shipment_delivery_notes.shipment_location_uid = shipment_location.shipment_location_uid AND shipment_delivery_notes.company_id = shipments.company_id AND shipment_delivery_notes.deleted_at IS NULL"
        },
        {
          "join_type": "INNER",
          "table_name": "delivery_notes",
          "join_condition": "delivery_notes.id = shipment_delivery_notes.delivery_note_id AND delivery_notes.company_id = shipments.company_id AND delivery_notes.deleted_at IS NULL"
        },
        {
          "join_type": "INNER",
          "table_name": "delivery_note_line_items",
          "join_condition": "delivery_note_line_items.delivery_note_id = delivery_notes.id AND delivery_note_line_items.company_id = shipments.company_id AND delivery_note_line_items.deleted_at IS NULL"
        }
      ],
      "company_id": 1,
      "print_query": false,
      "sort_columns": [
        [
          "shipments.id",
          "desc"
        ]
      ]
    },
    "company_id": 1,
    "lineitems": [
      {
        "master_grid_id": 0,
        "field_name": "shipments.id",
        "display_name": "id",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "shipments.uuid",
        "display_name": "uuid",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "shipments.shipment_number",
        "display_name": "shipment_number",
        "order_no": 1,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "user_details.code",
        "display_name": "customer_code",
        "order_no": 2,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "user_details.first_name || ' ' || COALESCE(user_details.last_name, '')",
        "display_name": "customer_name",
        "order_no": 3,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "customers_delivery_addresses.delivery_location",
        "display_name": "delivery_location",
        "order_no": 4,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "customers_delivery_addresses.customer_contact_no",
        "display_name": "customer_contact_no",
        "order_no": 5,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "delivery_notes.delivery_note_number",
        "display_name": "delivery_note_number",
        "order_no": 6,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "delivery_notes.reference_number",
        "display_name": "reference_number",
        "order_no": 7,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "delivery_notes.date_of_issue",
        "display_name": "date_of_issue",
        "order_no": 8,
        "is_grid_column": true,
        "is_searchable": false,
        "is_sortable": true,
        "field_type_id": 7,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "delivery_notes.customer_delivery_contact_name",
        "display_name": "delivery_contact_name",
        "order_no": 9,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "delivery_notes.customer_delivery_contact_email",
        "display_name": "delivery_contact_email",
        "order_no": 10,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "delivery_notes.customer_delivery_contact_number",
        "display_name": "delivery_contact_number",
        "order_no": 11,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "delivery_note_line_items.item_code",
        "display_name": "item_code",
        "order_no": 12,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "delivery_note_line_items.item_description",
        "display_name": "item_description",
        "order_no": 13,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "delivery_note_line_items.slip_no",
        "display_name": "slip_no",
        "order_no": 14,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "delivery_note_line_items.section_number",
        "display_name": "section_number",
        "order_no": 15,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "delivery_note_line_items.quantity",
        "display_name": "quantity",
        "order_no": 16,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "delivery_note_line_items.length",
        "display_name": "length",
        "order_no": 17,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "delivery_note_line_items.weight",
        "display_name": "weight",
        "order_no": 18,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 1,
        "company_id": 1
      }
    ]
  },
  {
    "name": "pod_shipment_list",
    "entity_name": "pod_shipment_list",
    "entity_type": "grid_builder_module",
    "static_page_content": null,
    "primary_table": "shipments",
    "associated_tables": [],
    "query_information": {
      "group_by": [
        "shipments.id",
        "shipments.uuid",
        "shipments.shipment_number",
        "user_details.code",
        "user_details.first_name",
        "user_details.last_name",
        "customers_delivery_addresses.delivery_location",
        "shipment_location.pod_images",
        "shipment_location.customer_signature",
        "shipment_location.shipment_location_uid",
        "shipment_location.otp_number",
        "shipment_location.pod_at"
      ],
      "includes": [
        {
          "join_type": "LEFT",
          "table_name": "shipment_customers",
          "join_condition": "shipment_customers.shipment_id = shipments.id AND shipment_customers.company_id = shipments.company_id"
        },
        {
          "join_type": "LEFT",
          "table_name": "user_details",
          "join_condition": "user_details.user_id = shipment_customers.customer_id AND user_details.company_id = shipments.company_id"
        },
        {
          "join_type": "LEFT",
          "table_name": "shipment_location",
          "join_condition": "shipment_location.shipment_id = shipments.id AND shipment_location.shipment_customer_uid = shipment_customers.shipment_customer_uid AND shipment_location.company_id = shipments.company_id"
        },
        {
          "join_type": "LEFT",
          "table_name": "customers_delivery_addresses",
          "join_condition": "customers_delivery_addresses.id = shipment_location.customer_address_id AND customers_delivery_addresses.company_id = shipments.company_id"
        },
        {
          "join_type": "LEFT",
          "table_name": "shipment_delivery_notes",
          "join_condition": "shipment_delivery_notes.shipment_id = shipments.id AND shipment_delivery_notes.shipment_location_uid = shipment_location.shipment_location_uid AND shipment_delivery_notes.company_id = shipments.company_id AND shipment_delivery_notes.deleted_at IS NULL"
        },
        {
          "join_type": "LEFT",
          "table_name": "delivery_notes",
          "join_condition": "delivery_notes.id = shipment_delivery_notes.delivery_note_id AND delivery_notes.company_id = shipments.company_id AND delivery_notes.deleted_at IS NULL"
        },
        {
          "join_type": "LEFT",
          "table_name": "delivery_note_line_items",
          "join_condition": "delivery_note_line_items.delivery_note_id = delivery_notes.id AND delivery_note_line_items.company_id = shipments.company_id AND delivery_note_line_items.deleted_at IS NULL"
        }
      ],
      "company_id": 1,
      "search_all": [
        {
          "value": 3,
          "operator": "!=",
          "column_name": "shipments.status_id"
        },
        {
          "value": 6,
          "operator": "=",
          "column_name": "shipments.shipment_status_id"
        },
        {
          "value": 8,
          "operator": "!=",
          "column_name": "shipment_location.shipment_status_id"
        }
      ],
      "print_query": false,
      "sort_columns": [
        [
          "shipments.shipment_number",
          "desc"
        ]
      ]
    },
    "company_id": 1,
    "lineitems": [
      {
        "master_grid_id": 0,
        "field_name": "shipment_location.shipment_location_uid",
        "display_name": "gparam_2",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "shipments.uuid",
        "display_name": "uuid",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "shipments.shipment_number",
        "display_name": "shipment_number",
        "order_no": 1,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "user_details.code",
        "display_name": "customer_code",
        "order_no": 2,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "user_details.first_name || ' ' || COALESCE(user_details.last_name, '')",
        "display_name": "customer_name",
        "order_no": 3,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "customers_delivery_addresses.delivery_location",
        "display_name": "delivery_location",
        "order_no": 4,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "string_agg(DISTINCT delivery_notes.delivery_note_number, ', ')",
        "display_name": "delivery_note_numbers",
        "clause_type": "having",
        "order_no": 5,
        "is_grid_column": true,
        "is_searchable": false,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "shipment_location.otp_number",
        "display_name": "otp",
        "order_no": 6,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "(CASE WHEN shipment_location.pod_images IS NOT NULL AND shipment_location.pod_images <> '' THEN 'Yes' ELSE 'No' END)",
        "display_name": "pod_images",
        "order_no": 7,
        "is_grid_column": true,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 3,
        "company_id": 1,
        "link_action": "pod_image_details_page",
        "link_mode": "popup_details",
        "link_type": "component"
      },
      {
        "master_grid_id": 0,
        "field_name": "(CASE WHEN shipment_location.customer_signature IS NOT NULL AND shipment_location.customer_signature <> '' THEN 'Yes' ELSE 'No' END)",
        "display_name": "customer_signature",
        "order_no": 8,
        "is_grid_column": true,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 3,
        "company_id": 1,
        "link_action": "customer_signature_details_page",
        "link_mode": "popup_details",
        "link_type": "component"
      },
      {
        "master_grid_id": 0,
        "field_name": "shipment_location.shipment_location_uid",
        "display_name": "gparam_1",
        "order_no": 0,
        "is_grid_column": false,
        "is_searchable": false,
        "is_sortable": false,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "shipment_location.pod_at",
        "display_name": "pod_at",
        "order_no": 9,
        "is_grid_column": true,
        "is_searchable": false,
        "is_sortable": true,
        "field_type_id": 7,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "string_agg(DISTINCT delivery_notes.reference_number, ', ')",
        "display_name": "order_reference_numbers",
        "order_no": 5.1,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "clause_type": "having",
        "company_id": 1
      }
    ]
  },
  {
    "name": "POD's images Details Page",
    "entity_name": "pod_image_details_page",
    "entity_type": "static_page_builder_module",
    "static_page_content": "<div>{{!-- MULTIPLE RESULT CASE --}}{{#if result_data.[0]}}{{#if result_data.[0].pod_images}}<div class=\"border rounded-lg p-3 bg-gray-50\"><strong class=\"block mb-2 text-gray-800 text-sm\">POD Images</strong><div class=\"flex flex-wrap gap-3\">{{#each result_data.[0].pod_images}}<div class=\"w-20 h-20 rounded-lg overflow-hidden border shadow-sm\"><img src=\"https://deliveryapp.altaiseer.com/lcp-altaiseer-api/{{image}}\" alt=\"POD Image\" class=\"w-full h-full object-cover hover:scale-105 transition-transform\" /></div>{{/each}}</div></div>{{else}}<div class=\"text-sm text-gray-500\">POD Images: No</div>{{/if}}{{else}}{{#if result_data.pod_images}}<div class=\"border rounded-lg p-3 bg-gray-50\"><strong class=\"block mb-2 text-gray-800 text-sm\">POD Images</strong><div class=\"flex flex-wrap gap-3\">{{#each result_data.pod_images}}<div class=\"w-20 h-20 rounded-lg overflow-hidden border shadow-sm\"><img src=\"https://deliveryapp.altaiseer.com/lcp-altaiseer-api/{{image}}\" alt=\"POD Image\" class=\"w-full h-full object-cover hover:scale-105 transition-transform\" /></div>{{/each}}</div></div>{{else}}<div class=\"text-sm text-gray-500\">POD Images: No</div>{{/if}}{{/if}}</div>",
    "query_information": {
      "group_by": [
        "shipment_location.shipment_location_uid",
        "shipment_location.pod_images",
        "shipment_location.id"
      ],
      "company_id": 1,
      "search_all": [
        {
          "value": "$gparam_1",
          "operator": "=",
          "column_name": "shipment_location.shipment_location_uid"
        },
        {
          "value": null,
          "operator": "IS",
          "column_name": "shipment_location.deleted_at"
        }
      ],
      "limit_range": 15,
      "print_query": false,
      "start_index": 0,
      "sort_columns": [
        [
          "shipment_location.id",
          "desc"
        ]
      ],
      "primary_table": "shipment_location",
      "select_columns": [
        [
          "shipment_location.shipment_location_uid"
        ],
        [
          "COALESCE((SELECT JSON_AGG(JSON_BUILD_OBJECT('image', img)) FROM unnest(string_to_array(shipment_location.pod_images, ',')) AS img), '[]')",
          "pod_images"
        ]
      ]
    }
  },
  {
    "name": "Customer Signature Details Page",
    "entity_name": "customer_signature_details_page",
    "entity_type": "static_page_builder_module",
    "static_page_content": "<div>{{!-- MULTIPLE RESULT CASE --}}{{#if result_data.[0]}}{{#if result_data.[0].customer_signature}}<div class=\"border rounded-lg p-3 bg-gray-50\"><strong class=\"block mb-2 text-gray-800 text-sm\">Customer Signature Images</strong><div class=\"flex flex-wrap gap-3\">{{#each result_data.[0].customer_signature}}<div class=\"w-20 h-20 rounded-lg overflow-hidden border shadow-sm\"><img src=\"https://deliveryapp.altaiseer.com/lcp-altaiseer-api/{{image}}\" alt=\"Customer Signature Image\" class=\"w-full h-full object-cover hover:scale-105 transition-transform\" /></div>{{/each}}</div></div>{{else}}<div class=\"text-sm text-gray-500\">POD Images: No</div>{{/if}}{{else}}{{#if result_data.customer_signature}}<div class=\"border rounded-lg p-3 bg-gray-50\"><strong class=\"block mb-2 text-gray-800 text-sm\">Customer Signature Images</strong><div class=\"flex flex-wrap gap-3\">{{#each result_data.customer_signature}}<div class=\"w-20 h-20 rounded-lg overflow-hidden border shadow-sm\"><img src=\"https://deliveryapp.altaiseer.com/lcp-altaiseer-api/{{image}}\" alt=\"Customer Signature Image\" class=\"w-full h-full object-cover hover:scale-105 transition-transform\" /></div>{{/each}}</div></div>{{else}}<div class=\"text-sm text-gray-500\">POD Images: No</div>{{/if}}{{/if}}</div>",
    "query_information": {
      "group_by": [
        "shipment_location.shipment_location_uid",
        "shipment_location.customer_signature",
        "shipment_location.id"
      ],
      "company_id": 1,
      "search_all": [
        {
          "value": "$gparam_1",
          "operator": "=",
          "column_name": "shipment_location.shipment_location_uid"
        },
        {
          "value": null,
          "operator": "IS",
          "column_name": "shipment_location.deleted_at"
        }
      ],
      "limit_range": 15,
      "print_query": false,
      "start_index": 0,
      "sort_columns": [
        [
          "shipment_location.id",
          "desc"
        ]
      ],
      "primary_table": "shipment_location",
      "select_columns": [
        [
          "shipment_location.shipment_location_uid"
        ],
        [
          "COALESCE((SELECT JSON_AGG(JSON_BUILD_OBJECT('image', img)) FROM unnest(string_to_array(shipment_location.customer_signature, ',')) AS img), '[]')",
          "customer_signature"
        ]
      ]
    }
  },
  {
    "name": "Close Shipment for Shipment Management",
    "entity_name": "close_shipment_for_shipment_management",
    "entity_type": "common_permission_module",
    "is_admin_module": true,
    "static_page_content": null,
    "primary_table": null,
    "query_information": null,
    "company_id": 1,
    "lineitems": []
  },
  {
    "name": "Detailed Shipment Excel Export Job",
    "entity_name": "detailed_shipment_excel_export_job",
    "entity_type": "export_module",
    "is_admin_module": true,
    "export_template_id": "detailed_shipment_excel_export_template",
    "company_id": 1,
    "lineitems": []
  },
  {
    "name": "POD Shipment List PDF Record Export Job",
    "entity_name": "pod_shipment_list_pdf_record_export_job",
    "entity_type": "export_module",
    "is_admin_module": true,
    "export_template_id": "pod_shipment_list_pdf_record_export_template",
    "company_id": 1,
    "lineitems": []
  },
  {
    "name": "Customer Location List",
    "entity_name": "customers_location_list",
    "entity_type": "grid_builder_module",
    "static_page_content": null,
    "primary_table": "customers_delivery_addresses",
    "associated_tables": [],
    "query_information": {
      "group_by": [
        "customers_delivery_addresses.delivery_location",
        "customers_delivery_addresses.customer_contact_no",
        "user_details.code",
        "user_information.full_name",
        "customers_delivery_addresses.id"
      ],
      "includes": [
        {
          "join_type": "INNER",
          "table_name": "user_details",
          "join_condition": "user_details.code = split_part(customers_delivery_addresses.delivery_address_code, '_', 1)"
        },
        {
          "join_type": "INNER",
          "table_name": "user_information",
          "join_condition": "user_information.user_id = user_details.user_id"
        },
        {
          "join_type": "INNER",
          "table_name": "delivery_notes",
          "join_condition": "delivery_notes.customer_delivery_address_id = customers_delivery_addresses.id AND delivery_notes.customer_id = user_details.user_id"
        }
      ],
      "company_id": 1,
      "print_query": false,
      "sort_columns": [
        [
          "customers_delivery_addresses.id",
          "asc"
        ]
      ]
    },
    "company_id": 1,
    "lineitems": [
      {
        "master_grid_id": 0,
        "field_name": "user_details.code",
        "display_name": "customer_code",
        "order_no": 1,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "customers_delivery_addresses.delivery_location",
        "display_name": "delivery_location",
        "order_no": 3,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "user_information.full_name",
        "display_name": "customer",
        "order_no": 2,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "customers_delivery_addresses.customer_contact_no",
        "display_name": "customer_contact_no",
        "order_no": 4,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      }
    ]
  },
  {
    "name": "customer_number_histories",
    "entity_name": "customer_number_histories",
    "entity_type": "grid_builder_module",
    "static_page_content": null,
    "primary_table": "shipment_location_contact_info_histories",
    "associated_tables": [],
    "query_information": {
      "includes": [
        {
          "join_type": "INNER",
          "table_name": "USER_INFORMATION AS users",
          "join_condition": "users.user_id = shipment_location_contact_info_histories.created_by"
        }
      ],
      "company_id": 1,
      "search_all": [
        {
          "value": "$gparam_1",
          "operator": "=",
          "column_name": "shipment_location_contact_info_histories.shipment_location_uid"
        }
      ],
      "print_query": false
    },
    "company_id": 1,
    "lineitems": [
      {
        "master_grid_id": 0,
        "field_name": "shipment_location_contact_info_histories.from_customer_delivery_contact_number",
        "display_name": "from_customer_delivery_contact_number",
        "order_no": 1,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "shipment_location_contact_info_histories.to_customer_delivery_contact_number",
        "display_name": "to_customer_delivery_contact_number",
        "order_no": 2,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "users.full_name",
        "display_name": "created_by",
        "order_no": 3,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 3,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "shipment_location_contact_info_histories.created_at",
        "display_name": "created_at",
        "order_no": 4,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 7,
        "company_id": 1
      }
    ]
  },
  {
    "name": "no_of_shipments_grid",
    "entity_name": "no_of_shipments_grid",
    "entity_type": "grid_builder_module",
    "static_page_content": null,
    "primary_table": "shipments",
    "associated_tables": [],
    "query_information": {
      "group_by": [
        "DATE(shipments.created_at)"
      ],
      "company_id": 1,
      "search_all": [
        {
          "value": null,
          "operator": "IS",
          "column_name": "shipments.deleted_at"
        }
      ],
      "print_query": false,
      "sort_columns": [
        [
          "created_date",
          "desc"
        ]
      ]
    },
    "company_id": 1,
    "lineitems": [
      {
        "master_grid_id": 0,
        "field_name": "COUNT(id)",
        "display_name": "no_of_shipments_created",
        "order_no": 2,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "COUNT(id) FILTER (WHERE shipments.shipment_status_id = 6)",
        "display_name": "no_of_shipments_delivered",
        "order_no": 3,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 1,
        "company_id": 1
      },
      {
        "master_grid_id": 0,
        "field_name": "DATE(shipments.created_at)",
        "display_name": "created_date",
        "order_no": 1,
        "is_grid_column": true,
        "is_searchable": true,
        "is_sortable": true,
        "field_type_id": 5,
        "company_id": 1
      }
    ]
  },
  {
    "name": "POD shipment List PDF export",
    "entity_name": "pod_shipment_list_pdf_export",
    "entity_type": "common_permission_module",
    "is_admin_module": true,
    "static_page_content": null,
    "primary_table": null,
    "query_information": null,
    "company_id": 1,
    "lineitems": []
  },
  {
    "name": "sms_check",
    "entity_name": "sms_check",
    "entity_type": "sms_check_module",
    "static_page_content": null,
    "primary_table": "sms_test_requests",
    "query_information": null,
    "company_id": 1,
    "lineitems": []
  }
]