1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2024-12-22 21:28:08 +01:00

Miglioramento duplicazione interventi

This commit is contained in:
Thomas Zilio 2020-07-31 08:56:41 +02:00
parent 57ca1f37fd
commit f2309ac1b3
5 changed files with 57 additions and 37 deletions

View File

@ -17,14 +17,15 @@ echo '
</div>
</div>
<!-- PULSANTI -->
<div class="row">
<div class="col-md-12 text-right">
<button type="submit" class="btn btn-primary">
<i class="fa fa-copy"></i>
'.tr('Duplica').'
<i class="fa fa-copy"></i> '.tr('Duplica').'
</button>
</div>
</div>
</form>';
echo '
<script>$(document).ready(init)</script>';

View File

@ -25,7 +25,9 @@ echo '
// Duplica contratto
echo'
<button type="button" class="btn btn-primary" onclick="if( confirm(\''.tr('Duplicare questo contratto?').'\') ){ $(\'#copia-contratto\').submit(); }"> <i class="fa fa-copy"></i> '.tr('Duplica contratto').'</button>';
<button type="button" class="btn btn-primary" onclick="if( confirm(\''.tr('Duplicare questo contratto?').'\') ){ $(\'#copia-contratto\').submit(); }">
<i class="fa fa-copy"></i> '.tr('Duplica contratto').'
</button>';
echo '
<form action="" method="post" id="copia-contratto">

View File

@ -16,16 +16,23 @@ if (empty($record['firma_file'])) {
// Duplica intervento
echo'
<button type="button" class="btn btn-primary " onclick="launch_modal( \''.tr('Duplica attività').'\', globals.rootdir + \'/modules/interventi/copia_attivita.php?id_module='.$id_module.'&id_record='.$id_record.'\');" >
<i class="fa fa-copy"></i> '.tr('Duplica attività').'...
</button>';
// Disabilito il tasto di firma per gli interventi completati
echo '
<button type="button" class="btn btn-primary " onclick="duplicaIntervento()">
<i class="fa fa-copy"></i> '.tr('Duplica attività').'
</button>
<!-- EVENTUALE FIRMA GIA\' EFFETTUATA -->
'.$info_firma.'
<button type="button" class="btn btn-primary " onclick="launch_modal( \''.tr('Anteprima e firma').'\', globals.rootdir + \'/modules/interventi/add_firma.php?id_module='.$id_module.'&id_record='.$id_record.'&anteprima=1\');" '.($record['flag_completato'] ? 'disabled' : '').'>
<button type="button" class="btn btn-primary" onclick="anteprimaFirma()" '.($record['flag_completato'] ? 'disabled' : '').'>
<i class="fa fa-desktop"></i> '.$frase.'...
</button>';
</button>
<script>
function duplicaIntervento() {
openModal("'.tr('Duplica attività').'", "'.$module->fileurl('modals/duplicazione.php').'?id_module='.$id_module.'&id_record='.$id_record.'");
}
function anteprimaFirma() {
openModal("'.tr('Anteprima e firma').'", "'.$module->fileurl('add_firma.php').'?id_module='.$id_module.'&id_record='.$id_record.'&anteprima=1");
}
</script>';

View File

@ -1,9 +1,9 @@
<?php
include_once __DIR__.'/../../core.php';
include_once __DIR__.'/../../../core.php';
echo '
<form action="" method="post" id="copia-intervento">
<form action="" method="post" id="form-copy">
<input type="hidden" name="backto" value="record-edit">
<input type="hidden" name="op" value="copy">
@ -11,27 +11,31 @@ echo '
<div class="col-md-6">
{[ "type": "timestamp", "label": "'.tr('Data/ora richiesta').'", "name": "data_richiesta", "required": 0, "value": "-now-", "required":1 ]}
</div>
<div class="col-md-6">
{[ "type": "select", "label": "'.tr('Stato').'", "name": "idstatointervento", "required": 1, "values": "query=SELECT idstatointervento AS id, descrizione, colore AS _bgcolor_ FROM in_statiintervento WHERE deleted_at IS NULL", "value": "" ]}
</div>
</div>
<div class="row">
<div class="col-md-6">
{["type":"checkbox", "label":"'.tr('Duplica righe').'", "name":"righe", "value":"", "help":"'.tr('Selezione per riportare anche le righe nella nuova attività').'" ]}
</div>
<div class="col-md-6">
{["type":"checkbox", "label":"'.tr('Duplica sessioni').'", "name":"sessioni", "value":"", "help":"'.tr('Selezione per riportare anche le sessioni di lavoro nella nuova attività').'" ]}
</div>
</div>
<!-- PULSANTI -->
<div class="row">
<div class="col-md-12 text-right">
<button type="submit" class="btn btn-primary"><i class="fa fa-copy"></i> '.tr('Duplica attività').'...</button>
<button type="submit" class="btn btn-primary">
<i class="fa fa-copy"></i> '.tr('Duplica').'
</button>
</div>
</div>
</form>';
</form>
<script>
init();
</script>';
echo '
<script>$(document).ready(init)</script>';

View File

@ -3,13 +3,17 @@
include_once __DIR__.'/../../core.php';
echo'
<button type="button" class="btn btn-primary" onclick="if( confirm(\'Duplicare questo preventivo?\') ){ $(\'#copia-preventivo\').submit(); }"> <i class="fa fa-copy"></i> '.tr('Duplica preventivo').'</button>';
<button type="button" class="btn btn-primary" onclick="if( confirm(\'Duplicare questo preventivo?\') ){ $(\'#copia-preventivo\').submit(); }">
<i class="fa fa-copy"></i> '.tr('Duplica preventivo').'
</button>';
$stati_abilitati = $dbo->fetchOne('SELECT GROUP_CONCAT(`descrizione` SEPARATOR ", ") AS stati_abilitati FROM `co_statipreventivi` WHERE `is_revisionabile` = 1 ')['stati_abilitati'];
// Crea revisione
echo '
<button type="button" class="btn btn-warning '.($record['is_revisionabile'] ? '' : 'disabled tip').'" onclick="if(confirm(\'Vuoi creare un nuova revisione?\')){$(\'#crea-revisione\').submit();}" '.($record['is_revisionabile'] ? '' : 'disabled').' title="'.($record['is_revisionabile'] ? '' : tr('Per creare una nuova revisione lo stato del preventivo deve essere tra: ').$stati_abilitati).'" ><i class="fa fa-edit"></i> '.tr('Crea nuova revisione...').'</button>';
<button type="button" class="btn btn-warning '.($record['is_revisionabile'] ? '' : 'disabled tip').'" onclick="if(confirm(\'Vuoi creare un nuova revisione?\')){$(\'#crea-revisione\').submit();}" '.($record['is_revisionabile'] ? '' : 'disabled').' title="'.($record['is_revisionabile'] ? '' : tr('Per creare una nuova revisione lo stato del preventivo deve essere tra: ').$stati_abilitati).'">
<i class="fa fa-edit"></i> '.tr('Crea nuova revisione...').'
</button>';
$rs_documento = $dbo->fetchArray('SELECT * FROM co_righe_preventivi WHERE idpreventivo='.prepare($id_record));
@ -20,14 +24,16 @@ $stati_abilitati = $dbo->fetchOne('SELECT GROUP_CONCAT(`descrizione` SEPARATOR "
// Creazione altri documenti
echo '
<div style="margin-left:4px;" class="dropdown pull-right">
<button class="btn btn-info dropdown-toggle '.($disabled ? '' : 'disabled tip').'" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true" '.($disabled ? '' : 'disabled').' title="'.($disabled ? '' : tr('Per creare un documento deve essere inserita almeno una riga e lo stato del preventivo deve essere tra: ').$stati_abilitati).'" >
<button class="btn btn-info dropdown-toggle '.($disabled ? '' : 'disabled tip').'" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true" '.($disabled ? '' : 'disabled').' title="'.($disabled ? '' : tr('Per creare un documento deve essere inserita almeno una riga e lo stato del preventivo deve essere tra: _STATE_LIST_', [
'_STATE_LIST_' => $stati_abilitati,
])).'" >
<i class="fa fa-magic"></i>&nbsp;'.tr('Crea').'...
<span class="caret"></span>
</button>
<ul class="dropdown-menu dropdown-menu-right">
<li>
<a class="'.($disabled ? '' : 'disabled').'" data-href="'.$structure->fileurl('crea_documento.php').'?id_module='.$id_module.'&id_record='.$id_record.'&documento=ddt" data-toggle="modal" data-title="'.tr('Crea ordine cliente').'">
<i class="fa fa-truck"></i>&nbsp;'.tr('DDT in uscita').'
<a class="'.($disabled ? '' : 'disabled').'" data-href="'.$structure->fileurl('crea_documento.php').'?id_module='.$id_module.'&id_record='.$id_record.'&documento=contratto" data-toggle="modal" data-title="'.tr('Crea contratto').'">
<i class="fa fa-file-o"></i>&nbsp;'.tr('Contratto').'
</a>
</li>
@ -38,14 +44,14 @@ echo '
</li>
<li>
<a class="'.($disabled ? '' : 'disabled').'" data-href="'.$structure->fileurl('crea_documento.php').'?id_module='.$id_module.'&id_record='.$id_record.'&documento=fattura" data-toggle="modal" data-title="'.tr('Crea fattura').'">
<i class="fa fa-file"></i>&nbsp;'.tr('Fattura').'
<a class="'.($disabled ? '' : 'disabled').'" data-href="'.$structure->fileurl('crea_documento.php').'?id_module='.$id_module.'&id_record='.$id_record.'&documento=ddt" data-toggle="modal" data-title="'.tr('Crea ordine cliente').'">
<i class="fa fa-truck"></i>&nbsp;'.tr('DDT in uscita').'
</a>
</li>
<li>
<a class="'.($disabled ? '' : 'disabled').'" data-href="'.$structure->fileurl('crea_documento.php').'?id_module='.$id_module.'&id_record='.$id_record.'&documento=contratto" data-toggle="modal" data-title="'.tr('Crea contratto').'">
<i class="fa fa-file-o"></i>&nbsp;'.tr('Contratto').'
<a class="'.($disabled ? '' : 'disabled').'" data-href="'.$structure->fileurl('crea_documento.php').'?id_module='.$id_module.'&id_record='.$id_record.'&documento=fattura" data-toggle="modal" data-title="'.tr('Crea fattura').'">
<i class="fa fa-file"></i>&nbsp;'.tr('Fattura').'
</a>
</li>
</ul>