|
| 1 | +<?php |
| 2 | + |
| 3 | +/* |
| 4 | + * OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione |
| 5 | + * Copyright (C) DevCode s.r.l. |
| 6 | + * |
| 7 | + * This program is free software: you can redistribute it and/or modify |
| 8 | + * it under the terms of the GNU General Public License as published by |
| 9 | + * the Free Software Foundation, either version 3 of the License, or |
| 10 | + * (at your option) any later version. |
| 11 | + * |
| 12 | + * This program is distributed in the hope that it will be useful, |
| 13 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | + * GNU General Public License for more details. |
| 16 | + * |
| 17 | + * You should have received a copy of the GNU General Public License |
| 18 | + * along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 19 | + */ |
| 20 | + |
| 21 | +include_once __DIR__.'/../../../core.php'; |
| 22 | + |
| 23 | +$righe = post('righe'); |
| 24 | + |
| 25 | +if (empty($righe) || !is_array($righe)) { |
| 26 | + exit; |
| 27 | +} |
| 28 | + |
| 29 | +echo '<table class="table table-striped table-hover table-bordered" id="tabella-inventario"> |
| 30 | + <thead> |
| 31 | + <tr> |
| 32 | + <th width="20%">'.tr('Codice').'</th> |
| 33 | + <th width="30%">'.tr('Descrizione').'</th> |
| 34 | + <th width="15%">'.tr('Giacenza attuale').'</th> |
| 35 | + <th width="15%">'.tr('Nuova giacenza').'</th> |
| 36 | + <th width="15%">'.tr('Ubicazione').'</th> |
| 37 | + <th width="5%">'.tr('Azioni').'</th> |
| 38 | + </tr> |
| 39 | + </thead> |
| 40 | + <tbody>'; |
| 41 | + |
| 42 | +foreach ($righe as $riga) { |
| 43 | + $id = $riga['id']; |
| 44 | + $codice = $riga['codice']; |
| 45 | + $descrizione = $riga['descrizione']; |
| 46 | + $giacenza_attuale = floatval($riga['giacenza_attuale']); |
| 47 | + $nuova_giacenza = floatval($riga['nuova_giacenza']); |
| 48 | + $ubicazione = $riga['ubicazione']; |
| 49 | + |
| 50 | + echo '<tr data-id="'.$id.'"> |
| 51 | + <td>'.$codice.'</td> |
| 52 | + <td>'.$descrizione.'</td> |
| 53 | + <td class="text-right">'.Translator::numberToLocale($giacenza_attuale).'</td> |
| 54 | + <td>'; |
| 55 | + |
| 56 | + // Input giacenza con struttura OpenSTAManager |
| 57 | + echo '{[ "type": "number", "name": "giacenza_'.$id.'", "value": "'.$nuova_giacenza.'", "decimals": "qta", "class": "text-right", "onchange": "aggiornaGiacenza('.$id.', this.value)" ]}'; |
| 58 | + |
| 59 | + echo '</td> |
| 60 | + <td>'; |
| 61 | + |
| 62 | + // Input ubicazione con struttura OpenSTAManager |
| 63 | + echo '{[ "type": "text", "name": "ubicazione_'.$id.'", "value": "'.$ubicazione.'", "placeholder": "'.tr('Ubicazione').'", "onchange": "aggiornaUbicazione('.$id.', this.value)" ]}'; |
| 64 | + |
| 65 | + echo '</td> |
| 66 | + <td class="text-center"> |
| 67 | + <button type="button" class="btn btn-danger" |
| 68 | + onclick="rimuoviRigaInventario('.$id.')" |
| 69 | + title="'.tr('Rimuovi').'"> |
| 70 | + <i class="fa fa-trash"></i> |
| 71 | + </button> |
| 72 | + </td> |
| 73 | + </tr>'; |
| 74 | +} |
| 75 | + |
| 76 | +echo '</tbody></table>'; |
0 commit comments