2017-08-04 16:28:16 +02:00
< ? php
2020-09-07 15:04:06 +02:00
/*
* OpenSTAManager : il software gestionale open source per l ' assistenza tecnica e la fatturazione
2021-01-20 15:08:51 +01:00
* Copyright ( C ) DevCode s . r . l .
2020-09-07 15:04:06 +02:00
*
* This program is free software : you can redistribute it and / or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation , either version 3 of the License , or
* ( at your option ) any later version .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
* along with this program . If not , see < https :// www . gnu . org / licenses />.
*/
2017-08-04 16:28:16 +02:00
2018-02-18 19:53:23 +01:00
include_once __DIR__ . '/../../core.php' ;
2017-08-04 16:28:16 +02:00
2018-07-03 11:37:15 +02:00
$id_anagrafica = ! empty ( get ( 'idanagrafica' )) ? get ( 'idanagrafica' ) : $user [ 'idanagrafica' ];
2022-02-16 17:47:19 +01:00
$stati = get ( 'pianificabile' ) ? 'SELECT id, descrizione FROM co_staticontratti WHERE is_pianificabile=1' : 'SELECT id, descrizione FROM co_staticontratti' ;
2021-09-01 10:52:22 +02:00
echo '
< form action = " " method = " post " id = " add-form " >
2017-08-04 16:28:16 +02:00
< input type = " hidden " name = " op " value = " add " >
< input type = " hidden " name = " backto " value = " record-edit " >
< div class = " row " >
< div class = " col-md-6 " >
2021-09-01 10:52:22 +02:00
{[ " type " : " text " , " label " : " '.tr('Nome').' " , " name " : " nome " , " required " : 1 ]}
2017-08-04 16:28:16 +02:00
</ div >
< div class = " col-md-6 " >
2021-02-20 13:31:05 +01:00
{[ " type " : " select " , " label " : " '.tr('Cliente').' " , " name " : " idanagrafica " , " required " : 1 , " value " : " '. $id_anagrafica .' " , " ajax-source " : " clienti " , " icon-after " : " add|'.module('Anagrafiche')['id'].'|tipoanagrafica=Cliente&readonly_tipo=1 " ]}
2017-08-04 16:28:16 +02:00
</ div >
</ div >
2022-02-16 17:47:19 +01:00
< div class = " row " >
< div class = " col-md-3 " >
{[ " type " : " select " , " label " : " '.tr('Stato').' " , " name " : " idstato " , " required " : 1 , " values " : " query='. $stati .' " ]}
</ div >
< div class = " col-md-3 " >
{[ " type " : " date " , " label " : " '.tr('Data accettazione').' " , " name " : " data_accettazione " ]}
</ div >
< div class = " col-md-3 " >
{[ " type " : " date " , " label " : " '.tr('Data conclusione').' " , " name " : " data_conclusione " ]}
</ div >
< div class = " col-md-3 " >
{[ " type " : " number " , " label " : " '.tr('Validità contratto').' " , " name " : " validita " , " decimals " : " 0 " , " icon-after " : " choice|period|'. $record['tipo_validita'] .' " , " help " : " '.tr('Il campo Validità contratto viene utilizzato per il calcolo della Data di conclusione del contratto').' " ]}
</ div >
</ div >
2021-09-01 10:52:22 +02:00
<!-- Informazioni rinnovo -->
2022-02-16 17:47:19 +01:00
< div class = " box box-primary collapsable collapsed-box " >
2021-09-01 10:52:22 +02:00
< div class = " box-header " >
< h3 class = " box-title " > '.tr(' Informazioni per rinnovo ').' </ h3 >
2022-02-16 17:47:19 +01:00
< div class = " box-tools pull-right " >
< button type = " button " class = " btn btn-box-tool " data - widget = " collapse " >
< i class = " fa fa-plus " ></ i >
</ button >
</ div >
2021-09-01 10:52:22 +02:00
</ div >
< div class = " box-body " >
< div class = " row " >
< div class = " col-md-6 " >
{[ " type " : " checkbox " , " label " : " '.tr('Rinnovabile').' " , " name " : " rinnovabile " , " id " : " rinnovabile_add " , " help " : " '.tr('Il contratto è rinnovabile?').' " ]}
</ div >
< div class = " col-md-6 " >
{[ " type " : " checkbox " , " label " : " '.tr('Rinnovo automatico').' " , " name " : " rinnovo_automatico " , " id " : " rinnovo_automatico_add " , " help " : " '.tr('Il contratto è da rinnovare automaticamente alla scadenza').' " , " disabled " : 1 ]}
</ div >
< div class = " col-md-6 " >
{[ " type " : " number " , " label " : " '.tr('Preavviso per rinnovo').' " , " name " : " giorni_preavviso_rinnovo " , " id " : " giorni_preavviso_rinnovo_add " , " decimals " : " 2 " , " icon-after " : " giorni " , " disabled " : 1 ]}
</ div >
< div class = " col-md-6 " >
{[ " type " : " number " , " label " : " '.tr('Ore rimanenti rinnovo').' " , " name " : " ore_preavviso_rinnovo " , " id " : " ore_preavviso_rinnovo_add " , " decimals " : " 2 " , " icon-after " : " ore " , " disabled " : 1 , " help " : " '.tr('Ore residue nel contratto prima di visualizzare una avviso per un eventuale rinnovo anticipato.').' " ]}
</ div >
</ div >
</ div >
</ div >
2017-08-04 16:28:16 +02:00
<!-- PULSANTI -->
< div class = " row " >
< div class = " col-md-12 text-right " >
2021-09-01 10:52:22 +02:00
< button type = " submit " class = " btn btn-primary " >
< i class = " fa fa-plus " ></ i > '.tr(' Aggiungi ').'
</ button >
2017-08-04 16:28:16 +02:00
</ div >
</ div >
</ form >
2021-09-01 10:52:22 +02:00
< script type = " text/javascript " >
input ( " rinnovabile " ) . on ( " change " , function () {
const disabled = parseInt ( $ ( this ) . val ()) === 0 ;
input ( " giorni_preavviso_rinnovo " ) . setDisabled ( disabled );
input ( " ore_preavviso_rinnovo " ) . setDisabled ( disabled );
input ( " rinnovo_automatico " ) . setDisabled ( disabled );
});
2022-02-16 17:47:19 +01:00
$ ( " #data_conclusione " ) . on ( " dp.change " , function ( e ) {
let data_accettazione = $ ( " #data_accettazione " );
data_accettazione . data ( " DateTimePicker " ) . maxDate ( e . date );
if ( data_accettazione . data ( " DateTimePicker " ) . date () > e . date ){
data_accettazione . data ( " DateTimePicker " ) . date ( e . date );
}
});
2021-09-01 10:52:22 +02:00
</ script > ' ;