Skip to content

Commit 06b43af

Browse files
feat: gestione bulk per impostare flag enabled massivamente sulle aliquote iva
1 parent 0cc96d1 commit 06b43af

1 file changed

Lines changed: 32 additions & 3 deletions

File tree

modules/iva/bulk.php

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020

2121
include_once __DIR__.'/../../core.php';
2222

23+
use Modules\Iva\Aliquota;
24+
2325
switch (post('op')) {
2426
case 'delete_bulk':
2527
$count_iva = $dbo->fetchNum('SELECT `id` FROM `co_iva` WHERE `deleted_at` IS NOT NULL');
@@ -50,10 +52,37 @@
5052
flash()->warning(tr('Nessuna tipologia iva eliminata!'));
5153
}
5254
break;
55+
56+
case 'change_enabled':
57+
foreach ($id_records as $id) {
58+
$aliquota = Aliquota::find($id);
59+
$aliquota->enabled = post('enabled');
60+
$aliquota->save();
61+
}
62+
63+
flash()->info(tr('Stato aliquote iva aggiornato con successo!'));
64+
65+
break;
5366
}
5467

55-
$bulk = [
56-
'delete_bulk' => tr('Elimina'),
68+
$operations['change_enabled'] = [
69+
'text' => '<span><i class="fa fa-refresh"></i> '.tr('Aggiorna stato').'</span>',
70+
'data' => [
71+
'title' => tr('Cambiare lo stato delle aliquote iva?'),
72+
'msg' => tr('Per ciascuna aliquota iva selezionata, verrà aggiornato lo stato').'
73+
<br><br>{[ "type": "checkbox", "label": "'.tr('Attivo').'", "name": "enabled" ]}',
74+
'button' => tr('Procedi'),
75+
'class' => 'btn btn-lg btn-success',
76+
],
77+
];
78+
79+
$operations['delete_bulk'] = [
80+
'text' => '<span><i class="fa fa-trash"></i> '.tr('Elimina').'</span>',
81+
'data' => [
82+
'msg' => tr('Vuoi davvero eliminare le aliquote iva selezionate?'),
83+
'button' => tr('Procedi'),
84+
'class' => 'btn btn-lg btn-danger',
85+
],
5786
];
5887

59-
return $bulk;
88+
return $operations;

0 commit comments

Comments
 (0)