2017-08-04 16:28:16 +02:00
|
|
|
<?php
|
2020-09-07 15:04:06 +02:00
|
|
|
/*
|
|
|
|
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
|
2021-01-20 15:08:51 +01:00
|
|
|
* Copyright (C) DevCode s.r.l.
|
2020-09-07 15:04:06 +02:00
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2017-08-04 16:28:16 +02:00
|
|
|
|
|
|
|
include_once __DIR__.'/../../core.php';
|
2024-03-07 16:04:52 +01:00
|
|
|
use Modules\Articoli\Articolo;
|
2024-03-22 15:52:24 +01:00
|
|
|
use Modules\Articoli\Categoria;
|
2017-08-04 16:28:16 +02:00
|
|
|
|
2024-03-07 16:04:52 +01:00
|
|
|
$subcategorie = Categoria::where('parent', '=', $id_record)->get();
|
2017-08-04 16:28:16 +02:00
|
|
|
|
|
|
|
foreach ($subcategorie as $sub) {
|
2024-03-07 16:04:52 +01:00
|
|
|
$n_articoli = Articolo::where('id_sottocategoria', '=', $sub['id'])->count();
|
|
|
|
|
2017-08-04 16:28:16 +02:00
|
|
|
echo '
|
2024-03-07 16:04:52 +01:00
|
|
|
<tr>
|
2024-04-18 17:44:05 +02:00
|
|
|
<td>'.$sub->getTranslation('title').'</td>
|
2024-03-07 16:04:52 +01:00
|
|
|
<td>'.$sub->colore.'</td>
|
2024-10-03 09:40:25 +02:00
|
|
|
<td>'.$sub->getTranslation('note').'</td>
|
2024-03-07 16:04:52 +01:00
|
|
|
<td>
|
|
|
|
<a class="btn btn-warning btn-sm" title="Modifica riga" onclick="launch_modal(\''.tr('Modifica sottocategoria').'\', \''.base_path().'/add.php?id_module='.$id_module.'&id_record='.$sub->id.'&id_original='.$id_record.'\');"><i class="fa fa-edit"></i></a>
|
|
|
|
<a class="btn btn-sm btn-danger ask '.(($n_articoli > 0) ? 'disabled tip' : '').'" data-backto="record-edit" data-id="'.$sub['id'].'" title="'.(($n_articoli > 0) ? 'Sottocategoria collegata a '.$n_articoli.' articoli' : '').'">
|
|
|
|
<i class="fa fa-trash"></i>
|
|
|
|
</a>
|
|
|
|
</td>
|
|
|
|
</tr>';
|
2017-08-04 16:28:16 +02:00
|
|
|
}
|