openstamanager/modules/categorie_impianti/edit.php

61 lines
1.7 KiB
PHP
Executable File

<?php
include_once __DIR__.'/../../core.php';
?><form action="" method="post" id="edit-form">
<input type="hidden" name="backto" value="record-edit">
<input type="hidden" name="op" value="update">
<!-- DATI -->
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title"><?php echo tr('Dati'); ?></h3>
</div>
<div class="panel-body">
<div class="row">
<div class="col-md-8">
{[ "type": "text", "label": "<?php echo tr('Nome'); ?>", "name": "nome", "required": 1, "value": "$nome$" ]}
</div>
<div class="col-md-4">
{[ "type": "text", "label": "<?php echo tr('Colore'); ?>", "name": "colore", "class": "colorpicker text-center", "value": "$colore$", "extra": "maxlength='7'", "icon-after": "<div class='img-circle square'></div>" ]}
</div>
</div>
<div class="row">
<div class="col-md-12">
{[ "type": "textarea", "label": "<?php echo tr('Nota'); ?>", "name": "nota", "value": "$nota$" ]}
</div>
</div>
</div>
</div>
</form>
<script>
$(document).ready( function() {
$('.colorpicker').colorpicker().on('changeColor', function() {
$('#colore').parent().find('.square').css( 'background', $('#colore').val() );
});
$('#colore').parent().find('.square').css( 'background', $('#colore').val() );
});
</script>
<?php
$res = $dbo->fetchNum('SELECT * FROM `my_impianti` WHERE `id_categoria`='.prepare($id_record));
if ($res) {
echo '
<div class="alert alert-danger">
<p>'.tr('Ci sono '.count($res).' impianti collegati a questa categoria. Non è possibile eliminarla.').'</p>
</div>';
} else {
echo '
<a class="btn btn-danger ask" data-backto="record-list">
<i class="fa fa-trash"></i> '.tr('Elimina').'
</a>';
}