<?php

include_once __DIR__.'/../../core.php';

?>

<form action="" method="post" id="edit-form">

	<input type="hidden" name="backto" value="record-edit">
	<input type="hidden" name="op" value="update">

	<div class="panel panel-<?php echo $_SESSION['profilo_pannello'] ?>">
		<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>			
		<div class="clearfix"></div>
		
	</div>
	
	<div class="clearfix"></div>
	
	
	<!-- DATI -->
	<div class="panel panel-<?php echo $_SESSION['profilo_pannello'] ?>">
		<div class="panel-heading">
			<h3 class="panel-title"><?php echo tr('Dati'); ?></h3>
		</div>

		<div class="panel-body">
			<div class="row">
				<div class="col-md-4">
					{[ "type": "text", "label": "<?php echo tr('Nome'); ?>", "name": "nome",  "value": "$nome$" ]}
                </div>
				<div class="col-md-4">
					{[ "type": "text", "label": "<?php echo tr('Filiale'); ?>", "name": "filiale",  "value": "$filiale$" ]}
                </div>
				<div class="col-md-4">
					{[ "type": "select", "label": "<?php echo tr('Conto predefinito'); ?>", "name": "id_pianodeiconti3",  "value": "$id_pianodeiconti3$", "values": "query=SELECT id, descrizione  FROM co_pianodeiconti3 WHERE idpianodeiconti2 = 1"  ]}						
                </div>
			</div>
			
			<div class="row">
				<div class="col-md-6">
					{[ "type": "text", "label": "<?php echo tr('IBAN'); ?>", "name": "iban", "class": "alphanumeric-mask", "maxlength": 32, "value": "$iban$" ]}
                </div>
				<div class="col-md-2">
					{[ "type": "text", "label": "<?php echo tr('BIC'); ?>", "name": "bic",  "class": "alphanumeric-mask", "maxlength": 11, "value": "$bic$" ]}
                </div>
				<div class="col-md-1">
					{[ "type": "text", "label": "<?php echo tr('ABI'); ?>", "name": "abi",  "class": "alphanumeric-mask", "maxlength": 5, "value": "$abi$" , "extra": "readonly" ]}
                </div>
				<div class="col-md-1">
					{[ "type": "text", "label": "<?php echo tr('CAB'); ?>", "name": "cab",  "class": "alphanumeric-mask", "maxlength": 5, "value": "$cab$" , "extra": "readonly" ]}
                </div>
			</div>
			
			<div class="row">
				<div class="col-md-12">
					{[ "type": "textarea", "label": "<?php echo tr('Note'); ?>", "name": "note", "required": 0, "class": "", "value": "$note$", "extra": "" ]}
				</div>
			</div>
		</div>
	</div>

</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>
