Skip to content
Snippets Groups Projects
Commit d429eebe authored by Aurore Chayrouse's avatar Aurore Chayrouse Committed by Jonathan Foucher
Browse files

#506 Liste des actions de...

#506 Liste des actions de protection : Nouvelles Colonnes
parent 2514e7f6
No related branches found
No related tags found
No related merge requests found
...@@ -346,8 +346,10 @@ class MesurementController extends CRUDController ...@@ -346,8 +346,10 @@ class MesurementController extends CRUDController
3 => 'cout', 3 => 'cout',
4 => 'charge', 4 => 'charge',
5 => 'priorite', 5 => 'priorite',
6 => 'responsable_action', 6 => 'responsable_action',
7 => 'actions', 7 => 'description',
8 => 'observation',
9 => 'actions',
]; ];
} }
...@@ -363,16 +365,6 @@ class MesurementController extends CRUDController ...@@ -363,16 +365,6 @@ class MesurementController extends CRUDController
/** @var Model\Mesurement $action */ /** @var Model\Mesurement $action */
foreach ($actions as $action) { foreach ($actions as $action) {
// Réduit la longueur du texte à 105 caractères
$description = $action->getDescription();
if(isset($description) && strlen($description) > 105) {
$description = substr($description, 0, 105).'...';
}
$observation = $action->getComment();
if(isset($observation) && strlen($observation) > 105) {
$observation = substr($observation, 0, 105).'...';
}
$reponse['data'][] = [ $reponse['data'][] = [
'id' => $action->getId(), 'id' => $action->getId(),
'nom' => !$isActionPlan ? $this->generateShowLink($action) : $action->getName(), 'nom' => !$isActionPlan ? $this->generateShowLink($action) : $action->getName(),
...@@ -383,8 +375,8 @@ class MesurementController extends CRUDController ...@@ -383,8 +375,8 @@ class MesurementController extends CRUDController
'priorite' => !\is_null($action->getPriority()) ? MesurementPriorityDictionary::getPriorities()[$action->getPriority()] : null, 'priorite' => !\is_null($action->getPriority()) ? MesurementPriorityDictionary::getPriorities()[$action->getPriority()] : null,
'date_planification' => !\is_null($action->getPlanificationDate()) ? \date_format($action->getPlanificationDate(), 'd/m/Y') : null, 'date_planification' => !\is_null($action->getPlanificationDate()) ? \date_format($action->getPlanificationDate(), 'd/m/Y') : null,
'responsable_action' => $action->getManager(), 'responsable_action' => $action->getManager(),
'description' => $description, 'description' => $action->getDescription(),
'observation' => $observation, 'observation' => $action->getComment(),
'actions' => $this->generateActionCell($action, $isActionPlan), 'actions' => $this->generateActionCell($action, $isActionPlan),
]; ];
} }
......
...@@ -193,6 +193,10 @@ class MesurementGenerator extends AbstractGenerator implements ImpressionGenerat ...@@ -193,6 +193,10 @@ class MesurementGenerator extends AbstractGenerator implements ImpressionGenerat
? ($mesurement->getPlanificationDate() ? $this->getDate($mesurement->getPlanificationDate()) : null) ? ($mesurement->getPlanificationDate() ? $this->getDate($mesurement->getPlanificationDate()) : null)
: 'Non applicable', : 'Non applicable',
], ],
[
'Observations',
$mesurement->getComment(),
],
]; ];
$historyData = [ $historyData = [
......
...@@ -121,8 +121,16 @@ ...@@ -121,8 +121,16 @@
order: [ order: [
[5, 'desc' ] [5, 'desc' ]
], ],
addSubstr : [7, 8],
} %} } %}
<script>
function substrColRenderFunction (data, type, full, meta){
let content = data && data.length > 105 ? `<span data-toggle="tooltip" data-placement="bottom" title="${data}">${data.substring(0, 105)}...</span>` : data
return content;
}
</script>
{{ include('_Utils/_serverside_datatable.html.twig') }} {{ include('_Utils/_serverside_datatable.html.twig') }}
<script> <script>
......
...@@ -95,15 +95,19 @@ ...@@ -95,15 +95,19 @@
<th> <th>
<input class="form-control" type="text" id="search_responsable_action" placeholder="Responsable" style="width: 100%;"> <input class="form-control" type="text" id="search_responsable_action" placeholder="Responsable" style="width: 100%;">
</th> </th>
<th scope="col"></th>
<th scope="col"></th>
</tr> </tr>
<tr> <tr>
<th>{{ 'registry.mesurement.list.name'|trans }}</th> <th scope="col">{{ 'registry.mesurement.list.name'|trans }}</th>
<th>{{ 'registry.mesurement.list.collectivity'|trans }}</th> <th scope="col">{{ 'registry.mesurement.list.collectivity'|trans }}</th>
<th>{{ 'registry.mesurement.list.status'|trans }}</th> <th scope="col">{{ 'registry.mesurement.list.status'|trans }}</th>
<th>{{ 'registry.mesurement.list.cost'|trans }}</th> <th scope="col">{{ 'registry.mesurement.list.cost'|trans }}</th>
<th>{{ 'registry.mesurement.list.charge'|trans }}</th> <th scope="col">{{ 'registry.mesurement.list.charge'|trans }}</th>
<th>{{ 'registry.mesurement.list.priority'|trans }}</th> <th scope="col">{{ 'registry.mesurement.list.priority'|trans }}</th>
<th>{{ 'registry.mesurement.list.responsable'|trans }}</th> <th scope="col">{{ 'registry.mesurement.list.responsable'|trans }}</th>
<th scope="col">{{ 'registry.mesurement.list.description'|trans }}</th>
<th scope="col">{{ 'registry.mesurement.list.observation'|trans }}</th>
{% if is_granted('ROLE_USER') %} {% if is_granted('ROLE_USER') %}
<th>{{ 'label.actions'|trans }}</th> <th>{{ 'label.actions'|trans }}</th>
{% endif %} {% endif %}
...@@ -140,18 +144,29 @@ ...@@ -140,18 +144,29 @@
{"data": "charge"}, {"data": "charge"},
{"data": "priorite"}, {"data": "priorite"},
{"data": "responsable_action"}, {"data": "responsable_action"},
{"data": "description", "visible": false, "orderable": false},
{"data": "observation", "visible": false, "orderable": false},
{"data": "actions", "orderable": false, "className": "noVis", "visible": actionIsVisible}, {"data": "actions", "orderable": false, "className": "noVis", "visible": actionIsVisible},
], ],
order: [ order: [
[5, 'desc' ] [5, 'desc' ]
], ],
addSubstr : [7, 8],
} %} } %}
<script>
function substrColRenderFunction (data, type, full, meta){
let content = data && data.length > 105 ? `<span data-toggle="tooltip" data-placement="bottom" title="${data}">${data.substring(0, 105)}...</span>` : data
return content;
}
</script>
{{ include('_Utils/_serverside_datatable.html.twig') }} {{ include('_Utils/_serverside_datatable.html.twig') }}
<script> <script>
$(document).ready(function() { $(document).ready(function() {
$('#table_filter').hide(); $('#table_filter').hide();
var oTable = $('#table').DataTable(); var oTable = $('#table').DataTable();
oTable.on( 'draw', function () { oTable.on( 'draw', function () {
...@@ -202,6 +217,7 @@ ...@@ -202,6 +217,7 @@
$('#search_responsable_action').keyup($.debounce(250, function(){ $('#search_responsable_action').keyup($.debounce(250, function(){
oTable.column('6').search($(this).val()).draw() ; oTable.column('6').search($(this).val()).draw() ;
})); }));
} ); } );
</script> </script>
{% endblock %} {% endblock %}
...@@ -94,6 +94,17 @@ ...@@ -94,6 +94,17 @@
delete options.addcheckbox; delete options.addcheckbox;
} }
if ( options.addSubstr ) {
options.columnDefs = [{
targets: options.addSubstr,
searchable: false,
orderable: false,
render: substrColRenderFunction,
}];
delete options.addSubstr;
}
var fullData = []; var fullData = [];
var strip = function ( str ) { var strip = function ( str ) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment