feat(#20): possibilité d'assigner des intervenants sur un ticket

This commit is contained in:
afornerot 2024-06-12 16:09:40 +02:00
parent 31876489ca
commit 0249b6cfae
5 changed files with 126 additions and 17 deletions

View File

@ -353,6 +353,10 @@ app_scrumissue_color:
path: /user/scrumissue/color
defaults: { _controller: App\Controller\ScrumissueController:color }
app_scrumissue_assigne:
path: /user/scrumissue/assigne
defaults: { _controller: App\Controller\ScrumissueController:assigne }
app_scrumissue_ctrlchange:
path: /user/scrumissue/ctrlchange
defaults: { _controller: App\Controller\ScrumissueController:ctrlchange }

View File

@ -138,6 +138,7 @@ class ScrumissueController extends AbstractController
$output=[];
$output["weight"]=$scrumissue->getWeight();
$output["giteajson"]=$scrumissue->getGiteajson();
return new JsonResponse($output);
}
@ -275,6 +276,26 @@ class ScrumissueController extends AbstractController
return new JsonResponse([]);
}
public function assigne(Request $request)
{
$em = $this->getDoctrine()->getManager();
$id=$request->get('id');
$assignees=$request->get('assignees');
// Rechercher l'issue en cours
$scrumissue=$em->getRepository("App:Scrumissue")->find($id);
if(!$scrumissue) return new JsonResponse(['message' => 'No Issue'], 403);
// Affecter l'issue
$response=$this->giteaservice->patchissue($scrumissue->getScrum()->getGiteajson()["owner"]["login"],$scrumissue->getScrum()->getGiteajson()["name"],$scrumissue->getGiteanumber(),["assignees"=>$assignees]);
if(!$response) return new JsonResponse(['message' => 'Error api'], 403);
return new JsonResponse([]);
}
public function color(Request $request)
{
$em = $this->getDoctrine()->getManager();

View File

@ -168,10 +168,12 @@ class ScrumRepository extends ServiceEntityRepository
$gitealabels=$this->giteaservice->getLabels($scrum->getGiteajson()["owner"]["login"],$scrum->getGiteajson()["name"]);
// Formatter les labels non colomn/team/priority/type
/*
foreach($gitealabels as $key => $gitealabel) {
if(in_array($gitealabel->id,$giteacolumns)||in_array($gitealabel->id,$giteateams)||in_array($gitealabel->id,$giteaprioritys)||in_array($gitealabel->id,$giteatypes))
unset($gitealabels[$key]);
}
*/
// Récupérer les issues de gitea
$giteaissues=$this->giteaservice->getIssues($scrum->getGiteajson()["owner"]["login"],$scrum->getGiteajson()["name"],"?state=".($viewclosed=="true"?"all":"open"));

View File

@ -210,9 +210,7 @@
{% set issuprioritycolor="#"~label.color %}
{% endif %}
{% 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 %}
{% set datalabels=datalabels~"datalabel"~label.id~" " %}
{% endfor %}
{% set dataassignees="" %}
@ -266,7 +264,7 @@
<div id="submenu{{issue.id}}" class="submenu" onmouseleave="issuout(this)" style="
position: absolute;
left: 223px;
left: 214px;
top: -1px;
width:300px;
z-index:1200;
@ -279,7 +277,7 @@
<div id="viewissu{{ issue.id }}" class="viewissu mb-2" data-issue="{{ issue.id }}" data-giteaid="{{issue.giteanumber}}" data-giteatitle="{{ issue.giteatitle }}">
<i class="btn fas fa-eye p-0 m-0 fa-fw pl-1 pl-1"></i>
<span>
<span style="cursor:pointer;">
Aperçu Ticket
</span>
</div>
@ -291,7 +289,7 @@
<div id="modissu{{ issue.id }}" class="modissu mb-2" data-issue="{{ issue.id }}" data-giteaid="{{issue.giteanumber}}" data-giteatitle="{{ issue.giteatitle }}">
<i class="btn fas fa-weight-hanging p-0 m-0 fa-fw pl-1 pl-1"></i>
<span>
<span style="cursor:pointer;">
Modifier le Poids = <span class="issue{{issue.id}}-weight">{{ issue.weight }}</span>
</span>
</div>
@ -299,19 +297,26 @@
{% if issue.scrumissueblock is empty %}
<div id="lockissu{{ issue.id }}" class="lockissu mb-2" data-issue="{{ issue.id }}" data-giteaid="{{issue.giteanumber}}" data-giteatitle="{{ issue.giteatitle }}">
<i class="btn fas fa-lock p-0 m-0 fa-fw pl-1 pl-1"></i>
<span>
<span style="cursor:pointer;">
Ajouter ce ticket comme bloquant à
</span>
</div>
{% else %}
<div id="unlockissu{{ issue.id }}" class="unlockissu mb-2" data-issue="{{ issue.id }}" data-giteaid="{{issue.giteanumber}}" data-giteatitle="{{ issue.giteatitle }}">
<i class="btn fas fa-lock p-0 m-0 fa-fw pl-1 pl-1"></i>
<span>
<span style="cursor:pointer;">
N'est plus bloquant pour #{{ issue.scrumissueblock.giteanumber}}
</span>
</div>
{% endif %}
<div id="assigneissu{{ issue.id }}" class="assigneissu mb-2" data-issue="{{ issue.id }}" data-giteaid="{{issue.giteanumber}}" data-giteatitle="{{ issue.giteatitle }}">
<i class="btn fas fa-users p-0 m-0 fa-fw pl-1 pl-1"></i>
<span style="cursor:pointer;">
Affecté à
</span>
</div>
<div>
<input type="text" id="colorissu{{ issue.id }}" data-issue="{{ issue.id }}" class="pick-a-color form-control form-control spectrum sp-colorize" value="{{issue.color}}" autocomplete="off">
</div>
@ -372,15 +377,19 @@
<i class="fas fa-weight-hanging"></i> = <span class="issue{{issue.id}}-weight">{{ issue.weight }}</span>
</div>
<div class="d-flex">
<div class="d-flex text-small">
<div class="text-small">Crée le {{issue.giteajson.created_at|date("d/m/y")}}</div>
<div class="text-small text-right ml-auto">Modifié le {{issue.giteajson.updated_at|date("d/m/y")}}</div>
</div>
{% if issue.giteastate=="closed" %}
<div class="text-small">Clos le {{issue.giteajson.closed_at|date("d/m/y")}}</div>
{% endif %}
<div class="text-small">
<div class="text-small">Par {{issue.giteajson.user.login}}</div>
{% if issue.giteastate=="closed" %}
<div class="text-small text-right ml-auto">
Clos le {{issue.giteajson.closed_at|date("d/m/y")}}
</div>
{% endif %}
</div>
</div>
</div>
{% endif %}
@ -443,6 +452,36 @@
</div>
</div>
</div>
<div id="mymodalassignees" 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">
<input type="hidden" id="modal-issueid" name="modal-issueid" required="required" class=" form-control" value="">
<div style="width:100%">
<label class="control-label required" for="issu_weight">
Affecté à
</label>
<select id="modal-assignees" multiple="multiple" class="form-control mb-3">
{% for giteaassignee in giteaassignees %}
<option value="{{giteaassignee.login}}">{{giteaassignee.login}}</option>
{% endfor %}
</select>
</div>
<button id="issu_assigne" class="btn btn-success mt-3">Enregistrer</button>
</div>
</div>
</div>
</div>
{% endblock %}
{% block localjavascript %}
@ -649,8 +688,6 @@
$("#modal-issueblocked").focus();
});
$("#issu_blockupdate").click(function(){
$.ajax({
method: "POST",
@ -740,6 +777,51 @@
});
});
$(document).on('click','.assigneissu',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) {
var tbassignees=[];
for (let assignee of data.giteajson.assignees) {
tbassignees.push(assignee.login);
}
$('#modal-assignees').select2();
$('#modal-assignees').val(tbassignees);
$('#modal-assignees').trigger('change');
$("#mymodalassignees").modal('show');
$(".submenu").hide();
$("#modal-assignees").focus();
},
});
});
$("#issu_assigne").click(function(){
$.ajax({
method: "POST",
url: "{{path("app_scrumissue_assigne")}}",
data: {
id:$("#modal-issueid").val(),
assignees:$("#modal-assignees").val(),
},
success: function(data) {
location.reload();
},
error: function (request, status, error) {
alert("pb sur l'affectation au ticket");
}
});
});
// Filter Milestones
function filtermilestones() {
$.ajax({