diff --git a/src/ninegitea-1.0/composer.lock b/src/ninegitea-1.0/composer.lock index 3a143b2..f3dcecf 100644 --- a/src/ninegitea-1.0/composer.lock +++ b/src/ninegitea-1.0/composer.lock @@ -3613,6 +3613,7 @@ "mail", "mailer" ], + "abandoned": "symfony/mailer", "time": "2019-11-12T09:31:26+00:00" }, { @@ -5226,6 +5227,7 @@ "symfony", "words" ], + "abandoned": "EnglishInflector from the String component", "time": "2020-05-20T17:43:50+00:00" }, { @@ -7293,6 +7295,7 @@ ], "description": "Symfony SwiftmailerBundle", "homepage": "http://symfony.com", + "abandoned": "symfony/mailer", "time": "2019-11-14T16:18:31+00:00" }, { @@ -8362,12 +8365,12 @@ "version": "1.9.0", "source": { "type": "git", - "url": "https://github.com/webmozart/assert.git", + "url": "https://github.com/webmozarts/assert.git", "reference": "9dc4f203e36f2b486149058bade43c851dd97451" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/9dc4f203e36f2b486149058bade43c851dd97451", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/9dc4f203e36f2b486149058bade43c851dd97451", "reference": "9dc4f203e36f2b486149058bade43c851dd97451", "shasum": "" }, diff --git a/src/ninegitea-1.0/config/routes.yaml b/src/ninegitea-1.0/config/routes.yaml index af50651..74984bd 100644 --- a/src/ninegitea-1.0/config/routes.yaml +++ b/src/ninegitea-1.0/config/routes.yaml @@ -164,6 +164,11 @@ app_group_select: path: /user/group/select defaults: { _controller: App\Controller\GroupController:select } +#== Report ======================================================================================================= +app_report: + path: /user/report/{id} + defaults: { _controller: App\Controller\ReportController:list } + #== Scrum ======================================================================================================== app_scrum: path: /user/scrum @@ -181,6 +186,10 @@ app_scrum_stat: path: /user/scrum/stat/{id} defaults: { _controller: App\Controller\ScrumController:stat } +app_scrum_info: + path: /user/scrum/info/{id} + defaults: { _controller: App\Controller\ScrumController:info } + app_scrum_update: path: /master/scrum/update/{id} defaults: { _controller: App\Controller\ScrumController:update } @@ -265,6 +274,14 @@ app_scrumissue_order: path: /user/scrumissue/order defaults: { _controller: App\Controller\ScrumissueController:order } +app_scrumissue_info: + path: /user/scrumissue/info + defaults: { _controller: App\Controller\ScrumissueController:info } + +app_scrumissue_update: + path: /user/scrumissue/update + defaults: { _controller: App\Controller\ScrumissueController:update } + app_scrumissue_ctrlchange: path: /user/scrumissue/ctrlchange defaults: { _controller: App\Controller\ScrumissueController:ctrlchange } diff --git a/src/ninegitea-1.0/src/Controller/IssueController.php b/src/ninegitea-1.0/src/Controller/IssueController.php index bc9b01f..61275af 100755 --- a/src/ninegitea-1.0/src/Controller/IssueController.php +++ b/src/ninegitea-1.0/src/Controller/IssueController.php @@ -64,6 +64,19 @@ class IssueController extends AbstractController $json=$scrum->getGiteajson(); $json["issues"]=$giteaissues; $json["category"]=$scrum->getCategory(); + foreach($json["issues"] as $key => $giteaissue) { + $issue=$em->getRepository("App:Scrumissue")->findOneBy(["giteaid"=>$giteaissue->id]); + if($issue) { + $json["issues"][$key]->weight=$issue->getWeight(); + $json["issues"][$key]->issueid=$issue->getId(); + $json["issues"][$key]->scrumid=$issue->getScrum()->getId(); + } + else { + $json["issues"][$key]->weight=0; + $json["issues"][$key]->issueid=0; + $json["issues"][$key]->scrumid=0; + } + } $tmp=[]; foreach($scrum->getScrumcolumns() as $column) { diff --git a/src/ninegitea-1.0/src/Controller/ReportController.php b/src/ninegitea-1.0/src/Controller/ReportController.php new file mode 100755 index 0000000..99fdbd1 --- /dev/null +++ b/src/ninegitea-1.0/src/Controller/ReportController.php @@ -0,0 +1,310 @@ +giteaservice = $giteaservice; } + + public function list($id,Request $request) + { + set_time_limit(0); + + $em = $this->getDoctrine()->getManager(); + $scrum = $em->getRepository("App:Scrum")->find($id); + $repoid = $scrum->getGiteaid(); + $repoowner = $scrum->getGiteajson()["owner"]["login"]; + $reponame = $scrum->getGiteajson()["name"]; + + $repo=$this->giteaservice->getRepo($repoid); + $issues=$this->giteaservice->getIssues($repoowner,$reponame,"?state=all"); + + foreach($issues as $keyissue => $issue) { + $issues[$keyissue]->body = $this->giteaservice->markdown("/".$scrum->getGiteajson()["full_name"],"comment",$issues[$keyissue]->body); + $issues[$keyissue]->comments=$this->giteaservice->getIssueComments($repoowner,$reponame,$issue->number); + foreach($issues[$keyissue]->comments as $keycomment => $comment) { + $issues[$keyissue]->comments[$keycomment]->body=$this->giteaservice->markdown("/".$scrum->getGiteajson()["full_name"],"comment",$issues[$keyissue]->comments[$keycomment]->body); + } + + $issues[$keyissue]->timelines=$this->giteaservice->getIssueTimelines($repoowner,$reponame,$issue->number); + } + + // Affichage du formulaire + return $this->render('Report/list.html.twig', [ + 'useheader' => false, + 'usesidebar' => false, + 'maxwidth' => true, + 'repo' => $repo, + 'issues' => $issues, + ]); + + } + + public function submit(Request $request) + { + // Initialisation de l'enregistrement + $em = $this->getDoctrine()->getManager(); + $data = new Entity(); + + // Récupérer les repos de gitea + $gitearepos=$this->giteaservice->getRepos(); + + // Création du formulaire + $form = $this->createForm(Form::class,$data,array("mode"=>"submit","gitearepos"=>$gitearepos)); + + // 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(); + $gitearepo=$this->giteaservice->getRepo($data->getGiteaid()); + $data->setGiteaname($gitearepo->full_name); + $data->setGiteajson(json_decode(json_encode($gitearepo), true)); + + $em->persist($data); + $em->flush(); + + // Retour à la liste + return $this->redirectToRoute($this->route); + } + + // Affichage du formulaire + return $this->render($this->render.'edit.html.twig', [ + 'useheader' => true, + 'usesidebar' => false, + 'maxwidth' => true, + $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); + + // Récupérer les repos de gitea + $gitearepos=$this->giteaservice->getRepos(); + + // Création du formulaire + $form = $this->createForm(Form::class,$data,array("mode"=>"update","gitearepos"=>$gitearepos)); + + // 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(); + $gitearepo=$this->giteaservice->getRepo($data->getGiteaid()); + $data->setGiteaname($gitearepo->full_name); + $data->setGiteajson(json_decode(json_encode($gitearepo), true)); + + $em->persist($data); + $em->flush(); + + // Retour à la liste + return $this->redirectToRoute($this->route); + } + + // Affichage du formulaire + return $this->render($this->render.'edit.html.twig', [ + 'useheader' => true, + 'usesidebar' => false, + 'maxwidth' => true, + $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->redirectToRoute($this->route); + } + } + + public function view($id,Request $request) + { + // Initialisation de l'enregistrement + $em = $this->getDoctrine()->getManager(); + $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); + + // 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); + $filterexcludes = $em->getRepository("App:User")->getUserpreference($this->getUser(),"filterexcludes",$id); + $showfilters = $em->getRepository("App:User")->getUserpreference($this->getUser(),"showfilters",$id); + + return $this->render($this->render.'view.html.twig', [ + 'useheader' => true, + 'usesidebar' => false, + 'usetitle' => $data->getName(), + 'giteaassignees' => $giteaassignees, + 'giteacolumns' => $giteacolumns, + 'giteamilestones' => $giteamilestones, + 'giteateams' => $giteateams, + 'giteaprioritys' => $giteaprioritys, + 'gitealabels' => $gitealabels, + 'filtermilestones' => $filtermilestones, + 'filterteams' => $filterteams, + 'filterprioritys' => $filterprioritys, + 'filterlabels' => $filterlabels, + 'filterassignees' => $filterassignees, + 'filterexcludes' => $filterexcludes, + 'showfilters' => $showfilters, + $this->data => $data, + ]); + } + + public function stat($id,Request $request) + { + // Initialisation de l'enregistrement + $em = $this->getDoctrine()->getManager(); + $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); + + // 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) { + + $labels=$issue->getGiteajson()["labels"]; + $haveteams=true; + if($filterteams) { + $haveteams=false; + foreach($filterteams as $filterteam) { + foreach($labels as $label) { + if($label["id"]==$filterteam) { + $haveteams=true; + } + } + } + } + + 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) { + foreach($milestone["stat"] as $k2=>$statut) { + $keysort = array_column($tbstat[$k1]["stat"][$k2]["labels"], 'label'); + array_multisort($keysort, SORT_ASC, $tbstat[$k1]["stat"][$k2]["labels"]); + } + + } + + return $this->render($this->render.'stat.html.twig', [ + 'useheader' => true, + 'usesidebar' => false, + 'usetitle' => $data->getName(), + 'giteaassignees' => $giteaassignees, + 'giteacolumns' => $giteacolumns, + 'giteamilestones' => $giteamilestones, + 'giteateams' => $giteateams, + 'giteaprioritys' => $giteaprioritys, + 'gitealabels' => $gitealabels, + 'filtermilestones' => $filtermilestones, + 'filterteams' => $filterteams, + 'showfilters' => $showfilters, + $this->data => $data, + 'tbstat' => $tbstat, + ]); + } + + 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()); + } + } + } +} diff --git a/src/ninegitea-1.0/src/Controller/ScrumController.php b/src/ninegitea-1.0/src/Controller/ScrumController.php index 1e9272f..dc5b373 100755 --- a/src/ninegitea-1.0/src/Controller/ScrumController.php +++ b/src/ninegitea-1.0/src/Controller/ScrumController.php @@ -5,6 +5,7 @@ namespace App\Controller; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\Form\FormError; use App\Entity\Scrum as Entity; @@ -298,6 +299,34 @@ class ScrumController extends AbstractController ]); } + public function info($id,Request $request) + { + $em = $this->getDoctrine()->getManager(); + + // Rechercher du scrum en cours + $scrum=$em->getRepository("App:Scrum")->find($id); + if(!$scrum) return new JsonResponse(['message' => 'No Issue'], 403); + + $giteaissues=$this->giteaservice->getIssues($scrum->getGiteajson()["owner"]["login"],$scrum->getGiteajson()["name"]); + + $weights=[]; + foreach($giteaissues as $giteaissue) { + $scrumissue=$em->getRepository("App:Scrumissue")->findOneBy(["scrum"=>$scrum,"giteaid"=>$giteaissue->id]); + if($scrumissue) { + if($giteaissue->milestone) $milestoneid=$giteaissue->milestone->id; + else $milestoneid=-100; + + if(!array_key_exists($milestoneid,$weights)) $weights[$milestoneid]=0; + $weights[$milestoneid]=$weights[$milestoneid]+$scrumissue->getWeight(); + } + } + + $output=[]; + $output["weights"]=$weights; + + return new JsonResponse($output); + } + protected function getErrorForm($id,$form,$request,$data,$mode) { if ($form->get('submit')->isClicked()&&$mode=="delete") { } diff --git a/src/ninegitea-1.0/src/Controller/ScrumissueController.php b/src/ninegitea-1.0/src/Controller/ScrumissueController.php index 3c30ed1..54c97fe 100755 --- a/src/ninegitea-1.0/src/Controller/ScrumissueController.php +++ b/src/ninegitea-1.0/src/Controller/ScrumissueController.php @@ -105,10 +105,55 @@ class ScrumissueController extends AbstractController $em->flush(); - return new JsonResponse(); } + public function info(Request $request) + { + $em = $this->getDoctrine()->getManager(); + + $id=$request->get('id'); + + // Rechercher l'issue en cours + $scrumissue=$em->getRepository("App:Scrumissue")->find($id); + if(!$scrumissue) return new JsonResponse(['message' => 'No Issue'], 403); + + $output=[]; + $output["weight"]=$scrumissue->getWeight(); + + return new JsonResponse($output); + } + + public function update(Request $request) + { + $em = $this->getDoctrine()->getManager(); + + $id=$request->get('id'); + $weight=$request->get('weight'); + + // Rechercher l'issue en cours + $scrumissue=$em->getRepository("App:Scrumissue")->find($id); + if(!$scrumissue) return new JsonResponse(['message' => 'No Issue'], 403); + + $scrumissue->setWeight($weight); + $em->flush(); + + $giteaissues=$this->giteaservice->getIssues($scrumissue->getScrum()->getGiteajson()["owner"]["login"],$scrumissue->getScrum()->getGiteajson()["name"]); + + $weights=[]; + foreach($giteaissues as $giteaissue) { + $issue=$em->getRepository("App:Scrumissue")->findOneBy(["scrum"=>$scrumissue->getScrum(),"giteaid"=>$giteaissue->id]); + if($issue) { + if($giteaissue->milestone) $milestoneid=$giteaissue->milestone->id; + else $milestoneid=-100; + + if(!array_key_exists($milestoneid,$weights)) $weights[$milestoneid]=0; + $weights[$milestoneid]=$weights[$milestoneid]+$issue->getWeight(); + } + } + return new JsonResponse($weights); + } + public function ctrlchange(Request $request) { $em = $this->getDoctrine()->getManager(); diff --git a/src/ninegitea-1.0/src/Entity/Scrumissue.php b/src/ninegitea-1.0/src/Entity/Scrumissue.php index 7f10e6a..8da46c6 100644 --- a/src/ninegitea-1.0/src/Entity/Scrumissue.php +++ b/src/ninegitea-1.0/src/Entity/Scrumissue.php @@ -26,6 +26,11 @@ class Scrumissue */ private $rowid; + /** + * @ORM\Column(type="integer") + */ + private $weight=0; + /** * @ORM\Column(type="integer") */ @@ -198,5 +203,17 @@ class Scrumissue return $this; } + public function getWeight(): ?int + { + return $this->weight; + } + + public function setWeight(int $weight): self + { + $this->weight = $weight; + + return $this; + } + } \ No newline at end of file diff --git a/src/ninegitea-1.0/src/Service/giteaService.php b/src/ninegitea-1.0/src/Service/giteaService.php index 7acd6f3..b4775ba 100644 --- a/src/ninegitea-1.0/src/Service/giteaService.php +++ b/src/ninegitea-1.0/src/Service/giteaService.php @@ -10,10 +10,12 @@ class giteaService private $params; private $session; private $url; - + private $giteaUrl; + public function __construct(SessionInterface $session,ParameterBagInterface $params,$giteaUrl) { $this->params = $params; + $this->giteaUrl = $giteaUrl; $this->url = $giteaUrl."/api/v1"; $this->session = $session; } @@ -29,6 +31,7 @@ class giteaService ]; $body = \Unirest\Request\Body::json($query); + $response=$this->api("POST",$apiurl,$body); if(!$response||$response->code!="200") return false; @@ -38,6 +41,31 @@ class giteaService } } + public function deletetoken($username) { + $apiurl=$this->url."/users/".$username."/tokens/".$this->session->get("giteatoken"); + $response=$this->api("DELETE",$apiurl,null,$this->session->get("giteatoken")); + } + + public function markdown($context,$mode,$body) { + $apiurl = $this->url."/markdown"; + $query= [ + "Context" => $context, + "Mode" => $mode, + "Text" => $body, + "Wiki" => false, + ]; + + $body = \Unirest\Request\Body::json($query); + + + $response=$this->api("POST",$apiurl,$body,$this->session->get("giteatoken")); + if(!$response||$response->code!="200") return false; + else { + $response->body= str_replace($this->giteaUrl,$this->giteaUrl.$context,$response->body); + return $response->body; + } + } + public function getuser() { $apiurl = $this->url."/user"; $response=$this->api("GET",$apiurl,null,$this->session->get("giteatoken")); @@ -48,7 +76,6 @@ class giteaService public function getuserprofil($id) { $apiurl = $this->url."/users/$id"; $response=$this->api("GET",$apiurl,null,$this->session->get("giteatoken")); - dump($response); if(!$response||$response->code!="200") return false; else return $response->body; } @@ -156,8 +183,9 @@ class giteaService else return $response->body; } - public function getissues($owner,$name) { - $apiurl = $this->url."/repos/$owner/$name/issues?state=open"; + public function getissues($owner,$name,$state="?state=open") { + $apiurl = $this->url."/repos/$owner/$name/issues".$state; + $page=1; $limit=20; $issues=[]; @@ -210,11 +238,25 @@ class giteaService $apiurl = $this->url."/repos/$owner/$name/issues/$index"; $body = \Unirest\Request\Body::json($patchs); $response=$this->api("PATCH",$apiurl,$body,$this->session->get("giteatoken")); - dump($response); if(!$response||$response->code!="201") return false; else return $response->body; } + public function getissuecomments($owner,$name,$index) { + $apiurl = $this->url."/repos/$owner/$name/issues/$index/comments"; + $response=$this->api("GET",$apiurl,null,$this->session->get("giteatoken")); + if(!$response||$response->code!="200") return false; + else return $response->body; + } + + + public function getissuetimelines($owner,$name,$index) { + $apiurl = $this->url."/repos/$owner/$name/issues/$index/timeline"; + $response=$this->api("GET",$apiurl,null,$this->session->get("giteatoken")); + if(!$response||$response->code!="200") return false; + else return $response->body; + } + private function api($method,$url,$query,$token=null) { // Entete $headers = [ diff --git a/src/ninegitea-1.0/templates/Issue/list.html.twig b/src/ninegitea-1.0/templates/Issue/list.html.twig index 103e2bf..8dbd1d3 100644 --- a/src/ninegitea-1.0/templates/Issue/list.html.twig +++ b/src/ninegitea-1.0/templates/Issue/list.html.twig @@ -146,6 +146,7 @@ Titre Equipe Priorité + Poid Affecté à Statut Etiquettes @@ -204,6 +205,13 @@ {{ giteaissue.title }} {{ teams|raw }} {{ prioritys|raw }} + + + + + {% set dataorder="" %} {% for assignee in giteaissue.assignees %} {% set dataorder=dataorder~assignee.username %} @@ -224,6 +232,31 @@ + + + {% endblock %} {% block localjavascript %} @@ -580,6 +613,58 @@ showhide(); } + function refreshinfo() { + $.ajax({ + method: "POST", + url: "{{path("app_scrum_info",{id:id})}}", + success: function(data) { + $(".totalweight").html("0"); + + Object.entries(data.weights).forEach(entry => { + const [key, value] = entry; + $("#total"+key).html(value); + }); + } + }); + } + + $(document).on('click','.modissu',function(){ + $(".modal-title").html("#"+$(this).data("giteaid")+" - "+$(this).data("giteatitle")); + $("#modal-issueid").val($(this).data("issue")); + + $.ajax({ + method: "POST", + url: "{{path("app_scrumissue_info")}}", + data: { + id:$("#modal-issueid").val(), + }, + success: function(data) { + $("#modal-issueweight").val(data.weight); + $("#mymodalissue").modal('show'); + $("#modal-issueweight").focus(); + }, + }); + }); + + $("#issu_update").click(function(){ + $.ajax({ + method: "POST", + url: "{{path("app_scrumissue_update")}}", + data: { + id:$("#modal-issueid").val(), + weight:$("#modal-issueweight").val(), + }, + success: function(data) { + $("#issue"+$("#modal-issueid").val()+"-weight").html($("#modal-issueweight").val()); + refreshinfo(); + $("#mymodalissue").modal('hide'); + }, + error: function (request, status, error) { + $("#mymodalissue").modal('hide'); + } + }); + }); + $(document).ready(function() { {% if id== 0 %} $('#filtercategorys').select2(); @@ -725,7 +810,8 @@ $("#filters").removeClass("d-flex"); {% endif %} - showhide(); + showhide(); + $("#mycontent").show(); }); {% endblock %} \ No newline at end of file diff --git a/src/ninegitea-1.0/templates/Report/list.html.twig b/src/ninegitea-1.0/templates/Report/list.html.twig new file mode 100644 index 0000000..3bfffa0 --- /dev/null +++ b/src/ninegitea-1.0/templates/Report/list.html.twig @@ -0,0 +1,153 @@ +{% extends "base.html.twig" %} + +{% block localstyle %} + body { + background-color: #efefef; + } + + .issuetitle { + margin-top:100px; + page-break-before: always; + } + + .issuediv { + zoom:60%; + } + + .issuecontent { + width:80%; + } + .issuedetail { + width:20%; + } + + @media print { + body { + background-color: transparent; + } + } +{% endblock %} + +{% block body %} + +

{{repo.full_name}}

+ {% for issue in issues %} +

#{{issue.number}} = {{issue.title}}

+ +
"; +
+

{{issue.user.login}} le {{issue.created_at|date("d/m/Y H:i")}}

+
+ {{issue.body|raw}} +
+ + {% if issue.comments %} + {% for comment in issue.comments %} +

{{comment.user.login}} le {{comment.created_at|date("d/m/Y H:i")}}

+
+ {{comment.body|raw}} +
+ {% endfor %} + {% endif %} +
+ +
+

Statut

+
+ {% if issue.closed_at %} + Clos le {{issue.closed_at|date("d/m/Y H:i")}} + {% else %} + En Cours + {% endif %} +
+ +

Jalon

+
+ {% if issue.milestone %} + {{ issue.milestone.title|raw }} + {% else %} + Backlog + {% endif %} +
+ + {% if issue.labels %} +

Labels

+
+
+ {% for label in issue.labels %} + {{label.name}} + {% endfor%} +
+
+ {% endif %} + + {% if issue.timelines %} +

Historique

+
+ + {% for timeline in issue.timelines %} + {% if timeline.type!="comment" and timeline.type!="project" and timeline.type!="added_deadline" and timeline.type!="modified_deadline"%} +
  • {{timeline.user.login}} le {{timeline.created_at|date("d/m/Y H:i")}}
    + + {% if timeline.type == "change_title" %} +
    Modification titre de {{timeline.old_title}} à {{timeline.new_title}}
    + + {% elseif timeline.type == "milestone" %} + {% if timeline.milestone %} +
    Affectation au Jalon {{timeline.milestone.title}}
    + {% else %} +
    Suppression du Jalon
    + {% endif %} + + {% elseif timeline.type == "label" %} +
    Affectation au Label {{timeline.label.name}}
    + + {% elseif timeline.type == "comment_ref" or timeline.type == "pull_ref" or timeline.type == "issue_ref" %} +
    Référencé le ticket #{{timeline.ref_issue.number}} - {{timeline.ref_issue.title}}
    + + {% elseif timeline.type == "add_dependency" %} +
    Ajouté dépendance au ticket #{{timeline.dependent_issue.number}} - {{timeline.dependent_issue.title}}
    + + {% elseif timeline.type == "remove_dependency" %} +
    Supprimé dépendance au ticket #{{timeline.dependent_issue.number}} - {{timeline.dependent_issue.title}}
    + + {% elseif timeline.type == "pull_push" %} +
    Ajout révision
    + + {% elseif timeline.type == "assignees" %} +
    Affecté intervenant {{timeline.assignee.login}}
    + + {% elseif timeline.type == "commit_ref" %} +
    Référencé depuis révision #{{timeline.body|raw}}
    + + {% elseif timeline.type == "merge_pull" %} +
    Révision fusionnée
    + + {% elseif timeline.type == "delete_branch" %} +
    Suppression branche {{timeline.old_ref|raw}}
    + + {% elseif timeline.type == "close" %} +
    Clos Fermeture du ticket
    + + {% elseif timeline.type == "review" %} +
    Revue acceptée
    + + {% elseif timeline.type == "review_request" %} +
    Demande de révision
    + + {% elseif timeline.type == "reopen" %} +
    Réouverture du ticket
    + + {% else %} + {{ dump(timeline) }} + {%endif%} + {% endif %} + {% endfor %} +
  • + {% endif %} +
    +
    + {% endfor %} + +{% endblock %} + diff --git a/src/ninegitea-1.0/templates/Scrum/view.html.twig b/src/ninegitea-1.0/templates/Scrum/view.html.twig index 49526c6..88e1189 100644 --- a/src/ninegitea-1.0/templates/Scrum/view.html.twig +++ b/src/ninegitea-1.0/templates/Scrum/view.html.twig @@ -98,7 +98,15 @@ {% endfor %} - + + + +
    + {% for giteamilestone in giteamilestones %} + {{giteamilestone.title}} = 0
    + {% endfor %} + Aucun = 0
    +
    @@ -164,7 +172,7 @@ {% set dataassignees=dataassignees~"dataassignee"~assignee.id~" " %} {% endfor %} -
    +
    + +
    @@ -234,9 +246,36 @@ {% endfor %}
    + + {% endblock %} {% block localjavascript %} + + + function showFilters() { if($("#filters").hasClass("d-flex")) { toshow=0; @@ -374,9 +413,61 @@ }); } - $("#textfilters").html(textfilters); + $("#textfilters").html(textfilters); } + function refreshinfo() { + $.ajax({ + method: "POST", + url: "{{path("app_scrum_info",{id:scrum.id})}}", + success: function(data) { + $(".totalweight").html("0"); + + Object.entries(data.weights).forEach(entry => { + const [key, value] = entry; + $("#total"+key).html(value); + }); + } + }); + } + + $(document).on('click','.modissu',function(){ + $(".modal-title").html("#"+$(this).data("giteaid")+" - "+$(this).data("giteatitle")); + $("#modal-issueid").val($(this).data("issue")); + + $.ajax({ + method: "POST", + url: "{{path("app_scrumissue_info")}}", + data: { + id:$("#modal-issueid").val(), + }, + success: function(data) { + $("#modal-issueweight").val(data.weight); + $("#mymodalissue").modal('show'); + $("#modal-issueweight").focus(); + }, + }); + }); + + $("#issu_update").click(function(){ + $.ajax({ + method: "POST", + url: "{{path("app_scrumissue_update")}}", + data: { + id:$("#modal-issueid").val(), + weight:$("#modal-issueweight").val(), + }, + success: function(data) { + $("#issue"+$("#modal-issueid").val()+"-weight").html($("#modal-issueweight").val()); + refreshinfo(); + $("#mymodalissue").modal('hide'); + }, + error: function (request, status, error) { + $("#mymodalissue").modal('hide'); + } + }); + }); + // Filter Milestones function filtermilestones() { $.ajax({ @@ -556,6 +647,7 @@ // Appliy filters showhide(); + refreshinfo(); $("#mycontent").show(); lastupdate="{{scrum.updatedate|date("Ymd H:i:s")}}"; @@ -589,6 +681,8 @@ $(ui.item).data("column",newcolumn); $(ui.item).data("milestone",newmilestone); if(data) lastupdate=data; + + refreshinfo(); }, error: function (request, status, error) { $( ".scrumcolumn" ).sortable('cancel'); @@ -604,7 +698,6 @@ } }); - console.log(lstordered); $.ajax({ method: "POST", url: "{{path("app_scrumissue_order")}}", @@ -612,8 +705,8 @@ id:{{scrum.id}}, lstordered:lstordered, } - }); - } + }); + }, });