|
| 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 | +use Modules\Impianti\Impianto; |
| 22 | + |
| 23 | +// Controllo che l'impianto sia disponibile |
| 24 | +if (empty($record)) { |
| 25 | + return; |
| 26 | +} |
| 27 | + |
| 28 | +// Carico l'impianto con Eloquent per avere accesso alle relazioni |
| 29 | +$impianto = Impianto::find($id_record); |
| 30 | +if (empty($impianto)) { |
| 31 | + return; |
| 32 | +} |
| 33 | + |
| 34 | +// Anagrafica cliente |
| 35 | +$anagrafica = $impianto->anagrafica; |
| 36 | +if (empty($anagrafica)) { |
| 37 | + return; |
| 38 | +} |
| 39 | + |
| 40 | +// Sede |
| 41 | +$sede = null; |
| 42 | +if (!empty($record['idsede'])) { |
| 43 | + $sede = $dbo->fetchOne('SELECT * FROM an_sedi WHERE id = '.prepare($record['idsede'])); |
| 44 | +} else { |
| 45 | + $sede = $anagrafica ? $anagrafica->toArray() : null; |
| 46 | +} |
| 47 | + |
| 48 | +// Categoria e sottocategoria |
| 49 | +$categoria = null; |
| 50 | +$sottocategoria = null; |
| 51 | +if (!empty($record['id_categoria'])) { |
| 52 | + $categoria = $dbo->fetchOne('SELECT zz_categorie.*, zz_categorie_lang.title FROM zz_categorie LEFT JOIN zz_categorie_lang ON (zz_categorie.id = zz_categorie_lang.id_record AND zz_categorie_lang.id_lang = '.prepare(Models\Locale::getDefault()->id).') WHERE zz_categorie.id = '.prepare($record['id_categoria'])); |
| 53 | +} |
| 54 | +if (!empty($record['id_sottocategoria'])) { |
| 55 | + $sottocategoria = $dbo->fetchOne('SELECT zz_categorie.*, zz_categorie_lang.title FROM zz_categorie LEFT JOIN zz_categorie_lang ON (zz_categorie.id = zz_categorie_lang.id_record AND zz_categorie_lang.id_lang = '.prepare(Models\Locale::getDefault()->id).') WHERE zz_categorie.id = '.prepare($record['id_sottocategoria'])); |
| 56 | +} |
| 57 | + |
| 58 | +// Marca e modello |
| 59 | +$marca = null; |
| 60 | +$modello = null; |
| 61 | +if (!empty($record['id_marca'])) { |
| 62 | + $marca = $dbo->fetchOne('SELECT * FROM zz_marche WHERE id = '.prepare($record['id_marca']).' AND deleted_at IS NULL'); |
| 63 | +} |
| 64 | +if (!empty($record['id_modello'])) { |
| 65 | + $modello = $dbo->fetchOne('SELECT * FROM zz_marche WHERE id = '.prepare($record['id_modello']).' AND deleted_at IS NULL'); |
| 66 | +} |
| 67 | + |
| 68 | +echo ' |
| 69 | +<div class="row mb-4"> |
| 70 | + <div class="col-md-12"> |
| 71 | + <div class="card card-outline card-primary shadow"> |
| 72 | + <div class="card-header"> |
| 73 | + <h3 class="card-title"><i class="fa fa-cogs"></i> <span style="color: #000;">'.tr('Informazioni Impianto').'</span></h3> |
| 74 | + </div> |
| 75 | + <div class="card-body"> |
| 76 | + <div class="row"> |
| 77 | + <div class="col-md-12"> |
| 78 | + <div class="row"> |
| 79 | + <div class="col-md-6"> |
| 80 | + <h4 class="mb-2"><b><i class="fa fa-cog text-primary mr-1"></i> '.$record['nome'].'</b></h4> |
| 81 | +
|
| 82 | + <p class="mb-2"> |
| 83 | + <span class="badge badge-secondary"><i class="fa fa-barcode mr-1"></i> '.$record['matricola'].'</span> |
| 84 | + '.(!empty($categoria['title']) ? '<span class="badge badge-info ml-1"><i class="fa fa-tag mr-1"></i> '.$categoria['title'].'</span>' : '').' |
| 85 | + '.(!empty($sottocategoria['title']) ? '<span class="badge badge-light ml-1">'.$sottocategoria['title'].'</span>' : '').' |
| 86 | + </p> |
| 87 | +
|
| 88 | + '.(!empty($record['descrizione']) ? '<p class="text-muted mb-2"><i class="fa fa-info-circle mr-1"></i> '.$record['descrizione'].'</p>' : '').' |
| 89 | +
|
| 90 | + <!-- Marca e Modello a sinistra -->'; |
| 91 | + |
| 92 | +// Informazioni tecniche |
| 93 | +if (!empty($marca['name']) || !empty($modello['name'])) { |
| 94 | + echo '<div class="mb-3">'; |
| 95 | + if (!empty($marca['name'])) { |
| 96 | + echo '<h5 class="mb-1"><strong>'.tr('Marca').':</strong> '.$marca['name'].'</h5>'; |
| 97 | + } |
| 98 | + if (!empty($modello['name'])) { |
| 99 | + echo '<h5 class="mb-1"><strong>'.tr('Modello').':</strong> '.$modello['name'].'</h5>'; |
| 100 | + } |
| 101 | + echo '</div>'; |
| 102 | +} |
| 103 | + |
| 104 | +echo ' |
| 105 | + </div> |
| 106 | +
|
| 107 | + <div class="col-md-6">'; |
| 108 | + |
| 109 | +// Data installazione - spostata sopra |
| 110 | +if (!empty($record['data'])) { |
| 111 | + echo '<div class="mb-3"><i class="fa fa-calendar text-muted mr-1"></i> <strong>'.tr('Installato il').':</strong> '.Translator::dateToLocale($record['data']).'</div>'; |
| 112 | +} |
| 113 | + |
| 114 | +echo ' |
| 115 | + <!-- Cliente a destra --> |
| 116 | + <div class="mb-3"> |
| 117 | + <h5 class="mb-2"> |
| 118 | + <i class="fa fa-user text-primary mr-1"></i> |
| 119 | + <strong>'.$anagrafica->ragione_sociale.'</strong> |
| 120 | + </h5> |
| 121 | + </div> |
| 122 | +
|
| 123 | + <div class="mt-2">'; |
| 124 | + |
| 125 | +// Contatti sede/cliente |
| 126 | +if (!empty($sede['telefono']) || !empty($sede['email']) || !empty($anagrafica->telefono) || !empty($anagrafica->email)) { |
| 127 | + echo '<div class="mt-3">'; |
| 128 | + if (!empty($sede['telefono'])) { |
| 129 | + echo '<a class="btn btn-light btn-xs mr-1 mb-1" href="tel:'.$sede['telefono'].'" target="_blank"><i class="fa fa-phone text-primary"></i> '.$sede['telefono'].'</a>'; |
| 130 | + } elseif (!empty($anagrafica->telefono)) { |
| 131 | + echo '<a class="btn btn-light btn-xs mr-1 mb-1" href="tel:'.$anagrafica->telefono.'" target="_blank"><i class="fa fa-phone text-primary"></i> '.$anagrafica->telefono.'</a>'; |
| 132 | + } |
| 133 | + |
| 134 | + if (!empty($sede['email'])) { |
| 135 | + echo '<a class="btn btn-light btn-xs mr-1 mb-1" href="mailto:'.$sede['email'].'"><i class="fa fa-envelope text-primary"></i> '.$sede['email'].'</a>'; |
| 136 | + } elseif (!empty($anagrafica->email)) { |
| 137 | + echo '<a class="btn btn-light btn-xs mr-1 mb-1" href="mailto:'.$anagrafica->email.'"><i class="fa fa-envelope text-primary"></i> '.$anagrafica->email.'</a>'; |
| 138 | + } |
| 139 | + echo '</div>'; |
| 140 | +} |
| 141 | + |
| 142 | +echo ' |
| 143 | + </div> |
| 144 | + </div> |
| 145 | + </div> |
| 146 | + </div> |
| 147 | + </div> |
| 148 | + </div> |
| 149 | + </div> |
| 150 | + </div> |
| 151 | +</div>'; |
0 commit comments