1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2024-12-25 06:55:05 +01:00
openstamanager/plugins/varianti_articolo/edit.php
2024-02-29 15:10:55 +01:00

74 lines
1.9 KiB
PHP

<?php
use Modules\Articoli\Articolo;
include_once __DIR__.'/../../core.php';
$articolo_originale = Articolo::find($id_record);
$combinazione = $articolo_originale->combinazione;
if (empty($combinazione)) {
echo '
<script>
$(document).ready(function (){
$("#link-tab_'.$id_plugin.'").addClass("disabled");
})
</script>';
return;
}
echo '
<button type="button" class="btn btn-warning pull-right" onclick="visualizzaCombinazione(this)">
<i class="fa fa-external-link"></i> '.tr('Visualizza combinazione').'
</button>
<div class="clearfix"></div>
<br>
<div class="box box-primary">
<div class="box-header">
<h3 class="box-title">'.tr('Varianti disponibili (Articoli)').'</h3>
</div>
<div class="box-body">
<table class="table table-hover table-striped">
<thead>
<tr>
<th width="10%">'.tr('Foto').'</th>
<th>'.tr('Variante').'</th>
<th>'.tr('Articolo').'</th>
</tr>
</thead>
<tbody>';
$articoli = $combinazione->articoli;
foreach ($articoli as $articolo) {
echo '
<tr data-id="'.$articolo->id.'">
<td><img class="img-thumbnail img-responsive" src="'.$articolo->image.'"></td>
<td>'.$articolo->nome_variante.'</td>
<td>
'.Modules::link('Articoli', $articolo->id, $articolo->codice.' - '.$articolo->name).'
'.($articolo->id == $articolo_originale->id ? '<span class="badge pull-right">'.tr('Articolo corrente').'</span>' : '').'
</td>
</tr>';
}
echo '
</tbody>
</table>
</div>
</div>
<script>
function visualizzaCombinazione(button) {
// Redirect
redirect(globals.rootdir + "/editor.php", {
id_module: "'.$combinazione->getModule()->id.'",
id_record: "'.$combinazione->id.'",
});
}
</script>';