ninegate/src/ninegate-1.0/src/Cadoles/PortalBundle/Resources/views/Projecttask/view.html.twig

254 lines
11 KiB
Twig

{% extends '@CadolesCore/base.html.twig' %}
{% block localstyle %}
.slider-volume {
width:100%
}
{% endblock %}
{% block appmenu %}
<ul class="nav navbar-top-links navbar-left">
<li id="menuproject-0" class="{% if entity.id is not defined %}active{%endif%}" style="cursor:pointer">
<a href="{{ path("cadoles_portal_user_project_view") }}">
Tout
</a>
</li>
{% for project in projects %}
<li id="menuproject-{{project.id}}" data-open="{% if project.canupdate %}true{%endif%}" class="{% if entity.id is defined and entity.id==project.id%}active{%endif%}" style="cursor:pointer">
<a href="{{ path("cadoles_portal_user_project_view",{'id':project.id}) }}">
{{ project.name }}
{% if project.canadd %}
<i class="fa fa-pencil"></i>
{% else %}
<i class="fa fa-lock"></i>
{% endif %}
</a>
</li>
{% endfor %}
</ul>
{% endblock %}
{% block pagewrapper %}
{% if access=="config" %}
<div class="pagemenu">
<a href="{{ path('cadoles_portal_config_project_view', {id:entity.project.id})}}">{{ entity.project.name }}</a>
</div>
{% else %}
<div style="margin:10px 0px 10px 0px; text-align:left; display:inline-block;width:49%">
{% if not idpage is empty %}
<a href="{{path('cadoles_portal_user_page_view',{id:idpage,usage:'group',group:idgroup})}}" class="btn btn-success">Revenir sur le Groupe</a>
{% endif %}
</div>
<ul class="nav navbar-default nav-pills">
<li id="menuproject-0" class="{% if entity.id is not defined %}active{%endif%}" style="cursor:pointer">
<a href="{{ path("cadoles_portal_user_project_view") }}">
Tout
</a>
</li>
{% for project in projects %}
<li id="menuproject-{{project.id}}" data-open="{% if project.canupdate %}true{%endif%}" class="{% if entity.id is defined and entity.id==project.id%}active{%endif%}" style="cursor:pointer">
<a href="{{ path("cadoles_portal_user_project_view",{'id':project.id}) }}">
{{ project.name }}
{% if project.canadd %}
<i class="fa fa-pencil"></i>
{% else %}
<i class="fa fa-lock"></i>
{% endif %}
</a>
</li>
{% endfor %}
</ul>
{% endif %}
<div class="projecttask">
<div class="row">
<div class="col col-md-9">
<div class="projecttitle">
<legend>
<h1 >{{entity.name}}</h1>
</legend>
{% if canadd %}
<br><a class="pull-right btn btn-primary" href="{{ path("cadoles_portal_"~access~"_projecttask_update",{'id':entity.id}) }}">Modifier</a>
{% endif %}
<small>Affectée à =
{% if entity.user is empty %}
{{ entity.owner.username }}
{% else %}
{{ entity.user.username }}
{%endif%}
<br>Crée le = {{ entity.submit|date("d/m/Y à H:i") }}
<br>Dans le projet = {{entity.project.name }}</small>
<br><small>Priorité = {{ entity.priority }}</small>
{% if entity.end %}
<br><small>A Réaliser avant le = {{ entity.end|date("d/m/Y") }}</small>
{%endif%}
{% if entity.projecttasktag %}
<br><small>Type = {{ entity.projecttasktag.name }}</small>
{% endif %}
{% if entity.projecttaskstatus %}
<br><small>Statut = {{ entity.projecttaskstatus.name }}</small>
{% endif %}
</div>
<div class="projectbody">
{{ entity.description | raw }}
</div>
<hr>
<a href="{{path('cadoles_portal_'~access~'_projectcomment_submit',{"idtask":entity.id}) }}" style="width:100%" class="btn btn-success">Ajouter un commentaire</a>
{% if not entity.projectcomments is empty %}
{% for comment in entity.projectcomments|reverse %}
<div class="projecttitle">
<legend><h2>{{comment.name}}</h2></legend>
<small>publié par {{ comment.user.username }} le {{ comment.submit|date("d/m/Y à H:i") }}</small>
{% if canadd or app.user==comment.user%}
<a href="{{ path("cadoles_portal_"~access~"_projectcomment_update",{'id':comment.id}) }}"><i class="fa fa-file"></i></a>
{% endif %}
</div>
<div class="projectbody">
{{ comment.description | raw }}
</div>
{% endfor %}
{% endif %}
</div>
<div class="col col-md-3" style="margin-top:20px; text-align:center">
Réalisé à<br>
<span id="percentage" style="font-size:60px">{{ entity.percentage}}</span><small>%</small>
{% if canadd %}
<br>
<div id="slider"></div>
{% endif %}
{% if files|length >= 1 %}
<br>
<div class="grid clearfix">
<div class="grid-sizer grid-small"></div>
<div class="grid-gutter-sizer"></div>
{% for file in files|sort %}
<div class="grid-item grid-small">
<div class="grid-item-content" style="background-color: #{{ color["main"]}}">
{% if canadd %}
<a style="cursor:pointer;color: #{{color['fontcolorhover']}}" onClick="delFile('projecttask-{{ entity.id}}','{{file.name|e('js')|raw }}')" class="item-delete">
<i class="fa fa-trash" title="Supprimer le fichier"></i>
</a>
{% endif %}
<a style="cursor:pointer" href="{{ path('cadoles_core_'~access~'_file_download',{'directory':'projecttask-'~entity.id,'filename':file.name }) }}">
<div class="item-link clearfix">
<div class="grid-item-logo">
{% if file.thumb is not empty %}
<img class="grid-item-img" height="110" src="{{ file.thumb }}">
{% else %}
<img class="grid-item-img" height="110" src="/{{ alias }}/bundles/cadolescore/images/files/_blank.png">
{% endif %}
</div>
<div class="grid-item-title">
<h2>{{ file.name }}</h2>
</div>
</div>
</a>
</div>
</div>
{% endfor %}
</div>
{% endif %}
{% if canadd %}
<div data-toggle="modal" data-target="#mymodal" onClick="ModalLoad('mymodal','Fichiers','{{ path('cadoles_core_'~access~'_file_upload',{'id': 'projecttask-'~entity.id,'type':'all'}) }}');" title="Ajouter des fichiers" class="grid-item-content" style="cursor:pointer;margin-top:20px;">
<img class="grid-item-img imageshadow" height="60" src="/ninegate/uploads/icon/icon_add.png">
<br>Ajouter des fichiers
</div>
{% endif %}
</div>
</div>
</div>
{% endblock %}
{% block localjavascript %}
var idproject;
$('document').ready(function(){
{% if canadd %}
$( "#slider" ).slider({
min: 0,
max: 100,
step: 10,
value: {{ entity.percentage }}
});
{% endif %}
{% if entity.id is defined %}
{% for project in projects %}
{% if project.id==entity.project.id %}
showProject({{ project.id }}, {{ project.canupdate }});
{% endif %}
{% endfor %}
{% else %}
showProject(0, {{ canupdate }});
{% endif %}
var optiongrid={columnWidth: '.grid-sizer',itemSelector: '.grid-item', gutter: '.grid-gutter-sizer'};
// Création des grilles d'items
$('body').imagesLoaded(function() {
var grid = $('.grid').masonry(optiongrid);
});
});
{% if canadd %}
$( "#slider" ).on( "slidestop", function( event, ui ) {
$.ajax({
method: "POST",
url: "{{ path('cadoles_portal_'~access~'_projecttask_percentage',{'id':entity.id}) }}",
data: {
percentage:ui.value,
},
success: function() {
$("#percentage").html(ui.value);
}
});
} );
{% endif %}
// Affichages des projects
function showProject(id,canupdate) {
// Rendre actif le page en cours dans le menu
$(".navbar-top-links li").removeClass("active");
$(".nav-pills li").removeClass("active");
$("#menuproject-"+id).addClass("active");
}
// Supprimer un fichier
function delFile(directory,filename) {
var r = confirm("Confirmez-vous la suppression de ce fichier ?");
if (r == true) {
$.ajax({
method: "POST",
url: "{{ path('cadoles_core_'~access~'_file_delete') }}",
data: {
directory:directory,
filename:filename
},
success: function() {
location.reload();
}
});
}
}
{% endblock %}