gest366/modules/stati_intervento/edit.php

111 lines
3.4 KiB
PHP
Raw Normal View History

2021-02-24 20:40:04 +00:00
<?php
include_once(__DIR__."/../../core.php");
//Se lo stato intervento è uno di quelli di default, non lo lascio modificare
if( $records[0]['default'] ){
$attr = "readonly='true'";
$warning_text = "<div class='alert alert-warning'>Puoi modificare solo il colore di questo intervento!</div>";
}
else{
$attr = "";
$warning_text = "";
}
?>
<script src="<?php echo $js ?>/bootstrap-colorpicker.min.js"></script>
<link rel="stylesheet" href="<?php echo $css ?>/bootstrap-colorpicker.min.css">
<?php echo $warning_text ?>
<form action="" method="post">
<input type="hidden" name="op" value="update">
<input type="hidden" name="backto" value="record-edit">
<input type="hidden" name="id_record" value="<?php echo $id_record ?>">
<div class="panel panel-<?php echo $_SESSION['profilo_pannello'] ?>">
<div class="clearfix"></div>
</br>
<div class="col-md-4">
<div class="pull-left">
<button type="submit" class="btn-app btn-success"><i class="fa fa-check"></i> Salva </button>
</div>
</div>
<?php
//Se lo stato intervento è uno di quelli di default, non lo lascio modificare
if( !$records[0]['default'] ){
?>
<div class="col-md-4">
<div class="pull-right">
<div class="pull-left showcase sweet">
<button type="button" class="btn-app btn-danger" aria-label="Show SweetAlert2 success message" ><i class="fa fa-trash-o"></i> Elimina</span></button>
</div>
</div>
</div>
<?php
}
?>
<div class="col-md-4">
</div>
<div class="clearfix"></div>
</div>
<div class="clearfix"></div>
<div class="panel panel-<?php echo $_SESSION['profilo_pannello'] ?>">
<div class="panel-heading">
<h3 class="panel-title"><?php echo _("Dati") ?></h3>
</div>
<div class="panel-body">
<div class="row">
<div class="col-md-2">
{[ "type": "span", "label": "<?php echo _("Codice"); ?>", "name": "idstatointervento", "required": 0, "class": "", "value": "$idstatointervento$", "extra": "" ]}
</div>
<div class="col-md-6">
{[ "type": "text", "label": "<?php echo _("Descrizione"); ?>", "name": "descrizione", "required": 1, "class": "", "value": "$descrizione$", "extra": "<?php echo $attr ?>" ]}
</div>
<div class="col-md-2">
{[ "type": "text", "label": "<?php echo _("Colore"); ?>", "name": "colore", "required": 1, "class": "colorpicker text-center", "value": "$colore$", "extra": "maxlength='7'", "icon-after": "<div class='img-circle square'></div>" ]}
</div>
</div>
</div>
</div>
</form>
<form action="" method="post" role="form" id="form-delete">
<input type="hidden" name="backto" value="record-list">
<input type="hidden" name="op" value="delete">
</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() );
});
$('.showcase.sweet button').on('click', () => {
swal({
title: 'Sei sicuro?',
text: "Eliminare questo elemento!",
type: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Conferma!'
}).then((result) => {
if (result.value) {
{ $('#form-delete').submit(); }
}
})
})
</script>