Controllo per impedire l'aggiunta di note interne vuote

Migliorie minori
This commit is contained in:
Luca 2020-07-17 16:03:21 +02:00
parent 714b0ca810
commit e4fc9b3c52
5 changed files with 77 additions and 53 deletions

View File

@ -207,31 +207,35 @@ if (!empty($interventi)) {
</td>
</tr>';
// Totali per stato
echo '
<tr>
<td colspan="6">
<br><b>'.tr('Totale interventi per stato', [], ['upper' => true]).'</b>
</td>
</tr>';
$stati = $interventi->groupBy('idstatointervento');
foreach ($stati as $interventi_collegati) {
$stato = $interventi_collegati->first()->stato;
$totale_stato = sum(array_column($interventi_collegati->toArray(), 'totale_imponibile'));
if (count($stati)>0){
// Totali per stato
echo '
<tr>
<td colspan="3"></td>
<tr>
<td colspan="6">
<br><b>'.tr('Totale interventi per stato', [], ['upper' => true]).'</b>
</td>
</tr>';
<td class="text-right" colspan="2" style="background:'.$stato->colore.';">
<big><b>'.$stato->descrizione.':</b></big>
</td>
foreach ($stati as $interventi_collegati) {
$stato = $interventi_collegati->first()->stato;
$totale_stato = sum(array_column($interventi_collegati->toArray(), 'totale_imponibile'));
echo '
<tr>
<td colspan="3"></td>
<td class="text-right" colspan="2" style="background:'.$stato->colore.';">
<big><b>'.$stato->descrizione.':</b></big>
</td>
<td class="text-right">
<big><b>'.moneyFormat($totale_stato).'</b></big>
</td>
</tr>';
}
<td class="text-right">
<big><b>'.moneyFormat($totale_stato).'</b></big>
</td>
</tr>';
}
echo '
@ -269,16 +273,16 @@ if (!empty($totale_ore_contratto)) {
echo '
<div class="row">
<big class="col-md-4 col-md-offset-4 text-center">
<table class="table text-left">
<table class="table text-left table-striped table-bordered">
<tr>
<td colspan="2">'.tr('Ore in contratto').':</td>
<td colspan="2" class="text-right">'.Translator::numberToLocale($totale_ore_contratto).'</td>
<td>'.tr('Ore a contratto').':</td>
<td class="text-right">'.Translator::numberToLocale($totale_ore_contratto).'</td>
</tr>
<tr>
<td>'.tr('Ore erogate totali').':</td>
<td class="text-right">'.Translator::numberToLocale($totale_ore).'</td>
</tr>
<tr>
<td>'.tr('Ore residue totali').':</td>
<td class="text-right">'.Translator::numberToLocale(floatval($totale_ore_contratto) - floatval($totale_ore)).'</td>
</tr>
@ -286,8 +290,9 @@ if (!empty($totale_ore_contratto)) {
<tr>
<td>'.tr('Ore erogate concluse').':</td>
<td class="text-right">'.Translator::numberToLocale($totale_ore_completate).'</td>
<td>'.tr('Ore residue').':</td>
</tr>
<tr>
<td>'.tr('Ore residue concluse').':</td>
<td class="text-right">'.Translator::numberToLocale(floatval($totale_ore_contratto) - floatval($totale_ore_completate)).'</td>
</tr>
</table>

View File

@ -170,16 +170,16 @@ switch (get('op')) {
foreach ($rsp as $r) {
if ($r['mese'] == $mese) {
if (date('Ymd', strtotime($r['data_richiesta'])) < date('Ymd')) {
$class = 'fc-event-danger';
$class = 'danger';
} else {
$class = 'fc-event-primary';
$class = 'primary';
}
echo '
<div class="fc-event '.$class.'" data-id="'.$r['id'].'" data-idcontratto="'.$r['idcontratto'].'" data-ref="'.$r['ref'].'">'.(($r['ref'] == 'intervento') ? '<i class=\'fa fa-wrench pull-right\'></i>' : '<i class=\'fa fa-file-text-o pull-right\'></i>').'
<div class="fc-event fc-event-'.$class.'" data-id="'.$r['id'].'" data-idcontratto="'.$r['idcontratto'].'" data-ref="'.$r['ref'].'">'.(($r['ref'] == 'intervento') ? '<i class=\'fa fa-wrench pull-right\'></i>' : '<i class=\'fa fa-file-text-o pull-right\'></i>').'
<b>'.$r['ragione_sociale'].'</b><br>'.Translator::dateToLocale($r['data_richiesta']).' ('.$r['tipointervento'].')<div class="request" >'.(!empty($r['richiesta']) ? ' - '.$r['richiesta'] : '').'</div>'.(!empty($r['nomecontratto']) ? '<br><b>Contratto:</b> '.$r['nomecontratto'] : '').
(!empty($r['data_scadenza'] and $r['data_scadenza'] != '0000-00-00 00:00:00') ? '<br><small>'.tr('entro il: ').Translator::dateToLocale($r['data_scadenza']).'</small>' : '').
(($r['ref'] == 'intervento') ? (Modules::link('Interventi', $r['id'], '<i class="fa fa-eye"></i>', null, 'title="'.tr('Visualizza scheda').'" class="btn btn-primary btn-xs pull-right"')).'<br>' : (Modules::link('Contratti', $r['idcontratto'], '<i class="fa fa-eye"></i>', null, 'title="'.tr('Visualizza scheda').'" class="btn btn-primary btn-xs pull-right"')).'<br>').
(($r['ref'] == 'intervento') ? (Modules::link('Interventi', $r['id'], '<i class="fa fa-eye"></i>', null, 'title="'.tr('Visualizza scheda').'" class="btn btn-'.$class.' btn-xs pull-right"')).'<br>' : (Modules::link('Contratti', $r['idcontratto'], '<i class="fa fa-eye"></i>', null, 'title="'.tr('Visualizza scheda').'" class="btn btn-'.$class.' btn-xs pull-right"')).'<br>').
'</div>';
}
} ?>

View File

@ -206,31 +206,35 @@ if (!empty($interventi)) {
</td>
</tr>';
// Totali per stato
echo '
<tr>
<td colspan="6">
<br><b>'.tr('Totale interventi per stato', [], ['upper' => true]).'</b>
</td>
</tr>';
$stati = $interventi->groupBy('idstatointervento');
foreach ($stati as $interventi_collegati) {
$stato = $interventi_collegati->first()->stato;
$totale_stato = sum(array_column($interventi_collegati->toArray(), 'totale_imponibile'));
if (count($stati)>0){
// Totali per stato
echo '
<tr>
<td colspan="3"></td>
<tr>
<td colspan="6">
<br><b>'.tr('Totale interventi per stato', [], ['upper' => true]).'</b>
</td>
</tr>';
<td class="text-right" colspan="2" style="background:'.$stato->colore.';">
<big><b>'.$stato->descrizione.':</b></big>
</td>
foreach ($stati as $interventi_collegati) {
$stato = $interventi_collegati->first()->stato;
$totale_stato = sum(array_column($interventi_collegati->toArray(), 'totale_imponibile'));
echo '
<tr>
<td colspan="3"></td>
<td class="text-right" colspan="2" style="background:'.$stato->colore.';">
<big><b>'.$stato->descrizione.':</b></big>
</td>
<td class="text-right">
<big><b>'.moneyFormat($totale_stato).'</b></big>
</td>
</tr>';
}
<td class="text-right">
<big><b>'.moneyFormat($totale_stato).'</b></big>
</td>
</tr>';
}
echo '

View File

@ -87,10 +87,25 @@ if ($structure->permission == 'rw') {
<!-- PULSANTI -->
<div class="row">
<div class="col-md-12 text-right">
<button type="sumbit" class="btn btn-primary">
<button type="submit" class="btn btn-primary" disabled id="aggiungi_nota" >
<i class="fa fa-plus"></i> '.tr('Aggiungi').'
</button>
</div>
</div>
</form>';
}
echo '
<script>
$(document).ready(function(){
CKEDITOR.instances["contenuto"].on("key", function() {
setTimeout(function(){
if(CKEDITOR.instances["contenuto"].getData() == ""){
$("#aggiungi_nota").prop("disabled", true);
}
else $("#aggiungi_nota").prop("disabled", false);
}, 10);
});
});
</script>';

View File

@ -59,7 +59,7 @@ if ($pricing || !empty($totale_ore)) {
<th colspan="2" class="text-center">
<b>'.Translator::numberToLocale($totale_ore - $totale_ore_impiegate).'</b><br>
<p>'.tr('Ore erogate').': '.Translator::numberToLocale($totale_ore_impiegate).'</p>
<p>'.tr('Ore in contratto').': '.Translator::numberToLocale($totale_ore).'</p>
<p>'.tr('Ore a contratto').': '.Translator::numberToLocale($totale_ore).'</p>
</th>
</tr>';
}