<?php include('casa/setup.casa.php');
$id = DataForms::GET('id');
include('inc_scripts.php');
$title = 'Foto Producto';
echo "<title>".AppName.' - '.$title."</title>";

$sql = "SELECT * FROM inventarios_productos WHERE prod_codigo = '$id';";
$db = new DB();
$db->dbSQL($sql);
$db->next();
	$prod_nombre = utf8_encode($db->dbField('prod_nombre'));											
	$prod_foto = $db->dbField('prod_foto');	
	  if(($prod_foto=='vacio')or($prod_foto=='')) 
	  $prod_foto = 'vacio.png';
?>
</head>
<body>
	<div class="wrapper">		
	<?php include('inc_menu.php');?>
		<div class="main-panel">
			<div class="content">
				
				<div class="page-inner">						
				<div class="row">
						<div class="col-md-12">
						<form action='<?php echo PATH_HOME.'productos-fotos2/'.uniqid(); ?>' method='post' enctype="multipart/form-data" novalidate>						
							<div class="card">
								<div class="card-header">
									<div class="card-title"><?php echo $title.': '.$prod_nombre?></div>
								</div>
								<div class="card-body">
									<div class="row">																														
										<div class="col-md-6 col-lg-12">																																										
											<div class="form-group form-group-default">
												<center><img src="<?php echo PATH_HOME.'fotos/small_'.$prod_foto ?>"></center>
												<br>
												<input type="file" id='txtFoto' name='txtFoto' class="form-control">
												<input type="hidden" id='txtCodigo' name='txtCodigo' value='<?php echo $id ?>'>
											</div>																						
										</div>
									</div>
								</div>
								<div class="card-action"><center>
									<div id='res'></div>
									<a href='<?php echo PATH_HOME.'productos/'; ?>' class="btn btn-danger"><b> CANCELAR </b></a>
									<button class="btn btn-info" type='submit'><b> GUARDAR FOTO </b></button>	</center>								
								</div>
							</div>
						</form>
						</div>
					</div>
				</div>
				
			</div>
			<?php include('inc_pie.php');?>
		</div>
		
		
	</div>
</body>
</html>