Aggiunta possibilità di specificare colore e note anche in fase di aggiunta delle categorie articoli

This commit is contained in:
Luca 2018-07-04 11:01:09 +02:00
parent d99cbd3846
commit b5a955fd65
3 changed files with 17 additions and 21 deletions

View File

@ -19,9 +19,11 @@ switch (filter('op')) {
case 'add':
$nome = filter('nome');
$nota = filter('nota');
$colore = filter('colore');
if (isset($nome)) {
$dbo->query('INSERT INTO `mg_categorie` (`nome`) VALUES ('.prepare($nome).')');
$dbo->query('INSERT INTO `mg_categorie` (`nome`, `colore`, `nota`) VALUES ('.prepare($nome).', '.prepare($colore).', '.prepare($nota).')');
$id_record = $dbo->lastInsertedID();

View File

@ -19,17 +19,14 @@ if (isset($id_record)) {
if (!isset($id_original)) {
?>
<input type="hidden" name="op" value="add">
<div class="row">
<div class="col-md-12">
{[ "type": "text", "label": "<?php echo tr('Nome'); ?>", "name": "nome", "required": 1 ]}
</div>
</div>
<?php
} else {
?>
<input type="hidden" name="op" value="row">
<input type="hidden" name="id_original" value="<?php echo $id_original; ?>">
<?php
}
?>
<div class="row">
<div class="col-md-8">
@ -47,19 +44,6 @@ if (!isset($id_original)) {
</div>
</div>
<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
}
?>
<!-- PULSANTI -->
<div class="row">
<div class="col-md-12 text-right">
@ -77,3 +61,13 @@ if (isset($id_record)) {
</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>

View File

@ -79,7 +79,7 @@ $res = $dbo->fetchNum('SELECT * FROM `mg_articoli` WHERE `id_categoria`='.prepar
if ($res) {
echo '
<div class="alert alert-danger">
<p>'.tr('Esistono ancora alcuni articoli sotto questa categoria!').'</p>
<p>'.tr('Ci sono '.count($res).' articoli collegati questa categoria. Non è possibile eliminarla.').'</p>
</div>';
} else {
echo '