2018-10-12 10:33:08 +02:00
< ? php
include_once __DIR__ . '/../../core.php' ;
2019-12-05 15:50:13 +01:00
include_once __DIR__ . '/../../../core.php' ;
2018-10-12 10:33:08 +02:00
$show_costi = true ;
// Limitazione delle azioni dei tecnici
if ( $user [ 'gruppo' ] == 'Tecnici' ) {
$show_costi = ! empty ( $user [ 'idanagrafica' ]) && setting ( 'Mostra i prezzi al tecnico' );
}
2019-07-12 15:12:24 +02:00
$sessione = $dbo -> fetchOne ( 'SELECT in_interventi_tecnici.*, an_anagrafiche.ragione_sociale, an_anagrafiche.deleted_at, in_interventi_tecnici.tipo_scontokm AS tipo_sconto_km, in_interventi_tecnici.prezzo_ore_unitario, in_interventi_tecnici.prezzo_km_unitario, in_interventi_tecnici.prezzo_dirittochiamata FROM in_interventi_tecnici INNER JOIN an_anagrafiche ON in_interventi_tecnici.idtecnico = an_anagrafiche.idanagrafica WHERE in_interventi_tecnici.id = ' . prepare ( get ( 'id_sessione' )));
2018-10-12 10:33:08 +02:00
2018-10-30 11:39:45 +01:00
$op = 'edit_sessione' ;
$button = '<i class="fa fa-edit"></i> ' . tr ( 'Modifica' );
2018-10-12 10:33:08 +02:00
echo '
2018-10-30 11:39:45 +01:00
< form id = " add_form " action = " '. $rootdir .'/editor.php?id_module='. $id_module .'&id_record='.get('id_record').' " method = " post " >
2018-10-12 10:33:08 +02:00
< input type = " hidden " name = " op " value = " '. $op .' " >
2018-10-30 11:39:45 +01:00
< input type = " hidden " name = " backto " value = " record-edit " >
2018-12-20 16:33:15 +01:00
< input type = " hidden " name = " id_sessione " value = " '. $sessione['id'] .' " >
< input type = " hidden " name = " idtecnico " value = " '. $sessione['idtecnico'] .' " > ' ;
2018-10-12 10:33:08 +02:00
// Tecnico
echo '
2019-06-11 18:35:07 +02:00
< div class = " row " >
< div class = " col-md-4 " >
{[ " type " : " span " , " label " : " '.tr('Tecnico').' " , " name " : " tecnico " , " required " : 0 , " value " : " '. $sessione['ragione_sociale'] .' '.(!empty( $sessione['deleted_at'] ) ? '<small class= " text - danger " ><em>('.tr('Eliminato').')</em></small>' : '').' " ]}
</ div >
</ div > ' ;
2018-10-12 10:33:08 +02:00
// Orari
echo '
< div class = " row " >
2018-10-30 11:39:45 +01:00
< div class = " col-md-4 " >
2019-07-08 17:11:48 +02:00
{[ " type " : " select " , " label " : " '.tr('Tipo attività').' " , " name " : " idtipointerventot " , " value " : " '. $sessione['idtipointervento'] .' " , " required " : 1 , " values " : " query=SELECT in_tipiintervento.idtipointervento AS id, descrizione, in_tariffe.costo_ore AS prezzo_ore_unitario, in_tariffe.costo_km AS prezzo_km_unitario, in_tariffe.costo_dirittochiamata AS prezzo_dirittochiamata FROM in_tipiintervento JOIN in_tariffe ON in_tipiintervento.idtipointervento = in_tariffe.idtipointervento WHERE in_tariffe.idtecnico = '.prepare( $sessione['idtecnico'] ).' ORDER BY descrizione " ]}
2018-10-30 11:39:45 +01:00
</ div >
2020-01-10 18:55:20 +01:00
2018-10-30 11:39:45 +01:00
< div class = " col-md-4 " >
2018-10-12 10:33:08 +02:00
{[ " type " : " timestamp " , " label " : " '.tr('Inizio attività').' " , " name " : " orario_inizio " , " required " : 1 , " value " : " '. $sessione['orario_inizio'] .' " ]}
</ div >
2018-10-30 11:39:45 +01:00
< div class = " col-md-4 " >
2018-10-12 10:33:08 +02:00
{[ " type " : " timestamp " , " label " : " '.tr('Fine attività').' " , " name " : " orario_fine " , " required " : 1 , " value " : " '. $sessione['orario_fine'] .' " ]}
</ div >
</ div > ' ;
echo '
< div class = " row " > ' ;
// Km
echo '
< div class = " col-md-4 " >
{[ " type " : " number " , " label " : " '.tr('Km').' " , " name " : " km " , " value " : " '. $sessione['km'] .' " ]}
</ div > ' ;
2020-01-10 18:55:20 +01:00
$class = $show_costi ? '' : 'hide' ;
2018-10-12 10:33:08 +02:00
// Sconto ore
echo '
2020-01-10 18:55:20 +01:00
< div class = " col-md-4 '. $class .' " >
2018-10-12 10:33:08 +02:00
{[ " type " : " number " , " label " : " '.tr('Sconto ore').' " , " name " : " sconto " , " value " : " '. $sessione['sconto_unitario'] .' " , " icon-after " : " choice|untprc|'. $sessione['tipo_sconto'] .' " ]}
</ div > ' ;
// Sconto km
echo '
2020-01-10 18:55:20 +01:00
< div class = " col-md-4 '. $class .' " >
2018-12-05 11:38:36 +01:00
{[ " type " : " number " , " label " : " '.tr('Sconto km').' " , " name " : " sconto_km " , " value " : " '. $sessione['scontokm_unitario'] .' " , " icon-after " : " choice|untprc|'. $sessione['tipo_sconto_km'] .' " ]}
2018-10-12 10:33:08 +02:00
</ div > ' ;
echo '
2019-07-08 17:11:48 +02:00
</ div >
2020-01-10 18:55:20 +01:00
2019-07-08 17:11:48 +02:00
< div class = " row " >
2020-01-10 18:55:20 +01:00
< div class = " col-md-4 '. $class .' " >
2019-07-08 17:11:48 +02:00
{[ " type " : " number " , " label " : " '.tr('Addebito orario').' " , " name " : " prezzo_ore_unitario " , " value " : " '. $sessione['prezzo_ore_unitario'] .' " ]}
</ div >
2020-01-10 18:55:20 +01:00
< div class = " col-md-4 '. $class .' " >
2019-07-12 15:12:24 +02:00
{[ " type " : " number " , " label " : " '.tr('Addebito km').' " , " name " : " prezzo_km_unitario " , " value " : " '. $sessione['prezzo_km_unitario'] .' " ]}
2019-07-08 17:11:48 +02:00
</ div >
2020-01-10 18:55:20 +01:00
< div class = " col-md-4 '. $class .' " >
2019-07-08 17:11:48 +02:00
{[ " type " : " number " , " label " : " '.tr('Addebito diritto ch.').' " , " name " : " prezzo_dirittochiamata " , " value " : " '. $sessione['prezzo_dirittochiamata'] .' " ]}
2019-12-09 17:47:07 +01:00
</ div > ' ;
2019-12-13 10:08:17 +01:00
2019-12-09 17:47:07 +01:00
echo '
2018-10-12 10:33:08 +02:00
</ div > ' ;
2019-12-09 17:47:07 +01:00
2018-10-12 10:33:08 +02:00
echo '
<!-- PULSANTI -->
< div class = " row " >
< div class = " col-md-12 text-right " >
< button type = " submit " class = " btn btn-primary " > '.$button.' </ button >
</ div >
</ div >
</ form > ' ;
echo '
2019-07-26 18:05:19 +02:00
< script > $ ( document ) . ready ( init ) </ script > ' ;
2018-10-12 10:33:08 +02:00
echo '
< script >
$ ( document ) . ready ( function () {
// Quando modifico orario inizio, allineo anche l\'orario fine
$ ( " #orario_inizio " ) . on ( " dp.change " , function ( e ) {
2019-08-02 15:58:31 +02:00
$ ( " #orario_fine " ) . data ( " DateTimePicker " ) . minDate ( e . date );
$ ( " #orario_fine " ) . change ();
2018-10-12 10:33:08 +02:00
});
2019-07-08 17:11:48 +02:00
$ ( " #idtipointerventot " ) . change ( function () {
data = $ ( this ) . selectData ();
2020-01-10 18:55:20 +01:00
2019-07-08 17:11:48 +02:00
$ ( " #prezzo_ore_unitario " ) . val ( data . prezzo_ore_unitario );
$ ( " #prezzo_km_unitario " ) . val ( data . prezzo_km_unitario );
$ ( " #prezzo_dirittochiamata " ) . val ( data . prezzo_dirittochiamata );
});
2018-10-12 10:33:08 +02:00
});
2020-01-14 22:30:46 +01:00
</ script > ' ;