# Raise Ticket

| | |
|---|---|
| **Nav ID** | `raise-ticket` |
| **Component** | `AdminRaiseTicketPage.jsx` |
| **Services** | `ticketsApi.js`, `usersApi.js` |

Uses `useMasterData()` for `tickets_status` and `tickets_type`.

---

## Endpoints

See prior endpoint docs.

---

## SQL queries

### Load users (assignee dropdown)

```sql
SELECT user_id, employee_name, email_id, ...
FROM users ORDER BY user_id ASC;
```

### Master lookups

```sql
SELECT * FROM `tickets_status`;
SELECT * FROM `tickets_type`;
```

### Create ticket

```sql
INSERT INTO tickets (`description`, `user_id`, `ticket_type_id`, `status_id`, `created_at`)
VALUES (?, ?, ?, ?, ?);
```

Example with bound values:

```sql
INSERT INTO tickets (`description`, `user_id`, `ticket_type_id`, `status_id`)
VALUES ('PTW form not loading', 10, 2, 1);
```

**Controller:** `ticketsController.js` → `createTicket`
