2021-08-31 15:46:14 +02:00
|
|
|
<?php
|
2024-02-29 17:42:08 +01:00
|
|
|
/*
|
|
|
|
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
|
|
|
|
* Copyright (C) DevCode s.r.l.
|
|
|
|
*
|
|
|
|
* 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/>.
|
|
|
|
*/
|
|
|
|
|
2021-08-31 15:46:14 +02:00
|
|
|
include_once __DIR__.'/../../core.php';
|
|
|
|
|
|
|
|
echo '
|
|
|
|
<form action="" method="post" id="edit-form" enctype="multipart/form-data">
|
|
|
|
<input type="hidden" name="backto" value="record-edit">
|
|
|
|
<input type="hidden" name="op" value="update">
|
|
|
|
|
2024-05-16 18:02:50 +02:00
|
|
|
<div class="card card-primary">
|
|
|
|
<div class="card-header">
|
|
|
|
<h3 class="card-title">'.tr('Dati').'</h3>
|
2021-08-31 15:46:14 +02:00
|
|
|
</div>
|
|
|
|
|
2024-05-16 18:02:50 +02:00
|
|
|
<div class="card-body">
|
2021-08-31 15:46:14 +02:00
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-6">
|
2024-03-20 11:13:28 +01:00
|
|
|
{[ "type": "text", "label": "'.tr('Titolo').'", "name": "titolo", "value": "'.$attributo->getTranslation('title').'", "required": 1, "help": "'.tr("Nome visibile dell'attributo").'" ]}
|
2021-08-31 15:46:14 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
|
2024-05-16 18:02:50 +02:00
|
|
|
<div class="card card-primary">
|
|
|
|
<div class="card-header">
|
|
|
|
<h3 class="card-title">'.tr('Valori attributo').'</h3>
|
2021-08-31 15:46:14 +02:00
|
|
|
</div>
|
|
|
|
|
2024-05-16 18:02:50 +02:00
|
|
|
<div class="card-body">
|
2021-08-31 15:46:14 +02:00
|
|
|
<button type="button" class="btn btn-primary pull-right" onclick="aggiungiValore(this)">
|
|
|
|
<i class="fa fa-plus"></i> '.tr('Aggiungi valore').'
|
|
|
|
</button>
|
|
|
|
|
|
|
|
<table class="table table-hover table-striped">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>'.tr('Valore').'</th>
|
2021-09-01 10:52:22 +02:00
|
|
|
<th width="10%" class="text-center">#</th>
|
2021-08-31 15:46:14 +02:00
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
|
|
|
|
<tbody>';
|
|
|
|
|
|
|
|
$valori = $attributo->valori;
|
|
|
|
foreach ($valori as $valore) {
|
|
|
|
echo '
|
|
|
|
<tr data-id="'.$valore->id.'">
|
|
|
|
<td>'.$valore->nome.'</td>
|
|
|
|
<td class="text-center">
|
|
|
|
<button type="button" class="btn btn-warning btn-xs" onclick="modificaValore(this)">
|
|
|
|
<i class="fa fa-edit"></i>
|
|
|
|
</button>
|
|
|
|
|
|
|
|
<button type="button" class="btn btn-danger btn-xs" onclick="rimuoviValore(this)">
|
|
|
|
<i class="fa fa-trash-o"></i>
|
|
|
|
</button>
|
|
|
|
</td>
|
|
|
|
</tr>';
|
|
|
|
}
|
|
|
|
|
|
|
|
echo '
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<a class="btn btn-danger ask" data-backto="record-list">
|
|
|
|
<i class="fa fa-trash"></i> '.tr('Elimina').'
|
|
|
|
</a>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
function aggiungiValore(button) {
|
|
|
|
let riga = $(button).closest("tr");
|
|
|
|
|
|
|
|
// Apertura modal
|
|
|
|
openModal("'.tr('Aggiungi valore').'", "'.$module->fileurl('gestione-valore.php').'?id_module=" + globals.id_module + "&id_record=" + globals.id_record);
|
|
|
|
}
|
|
|
|
|
|
|
|
function modificaValore(button) {
|
|
|
|
let riga = $(button).closest("tr");
|
|
|
|
let id = riga.data("id");
|
|
|
|
|
|
|
|
// Apertura modal
|
|
|
|
openModal("'.tr('Modifica valore').'", "'.$module->fileurl('gestione-valore.php').'?id_module=" + globals.id_module + "&id_record=" + globals.id_record + "&id_valore=" + id);
|
|
|
|
}
|
|
|
|
|
|
|
|
function rimuoviValore(button) {
|
|
|
|
let riga = $(button).closest("tr");
|
|
|
|
let id = riga.data("id");
|
|
|
|
|
|
|
|
// Redirect
|
|
|
|
redirect(globals.rootdir + "/editor.php", {
|
|
|
|
id_module: globals.id_module,
|
|
|
|
id_record: globals.id_record,
|
|
|
|
id_valore: id,
|
|
|
|
op: "rimuovi-valore",
|
|
|
|
backto: "record-edit",
|
|
|
|
});
|
|
|
|
}
|
|
|
|
</script>';
|