feat: aggiunta modello in articoli #1180

This commit is contained in:
valentina 2024-11-06 09:45:50 +01:00
parent c147b44e16
commit 6ae460cf4e
4 changed files with 27 additions and 11 deletions

View File

@ -150,6 +150,7 @@ switch (post('op')) {
$articolo->volume = post('volume'); $articolo->volume = post('volume');
$articolo->peso_lordo = post('peso_lordo'); $articolo->peso_lordo = post('peso_lordo');
$articolo->id_marchio = post('id_marchio'); $articolo->id_marchio = post('id_marchio');
$articolo->modello = post('modello');
$articolo->um_secondaria = post('um_secondaria'); $articolo->um_secondaria = post('um_secondaria');
$articolo->fattore_um_secondaria = post('fattore_um_secondaria'); $articolo->fattore_um_secondaria = post('fattore_um_secondaria');

View File

@ -62,20 +62,23 @@ use Modules\Iva\Aliquota;
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-4"> <div class="col-md-3">
<?php echo (!empty($record['id_categoria'])) ? <?php echo (!empty($record['id_categoria'])) ?
Modules::link('Categorie articoli', $record['id_categoria'], null, null, 'class="pull-right"') : ''; ?> Modules::link('Categorie articoli', $record['id_categoria'], null, null, 'class="pull-right"') : ''; ?>
{[ "type": "select", "label": "<?php echo tr('Categoria'); ?>", "name": "categoria", "required": 0, "value": "$id_categoria$", "ajax-source": "categorie", "icon-after": "add|<?php echo Module::where('name', 'Categorie articoli')->first()->id; ?>" ]} {[ "type": "select", "label": "<?php echo tr('Categoria'); ?>", "name": "categoria", "required": 0, "value": "$id_categoria$", "ajax-source": "categorie", "icon-after": "add|<?php echo Module::where('name', 'Categorie articoli')->first()->id; ?>" ]}
</div> </div>
<div class="col-md-4"> <div class="col-md-3">
{[ "type": "select", "label": "<?php echo tr('Sottocategoria'); ?>", "name": "subcategoria", "value": "$id_sottocategoria$", "ajax-source": "sottocategorie", "select-options": <?php echo json_encode(['id_categoria' => $record['id_categoria']]); ?>, "icon-after": "add|<?php echo Module::where('name', 'Categorie articoli')->first()->id; ?>|id_original=<?php echo $record['id_categoria']; ?>" ]} {[ "type": "select", "label": "<?php echo tr('Sottocategoria'); ?>", "name": "subcategoria", "value": "$id_sottocategoria$", "ajax-source": "sottocategorie", "select-options": <?php echo json_encode(['id_categoria' => $record['id_categoria']]); ?>, "icon-after": "add|<?php echo Module::where('name', 'Categorie articoli')->first()->id; ?>|id_original=<?php echo $record['id_categoria']; ?>" ]}
</div> </div>
<div class="col-md-4"> <div class="col-md-3">
<?php echo !empty($record['id_marchio']) ? Modules::link('Marchi', $record['id_marchio'], null, null, 'class="pull-right"') : ''; ?> <?php echo !empty($record['id_marchio']) ? Modules::link('Marchi', $record['id_marchio'], null, null, 'class="pull-right"') : ''; ?>
{[ "type": "select", "label": "<?php echo tr('Marchio'); ?>", "name": "id_marchio", "value":"$id_marchio$", "values": "query=SELECT id, name AS descrizione FROM mg_marchi ORDER BY descrizione ASC" ]} {[ "type": "select", "label": "<?php echo tr('Marchio'); ?>", "name": "id_marchio", "value":"$id_marchio$", "values": "query=SELECT id, name AS descrizione FROM mg_marchi ORDER BY descrizione ASC" ]}
</div> </div>
<div class="col-md-3">
{[ "type": "text", "label": "<?php echo tr('Modello'); ?>", "name": "modello", "value": "$modello$" ]}
</div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">

View File

@ -36,15 +36,24 @@ echo '
</div> </div>
<div class="col-md-9">'; <div class="col-md-9">';
// Articolo
// Articolo if ($articolo->marchio || $articolo->modello) {
echo ' echo'
'.($articolo->id_marchio ? '<p class="float-right"><i class="fa fa-tag"></i> '.($articolo->marchio->name? '<a href="'.$articolo->marchio->link.'" target="_blank" rel="noopener noreferrer"> '.$articolo->marchio->name.'</a>' : $articolo->marchio->name).'</p>' : ''). <p class="float-right"><i class="fa fa-tag"></i>
($articolo->id_categoria ? '<p class="text-muted"> '.$articolo->categoria->getTranslation('title') : '').($articolo->id_sottocategoria ? ' <small><i class="fa fa-chevron-right"></i></small> '.$articolo->sottocategoria->getTranslation('title') : '').'</p> '.($articolo->marchio ? ($articolo->marchio->link ? '<a href="'.$articolo->marchio->link.'" target="_blank" rel="noopener noreferrer"> '.$articolo->marchio->name.'</a>' : $articolo->marchio->name.' ') : '').
<h4><b>'.$articolo->getTranslation('title').'</b> '.($articolo->attivo ? '<i class="fa fa-check text-success"></i>' : '<i class="fa fa-times text-danger"></i> ').'</h4> ($articolo->modello ? ' <small><i class="fa fa-chevron-right"></i></small> '.$articolo->modello.' ' : '')
.'</p>';
}
if ($articolo->id_categoria) {
echo'
<p class="text-muted">'.$articolo->categoria->getTranslation('title').
($articolo->sottocategoria ? ' <small><i class="fa fa-chevron-right"></i></small> '.$articolo->sottocategoria->getTranslation('title') : '').
'</p>';
}
echo'
<p><h4><b>'.$articolo->getTranslation('title').'</b> '.($articolo->attivo ? '<i class="fa fa-check text-success"></i>' : '<i class="fa fa-times text-danger"></i> ').'</h4></p>
<p><b>'.$articolo->codice.'</b> '.($articolo->barcode ? ' - <i class="fa fa-barcode"></i> '.$articolo->barcode.'</p>' : '').'</p> <p><b>'.$articolo->codice.'</b> '.($articolo->barcode ? ' - <i class="fa fa-barcode"></i> '.$articolo->barcode.'</p>' : '').'</p>
'.($articolo->note ? '<p class="text-danger"><i class="fa fa-pencil-square-o"></i> '.$articolo->note.'</p>' : '').' '.($articolo->note ? '<p class="text-danger"><i class="fa fa-pencil-square-o"></i> '.$articolo->note.'</p>' : '').'
</div> </div>
</div> </div>
</div> </div>

View File

@ -91,3 +91,6 @@ UPDATE `zz_views` SET `name` = 'emailto_Email' WHERE `zz_views`.`name` = 'Email'
UPDATE `zz_views_lang` SET `title` = 'tel_Telefono' WHERE `zz_views_lang`.`id_record` = (SELECT `id` FROM `zz_views` WHERE `name` = 'tel_Telefono'); UPDATE `zz_views_lang` SET `title` = 'tel_Telefono' WHERE `zz_views_lang`.`id_record` = (SELECT `id` FROM `zz_views` WHERE `name` = 'tel_Telefono');
UPDATE `zz_views_lang` SET `title` = 'tel_Cellulare' WHERE `zz_views_lang`.`id_record` = (SELECT `id` FROM `zz_views` WHERE `name` = 'tel_Cellulare'); UPDATE `zz_views_lang` SET `title` = 'tel_Cellulare' WHERE `zz_views_lang`.`id_record` = (SELECT `id` FROM `zz_views` WHERE `name` = 'tel_Cellulare');
UPDATE `zz_views_lang` SET `title` = 'emailto_Email' WHERE `zz_views_lang`.`id_record` = (SELECT `id` FROM `zz_views` WHERE `name` = 'emailto_Email'); UPDATE `zz_views_lang` SET `title` = 'emailto_Email' WHERE `zz_views_lang`.`id_record` = (SELECT `id` FROM `zz_views` WHERE `name` = 'emailto_Email');
-- Aggiunta campo modello
ALTER TABLE `mg_articoli` ADD `modello` VARCHAR(255) NULL AFTER `id_marchio`;