2019-05-02 13:17:06 +02:00
|
|
|
<?php
|
|
|
|
|
2020-03-14 12:21:14 +01:00
|
|
|
use Modules\Interventi\Intervento;
|
|
|
|
|
2019-05-02 13:17:06 +02:00
|
|
|
include_once __DIR__.'/../../../core.php';
|
|
|
|
|
2020-03-14 12:21:14 +01:00
|
|
|
// Interventi da pianificare
|
|
|
|
$interventi_da_pianificare = Intervento::doesntHave('sessioni')
|
|
|
|
->orderByRaw('IF(data_scadenza IS NULL, data_richiesta, data_scadenza)')
|
|
|
|
->get();
|
|
|
|
$raggruppamenti = $interventi_da_pianificare->groupBy(function ($item, $key) {
|
|
|
|
$data = $item->data_scadenza ?: $item->data_richiesta;
|
|
|
|
|
|
|
|
return $data->formatLocalized('%B %Y');
|
|
|
|
});
|
|
|
|
|
|
|
|
$counter = 0;
|
|
|
|
foreach ($raggruppamenti as $mese => $raggruppamento) {
|
|
|
|
++$counter;
|
|
|
|
|
|
|
|
// Se cambia il mese ricreo l'intestazione della tabella
|
|
|
|
if ($counter == 1) {
|
|
|
|
$attr = '';
|
|
|
|
$class = 'fa-minus-circle';
|
|
|
|
} else {
|
|
|
|
$attr = 'style="display:none;"';
|
|
|
|
$class = 'fa-plus-circle';
|
|
|
|
}
|
|
|
|
|
|
|
|
echo "
|
|
|
|
<h4>
|
|
|
|
<a class='clickable' onclick=\"if( $('#t1_".$counter."').css('display') == 'none' ){ $(this).children('i').removeClass('fa-plus-circle'); $(this).children('i').addClass('fa-minus-circle'); }else{ $(this).children('i').addClass('fa-plus-circle'); $(this).children('i').removeClass('fa-minus-circle'); } $('#t1_".$counter."').slideToggle();\">
|
|
|
|
<i class='fa ".$class."'></i> ".$mese.'
|
|
|
|
</a>
|
|
|
|
</h4>';
|
2019-05-02 13:17:06 +02:00
|
|
|
|
|
|
|
echo '
|
2020-03-14 12:21:14 +01:00
|
|
|
<div id="t1_'.$counter.'" '.$attr.'>
|
|
|
|
<table class="table table-hover table-striped">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th width="70">'.tr('Codice').'</th>
|
|
|
|
<th width="120">'.tr('Cliente').'</th>
|
|
|
|
<th width="70"><small>'.tr('Data richiesta').'</small></th>
|
|
|
|
<th width="70"><small>'.tr('Data scadenza').'</small></th>
|
|
|
|
<th width="200">'.tr('Tipo intervento').'</th>
|
|
|
|
<th>'.tr('Descrizione').'</th>
|
|
|
|
<th width="100">'.tr('Sede').'</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
2019-05-02 13:17:06 +02:00
|
|
|
|
2020-03-14 12:21:14 +01:00
|
|
|
<tbody>';
|
|
|
|
|
|
|
|
// Elenco interventi da pianificare
|
|
|
|
foreach ($raggruppamento as $r) {
|
|
|
|
echo '
|
|
|
|
<tr id="int_'.$r['id'].'">
|
|
|
|
<td><a target="_blank" >'.Modules::link(Modules::get('Interventi')['id'], $r['id'], $r['codice']).'</a></td>
|
|
|
|
<td>'.$r['ragione_sociale'].'</td>
|
|
|
|
<td>'.Translator::dateToLocale($r['data_richiesta']).'</td>
|
|
|
|
<td>'.((empty($r['data_scadenza'])) ? ' - ' : Translator::dateToLocale($r['data_scadenza'])).'</td>
|
|
|
|
<td>'.$r['tipointervento'].'</td>
|
|
|
|
<td>'.nl2br($r['richiesta']).'</td>
|
|
|
|
';
|
2019-05-02 13:17:06 +02:00
|
|
|
|
|
|
|
echo '
|
2020-03-14 12:21:14 +01:00
|
|
|
<td>';
|
|
|
|
// Sede
|
|
|
|
if ($r['idsede'] == '-1') {
|
|
|
|
echo '- '.('Nessuna').' -';
|
|
|
|
} elseif (empty($r['idsede'])) {
|
|
|
|
echo tr('Sede legale');
|
|
|
|
} else {
|
|
|
|
$rsp2 = $dbo->fetchArray("SELECT id, CONCAT( CONCAT_WS( ' (', CONCAT_WS(', ', nomesede, citta), indirizzo ), ')') AS descrizione FROM an_sedi WHERE id=".prepare($r['idsede']));
|
|
|
|
|
|
|
|
echo $rsp2[0]['descrizione'];
|
|
|
|
}
|
|
|
|
echo '
|
|
|
|
</td>';
|
|
|
|
|
|
|
|
echo '
|
|
|
|
</tr>';
|
2019-05-02 13:17:06 +02:00
|
|
|
}
|
2020-03-14 12:21:14 +01:00
|
|
|
|
2019-05-02 13:17:06 +02:00
|
|
|
echo '
|
2020-03-14 12:21:14 +01:00
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>';
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($raggruppamenti->isEmpty()) {
|
2019-05-02 13:17:06 +02:00
|
|
|
echo '
|
2020-03-14 12:21:14 +01:00
|
|
|
<p>'.tr('Non ci sono interventi da pianificare').'.</p>';
|
2019-05-02 13:17:06 +02:00
|
|
|
}
|