{% extends 'content/baseImmemory.html.twig' %}
{# extends 'realisations/immemory/base.html.twig' #}
{% block title %}{{ stack.nom }} {% endblock %}
{% block body %}
<div class="col-12 menuShow">
{% include "content/structure/breadcrumb.html.twig" %}
</div>
<div class="container-fluid">
<div class="row fondintro">
<div class="col-12 titreCard">
<h1>
{{ stack.nom }}
</h1>
</div>
<div class="col-12 col-md-6 showAdmin">
<div class="zonesImg{{ stack.id }}" style="position:relative; ">
<img src="{{ pathLocal }}/{{ stack.urlImage }}" alt="{{ stack.urlImage }}" class=" img-fluid">
{% include "content/structure/zonesActives.html.twig" %}
</div>
</div>
<div class="col-12 col-md-6">
<div class="col-12 details">
<ul>
<li>Id : <span class="categorie_details">{{ stack.id }}</span></li>
<li>Catégorie : <span class="categorie_details">{{ stack.Scategorie.nom }}</span></li>
<li>Séquence : <span class="categorie_details">{{ stack.Ssequence.nom }}</span></li>
<li>Card : <span class="categorie_details">{{ stack.nom }}</span></li>
</ul>
</div>
<div class="col-12 showBtns">
<a class="btn btnImmemory" href="{{ path('front_cdrom_900_ciblebif', {'id': stack.id}) }}" target="_blank">
voir dans CDRom
</a>
{% if app.user is not null %}
{% for role in app.user.roles %}
{% if role == "ROLE_ADMIN" %}
<a class="btn btnImmemory" href="{{ path('admin_stacks_edit', {'id': stack.id}) }}">
Modifier
</a>
<a class="btn btnImmemory" href="{{ path('admin_stacks_delete', {'id': stack.id}) }}">
Supprimer
</a>
{% else %}
{% endif %}
{% endfor %}
{% endif %}
{% if recherche == 0 %}
<a class="btn btnImmemory rouge" href="{{ urlBack }}">
{% else %}
<a class="btn btnImmemory rouge" href="{{ path('webSite_stacks_sequence_recherche', {'page': 1, 'search': recherche }) }}">
{% endif %}
Retour
</a>
</div>
<div class="listNav">
<h3>Navigation :</h3>
<div id="navigationImmemory" class="">
{% include "content/structure/menuZonesActives.html.twig" %}
</div>
</div>
{% if app.user is not null %}
<h3>Commentaires :</h3>
{% if stack.commentaires|length == 0 %}
Pas de Commentaire
{% else %}
{% for comm in stack.commentaires %}
<div class="commentaire" style="background-color:beige; padding:7px 7px 0 7px;border: 1px solid grey;">
{{ comm.texte|raw }}
<div class="row" style="padding:4px 0; border-top:1px solid grey; ">
<div class="col-6" style="text-align: left;">
<small> {{ comm.userCrea[0].username|slice(0, 1) | capitalize }}{{ comm.userCrea[0].id }} le {{ comm.dateModif|date("d m Y") }} à {{ comm.dateModif|date("H:i:s") }} </small>
</div>
<div class="col-6" style="text-align:right;">
{% if app.user.id == comm.userCrea[0].id or app.user.roles[0] == "ROLE_ADMIN" %}
<a id="btnModifComm_{{ comm.id }}" href="#ligne_{{ stack.id }}" class="btn btn-sm btn-warning" title="Modifier">
<i class="fa fa-pencil-square-o" aria-hidden="true"></i>
</a>
<a id="btnSupprComm_{{ comm.id }}" href="#ligne_{{ stack.id }}" class="btn btn-sm btn-danger" title="Effacer">
<i class="fa fa-trash" aria-hidden="true"></i>
</a>
{% endif %}
</div>
</div>
</div>
{% endfor %}
{% endif %}
{% else %}
{% endif %}
<br><br>
<h3>Médias :</h3>
{% if stack.film.nom is defined and stack.film.nom != "-" and stack.film.nom != "Vide" and stack.film.id != 1 %}
<!-- film -->
<h3>Movies :</h3>
<h5> {{ stack.film.id }}. {{ stack.film.nom }} </h5>
{% else %}
<i> No clip</i> <br>
{% endif %}
<br><br>
{% if stack.transitIn.son0 is defined and stack.transitIn.son0 is not null %}
<!-- Son -->
<h3>Sound :</h3>
<h5> {{ stack.transitIn.son0 }} </h5>
{% else %}
<i>No sound </i><br>
{% endif %}
</div>
<div id="txt" class=" col-12 textShowAdmin">
{% if stack.texte is defined and stack.texte is not null %}
<!-- Texte -->
<h3>Text :</h3>
<p> {{ stack.texte|raw }} </p>
{% else %}
<i> No text</i> <br>
{% endif %}
</div>
</div>
</div>
<div id="fondForm" class="fondForm" style="
background-color: black;
position: fixed;
display: none;
width: 100%;
height: 100%; color:white;
top:0; left:0; z-index:200; opacity:1;">
<div class="container">
<div class="row justify-content-center">
<div id="contenuForm" class="col-12">
</div>
</div>
</div>
</div>
{% endblock %}
{% block javascripts %}
<script type="text/javascript">
$(function(){
// ---------------------------------------
// gestion du bouton ajouter un commentaire
$('[id ^= "btnAjouteComm_"]').click(function(){
// recup code
monid = $(this).attr('id').substr(14);
console.log( monid );
// affiche le fond du formulaire
$("#fondForm").show(145);
// charge le formulaire d'ajout de commentaire dans le fond du formulaire
$.ajax({
type: "POST",
url: "{{ path('membre_stacks_commentaire_formAjoute') }}",
data: {
cardId: $(this).attr('id').substr(14),
},
success: function(msg)
{
// affiche le code de la stack
$( "#contenuForm" ).html( msg );
$("#btnCloseForm").click(function(){
$("#fondForm").hide(145);
});
$("#btnCloseForm2").click(function(){
$("#fondForm").hide(145);
});
$('[name ^= "form"]').submit(function(evt){
evt.preventDefault();
// recup données
texte = CKEDITOR.instances['form_texte'].getData()
$.ajax({
type: "POST",
url: "{{ path('membre_stacks_commentaire_formTraitement') }}",
data: {
texte: texte,
monid: monid,
},
success: function(msg2)
{
console.log("formTraitement " + msg2['ok']);
$("#fondForm").hide(145);
location.reload(true);
}
});
console.log("submit form " + texte);
});
}
});
});
// gestion du bouton ajouter un commentaire
$('[id ^= "btnModifComm_"]').click(function(){
// recup code
monid = $(this).attr('id').substr(13);
console.log( monid );
// affiche le fond du formulaire
$("#fondForm").show(145);
// charge le formulaire d'ajout de commentaire dans le fond du formulaire
$.ajax({
type: "POST",
url: "{{ path('membre_stacks_commentaire_formModif') }}",
data: {
commId: monid,
},
success: function(msg)
{
// affiche le code de la stack
$( "#contenuForm" ).html( msg );
$("#btnCloseForm").click(function(){
$("#fondForm").hide(145);
$( "#contenuForm" ).html( "" );
});
$("#btnCloseForm2").click(function(){
$("#fondForm").hide(145);
$( "#contenuForm" ).html( "" );
});
//
$('[name ^= "form"]').submit(function(evt){
evt.preventDefault();
// recup données
texte = CKEDITOR.instances['form_texte'].getData()
$.ajax({
type: "POST",
url: "{{ path('membre_stacks_commentaire_formModifTraitement') }}",
data: {
texte: texte,
monid: monid,
},
/*
*/
success: function(msg2)
{
console.log("formModifTraitement " + msg2['ok']);
$("#fondForm").hide(145);
$( "#contenuForm" ).html( "" );
location.reload(true);
}
});
console.log("submit form " + texte);
});
}
});
});
// gestion du bouton ajouter un commentaire
$('[id ^= "btnSupprComm_"]').click(function(){
// recup code
monid = $(this).attr('id').substr(13);
console.log( monid );
// affiche le fond du formulaire
$("#fondForm").show(145);
// charge le formulaire d'ajout de commentaire dans le fond du formulaire
$.ajax({
type: "POST",
url: "{{ path('membre_stacks_commentaire_formSuppr') }}",
data: {
commId: monid,
},
success: function(msg)
{
// affiche le code de la stack
$( "#contenuForm" ).html( msg );
$("#btnCloseForm").click(function(){
$("#fondForm").hide(145);
$( "#contenuForm" ).html( "" );
});
$("#btnCloseForm2").click(function(){
$("#fondForm").hide(145);
$( "#contenuForm" ).html( "" );
});
//
$('[id ^= "btnSuppCommOui_"]').click(function(){
console.log("oui");
$.ajax({
type: "POST",
url: "{{ path('membre_stacks_commentaire_formSupprTraitement') }}",
data: {
monid: monid,
},
success: function(msg2)
{
console.log("formSupprTraitement " + msg2['ok']);
$("#fondForm").hide(145);
$( "#contenuForm" ).html( "" );
location.reload(true);
}
/*
*/
});
});
}
});
});
});
</script>
{% endblock %}