ninegitea/src/ninegitea-1.0/templates/Scrum/view.html.twig

342 lines
13 KiB
Twig
Raw Normal View History

2021-07-20 13:04:47 +02:00
{% extends "base.html.twig" %}
{% block localstyle %}
html { height:100%}
body { height:100%; background-color:#efefef;}
main { height:100%}
h3 { font-size:14px; margin-top:15px;}
#mycontent { width: 5000px;}
2022-01-11 13:39:51 +01:00
.btn-link {
cursor:pointer;
}
.control-label {
margin-bottom:0px;
}
.tag {
border-radius: 5px;
padding: 8px 8px;
margin-bottom: 5px;
display: inline-block;
min-width: 35px;
text-align: center;
color: #ffffff !important;
zoom: 80%;
}
.tag i {
margin-right:5px;
}
.assignee {
width:30px;
margin: 5px 5px 0px 0px;
}
2021-07-20 13:04:47 +02:00
{% endblock %}
{% block body %}
2022-01-11 13:39:51 +01:00
<div class="d-flex justify-content-start mt-3">
<div style="width:585px" class="pr-2">
<label class="control-label">Filtre JALONS</label>
<select id="filtermilestones" multiple="multiple" class="form-control">
{% for giteamilestone in giteamilestones %}
<option value="{{giteamilestone.id}}">{{giteamilestone.title}}</option>
{% endfor %}
<option value="-100">Aucun</option>
</select>
</div>
<div style="width:585px" class="pr-2">
<label class="control-label">Filtre ETIQUETTES</label>
<select id="filterlabels" multiple="multiple" class="form-control">
{% for gitealabel in gitealabels %}
<option value="{{gitealabel.id}}">{{gitealabel.name}}</option>
{% endfor %}
</select>
</div>
<div style="width:585px" class="pr-2">
<label class="control-label">Filtre AFFECTATIONS</label>
<select id="filterassignees" multiple="multiple" class="form-control">
{% for giteaassignee in giteaassignees %}
<option value="{{giteaassignee.id}}">{{giteaassignee.login}}</option>
{% endfor %}
</select>
</div>
</div>
2021-07-20 13:04:47 +02:00
{% for column in scrum.scrumcolumns %}
{% set idmiletone="-100" %}
{% set tbidmiletone=[] %}
{% set haveissues=false %}
2022-01-11 13:39:51 +01:00
<div class="card d-inline-block mt-3 align-top mb-5" data-column="{{column.giteaid}}" style="width: 18rem;">
2021-07-20 13:04:47 +02:00
<div class="card-header">{{ column.name }}</div>
<div class="card-body p-1">
{% for issue in column.scrumissues %}
{% set haveissues=true %}
{% if idmiletone!=issue.giteamilestone %}
{% if idmiletone!=-100 %}</ul>{% endif %}
{% if issue.giteamilestone is empty %}
{% set tbidmiletone = tbidmiletone|merge([-100]) %}
2022-01-11 13:39:51 +01:00
{% set idmilestone = -100 %}
{% set namemilestone = "Aucun" %}
2021-07-20 13:04:47 +02:00
{% else %}
{% set tbidmiletone = tbidmiletone|merge([issue.giteamilestone]) %}
2022-01-11 13:39:51 +01:00
{% set idmilestone = issue.giteamilestone %}
{% set namemilestone = issue.giteajson.milestone.title %}
2021-07-20 13:04:47 +02:00
{% endif %}
2022-01-11 13:39:51 +01:00
<h3 data-milestone="{{idmilestone}}">JALON = {{namemilestone}}</h3>
<ul class="scrumcolumn list-group" style="min-height:50px" data-column="{{column.giteaid}}" data-milestone="{{idmilestone}}">
2021-07-20 13:04:47 +02:00
{% set idmiletone=issue.giteamilestone %}
{% endif %}
2022-01-11 13:39:51 +01:00
{% set datalabels="" %}
{% for label in issue.giteajson.labels %}
{% if label.id not in giteacolumns %}
{% set datalabels=datalabels~"datalabel"~label.id~" " %}
{% endif %}
{% endfor %}
{% set dataassignees="" %}
{% for assignee in issue.giteajson.assignees %}
{% set dataassignees=dataassignees~"dataassignee"~assignee.id~" " %}
{% endfor %}
<div data-id="{{ issue.id }}" data-issue="{{ issue.id }}" data-column="{{column.giteaid}}" data-milestone="{{idmilestone}}" class="card mb-1 issue issue-{{issue.id}} {{datalabels}} {{dataassignees}}">
2021-07-20 13:04:47 +02:00
<div class="card-footer p-1" style="line-height:10px; border-top:none;">
2021-12-06 15:39:12 +01:00
<div class="float-left btn btn-link p-0 m-0 fas fa-arrows-alt" style="cursor:move"></div>
<a target="_blank" class="modcolumn btn btn-link float-right fa fa-file p-0 m-0" href="{{issue.giteajson.html_url}}"></a>
2021-07-20 13:04:47 +02:00
</div>
<div class="card-body p-1" style="line-height:10px;">
<div class="d-inline-block">
<small>
2022-01-11 13:39:51 +01:00
{{issue.giteanumber}} - {{ issue.giteatitle }}<br><br>
{% for label in issue.giteajson.labels %}
{% if label.id not in giteacolumns %}
<span class="btn-link tag" style="background-color:#{{label.color}}">
<i class="fas fa-tag"></i>
{{ label.name }}
</span>
{% endif %}
{% endfor %}
<div>
{% for assignee in issue.giteajson.assignees %}
<img src="{{assignee.avatar_url}}" class="assignee" title="{{assignee.username}}">
{% endfor %}
</div>
2021-07-20 13:04:47 +02:00
</small>
</div>
</div>
</div>
{% endfor %}
{% if haveissues %}
</ul>
{% endif %}
{% for giteamilestone in giteamilestones %}
{% if giteamilestone.id not in tbidmiletone %}
2022-01-11 13:39:51 +01:00
<h3 data-milestone="{{giteamilestone.id}}"> JALON = {{giteamilestone.title}}</h3>
<ul class="scrumcolumn list-group" style="min-height:50px" data-column="{{ column.giteaid }}" data-milestone="{{giteamilestone.id}}"></ul>
2021-07-20 13:04:47 +02:00
{% endif %}
{%endfor%}
{% if -100 not in tbidmiletone %}
2022-01-11 13:39:51 +01:00
<h3 data-milestone="-100"> JALON = Aucun</h3>
<ul class="scrumcolumn list-group" style="min-height:50px" data-column="{{ column.giteaid }}" data-milestone="-100"></ul>
2021-07-20 13:04:47 +02:00
{% endif %}
</div>
</div>
{% endfor %}
{% endblock %}
{% block localjavascript %}
2022-01-11 13:39:51 +01:00
2021-07-20 13:04:47 +02:00
$(document).ready(function() {
2022-01-11 13:39:51 +01:00
// Apply Filter
function showhide() {
if($("#filtermilestones").val().length !== 0) {
$("[data-milestone]").hide();
$.each($("#filtermilestones").val(), function( index, value ) {
$("[data-milestone="+value+"]").show();
});
}
else $("[data-milestone]").show();
$(".issue").hide();
if($("#filterlabels").val().length !== 0) {
$( ".issue" ).each(function( index ) {
domissue=$(this);
$.each($("#filterlabels").val(), function( index, value ) {
if (domissue.hasClass("datalabel"+value))
domissue.show();
});
});
}
if($("#filterassignees").val().length !== 0) {
$( ".issue" ).each(function( index ) {
domissue=$(this);
$.each($("#filterassignees").val(), function( index, value ) {
if (domissue.hasClass("dataassignee"+value))
domissue.show();
});
});
}
if($("#filterlabels").val().length === 0 && $("#filterassignees").val().length === 0)
$(".issue").show();
}
// Filter Milestones
function filtermilestones() {
$.ajax({
method: "POST",
url: "{{ path('app_user_preference') }}",
data: {
key:'filtermilestones',
id:{{scrum.id}},
value: $("#filtermilestones").val()
}
});
showhide();
}
$('#filtermilestones').select2();
{% if filtermilestones %}
{% for milestone in filtermilestones %}
$("#filtermilestones").val($("#filtermilestones").val().concat("{{milestone}}"));
{%endfor%}
$('#filtermilestones').trigger('change');
{% endif %}
$('#filtermilestones').on("select2:select", function(e) {
filtermilestones();
});
$('#filtermilestones').on("select2:unselect", function(e) {
filtermilestones();
});
// Filter Labels
function filterlabels() {
$.ajax({
method: "POST",
url: "{{ path('app_user_preference') }}",
data: {
key:'filterlabels',
id:{{scrum.id}},
value: $("#filterlabels").val()
}
});
showhide();
}
$('#filterlabels').select2();
{% if filterlabels %}
{% for label in filterlabels %}
$("#filterlabels").val($("#filterlabels").val().concat("{{label}}"));
{%endfor%}
$('#filterlabels').trigger('change');
{% endif %}
$('#filterlabels').on("select2:select", function(e) {
filterlabels();
});
$('#filterlabels').on("select2:unselect", function(e) {
filterlabels();
});
// Filtre Assignees
function filterassignees() {
$.ajax({
method: "POST",
url: "{{ path('app_user_preference') }}",
data: {
key:'filterassignees',
id:{{scrum.id}},
value: $("#filterassignees").val()
}
});
showhide();
}
$('#filterassignees').select2();
{% if filterassignees %}
{% for assignee in filterassignees %}
$("#filterassignees").val($("#filterassignees").val().concat("{{assignee}}"));
{%endfor%}
$('#filterassignees').trigger('change');
{% endif %}
$('#filterassignees').on("select2:select", function(e) {
filterassignees();
});
$('#filterassignees').on("select2:unselect", function(e) {
filterassignees();
});
// Appliy filters
showhide();
// Sort columns
2021-07-20 13:04:47 +02:00
$( ".scrumcolumn" ).sortable({
handle: ".fa-arrows-alt",
connectWith: ".scrumcolumn",
cursor: "move",
2021-12-06 15:39:12 +01:00
update: function( event, ui ) {
2021-07-20 13:04:47 +02:00
id=$(ui.item).data("issue");
2022-01-11 13:39:51 +01:00
oldcolumn=$(ui.item).data("column");
2021-07-20 13:04:47 +02:00
oldmilestone=$(ui.item).data("milestone");
2022-01-11 13:39:51 +01:00
newcolumn=$(ui.item).parent().data("column");
2021-07-20 13:04:47 +02:00
newmilestone=$(ui.item).parent().data("milestone");
2022-01-11 13:39:51 +01:00
console.log("ID = "+id+" = Column : "+oldcolumn+">>"+newcolumn+" = Milestone : "+oldmilestone+">>"+newmilestone );
2021-07-20 13:04:47 +02:00
2022-01-11 13:39:51 +01:00
if(oldcolumn!=newcolumn||oldmilestone!=newmilestone) {
2021-07-20 13:04:47 +02:00
$.ajax({
method: "POST",
url: "{{path("app_scrumissue_change")}}",
data: {
id:id,
2022-01-11 13:39:51 +01:00
oldcolumn:oldcolumn,
2021-07-20 13:04:47 +02:00
oldmilestone:oldmilestone,
2022-01-11 13:39:51 +01:00
newcolumn:newcolumn,
2021-07-20 13:04:47 +02:00
newmilestone:newmilestone,
},
success: function() {
2022-01-11 13:39:51 +01:00
$(ui.item).data("column",newcolumn);
2021-07-20 13:04:47 +02:00
$(ui.item).data("milestone",newmilestone);
},
error: function (request, status, error) {
$( ".scrumcolumn" ).sortable('cancel');
}
});
}
2021-12-06 15:39:12 +01:00
lstordered="";
$(".scrumcolumn div" ).each(function( index ) {
if($(this).data("id")) {
if(index==0) lstordered=$(this).data("id");
else lstordered=lstordered+","+$(this).data("id");
2022-01-11 13:39:51 +01:00
}
2021-12-06 15:39:12 +01:00
});
2022-01-11 13:39:51 +01:00
2021-12-06 15:39:12 +01:00
console.log(lstordered);
2022-01-11 13:39:51 +01:00
$.ajax({
method: "POST",
url: "{{path("app_scrumissue_order")}}",
data: {
id:{{scrum.id}},
lstordered:lstordered,
}
});
2021-07-20 13:04:47 +02:00
}
2022-01-13 20:24:04 +01:00
});
2021-07-20 13:04:47 +02:00
});
{% endblock %}