svg
This commit is contained in:
@@ -3,115 +3,174 @@
|
||||
|
||||
|
||||
{%block body%}
|
||||
<h2>Projets</h2>
|
||||
<ul id="tabProjects" class="nav nav-tabs">
|
||||
<li class="me-5">
|
||||
<a href="{{ path('app_user_project_submit') }}" class="btn btn-success">Ajouter</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" aria-current="page" href="#" data-status="A Voter"">A Voter</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#" data-status="Brouillon">Brouillon</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#" data-status="Voté">Voté</a>
|
||||
</li>
|
||||
<li class="nav-item ms-auto">
|
||||
<a class="nav-link" href="#" data-status="Archivé">Archivé</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-success nav-tome" href="#">Mes Projets</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<h2>Projets</h2>
|
||||
<ul id="tabProjects" class="nav nav-tabs">
|
||||
<li class="me-5">
|
||||
<a href="{{ path('app_user_project_submit') }}" class="btn btn-success">Ajouter</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" aria-current="page" href="#" data-status="A Voter"">A Voter</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#" data-status="Brouillon">Brouillon</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#" data-status="Voté">Voté</a>
|
||||
</li>
|
||||
<li class="nav-item ms-auto">
|
||||
<a class="nav-link" href="#" data-status="Archivé">Archivé</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-success nav-tome" href="#">Mes Projets</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div id="containerdraft" data-status="Brouillon" class='containerStatus d-flex flex-wrap mt-3' style='justify-content: left'>
|
||||
<h3 style="width:100%">Brouillon</h3>
|
||||
</div>
|
||||
<div id="containervoted" data-status="A Voter" class='containerStatus d-flex flex-wrap mt-3' style='justify-content: left'>
|
||||
<h3 style="width:100%">A Voter</h3>
|
||||
</div>
|
||||
<div id="containertovote" data-status="Voté" class='containerStatus d-flex flex-wrap mt-3' style='justify-content: left'>
|
||||
<h3 style="width:100%">Voté</h3>
|
||||
</div>
|
||||
<div id="containerarchived" data-status="Archivé" class='containerStatus d-flex flex-wrap mt-3' style='justify-content: left'>
|
||||
<h3 style="width:100%">Archivé</h3>
|
||||
</div>
|
||||
<div id="containerdraft" data-status="Brouillon" class='containerProjectStatus d-flex flex-wrap mt-3' style='justify-content: left'>
|
||||
<h3 style="width:100%">Brouillon</h3>
|
||||
</div>
|
||||
<div id="containervoted" data-status="A Voter" class='containerProjectStatus d-flex flex-wrap mt-3' style='justify-content: left'>
|
||||
<h3 style="width:100%">A Voter</h3>
|
||||
</div>
|
||||
<div id="containertovote" data-status="Voté" class='containerProjectStatus d-flex flex-wrap mt-3' style='justify-content: left'>
|
||||
<h3 style="width:100%">Voté</h3>
|
||||
</div>
|
||||
<div id="containerarchived" data-status="Archivé" class='containerProjectStatus d-flex flex-wrap mt-3' style='justify-content: left'>
|
||||
<h3 style="width:100%">Archivé</h3>
|
||||
</div>
|
||||
|
||||
<div style="display:none">
|
||||
{% for project in projects %}
|
||||
{% if is_granted('VIEW', project) %}
|
||||
<div class='card cardProject' data-status="{{project.status}}" data-tome="{{is_granted('TOME', project)}}" style='width:300px; margin-right:10px;'>
|
||||
<div class='card-header d-flex justify-content-between align-items-center'>
|
||||
<h5>{{project.title}}</h5>
|
||||
<div style="display:none">
|
||||
{% for project in projects %}
|
||||
{% if is_granted('VIEW', project) %}
|
||||
<div class='card cardProject' data-status="{{project.status}}" data-tome="{{is_granted('TOME', project)}}" style='width:300px; margin-right:10px;'>
|
||||
<div class='card-header d-flex justify-content-between align-items-center'>
|
||||
<h5>{{project.title}}</h5>
|
||||
|
||||
<div>
|
||||
<a href="{{ path("app_user_project_view",{id:project.id}) }}" class="btn btn-secondary btn-sm"><i class="fas fa-eye"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class='card-body'>
|
||||
{{project.summary|nl2br}}
|
||||
|
||||
{% if project.status=="Voté" or project.status=="Archivé" %}
|
||||
<small>
|
||||
<hr>
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
{% for option in project.options %}
|
||||
{{ option.title|title }} = {{ option.nbVote }}<br>
|
||||
{% endfor %}
|
||||
<div>
|
||||
<a href="{{ path("app_user_project_view",{id:project.id}) }}" class="btn btn-secondary btn-sm"><i class="fas fa-eye"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-6">
|
||||
Votes Blancs = {{ project.nbVoteWhite }}<br>
|
||||
Votes Nuls = {{ project.nbVoteNull }}
|
||||
<div class='card-body'>
|
||||
{{project.summary|nl2br}}
|
||||
|
||||
{% if project.status=="Voté" or project.status=="Archivé" %}
|
||||
<small>
|
||||
<hr>
|
||||
<div class="row">
|
||||
<div class="col-xs-6">
|
||||
{% for option in project.options %}
|
||||
{{ option.title|title }} = {{ option.nbVote }}<br>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div class="col-xs-6">
|
||||
Votes Blancs = {{ project.nbVoteWhite }}<br>
|
||||
Votes Nuls = {{ project.nbVoteNull }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
<strong>Résultat = </strong><br>
|
||||
{{ project.resultVote|nl2br }}
|
||||
</small>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class='card-footer' style="line-height:14px">
|
||||
<small><em>
|
||||
{% if project.dueDate %}
|
||||
<b>A Voter pour le</b> = {{ project.dueDate|date("d/m/Y") }}<br>
|
||||
{% endif %}
|
||||
<b>Nature</b> = {{ project.nature }}<br>
|
||||
<b>Propriétaires</b> =
|
||||
{%for user in project.users%}
|
||||
{{loop.first ? user.username : ' - '~user.username}}
|
||||
{%endfor%}
|
||||
</em></small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
<strong>Résultat = </strong><br>
|
||||
{{ project.resultVote|nl2br }}
|
||||
</small>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class='card-footer' style="line-height:14px">
|
||||
<small><em>
|
||||
{% if project.dueDate %}
|
||||
<b>A Voter pour le</b> = {{ project.dueDate|date("d/m/Y") }}<br>
|
||||
{% endif %}
|
||||
<b>Nature</b> = {{ project.nature }}<br>
|
||||
<b>Propriétaires</b> =
|
||||
{%for user in project.users%}
|
||||
{{loop.first ? user.username : ' - '~user.username}}
|
||||
{%endfor%}
|
||||
</em></small>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<h2>Groupes</h2>
|
||||
<ul id="tabGroups" class="nav nav-tabs">
|
||||
<li class="me-5">
|
||||
<a href="{{ path('app_user_group_submit') }}" class="btn btn-success">Ajouter</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" aria-current="page" href="#" data-status="Actif"">Actif</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="#" data-status="Brouillon">Inactif</a>
|
||||
</li>
|
||||
<li class="nav-item ms-auto">
|
||||
<a class="nav-link text-success nav-tome" href="#">Mes Groupes</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div id="containeractif" data-status="Actif" class='containerGroupStatus d-flex flex-wrap mt-3' style='justify-content: left'>
|
||||
<h3 style="width:100%">Actif</h3>
|
||||
</div>
|
||||
<div id="containerinactif" data-status="Inactif" class='containerGroupStatus d-flex flex-wrap mt-3' style='justify-content: left'>
|
||||
<h3 style="width:100%">Inactif</h3>
|
||||
</div>
|
||||
|
||||
<div style="display:none">
|
||||
{% for group in groups %}
|
||||
{% if is_granted('VIEW', group) %}
|
||||
<div class='card cardGroup' data-status="{{group.status}}" data-tome="{{is_granted('TOME', group)}}" style='width:300px; margin-right:10px;'>
|
||||
<div class='card-header d-flex justify-content-between align-items-center'>
|
||||
<h5>{{group.title}}</h5>
|
||||
|
||||
<div>
|
||||
<a href="{{ path("app_user_group_view",{id:group.id}) }}" class="btn btn-secondary btn-sm"><i class="fas fa-eye"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class='card-body'>
|
||||
{{group.summary|nl2br}}
|
||||
</div>
|
||||
|
||||
<div class='card-footer' style="line-height:14px">
|
||||
<small><em>
|
||||
{% if group.dueDate %}
|
||||
<b>A Voter pour le</b> = {{ group.dueDate|date("d/m/Y") }}<br>
|
||||
{% endif %}
|
||||
<b>Propriétaires</b> =
|
||||
{%for user in group.users%}
|
||||
{{loop.first ? user.username : ' - '~user.username}}
|
||||
{%endfor%}
|
||||
</em></small>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{%endblock%}
|
||||
|
||||
{% block localscript %}
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
// Cacher tous les containers sauf celui actif au chargement
|
||||
let initialStatus = $('.nav-link.active').data('status');
|
||||
$('.containerStatus').removeClass("d-flex");
|
||||
$('.containerStatus').hide();
|
||||
let initialStatus = $('#tabProjects .nav-link.active').data('status');
|
||||
$('.containerProjectStatus').removeClass("d-flex");
|
||||
$('.containerProjectStatus').hide();
|
||||
|
||||
$('.cardProject').each(function () {
|
||||
const $card = $(this);
|
||||
const status = $card.data('status');
|
||||
const $container = $('.containerStatus[data-status="' + status + '"]')
|
||||
const $container = $('.containerProjectStatus[data-status="' + status + '"]')
|
||||
|
||||
if ($container.length) {
|
||||
$container.append($card);
|
||||
}
|
||||
});
|
||||
|
||||
console.log(initialStatus);
|
||||
$('.containerStatus[data-status="' + initialStatus + '"]').addClass("d-flex");
|
||||
$('.containerProjectStatus[data-status="' + initialStatus + '"]').addClass("d-flex");
|
||||
|
||||
$('#tabProjects .nav-link').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
@@ -127,7 +186,7 @@
|
||||
// On affiche que les cardProject avec tome
|
||||
$(".cardProject[data-tome='1']").show();
|
||||
|
||||
$('.containerStatus').each(function () {
|
||||
$('.containerProjectStatus').each(function () {
|
||||
const $container = $(this);
|
||||
const hasTome = $container.find('.cardProject[data-tome="1"]').length > 0;
|
||||
|
||||
@@ -146,11 +205,69 @@
|
||||
let status = $(this).data('status');
|
||||
|
||||
// Cache tous les containers, puis affiche celui correspondant au data-status
|
||||
$('.containerStatus').removeClass('d-flex').hide();
|
||||
$('.containerStatus[data-status="' + status + '"]').addClass("d-flex").show();
|
||||
$('.containerProjectStatus').removeClass('d-flex').hide();
|
||||
$('.containerProjectStatus[data-status="' + status + '"]').addClass("d-flex").show();
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
// Cacher tous les containers sauf celui actif au chargement
|
||||
let initialStatus = $('#tabGroups .nav-link.active').data('status');
|
||||
$('.containerGroupStatus').removeClass("d-flex");
|
||||
$('.containerGroupStatus').hide();
|
||||
|
||||
$('.cardGroup').each(function () {
|
||||
const $card = $(this);
|
||||
const status = $card.data('status');
|
||||
const $container = $('.containerGroupStatus[data-status="' + status + '"]')
|
||||
|
||||
if ($container.length) {
|
||||
$container.append($card);
|
||||
}
|
||||
});
|
||||
|
||||
$('.containerGroupStatus[data-status="' + initialStatus + '"]').addClass("d-flex");
|
||||
|
||||
$('#tabGroups .nav-link').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
// Gère les onglets actifs
|
||||
$('.nav-link').removeClass('active');
|
||||
$(this).addClass('active');
|
||||
|
||||
if ($(this).hasClass('nav-tome')) {
|
||||
// On masque tt les cardGroup
|
||||
$(".cardGroup").hide();
|
||||
|
||||
// On affiche que les cardGroup avec tome
|
||||
$(".cardGroup[data-tome='1']").show();
|
||||
|
||||
$('.containerGroupStatus').each(function () {
|
||||
const $container = $(this);
|
||||
const hasTome = $container.find('.cardGroup[data-tome="1"]').length > 0;
|
||||
|
||||
if (hasTome) {
|
||||
$container.addClass('d-flex').show();
|
||||
} else {
|
||||
$container.removeClass('d-flex').hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
// On affiche tt les cardGroup
|
||||
$(".cardGroup").show();
|
||||
|
||||
// Récupère le data-status sélectionné
|
||||
let status = $(this).data('status');
|
||||
|
||||
// Cache tous les containers, puis affiche celui correspondant au data-status
|
||||
$('.containerGroupStatus').removeClass('d-flex').hide();
|
||||
$('.containerGroupStatus[data-status="' + status + '"]').addClass("d-flex").show();
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
|
Reference in New Issue
Block a user