2017-08-04 16:28:16 +02:00
< ? php
include_once __DIR__ . '/../../core.php' ;
if ( get ( 'tipoanagrafica' ) != '' ) {
$rs = $dbo -> fetchArray ( 'SELECT idtipoanagrafica FROM an_tipianagrafiche WHERE descrizione=' . prepare ( get ( 'tipoanagrafica' )));
$idtipoanagrafica = $rs [ 0 ][ 'idtipoanagrafica' ];
}
echo '
2018-02-23 16:04:50 +01:00
< 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 " >
2019-01-04 19:23:28 +01:00
{[ " type " : " text " , " label " : " '.tr('Denominazione').' " , " name " : " ragione_sociale " , " required " : 1 ]}
2017-08-04 16:28:16 +02:00
</ div >
< div class = " col-md-6 " >
2020-01-14 18:31:46 +01:00
{[ " type " : " select " , " label " : " '.tr('Tipo di anagrafica').' " , " name " : " idtipoanagrafica[] " , " multiple " : " 1 " , " required " : 1 , " values " : " query=SELECT idtipoanagrafica AS id, descrizione FROM an_tipianagrafiche WHERE idtipoanagrafica NOT IN (SELECT DISTINCT(x.idtipoanagrafica) FROM an_tipianagrafiche_anagrafiche x INNER JOIN an_tipianagrafiche t ON x.idtipoanagrafica = t.idtipoanagrafica INNER JOIN an_anagrafiche ON an_anagrafiche.idanagrafica = x.idanagrafica WHERE t.descrizione = \ 'Azienda \ ' AND deleted_at IS NULL) ORDER BY descrizione " , " value " : " '.(isset( $idtipoanagrafica ) ? $idtipoanagrafica : null).' " , " readonly " : '.(!empty(get(' readonly_tipo ')) ? 1 : 0).' ]}
2017-08-04 16:28:16 +02:00
</ div >
2019-01-04 19:23:28 +01:00
</ div >
2019-01-05 09:53:17 +01:00
2019-01-04 19:23:28 +01:00
< div class = " row " >
2019-02-26 15:44:53 +01:00
2019-01-04 19:23:28 +01:00
< div class = " col-md-6 " >
2019-02-26 15:44:53 +01:00
{[ " type " : " text " , " label " : " '.tr('Cognome').' " , " name " : " cognome " , " required " : 0 ]}
2019-01-04 19:23:28 +01:00
</ div >
2019-02-26 15:44:53 +01:00
2019-01-04 19:23:28 +01:00
< div class = " col-md-6 " >
2019-05-21 15:21:55 +02:00
{[ " type " : " text " , " label " : " '.tr('Nome').' " , " name " : " nome " , " id " : " nome_ " , " required " : 0 ]}
2019-01-04 19:23:28 +01:00
</ div >
2019-02-26 15:44:53 +01:00
2018-04-17 23:41:56 +02:00
</ div > ' ;
2019-01-05 09:53:17 +01:00
2018-07-03 11:12:32 +02:00
echo '
< div class = " box box-info collapsed-box " >
2018-04-17 23:41:56 +02:00
< div class = " box-header with-border " >
< h3 class = " box-title " > '.tr(' Dati anagrafici ').' </ h3 >
< 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 >
</ div >
2018-11-23 12:43:45 +01:00
< div class = " box-body " >
2018-04-17 23:41:56 +02:00
< div class = " row " >
< div class = " col-md-4 " >
2019-07-05 12:28:19 +02:00
{[ " type " : " text " , " label " : " '.tr('Partita IVA').' " , " maxlength " : 13 , " name " : " piva " , " class " : " text-center alphanumeric-mask " , " validation " : " partita_iva " ]}
2018-04-17 23:41:56 +02:00
</ div >
< div class = " col-md-4 " >
2019-07-05 12:28:19 +02:00
{[ " type " : " text " , " label " : " '.tr('Codice fiscale').' " , " maxlength " : 16 , " name " : " codice_fiscale " , " class " : " text-center alphanumeric-mask " , " validation " : " codice_fiscale " ]}
2018-04-17 23:41:56 +02:00
</ div >
2019-03-21 11:39:33 +01:00
2018-04-17 23:41:56 +02:00
< div class = " col-md-4 " >
2019-03-21 11:39:33 +01:00
{[ " type " : " select " , " label " : " '.tr('Tipologia').' " , " name " : " tipo " , " values " : " list= \" \" : \" '.tr('Non specificato').' \" , \" Azienda \" : \" '.tr('Azienda').' \" , \" Privato \" : \" '.tr('Privato').' \" , \" Ente pubblico \" : \" '.tr('Ente pubblico').' \" " ]}
2018-04-17 23:41:56 +02:00
</ div >
2019-03-21 11:39:33 +01:00
2018-04-17 23:41:56 +02:00
</ div >
< div class = " row " >
< div class = " col-md-4 " >
2018-07-03 12:28:38 +02:00
{[ " type " : " text " , " label " : " '.tr('Indirizzo').' " , " name " : " indirizzo " ]}
2018-04-17 23:41:56 +02:00
</ div >
< div class = " col-md-2 " >
2018-07-03 12:28:38 +02:00
{[ " type " : " text " , " label " : " '.tr('C.A.P.').' " , " name " : " cap " , " maxlength " : 5 , " class " : " text-center " ]}
2018-04-17 23:41:56 +02:00
</ div >
< div class = " col-md-4 " >
2018-07-03 12:28:38 +02:00
{[ " type " : " text " , " label " : " '.tr('Città').' " , " name " : " citta " , " class " : " text-center " ]}
2018-04-17 23:41:56 +02:00
</ div >
< div class = " col-md-2 " >
2018-11-29 14:46:31 +01:00
{[ " type " : " text " , " label " : " '.tr('Provincia').' " , " name " : " provincia " , " maxlength " : 2 , " class " : " text-center " , " extra " : " onkeyup= \" this.value = this.value.toUpperCase(); \" " ]}
2018-04-17 23:41:56 +02:00
</ div >
</ div >
< div class = " row " >
2019-03-21 11:39:33 +01:00
< div class = " col-md-4 " >
2019-07-08 12:36:51 +02:00
{[ " type " : " select " , " label " : " '.tr('Nazione').' " , " name " : " id_nazione " , " values " : " query=SELECT id AS id, CONCAT_WS( \ ' - \ ', iso2, nome) AS descrizione FROM an_nazioni ORDER BY CASE WHEN iso2= \ 'IT \ ' THEN -1 ELSE iso2 END " ]}
2019-03-21 11:39:33 +01:00
</ div >
2018-04-17 23:41:56 +02:00
< div class = " col-md-4 " >
2018-07-03 12:28:38 +02:00
{[ " type " : " text " , " label " : " '.tr('Telefono').' " , " name " : " telefono " , " class " : " text-center " , " icon-before " : " <i class= \" fa fa-phone \" ></i> " ]}
2018-04-17 23:41:56 +02:00
</ div >
< div class = " col-md-4 " >
2018-07-03 12:28:38 +02:00
{[ " type " : " text " , " label " : " '.tr('Cellulare').' " , " name " : " cellulare " , " class " : " text-center " , " icon-before " : " <i class= \" fa fa-mobile \" ></i> " ]}
2018-04-17 23:41:56 +02:00
</ div >
2019-03-21 11:39:33 +01:00
</ div >
< div class = " row " >
2018-04-17 23:41:56 +02:00
< div class = " col-md-4 " >
2018-07-03 12:28:38 +02:00
{[ " type " : " text " , " label " : " '.tr('Email').' " , " name " : " email " , " class " : " email-mask " , " placeholder " : " casella@dominio.ext " , " icon-before " : " <i class= \" fa fa-envelope \" ></i> " ]}
2018-04-17 23:41:56 +02:00
</ div >
2019-03-21 11:39:33 +01:00
< div class = " col-md-4 " >
{[ " type " : " text " , " label " : " '.tr('PEC').' " , " name " : " pec " , " class " : " email-mask " , " placeholder " : " pec@dominio.ext " , " icon-before " : " <i class= \ 'fa fa-envelope-o \ '></i> " ]}
</ div > ' ;
2019-04-04 17:30:58 +02:00
$help_codice_destinatario = tr ( " Per impostare il codice specificare prima '<b>Tipologia</b>' e '<b>Nazione</b>' dell'anagrafica " ) . ':<br><br><ul><li>' . tr ( 'Ente pubblico (B2G/PA) - Codice Univoco Ufficio (www.indicepa.gov.it), 6 caratteri' ) . '</li><li>' . tr ( 'Azienda (B2B) - Codice Destinatario, 7 caratteri' ) . '</li><li>' . tr ( 'Privato (B2C) - viene utilizzato il Codice Fiscale' ) . '</li>' . '</ul>Se non si conosce il codice destinatario lasciare vuoto il campo. Verrà applicato in automatico quello previsto di default dal sistema (\'0000000\', \'999999\', \'XXXXXXX\').' ;
2019-03-21 11:39:33 +01:00
echo '
< div class = " col-md-4 " >
2019-10-04 13:26:47 +02:00
{[ " type " : " text " , " label " : " '.tr('Codice destinatario').' " , " name " : " codice_destinatario " , " required " : 0 , " class " : " text-center text-uppercase alphanumeric-mask " , " maxlength " : " 7 " , " extra " : " " , " help " : " '.tr( $help_codice_destinatario ).' " , " readonly " : " 1 " ]}
2019-03-21 11:39:33 +01:00
</ div >
</ div >
2018-04-17 23:41:56 +02:00
</ div >
</ div > ' ;
2018-05-14 15:40:17 +02:00
echo
' < div class = " row " >
2017-08-04 16:28:16 +02:00
< div class = " col-md-12 text-right " >
2018-02-18 19:53:23 +01: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 > ' ;
2019-01-05 09:53:17 +01:00
?>
< script >
// Abilito solo ragione sociale oppure solo nome-cognome in base a cosa compilo
2019-05-21 15:21:55 +02:00
$ ( '#nome_, #cognome' , '#bs-popup, #bs-popup2' ) . blur ( function (){
if ( $ ( '#nome_' , '#bs-popup, #bs-popup2' ) . val () == '' && $ ( '#cognome' , '#bs-popup, #bs-popup2' ) . val () == '' ){
$ ( '#nome_, #cognome' , '#bs-popup, #bs-popup2' ) . prop ( 'disabled' , true ) . prop ( 'required' , false );
2019-01-05 10:30:20 +01:00
$ ( '#ragione_sociale' , '#bs-popup, #bs-popup2' ) . prop ( 'disabled' , false ) . prop ( 'required' , true );
2019-01-05 09:53:17 +01:00
} else {
2019-05-21 15:21:55 +02:00
$ ( '#nome_, #cognome' , '#bs-popup, #bs-popup2' ) . prop ( 'disabled' , false ) . prop ( 'required' , true );
2019-01-05 10:30:20 +01:00
$ ( '#ragione_sociale' , '#bs-popup, #bs-popup2' ) . prop ( 'disabled' , true ) . prop ( 'required' , false );
2019-01-05 09:53:17 +01:00
}
});
2019-03-21 11:39:33 +01:00
$ ( '#ragione_sociale' , '#bs-popup, #bs-popup2' ) . blur ( function (){
2019-01-05 10:30:20 +01:00
if ( $ ( '#ragione_sociale' , '#bs-popup, #bs-popup2' ) . val () == '' ){
2019-05-21 15:21:55 +02:00
$ ( '#nome_, #cognome' , '#bs-popup, #bs-popup2' ) . prop ( 'disabled' , false ) . prop ( 'required' , true );
2019-01-05 10:30:20 +01:00
$ ( '#ragione_sociale' , '#bs-popup, #bs-popup2' ) . prop ( 'disabled' , true ) . prop ( 'required' , false );
2019-01-05 09:53:17 +01:00
} else {
2019-05-21 15:21:55 +02:00
$ ( '#nome_, #cognome' , '#bs-popup, #bs-popup2' ) . prop ( 'disabled' , true ) . prop ( 'required' , false );
2019-01-05 10:30:20 +01:00
$ ( '#ragione_sociale' , '#bs-popup, #bs-popup2' ) . prop ( 'disabled' , false ) . prop ( 'required' , true );
2019-01-05 09:53:17 +01:00
}
});
2019-10-04 13:26:47 +02:00
$ ( '#id_nazione' , '#bs-popup, #bs-popup2' ) . change ( function (){
if ( $ ( this ) . find ( 'option:selected' ) . data ( 'text' ) == 'IT - Italia' ){
$ ( '#codice_destinatario' , '#bs-popup, #bs-popup2' ) . removeAttr ( 'readonly' );
}
});
2019-04-09 17:58:42 +02:00
</ script >