331 lines
20 KiB
Twig
331 lines
20 KiB
Twig
{% extends 'base.html.twig' %}
|
|
|
|
{% block body %}
|
|
{% set isSA = is_granted('ROLE_SUPER_ADMIN') %}
|
|
<div class="w-100 h-100 p-5 m-auto">
|
|
{% for type, messages in app.flashes %}
|
|
{% for message in messages %}
|
|
<div class="alert alert-{{ type }}">
|
|
{{ message }}
|
|
</div>
|
|
{% endfor %}
|
|
{% endfor %}
|
|
<div class="col d-flex justify-content-between align-items-center">
|
|
<div class="d-flex ">
|
|
{% if organization.logoUrl %}
|
|
<img src="{{ asset(organization.logoUrl) }}" alt="Organization logo"
|
|
class="rounded-circle" style="width:40px; height:40px;">
|
|
{% endif %}
|
|
<h1 class="mb-4 ms-3">{{ organization.name|title }} - Dashboard</h1>
|
|
</div>
|
|
<div class="d-flex gap-2">
|
|
{% if isSA %}
|
|
<a href="{{ path('organization_edit', {'id': organization.id}) }}" class="btn btn-primary">Gérer
|
|
l'organisation</a>
|
|
<form method="POST" action="{{ path('organization_delete', {'id': organization.id}) }}"
|
|
onsubmit="return confirm('Vous allez supprimer cette organisation, êtes vous sûre?');"
|
|
style="display: inline-block;">
|
|
<button class="btn btn-secondary" type="submit">Supprimer l'organisation</button>
|
|
</form>
|
|
{% if organization.active %}
|
|
<form method="POST" action="{{ path('organization_deactivate', {'id': organization.id}) }}"
|
|
onsubmit="return confirm('Vous allez désactiver cette organisation, êtes vous sûre?');"
|
|
style="display: inline-block;">
|
|
<button class="btn btn-warning" type="submit">Désactiver l'organisation</button>
|
|
</form>
|
|
{% else %}
|
|
<form method="POST" action="{{ path('organization_activate', {'id': organization.id}) }}"
|
|
onsubmit="return confirm('Vous allez re-activer cette organisation, êtes vous sûre?');"
|
|
style="display: inline-block;">
|
|
<button class="btn btn-primary" type="submit">Activer l'organisation</button>
|
|
</form>
|
|
{% endif %}
|
|
{% elseif is_granted("ROLE_ADMIN") %}
|
|
<a href="{{ path('organization_edit', {'id': organization.id}) }}" class="btn btn-primary">Gérer mon
|
|
organisation</a>
|
|
{% endif %}
|
|
</div>
|
|
|
|
</div>
|
|
{# single row so that activity and users tabs are next to each other #}
|
|
<div class="row">
|
|
{# User tables #}
|
|
<div class="col-9">
|
|
<div class="row mb-3 d-flex gap-2 ">
|
|
<div class="col mb-3 card no-header-bg"
|
|
data-controller="user"
|
|
data-user-org-id-value="{{ organization.id }}"
|
|
data-user-new-value="true"
|
|
data-user-list-small-value="true">
|
|
|
|
<div class="card-header d-flex justify-content-between align-items-center">
|
|
<h2>Nouveaux utilisateurs</h2>
|
|
{# Button to trigger modal #}
|
|
<button type="button" class="btn btn-primary" data-action="click->user#openNewUserModal">
|
|
Ajouter un utilisateur
|
|
</button>
|
|
</div>
|
|
<div class="card-body">
|
|
<div id="tabulator-userListSmall"></div>
|
|
</div>
|
|
|
|
{# New User Modal #}
|
|
<div class="modal fade" id="newUserModal" tabindex="-1" aria-hidden="true"
|
|
data-user-target="modal">
|
|
<div class="modal-dialog modal-lg">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title">Créer un nouvel utilisateur</h5>
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
|
</div>
|
|
<form data-action="submit->user#submitNewUser">
|
|
<div class="modal-body">
|
|
<div class="mb-3">
|
|
<label class="form-label">Email*</label>
|
|
<input type="email" name="email" class="form-control" required>
|
|
</div>
|
|
<div class="row">
|
|
<div class="col-6 mb-3">
|
|
<label class="form-label">Prénom*</label>
|
|
<input type="text" name="name" class="form-control" required>
|
|
</div>
|
|
<div class="col-6 mb-3">
|
|
<label class="form-label">Nom*</label>
|
|
<input type="text" name="surname" class="form-control" required>
|
|
</div>
|
|
</div>
|
|
<div class="mb-3">
|
|
<label class="form-label">Numéro de téléphone</label>
|
|
<input type="number" name="phoneNumber" class="form-control">
|
|
</div>
|
|
<div class="mb-3">
|
|
<label class="form-label">Photo de profil</label>
|
|
<input type="file" name="pictureUrl" class="form-control"
|
|
accept="image/*">
|
|
</div>
|
|
|
|
<hr>
|
|
<label class="form-label"><b>Applications à associer**</b></label>
|
|
<div class="row" data-user-target="appList">
|
|
{# Applications will be injected here #}
|
|
<div class="text-center p-3 text-muted">Chargement des applications...
|
|
</div>
|
|
</div>
|
|
<input type="hidden" name="organizationId" value="{{ organization.id }}">
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">
|
|
Annuler
|
|
</button>
|
|
<button type="submit" class="btn btn-primary">Créer l'utilisateur</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col mb-3 card no-header-bg"
|
|
data-controller="user"
|
|
data-user-org-id-value="{{ organization.id }}"
|
|
data-user-admin-value="true"
|
|
data-user-list-small-value="true">
|
|
|
|
<div class="card-header d-flex justify-content-between align-items-center">
|
|
<h2>Administrateurs</h2>
|
|
<button type="button" class="btn btn-primary" data-action="click->user#openAddAdminModal">
|
|
Ajouter un administrateur
|
|
</button>
|
|
</div>
|
|
|
|
<div class="card-body">
|
|
<div id="tabulator-userListSmallAdmin"></div>
|
|
</div>
|
|
|
|
{# Modal for Adding Admin #}
|
|
<div class="modal fade" id="addAdminModal" tabindex="-1" aria-hidden="true"
|
|
data-user-target="modal">
|
|
<div class="modal-dialog">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title">Ajouter un administrateur</h5>
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal"
|
|
aria-label="Close"></button>
|
|
</div>
|
|
<form data-action="submit->user#submitAddAdmin">
|
|
<div class="modal-body">
|
|
<div class="mb-3">
|
|
<label class="form-label">Sélectionner l'utilisateur</label>
|
|
<select name="userId" class="form-select" data-user-target="userSelect"
|
|
required>
|
|
<option value="">Chargement...</option>
|
|
</select>
|
|
</div>
|
|
{# Hidden Fields #}
|
|
<input type="hidden" name="status" value="add">
|
|
<input type="hidden" name="organizationId" value="{{ organization.id }}">
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">
|
|
Annuler
|
|
</button>
|
|
<button type="submit" class="btn btn-primary">Ajouter</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="row mb-3 card no-header-bg">
|
|
<div class="card-header">
|
|
<h2>
|
|
Mes utilisateurs
|
|
</h2>
|
|
</div>
|
|
<div class="card-body">
|
|
<div id="tabulator-userListOrganization" data-controller="user"
|
|
data-user-aws-value="{{ aws_url }}"
|
|
data-user-statut-value="true"
|
|
data-user-list-organization-value="true"
|
|
data-user-org-id-value="{{ organization.id }}">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
{# APPLICATION ROW #}
|
|
<div class="row mb-3 card no-header-bg"
|
|
data-controller="project"
|
|
data-project-list-project-value="true"
|
|
data-project-org-id-value="{{ organization.id }}"
|
|
data-project-admin-value="{{ isSA ? 'true' : 'false' }}">
|
|
<div class="card-header d-flex justify-content-between align-items-center">
|
|
<h2>Mes Projets</h2>
|
|
{% if is_granted("ROLE_SUPER_ADMIN") %}
|
|
{# Trigger for the Modal #}
|
|
<button type="button" class="btn btn-primary" data-action="click->project#openCreateModal">
|
|
Crée un projet
|
|
</button>
|
|
{% endif %}
|
|
</div>
|
|
<div class="card-body">
|
|
<div id="tabulator-projectListOrganization">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="modal fade" id="createProjectModal" tabindex="-1" aria-hidden="true"
|
|
data-project-target="modal">
|
|
<div class="modal-dialog modal-lg">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title" data-project-target="formTitle">Nouveau Projet</h5>
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
|
</div>
|
|
<form data-action="submit->project#submitForm">
|
|
<div class="modal-body">
|
|
<div class="mb-3">
|
|
<label class="form-label">
|
|
<i class="color-primary">{{ ux_icon('bi:input-cursor-text', {height: '15px', width: '15px'}) }}</i>
|
|
Nom du projet</label>
|
|
<input type="text" name="name"
|
|
data-project-target="nameInput"
|
|
class="form-control" required>
|
|
</div>
|
|
<div class="row">
|
|
<div class="mb-3 col-6">
|
|
<label class="form-label">
|
|
<i class="color-primary">
|
|
{{ ux_icon('bi:calendar', {height: '15px', width: '15px'}) }}
|
|
</i>Horodatage</label>
|
|
<select name="timestamp" class="form-select"
|
|
data-project-target="timestampSelect" required>
|
|
<option value="day">Jour uniquement (YYYY-MM-DD)</option>
|
|
<option value="full">Horodatage complet (YYYY-MM-DD HH:MM:SS)
|
|
</option>
|
|
</select>
|
|
</div>
|
|
<div class="mb-3 col-6">
|
|
<label class="form-label">
|
|
<i class="color-primary">
|
|
{{ ux_icon('bi:trash3', {height: '15px', width: '15px'}) }}
|
|
</i>
|
|
Autorisation de suppression</label>
|
|
<select name="deletion" class="form-select"
|
|
data-project-target="deletionSelect" required>
|
|
<option value="true">Suppression autorisée</option>
|
|
<option value="false">Suppression interdite</option>
|
|
</select>
|
|
</div>
|
|
<div class="mb-3">
|
|
<label class="form-label">
|
|
<i class="color-primary">
|
|
{{ ux_icon('material-symbols:picture-in-picture-outline-rounded', {height: '15px', width: '15px'}) }}
|
|
</i>
|
|
Logo de projet
|
|
</label>
|
|
<input type="file" name="logo" class="form-control"
|
|
accept="image/*">
|
|
</div>
|
|
</div>
|
|
|
|
<label class="form-label">
|
|
<i class="color-primary">{{ ux_icon('bi:grid-3x3-gap', {height: '15px', width: '15px'}) }}</i>
|
|
Applications</label>
|
|
<div class="row" data-project-target="appList">
|
|
{# Checkboxes will be injected here #}
|
|
<div class="text-center p-3">Chargement des applications...</div>
|
|
</div>
|
|
<input name="organizationId" type="hidden" value="{{ organization.id }}">
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">
|
|
Annuler
|
|
</button>
|
|
<button type="submit" class="btn btn-primary">Enregistrer</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{# Activities col #}
|
|
<div class="col-3 m-auto">
|
|
<div class="card "
|
|
data-controller="organization"
|
|
data-organization-activities-value="true"
|
|
data-organization-id-value="{{ organization.id }}">
|
|
|
|
<div class="card-header d-flex justify-content-between align-items-center border-0">
|
|
<h3>Activité récente</h3>
|
|
|
|
<button class="btn btn-sm btn-primary" data-action="organization#loadActivities">
|
|
<i class="fas fa-sync"></i> Rafraîchir
|
|
</button>
|
|
</div>
|
|
|
|
<div class="card-body bg-light">
|
|
<div class="d-flex flex-column" data-organization-target="activityList">
|
|
<div class="text-center text-muted p-5">
|
|
<span class="spinner-border" aria-hidden="true"></span>
|
|
</div>
|
|
</div>
|
|
|
|
{# Empty state #}
|
|
<div class="d-none" data-organization-target="emptyMessage">
|
|
<div class="alert alert-light text-center shadow-sm">Aucune activité récente.</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
{% endblock %}
|
|
|
|
|