export csv et filtre type

This commit is contained in:
afornerot 2023-08-30 11:15:33 +02:00
parent e15d25236a
commit a5b6ef51a4
13 changed files with 801 additions and 23 deletions

View File

@ -273,6 +273,27 @@ app_scrumpriority_order:
defaults: { _controller: App\Controller\ScrumpriorityController:order }
#== Scrumtype ========================================================================================================
app_scrumtype_submit:
path: /master/scrumtype/submit/{scrumid}
defaults: { _controller: App\Controller\ScrumtypeController:submit }
app_scrumtype_update:
path: /master/scrumtype/update/{id}
defaults: { _controller: App\Controller\ScrumtypeController:update }
app_scrumtype_delete:
path: /master/scrumtype/delete/{id}
defaults: { _controller: App\Controller\ScrumtypeController:delete }
app_scrumtype_select:
path: /master/scrumtype/select/{scrumid}
defaults: { _controller: App\Controller\ScrumtypeController:select }
app_scrumtype_order:
path: /master/scrumtype/order/{scrumid}
defaults: { _controller: App\Controller\ScrumtypeController:order }
#== Scrumissue ========================================================================================================
app_scrumissue_change:
path: /user/scrumissue/change

View File

@ -4,27 +4,30 @@ namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Form\FormError;
use App\Entity\Issue as Entity;
use App\Entity\Issueissue as Issueissue;
use App\Form\IssueType as Form;
use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\HttpFoundation\ResponseHeaderBag;
use App\Service\giteaService;
class IssueController extends AbstractController
{
private $appKernel;
private $data = "issue";
private $route = "app_issue";
private $render = "Issue/";
private $entity = "App:Issue";
public function __construct(giteaService $giteaservice) { $this->giteaservice = $giteaservice; }
public function __construct(KernelInterface $appKernel,giteaService $giteaservice) {
$this->appKernel = $appKernel;
$this->giteaservice = $giteaservice;
}
public function list($id, Request $request)
{
$em = $this->getDoctrine()->getManager();
$fgcsv = $request->get("fgcsv");
// Récupérer les repos de gitea
if($id==0) $scrums=$em->getRepository("App:Scrum")->findBy([],["name"=>"ASC"]);
@ -36,6 +39,7 @@ class IssueController extends AbstractController
$giteacolumns=[];
$giteateams=[];
$giteaprioritys=[];
$giteatypes=[];
$gitealabels=[];
$giteaassignees=$em->getRepository("App:User")->findBy([],["username"=>"ASC"]);
$viewclosed = $request->getSession()->get("viewclosed");
@ -98,6 +102,11 @@ class IssueController extends AbstractController
array_push($giteaprioritys,$priority->getGiteajson()["name"]);
}
foreach($scrum->getScrumtypes() as $type) {
if(!in_array($type->getGiteajson()["name"],$giteatypes))
array_push($giteatypes,$type->getGiteajson()["name"]);
}
foreach($giteaissues as $giteaissue) {
foreach($giteaissue->labels as $label) {
if(!in_array($label->name,$gitealabels))
@ -112,6 +121,7 @@ class IssueController extends AbstractController
sort($giteacolumns);
sort($giteateams);
sort($giteaprioritys);
sort($giteatypes);
sort($gitealabels);
sort($giteacategorys);
@ -122,11 +132,56 @@ class IssueController extends AbstractController
$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);
$filtertypes = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filtertypes",$id);
$filterlabels = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterlabels",$id);
$filterassignees = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterassignees",$id);
$filterexcludes = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterexcludes",$id);
$showfilters = $em->getRepository("App:User")->getUserpreference($this->getUser(),"showfilters",$id);
if($fgcsv) {
$dir = $this->appKernel->getProjectDir() . '/uploads/issues/';
$file = "issues-".$id.".csv";
$fs = new Filesystem();
$fs->mkdir($dir);
$csvh = fopen($dir.$file, 'w');
$d = ';'; // this is the default but i like to be explicit
$e = '"'; // this is the default but i like to be explicit
$tmp=["Projet","Jalon","Type","Id","Titre","Statut","Label"];
fputcsv($csvh, $tmp, $d, $e);
foreach($gitearepos as $gitearepo) {
foreach($gitearepo["issues"] as $giteaissue) {
$statut="";
$type="";
$labels="";
foreach($giteaissue->labels as $label) {
if(in_array($label->id,$gitearepo["columns"]))
$statut=$label->name;
elseif(in_array($label->name,$giteatypes))
$type=$label->name;
else
$labels=$labels.($labels!=""?"\n":"").$label->name;
}
$tmp=[
$gitearepo["name"],
(isset($giteaissue->milestone->title)?$giteaissue->milestone->title:""),
$type,
$giteaissue->number,
$giteaissue->title,
$statut,
$labels
];
fputcsv($csvh, $tmp, $d, $e);
}
}
fclose($csvh);
$response = new BinaryFileResponse($dir.$file);
$response->setContentDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT);
return $response;
}
return $this->render($this->render.'list.html.twig',[
"useheader" => true,
"usesidebar" => false,
@ -137,6 +192,7 @@ class IssueController extends AbstractController
"giteacolumns" => $giteacolumns,
"giteateams" => $giteateams,
"giteaprioritys" => $giteaprioritys,
"giteatypes" => $giteatypes,
"gitealabels" => $gitealabels,
"giteaassignees" => $giteaassignees,
"filtercategorys" => $filtercategorys,
@ -145,6 +201,7 @@ class IssueController extends AbstractController
"filtercolumns" => $filtercolumns,
"filterteams" => $filterteams,
"filterprioritys" => $filterprioritys,
"filtertypes" => $filtertypes,
"filterlabels" => $filterlabels,
"filterexcludes" => $filterexcludes,
"filterassignees" => $filterassignees,

View File

@ -176,12 +176,13 @@ 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,$giteaprioritys,$gitealabels);
$em->getRepository("App:Scrum")->getGitea($data,$giteaassignees,$giteacolumns,$giteamilestones,$giteateams,$giteaprioritys,$giteatypes,$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);
$filtertypes = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filtertypes",$id);
$filterlabels = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterlabels",$id);
$filterassignees = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterassignees",$id);
$filterexcludes = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterexcludes",$id);
@ -196,10 +197,12 @@ class ScrumController extends AbstractController
'giteamilestones' => $giteamilestones,
'giteateams' => $giteateams,
'giteaprioritys' => $giteaprioritys,
'giteatypes' => $giteatypes,
'gitealabels' => $gitealabels,
'filtermilestones' => $filtermilestones,
'filterteams' => $filterteams,
'filterprioritys' => $filterprioritys,
'filtertypes' => $filtertypes,
'filterlabels' => $filterlabels,
'filterassignees' => $filterassignees,
'filterexcludes' => $filterexcludes,
@ -215,7 +218,7 @@ 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,$giteaprioritys,$gitealabels);
$em->getRepository("App:Scrum")->getGitea($data,$giteaassignees,$giteacolumns,$giteamilestones,$giteateams,$giteaprioritys,$giteatypes,$gitealabels);
// Préférences utilisateur
$filtermilestones = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filtermilestones",$id);
@ -298,6 +301,7 @@ class ScrumController extends AbstractController
'giteamilestones' => $giteamilestones,
'giteateams' => $giteateams,
'giteaprioritys' => $giteaprioritys,
'giteatypes' => $giteatypes,
'gitealabels' => $gitealabels,
'filtermilestones' => $filtermilestones,
'filterteams' => $filterteams,

View File

@ -0,0 +1,194 @@
<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Form\FormError;
use App\Entity\Scrumtype as Entity;
use App\Form\ScrumtypeType as Form;
use App\Service\giteaService;
class ScrumtypeController extends AbstractController
{
private $data = "scrumtype";
private $route = "app_scrumtype";
private $render = "Scrumtype/";
private $entity = "App:Scrumtype";
public function __construct(giteaService $giteaservice) { $this->giteaservice = $giteaservice; }
public function submit($scrumid, Request $request)
{
// Initialisation de l'enregistrement
$em = $this->getDoctrine()->getManager();
$scrum=$em->getRepository("App:Scrum")->find($scrumid);
$data = new Entity();
$data->setScrum($scrum);
$last = $em->getRepository('App:Scrumtype')->findOneBy(["scrum"=>$scrum], ['rowid' => 'DESC']);
if(!$last) $data->setRowid(0);
else $data->setRowid($last->getRowid()+1);
// Récupérer les repos de gitea
$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>");
// Création du formulaire
$form = $this->createForm(Form::class,$data,array("mode"=>"submit","gitealabels"=>$gitealabels));
// Récupération des data du formulaire
$form->handleRequest($request);
// Sur erreur
$this->getErrorForm(null,$form,$request,$data,"submit");
// Sur validation
if ($form->get('submit')->isClicked() && $form->isValid()) {
$data = $form->getData();
$gitealabel=$this->giteaservice->getLabel($scrum->getGiteajson()["owner"]["login"],$scrum->getGiteajson()["name"],$data->getGiteaid());
$data->setGiteajson(json_decode(json_encode($gitealabel), true));
$em->persist($data);
$em->flush();
// Retour à la liste
return $this->render($this->render.'close.html.twig');
}
// Affichage du formulaire
return $this->render($this->render.'edit.html.twig', [
'useheader' => false,
'usesidebar' => false,
$this->data => $data,
'mode' => 'submit',
'form' => $form->createView()
]);
}
public function update($id,Request $request)
{
// Initialisation de l'enregistrement
$em = $this->getDoctrine()->getManager();
$data=$em->getRepository($this->entity)->find($id);
$scrum=$data->getScrum();
// Récupérer les repos de gitea
$gitealabels=$this->giteaservice->getLabels($scrum->getGiteajson()["owner"]["login"],$scrum->getGiteajson()["name"]);
// Création du formulaire
$form = $this->createForm(Form::class,$data,array("mode"=>"submit","gitealabels"=>$gitealabels));
// Récupération des data du formulaire
$form->handleRequest($request);
// Sur erreur
$this->getErrorForm(null,$form,$request,$data,"update");
// Sur validation
if ($form->get('submit')->isClicked() && $form->isValid()) {
$data = $form->getData();
$gitealabel=$this->giteaservice->getLabel($scrum->getGiteajson()["owner"]["login"],$scrum->getGiteajson()["name"],$data->getGiteaid());
$data->setGiteajson(json_decode(json_encode($gitealabel), true));
$em->persist($data);
$em->flush();
// Retour à la liste
return $this->render($this->render.'close.html.twig');
}
// Affichage du formulaire
return $this->render($this->render.'edit.html.twig', [
'useheader' => false,
'usesidebar' => false,
$this->data => $data,
'mode' => 'update',
'form' => $form->createView()
]);
}
public function delete($id,Request $request)
{
// Initialisation de l'enregistrement
$em = $this->getDoctrine()->getManager();
$data=$em->getRepository($this->entity)->find($id);
// Controle avant suppression
$error=false;
if($id<0) $error=true;
if($error)
return $this->redirectToRoute($this->route."_update",["id"=>$id]);
else {
$em->remove($data);
$em->flush();
// Retour à la liste
return $this->render($this->render.'close.html.twig');
}
}
public function select($scrumid, Request $request)
{
// S'assurer que c'est un appel ajax
if (!$request->isXmlHttpRequest()) {
return new JsonResponse(array('message' => 'Interdit'), 400);
}
$em = $this->getDoctrine()->getManager();
$scrum=$em->getRepository("App:Scrum")->find($scrumid);
$scrumtypes = $scrum->getScrumtypes();
$output=array();
foreach($scrumtypes as $scrumtype) {
array_push($output,array("id"=>$scrumtype->getId(),"name"=>"<b>".$scrumtype->getName()."</b><br><small>liè au label gitea ".$scrumtype->getGiteajson()["name"]."</small>"));
}
$response = new Response(json_encode($output));
$response->headers->set('Content-Type', 'application/json');
return $response;
}
public function order($scrumid, Request $request)
{
$em = $this->getDoctrine()->getManager();
$scrumtypeids=explode(",",$request->get('lstordered'));
$i=1;
foreach($scrumtypeids as $id) {
$scrumtype=$em->getRepository($this->entity)->find($id);
if($scrumtype) {
$scrumtype->setRowid($i);
$em->persist($scrumtype);
$em->flush();
}
$i++;
}
$response = new Response();
$response->headers->set('Content-Type', 'application/json');
return $response;
}
protected function getErrorForm($id,$form,$request,$data,$mode) {
if ($form->get('submit')->isClicked()&&$mode=="delete") {
}
if ($form->get('submit')->isClicked() && $mode=="submit") {
}
if ($form->get('submit')->isClicked() && ($mode=="submit" || $mode=="update")) {
}
if ($form->get('submit')->isClicked() && !$form->isValid()) {
$this->get('session')->getFlashBag()->clear();
$errors = $form->getErrors();
foreach( $errors as $error ) {
$request->getSession()->getFlashBag()->add("error", $error->getMessage());
}
}
}
}

View File

@ -85,6 +85,12 @@ class Scrum
*/
private $scrumprioritys;
/**
* @ORM\OneToMany(targetEntity="Scrumtype", mappedBy="scrum", cascade={"persist"}, orphanRemoval=true)
* @ORM\OrderBy({"rowid" = "ASC"})
*/
private $scrumtypes;
public function getStatistique()
{
$id=-100;
@ -110,6 +116,7 @@ class Scrum
$this->scrumissues = new ArrayCollection();
$this->scrumteams = new ArrayCollection();
$this->scrumprioritys = new ArrayCollection();
$this->scrumtypes = new ArrayCollection();
}
public function getId(): ?int
@ -340,4 +347,35 @@ class Scrum
return $this;
}
/**
* @return Collection|Scrumtype[]
*/
public function getScrumtypes(): Collection
{
return $this->scrumtypes;
}
public function addScrumtype(Scrumtype $scrumtype): self
{
if (!$this->scrumtypes->contains($scrumtype)) {
$this->scrumtypes[] = $scrumtype;
$scrumtype->setScrum($this);
}
return $this;
}
public function removeScrumtype(Scrumtype $scrumtype): self
{
if ($this->scrumtypes->contains($scrumtype)) {
$this->scrumtypes->removeElement($scrumtype);
// set the owning side to null (unless already changed)
if ($scrumtype->getScrum() === $this) {
$scrumtype->setScrum(null);
}
}
return $this;
}
}

View File

@ -0,0 +1,116 @@
<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/**
* Scrumtype
*
* @ORM\Entity()
* @ORM\Table(name="scrumtype", uniqueConstraints={@ORM\UniqueConstraint(name="gitealabel", columns={"giteaid","scrum_id"})} )
*/
class Scrumtype
{
/**
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\Column(name="name", type="string")
*
*/
private $name;
/**
* @ORM\Column(type="integer")
*/
private $rowid;
/**
* @ORM\Column(type="integer")
*/
private $giteaid;
/**
* @ORM\Column(type="json")
*/
private $giteajson;
/**
* @ORM\ManyToOne(targetEntity="Scrum", inversedBy="scrumtypes")
*/
private $scrum;
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getRowid(): ?int
{
return $this->rowid;
}
public function setRowid(int $rowid): self
{
$this->rowid = $rowid;
return $this;
}
public function getGiteaid(): ?int
{
return $this->giteaid;
}
public function setGiteaid(int $giteaid): self
{
$this->giteaid = $giteaid;
return $this;
}
public function getGiteajson(): ?array
{
return $this->giteajson;
}
public function setGiteajson(array $giteajson): self
{
$this->giteajson = $giteajson;
return $this;
}
public function getScrum(): ?Scrum
{
return $this->scrum;
}
public function setScrum(?Scrum $scrum): self
{
$this->scrum = $scrum;
return $this;
}
}

View File

@ -0,0 +1,58 @@
<?php
namespace App\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Tetranz\Select2EntityBundle\Form\Type\Select2EntityType;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\EntityManager;
class ScrumtypeType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('submit',
SubmitType::class, [
"label" => "Valider",
"attr" => ["class" => "btn btn-success no-print"],
]
);
$builder->add('name',
TextType::class, [
"label" =>"Nom",
]
);
$choices=[];
foreach($options["gitealabels"] as $label) {
$choices[$label->name]=$label->id;
}
$builder->add('giteaid',
ChoiceType::class, [
"label" => "Label Gitea",
"choices" => $choices,
"disabled" => ($options["mode"]=="submit"?false:true),
"placeholder" => "Selectionnez un label gitea",
]
);
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(array(
'data_class' => 'App\Entity\Scrumtype',
'mode' => 'string',
'gitealabels' => 'string',
));
}
}

View File

@ -36,7 +36,7 @@ class ScrumRepository extends ServiceEntityRepository
return $scrums;
}
}
public function getGitea($scrum,&$giteaassignees,&$giteacolumns,&$giteamilestones,&$giteateams,&$giteaprioritys,&$gitealabels) {
public function getGitea($scrum,&$giteaassignees,&$giteacolumns,&$giteamilestones,&$giteateams,&$giteaprioritys,&$giteatypes,&$gitealabels) {
$viewclosed = $this->session->get("viewclosed");
// Récupérer le dernier order
@ -69,6 +69,13 @@ class ScrumRepository extends ServiceEntityRepository
array_push($giteaprioritys,$priority->getGiteaid());
}
// Récupérer les types
$types=$this->_em->getRepository('App:Scrumtype')->findBy(["scrum"=>$scrum], ['rowid' => 'ASC']);
$giteatypes=[];
foreach($types as $type) {
array_push($giteatypes,$type->getGiteaid());
}
// Récupérer la orga de gitea
if(!empty($scrum->getGiteajson()["owner"]["email"]))
$giteaassignees=[$scrum->getGiteajson()["owner"]];
@ -105,7 +112,7 @@ class ScrumRepository extends ServiceEntityRepository
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)||in_array($gitealabel->id,$giteaprioritys))
if(in_array($gitealabel->id,$giteacolumns)||in_array($gitealabel->id,$giteateams)||in_array($gitealabel->id,$giteaprioritys)||in_array($gitealabel->id,$giteatypes))
unset($gitealabels[$key]);
}
@ -144,7 +151,7 @@ class ScrumRepository extends ServiceEntityRepository
if(!$giteaissue->milestone&&!is_null($scrumissue->getGiteamilestone()))
$fgissueupdated=true;
$fgissueupdated=true;
//$fgissueupdated=true;
if($fgissueupdated) {
$fgscrumupdate=true;
$this->majissue($scrumissue,$giteaissue);

View File

@ -75,6 +75,15 @@
</select>
</div>
<div style="width:100%" class="mt-3">
<label class="control-label" style="color:var(--colorftbodydark)">Filtre TYPES</label>
<select id="filtertypes" multiple="multiple" class="form-control">
{% for giteatype in giteatypes %}
<option value="{{giteatype}}">{{giteatype}}</option>
{% endfor %}
</select>
</div>
<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">
@ -97,7 +106,7 @@
<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 and gitealabel not in giteaprioritys %}
{% if gitealabel not in giteacolumns and gitealabel not in giteateams and gitealabel not in giteaprioritys and gitealabel not in giteatypes %}
<option value="{{gitealabel}}">{{gitealabel}}</option>
{% endif %}
{% endfor %}
@ -118,7 +127,7 @@
<label class="control-label" style="color:var(--colorftbodydark)">Filtre EXCLUSIONS</label>
<select id="filterexcludes" multiple="multiple" class="form-control">
{% for gitealabel in gitealabels %}
{% if gitealabel not in giteacolumns and gitealabel not in giteateams and gitealabel not in giteaprioritys %}
{% if gitealabel not in giteacolumns and gitealabel not in giteateams and gitealabel not in giteaprioritys and gitealabel not in giteatypes %}
<option value="{{gitealabel}}">{{gitealabel}}</option>
{% endif %}
{% endfor %}
@ -134,6 +143,8 @@
<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>
<a class="btn btn-success float-right" href="{{path('app_issuescrum',{id:id,'fgcsv':true})}}">Export CSV</a>
</div>
<table class="mt-4 table table-striped table-bordered table-hover" id="dataTables" style="width:100%; zoom:80%;">
@ -142,7 +153,8 @@
<th class="no-sort"></th>
{%if id==0 %}<th style="width:100px">Projet</th>{%endif%}
<th style="width:200px">Jalon</th>
<th style="width:135px"class="no-string">N°</th>
<th style="width:200px">Type</th>
<th style="width:70px"class="no-string">N°</th>
<th style="width:1000px">Titre</th>
<th style="width:200px">Equipe</th>
<th style="width:250px">Priorité</th>
@ -179,9 +191,9 @@
{% set statut = "Backlog" %}
{% set teams = "" %}
{% set types = "" %}
{% 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 datatypes = "" %}
{% 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 = "" %}
@ -189,6 +201,9 @@
{% for label in giteaissue.labels %}
{% if label.id in gitearepo.columns %}
{% set statut= label.name %}
{% elseif label.name in giteatypes %}
{% set types='<span class="btn-link tag mr-1" style="background-color:#'~label.color~'"><i class="fas fa-tag"></i>'~label.name~'</span>' %}
{% set datatypes=','~label.name %}
{% 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 %}
@ -206,12 +221,13 @@
{% 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-prioritys="{{dataprioritys}}" 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-types="{{datatypes}}" data-labels="{{datalabels}}" data-assignees="{{dataassignees}}">
<td>
<a target="_blank" class="btn btn-link fa fa-file" href="{{giteaissue.html_url}}"></a>
</td>
{%if id==0 %}<td>{{ gitearepo.full_name }}</td>{%endif%}
<td>{% if giteaissue.milestone %}{{ giteaissue.milestone.title }} {%endif%}</td>
<td>{{ types|raw }}</td>
<td>{{ giteaissue.number }}</td>
<td>
<a target="_blank" href="{{giteaissue.html_url}}">
@ -310,6 +326,7 @@
columnfilters=$("#filtercolumns").val();
teamfilters=$("#filterteams").val();
priorityfilters=$("#filterprioritys").val();
typefilters=$("#filtertypes").val();
labelfilters=$("#filterlabels").val();
assigneefilters=$("#filterassignees").val();
excludefilters=$("#filterexcludes").val();
@ -326,6 +343,7 @@
column = $(el).data('column');
teams = $(el).data('teams').split(',');
prioritys = $(el).data('prioritys').split(',');
types = $(el).data('types').split(',');
labels = $(el).data('labels').split(',');
assignees = $(el).data('assignees').split(',');
@ -367,7 +385,7 @@
});
}
if(toreturn&&(teamfilters.length!==0||priorityfilters.length!==0||labelfilters.length!==0||assigneefilters.length!==0)) {
if(toreturn&&(teamfilters.length!==0||priorityfilters.length!==0||typefilters.length!==0||labelfilters.length!==0||assigneefilters.length!==0)) {
if(labelfilters.length!==0) {
toreturn=false;
$.each(labelfilters, function( index, value ) {
@ -395,6 +413,15 @@
});
}
if(typefilters.length!==0&&toreturn) {
toreturn=false;
$.each(typefilters, function( index, value ) {
if(jQuery.inArray(value, types )>0) {
toreturn=true;
}
});
}
if(assigneefilters.length!==0&&toreturn) {
toreturn=false;
$.each(assigneefilters, function( index, value ) {
@ -468,6 +495,15 @@
});
}
if(typefilters.length!==0) {
data = $("#filtertypes").select2('data');
textfilters=textfilters+"&nbsp;&nbsp;&nbsp;&nbsp;<b>EQUIPES</b> =";
$.each(typefilters, 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> =";
@ -587,6 +623,20 @@
showhide();
}
function filtertypes() {
$.ajax({
method: "POST",
url: "{{ path('app_user_preference') }}",
data: {
key:'filtertypes',
id:{{id}},
value: $("#filtertypes").val()
}
});
showhide();
}
function filterlabels() {
$.ajax({
method: "POST",
@ -772,6 +822,20 @@
filterprioritys();
});
$('#filtertypes').select2();
{% if filtertypes %}
{% for type in filtertypes %}
$("#filtertypes").val($("#filtertypes").val().concat("{{type}}"));
{%endfor%}
$('#filtertypes').trigger('change');
{% endif %}
$('#filtertypes').on("select2:select", function(e) {
filtertypes();
});
$('#filtertypes').on("select2:unselect", function(e) {
filtertypes();
});
$('#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> Types
<button id="addtype" type="button" class="btn float-right fa fa-plus"></button>
</div>
<div id="scrumtypes" class="card-body">
<ol id="scrumtypes" class="list-group list-group-numbered">
</ol>
</div>
</div>
<div class="card mb-3">
<div class="card-header">
<i class="fa fa-pencil-alt fa-fw"></i> Priorités
@ -155,6 +168,23 @@
</div>
</div>
<div id="mymodaltype" 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 %}
@ -165,6 +195,7 @@
loadscrumcolumns();
loadscrumteams();
loadscrumprioritys();
loadscrumtypes();
{%endif%}
});
@ -343,7 +374,64 @@
});
},
});
}
$("#addtype").click(function() {
ModalLoad('mymodaltype','Ajouter une colonne','{{path('app_scrumtype_submit',{scrumid:scrum.id})}}');
});
$('#scrumtypes').on('click', '.modtype', function(event) {
url="{{path('app_scrumtype_update',{id:'xxx'})}}";
url=url.replace("xxx",$(this).data("id"));
ModalLoad('mymodaltype','Modifier un type',url);
});
$('#mymodaltype').on('hidden.bs.modal', function () {
loadscrumtypes();
});
function loadscrumtypes() {
$("#scrumtypes").empty();
$.ajax({
method: "POST",
url: "{{path("app_scrumtype_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="modtype btn float-right fa fa-file"></button>';
html+='</li>';
$("#scrumtypes").append(html);
});
$( "#scrumtypes" ).sortable({
axis: "y",
handle: ".fa-arrows-alt-v",
update: function( event, ui ) {
lstordered="";
$( "#scrumtypes li" ).each(function( index ) {
if(index==0) lstordered=$(this).data("id");
else lstordered=lstordered+","+$(this).data("id");
});
$.ajax({
method: "POST",
url: "{{path("app_scrumtype_order",{scrumid:scrum.id})}}",
data: {
lstordered:lstordered
}
});
}
});
},
});
}
{% endif %}

View File

@ -58,6 +58,15 @@
</select>
</div>
<div style="width:100%" class="mt-3">
<label class="control-label" style="color:var(--colorftbodydark)">Filtre TYPES</label>
<select id="filtertypes" multiple="multiple" class="form-control">
{% for type in scrum.scrumtypes %}
<option value="{{type.giteaid}}">{{type.name}}</option>
{% endfor %}
</select>
</div>
<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">
@ -165,17 +174,22 @@
{% set datalabels="" %}
{% set datateams="" %}
{% set datatypes="" %}
{% 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 in giteatypes %}
{% set datatypes=datatypes~"datatype"~label.id~" " %}
{% endif %}
{% 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 %}
{% if label.id not in giteacolumns and label.id not in giteateams and label.id not in giteatypes and label.id not in giteaprioritys %}
{% set datalabels=datalabels~"datalabel"~label.id~" " %}
{% endif %}
{% endfor %}
@ -185,7 +199,7 @@
{% set dataassignees=dataassignees~"dataassignee"~assignee.id~" " %}
{% endfor %}
<div id="issu{{ issue.id }}" 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}} state-{{issue.giteastate}}">
<div id="issu{{ issue.id }}" data-id="{{ issue.id }}" data-issue="{{ issue.id }}" data-column="{{column.giteaid}}" data-milestone="{{idmilestone}}" class="card mb-1 issue issue-{{issue.id}} {{datateams}} {{datatypes}} {{dataprioritys}} {{datalabels}} {{dataassignees}} state-{{issue.giteastate}}">
<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>
@ -212,6 +226,15 @@
{% endif %}
{% endfor %}
<br>
{% for label in issue.giteajson.labels %}
{% if label.id not in giteacolumns and label.id in giteatypes %}
<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}}">
@ -222,7 +245,7 @@
{% endfor %}
<br>
{% for label in issue.giteajson.labels %}
{% if label.id not in giteacolumns and label.id not in giteateams and label.id not in giteaprioritys %}
{% if label.id not in giteacolumns and label.id not in giteateams and label.id not in giteaprioritys and label.id not in giteatypes %}
<span class="btn-link tag" style="background-color:#{{label.color}}">
<i class="fas fa-tag"></i>
{{ label.name }}
@ -352,6 +375,14 @@
});
}
if(toshow&&$("#filtertypes").val().length !== 0) {
toshow=false;
$.each($("#filtertypes").val(), function( index, value ) {
if (domissue.hasClass("datatype"+value))
toshow=true;
});
}
if(toshow&&$("#filterlabels").val().length !== 0) {
toshow=false;
$.each($("#filterlabels").val(), function( index, value ) {
@ -406,6 +437,15 @@
});
}
if($("#filtertypes").val().length!==0) {
data = $("#filtertypes").select2('data');
textfilters=textfilters+"&nbsp;&nbsp;&nbsp;&nbsp;<b>EQUIPES</b> =";
$.each($("#filtertypes").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> =";
@ -575,6 +615,35 @@
filterprioritys();
});
// Filter Types
function filtertypes() {
$.ajax({
method: "POST",
url: "{{ path('app_user_preference') }}",
data: {
key:'filtertypes',
id:{{scrum.id}},
value: $("#filtertypes").val()
}
});
showhide();
}
$('#filtertypes').select2();
{% if filtertypes %}
{% for type in filtertypes %}
$("#filtertypes").val($("#filtertypes").val().concat("{{type}}"));
{%endfor%}
$('#filtertypes').trigger('change');
{% endif %}
$('#filtertypes').on("select2:select", function(e) {
filtertypes();
});
$('#filtertypes').on("select2:unselect", function(e) {
filtertypes();
});
// Filter Labels
function filterlabels() {
$.ajax({

View File

@ -0,0 +1,11 @@
{% extends 'base.html.twig' %}
{% block body %}
{% endblock %}
{% block localjavascript %}
$(document).ready(function() {
window.parent.$("#mymodaltype").modal('hide');
});
{% endblock %}

View File

@ -0,0 +1,51 @@
{% extends 'base.html.twig' %}
{% block body %}
{{ form_start(form) }}
{{ form_widget(form.submit) }}
<button class="btn btn-secondary" onClick="closeModal();">Annuler</button>
{% if mode=="update" %}
<a href="{{ path('app_scrumtype_delete',{'id':scrumtype.id}) }}"
class="btn btn-danger float-right"
data-method="delete"
data-confirm="Êtes-vous sûr de vouloir supprimer cet entregistrement ?">
Supprimer
</a>
{% endif %}
<br><br>
{% if app.session.flashbag.has('error') %}
<div class='alert alert-danger' style='margin: 5px 0px'>
<strong>Erreur</strong><br>
{% for flashMessage in app.session.flashbag.get('error') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
{% if app.session.flashbag.has('notice') %}
<div class='alert alert-info' style='margin: 5px 0px'>
<strong>Information</strong><br>
{% for flashMessage in app.session.flashbag.get('notice') %}
{{ flashMessage }}<br>
{% endfor %}
</div>
{% endif %}
{{ form_row(form.name) }}
{{ form_row(form.giteaid) }}
{{ form_end(form) }}
{% endblock %}
{% block localjavascript %}
$(document).ready(function() {
$("#scrumtype_name").focus();
});
function closeModal() {
window.parent.$("#mymodaltype").modal('hide');
}
{% endblock %}