This commit is contained in:
afornerot 2022-02-03 17:26:35 +01:00
parent bbb0297f19
commit 6a31f22fb8
10 changed files with 598 additions and 80 deletions

View File

@ -234,6 +234,28 @@ app_scrumteam_order:
defaults: { _controller: App\Controller\ScrumteamController:order }
#== Scrumpriority ========================================================================================================
app_scrumpriority_submit:
path: /master/scrumpriority/submit/{scrumid}
defaults: { _controller: App\Controller\ScrumpriorityController:submit }
app_scrumpriority_update:
path: /master/scrumpriority/update/{id}
defaults: { _controller: App\Controller\ScrumpriorityController:update }
app_scrumpriority_delete:
path: /master/scrumpriority/delete/{id}
defaults: { _controller: App\Controller\ScrumpriorityController:delete }
app_scrumpriority_select:
path: /master/scrumpriority/select/{scrumid}
defaults: { _controller: App\Controller\ScrumpriorityController:select }
app_scrumpriority_order:
path: /master/scrumpriority/order/{scrumid}
defaults: { _controller: App\Controller\ScrumpriorityController:order }
#== Scrumissue ========================================================================================================
app_scrumissue_change:
path: /user/scrumissue/change

View File

@ -35,6 +35,7 @@ class IssueController extends AbstractController
$giteamilestones=[];
$giteacolumns=[];
$giteateams=[];
$giteaprioritys=[];
$gitealabels=[];
$giteaassignees=$em->getRepository("App:User")->findBy([],["username"=>"ASC"]);
@ -78,6 +79,11 @@ class IssueController extends AbstractController
array_push($giteateams,$team->getGiteajson()["name"]);
}
foreach($scrum->getScrumprioritys() as $priority) {
if(!in_array($priority->getGiteajson()["name"],$giteaprioritys))
array_push($giteaprioritys,$priority->getGiteajson()["name"]);
}
foreach($giteaissues as $giteaissue) {
foreach($giteaissue->labels as $label) {
if(!in_array($label->name,$gitealabels))
@ -91,6 +97,7 @@ class IssueController extends AbstractController
array_multisort($keysort, SORT_DESC, $giteamilestones);
sort($giteacolumns);
sort($giteateams);
sort($giteaprioritys);
sort($gitealabels);
sort($giteacategorys);
@ -100,6 +107,7 @@ class IssueController extends AbstractController
$filtermilestones = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filtermilestones",$id);
$filtercolumns = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filtercolumns",$id);
$filterteams = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterteams",$id);
$filterprioritys = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterprioritys",$id);
$filterlabels = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterlabels",$id);
$filterassignees = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterassignees",$id);
$showfilters = $em->getRepository("App:User")->getUserpreference($this->getUser(),"showfilters",$id);
@ -113,6 +121,7 @@ class IssueController extends AbstractController
"giteamilestones" => $giteamilestones,
"giteacolumns" => $giteacolumns,
"giteateams" => $giteateams,
"giteaprioritys" => $giteaprioritys,
"gitealabels" => $gitealabels,
"giteaassignees" => $giteaassignees,
"filtercategorys" => $filtercategorys,
@ -120,6 +129,7 @@ class IssueController extends AbstractController
"filtermilestones" => $filtermilestones,
"filtercolumns" => $filtercolumns,
"filterteams" => $filterteams,
"filterprioritys" => $filterprioritys,
"filterlabels" => $filterlabels,
"filterassignees" => $filterassignees,
"showfilters" => $showfilters,

View File

@ -35,16 +35,15 @@ class ScrumController extends AbstractController
array_push($giteacategorys,$scrum->getCategory());
$gitearepo=$this->giteaservice->getRepo($scrum->getGiteajson()["id"]);
if(!$gitearepo) die("Probleme de connexion avec gitea veuillez vous <a href='/ninegitea/logout'>reconnecter</a>");
if($gitearepo) {
if($gitearepo->updated_at!=$scrum->getGiteajson()["updated_at"]||$gitearepo->open_issues_count!=$scrum->getGiteajson()["open_issues_count"]) {
$scrum->setGiteajson(json_decode(json_encode($gitearepo), true));
$em->persist($scrum);
$em->flush();
}
if($gitearepo->updated_at!=$scrum->getGiteajson()["updated_at"]||$gitearepo->open_issues_count!=$scrum->getGiteajson()["open_issues_count"]) {
$scrum->setGiteajson(json_decode(json_encode($gitearepo), true));
$em->persist($scrum);
$em->flush();
array_push($gitearepos,$gitearepo);
}
array_push($gitearepos,$gitearepo);
}
sort($giteacategorys);
@ -176,11 +175,12 @@ class ScrumController extends AbstractController
$data=$em->getRepository($this->entity)->find($id);
if(!$data) return $this->redirectToRoute($this->route);
$em->getRepository("App:Scrum")->getGitea($data,$giteaassignees,$giteacolumns,$giteamilestones,$giteateams,$gitealabels);
$em->getRepository("App:Scrum")->getGitea($data,$giteaassignees,$giteacolumns,$giteamilestones,$giteateams,$giteaprioritys,$gitealabels);
// Préférences utilisateur
$filtermilestones = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filtermilestones",$id);
$filterteams = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterteams",$id);
$filterprioritys = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterprioritys",$id);
$filterlabels = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterlabels",$id);
$filterassignees = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterassignees",$id);
$showfilters = $em->getRepository("App:User")->getUserpreference($this->getUser(),"showfilters",$id);
@ -193,12 +193,14 @@ class ScrumController extends AbstractController
'giteacolumns' => $giteacolumns,
'giteamilestones' => $giteamilestones,
'giteateams' => $giteateams,
'giteaprioritys' => $giteaprioritys,
'gitealabels' => $gitealabels,
'filtermilestones' => $filtermilestones,
'filterteams' => $filterteams,
'filterprioritys' => $filterprioritys,
'filterlabels' => $filterlabels,
'filterassignees' => $filterassignees,
"showfilters" => $showfilters,
'showfilters' => $showfilters,
$this->data => $data,
]);
}
@ -210,42 +212,62 @@ class ScrumController extends AbstractController
$data=$em->getRepository($this->entity)->find($id);
if(!$data) return $this->redirectToRoute($this->route);
$em->getRepository("App:Scrum")->getGitea($data,$giteaassignees,$giteacolumns,$giteamilestones,$giteateams,$gitealabels);
$em->getRepository("App:Scrum")->getGitea($data,$giteaassignees,$giteacolumns,$giteamilestones,$giteateams,$giteaprioritys,$gitealabels);
// Préférences utilisateur
$filtermilestones = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filtermilestones",$id);
$filterteams = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterteams",$id);
$showfilters = $em->getRepository("App:User")->getUserpreference($this->getUser(),"showfilters",$id);
$tbstat=[];
foreach($data->getScrumIssues() as $issue) {
$idmilestone=($issue->getGiteamilestone()?$issue->getGiteamilestone():-100);
$lbmilestone=($issue->getGiteamilestone()?$issue->getGiteamilestonename():"Aucun");
if(!array_key_exists($idmilestone,$tbstat)) {
$tbstat[$idmilestone]=["id"=>$idmilestone,"name"=>$lbmilestone,"stat"=>[]];
}
if(!array_key_exists($issue->getScrumcolumn()->getId(),$tbstat[$idmilestone]["stat"])) {
$tbstat[$idmilestone]["stat"][$issue->getScrumcolumn()->getId()]=[
"id"=>$issue->getScrumcolumn()->getId(),
"label"=>$issue->getScrumcolumn()->getName(),
"total"=>0,
"color"=>"#".$issue->getScrumcolumn()->getGiteajson()["color"],
"labels"=>[],
];
}
$labels=$issue->getGiteajson()["labels"];
foreach($labels as $label) {
if($issue->getScrumcolumn()->getGiteaid()!=$label["id"]) {
if(!array_key_exists($label["id"],$tbstat[$idmilestone]["stat"][$issue->getScrumcolumn()->getId()]["labels"])) {
$tbstat[$idmilestone]["stat"][$issue->getScrumcolumn()->getId()]["labels"][$label["id"]] = [
"id"=>$label["id"],
"label"=>$label["name"],
"total"=>0,
"color"=>"#".$label["color"],
];
$haveteams=true;
if($filterteams) {
$haveteams=false;
foreach($filterteams as $filterteam) {
foreach($labels as $label) {
if($label["id"]==$filterteam) {
$haveteams=true;
}
}
$tbstat[$idmilestone]["stat"][$issue->getScrumcolumn()->getId()]["labels"][$label["id"]]["total"]++;
}
}
$tbstat[$idmilestone]["stat"][$issue->getScrumcolumn()->getId()]["total"]++;
if($haveteams) {
$idmilestone=($issue->getGiteamilestone()?$issue->getGiteamilestone():-100);
$lbmilestone=($issue->getGiteamilestone()?$issue->getGiteamilestonename():"Aucun");
if(!array_key_exists($idmilestone,$tbstat)) {
$tbstat[$idmilestone]=["id"=>$idmilestone,"name"=>$lbmilestone,"stat"=>[]];
}
if(!array_key_exists($issue->getScrumcolumn()->getId(),$tbstat[$idmilestone]["stat"])) {
$tbstat[$idmilestone]["stat"][$issue->getScrumcolumn()->getId()]=[
"id"=>$issue->getScrumcolumn()->getId(),
"label"=>$issue->getScrumcolumn()->getName(),
"total"=>0,
"color"=>"#".$issue->getScrumcolumn()->getGiteajson()["color"],
"labels"=>[],
];
}
foreach($labels as $label) {
if($issue->getScrumcolumn()->getGiteaid()!=$label["id"]) {
if(!array_key_exists($label["id"],$tbstat[$idmilestone]["stat"][$issue->getScrumcolumn()->getId()]["labels"])) {
$tbstat[$idmilestone]["stat"][$issue->getScrumcolumn()->getId()]["labels"][$label["id"]] = [
"id"=>$label["id"],
"label"=>$label["name"],
"total"=>0,
"color"=>"#".$label["color"],
];
}
$tbstat[$idmilestone]["stat"][$issue->getScrumcolumn()->getId()]["labels"][$label["id"]]["total"]++;
}
}
$tbstat[$idmilestone]["stat"][$issue->getScrumcolumn()->getId()]["total"]++;
}
}
foreach($tbstat as $k1=>$milestone) {
@ -264,7 +286,11 @@ class ScrumController extends AbstractController
'giteacolumns' => $giteacolumns,
'giteamilestones' => $giteamilestones,
'giteateams' => $giteateams,
'giteaprioritys' => $giteaprioritys,
'gitealabels' => $gitealabels,
'filtermilestones' => $filtermilestones,
'filterteams' => $filterteams,
'showfilters' => $showfilters,
$this->data => $data,
'tbstat' => $tbstat,
]);

View File

@ -79,6 +79,12 @@ class Scrum
*/
private $scrumteams;
/**
* @ORM\OneToMany(targetEntity="Scrumpriority", mappedBy="scrum", cascade={"persist"}, orphanRemoval=true)
* @ORM\OrderBy({"rowid" = "ASC"})
*/
private $scrumprioritys;
public function getStatistique()
{
$id=-100;
@ -103,6 +109,7 @@ class Scrum
$this->scrumcolumns = new ArrayCollection();
$this->scrumissues = new ArrayCollection();
$this->scrumteams = new ArrayCollection();
$this->scrumprioritys = new ArrayCollection();
}
public function getId(): ?int
@ -302,4 +309,35 @@ class Scrum
return $this;
}
/**
* @return Collection|Scrumpriority[]
*/
public function getScrumprioritys(): Collection
{
return $this->scrumprioritys;
}
public function addScrumpriority(Scrumpriority $scrumpriority): self
{
if (!$this->scrumprioritys->contains($scrumpriority)) {
$this->scrumprioritys[] = $scrumpriority;
$scrumpriority->setScrum($this);
}
return $this;
}
public function removeScrumpriority(Scrumpriority $scrumpriority): self
{
if ($this->scrumprioritys->contains($scrumpriority)) {
$this->scrumprioritys->removeElement($scrumpriority);
// set the owning side to null (unless already changed)
if ($scrumpriority->getScrum() === $this) {
$scrumpriority->setScrum(null);
}
}
return $this;
}
}

View File

@ -16,7 +16,7 @@ class ScrumRepository extends ServiceEntityRepository
$this->giteaservice = $giteaservice;
}
public function getGitea($scrum,&$giteaassignees,&$giteacolumns,&$giteamilestones,&$giteateams,&$gitealabels) {
public function getGitea($scrum,&$giteaassignees,&$giteacolumns,&$giteamilestones,&$giteateams,&$giteaprioritys,&$gitealabels) {
// Récupérer le dernier order
$last = $this->_em->getRepository('App:Scrumissue')->findOneBy(["scrum"=>$scrum], ['rowid' => 'DESC']);
if(!$last) $lastrowid=-1;
@ -40,6 +40,13 @@ class ScrumRepository extends ServiceEntityRepository
array_push($giteateams,$team->getGiteaid());
}
// Récupérer les prioritys
$prioritys=$this->_em->getRepository('App:Scrumpriority')->findBy(["scrum"=>$scrum], ['rowid' => 'ASC']);
$giteaprioritys=[];
foreach($prioritys as $priority) {
array_push($giteaprioritys,$priority->getGiteaid());
}
// Récupérer la orga de gitea
if(!empty($scrum->getGiteajson()["owner"]["email"]))
$giteaassignees=[$scrum->getGiteajson()["owner"]];
@ -75,7 +82,7 @@ class ScrumRepository extends ServiceEntityRepository
$gitealabels=$this->giteaservice->getLabels($scrum->getGiteajson()["owner"]["login"],$scrum->getGiteajson()["name"]);
if(!is_array($gitealabels)) die("Probleme de connexion avec gitea veuillez vous <a href='/ninegitea/logout'>reconnecter</a>");
foreach($gitealabels as $key => $gitealabel) {
if(in_array($gitealabel->id,$giteacolumns)||in_array($gitealabel->id,$giteateams))
if(in_array($gitealabel->id,$giteacolumns)||in_array($gitealabel->id,$giteateams)||in_array($gitealabel->id,$giteaprioritys))
unset($gitealabels[$key]);
}

View File

@ -31,7 +31,7 @@
{% block body %}
<div class="d-flex">
<div id="filters" class="d-flex flex-column pl-2 pr-2 " style="width:350px; background-color:var(--colorbgbodydark);min-height:1000px;">
<div id="filters" class="d-flex flex-column pl-2 pr-2 " style="width:350px; background-color:var(--colorbgbodydark);min-height:1500px;">
<div style="width:100%" class="mt-3">
<label class="control-label" style="color:var(--colorftbodydark)">Filtre TICKET</label>
<input type="number" id="filterticket" class=" form-control">
@ -84,11 +84,20 @@
</select>
</div>
<div style="width:100%" class="mt-3">
<label class="control-label" style="color:var(--colorftbodydark)">Filtre PRIORITES</label>
<select id="filterprioritys" multiple="multiple" class="form-control">
{% for giteapriority in giteaprioritys %}
<option value="{{giteapriority}}">{{giteapriority}}</option>
{% endfor %}
</select>
</div>
<div style="width:100%" class="mt-3">
<label class="control-label" style="color:var(--colorftbodydark)">Filtre ETIQUETTES</label>
<select id="filterlabels" multiple="multiple" class="form-control">
{% for gitealabel in gitealabels %}
{% if gitealabel not in giteacolumns and gitealabel not in giteateams %}
{% if gitealabel not in giteacolumns and gitealabel not in giteateams and gitealabel not in giteaprioritys %}
<option value="{{gitealabel}}">{{gitealabel}}</option>
{% endif %}
{% endfor %}
@ -108,6 +117,10 @@
<div class="pl-3" style="width:100%;">
<div class="mt-4 mb-3" style="zoom:80%">
<button class="btn btn-success" onClick="showFilters()"><i class="fas fa-filter"></i></button>
{% if id!=0 %}
<a class="btn btn-success" href="{{path('app_scrum_view',{id:id})}}"><i class="fas fa-columns"></i></a>
<a class="btn btn-success" href="{{path('app_scrum_stat',{id:id})}}"><i class="fas fa-chart-area"></i></a>
{% endif %}
<span id="textfilters"></span>
</div>
@ -121,6 +134,7 @@
<th style="width:135px"class="no-string">N°</th>
<th style="width:1000px">Titre</th>
<th style="width:200px">Equipe</th>
<th style="width:250px">Priorité</th>
<th style="width:135px">Affecté à</th>
<th style="width:300px">Etiquettes</th>
</tr>
@ -142,6 +156,10 @@
{% set statut = "Backlog" %}
{% set teams = "" %}
{% set datateams = "" %}
{% set prioritys = '<span class="btn-link tag mr-1" style="background-color:#70c24a"><i class="fas fa-tag"></i>'~giteaprioritys|last~'</span>' %}
{% set dataprioritys = ','~giteaprioritys|last %}
{% set prioritys = '<span class="btn-link tag mr-1" style="background-color:#70c24a"><i class="fas fa-tag"></i>'~giteaprioritys|last~'</span>' %}
{% set dataprioritys = ','~giteaprioritys|last %}
{% set labels = "" %}
{% set datalabels = "" %}
{% for label in giteaissue.labels %}
@ -150,6 +168,9 @@
{% elseif label.name in giteateams %}
{% set teams=teams~'<span class="btn-link tag mr-1" style="background-color:#'~label.color~'"><i class="fas fa-tag"></i>'~label.name~'</span>' %}
{% set datateams=datateams~','~label.name %}
{% elseif label.name in giteaprioritys %}
{% set prioritys='<span class="btn-link tag mr-1" style="background-color:#'~label.color~'"><i class="fas fa-tag"></i>'~label.name~'</span>' %}
{% set dataprioritys=','~label.name %}
{% else %}
{% set labels=labels~'<span class="btn-link tag mr-1" style="background-color:#'~label.color~'"><i class="fas fa-tag"></i>'~label.name~'</span>' %}
{% set datalabels=datalabels~','~label.name %}
@ -161,7 +182,7 @@
{% set dataassignees=dataassignees~','~assignee.username %}
{% endfor %}
<tr data-category="{{gitearepo.category}}" data-repo="{{datarepo}}" data-milestone="{{datamilestone}}" data-ticket="{{dataticket}}" data-column="{{statut}}" data-teams="{{datateams}}" data-labels="{{datalabels}}" data-assignees="{{dataassignees}}">
<tr data-category="{{gitearepo.category}}" data-repo="{{datarepo}}" data-milestone="{{datamilestone}}" data-ticket="{{dataticket}}" data-column="{{statut}}" data-teams="{{datateams}}" data-prioritys="{{dataprioritys}}" data-labels="{{datalabels}}" data-assignees="{{dataassignees}}">
<td>
<a target="_blank" class="btn btn-link fa fa-file" href="{{giteaissue.html_url}}"></a>
</td>
@ -169,9 +190,15 @@
<td>{% if giteaissue.milestone %}{{ giteaissue.milestone.title }} {%endif%}</td>
<td>{{ statut }}</td>
<td>{{ giteaissue.number }}</td>
<td>{{ giteaissue.title }}</td>
<td><a target="_blank" href="{{giteaissue.html_url}}">{{ giteaissue.title }}</a></td>
<td>{{ teams|raw }}</td>
<td>
<td>{{ prioritys|raw }}</td>
{% set dataorder="" %}
{% for assignee in giteaissue.assignees %}
{% set dataorder=dataorder~assignee.username %}
{% endfor %}
<td data-order="{{dataorder}}">
{% for assignee in giteaissue.assignees %}
<img src="{{assignee.avatar_url}}" class="assignee" title="{{assignee.username}}">
{% endfor %}
@ -221,6 +248,7 @@
milestonefilters=$("#filtermilestones").val();
columnfilters=$("#filtercolumns").val();
teamfilters=$("#filterteams").val();
priorityfilters=$("#filterprioritys").val();
labelfilters=$("#filterlabels").val();
assigneefilters=$("#filterassignees").val();
@ -235,6 +263,7 @@
milestone = $(el).data('milestone');
column = $(el).data('column');
teams = $(el).data('teams').split(',');
prioritys = $(el).data('prioritys').split(',');
labels = $(el).data('labels').split(',');
assignees = $(el).data('assignees').split(',');
@ -268,7 +297,7 @@
toreturn=false;
}
if(toreturn&&(teamfilters.length!==0||labelfilters.length!==0||assigneefilters.length!==0)) {
if(toreturn&&(teamfilters.length!==0||priorityfilters.length!==0||labelfilters.length!==0||assigneefilters.length!==0)) {
if(labelfilters.length!==0) {
toreturn=false;
$.each(labelfilters, function( index, value ) {
@ -287,6 +316,15 @@
});
}
if(priorityfilters.length!==0&&toreturn) {
toreturn=false;
$.each(priorityfilters, function( index, value ) {
if(jQuery.inArray(value, prioritys )>0) {
toreturn=true;
}
});
}
if(assigneefilters.length!==0&&toreturn) {
toreturn=false;
$.each(assigneefilters, function( index, value ) {
@ -351,6 +389,15 @@
});
}
if(priorityfilters.length!==0) {
data = $("#filterprioritys").select2('data');
textfilters=textfilters+"&nbsp;&nbsp;&nbsp;&nbsp;<b>EQUIPES</b> =";
$.each(priorityfilters, function( index, value ) {
if(index>0)textfilters=textfilters+" &";
textfilters=textfilters+" "+data[index].text;
});
}
if(labelfilters.length!==0) {
data = $("#filterlabels").select2('data');
textfilters=textfilters+"&nbsp;&nbsp;&nbsp;&nbsp;<b>ETIQUETTES</b> =";
@ -446,6 +493,20 @@
showhide();
}
function filterprioritys() {
$.ajax({
method: "POST",
url: "{{ path('app_user_preference') }}",
data: {
key:'filterprioritys',
id:{{id}},
value: $("#filterprioritys").val()
}
});
showhide();
}
function filterlabels() {
$.ajax({
method: "POST",
@ -551,6 +612,20 @@
filterteams();
});
$('#filterprioritys').select2();
{% if filterprioritys %}
{% for priority in filterprioritys %}
$("#filterprioritys").val($("#filterprioritys").val().concat("{{priority}}"));
{%endfor%}
$('#filterprioritys').trigger('change');
{% endif %}
$('#filterprioritys').on("select2:select", function(e) {
filterprioritys();
});
$('#filterprioritys').on("select2:unselect", function(e) {
filterprioritys();
});
$('#filterlabels').select2();
{% if filterlabels %}
{% for label in filterlabels %}

View File

@ -74,6 +74,19 @@
</div>
</div>
<div class="card mb-3">
<div class="card-header">
<i class="fa fa-pencil-alt fa-fw"></i> Priorités
<button id="addpriority" type="button" class="btn float-right fa fa-plus"></button>
</div>
<div id="scrumprioritys" class="card-body">
<ol id="scrumprioritys" class="list-group list-group-numbered">
</ol>
</div>
</div>
<div class="card">
<div class="card-header">
<i class="fa fa-pencil-alt fa-fw"></i> Colonnes
@ -125,6 +138,23 @@
</div>
</div>
<div id="mymodalpriority" class="modal" role="dialog">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title"></h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<iframe frameborder=0 width="100%" height="600px"></iframe>
</div>
</div>
</div>
</div>
{% endblock %}
{% block localjavascript %}
@ -134,6 +164,7 @@
{% if mode=="update" %}
loadscrumcolumns();
loadscrumteams();
loadscrumprioritys();
{%endif%}
});
@ -254,6 +285,64 @@
});
},
});
}
$("#addpriority").click(function() {
ModalLoad('mymodalpriority','Ajouter une colonne','{{path('app_scrumpriority_submit',{scrumid:scrum.id})}}');
});
$('#scrumprioritys').on('click', '.modpriority', function(event) {
url="{{path('app_scrumpriority_update',{id:'xxx'})}}";
url=url.replace("xxx",$(this).data("id"));
ModalLoad('mymodalpriority','Modifier une priority',url);
});
$('#mymodalpriority').on('hidden.bs.modal', function () {
loadscrumprioritys();
});
function loadscrumprioritys() {
$("#scrumprioritys").empty();
$.ajax({
method: "POST",
url: "{{path("app_scrumpriority_select",{scrumid:scrum.id})}}",
success: function(datas, dataType)
{
jQuery.each(datas, function(i, wid) {
html ='<li data-id="'+wid.id+'" class="list-group-item d-flex justify-content-between">';
html+='<div>';
html+='<div class="mr-3 p-2 d-inline-block"><i class="fas fa-arrows-alt-v fa-2x"></i></div>';
html+='<div class="d-inline-block">';
html+=wid.name;
html+='</div>';
html+='</div>';
html+='<button type="button" data-id="'+wid.id+'" class="modpriority btn float-right fa fa-file"></button>';
html+='</li>';
$("#scrumprioritys").append(html);
});
$( "#scrumprioritys" ).sortable({
axis: "y",
handle: ".fa-arrows-alt-v",
update: function( event, ui ) {
lstordered="";
$( "#scrumprioritys li" ).each(function( index ) {
if(index==0) lstordered=$(this).data("id");
else lstordered=lstordered+","+$(this).data("id");
});
$.ajax({
method: "POST",
url: "{{path("app_scrumpriority_order",{scrumid:scrum.id})}}",
data: {
lstordered:lstordered
}
});
}
});
},
});
}
{% endif %}

View File

@ -1,13 +1,19 @@
{% extends "base.html.twig" %}
{% block localstyle %}
#main {
padding-left:0px;
margin-bottom:0px;
}
#mycontent { display:none; }
.flot-chart {
display: block;
height: 350px;
height: 450px;
}
.flot-chart-content {
width: 350px;
height: 350px;
width: 400px;
height: 250px;
}
.flot-chart-subcontent {
@ -18,37 +24,185 @@
{% endblock %}
{% block body %}
<h1>{{ scrum.name }}</h1>
<div class="d-flex justify-content-around mt-4">
{% for milestone in tbstat %}
<div class="flot-chart mr-4">
<div id="floatdonut{{ milestone.id }}" class="flot-chart-content"></div>
<div class="mt-3 pb-3">
<h4>{{milestone.name|replace({" : ":"<br>"})|raw}}</h4>
<div class="d-flex">
<div id="filters" class="d-flex flex-column pl-2 pr-2 " style="width:350px; background-color:var(--colorbgbodydark);min-height:1500px;">
<div style="width:100%" class="mt-3">
<label class="control-label" style="color:var(--colorftbodydark)">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>
{% for column in milestone.stat %}
<li>
{{ column.label }} = {{ column.total }}
<small class="d-flex">
<div id="floatsubdonut{{ milestone.id }}-{{ column.id }}" class="flot-chart-subcontent"></div>
<ul style="line-height:15px">
{% for label in column.labels %}
<li >{{label.label}} = {{label.total}}</li>
{% endfor %}
</ul>
</small>
</li>
{%endfor%}
<div style="width:100%" class="mt-3">
<label class="control-label" style="color:var(--colorftbodydark)">Filtre EQUIPES</label>
<select id="filterteams" multiple="multiple" class="form-control">
{% for team in scrum.scrumteams %}
<option value="{{team.giteaid}}">{{team.name}}</option>
{% endfor %}
</select>
</div>
</div>
<div class="pl-3" style="width:100%;">
<div class="mt-4 mb-3" style="zoom:80%">
<button class="btn btn-success" onClick="showFilters()"><i class="fas fa-filter"></i></button>
<a class="btn btn-success" href="{{path('app_scrum_view',{id:scrum.id})}}"><i class="fas fa-columns"></i></a>
<a class="btn btn-success" href="{{path('app_issuescrum',{id:scrum.id})}}"><i class="fas fa-ticket-alt"></i></a>
<span id="textfilters"></span>
</div>
<h1>{{ scrum.name }}</h1>
<div class="d-flex flex-column mt-4">
{% for milestone in tbstat %}
<div class="flot-chart mr-4" data-milestone="{{ milestone.id }}">
<h4>{{milestone.name}}</h4>
<div class="mt-4">
<div id="floatdonut{{ milestone.id }}" class="flot-chart-content" style="float:left"></div>
<div class="mt-3 pb-3" style="width:100%">
<div class="d-flex justify-content-between mt-4">
{% for column in milestone.stat %}
<div style="width:250px">
<div style="background-color:{{column.color}}; padding:3px;margin-bottom:3px;">{{ column.label }} = {{ column.total }}</div>
<small>
<div style="line-height:15px; width:100%">
{% for label in column.labels %}
<li >{{label.label}} = {{label.total}}</li>
{% endfor %}
</div>
</small>
</div>
{%endfor%}
</div>
</div>
</div>
</div>
{% endfor %}
</div>
</div>
{% endfor %}
</div>
{% endblock %}
{% block localjavascript %}
function showFilters() {
if($("#filters").hasClass("d-flex")) {
toshow=0;
$("#filters").addClass("d-none");
$("#filters").removeClass("d-flex");
}
else {
toshow=1;
$("#filters").addClass("d-flex");
$("#filters").removeClass("d-none");
}
$.ajax({
method: "POST",
url: "{{ path('app_user_preference') }}",
data: {
key:'showfilters',
id:{{scrum.id}},
value: toshow
}
});
}
$(document).ready(function() {
// 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();
textfilters="";
if($("#filtermilestones").val().length!==0) {
data = $("#filtermilestones").select2('data');
textfilters=textfilters+"&nbsp;&nbsp;&nbsp;&nbsp;<b>JALONS</b> =";
$.each($("#filtermilestones").val(), function( index, value ) {
if(index>0)textfilters=textfilters+" &";
textfilters=textfilters+" "+data[index].text;
});
}
if($("#filterteams").val().length!==0) {
data = $("#filterteams").select2('data');
textfilters=textfilters+"&nbsp;&nbsp;&nbsp;&nbsp;<b>EQUIPES</b> =";
$.each($("#filterteams").val(), function( index, value ) {
if(index>0)textfilters=textfilters+" &";
textfilters=textfilters+" "+data[index].text;
});
}
$("#textfilters").html(textfilters);
}
// 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 Teams
function filterteams() {
$.ajax({
method: "POST",
url: "{{ path('app_user_preference') }}",
data: {
key:'filterteams',
id:{{scrum.id}},
value: $("#filterteams").val()
}
});
location.reload();
}
$('#filterteams').select2();
{% if filterteams %}
{% for team in filterteams %}
$("#filterteams").val($("#filterteams").val().concat("{{team}}"));
{%endfor%}
$('#filterteams').trigger('change');
{% endif %}
$('#filterteams').on("select2:select", function(e) {
filterteams();
});
$('#filterteams').on("select2:unselect", function(e) {
filterteams();
});
{% for milestone in tbstat %}
var data = [
{% for data in milestone.stat %}
@ -63,9 +217,25 @@
var plotObj = $.plot($("#floatdonut{{ milestone.id }}"), data, {
series: {
pie: {
show: true
show: true,
radius: 1,
label: {
show: true,
radius: 1,
threshold: 0.1,
background: {
opacity: 0.5,
color: '#cdcdcd',
},
formatter: function(label, series) {
return '<span style="color:#000; padding:3px;">' + label + '</span>';
}
}
}
},
legend: {
show: false,
},
});
{% for data in milestone.stat %}
@ -101,5 +271,14 @@
{% endfor %}
{% endfor %}
{% endfor %}
{% if not showfilters %}
$("#filters").addClass("d-none");
$("#filters").removeClass("d-flex");
{% endif %}
// Appliy filters
showhide();
$("#mycontent").show();
});
{% endblock %}

View File

@ -3,6 +3,7 @@
{% block localstyle %}
html { height:100%}
body { height:100%; background-color:#efefef;}
#main {
padding-left:0px;
margin-bottom:0px;
@ -42,7 +43,7 @@
{% block body %}
<div class="d-flex">
<div id="filters" class="d-flex flex-column pl-2 pr-2 " style="width:350px; background-color:var(--colorbgbodydark);min-height:1000px;">
<div id="filters" class="d-flex flex-column pl-2 pr-2 " style="width:350px; background-color:var(--colorbgbodydark);min-height:1500px;">
<div style="width:100%" class="mt-3">
<label class="control-label" style="color:var(--colorftbodydark)">Filtre JALONS</label>
<select id="filtermilestones" multiple="multiple" class="form-control">
@ -62,6 +63,15 @@
</select>
</div>
<div style="width:100%" class="mt-3">
<label class="control-label" style="color:var(--colorftbodydark)">Filtre PRIORITES</label>
<select id="filterprioritys" multiple="multiple" class="form-control">
{% for priority in scrum.scrumprioritys %}
<option value="{{priority.giteaid}}">{{priority.name}}</option>
{% endfor %}
</select>
</div>
<div style="width:100%" class="mt-3">
<label class="control-label" style="color:var(--colorftbodydark)">Filtre ETIQUETTES</label>
<select id="filterlabels" multiple="multiple" class="form-control">
@ -89,7 +99,9 @@
<div class="mt-4" style="zoom:80%">
<button class="btn btn-success" onClick="showFilters()"><i class="fas fa-filter"></i></button>
<a href="{{giteaUrl}}/{{scrum.giteajson.owner.login}}/{{scrum.giteajson.name}}/issues/new" class="btn btn-success">Nouveau Ticket</a>
<a class="btn btn-success" href="{{path('app_issuescrum',{id:scrum.id})}}"><i class="fas fa-ticket-alt"></i></a>
<a class="btn btn-success" href="{{path('app_scrum_stat',{id:scrum.id})}}"><i class="fas fa-chart-area"></i></a>
<a href="{{giteaUrl}}/{{scrum.giteajson.owner.login}}/{{scrum.giteajson.name}}/issues/new" class="btn btn-success" target="_blank">Nouveau Ticket</a>
<span id="textfilters"></span>
</div>
@ -122,12 +134,17 @@
{% set datalabels="" %}
{% set datateams="" %}
{% set dataprioritys="datapriority"~giteaprioritys|last %}
{% for label in issue.giteajson.labels %}
{% if label.id not in giteacolumns and label.id in giteateams %}
{% set datateams=datateams~"datateam"~label.id~" " %}
{% endif %}
{% if label.id not in giteacolumns and label.id not in giteateams %}
{% if label.id not in giteacolumns and label.id in giteaprioritys %}
{% set dataprioritys="datapriority"~label.id~" " %}
{% endif %}
{% if label.id not in giteacolumns and label.id not in giteateams and label.id not in giteaprioritys %}
{% set datalabels=datalabels~"datalabel"~label.id~" " %}
{% endif %}
{% endfor %}
@ -137,7 +154,7 @@
{% 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}} {{datateams}} {{datalabels}} {{dataassignees}}">
<div data-id="{{ issue.id }}" data-issue="{{ issue.id }}" data-column="{{column.giteaid}}" data-milestone="{{idmilestone}}" class="card mb-1 issue issue-{{issue.id}} {{datateams}} {{dataprioritys}} {{datalabels}} {{dataassignees}}">
<div class="card-footer p-1" style="line-height:10px; border-top:none;">
<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>
@ -149,6 +166,15 @@
{{issue.giteanumber}} - {{ issue.giteatitle }}<br><br>
<small>Crée le {{issue.giteajson.created_at|date("d/m/y")}}</small><small style ="float:right">Modifié le {{issue.giteajson.updated_at|date("d/m/y")}}</small><br><br>
{% for label in issue.giteajson.labels %}
{% if label.id not in giteacolumns and label.id in giteaprioritys %}
<span class="btn-link tag" style="background-color:#{{label.color}}">
<i class="fas fa-tag"></i>
{{ label.name }}
</span>
{% endif %}
{% endfor %}
<br>
{% for label in issue.giteajson.labels %}
{% if label.id not in giteacolumns and label.id in giteateams %}
<span class="btn-link tag" style="background-color:#{{label.color}}">
@ -159,7 +185,7 @@
{% endfor %}
<br>
{% for label in issue.giteajson.labels %}
{% if label.id not in giteacolumns and label.id not in giteateams %}
{% if label.id not in giteacolumns and label.id not in giteateams and label.id not in giteaprioritys %}
<span class="btn-link tag" style="background-color:#{{label.color}}">
<i class="fas fa-tag"></i>
{{ label.name }}
@ -249,6 +275,14 @@
});
}
if(toshow&&$("#filterprioritys").val().length !== 0) {
toshow=false;
$.each($("#filterprioritys").val(), function( index, value ) {
if (domissue.hasClass("datapriority"+value))
toshow=true;
});
}
if(toshow&&$("#filterlabels").val().length !== 0) {
toshow=false;
$.each($("#filterlabels").val(), function( index, value ) {
@ -287,6 +321,15 @@
});
}
if($("#filterprioritys").val().length!==0) {
data = $("#filterprioritys").select2('data');
textfilters=textfilters+"&nbsp;&nbsp;&nbsp;&nbsp;<b>EQUIPES</b> =";
$.each($("#filterprioritys").val(), function( index, value ) {
if(index>0)textfilters=textfilters+" &";
textfilters=textfilters+" "+data[index].text;
});
}
if($("#filterlabels").val().length!==0) {
data = $("#filterlabels").select2('data');
textfilters=textfilters+"&nbsp;&nbsp;&nbsp;&nbsp;<b>ETIQUETTES</b> =";
@ -366,6 +409,35 @@
filterteams();
});
// Filter Proritys
function filterprioritys() {
$.ajax({
method: "POST",
url: "{{ path('app_user_preference') }}",
data: {
key:'filterprioritys',
id:{{scrum.id}},
value: $("#filterprioritys").val()
}
});
showhide();
}
$('#filterprioritys').select2();
{% if filterprioritys %}
{% for priority in filterprioritys %}
$("#filterprioritys").val($("#filterprioritys").val().concat("{{priority}}"));
{%endfor%}
$('#filterprioritys').trigger('change');
{% endif %}
$('#filterprioritys').on("select2:select", function(e) {
filterprioritys();
});
$('#filterprioritys').on("select2:unselect", function(e) {
filterprioritys();
});
// Filter Labels
function filterlabels() {
$.ajax({