# Configuration des sites

### Ajouter un site

- <span style="white-space: pre-wrap;">Pour ajouter les sites, vous devez modifier le fichier </span>`<span class="editor-theme-code">nui/assets/config.js</span>`<span style="white-space: pre-wrap;"></span>
- <span style="white-space: pre-wrap;">Ajouter une ligne dans le tableau </span>`<span class="editor-theme-code">config.sites</span>`

<u>Format de la ligne :</u>

```lua
{
  name: "Nom affiché sur la tablette", 
  icon: "img/mon_image.png", 
  href: "nom_unique", 
  url: "url vers le site internet" 
}
```

<p class="callout warning"><span style="white-space: pre-wrap;">Attention, le </span>****href****<span style="white-space: pre-wrap;"> doit être unique et ne peut pas être mis sur un autre site !</span></p>

<details id="bkmrk-exemple-avant-%3A-cons"><summary>Exemple</summary>

<u>Avant :</u>

```javascript
const config = {
    sites : [
        { name: 'Xelyos', icon: 'img/xelyos.png', href: 'xelyosapp', url: "https://xelyos.fr" },
        { name: 'Mail RP', icon: 'img/mailrp.png', href: 'mailrpapp', url: "https://mail-rp.com" },
        { name: 'Top Serveur', icon: 'img/top-serveur.png', href: 'topserveurapp', url: "https://top-serveurs.net" },
        { name: 'COP app', icon: 'img/lspd.png', href: 'copapp', url: "https://intranet-lspd.xelyos.fr" },
        { name: 'SECOURS app', icon: 'img/samu.png', href: 'secoursapp', url: "https://intranet-ems.xelyos.fr" },
    ]
};
```

<u>Nouveau site :</u>

```lua
{
  name: "Intranet Xelyos", 
  icon: "img/intranet.png", 
  href: "intranetxelyos", 
  url: "http://intranet-rp.com" 
}
```

<u>Après :</u>

#####   


```javascript
const config = {
    sites : [
        { name: 'Xelyos', icon: 'img/xelyos.png', href: 'xelyosapp', url: "https://xelyos.fr" },
        { name: 'Mail RP', icon: 'img/mailrp.png', href: 'mailrpapp', url: "https://mail-rp.com" },
        { name: 'Top Serveur', icon: 'img/top-serveur.png', href: 'topserveurapp', url: "https://top-serveurs.net" },
        { name: 'COP app', icon: 'img/lspd.png', href: 'copapp', url: "https://intranet-lspd.xelyos.fr" },
        { name: 'SECOURS app', icon: 'img/samu.png', href: 'secoursapp', url: "https://intranet-ems.xelyos.fr" },
        { name: "Intranet Xelyos", icon: "img/intranet.png", href: "intranetxelyos", url: "http://intranet-rp.com" },
    ]
};
```

<span style="white-space: pre-wrap;"></span>

</details>- <span style="white-space: pre-wrap;">L'image liée à votre site doit se situer dans le répertoire </span>`<span class="editor-theme-code">nui/img</span>`

##### Changer la couleur de fond

- <span style="white-space: pre-wrap;">Vous pouvez également changer la couleur de fond en ajoutant/modifiant le fichier </span>`<span class="editor-theme-code">nui/assets/color.css</span>`

```css
.application > #num_unique { 
    background: #37517e;
    background: linear-gradient(to right, #37517e, #142747);
}
```

### Limiter l'accès à un site pour un job

<span style="white-space: pre-wrap;">Pour restreindre l'accès à un site pour un job, vous devez modifier le fichier </span>`<span class="editor-theme-code">nui/assets/config.js</span>`.

<u>Format de la restriction :</u>

```lua
{
  job_name: "nom_du_job",
  sites: [
    { name: 'COP app', icon: 'img/lspd.png', href: 'copapp', url: "https://intranet-lspd.xelyos.fr" }
  ]
}
```

<p class="callout warning"><span style="white-space: pre-wrap;">Attention, la ligne présente dans le tableau </span>****sites****<span style="white-space: pre-wrap;"> doit être identique à celle présente dans la variable </span>`<span class="editor-theme-code">config.sites</span>`<span style="white-space: pre-wrap;"> !</span></p>

<details id="bkmrk-exemple-variable-ave"><summary>Exemple</summary>

<span style="white-space: pre-wrap;"></span>

<u>Variable avec tous les sites :</u>

```javascript
const config = {
    sites : [
        { name: 'Xelyos', icon: 'img/xelyos.png', href: 'xelyosapp', url: "https://xelyos.fr" },
        { name: 'Mail RP', icon: 'img/mailrp.png', href: 'mailrpapp', url: "https://mail-rp.com" },
        { name: 'Top Serveur', icon: 'img/top-serveur.png', href: 'topserveurapp', url: "https://top-serveurs.net" },
        { name: 'COP app', icon: 'img/lspd.png', href: 'copapp', url: "https://intranet-lspd.xelyos.fr" },
        { name: 'SECOURS app', icon: 'img/samu.png', href: 'secoursapp', url: "https://intranet-ems.xelyos.fr" },
        { name: "Intranet Xelyos", icon: "img/intranet.png", href: "intranetxelyos", url: "http://intranet-rp.com" },
    ]
};
```

<u>Variable avec la restriction :</u>

```javascript
const jobSites = [
    {
        job_name: "police",
        sites: [
            { name: 'COP app', icon: 'img/lspd.png', href: 'copapp', url: "https://intranet-lspd.xelyos.fr" },
            { name: "Intranet Xelyos", icon: "img/intranet.png", href: "intranetxelyos", url: "http://intranet-rp.com" },
        ]
    },
    {
        job_name: "ambulance",
        sites: [
            { name: 'SECOURS app', icon: 'img/samu.png', href: 'secoursapp', url: "https://intranet-ems.xelyos.fr" },
            { name: "Intranet Xelyos", icon: "img/intranet.png", href: "intranetxelyos", url: "http://intranet-rp.com" },
        ]
    }
];
```

#####   


<u>Avec cette configuration :</u>

- <span style="white-space: pre-wrap;">Le site </span>****Intranet Xelyos****<span style="white-space: pre-wrap;"> sera accessible par les jobs police et ambulance</span>
- <span style="white-space: pre-wrap;">Le site </span>****Cop App****<span style="white-space: pre-wrap;"> sera uniquement accessible par le job police</span>
- <span style="white-space: pre-wrap;">Le site </span>****Secours App****<span style="white-space: pre-wrap;"> sera uniquement accessible par le job ambulance</span>

</details>