

<body>

<form action="" method="post" role="form" enctype="multipart/form-data">
	<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-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>			
		<div class="clearfix"></div>
		
	</div>
		
	
	
	

	<!-- DATI ANAGRAFICI -->
	<div class="panel panel-primary">
		<div class="panel-heading">
			<h3 class="panel-title">Nota</h3>
		</div>
        
	
		<div class="panel-body">
			<div class="pull-right">
            <!--	<a class="btn btn-info" target="_blank" href="<?php echo $rootdir ?>/templates/pdfgen.php?ptype=note&idscheda=<?php echo $id_record ?>"><i class="fa fa-print"></i> Stampa Nota</a> -->
				
                <br><br>
			</div>
			<div class="clearfix"></div>
		
			<div class="row">
								
				<div class="col-md-12">
					<div class="row">
	                    <div class="col-md-2">
							{[ "type": "text", "label": "N° progressivo", "name": "idscheda", "required": 1, "class": "text-center", "value": "$idscheda$", "extra": "readonly" ]}
							<input type="hidden" name="idscheda" value="<?php echo $records[0]['idscheda']; ?>">
						</div>											
						<div class="col-md-4">
							{[ "type": "text", "label": "Spesa Sostenuta", "name": "nome", "required": 1, "class": "", "value": "$nome$", "extra": "" ]}
						</div>                        
                        <div class="col-md-2">							
							{[ "type": "date", "label": "Data", "maxlength": 10, "name": "data_archiviazione", "required": 1, "class": "text-center datepicker", "value": "$data_archiviazione$", "extra": "" ]}
						</div>
                        
                        <div class="col-md-2">
							{[ "type": "select", "label": "Tipologia", "name": "idstato", "required": 0, "class": "", "values": "query=SELECT * FROM ms_spese_gruppo", "value": "$idstato$", "extra": "" ]}
						</div>
                        
                        <div class="col-md-2">
							{[ "type": "text", "label": "Importo", "name": "importo", "required": 0, "class": "inputmask-decimal", "value": "$importo$", "extra": "", "icon-after": "&euro;" ]}
						</div>
					</div>
                    <div class="row">    
						<div class="clearfix"></div>
						<div class="col-md-6">                        
							{[ "type": "select", "label": "Operatore", "name": "idtecnico", "required": 0, "class": "", "values": "query=SELECT an_anagrafiche.idanagrafica AS id, ragione_sociale AS descrizione FROM an_anagrafiche INNER JOIN (an_tipianagrafiche_anagrafiche INNER JOIN an_tipianagrafiche ON an_tipianagrafiche_anagrafiche.idtipoanagrafica=an_tipianagrafiche.idtipoanagrafica) ON an_anagrafiche.idanagrafica=an_tipianagrafiche_anagrafiche.idanagrafica WHERE descrizione='Tecnico' and deleted=0 ORDER BY ragione_sociale ASC", "value": "$idtecnico$", "extra": "" ]}
				        </div>
						<div class="col-md-6">                        
							{[ "type": "select", "label": "Cliente", "name": "idanagrafica", "required": 0, "class": "", "values": "query=SELECT an_anagrafiche.idanagrafica AS id, ragione_sociale AS descrizione FROM an_anagrafiche INNER JOIN (an_tipianagrafiche_anagrafiche INNER JOIN an_tipianagrafiche ON an_tipianagrafiche_anagrafiche.idtipoanagrafica=an_tipianagrafiche.idtipoanagrafica) ON an_anagrafiche.idanagrafica=an_tipianagrafiche_anagrafiche.idanagrafica WHERE descrizione<>'Tecnico' and deleted=0 ORDER BY ragione_sociale ASC", "value": "$idanagrafica$", "extra": "" ]}
				        </div>
					</div>
				</div>
			</div>
		</div>
	</div>
            
         
            
           
            
 <!-- Descrizioen  -->
 <div class="panel panel-primary">
	<div class="panel-heading">
		<h3 class="panel-title">Appunti</h3>
	</div>
    <div class="panel-body">
		<div class="row"> 
			<div class="col-md-12">
				{[ "type": "textarea", "label": "Descrizione", "name": "descrizione", "required": 0, "class": "autogrow", "value": "$descrizione$", "extra": "rows='5'" ]}
			</div>
        </div>
		<div class="row">
			<div class="col-md-12">
					{[ "type": "textarea", "label": "Note", "name": "note", "required": 0, "value": "$note$", "extra": "" ]}
			</div>
		</div>                                     	
	</div>
</div>

    
 
</form>

<?php
/*
	UPLOAD FILE
*/
filelist_and_upload( "Nota Spese", $id_record );
?>



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

