Spostati pulsanti in ddt e ordini secondo nuova struttura su file esterno buttons.php

This commit is contained in:
Luca 2018-05-19 00:50:06 +02:00
parent 68ba2da869
commit 0950671c52
6 changed files with 54 additions and 55 deletions

View File

@ -103,7 +103,7 @@ if (empty($records)) {
{( "name": "button", "type": "email", "id_module": "'.$id_module.'", "id_record": "'.$id_record.'" )} {( "name": "button", "type": "email", "id_module": "'.$id_module.'", "id_record": "'.$id_record.'" )}
<a class="btn btn-success" id="save"> <a class="btn btn-success" id="save">
<i class="fa fa-check"></i> '.tr('Salva modifiche').' <i class="fa fa-check"></i> '.tr('Salva').'
</a> </a>
</div> </div>
</div> </div>

13
modules/ddt/buttons.php Normal file
View File

@ -0,0 +1,13 @@
<?php
include_once __DIR__.'/../../core.php';
if (!in_array($records[0]['stato'], ['Bozza', 'Fatturato'])) {
echo '
<a class="btn btn-info" data-href="'.$rootdir.'/modules/fatture/crea_documento.php?id_module=.'.$id_module.'&id_record='.$id_record.'&documento=fattura" data-toggle="modal" data-title="Crea fattura" data-target="#bs-popup">
<i class="fa fa-magic"></i>.'.tr('Crea fattura').'</i>
</a>';
}

View File

@ -173,21 +173,6 @@ if ($records[0]['stato'] != 'Evaso') {
} }
?> ?>
</div> </div>
<div class="pull-right">
<!-- Stampe -->
<?php
if (!in_array($records[0]['stato'], ['Bozza', 'Fatturato'])) {
?>
<a class="btn btn-sm btn-info" data-href="<?php echo $rootdir; ?>/modules/fatture/crea_documento.php?id_module=<?php echo $id_module; ?>&id_record=<?php echo $id_record; ?>&documento=fattura" data-toggle="modal" data-title="Crea fattura" data-target="#bs-popup">
<i class="fa fa-magic"></i> <?php echo tr('Crea fattura da ddt'); ?>...</i>
</a>
<?php
}
?>
</div>
<div class="clearfix"></div> <div class="clearfix"></div>
<br> <br>

View File

@ -0,0 +1,29 @@
<?php
include_once __DIR__.'/../../core.php';
if (!in_array($records[0]['stato'], ['Evaso'])) {
echo '
<div class="dropdown">
<button class="btn btn-info dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
<i class="fa fa-magic"></i>&nbsp;'.tr('Crea').'...
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li>
<a data-href="'.$rootdir.'/modules/fatture/crea_documento.php?id_module='.$id_module.'&id_record='.$id_record.'&documento=ddt" data-toggle="modal" data-title="'.tr('Crea ddt').'" data-target="#bs-popup"><i class="fa fa-file-o"></i>&nbsp;'.tr('ddt').'
</a>
</li>
<li>
<a data-href="'.$rootdir.'/modules/fatture/crea_documento.php?id_module='.$id_module.'&id_record='.$id_record.'&documento=fattura" data-toggle="modal" data-title="'.tr('Crea fattura').'" data-target="#bs-popup"><i class="fa fa-file"></i>&nbsp;'.tr('fattura').'
</a>
</li>
</ul>
</div>';
}

View File

@ -88,7 +88,10 @@ if ($module['name'] == 'Ordini cliente') {
<div class="panel-body"> <div class="panel-body">
<div class="pull-left"> <div class="pull-left">
<?php if ($records[0]['stato'] != 'Evaso') { <?php
if ($records[0]['stato'] != 'Evaso') {
?> ?>
<a class="btn btn-primary" data-href="<?php echo $rootdir; ?>/modules/ordini/row-add.php?id_module=<?php echo $id_module; ?>&id_record=<?php echo $id_record; ?>&is_articolo" data-toggle="modal" data-title="Aggiungi articolo" data-target="#bs-popup"><i class="fa fa-plus"></i> <?php echo tr('Articolo'); ?></a> <a class="btn btn-primary" data-href="<?php echo $rootdir; ?>/modules/ordini/row-add.php?id_module=<?php echo $id_module; ?>&id_record=<?php echo $id_record; ?>&is_articolo" data-toggle="modal" data-title="Aggiungi articolo" data-target="#bs-popup"><i class="fa fa-plus"></i> <?php echo tr('Articolo'); ?></a>
@ -96,41 +99,10 @@ if ($module['name'] == 'Ordini cliente') {
<a class="btn btn-primary" data-href="<?php echo $rootdir; ?>/modules/ordini/row-add.php?id_module=<?php echo $id_module; ?>&id_record=<?php echo $id_record; ?>&is_descrizione" data-toggle="modal" data-title="Aggiungi descrizione" data-target="#bs-popup"><i class="fa fa-plus"></i> <?php echo tr('Descrizione'); ?></a> <a class="btn btn-primary" data-href="<?php echo $rootdir; ?>/modules/ordini/row-add.php?id_module=<?php echo $id_module; ?>&id_record=<?php echo $id_record; ?>&is_descrizione" data-toggle="modal" data-title="Aggiungi descrizione" data-target="#bs-popup"><i class="fa fa-plus"></i> <?php echo tr('Descrizione'); ?></a>
<?php <?php
} ?>
</div>
<div class="pull-right">
<!-- Stampe -->
<?php
if ($records[0]['stato'] != 'Evaso') {
echo '
<div class="dropdown">
<button class="btn btn-info dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
<i class="fa fa-magic"></i>&nbsp;'.tr('Crea subito').'
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li>
<a data-href="'.$rootdir.'/modules/fatture/crea_documento.php?id_module='.$id_module.'&id_record='.$id_record.'&documento=ddt" data-toggle="modal" data-title="'.tr('Crea ddt').'" data-target="#bs-popup"><i class="fa fa-file-o"></i>&nbsp;'.tr('ddt').'
</a>
</li>
<li>
<a data-href="'.$rootdir.'/modules/fatture/crea_documento.php?id_module='.$id_module.'&id_record='.$id_record.'&documento=fattura" data-toggle="modal" data-title="'.tr('Crea fattura').'" data-target="#bs-popup"><i class="fa fa-file"></i>&nbsp;'.tr('fattura').'
</a>
</li>
</ul>
</div>';
} }
?> ?>
</div> </div>
<div class="clearfix"></div> <div class="clearfix"></div>
<br> <br>

View File

@ -29,7 +29,7 @@ class ButtonManager implements ManagerInterface
$result = [ $result = [
'link' => \Prints::getHref($options['id'], $options['id_record'], $options['parameters']), 'link' => \Prints::getHref($options['id'], $options['id_record'], $options['parameters']),
'title' => $print['title'], 'title' => tr('Stampa').' '.strtolower($print['title']),
'icon' => $print['icon'], 'icon' => $print['icon'],
]; ];
} else { } else {
@ -37,7 +37,7 @@ class ButtonManager implements ManagerInterface
$result = [ $result = [
'link' => ROOTDIR.'/mail.php?id_module='.$options['id_module'].'&id_record='.$options['id_record'].'&id='.$options['id'], 'link' => ROOTDIR.'/mail.php?id_module='.$options['id_module'].'&id_record='.$options['id_record'].'&id='.$options['id'],
'title' => $template['name'], 'title' => tr('Invia').' '.strtolower($template['name']),
'icon' => $template['icon'], 'icon' => $template['icon'],
'type' => 'modal', 'type' => 'modal',
]; ];
@ -157,9 +157,9 @@ class ButtonManager implements ManagerInterface
$result = ''; $result = '';
if ($options['type'] == 'print') { if ($options['type'] == 'print') {
$result = '<i class="fa fa-print"></i> '.tr('Stampe'); $result = '<i class="fa fa-print"></i> '.tr('Stampa');
} else { } else {
$result = '<i class="fa fa-envelope"></i> '.tr('Email'); $result = '<i class="fa fa-envelope"></i> '.tr('Invia');
} }
return $result; return $result;