<?php
	include_once(__DIR__."/../../core.php");

	
	
	$module_name = 'Installazioni';
	
	$iddocumento = $html->form('matricola');
	$id_record = $html->form('matricola');
	$matricola = $html->form('matricola');
	$idriga = $html->form('idriga');
	$dir = "entrata";
	
	$q = "SELECT *  from my_impianti WHERE matricola='".$iddocumento."'";
	$rs = $dbo->fetchArray($q);
	$matricola = $rs[0]['matricola'];
	$idanagrafica = $rs[0]['idanagrafica'];
	
	
	
	//Info riga inserita

	$q = "SELECT * FROM my_impianti_righe WHERE  id='".$idriga."'";
	$rsr = $dbo->fetchArray($q);
	/*
		Form di modifica riga documento
	*/
	echo "<label>Documento numero ".$numero."</label><br><br>\n";
	echo "<form id=\"link_form\" action=\"".$rootdir."/editor.php?id_module=".$modules_info[$module_name]['id']."&id_record=".$iddocumento."\" method=\"post\">\n";
	
	echo "	<input type='hidden' name='op' value='editriga'>\n";
	echo "	<input type='hidden' name='idriga' value='".$idriga."'>\n";
	echo "	<input type='hidden' name='backto' value='record-edit'>\n";
	echo "	<input type='hidden' name='dir' value='".$dir."'>\n";
	
	
	
	//Descrizione
	echo "	<div class='row'>\n";
	echo "		<div class='col-md-12'>\n";
	echo "			<label>Descrizione</label>\n";
	echo "			<textarea name=\"descrizione\" id=\"descrizione\" class='form-control' >".$rsr[0]['descrizione']."</textarea>\n";
	echo "		</div>\n";
	echo "	</div>\n";
			
	echo "<br>";

	echo "<div class='panel panel-primary'>";
		echo "<div class='panel-body'>";
			echo "	<div class='row'>\n";	
			//Qta	
				echo "		<div class='col-md-3'>\n";
				echo "			<div class='form-group'>\n";
				echo "				<label>Q.t&agrave;</label>\n";
				echo "				<div class='input-group'>\n";
				echo "					<input type='text' class='form-control inputmask-decimal' id='qta' maxlength='8' name='qta' value=\"".$rsr[0]['qta']."\">\n";
				echo "				</div>\n";
				echo "			</div>\n";
				echo "		</div>\n";		
			
			//Seriale
				echo "		<div class='col-md-8'>\n";
				echo "			<div class='form-group'>\n";
				echo "				<label>Seriale</label>\n";
				echo "				<div class='input-group'>\n";				
				echo "					<input type='text' required='true' class='form-control' id='seriale'  name='seriale'  value=\"".$rsr[0]['n_seriale']."\">\n";
				echo "				</div>\n";
				echo "			</div>\n";
				echo "		</div>\n";
			
			echo "		</div>\n";	
		echo "		</div>\n";		
	echo "		</div>\n";		
	
	
	
	
	
		
	echo "	<a onclick=\"addriga();\" class=\"btn btn-primary pull-right\"><i class=\"fa fa-edit\"></i> Modifica</a>\n";
	echo "</form>\n";
?>

	<script type="text/javascript">
	
		function addriga(){
		
				$("#link_form").submit();
			
		}
		
		$(document).ready( function(){
		
			start_superselect();
			start_inputmask();
		
		});
	</script>

	<div class="clearfix"></div>

