|
| 1 | +<?php |
| 2 | +/* |
| 3 | + * OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione |
| 4 | + * Copyright (C) DevCode s.r.l. |
| 5 | + * |
| 6 | + * This program is free software: you can redistribute it and/or modify |
| 7 | + * it under the terms of the GNU General Public License as published by |
| 8 | + * the Free Software Foundation, either version 3 of the License, or |
| 9 | + * (at your option) any later version. |
| 10 | + * |
| 11 | + * This program is distributed in the hope that it will be useful, |
| 12 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | + * GNU General Public License for more details. |
| 15 | + * |
| 16 | + * You should have received a copy of the GNU General Public License |
| 17 | + * along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 18 | + */ |
| 19 | + |
| 20 | +include_once __DIR__.'/../../core.php'; |
| 21 | + |
| 22 | +if ($record['can_delete']) { |
| 23 | + $attr = ''; |
| 24 | +} else { |
| 25 | + $attr = 'readonly'; |
| 26 | + echo '<div class="alert alert-warning">'.tr('Alcune impostazioni non possono essere modificate per questo stato.').('</div>'); |
| 27 | +} |
| 28 | + |
| 29 | +?> |
| 30 | +<form action="" method="post" id="edit-form"> |
| 31 | + <input type="hidden" name="op" value="update"> |
| 32 | + <input type="hidden" name="backto" value="record-edit"> |
| 33 | + <input type="hidden" name="id_record" value="<?php echo $id_record; ?>"> |
| 34 | + |
| 35 | + <div class="row"> |
| 36 | + <div class="col-md-5"> |
| 37 | + {[ "type": "text", "label": "<?php echo tr('Descrizione'); ?>", "name": "descrizione", "required": 1, "value": "$title$", "extra": "<?php echo $attr; ?>" ]} |
| 38 | + </div> |
| 39 | + |
| 40 | + <div class="col-md-4"> |
| 41 | + {[ "type": "text", "label": "<?php echo tr('Icona'); ?>", "name": "icona", "required": 1, "class": "text-center", "value": "$icona$", "extra": "", "icon-after": "<?php echo (!empty($record['icona'])) ? '<i class=\"'.$record['icona'].'\"></i>' : ''; ?>" ]} |
| 42 | + </div> |
| 43 | + |
| 44 | + <div class="col-md-3"> |
| 45 | + {[ "type": "text", "label": "<?php echo tr('Colore'); ?>", "name": "colore", "required": 1, "class": "colorpicker text-center", "value": "$colore$", "extra": "maxlength='7'", "icon-after": "<div class='img-circle square'></div>" ]} |
| 46 | + </div> |
| 47 | + </div> |
| 48 | +</form> |
| 49 | + |
| 50 | +<?php |
| 51 | +$impianti = $dbo->fetchNum('SELECT id FROM my_impianti WHERE id_stato='.prepare($id_record)); |
| 52 | + |
| 53 | +if (!empty($impianti)) { |
| 54 | + echo ' |
| 55 | +<div class="alert alert-danger"> |
| 56 | + '.tr('Ci sono _NUM_ impianti collegati', [ |
| 57 | + '_NUM_' => $impianti, |
| 58 | + ]).'. |
| 59 | +</div>'; |
| 60 | +} |
| 61 | + |
| 62 | +if (!empty($record['can_delete'])) { |
| 63 | + echo ' |
| 64 | +<a class="btn btn-danger ask" data-backto="record-list"> |
| 65 | + <i class="fa fa-trash"></i>'.tr('Elimina').' |
| 66 | +</a>'; |
| 67 | +} |
| 68 | + |
| 69 | +?> |
| 70 | + |
| 71 | +<script> |
| 72 | + $(document).ready(function() { |
| 73 | + $('.colorpicker').colorpicker({ format: 'hex' }).on('changeColor', function() { |
| 74 | + $(this).parent().find('.square').css('background', $(this).val()); |
| 75 | + }); |
| 76 | + $('.colorpicker').parent().find('.square').css('background', $('.colorpicker').val()); |
| 77 | + }); |
| 78 | +</script> |
0 commit comments