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

	<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>							
				<button type="button" class="btn-app btn-primary" onclick="if( confirm('Associare articoli?') ){ $('#form-associa').submit(); }"><i class="fa fa-files-o"></i> Associa articoli</span></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 ARTICOLO -->
	<div class="panel panel-<?php echo $_SESSION['profilo_pannello'] ?>">
		<div class="panel-heading">
			<h3 class="panel-title">Listino</h3>
		</div>
	
		<div class="panel-body">
			
		
			<div class="row">
				<div class="col-md-4">
					{[ "type": "text", "label": "Nome", "name": "nome", "required": 1, "class": "", "value": "$nome$", "extra": "" ]}
				</div>
				<div class="col-md-4">
					{[ "type": "text", "label": "Sconto", "name": "prc_guadagno", "required": 1, "class": "text-right", "value": "$prc_guadagno$", "extra": "", "icon-after": "%" ]}
				</div>

			</div>
			<div class="row">
				<div class="col-md-12">
					{[ "type": "textarea", "label": "Note", "name": "note", "required": 0, "class": "", "value": "$note$", "extra": "" ]}
				</div>
			</div>

			
		

<!-- Articoli Associati al listino -->
<div class="panel panel-<?php echo $_SESSION['profilo_pannello'] ?>">
	<div class="panel-heading">
		<h3 class="panel-title">Articoli Associati al listino</h3>
	</div>

	<div class="panel-body">
		<div class="pull-left">
			<?php if( $records[0]['stato'] != 'Evaso' ){ ?>
				<a class="btn btn-sm btn-primary" data-href="<?php echo $rootdir ?>/modules/listini/add_articolo.php?idarticolo=<?php echo $id_record ?>&dir=<?php echo $dir ?>" data-toggle="modal" data-title="Aggiungi articolo" data-target="#bs-popup"><i class="fa fa-plus"></i> Articolo</a>
			<?php } ?>
		</div>
		<div class="clearfix"></div>
		<br>
		
		<div class="row">
			<div class="col-md-12">
				<table class="table table-striped table-hover table-condensed table-bordered">
				<tr>
					<th>Descrizione</th>
				   	<th class="text-center" width="120">Prz.Base</th>
					<th class="text-center" width="80">%</th>
				    <th class="text-center" width="120">Prz.Listino</th>
					<th width="60"></th>
				</tr>
				
				<?php include($docroot."/modules/listini/row-list.php"); ?>
				</table>
			</div>
		</div>
	</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">
	<input type="hidden" name="id_record" value="<?php echo $id_record ?>">

	</form>

<form action="" method="post" role="form" id="form-associa">
	<input type="hidden" name="backto" value="record-edit">
	<input type="hidden" name="op" value="associa">
    <input type="hidden" name="id_record" value="<?php echo $id_record ?>">
	
</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>
