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

	
	

	$module_name = "Tipi di canone";
	
	$iddocumento = $html->form('iddocumento');
	$idriga = $html->form('idriga');

	
	//Info riga inserita
	$q = "SELECT * FROM co_contratti_tipi_righe_qta WHERE id='".$idriga."'";
	$rsr = $dbo->fetchArray($q);
	$idconto_fattura = $rsr[0]['idconto'];
	$id_magazzino_e=$rsr[0]['id_magazzino_e'];

	
	/*
		Form di modifica riga documento
	*/
	echo "<label>Modifica riga </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_qta'>\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-2'>\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";					
			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(){
			if( $('#descrizione').val()!='' && $('#idiva option:selected').val()!='' ){
				$("#link_form").submit();
			}
		}
		
		$(document).ready( function(){
		
			start_superselect();
			start_inputmask();
		
		});
	</script>

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

