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
2023-02-02 11:23:09 +01:00
use Carbon\Carbon ;
2024-03-05 16:01:45 +01:00
use Models\Module ;
2024-03-13 09:47:05 +01:00
use Models\Plugin ;
2024-03-22 15:52:24 +01:00
use Modules\Anagrafiche\Anagrafica ;
use Modules\Banche\Banca ;
2020-08-25 10:07:46 +02:00
2017-08-04 16:28:16 +02:00
include_once __DIR__ . '/../../core.php' ;
2020-02-05 00:31:41 +01:00
$is_fornitore = in_array ( $id_fornitore , $tipi_anagrafica );
2019-07-24 12:42:45 +02:00
$is_cliente = in_array ( $id_cliente , $tipi_anagrafica );
$is_tecnico = in_array ( $id_tecnico , $tipi_anagrafica );
2022-05-19 17:42:41 +02:00
$is_agente = in_array ( $id_agente , $tipi_anagrafica );
2023-12-13 11:41:59 +01:00
$is_azienda = in_array ( $id_azienda , $tipi_anagrafica );
2017-09-19 14:45:59 +02:00
2023-12-13 11:41:59 +01:00
if ( ! $is_cliente && ! $is_fornitore && ! $is_azienda && $is_tecnico ) {
2024-06-11 16:58:27 +02:00
$ignore = Plugin :: where ( 'name' , 'Sedi' )
-> orWhere ( 'name' , 'Referenti' )
-> orWhere ( 'name' , 'Dichiarazioni d\'intento' )
2024-03-13 09:47:05 +01:00
-> get ();
2020-01-22 11:46:08 +01:00
foreach ( $ignore as $plugin ) {
echo '
2021-10-25 11:08:03 +02:00
< script >
2024-03-13 09:47:05 +01:00
$ ( " #link-tab_'. $plugin->id .' " ) . addClass ( " disabled " );
2021-10-25 11:08:03 +02:00
</ script > ' ;
2020-01-22 11:46:08 +01:00
}
}
2019-07-24 12:42:45 +02:00
if ( ! $is_cliente ) {
2024-06-11 16:58:27 +02:00
$ignore = Plugin :: where ( 'name' , 'Impianti del cliente' )
-> orWhere ( 'name' , 'Contratti del cliente' )
-> orWhere ( 'name' , 'Ddt del cliente' )
2024-03-13 09:47:05 +01:00
-> get ();
2017-09-19 14:45:59 +02:00
2017-10-08 18:28:26 +02:00
foreach ( $ignore as $plugin ) {
2017-09-19 14:45:59 +02:00
echo '
2021-10-25 11:08:03 +02:00
< script >
$ ( " #link-tab_'. $plugin['id'] .' " ) . addClass ( " disabled " );
</ script > ' ;
2017-09-19 14:45:59 +02:00
}
}
2020-09-23 18:36:33 +02:00
$nazione_anagrafica = $anagrafica -> sedeLegale -> nazione ;
2020-12-29 00:39:30 +01:00
// Avvisi problemi scheda anagrafica
$problemi_anagrafica = [];
2021-02-18 18:48:44 +01:00
if ( $is_cliente && empty ( $record [ 'idconto_cliente' ])) {
2021-07-14 17:18:41 +02:00
$problemi_anagrafica [] = '<div class="row" style="margin-bottom:5px;"><div class="col-md-3">' . tr ( 'Piano dei conti mancante per il cliente' ) . '</div><button type="button" class="btn btn-xs btn-success" onclick="risolviConto(\'cliente\')"><i class="fa fa-cog"></i> ' . tr ( 'Risolvi' ) . '</button></div>' ;
2020-12-29 00:39:30 +01:00
}
2021-02-18 18:48:44 +01:00
if ( $is_fornitore && empty ( $record [ 'idconto_fornitore' ])) {
2021-07-14 17:18:41 +02:00
$problemi_anagrafica [] = '<div class="row"><div class="col-md-3">' . tr ( 'Piano dei conti mancante per il fornitore' ) . '</div><button type="button" class="btn btn-xs btn-success" onclick="risolviConto(\'fornitore\')"><i class="fa fa-cog"></i> ' . tr ( 'Risolvi' ) . '</button></div>' ;
2020-12-29 00:39:30 +01:00
}
if ( sizeof ( $problemi_anagrafica ) > 0 ) {
2021-07-14 17:18:41 +02:00
echo '<div class="alert alert-warning"><i class="fa fa-warning"></i> ' . tr ( 'ATTENZIONE: <br>_CAMPI_' , [
2023-08-08 17:04:47 +02:00
'_CAMPI_' => implode ( '' , $problemi_anagrafica ),
2020-12-29 00:39:30 +01:00
]) . '</div>' ;
}
2017-09-22 12:31:06 +02:00
?>
2017-08-04 16:28:16 +02:00
2021-04-16 13:09:12 +02:00
< form action = " " method = " post " id = " edit-form " >
2023-08-08 17:04:47 +02:00
< fieldset >
< input type = " hidden " name = " backto " value = " record-edit " >
< input type = " hidden " name = " op " value = " update " >
<!-- DATI ANAGRAFICI -->
2024-05-16 18:02:50 +02:00
< div class = " card card-primary " >
< div class = " card-header " >
< h3 class = " card-title " >< ? php echo tr ( 'Dati anagrafici' ); ?> </h3>
2023-08-08 17:04:47 +02:00
</ div >
2024-05-16 18:02:50 +02:00
< div class = " card-body " >
2023-08-08 17:04:47 +02:00
< div class = " row " >
< div class = " col-md-6 " >
{[ " type " : " text " , " label " : " <?php echo tr('Denominazione'); ?> " , " name " : " ragione_sociale " , " required " : 1 , " value " : " $ragione_sociale $ " , " extra " : " " ]}
</ div >
< div class = " col-md-3 " >
2021-02-01 12:07:38 +01:00
{[ " type " : " text " , " label " : " <?php echo tr('Partita IVA'); ?> " , " maxlength " : 16 , " name " : " piva " , " class " : " text-center alphanumeric-mask text-uppercase " , " value " : " $piva $ " , " validation " : " partita_iva " ]}
2019-01-04 19:23:28 +01:00
</ div >
2019-01-05 09:53:17 +01:00
2023-08-08 17:04:47 +02:00
< div class = " col-md-3 " >
2024-03-22 15:52:24 +01:00
{[ " type " : " select " , " label " : " <?php echo tr('Tipologia'); ?> " , " name " : " tipo " , " values " : " list= \" Azienda \" : \" <?php echo tr('Azienda'); ?> \" , \" Ente pubblico \" : \" <?php echo tr('Ente pubblico'); ?> \" <?php echo $anagrafica->isAzienda () ? '' : ', \" Privato \" : \" '.tr('Privato').' \" '; ?> " , " value " : " $tipo $ " , " placeholder " : " <?php echo tr('Non specificato'); ?> " ]}
2023-08-08 17:04:47 +02:00
</ div >
</ div >
2019-01-05 09:53:17 +01:00
2023-08-08 17:04:47 +02:00
< div class = " row " >
2019-08-29 15:09:01 +02:00
2023-08-08 17:04:47 +02:00
< div class = " col-md-4 " >
{[ " type " : " text " , " label " : " <?php echo tr('Cognome'); ?> " , " name " : " cognome " , " required " : 0 , " value " : " $cognome $ " , " extra " : " " ]}
</ div >
2019-01-05 09:53:17 +01:00
2023-08-08 17:04:47 +02:00
< div class = " col-md-4 " >
{[ " type " : " text " , " label " : " <?php echo tr('Nome'); ?> " , " name " : " nome " , " required " : 0 , " value " : " $nome $ " , " extra " : " " ]}
</ div >
2019-01-05 09:53:17 +01:00
2023-08-08 17:04:47 +02:00
< div class = " col-md-4 " >
2019-07-05 12:28:19 +02:00
{[ " type " : " text " , " label " : " <?php echo tr('Codice fiscale'); ?> " , " maxlength " : 16 , " name " : " codice_fiscale " , " class " : " text-center alphanumeric-mask text-uppercase " , " value " : " $codice_fiscale $ " , " validation " : " codice_fiscale " ]}
2019-01-04 19:23:28 +01:00
</ div >
2019-01-05 09:53:17 +01:00
2023-08-08 17:04:47 +02:00
</ div >
2018-11-09 11:34:27 +01:00
2024-05-16 18:02:50 +02:00
<!-- RIGA PER LE ANAGRAFICHE CON TIPOLOGIA 'PRIVATO' -->
< ? php if ( $record [ 'tipo' ] == 'Privato' ) { ?>
< div class = " row " >
< div class = " col-md-4 " >
{[ " type " : " text " , " label " : " <?php echo tr('Luogo di nascita'); ?> " , " name " : " luogo_nascita " , " value " : " $luogo_nascita $ " ]}
</ div >
< div class = " col-md-4 " >
{[ " type " : " date " , " label " : " <?php echo tr('Data di nascita'); ?> " , " name " : " data_nascita " , " value " : " $data_nascita $ " ]}
</ div >
< div class = " col-md-4 " >
{[ " type " : " select " , " label " : " <?php echo tr('Sesso'); ?> " , " name " : " sesso " , " values " : " list= \" \" : \" Non specificato \" , \" M \" : \" <?php echo tr('Uomo'); ?> \" , \" F \" : \" <?php echo tr('Donna'); ?> \" " , " value " : " $sesso $ " ]}
</ div >
</ div >
< ? php } ?>
< div class = " row " >
< div class = " col-md-2 " >
{[ " type " : " text " , " label " : " <?php echo tr('Codice anagrafica'); ?> " , " name " : " codice " , " required " : 1 , " class " : " text-center alphanumeric-mask " , " value " : " $codice $ " , " maxlength " : 20 , " validation " : " codice " ]}
</ div >
< div class = " col-md-2 " >
< ? php
2024-01-15 15:30:45 +01:00
$help_codice_destinatario = tr ( " Per impostare il codice specificare prima il campo '_NATION_' dell'anagrafica " , [
'_NATION_' => '<b>Nazione</b>' ,
]) . ' :< br >< br >< ul >
2019-01-06 14:18:48 +01:00
< li > '.tr(' Azienda ( B2B ) - Codice Destinatario , 7 caratteri ').' </ li >
2024-02-25 11:24:18 +01:00
< li > '.tr(' Ente pubblico ( B2G / PA ) - Codice Univoco Ufficio ( www . indicepa . gov . it ), 6 caratteri ').' </ li >
2020-03-16 10:54:25 +01:00
< li > '.tr(' Privato ( B2C ) - viene utilizzato il Codice Fiscale ').' </ li ></ ul >
'.tr(' Se non si conosce il codice destinatario lasciare vuoto il campo , e verrà applicato in automatico quello previsto di default dal sistema ( \ '0000000\', \'999999\', \'XXXXXXX\')' ) . '.' ;
2019-01-06 14:18:48 +01:00
2024-01-15 15:30:45 +01:00
if ( in_array ( $id_azienda , $tipi_anagrafica )) {
2024-03-22 15:52:24 +01:00
$help_codice_destinatario .= ' <br><b>' . tr ( 'Attenzione' ) . ': </b>' . tr ( " Non è necessario comunicare il proprio codice destinatario ai fornitori in quanto è sufficiente che questo sia registrato all'interno portale del Sistema Di Interscambio dell'Agenzia Entrate (SDI) (ivaservizi.agenziaentrate.gov.it) " ) . '.' ;
2024-02-20 16:33:44 +01:00
}
2024-01-15 15:30:45 +01:00
?>
2024-02-25 13:22:06 +01:00
{[ " type " : " text " , " label " : " <?php echo ( $record['tipo'] == 'Ente pubblico') ? tr('Codice unico ufficio') : tr('Codice destinatario'); ?> " , " name " : " codice_destinatario " , " required " : 0 , " class " : " text-center text-uppercase alphanumeric-mask " , " value " : " $codice_destinatario $ " , " maxlength " : < ? php echo ( $record [ 'tipo' ] == 'Ente pubblico' ) ? '6' : '7' ; ?> , "help": "<?php echo tr($help_codice_destinatario); ?>", "readonly": "<?php echo intval($nazione_anagrafica ? !(($nazione_anagrafica->iso2 === 'IT') || ($nazione_anagrafica->iso2 === 'SM')) : 0); ?>", "validation": "codice_intermediario" ]}
2023-08-08 17:04:47 +02:00
</ div >
2018-11-09 11:34:27 +01:00
2018-09-26 09:23:42 +02:00
< div class = " col-md-4 " >
2023-08-08 17:04:47 +02:00
{[ " type " : " text " , " label " : " <?php echo tr('PEC'); ?> " , " name " : " pec " , " class " : " email-mask " , " placeholder " : " pec@dominio.ext " , " value " : " $pec $ " , " icon-before " : " <i class='fa fa-envelope-o'></i> " , " validation " : " email " ]}
</ div >
2017-08-04 16:28:16 +02:00
2023-08-08 17:04:47 +02:00
< div class = " col-md-4 " >
{[ " type " : " text " , " label " : " <?php echo tr('Sito web'); ?> " , " name " : " sitoweb " , " placeholder " : " www.dominio.ext " , " value " : " $sitoweb $ " , " icon-before " : " <i class='fa fa-globe'></i> " ]}
</ div >
</ div >
2018-09-24 18:10:16 +02:00
</ div >
</ div >
2020-08-19 17:29:42 +02:00
< div class = " row " >
< div class = " col-md-8 " >
2024-05-16 18:02:50 +02:00
< div class = " card card-primary " >
< div class = " card-header " >
< h3 class = " card-title " >< ? php echo tr ( 'Sede legale' ); ?> </h3>
2020-08-19 17:29:42 +02:00
</ div >
2024-05-16 18:02:50 +02:00
< div class = " card-body " >
2018-11-09 11:34:27 +01:00
2020-08-19 17:29:42 +02:00
< div class = " row " >
< div class = " col-md-<?php echo (empty( $record['indirizzo2'] )) ? '10' : '8'; ?> " >
{[ " type " : " text " , " label " : " <?php echo tr('Indirizzo'); ?> " , " name " : " indirizzo " , " value " : " $indirizzo $ " ]}
</ div >
2018-11-09 11:34:27 +01:00
2020-08-19 17:29:42 +02:00
< div class = " col-md-2<?php echo (empty( $record['indirizzo2'] )) ? ' hide' : ''; ?> " >
{[ " type " : " text " , " label " : " <?php echo tr('Civico'); ?> " , " name " : " indirizzo2 " , " value " : " $indirizzo2 $ " ]}
</ div >
2018-11-09 11:34:27 +01:00
2020-08-19 17:29:42 +02:00
< div class = " col-md-2 " >
2021-02-01 12:07:38 +01:00
{[ " type " : " text " , " label " : " <?php echo tr('C.A.P.'); ?> " , " name " : " cap " , " maxlength " : 6 , " class " : " text-center " , " value " : " $cap $ " ]}
2020-08-19 17:29:42 +02:00
</ div >
</ div >
2018-09-24 18:10:16 +02:00
2020-08-19 17:29:42 +02:00
< div class = " row " >
< div class = " col-md-4 " >
{[ " type " : " text " , " label " : " <?php echo tr('Città'); ?> " , " name " : " citta " , " class " : " text-center " , " value " : " $citta $ " ]}
</ div >
2018-11-09 11:34:27 +01:00
2020-08-19 17:29:42 +02:00
< div class = " col-md-4 " >
2022-12-16 00:10:47 +01:00
{[ " type " : " text " , " label " : " <?php echo tr('Provincia'); ?> " , " name " : " provincia " , " class " : " text-center provincia-mask text-uppercase " , " value " : " $provincia $ " , " extra " : " onkeyup= \" this.value = this.value.toUpperCase(); \" " ]}
2020-08-19 17:29:42 +02:00
</ div >
2018-09-24 18:10:16 +02:00
2020-08-19 17:29:42 +02:00
< div class = " col-md-4 " >
{[ " type " : " select " , " label " : " <?php echo tr('Nazione'); ?> " , " name " : " id_nazione " , " value " : " $id_nazione $ " , " ajax-source " : " nazioni " ]}
</ div >
</ div >
2018-09-24 18:10:16 +02:00
2020-08-19 17:29:42 +02:00
< div class = " row " >
< div class = " col-md-4 " >
2023-10-06 12:44:54 +02:00
{[ " type " : " telefono " , " label " : " <?php echo tr('Telefono'); ?> " , " name " : " telefono " , " class " : " text-center " , " value " : " $telefono $ " ]}
2020-08-19 17:29:42 +02:00
</ div >
2018-09-24 18:10:16 +02:00
2020-08-19 17:29:42 +02:00
< div class = " col-md-4 " >
2024-05-23 11:36:25 +02:00
{[ " type " : " telefono " , " label " : " <?php echo tr('Cellulare'); ?> " , " name " : " cellulare " , " class " : " text-center " , " value " : " $cellulare $ " , " icon-after " : " <?php echo !empty( $record['cellulare'] ) ? " < btn class = 'clickable' onclick = sendWhatsAppMessage ( " .prepare( $record['cellulare'] ). " ) >< i class = 'fa fa-whatsapp tip' title = '".((str_starts_with((string) $record[' cellulare '], ' + ')) ? substr((string) $record[' cellulare '], 1) : $record[' cellulare '])."' ></ i > " : " < i class = 'fa fa-whatsapp tip' title = '".tr(' Compila il campo per utilizzare WhatsApp . ')."' ></ i > " ; ?> " ]}
2020-08-19 17:29:42 +02:00
</ div >
2018-09-24 18:10:16 +02:00
2020-08-19 17:29:42 +02:00
< div class = " col-md-4 " >
2021-11-22 11:35:20 +01:00
{[ " type " : " text " , " label " : " <?php echo tr('Email'); ?> " , " name " : " email " , " class " : " email-mask " , " placeholder " : " casella@dominio.ext " , " value " : " $email $ " , " icon-before " : " <i class='fa fa-envelope'></i> " , " validation " : " email " ]}
2020-08-19 17:29:42 +02:00
</ div >
</ div >
2018-09-24 18:10:16 +02:00
2020-08-19 17:29:42 +02:00
< div class = " row " >
< div class = " col-md-4 " >
{[ " type " : " text " , " label " : " <?php echo tr('Fax'); ?> " , " name " : " fax " , " class " : " text-center " , " value " : " $fax $ " , " icon-before " : " <i class='fa fa-fax'></i> " ]}
</ div >
< div class = " col-md-4 " >
2024-06-25 09:40:41 +02:00
{[ " type " : " select " , " label " : " <?php echo tr('Zona'); ?> " , " name " : " idzona " , " values " : " query=SELECT id, CONCAT_WS( ' - ', nome, descrizione) AS descrizione FROM an_zone ORDER BY descrizione ASC " , " value " : " $idzona $ " , " placeholder " : " <?php echo tr('Nessuna zona'); ?> " , " icon-after " : " add|<?php echo Module::where('name', 'Zone')->first()->id; ?> " ]}
2020-08-19 17:29:42 +02:00
</ div >
2018-09-24 18:10:16 +02:00
2020-08-19 17:29:42 +02:00
< div class = " col-md-4 " >
2024-07-25 12:40:22 +02:00
{[ " type " : " number " , " label " : " <?php echo tr('Distanza'); ?> " , " name " : " km " , " decimals " : " qta " , " class " : " text-center " , " value " : " $km $ " , " icon-after " : " Km " ]}
2020-08-19 17:29:42 +02:00
</ div >
</ div >
2023-08-08 17:04:47 +02:00
2022-03-08 15:44:13 +01:00
< div class = " row " >
2024-06-29 20:34:36 +02:00
< div class = " col-md-4 " >
2022-03-08 15:44:13 +01:00
{[ " type " : " checkbox " , " label " : " <?php echo tr('Opt-out per newsletter'); ?> " , " name " : " disable_newsletter " , " value " : " <?php echo empty( $record['enable_newsletter'] ); ?> " , " help " : " <?php echo tr('Blocco per l \ 'invio delle email.'); ?> " ]}
</ div >
</ div >
2020-08-19 17:29:42 +02:00
</ div >
2018-09-24 18:10:16 +02:00
</ div >
</ div >
2018-09-26 09:23:42 +02:00
2023-08-08 17:04:47 +02:00
< ? php
$sede_cliente = $anagrafica -> sedeLegale ;
2020-08-25 10:07:46 +02:00
2024-01-15 15:30:45 +01:00
$anagrafica_azienda = Anagrafica :: find ( setting ( 'Azienda predefinita' ));
$sede_azienda = $anagrafica_azienda -> sedeLegale ;
2020-08-25 10:07:46 +02:00
2024-01-15 15:30:45 +01:00
echo '
2020-08-19 17:29:42 +02:00
< div class = " col-md-4 " >
2024-05-16 18:02:50 +02:00
< div class = " card card-primary " >
< div class = " card-header " >
< h3 class = " card-title " > '.tr(' Geolocalizzazione ').' </ h3 >
2018-09-26 09:23:42 +02:00
</ div >
2024-05-16 18:02:50 +02:00
< div class = " card-body " > ' ;
2023-08-04 14:54:28 +02:00
2024-01-15 15:30:45 +01:00
// Area caricamento mappa
echo '
2023-06-29 09:49:21 +02:00
< div id = " map-edit " style = " width: 100%; " ></ div >
2018-09-26 09:23:42 +02:00
2020-08-19 17:29:42 +02:00
< div class = " clearfix " ></ div >
< br > ' ;
2024-01-15 15:30:45 +01:00
if ( ! empty ( $sede_cliente -> gaddress ) || ( ! empty ( $sede_cliente -> lat ) && ! empty ( $sede_cliente -> lng ))) {
// Modifica manuale delle informazioni
echo '
2023-06-29 09:49:21 +02:00
< a class = " btn btn-info btn-block " onclick = " modificaPosizione() " >
2023-08-04 14:54:28 +02:00
< i class = " fa fa-map " ></ i > '.tr(' Aggiorna posizione ').'
2020-08-24 17:22:52 +02:00
</ a > ' ;
2024-01-15 15:30:45 +01:00
} else {
// Definizione manuale delle informazioni
echo '
2022-06-15 19:43:44 +02:00
< a class = " btn btn-primary btn-block " onclick = " modificaPosizione() " >
2023-08-04 14:54:28 +02:00
< i class = " fa fa-map " ></ i > '.tr(' Definisci posizione ').'
2022-06-15 19:43:44 +02:00
</ a > ' ;
2024-01-15 15:30:45 +01:00
}
2020-08-24 17:22:52 +02:00
2024-01-15 15:30:45 +01:00
// Navigazione diretta verso l'indirizzo
echo '
2023-08-04 14:54:28 +02:00
< a class = " btn btn-info btn-block '.((empty( $sede_cliente->lat ) && empty( $sede_cliente->lng )) ? 'disabled' : '').' " onclick = " $ ( \ '#map-edit \ ').height(235); caricaMappa(); $ (this).hide(); " >
< i class = " fa fa-compass " ></ i > '.tr(' Carica mappa ').'
2023-08-03 18:15:54 +02:00
</ a > ' ;
2024-01-15 15:30:45 +01:00
// Navigazione diretta verso l'indirizzo
echo '
2023-10-13 14:57:59 +02:00
< a class = " btn btn-info btn-block '.(( $anagrafica->isAzienda () || (empty( $sede_cliente->lat ) || empty( $sede_cliente->lng )) || (empty( $sede_azienda->lat ) || empty( $sede_azienda->lng ))) ? 'disabled' : '').' " onclick = " calcolaPercorso() " >
2020-08-24 17:22:52 +02:00
< i class = " fa fa-map-signs " ></ i > '.tr(' Calcola percorso ').'
2023-10-13 14:57:59 +02:00
'.((!empty($sede_cliente->lat) && !empty($sede_azienda->lat)) ? tr(' ( GPS ) ') : ' ').'
2020-08-19 17:29:42 +02:00
</ a > ' ;
2024-01-15 15:30:45 +01:00
// Ricerca diretta su Mappa
echo '
2023-06-15 14:09:04 +02:00
< a class = " btn btn-info btn-block " onclick = " cercaOpenStreetMap() " >
< i class = " fa fa-map-marker " ></ i > '.tr(' Cerca su Mappa ').'
2023-10-13 14:57:59 +02:00
'.((!empty($sede_cliente->lat)) ? tr(' ( GPS ) ') : ' ').'
2020-08-19 17:29:42 +02:00
</ a > ' ;
2018-09-26 09:23:42 +02:00
2024-01-15 15:30:45 +01:00
echo '
2020-08-19 17:29:42 +02:00
</ div >
</ div >
</ div >
2018-09-24 18:10:16 +02:00
</ div >
2020-08-19 17:29:42 +02:00
< script >
function modificaPosizione () {
openModal ( " '.tr('Modifica posizione').' " , " '. $module->fileurl ('modals/posizione.php').'?id_module='. $id_module .'&id_record='. $id_record .' " );
}
2023-06-15 14:09:04 +02:00
function cercaOpenStreetMap () {
2020-08-25 10:07:46 +02:00
const indirizzo = getIndirizzoAnagrafica ();
2023-10-13 14:57:59 +02:00
const destinazione = ( ! isNaN ( indirizzo [ 0 ]) && ! isNaN ( indirizzo [ 1 ])) ? indirizzo [ 0 ] + " , " + indirizzo [ 1 ] : indirizzo [ 2 ];
if ( isMobile . any ) {
window . open ( " geo: " + destinazione + " ?z=16&q= " + destinazione );
} else {
if ( ! isNaN ( indirizzo [ 0 ]) && ! isNaN ( indirizzo [ 1 ])) {
window . open ( " https://www.openstreetmap.org/?mlat= " + indirizzo [ 0 ] + " &mlon= " + indirizzo [ 1 ] + " #map=12/ " + destinazione + " / " + indirizzo [ 1 ]);
2023-10-13 10:41:31 +02:00
} else {
2023-10-13 14:57:59 +02:00
window . open ( " https://www.openstreetmap.org/search?query= " + indirizzo [ 2 ] + " #map=12 " );
2023-10-13 10:41:31 +02:00
}
2023-06-15 14:09:04 +02:00
}
2020-08-19 17:29:42 +02:00
}
function calcolaPercorso () {
2020-08-25 10:07:46 +02:00
const indirizzo_partenza = getIndirizzoAzienda ();
const indirizzo_destinazione = getIndirizzoAnagrafica ();
2023-10-13 10:41:31 +02:00
2023-10-13 14:57:59 +02:00
const destinazione = ( ! isNaN ( indirizzo_destinazione [ 0 ]) && ! isNaN ( indirizzo_destinazione [ 1 ])) ? indirizzo_destinazione [ 0 ] + " , " + indirizzo_destinazione [ 1 ] : indirizzo_destinazione [ 2 ];
2023-10-13 10:41:31 +02:00
if ( isMobile . any ) {
2023-10-13 14:57:59 +02:00
window . open ( " geo: " + destinazione + " ?z=16&q= " + destinazione );
2023-10-13 10:41:31 +02:00
} else {
2023-10-13 14:57:59 +02:00
window . open ( " https://www.openstreetmap.org/directions?engine=fossgis_osrm_car&route= " + indirizzo_partenza + " ; " + destinazione );
2023-10-13 10:41:31 +02:00
}
2020-08-25 10:07:46 +02:00
}
function getIndirizzoAzienda () {
const indirizzo = " '. $sede_azienda->indirizzo .' " ;
const citta = " '. $sede_azienda->citta .' " ;
const lat = parseFloat ( " '. $sede_azienda->lat .' " );
const lng = parseFloat ( " '. $sede_azienda->lng .' " );
2023-10-13 14:57:59 +02:00
return lat + " , " + lng ;
2020-08-25 10:07:46 +02:00
}
function getIndirizzoAnagrafica () {
const indirizzo = $ ( " #indirizzo " ) . val ();
const citta = $ ( " #citta " ) . val ();
const lat = parseFloat ( " '. $sede_cliente->lat .' " );
const lng = parseFloat ( " '. $sede_cliente->lng .' " );
const indirizzo_default = encodeURI ( indirizzo ) + " , " + encodeURI ( citta );
2023-06-15 14:09:04 +02:00
return [ lat , lng , indirizzo_default ];
2020-08-19 17:29:42 +02:00
}
2023-06-29 09:49:21 +02:00
var map = null ;
2020-09-07 10:34:42 +02:00
function caricaMappa () {
2023-06-15 14:09:04 +02:00
const lat = parseFloat ( " '. $sede_cliente->lat .' " );
2023-08-04 14:54:28 +02:00
const lng = parseFloat ( " '. $sede_cliente->lng .' " );
2023-08-03 17:40:09 +02:00
2023-08-08 15:33:28 +02:00
if ( ! lat || ! lng ){
2023-08-04 14:54:28 +02:00
swal ( " '.tr('Errore').' " , " '.tr('La posizione non è stata definita. Impossibile caricare la mappa.').' " , " error " );
2023-08-03 17:40:09 +02:00
return false ;
}
2023-06-29 09:49:21 +02:00
var container = L . DomUtil . get ( " map-edit " );
if ( container . _leaflet_id != null ){
map . eachLayer ( function ( layer ) {
if ( layer instanceof L . Marker ) {
map . removeLayer ( layer );
}
});
} else {
map = L . map ( " map-edit " , {
gestureHandling : true
});
2023-08-04 14:54:28 +02:00
L . tileLayer ( " '.setting('Tile server OpenStreetMap').' " , {
2023-06-29 09:49:21 +02:00
maxZoom : 17 ,
attribution : " © OpenStreetMap "
2024-06-30 14:48:45 +02:00
}) . addTo ( map );
2023-06-29 09:49:21 +02:00
}
2023-06-15 14:09:04 +02:00
var icon = new L . Icon ({
iconUrl : globals . rootdir + " /assets/dist/img/marker-icon.png " ,
shadowUrl : globals . rootdir + " /assets/dist/img/leaflet/marker-shadow.png " ,
iconSize : [ 25 , 41 ],
iconAnchor : [ 12 , 41 ],
popupAnchor : [ 1 , - 34 ],
shadowSize : [ 41 , 41 ]
});
var marker = L . marker ([ lat , lng ], {
icon : icon
}) . addTo ( map );
2024-06-30 14:48:45 +02:00
L . control
. fullscreen ({
position : " topright " ,
title : " '.tr('Vai a schermo intero').' " ,
titleCancel : " '.tr('Esci dalla modalità schermo intero').' " ,
content : null ,
forceSeparateButton : true ,
forcePseudoFullscreen : true ,
fullscreenElement : false
}) . addTo ( map );
2023-06-29 09:49:21 +02:00
2024-06-30 14:48:45 +02:00
map . setView ([ lat , lng ], 14 );
2020-09-07 10:34:42 +02:00
}
2021-07-14 17:18:41 +02:00
function risolviConto ( tipo ){
$ . ajax ({
url : globals . rootdir + " /actions.php " ,
type : " POST " ,
dataType : " json " ,
data : {
id_module : globals . id_module ,
id_record : globals . id_record ,
tipo : tipo ,
op : " risolvi_conto " ,
},
success : function ( response ) {
location . reload ();
},
error : function () {
location . reload ();
}
});
2021-07-27 18:11:54 +02:00
}
2021-07-14 17:18:41 +02:00
2020-08-19 17:29:42 +02:00
</ script > ' ;
2018-10-18 17:55:59 +02:00
2024-01-15 15:30:45 +01:00
if ( $is_cliente or $is_fornitore or $is_tecnico ) {
echo '
2018-03-29 00:26:23 +02:00
2024-06-29 20:33:14 +02:00
< div class = " card card-primary " >
2024-06-12 10:08:32 +02:00
< div class = " card-header " >
< h3 class = " card-title " > '.tr(' Informazioni per tipo di anagrafica ').' </ h3 >
</ div >
2019-02-18 09:25:18 +01:00
2024-06-12 10:08:32 +02:00
< div class = " card-body " >
< div class = " nav-tabs-custom " >
< ul class = " nav nav-tabs nav-justified " >
< li class = " nav-item '.( $is_cliente ? 'active " ' : ' " ').'><a href= " #cliente" data-card-widget="tab" class="nav-link '.($is_cliente ? '' : 'disabled').'" '.($is_cliente ? '' : 'disabled').'>'.tr('Cliente').'</a></li>
2020-03-16 10:54:25 +01:00
2024-06-12 10:08:32 +02:00
< li class = " nav-item '.(! $is_cliente && $is_fornitore ? 'active " ' : ' " ').'><a href= " #fornitore" data-card-widget="tab" class="nav-link '.($is_fornitore ? '' : 'disabled').'" '.($is_fornitore ? '' : 'disabled').'>'.tr('Fornitore').'</a></li>
2020-03-16 10:54:25 +01:00
2024-07-10 17:27:07 +02:00
< li class = " nav-item " >< a href = " #cliente_fornitore " data - card - widget = " tab " class = " nav-link '.( $is_cliente || $is_fornitore ? '' : 'disabled').' " '.($is_cliente || $is_fornitore ? ' ' : ' disabled ').' > '.tr(' Cliente e fornitore ').' </ a ></ li >
2019-09-18 11:31:49 +02:00
2024-06-12 10:08:32 +02:00
< li class = " nav-item'.(! $is_cliente && ! $is_fornitore && $is_tecnico ? 'active " ' : ' " ').'><a href= " #tecnico" data-card-widget="tab" class="nav-link '.($is_tecnico ? '' : 'disabled').'" '.($is_tecnico ? '' : 'disabled').'>'.tr('Tecnico').'</a></li>
</ ul >
2020-03-16 10:54:25 +01:00
2024-06-12 10:08:32 +02:00
< div class = " tab-content '.(! $is_cliente && ! $is_fornitore && ! $is_tecnico ? 'hide' : '').' " >
< div class = " tab-pane '.(! $is_cliente && ! $is_fornitore ? ' hide' : '').' " id = " cliente_fornitore " >
< div class = " row " >
< div class = " col-md-3 " >
{[ " type " : " checkbox " , " label " : " '.tr('Abilitare lo split payment').' " , " name " : " split_payment " , " value " : " $split_payment $ " , " help " : " '.tr('Lo split payment è disponibile per le anagrafiche di tipologia \" Ente pubblico \" o \" Azienda \" (iscritta al Dipartimento Finanze - Scissione dei pagamenti) ed <strong>è obbligatorio</strong> per:<ul><li>Stato;</li><li>organi statali ancorché dotati di personalità giuridica;</li><li>enti pubblici territoriali e dei consorzi tra essi costituiti;</li><li>Camere di Commercio;</li><li>Istituti universitari;</li><li>ASL e degli enti ospedalieri;</li><li>enti pubblici di ricovero e cura aventi prevalente carattere scientifico;</li><li>enti pubblici di assistenza e beneficienza;</li><li>enti di previdenza;</li><li>consorzi tra questi costituiti.</li></ul>').' " , " placeholder " : " '.tr('Split payment').' " , " extra " : " '.( $record['tipo'] == 'Ente pubblico' || $record['tipo'] == 'Azienda' ? '' : 'disabled').' " ]}
</ div >
2020-03-16 10:54:25 +01:00
2024-07-10 17:27:07 +02:00
< div class = " col-md-6 " >
2024-06-12 10:08:32 +02:00
{[ " type " : " text " , " label " : " '.tr('Dicitura fissa in fattura').' " , " name " : " diciturafissafattura " , " value " : " $diciturafissafattura $ " ]}
</ div >
2019-07-24 12:42:45 +02:00
</ div >
2023-01-20 13:10:00 +01:00
2024-06-12 10:08:32 +02:00
< div class = " row " >
</ div > ' ;
2020-09-24 16:41:43 +02:00
2024-01-15 15:30:45 +01:00
$banche = Banca :: where ( 'id_anagrafica' , $anagrafica -> id ) -> get ();
2024-04-09 12:18:08 +02:00
$banca_predefinita = $banche -> first ( fn ( $item ) => ! empty ( $item [ 'predefined' ]));
2024-06-11 16:58:27 +02:00
$modulo_banche = Module :: where ( 'name' , 'Banche' ) -> first () -> id ;
2024-01-15 15:30:45 +01:00
if ( ! $banche -> isEmpty ()) {
echo '
2024-06-12 10:08:32 +02:00
< div class = " row " >
< div class = " col-md-6 " >
< a href = " '.base_path().'/editor.php?id_module='. $modulo_banche .'&id_record='. $banca_predefinita->id .' " >
'.tr("Visualizza la banca predefinita per l' Anagrafica " ).' <i class= " fa fa - external - link " ></i>
</ a >
</ div >
< div class = " col-md-6 " >
< a href = " '.base_path().'/controller.php?id_module='. $modulo_banche .'&search_Anagrafica='.rawurlencode((string) $anagrafica['ragione_sociale'] ).' " >
'.tr("Visualizza le banche disponibili per l' Anagrafica " ).' <i class= " fa fa - external - link " ></i>
</ a >
</ div >
</ div > ' ;
2024-01-15 15:30:45 +01:00
} else {
echo '
2024-06-12 10:08:32 +02:00
< div class = " alert alert-info " >
'.tr(' Non sono presenti banche per l\ 'anagrafica' ) . '... ' . Modules :: link ( 'Banche' , null , tr ( 'Creane una' )) . '
</ div > ' ;
2024-01-15 15:30:45 +01:00
}
2019-02-18 09:25:18 +01:00
2024-01-15 15:30:45 +01:00
echo '
2019-07-24 12:42:45 +02:00
</ div >
2020-03-16 10:54:25 +01:00
2024-06-12 10:08:32 +02:00
< div class = " tab-pane '.(! $is_cliente ? 'hide' : 'active').' " id = " cliente " >
< div class = " row " >
< div class = " col-md-6 " >
{[ " type " : " select " , " label " : " '.tr('Provenienza cliente').' " , " name " : " id_provenienza " , " ajax-source " : " provenienze " , " value " : " $id_provenienza $ " , " icon-after " : " add|'.Module::where('name', 'Provenienze')->first()->id.' " ]}
</ div >
< div class = " col-md-6 " >
{[ " type " : " select " , " label " : " '.tr('Pagamento predefinito').' " , " name " : " idpagamento_vendite " , " values " : " query=SELECT `co_pagamenti`.`id`, `co_pagamenti_lang`.`title` AS descrizione FROM `co_pagamenti` LEFT JOIN `co_pagamenti_lang` ON (`co_pagamenti`.`id` = `co_pagamenti_lang`.`id_record` AND `co_pagamenti_lang`.`id_lang` = '.prepare(Models \ Locale::getDefault()->id).') GROUP BY `descrizione` ORDER BY `descrizione` ASC " , " value " : " $idpagamento_vendite $ " ]}
</ div >
2019-07-24 12:42:45 +02:00
</ div >
2020-03-16 10:54:25 +01:00
2024-06-12 10:08:32 +02:00
< div class = " row " >
< div class = " col-md-6 " >
{[ " type " : " select " , " label " : " '.tr('Banca predefinita per accrediti').' " , " name " : " idbanca_vendite " , " ajax-source " : " banche " , " select-options " : '.json_encode([' id_anagrafica ' => $anagrafica_azienda->id]).' , " value " : " $idbanca_vendite $ " , " help " : " '.tr( " Banca predefinita dell 'Azienda su cui accreditare i pagamenti").' " ]}
</ div >
< div class = " col-md-6 " >
{[ " type " : " select " , " label " : " '.tr('Iva predefinita').' " , " name " : " idiva_vendite " , " ajax-source " : " iva " , " value " : " $idiva_vendite $ " ]}
</ div >
2019-07-24 12:42:45 +02:00
</ div >
2020-03-16 10:54:25 +01:00
2024-06-12 10:08:32 +02:00
< div class = " row " >
< div class = " col-md-6 " >
{[ " type " : " select " , " label " : " '.tr( " Ritenuta d 'acconto predefinita").' " , " name " : " id_ritenuta_acconto_vendite " , " values " : " query = SELECT id , descrizione FROM co_ritenutaacconto ORDER BY descrizione ASC " , " value " : " $id_ritenuta_acconto_vendite $ " ]}
</ div >
< div class = " col-md-6 " >
{[ " type " : " select " , " label " : " '.tr('Piano di sconto/magg. su articoli').' " , " name " : " id_piano_sconto_vendite " , " values " : " query=SELECT id, nome AS descrizione FROM mg_piani_sconto ORDER BY nome ASC " , " value " : " $id_piano_sconto_vendite $ " ]}
</ div >
2020-07-27 15:40:54 +02:00
</ div >
2024-06-12 10:08:32 +02:00
< div class = " row " >
< div class = " col-md-6 " >
{[ " type " : " select " , " label " : " '.tr('Indirizzo di fatturazione').' " , " name " : " idsede_fatturazione " , " values " : " query=SELECT id, IF(citta = \ ' \ ', nomesede, CONCAT_WS( \ ', \ ', nomesede, citta)) AS descrizione FROM an_sedi WHERE idanagrafica='.prepare( $id_record ).' UNION SELECT \ '0 \ ' AS id, \ 'Sede legale \ ' AS descrizione ORDER BY descrizione " , " value " : " $idsede_fatturazione $ " ]}
</ div >
< div class = " col-md-6 " >
{[ " type " : " select " , " label " : " '.tr('Agente principale').' " , " name " : " idagente " , " values " : " query=SELECT `an_anagrafiche`.`idanagrafica` AS id, IF(deleted_at IS NOT NULL, CONCAT(`ragione_sociale`, \ ' (Eliminato) \ '), `ragione_sociale` ) AS descrizione FROM `an_anagrafiche` INNER JOIN (`an_tipianagrafiche_anagrafiche` INNER JOIN `an_tipianagrafiche` ON `an_tipianagrafiche_anagrafiche`.`idtipoanagrafica`=`an_tipianagrafiche`.`id` LEFT JOIN `an_tipianagrafiche_lang` ON (`an_tipianagrafiche_lang`.`id_record` = `an_tipianagrafiche`.`id` AND `an_tipianagrafiche_lang`.`id_lang` = '.prepare(Models \ Locale::getDefault()->id).')) ON `an_anagrafiche`.`idanagrafica`=`an_tipianagrafiche_anagrafiche`.`idanagrafica` WHERE (`title`= \ 'Agente \ ' AND `deleted_at` IS NULL)'.(isset( $record['idagente'] ) ? 'OR (`an_anagrafiche`.`idanagrafica` = '.prepare( $record['idagente'] ).' AND `deleted_at` IS NOT NULL) ' : '').'ORDER BY `ragione_sociale` " , " value " : " $idagente $ " ]}
</ div >
2022-11-15 17:38:42 +01:00
</ div >
2024-06-12 10:08:32 +02:00
< div class = " row " >
< div class = " col-md-6 " >
{[ " type " : " select " , " label " : " '.tr('Listino').' " , " name " : " id_listino " , " ajax-source " : " listini " , " value " : " $id_listino $ " ]}
</ div >
< div class = " col-md-6 " >
{[ " type " : " select " , " label " : " '.tr('Tipo attività predefinita').' " , " name " : " idtipointervento_default " , " ajax-source " : " tipiintervento " , " value " : " $idtipointervento_default $ " ]}
</ div >
2023-02-02 11:23:09 +01:00
</ div >
2024-06-12 10:08:32 +02:00
< div class = " row " >
< div class = " col-md-6 " >
{[ " type " : " select " , " label " : " '.tr( " Dichiarazione d 'intento").' " , " name " : " id_dichiarazione_intento_default " , " ajax - source " : " dichiarazioni_intento " , " select - options " : { " idanagrafica " : '. $id_record .', " data " : " '.Carbon::now().' " }, " value " : " $id_dichiarazione_intento_default $ " ]}
2024-07-10 17:27:07 +02:00
</ div >
< div class = " col-md-6 " >
{[ " type " : " select " , " label " : " '.tr('Relazione').' " , " name " : " idrelazione " , " ajax-source " : " relazioni " , " value " : " $idrelazione $ " , " icon-after " : " add|'.Module::where('name', 'Relazioni')->first()->id.' " ]}
2024-06-12 10:08:32 +02:00
</ div > ' ;
2019-07-24 12:42:45 +02:00
2024-01-15 15:30:45 +01:00
// Collegamento con il conto
$conto = $dbo -> fetchOne ( 'SELECT co_pianodeiconti3.id, co_pianodeiconti2.numero as numero, co_pianodeiconti3.numero as numero_conto, co_pianodeiconti3.descrizione AS descrizione FROM co_pianodeiconti3 INNER JOIN co_pianodeiconti2 ON co_pianodeiconti3.idpianodeiconti2=co_pianodeiconti2.id WHERE co_pianodeiconti3.id = ' . prepare ( $record [ 'idconto_cliente' ]));
2019-07-24 12:42:45 +02:00
2024-01-15 15:30:45 +01:00
echo '
2024-06-12 10:08:32 +02:00
< div class = " col-md-6 " >
< p >< b > '.tr(' Piano dei conti cliente ').' </ b ></ p > ' ;
2019-07-24 15:22:10 +02:00
2024-01-15 15:30:45 +01:00
if ( ! empty ( $conto [ 'numero_conto' ])) {
$piano_dei_conti_cliente = $conto [ 'numero' ] . '.' . $conto [ 'numero_conto' ] . ' ' . $conto [ 'descrizione' ];
echo Modules :: link ( 'Piano dei conti' , null , $piano_dei_conti_cliente , null , '' , 1 , 'movimenti-' . $conto [ 'id' ]);
} else {
$piano_dei_conti_cliente = tr ( 'Nessuno' );
}
2019-07-24 15:22:10 +02:00
2024-01-15 15:30:45 +01:00
echo '
2024-06-12 10:08:32 +02:00
</ div >
2019-07-24 12:42:45 +02:00
</ div >
2024-06-12 10:08:32 +02:00
</ div > ' ;
2019-02-18 09:25:18 +01:00
2024-01-15 15:30:45 +01:00
echo '
2024-06-12 10:08:32 +02:00
< div class = " tab-pane '.(! $is_fornitore ? 'hide' : (! $is_cliente ? 'active' : '')).' " id = " fornitore " >
< div class = " row " >
< div class = " col-md-6 " >
{[ " type " : " select " , " label " : " '.tr('Pagamento predefinito').' " , " name " : " idpagamento_acquisti " , " values " : " query=SELECT `co_pagamenti`.`id`, `co_pagamenti_lang`.`title` AS descrizione FROM `co_pagamenti` LEFT JOIN `co_pagamenti_lang` ON (`co_pagamenti`.`id` = `co_pagamenti_lang`.`id_record` AND `co_pagamenti_lang`.`id_lang` = '.prepare(Models \ Locale::getDefault()->id).') GROUP BY `descrizione` ORDER BY `descrizione` ASC " , " value " : " $idpagamento_acquisti $ " ]}
</ div >
2020-03-16 10:54:25 +01:00
2024-06-12 10:08:32 +02:00
< div class = " col-md-6 " >
{[ " type " : " select " , " label " : " '.tr('Banca predefinita per addebiti').' " , " name " : " idbanca_acquisti " , " ajax-source " : " banche " , " select-options " : '.json_encode([' id_anagrafica ' => $anagrafica_azienda->id]).' , " value " : " $idbanca_acquisti $ " , " help " : " '.tr( " Banca predefinita dell 'Azienda da cui addebitare i pagamenti").' " ]}
</ div >
2019-07-24 12:42:45 +02:00
</ div >
2020-03-16 10:54:25 +01:00
2024-06-12 10:08:32 +02:00
< div class = " row " >
< div class = " col-md-6 " >
{[ " type " : " select " , " label " : " '.tr('Iva predefinita').' " , " name " : " idiva_acquisti " , " ajax-source " : " iva " , " value " : " $idiva_acquisti $ " ]}
</ div >
2020-03-16 10:54:25 +01:00
2024-06-12 10:08:32 +02:00
< div class = " col-md-6 " >
{[ " type " : " select " , " label " : " '.tr( " Ritenuta d 'acconto predefinita").' " , " name " : " id_ritenuta_acconto_acquisti " , " values " : " query = SELECT id , descrizione FROM co_ritenutaacconto ORDER BY descrizione ASC " , " value " : " $id_ritenuta_acconto_acquisti $ " ]}
</ div >
2019-07-24 12:42:45 +02:00
</ div >
2020-03-16 10:54:25 +01:00
2024-06-12 10:08:32 +02:00
< div class = " row " >
< div class = " col-md-6 " >
{[ " type " : " select " , " label " : " '.tr('Piano di sconto/magg. su articoli').' " , " name " : " id_piano_sconto_acquisti " , " values " : " query=SELECT id, nome AS descrizione FROM mg_piani_sconto ORDER BY nome ASC " , " value " : " $id_piano_sconto_acquisti $ " ]}
</ div > ' ;
2019-07-24 12:42:45 +02:00
2024-01-15 15:30:45 +01:00
// Collegamento con il conto
$conto = $dbo -> fetchOne ( 'SELECT co_pianodeiconti3.id, co_pianodeiconti2.numero as numero, co_pianodeiconti3.numero as numero_conto, co_pianodeiconti3.descrizione AS descrizione FROM co_pianodeiconti3 INNER JOIN co_pianodeiconti2 ON co_pianodeiconti3.idpianodeiconti2=co_pianodeiconti2.id WHERE co_pianodeiconti3.id = ' . prepare ( $record [ 'idconto_fornitore' ]));
2020-07-27 15:40:54 +02:00
2024-01-15 15:30:45 +01:00
echo '
2024-06-12 10:08:32 +02:00
< div class = " col-md-6 " >
< p >< b > '.tr(' Piano dei conti fornitore ').' </ b ></ p > ' ;
2019-07-24 15:41:04 +02:00
2024-01-15 15:30:45 +01:00
if ( ! empty ( $conto [ 'numero_conto' ])) {
$piano_dei_conti_fornitore = $conto [ 'numero' ] . '.' . $conto [ 'numero_conto' ] . ' ' . $conto [ 'descrizione' ];
echo Modules :: link ( 'Piano dei conti' , null , $piano_dei_conti_fornitore , null , '' , 1 , 'movimenti-' . $conto [ 'id' ]);
} else {
$piano_dei_conti_fornitore = tr ( 'Nessuno' );
}
2019-07-24 15:22:10 +02:00
2024-01-15 15:30:45 +01:00
echo '
2024-06-12 10:08:32 +02:00
</ div >
2019-07-24 12:42:45 +02:00
</ div >
</ div >
2024-06-12 10:08:32 +02:00
< div class = " tab-pane'.(! $is_cliente && ! $is_fornitore && $is_tecnico ? ' active' : '').''.(! $is_tecnico ? ' hide' : '').' " id = " tecnico " >
< div class = " row " >
< div class = " col-md-6 " >
{[ " type " : " text " , " label " : " '.tr('Colore').' " , " name " : " colore " , " id " : " colore_t " , " class " : " colorpicker text-center " , " value " : " $colore $ " , " maxlength " : " 7 " , " icon-after " : " <div class= \ 'img-circle square \ '></div> " ]}
</ div >
2019-07-24 12:42:45 +02:00
</ div >
</ div >
2024-06-12 10:08:32 +02:00
</ div >
2019-02-18 09:25:18 +01:00
</ div >
</ div >
2024-06-12 10:08:32 +02:00
</ div > ' ;
2024-01-15 15:30:45 +01:00
}
?>
2017-08-04 16:28:16 +02:00
2024-06-12 10:08:32 +02:00
< div class = " card card-primary " >
< div class = " card-header " >
< h3 class = " card-title " >< ? php echo tr ( 'Informazioni aggiuntive' ); ?> </h3>
</ div >
2017-08-04 16:28:16 +02:00
2024-06-12 10:08:32 +02:00
< div class = " card-body " >
< div class = " row " >
< div class = " col-md-3 " >
{[ " type " : " text " , " label " : " <?php echo tr('Numero d \ 'iscrizione registro imprese'); ?> " , " name " : " codiceri " , " value " : " $codiceri $ " , " help " : " <?php echo tr('Il numero registro imprese è il numero di iscrizione attribuito dal Registro Imprese della Camera di Commercio.'); ?> " ]}
</ div >
2017-08-04 16:28:16 +02:00
2024-06-12 10:08:32 +02:00
< div class = " col-md-3 " >
{[ " type " : " text " , " label " : " <?php echo tr('Codice R.E.A.').' <small>('.tr('provincia-C.C.I.A.A.').')</small>'; ?> " , " name " : " codicerea " , " value " : " $codicerea $ " , " class " : " rea-mask text-uppercase " , " help " : " <?php echo tr('Esempio: _PATTERN_', [
'_PATTERN_' => 'RM-123456' ,
]); ?> " ]}
</ div >
2020-07-27 15:40:54 +02:00
2024-06-12 10:08:32 +02:00
< div class = " col-md-3 " >
{[ " type " : " text " , " label " : " <?php echo tr('Riferimento Amministrazione'); ?> " , " name " : " riferimento_amministrazione " , " value " : " $riferimento_amministrazione $ " , " maxlength " : " 20 " ]}
</ div >
< ? php
2024-01-15 15:30:45 +01:00
if ( $is_agente ) {
?>
2024-06-12 10:08:32 +02:00
< div class = " col-md-3 " >
{[ " type " : " number " , " label " : " <?php echo tr('Provvigione predefinita'); ?> " , " name " : " provvigione_default " , " value " : " $provvigione_default $ " , " icon-after " : " % " ]}
</ div >
< ? php
2024-01-15 15:30:45 +01:00
}
?>
2024-06-12 10:08:32 +02:00
</ div >
2020-09-24 16:41:43 +02:00
2024-06-12 10:08:32 +02:00
< div class = " row " >
< div class = " col-md-3 " >
{[ " type " : " text " , " label " : " <?php echo tr('Num. iscr. tribunale'); ?> " , " name " : " iscrizione_tribunale " , " value " : " $iscrizione_tribunale $ " ]}
</ div >
2017-08-04 16:28:16 +02:00
2024-06-12 10:08:32 +02:00
< div class = " col-md-3 " >
{[ " type " : " text " , " label " : " <?php echo tr('Num. iscr. albo artigiani'); ?> " , " name " : " n_alboartigiani " , " value " : " $n_alboartigiani $ " ]}
</ div >
2017-08-04 16:28:16 +02:00
2024-06-12 10:08:32 +02:00
< div class = " col-md-3 " >
{[ " type " : " text " , " label " : " <?php echo tr('Foro di competenza'); ?> " , " name " : " foro_competenza " , " value " : " $foro_competenza $ " ]}
</ div >
2017-08-04 16:28:16 +02:00
2024-06-12 10:08:32 +02:00
< div class = " col-md-3 " >
{[ " type " : " text " , " label " : " <?php echo tr('Capitale sociale'); ?> " , " name " : " capitale_sociale " , " value " : " $capitale_sociale $ " ]}
2023-08-08 17:04:47 +02:00
</ div >
2024-06-12 10:08:32 +02:00
</ div >
2018-06-29 17:30:41 +02:00
2024-06-12 10:08:32 +02:00
< div class = " row " >
< div class = " col-md-3 " >
{[ " type " : " select " , " label " : " <?php echo tr('Settore merceologico'); ?> " , " name " : " id_settore " , " ajax-source " : " settori " , " value " : " $id_settore $ " , " icon-after " : " add|<?php echo Module::where('name', 'Settori')->first()->id; ?> " ]}
</ div >
2017-08-04 16:28:16 +02:00
2024-06-12 10:08:32 +02:00
< div class = " col-md-3 " >
{[ " type " : " text " , " label " : " <?php echo tr('Marche trattate'); ?> " , " name " : " marche " , " value " : " $marche $ " ]}
</ div >
2018-02-22 11:07:52 +01:00
2024-06-12 10:08:32 +02:00
< div class = " col-md-3 " >
{[ " type " : " number " , " label " : " <?php echo tr('Num. dipendenti'); ?> " , " name " : " dipendenti " , " decimals " : 0 , " value " : " $dipendenti $ " ]}
</ div >
2017-08-04 16:28:16 +02:00
2024-06-12 10:08:32 +02:00
< div class = " col-md-3 " >
{[ " type " : " number " , " label " : " <?php echo tr('Num. macchine'); ?> " , " name " : " macchine " , " decimals " : 0 , " value " : " $macchine $ " ]}
2023-08-08 17:04:47 +02:00
</ div >
2024-06-12 10:08:32 +02:00
</ div >
2017-08-04 16:28:16 +02:00
2024-06-12 10:08:32 +02:00
< div class = " row " >
< div class = " col-md-6 " >
{[ " type " : " select " , " multiple " : " 1 " , " label " : " <?php echo tr('Tipo di anagrafica'); ?> " , " name " : " idtipoanagrafica[] " , " values " : " query=SELECT `an_tipianagrafiche`.`id`, `title` as descrizione FROM `an_tipianagrafiche` LEFT JOIN `an_tipianagrafiche_lang` ON (`an_tipianagrafiche`.`id` = `an_tipianagrafiche_lang`.`id_record` AND `an_tipianagrafiche_lang`.`id_lang` = <?php echo prepare(Models \ Locale::getDefault()->id); ?>) WHERE `an_tipianagrafiche`.`id` NOT IN (SELECT DISTINCT(`x`.`idtipoanagrafica`) FROM `an_tipianagrafiche_anagrafiche` x INNER JOIN `an_tipianagrafiche` t ON `x`.`idtipoanagrafica` = `t`.`id` LEFT JOIN `an_tipianagrafiche_lang` ON (`an_tipianagrafiche_lang`.`id_record` = `t`.`id` AND `an_tipianagrafiche_lang`.`id_lang` = <?php echo prepare(Models \ Locale::getDefault()->id); ?>) INNER JOIN `an_anagrafiche` ON `an_anagrafiche`.`idanagrafica` = `x`.`idanagrafica` WHERE `an_tipianagrafiche_lang`.`title` = 'Azienda' AND `deleted_at` IS NULL) ORDER BY `title` " , " value " : " $idtipianagrafica $ " ]}
2023-08-08 17:04:47 +02:00
< ? php
2024-01-15 15:30:45 +01:00
if ( in_array ( $id_azienda , $tipi_anagrafica )) {
echo '
2024-06-12 10:08:32 +02:00
< p class = " badge badge-info " > '.tr(' Questa anagrafica è di tipo " Azienda " ').' .</ p > ' ;
2024-01-15 15:30:45 +01:00
}
?>
2024-06-12 10:08:32 +02:00
</ div >
< div class = " col-md-6 " >
{[ " type " : " textarea " , " label " : " <?php echo tr('Note'); ?> " , " name " : " note " , " value " : " $note $ " , " charcounter " : 1 ]}
2023-08-08 17:04:47 +02:00
</ div >
</ div >
</ div >
2024-06-12 10:08:32 +02:00
</ div >
2023-08-08 17:04:47 +02:00
</ fieldset >
2017-08-04 16:28:16 +02:00
</ form >
2017-09-18 15:57:37 +02:00
2018-09-28 16:17:10 +02:00
{( " name " : " filelist_and_upload " , " id_module " : " $id_module $ " , " id_record " : " $id_record $ " )}
2018-03-27 18:47:17 +02:00
2017-08-04 16:28:16 +02:00
< ? php
2018-05-17 14:33:40 +02:00
2018-07-09 10:44:54 +02:00
if ( setting ( 'Azienda predefinita' ) == $id_record ) {
2018-07-02 15:41:38 +02:00
echo '
2020-01-22 10:49:44 +01:00
< div class = " alert alert-info " > '.tr(' Per impostare il < b > logo nelle stampe </ b > , caricare un\ 'immagine specificando come nome "<b>Logo stampe</b>" (Risoluzione consigliata 302x111 pixel).<br>Per impostare una <b>filigrana nelle stampe</b>, caricare un\'immagine specificando come nome "<b>Filigrana stampe</b>"' ) . '.</div>' ;
2018-07-02 15:41:38 +02:00
}
2018-09-05 10:05:23 +02:00
// Collegamenti diretti
// Fatture, ddt, preventivi, contratti, ordini, interventi, utenti collegati a questa anagrafica
2024-04-18 17:44:05 +02:00
$elementi = $dbo -> fetchArray ( 'SELECT `co_documenti`.`id`, `co_documenti`.`data`, `co_documenti`.`numero`, `co_documenti`.`numero_esterno`, `co_tipidocumento_lang`.`title` AS tipo_documento, `co_tipidocumento`.`dir`, NULL AS `deleted_at` FROM `co_documenti` INNER JOIN `co_tipidocumento` ON `co_tipidocumento`.`id` = `co_documenti`.`idtipodocumento` LEFT JOIN `co_tipidocumento_lang` ON (`co_tipidocumento`.`id` = `co_tipidocumento_lang`.`id_record` AND `co_tipidocumento_lang`.`id_lang` = ' . prepare ( Models\Locale :: getDefault () -> id ) . ') WHERE `co_documenti`.`idanagrafica` = ' . prepare ( $id_record ) . '
2018-06-06 00:37:22 +02:00
2018-09-05 10:05:23 +02:00
UNION
2022-11-22 16:23:45 +01:00
SELECT `zz_users` . `idgruppo` AS id , `zz_users` . `created_at` AS data , `zz_users` . `username` AS numero , 0 AS `numero_esterno` , " Utente " AS tipo_documento , 0 AS `dir` , NULL AS `deleted_at` FROM `zz_users` WHERE `zz_users` . `idanagrafica` = '.prepare($id_record).'
2018-05-17 14:33:40 +02:00
2018-09-05 10:05:23 +02:00
UNION
2024-04-18 17:44:05 +02:00
SELECT `or_ordini` . `id` , `or_ordini` . `data` , `or_ordini` . `numero` , `or_ordini` . `numero_esterno` , `or_tipiordine_lang` . `title` AS tipo_documento , `or_tipiordine` . `dir` , NULL AS `deleted_at` FROM `or_ordini` INNER JOIN `or_tipiordine` ON `or_tipiordine` . `id` = `or_ordini` . `idtipoordine` LEFT JOIN `or_tipiordine_lang` ON ( `or_tipiordine` . `id` = `or_tipiordine_lang` . `id_record` AND `or_tipiordine_lang` . `id_lang` = '.prepare(Models\Locale::getDefault()->id).' ) WHERE `or_ordini` . `idanagrafica` = '.prepare($id_record).'
2018-05-17 14:33:40 +02:00
2018-09-05 10:05:23 +02:00
UNION
2024-04-18 17:44:05 +02:00
SELECT `dt_ddt` . `id` , `dt_ddt` . `data` , `dt_ddt` . `numero` , `dt_ddt` . `numero_esterno` , `dt_tipiddt_lang` . `title` AS tipo_documento , `dt_tipiddt` . `dir` , NULL AS `deleted_at` FROM `dt_ddt` INNER JOIN `dt_tipiddt` ON `dt_tipiddt` . `id` = `dt_ddt` . `idtipoddt` LEFT JOIN `dt_tipiddt_lang` ON ( `dt_tipiddt` . `id` = `dt_tipiddt_lang` . `id_record` AND `dt_tipiddt_lang` . `id_lang` = '.prepare(Models\Locale::getDefault()->id).' ) WHERE `dt_ddt` . `idanagrafica` = '.prepare($id_record).'
2018-05-17 14:33:40 +02:00
2018-09-05 10:05:23 +02:00
UNION
2019-07-23 12:13:58 +02:00
SELECT `in_interventi` . `id` , `in_interventi` . `data_richiesta` , `in_interventi` . `codice` AS numero , 0 AS numero_esterno , " Intervento " AS tipo_documento , 0 AS dir , in_interventi . deleted_at AS `deleted_at` FROM `in_interventi` LEFT JOIN `in_interventi_tecnici` ON `in_interventi` . `id` = `in_interventi_tecnici` . `idintervento` WHERE `in_interventi` . `id` IN ( SELECT `idintervento` FROM `in_interventi_tecnici` WHERE `idtecnico` = '.prepare($id_record).' ) OR `in_interventi` . `idanagrafica` = '.prepare($id_record).'
2018-05-17 14:33:40 +02:00
2018-09-05 10:05:23 +02:00
UNION
2019-07-23 12:13:58 +02:00
SELECT `co_contratti` . `id` , `co_contratti` . `data_bozza` , `co_contratti` . `numero` , 0 AS numero_esterno , " Contratto " AS tipo_documento , 0 AS dir , NULL AS `deleted_at` FROM `co_contratti` WHERE `co_contratti` . `idanagrafica` = '.prepare($id_record).'
2018-05-17 14:33:40 +02:00
2018-09-05 10:05:23 +02:00
UNION
2024-05-20 16:28:49 +02:00
SELECT `co_preventivi` . `id` , `co_preventivi` . `data_bozza` , `co_preventivi` . `numero` , 0 AS numero_esterno , " Preventivo " AS tipo_documento , 0 AS dir , NULL AS `deleted_at` FROM `co_preventivi` WHERE `co_preventivi` . `idanagrafica` = '.prepare($id_record).' AND `default_revision` = 1
2018-09-03 16:01:05 +02:00
2018-09-05 12:01:29 +02:00
ORDER BY `data` ' );
2018-06-26 10:29:30 +02:00
2018-09-05 10:05:23 +02:00
if ( ! empty ( $elementi )) {
echo '
2024-05-16 18:02:50 +02:00
< div class = " card card-warning collapsable collapsed-card " >
< div class = " card-header with-border " >
< h3 class = " card-title " >< i class = " fa fa-warning " ></ i > '.tr(' Documenti collegati : _NUM_ ' , [
2023-08-08 17:04:47 +02:00
'_NUM_' => count ( $elementi ),
]) . ' </ h3 >
2024-05-16 18:02:50 +02:00
< div class = " card-tools pull-right " >
2024-05-23 17:51:21 +02:00
< button type = " button " class = " btn btn-tool " data - card - widget = " collapse " >< i class = " fa fa-plus " ></ i ></ button >
2018-09-05 10:05:23 +02:00
</ div >
</ div >
2024-05-16 18:02:50 +02:00
< div class = " card-body " >
2018-09-05 10:05:23 +02:00
< ul > ' ;
foreach ( $elementi as $elemento ) {
2019-07-23 12:13:58 +02:00
$descrizione = tr ( '_DOC_ _NUM_ del _DATE_ _DELETED_AT_' , [
2023-08-08 17:04:47 +02:00
'_DOC_' => $elemento [ 'tipo_documento' ],
'_NUM_' => ! empty ( $elemento [ 'numero_esterno' ]) ? $elemento [ 'numero_esterno' ] : $elemento [ 'numero' ],
'_DATE_' => Translator :: dateToLocale ( $elemento [ 'data' ]),
'_DELETED_AT_' => ( ! empty ( $elemento [ 'deleted_at' ]) ? tr ( 'Eliminato il:' ) . ' ' . Translator :: dateToLocale ( $elemento [ 'deleted_at' ]) : '' ),
]);
2018-09-05 10:05:23 +02:00
2024-01-15 15:30:45 +01:00
// se non è un preventivo è un ddt o una fattura
// se non è un ddt è una fattura.
2018-09-05 10:05:23 +02:00
if ( in_array ( $elemento [ 'tipo_documento' ], [ 'Utente' ])) {
$modulo = 'Utenti e permessi' ;
2024-06-06 16:59:36 +02:00
} elseif ( in_array ( $elemento [ 'tipo_documento' ], [ 'Attività' ])) {
2018-09-05 10:05:23 +02:00
$modulo = 'Interventi' ;
} elseif ( in_array ( $elemento [ 'tipo_documento' ], [ 'Preventivo' ])) {
$modulo = 'Preventivi' ;
} elseif ( in_array ( $elemento [ 'tipo_documento' ], [ 'Contratto' ])) {
$modulo = 'Contratti' ;
} elseif ( in_array ( $elemento [ 'tipo_documento' ], [ 'Ordine cliente' , 'Ordine fornitore' ])) {
$modulo = ( $elemento [ 'dir' ] == 'entrata' ) ? 'Ordini cliente' : 'Ordini fornitore' ;
2019-01-10 18:41:25 +01:00
} elseif ( in_array ( $elemento [ 'tipo_documento' ], [ 'Ddt in uscita' , 'Ddt in entrata' ])) {
2024-05-03 12:15:09 +02:00
$modulo = ( $elemento [ 'dir' ] == 'entrata' ) ? 'Ddt in uscita' : 'Ddt in entrata' ;
2018-09-05 10:05:23 +02:00
} else {
$modulo = ( $elemento [ 'dir' ] == 'entrata' ) ? 'Fatture di vendita' : 'Fatture di acquisto' ;
2018-06-26 14:30:26 +02:00
}
2018-06-26 10:29:30 +02:00
2018-09-05 10:05:23 +02:00
$id = $elemento [ 'id' ];
2018-06-26 14:30:26 +02:00
echo '
2018-09-05 10:05:23 +02:00
< li > '.Modules::link($modulo, $id, $descrizione).' </ li > ' ;
2018-06-26 14:30:26 +02:00
}
2018-06-26 10:29:30 +02:00
2018-09-05 10:05:23 +02:00
echo '
</ ul >
</ div >
</ div > ' ;
}
2018-10-26 09:06:07 +02:00
if ( empty ( $record [ 'deleted_at' ])) {
2018-07-03 11:37:15 +02:00
if ( ! in_array ( $id_azienda , $tipi_anagrafica )) {
2018-09-05 10:05:23 +02:00
if ( ! empty ( $elementi )) {
echo '
< div class = " alert alert-error " >
'.tr(' Eliminando questo documento si potrebbero verificare problemi nelle altre sezioni del gestionale ').' .
</ div > ' ;
}
2018-06-26 14:30:26 +02:00
echo '
2018-09-05 10:05:23 +02:00
< a class = " btn btn-danger ask " data - backto = " record-list " >
< i class = " fa fa-trash " ></ i > '.tr(' Elimina ').'
</ a > ' ;
2018-06-26 14:30:26 +02:00
} else {
echo '
2018-09-05 10:05:23 +02:00
< div class = " alert alert-warning " > '.tr(' Questa è l\ 'anagrafica "Azienda" e non è possibile eliminarla' ) . '.</div>' ;
2018-06-26 14:30:26 +02:00
}
} else {
echo '
2018-09-05 10:05:23 +02:00
< div class = " alert alert-danger " > '.tr(' Questa anagrafica è stata eliminata ').' .</ div > ' ;
2017-09-18 11:22:02 +02:00
}
2017-08-04 16:28:16 +02:00
?>
< script >
2024-02-25 17:19:34 +01:00
2024-04-24 10:16:49 +02:00
var an_sdi = < ? php echo ( $anagrafica -> tipo == 'Azienda' ) ? $dbo -> fetchOne ( 'SELECT JSON_ARRAYAGG(`codice`) AS `elenco_codici` FROM `an_sdi`' )[ 'elenco_codici' ] : []; ?> ;
2024-02-25 17:19:34 +01:00
2023-08-08 17:04:47 +02:00
$ ( document ) . ready ( function () {
2024-02-25 16:30:47 +01:00
// Auto-completamento codice intermediario per anagrafiche con tipologia Azienda
2024-04-24 10:16:49 +02:00
if ( an_sdi && an_sdi . length > 1 ) {
2024-02-25 16:30:47 +01:00
const input = $ ( " #codice_destinatario " )[ 0 ];
autocomplete ({
minLength : 0 ,
input : input ,
emptyMsg : globals . translations . noResults ,
fetch : function ( text , update ) {
text = text . toLowerCase ();
const suggestions = an_sdi . filter ( n => n . toLowerCase () . startsWith ( text ));
// Trasformazione risultati in formato leggibile
const results = suggestions . map ( function ( result ) {
return {
label : result ,
value : result
}
});
update ( results );
},
onSelect : function ( item ) {
2024-08-22 10:19:35 +02:00
input . value = item . label ;
2024-02-25 16:30:47 +01:00
},
});
}
2023-08-08 17:04:47 +02:00
$ ( " .colorpicker " ) . colorpicker ({
format : 'hex'
}) . on ( " changeColor " , function () {
$ ( " #colore_t " ) . parent () . find ( " .square " ) . css ( " background " , $ ( " #colore_t " ) . val ());
});
$ ( " #colore_t " ) . parent () . find ( " .square " ) . css ( " background " , $ ( " #colore_t " ) . val ());
// Abilito solo ragione sociale oppure solo cognome-nome in base a cosa compilo
$ ( '#nome, #cognome' ) . bind ( " keyup change " , function ( e ) {
if ( $ ( '#nome' ) . val () == '' && $ ( '#cognome' ) . val () == '' ) {
2019-01-05 09:53:17 +01:00
$ ( '#nome, #cognome' ) . prop ( 'disabled' , true ) . prop ( 'required' , false );
2023-08-08 17:04:47 +02:00
$ ( '#ragione_sociale' ) . prop ( 'disabled' , false ) . prop ( 'required' , true );
$ ( '#ragione_sociale' ) . focus ();
} else {
2019-01-05 09:53:17 +01:00
$ ( '#nome, #cognome' ) . prop ( 'disabled' , false ) . prop ( 'required' , true );
2023-08-08 17:04:47 +02:00
$ ( '#ragione_sociale' ) . prop ( 'disabled' , true ) . prop ( 'required' , false );
}
});
2019-01-05 09:53:17 +01:00
2019-01-10 18:41:25 +01:00
$ ( '#ragione_sociale' ) . bind ( " keyup change " , function ( e ) {
2023-08-08 17:04:47 +02:00
if ( $ ( '#ragione_sociale' ) . val () == '' ) {
2019-01-05 09:53:17 +01:00
$ ( '#nome, #cognome' ) . prop ( 'disabled' , false ) . prop ( 'required' , true );
$ ( '#ragione_sociale' ) . prop ( 'disabled' , true ) . prop ( 'required' , false );
2023-08-08 17:04:47 +02:00
$ ( '#cognome' ) . focus ();
} else {
2019-01-05 09:53:17 +01:00
$ ( '#nome, #cognome' ) . prop ( 'disabled' , true ) . prop ( 'required' , false );
2023-08-08 17:04:47 +02:00
$ ( '#ragione_sociale' ) . prop ( 'disabled' , false ) . prop ( 'required' , true );
$ ( '#ragione_sociale' ) . focus ();
}
});
2019-01-05 09:53:17 +01:00
2019-02-03 10:59:33 +01:00
$ ( '#ragione_sociale, #cognome' ) . trigger ( 'keyup' );
2023-08-08 17:04:47 +02:00
});
</ script >