MDT

MDTs are configured in lb-tablet/config/mdts.json. Each top-level key is the MDT identifier used in exports, dispatches and shared reports. The default file includes Police, Ambulance, Fire and Mechanic.

Restart lb-tablet after changing mdts.json.

Adding an MDT

Add a new top-level object to lb-tablet/config/mdts.json. The key should be unique and is case-sensitive.

lb-tablet/config/mdts.json
{
    "Tow": {
        "name": "Tow",
        "department": "Los Santos Towing",
        "deviceName": "Mobile Data Terminal",
        "appIcon": "./assets/img/icons/apps/Mechanic.png",
        "icon": "./assets/img/icons/mdt/mechanic.png",
        "colorTheme": "#eb8934",
        "callsign": {
            "enabled": true,
            "format": "[T-111]",
            "requireTemplate": true,
            "allowChange": true,
            "autoGenerate": true
        },
        "options": {
            "dutyBlips": true
        },
        "defaultPermissions": {
            "tow": {
                "view": 0,
                "create": 0,
                "edit": 2,
                "delete": 3,
                "pin": 2,
                "kick": 2
            }
        },
        "tabs": [
            {
                "type": "home",
                "icon": "IoHome",
                "label": "Home",
                "content": ["reports", "bulletin", "units"]
            },
            {
                "type": "bulletin",
                "label": "Bulletin",
                "icon": "IoBookmark"
            },
            {
                "type": "dispatch",
                "label": "Dispatch",
                "icon": "IoRadio"
            },
            {
                "type": "units",
                "label": "Units",
                "icon": "IoGrid",
                "default": {
                    "status": "available",
                    "units": []
                },
                "statuses": {
                    "available": {
                        "label": "Available",
                        "color": "green"
                    },
                    "busy": {
                        "label": "Busy",
                        "color": "orange"
                    }
                }
            },
            {
                "type": "reports",
                "id": "reports",
                "label": "Reports",
                "name": "report",
                "icon": "IoFolder",
                "fields": [
                    {
                        "id": "target",
                        "type": "target",
                        "vehicle": true,
                        "person": false,
                        "label": "Vehicle",
                        "subtitle": "plate"
                    },
                    {
                        "id": "description",
                        "type": "text",
                        "label": "Description",
                        "template": "# Tow Report\n\n**Vehicle:**\n**Reason:**\n**Location:**\n\n**Notes:**"
                    },
                    {
                        "id": "gallery",
                        "type": "photo",
                        "label": "Gallery",
                        "multiple": true
                    }
                ]
            },
            {
                "type": "employees",
                "label": "Employees",
                "icon": "IoPeople"
            },
            {
                "type": "chat",
                "label": "Chat",
                "icon": "IoChatbubbleEllipses"
            },
            {
                "type": "logs",
                "label": "Logs",
                "icon": "IoPrint"
            }
        ]
    }
}

The jobs that can access an MDT are taken from defaultPermissions. In the example above, players with the tow job can access the Tow MDT.

Permissions

Permissions can be a minimum grade, an array of allowed grades, true or false.

{
    "defaultPermissions": {
        "police": {
            "view": 0,
            "create": 2,
            "edit": [3, 4],
            "delete": false
        }
    }
}

The default permission keys are view, create, edit, delete, stash, fine, pin, kick, invite, private, triangulate, unlock, callHistory, createWiretap, listenWiretap, messageWiretap and removeWiretap.

You can override permissions per tab by adding permissions to the tab. If no tab permissions are set, the tab uses defaultPermissions.

{
    "type": "reports",
    "id": "cases",
    "label": "Cases",
    "name": "case",
    "icon": "IoReceipt",
    "permissions": {
        "police": {
            "view": 0,
            "create": 2,
            "edit": 3,
            "delete": 4
        }
    },
    "fields": []
}

Tabs

Tabs are shown in the same order as the tabs array. The home tab uses content to decide which tabs to show on the home screen. content can contain either a tab type or a report tab id.

Available tab types are home, bulletin, dispatch, units, users, vehicles, properties, weapons, reports, catalog, employees, chat, phone, jail and logs.

Report tabs must have an id. Use different ids when you want multiple report-like tabs, such as reports, cases, warrants or serviceReports.

Report Fields

Report tabs are built from the fields array.

TypeDescription
textMarkdown text field. Supports template.
dropdownSelect one value from options.
tagMDT tags for the current tab.
photoOne or more photos/videos.
person, vehicle, weapon, property, employeeLink entities to the report.
targetSelect one target, usually a person or vehicle.
linkedLink other reports, vehicles, properties or weapons.
stashEvidence stash field. Requires Config.MDT.EvidenceStash.Enabled.
date, location, sliderSpecialized input fields.

For linked fields that point to reports, set linkType to reports and use linkId to choose which report tab to link to.

{
    "id": "linked_cases",
    "type": "linked",
    "label": "Linked Cases",
    "linkType": "reports",
    "linkId": "cases",
    "multiple": true
}

Copying an MDT

Use copy to inherit settings from another MDT. Any values you define on the copied MDT override the source MDT.

lb-tablet/config/mdts.json
{
    "Sheriff": {
        "copy": "Police",
        "name": "Sheriff",
        "department": "Blaine County Sheriff's Office",
        "deviceName": "Mobile Database Terminal",
        "appIcon": "./assets/img/icons/apps/Police.png",
        "icon": "./assets/img/icons/mdt/police.webp",
        "colorTheme": "#b68b2c",
        "defaultPermissions": {
            "sheriff": {
                "view": 0,
                "create": 2,
                "edit": 3,
                "delete": 4,
                "stash": 3,
                "fine": 2,
                "pin": 3,
                "kick": 3,
                "invite": 2,
                "private": 3,
                "triangulate": 2,
                "unlock": 2,
                "callHistory": 1,
                "createWiretap": 2,
                "listenWiretap": 1,
                "messageWiretap": 1,
                "removeWiretap": 2
            }
        },
        "disabledTabs": ["phone", "warrants"],
        "tabs": []
    }
}

Add "tabs": [] when you use disabledTabs. Tabs listed in disabledTabs are skipped while the copied tabs are merged into your own tabs array.

To override a copied tab, add a tab with the same type and id. The copied MDT will keep your tab and only add missing tabs from the source MDT.

Sharing Reports Between MDTs

Use a shared reports tab when one MDT should read and write reports stored under another MDT. The shared tab must use an id that exists on the source MDT.

Add the shared tab to the target MDT's tabs array:

lb-tablet/config/mdts.json
{
    "type": "reports",
    "id": "cases",
    "label": "Police Cases",
    "name": "case",
    "icon": "IoReceipt",
    "shared": true,
    "mdt": "Police"
}

For example, adding the tab above to Fire.tabs shows the Police MDT's cases tab in the Fire MDT. The fields are copied from Police on resource start, and reports are stored under Police.

Permissions still come from the MDT where the user opened the tab. Add permissions to the shared tab if the target MDT should use different grades for viewing, creating, editing or deleting shared reports.

{
    "type": "reports",
    "id": "cases",
    "label": "Police Cases",
    "name": "case",
    "icon": "IoReceipt",
    "shared": true,
    "mdt": "Police",
    "permissions": {
        "fire": {
            "view": 2,
            "create": false,
            "edit": false,
            "delete": false
        }
    }
}

Private Reports

Reports can be marked as private, and requires the private permission. The creator can share the report with specific MDT employees from the tablet UI.

Dispatches

Dispatches can be sent to one MDT, multiple MDTs or all MDTs that match a job.

exports["lb-tablet"]:AddDispatch({
    mdt = "Police",
    priority = "high",
    code = "10-90",
    title = "Store Robbery",
    description = "Silent alarm triggered",
    location = {
        label = "24/7 Supermarket",
        coords = vector2(25.7, -1345.3)
    },
    time = 300
})
exports["lb-tablet"]:AddDispatch({
    mdts = { "Police", "Ambulance" },
    priority = "medium",
    code = "10-52",
    title = "Vehicle Accident",
    description = "Multiple vehicles involved",
    location = {
        label = "Vespucci Boulevard",
        coords = vector2(-510.2, -260.4)
    },
    time = 300
})

You can also use job = "police" or job = { "police", "ambulance" }. The tablet will send the dispatch to every MDT whose defaultPermissions includes that job.

Exporting Reports

Exporting reports requires a supported inventory. ox_inventory & qb-inventory are supported by default.

Report exporting is controlled by Config.MDT.ExportReports. When enabled, players can export a report to the configured item.

lb-tablet/config/config.lua
Config.MDT.ExportReports.Enabled = "auto"
Config.MDT.ExportReports.Item = "document"

Using the exported item opens a read-only copy of the report.