openstamanager/plugins/revisioni/edit.php

69 lines
3.5 KiB
PHP
Raw Normal View History

2019-03-08 15:18:52 +01:00
<?php
2018-10-17 18:28:15 +02:00
include_once __DIR__.'/../../../core.php';
2018-10-25 16:57:39 +02:00
echo "<form action='".$rootdir.'/editor.php?id_module='.$id_module.'&id_record='.$id_record."' method='post'>";
2018-10-17 18:28:15 +02:00
echo " <input type='hidden' name='backto' value='record-edit'>";
echo " <input type='hidden' name='op' value='edit_revision'>";
echo " <input type='hidden' name='id_plugin' value='".$id_plugin."'>";
echo " <input type='hidden' name='id_record' value='".$id_record."'>";
2018-10-25 16:57:39 +02:00
$rs_master_revision = $dbo->fetchArray('SELECT master_revision FROM co_preventivi WHERE id='.prepare($id_record));
2018-10-17 18:28:15 +02:00
echo " <input type='hidden' name='master_revision' value='".$rs_master_revision[0]['master_revision']."'>";
2018-10-25 16:57:39 +02:00
$rs_revisioni = $dbo->fetchArray('SELECT * FROM co_preventivi WHERE master_revision='.prepare($rs_master_revision[0]['master_revision']).' OR id='.prepare($rs_master_revision[0]['master_revision']).' ORDER BY created_at');
2018-10-17 18:28:15 +02:00
echo " <div class='row'>";
echo " <div class='col-md-12'>";
echo " <div class='alert alert-info'><i class='fa fa-info-circle'></i> Seleziona la spunta e clicca salva per cambiare la revisione del preventivo</div>";
echo " <table class='table table-condensed table-bordered'>";
echo " <tr>
<th style='width:50px;' class='text-center'>#</th>
<th>Descrizione</th>
<th style='width:50px;'></th>
</tr>";
2018-10-25 16:57:39 +02:00
for ($i = 0; $i < sizeof($rs_revisioni); ++$i) {
if ($rs_revisioni[$i]['master_revision'] == $rs_revisioni[$i]['id'] || $rs_revisioni[$i]['default_revision'] == 1) {
$disabled = 'disabled';
} else {
$disabled = '';
}
if ($rs_revisioni[$i]['default_revision']) {
$cheched = 'checked';
} else {
$cheched = '';
}
2018-10-17 18:28:15 +02:00
echo " <tr>
<td class='text-center'>
2018-10-25 16:57:39 +02:00
<input type='radio' class='revision_changer' name='idrevisione' value='".$rs_revisioni[$i]['id']."' ".$cheched.'>
2018-10-17 18:28:15 +02:00
</td>
<td>
2018-10-25 16:57:39 +02:00
Revisione '.($i + 1).' creata il '.Translator::dateToLocale($rs_revisioni[$i]['created_at']).' alle '.date('H:i', strtotime($rs_revisioni[$i]['created_at']))."
2018-10-17 18:28:15 +02:00
</td>
2018-10-25 16:57:39 +02:00
<td class='text-center'>"; ?>
<button type='button' class='btn btn-danger <?php echo $disabled; ?>' onclick='if(confirm("Vuoi cancellare questa revisione?")){$("#idrevisione").val("<?php echo $rs_revisioni[$i]['id']; ?>");$("#form_deleterevision").submit();}' <?php echo $disabled; ?>><i class='fa fa-trash'></i></button>
2018-10-17 18:28:15 +02:00
<?php
2018-10-25 16:57:39 +02:00
echo '
2018-10-17 18:28:15 +02:00
</td>
2018-10-25 16:57:39 +02:00
</tr>';
2018-10-17 18:28:15 +02:00
}
2018-10-25 16:57:39 +02:00
echo ' </table>';
2018-10-17 18:28:15 +02:00
2018-10-25 16:57:39 +02:00
echo ' </div>';
echo ' </div>';
2018-10-17 18:28:15 +02:00
echo " <div class='row'>";
echo " <div class='col-md-12 text-center'>";
2018-12-28 08:07:56 +01:00
echo ' <button '.((sizeof($rs_revisioni) < 2) ? 'disabled' : '')." type='submit' class='btn btn-primary' ><i class='fa fa-refresh'></i> ".tr('Cambia revisione').'</button>';
echo ' </div>';
echo ' </div>';
echo '</form>';
2018-10-17 18:28:15 +02:00
2018-10-25 16:57:39 +02:00
echo "<form action='".$rootdir.'/editor.php?id_module='.$id_module.'&id_record='.$id_record."' method='post' id='form_deleterevision'>";
2018-10-17 18:28:15 +02:00
echo " <input type='hidden' name='backto' value='record-edit'>";
echo " <input type='hidden' name='op' value='delete_revision'>";
echo " <input type='hidden' name='id_plugin' value='".$id_plugin."'>";
echo " <input type='hidden' name='id_record' value='".$id_record."'>";
echo " <input type='hidden' name='idrevisione' id='idrevisione' value=''>";
2018-10-25 16:57:39 +02:00
echo '</form>';
2018-10-17 18:28:15 +02:00
?>