# Applications

## Requirements

* Framework: QBox
* ox\_inventory (required dependancy)
* ox\_target (required dependancy)

## Installation

{% stepper %}
{% step %}

### Install Resource

1. Place `rs-applications` folder in your servers `resources/` directory
2. Add resource to your `server.cfg`

```
ensure ox_lib
ensure qbx_core
ensure ox_target
ensure [ox]        -- Must be placed AFTER

ensure rs-applications
```

Make sure `rs-applications` is started after all core resources / frameworks.
{% endstep %}

{% step %}

### Discord Webhooks

1. Make your discord channels, then create webhooks.
2. Add webhooks to your `server.cfg`

```
setr rs_applications_webhook_police "https://discord.com/api/webhooks/your_police_webhook"
setr rs_applications_webhook_ambulance "https://discord.com/api/webhooks/your_ambulance_webhook"
```

{% endstep %}

{% step %}

### Inventory Items

locate `ox_inventory/data/items.lua` and include these

```
['police_application'] = {
    label = 'Police Application',
    weight = 10,
    stack = false,
    close = true,
    consume = 0,
    description = 'A paper application for joining the police department.',
    client = {
        image = "application.png",
        export = 'rs-applications.police_application'
    }
},

['ambulance_application'] = {
    label = 'Ambulance Application',
    weight = 10,
    stack = false,
    close = true,
    consume = 0,
    description = 'A paper application for joining EMS.',
    client = {
        image = "application.png",
        export = 'rs-applications.ambulance_application'
    }
},
```

locate `ox_inventory/web/images` and drag the included `application.png` into the images folder
{% endstep %}

{% step %}

### Verify

1. Restart your server
2. Check console for `[RawScripts] Applications successfully started.`
3. Configuration time!

{% endstep %}
{% endstepper %}

## Configuration

Alot of this is recorded in the supplied `README.md` file in better detail.

After you `rs-applications` running, you can configure any of the settings and view saved changes by typing `restart rs-applications` in your server console or F8 menu.

Configuration is pretty straight forward, here's some good mentions

```
This section is information for your embeded messages from new applications posted via the webhooks

discord = {
    title = "New Ambulance Application", -- Embed title
    footer = "Submitted by: %s %s | Citizen ID: %s", -- Shows "Submitted by: PlayerName | CitizenID: 000000 - Time/Date
    color = 15158332, -- Recommend leaving these as is, just basic red/blue per department
},
```

```
You can have multiple pick-up locations (interactable points where players get their applications from)
by simply re-using the first code block and changing the coords, often used for multiple PD/EMS locations.

pickupLocations = {
    {
        coords = vec3(441.83, -982.06, 30.81), -- Coords to Interactable point
        radius = 0.5,  -- Interactable Radius
        distance = 1.0, -- Distance which Interactable
        icon = "fas fa-file-signature", -- Icon which ox_target shows
        label = "Take [department] Application", -- Label which shows while holding ALT
    },
    --{
    --    coords = vec3(441.83, -982.06, 30.81),
    --    radius = 0.5,
    --    distance = 1.0,
    --    icon = "fas fa-file-signature",
    --    label = "Take [department] Application",
    --},
},
```

```
Questions can be added, removed or edited under this section, aswell as editing required sections.

text = short text input
date = date selection / input ( MM/DD/YYYY )
tel = number input 
textarea = large text input

required = true/false (can't complete form without filling required areas, also dynamically places "(optional) or (required) placeholder text") depending on value.

questions = {
    { label = "What is your City Full Name?", type = "text", required = true },
    { label = "What is your Real D.O.B?", type = "date", required = true },
    { label = "What is your In-Game Phone Number?", type = "tel", required = true },
    { label = "Why do you want to become a police officer?", type = "textarea", required = true },
    { label = "Do you have any prior experience in law enforcement?", type = "textarea", required = true },
    { label = "Please describe your character's personality and background.", type = "textarea", required = false },
    { label = "Any other information you wish to add?", type = "textarea", required = false },
},
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://rawscripts.gitbook.io/rawscripts-docs/applications.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
