# Business Details — documentation

> A directory of the city's businesses with live open status, waypoints and reviews.

- URL: https://xexstudio.com/docs/business-details
- Version: 2.0.0
- Product page: https://xexstudio.com/scripts/business-details
A directory of your city's businesses: which ones are open right now, where they are, what they offer and what
players think of them. Employees open and close their business from the same screen. ESX, QBCore and Qbox.

Free and open source.

## Requirements

- [ox_lib](https://github.com/overextended/ox_lib)
- One framework: **ESX**, **QBCore** or **Qbox**
- Optional: [oxmysql](https://github.com/overextended/oxmysql) for player reviews (the table is created on first start)

## Install

1. Drop `xex_businessdetails` into your resources folder.
2. Add to `server.cfg` after your framework, ox_lib and oxmysql:
   ```cfg
   ensure xex_businessdetails
   ```
3. Set the language with `setr ox:locale en` (or `es`).
4. Optional, to let staff delete reviews:
   ```cfg
   add_ace group.admin xex_businessdetails.staff allow
   ```
5. Edit `config.lua` with your businesses and jobs, and put your images in `ui/images/` (16:9, 640×360 is plenty).

Players open the directory with `/business` (configurable), an optional key, or a phone app (see below).

## Configure

Everything lives in `config.lua`:

| Setting | What it does |
| --- | --- |
| `Config.Framework` | `auto`, or force `esx` / `qb` / `qbox` |
| `Config.Command` / `Config.Keybind` | How players open the directory |
| `Config.UI` | Brand name, title and accent colour |
| `Config.Status` | Cooldown before reopening, distance to the business, duty requirement, auto close when no staff is online |
| `Config.Announce` | Notification to every player on open / close, and a periodic reminder of what is open |
| `Config.Blips` | Map blips, only for open businesses or always |
| `Config.Descriptions` | Let employees rewrite their description in game (saved across restarts) |
| `Config.Reviews` | Player reviews: on / off, distance, comment length |
| `Config.Categories` | Filter chips |
| `Config.Businesses` | Your businesses: id, label, job, minimum grade, category, image, coordinates, description |

`config_server.lua` holds the Discord webhook (openings, closings, description edits, reviews). It is never sent to players.

Several businesses can share one job. Keep each `id` unique and do not change it once players have left reviews.

## Phone apps

Open the directory from any phone app with the client export:

```lua
exports.xex_businessdetails:Open()
```

lb-phone example (`lb-phone/config/config.lua`, inside `Config.CustomApps`):

```lua
['businesses'] = {
    name = 'Businesses',
    description = 'What is open in the city right now',
    developer = 'XeX',
    defaultApp = true,
    icon = 'https://your-cdn/businesses.png', -- your own icon
    onUse = function()
        exports.xex_businessdetails:Open()
    end,
},
```

## For developers

```lua
-- server
exports.xex_businessdetails:IsOpen('burgershot')        -- true / false
exports.xex_businessdetails:GetOpen()                   -- { 'burgershot', 'vanilla', ... }
exports.xex_businessdetails:SetOpen('burgershot', true) -- open or close from another resource (announced as usual)

AddEventHandler('xex_businessdetails:statusChanged', function(id, open, src) end)
```

Clients can read `GlobalState.xex_businesses` (`{ [id] = openedAt }`) for the live status.

`bridge/server.lua` is open: adapt it if you use a custom framework or job system.

## Security

- Opening, closing and editing are checked on the server: job, grade, duty, distance and cooldown.
- Reviews are validated on the server (stars, length, distance, one per player and business, no reviewing your own
  business) and rate limited.
- Every text written by players is shown as plain text in the UI, never as HTML.
