<form action="" method="post" id="add-form">
	<input type="hidden" name="op" value="update">
	<input type="hidden" name="backto" value="record-edit">
	<input type="hidden" name="id_record" value="<?php echo $id_record ?>">

	
	<div class="panel panel-primary">
		<div class="clearfix"></div>
		</br>	
		<div class="col-md-4">				
			<div class="pull-left">		
				<button type="submit" class="btn-app btn-success"><i class="fa fa-check"></i> Salva </button>							
				
			</div>
		</div>
		<div class="col-md-4">				
			<div class="pull-right">								
				<div class="pull-left showcase sweet"> 		
				<button type="button" class="btn-app btn-danger" aria-label="Show SweetAlert2 success message" ><i class="fa fa-trash-o"></i> Elimina</span></button>		
				</div>				
			</div>	
		</div>
		
		<div class="col-md-4">
			<div class="pull-right">	
			<div class="btn-group">
				<button type="button" class="btn btn-app btn-info dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fa fa-th"></i>Contatta <span class="caret"></span>
				<span class="sr-only">Toggle Dropdown</span></button>
				<ul class="dropdown-menu dropdown-menu-right">
					<li><a onclick="launch_modal( 'Invio SMS tramite E-mail', '<?php echo $rootdir ?>/modules/rubrica/mail_sms.php?id_module=<?php echo $id_module ?>&idanagrafica=<?php echo $id_record ?>',1);"><i class="fa fa-comments-o"></i> Mail to SMS</a></a> </li>
					<li><a onclick="launch_modal( 'Invio messaggio E-mail', '<?php echo $rootdir ?>/modules/rubrica/mail_pdf.php?id_module=<?php echo $id_module ?>&idanagrafica=<?php echo $id_record ?>',1);"><i class="fa fa-envelope"></i> Invia Mail</a>	</li>
					<li><a  target="_blank" href="<?php echo $records[0]['cellulare'] ?>"><i class="fa fa-mobile"></i> Chiama Ora</a></li>	
				</ul>
			</div>	
			
				<div class="btn-group">
					<button type="button" class="btn btn-app btn-info dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><i class="fa fa-edit"></i>Funzioni <span class="caret"></span><span class="sr-only">Toggle Dropdown</span></button>
					<ul class="dropdown-menu dropdown-menu-right">						
						<li><a target="_blank" href="<?php echo $rootdir ?>/editor.php?id_module=2&id_record=<?php echo $records[0]['idanagrafica'] ?>"><i class="fa fa-user"></i>Dettaglio Anagrafica</a></li>
					</ul>
				</div>	

			
			</div>				
		</div>		
		<div class="clearfix"></div>
		
	</div>
		
	<!-- DATI ANAGRAFICA -->
	<div class="panel panel-primary">
		<div class="panel-heading">
			<h3 class="panel-title">Dati aziendali</h3>
		</div>
		
		<div class="panel-body">
		
			<div class="row">		
				<div class="col-md-6">
					{[ "type": "text", "label": "Ragione Sociale", "name": "a_ragione_sociale", "required": 0, "class": "", "value": "$a_ragione_sociale$", "extra": "readonly" ]}
				</div>
				<div class="col-md-6">
					{[ "type": "text", "label": "Indirizzo", "name": "a_indirizzo", "required": 0, "class": "", "value": "$a_indirizzo$", "extra": "readonly" ]}
				</div>
				
			</div>
			
			<div class="row">
				<div class="col-md-3">
					{[ "type": "text", "label": "Telefono", "name": "a_telefono", "required": 0, "class": "", "value": "$a_telefono$", "extra": "readonly" ]}
				</div>
				<div class="col-md-3">
					{[ "type": "text", "label": "Fax", "name": "a_fax", "required": 0, "class": "", "value": "$a_fax$", "extra": "readonly" ]}
				</div>
				<div class="col-md-2">
					{[ "type": "text", "label": "Città", "name": "a_citta", "required": 0, "class": "", "value": "$a_citta$", "extra": "readonly" ]}
				</div>
				<div class="col-md-2">
					{[ "type": "text", "label": "C.A.P.", "name": "a_cap", "required": 0, "class": "", "value": "$a_cap$", "extra": "readonly" ]}
				</div>
				<div class="col-md-2">
					{[ "type": "text", "label": "Prov.", "name": "a_prov", "required": 0, "class": "", "value": "$a_prov$", "extra": "readonly" ]}
				</div>
			</div>
			
			<div class="row">
				<div class="col-md-3">
					{[ "type": "text", "label": "E-mail", "name": "a_email", "required": 0, "class": "", "value": "$a_email$", "extra": "readonly" ]}
				</div>
				<div class="col-md-3">
					{[ "type": "text", "label": "Pec", "name": "a_pec", "required": 0, "class": "", "value": "$a_pec$", "extra": "readonly" ]}
				</div>
			</div>
			
		</div>	
		
	</div>



	<!-- REFERENTE -->
	<div class="panel panel-primary">
		<div class="panel-heading">
			<h3 class="panel-title">Referente</h3>
		</div>
		
		<div class="panel-body">
		
			<div class="row">		
				<div class="col-md-3">
					{[ "type": "text", "label": "Nominativo", "name": "r_nome", "required": 0, "class": "", "value": "$r_nome$", "extra": "" ]}
				</div>
				<div class="col-md-3">
					{[ "type": "text", "label": "Mansione", "name": "r_mansione", "required": 0, "class": "", "value": "$r_mansione$", "extra": "" ]}
				</div>
				<div class="col-md-3">
					{[ "type": "text", "label": "E-mail", "name": "r_email", "required": 0, "class": "", "value": "$r_email$", "extra": "" ]}
				</div>
				<div class="col-md-3">
					{[ "type": "select", "label": "Stato", "name": "r_stato", "required": 0, "class": "", "values": "list=\"\": \"Non specificato\", \"Attivo\": \"Attivo\", \"Non Attivo\": \"Non Attivo\"", "value":  "$r_stato$", "extra": "" ]}
				</div>
			</div>
			
			<div class="row">
				<div class="col-md-3">
					{[ "type": "text", "label": "Telefono", "name": "r_telefono", "required": 0, "class": "", "value": "$r_telefono$", "extra": "" ]}
				</div>
				<div class="col-md-3">
					{[ "type": "text", "label": "Cellulare", "name": "r_cellulare", "required": 0, "class": "", "value": "$r_cellulare$", "extra": "" ]}
				</div>
				<div class="col-md-3">
					{[ "type": "text", "label": "Fax", "name": "r_fax", "required": 0, "class": "", "value": "$r_fax$", "extra": "" ]}
				</div>
			</div>
			
			<div class="row">
				<div class="col-md-12">
					{[ "type": "textarea", "label": "Note", "name": "r_note", "required": 0, "class": "", "value": "$r_note$", "extra": "rows=5" ]}
				</div>

			</div>
			
		</div>	
		
	</div>

	<?php include ($docroot . "/lib/campi_personalizzati.php");	?>
	
</form>

<form action="" method="post" role="form" id="form-delete">
	<input type="hidden" name="backto" value="record-list">
	<input type="hidden" name="op" value="delete">
</form>
<script>		
	$('.showcase.sweet button').on('click', () => {
		swal({
		  title: 'Sei sicuro?',
		  text: "Eliminare questo elemento!",
		  type: 'warning',
		  showCancelButton: true,
		  confirmButtonColor: '#3085d6',
		  cancelButtonColor: '#d33',
		  confirmButtonText: 'Conferma!'
		}).then((result) => {
		  if (result.value) {			
			{ $('#form-delete').submit(); }
		  }
		})
	})		
</script>
