<?php echo $this->render('admin/header.phtml'); ?>

<?php

$lit = array('A','B','C','D','E');

?>

<script type="text/javascript" language="javascript">

	$(document).ready(function () {

		<?php if( isset( $this->addProductSuccess ) ){ ?>
			alertify.success("<i class='fa fa-check'></i> <?php echo @Lib_Lang::translate(admin_product_add_success); ?>");
		<?php } ?>

		<?php if( isset( $this->editProductSuccess ) ){ ?>
			alertify.success("<i class='fa fa-check'></i> <?php echo @Lib_Lang::translate(admin_product_editproduct_success); ?>");
		<?php } ?>	
		
	});

</script>

<div class="container">		

<?php echo $this->render('admin/menu.phtml'); ?>
<?php echo $this->render('admin/productmenu.phtml'); ?>


<script type="text/javascript" language="javascript">

	$(document).ready(function () {	
	
	
		$( "#heightStandard" ).load( "<?php echo $this->url(array('controller' => 'admin', 'action' => 'producteditstandardsize'), 'default', true); ?>", {product_id: <?php echo$this->ProductInfo['product_id']; ?>, module_id: 'heightStandard'}, function(){} );
		
		$( "#widthStandard" ).load( "<?php echo $this->url(array('controller' => 'admin', 'action' => 'producteditstandardsize'), 'default', true); ?>", {product_id: <?php echo$this->ProductInfo['product_id']; ?>, module_id: 'widthStandard'}, function(){} );
		
		$( "#depthStandard" ).load( "<?php echo $this->url(array('controller' => 'admin', 'action' => 'producteditstandardsize'), 'default', true); ?>", {product_id: <?php echo$this->ProductInfo['product_id']; ?>, module_id: 'depthStandard'}, function(){} );
		
		$( "#shelfamountStandard" ).load( "<?php echo $this->url(array('controller' => 'admin', 'action' => 'producteditstandardsize'), 'default', true); ?>", {product_id: <?php echo$this->ProductInfo['product_id']; ?>, module_id: 'shelfamountStandard'}, function(){} );
<?php 
foreach( $lit as $key => $l ){
?>		
		$( "#Wysszar<?php echo$l; ?>Standard" ).load( "<?php echo $this->url(array('controller' => 'admin', 'action' => 'producteditstandardsize'), 'default', true); ?>", {product_id: <?php echo$this->ProductInfo['product_id']; ?>, module_id: 'Wysszar<?php echo$l; ?>Standard'}, function(){} );
<?php
}
?>		

		$('#formEditProduct').validate({
			errorClass: "formError",
			errorElement: "div",
			rules: {
				product_name: {
					required: true
				},
				image_product: {
					required: false
				}
			},
			messages: {
				product_name: {
					required: "<?php echo @Lib_Lang::translate(admin_product_required); ?>"
				}
			}
		});	
	
		$('[name="admin_editproduct"]').click(function(){
			if( $('#category_id').val() == 0 ){
				alertify.error("<i class='fa fa-close'></i> <?php echo @Lib_Lang::translate(admin_product_category_selecterr); ?>");
				return false;
			}else{
				return true;
			}
		});
	
	
	});

</script>

	
	<div class="row">
		<div class="col-xs-3 col-sm-3 col-md-3">
			<h3><?php echo @Lib_Lang::translate(admin_product_edit_top); ?><br /><small><?php echo$this->ProductInfo['product_name']; ?></small></h3>
			
		</div>
		<div class="col-xs-9 col-sm-9 col-md-9 text-right">
		</div>
	</div>

	<?php echo $this->render('admin/producteditmenu.phtml'); ?>

		
	<form id="formEditProduct" method="post" class="form-horizontal">
	

	
	<div class="row">
		<div class="col-xs-6 col-sm-6 col-md-6">
			<h3><?php echo @Lib_Lang::translate(admin_category_edit_top_size); ?></h3>
		</div>
		<div class="col-xs-6 col-sm-6 col-md-6 text-right formLabelMarginTop">
		
		
		</div>
	</div>	
	
	
	<div class="row">
		<hr />
	</div>


<script type="text/javascript" language="javascript">

	$(document).ready(function () {	

	
		$('[name="admin_editproduct"]').click(function(){
			min = parseInt($('[name="product_height_min"]').val());
			max = parseInt($('[name="product_height_max"]').val());
			def = parseInt($('[name="product_height_default"]').val());
			if( max < min ){
				alertify.error("<i class='fa fa-close'></i> <?php echo @Lib_Lang::translate(admin_product_size_height_error); ?>");
				return false;
			}else{
				if( def < min || def > max ){
					alertify.error("<i class='fa fa-close'></i> <?php echo @Lib_Lang::translate(admin_product_size_heightdef_error); ?>");					
					return false;
				}else{
					return true;					
				}
			}			
		});
	
	
	});

</script>
	
	
	
<?php

	$cmd = 'height';

?>
	
	
	
	<div class="row">
		<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_imagesize); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8"><input type="file" name="image_product_<?php echo$cmd; ?>" class="form-control fileInput" />
		
		<div id="message_<?php echo$cmd; ?>" style="padding-top:8px;padding-bottom:8px;display:none;"></div>
		<div class="row" id="finishPhoto_<?php echo$cmd; ?>"></div>
		</div>
	</div>
	
	

				
<script type="text/javascript" language="javascript">
	
$(document).ready(function () {

	<?php if( $this->rowProduct['product_'.$cmd.'_img'] ){ ?>
	$("#message_<?php echo$cmd; ?>").html('<?php echo @Lib_Lang::translate(admin_product_image_upload); ?>');
	$("#message_<?php echo$cmd; ?>").css({'display':'block'});
	$("#finishPhoto_<?php echo$cmd; ?>").load("<?php echo $this->url(array('controller' => 'admin', 'action' => 'productphotosize'), 'default', true); ?>",{'type':'<?php echo$cmd; ?>',filename: '<?php echo$this->rowProduct['product_'.$cmd.'_img']; ?>'}, function(){$("#message_<?php echo$cmd; ?>").css({'display':'none'});$("#message_<?php echo$cmd; ?>").html('');});
	<?php } ?>

	$("[name='image_product_<?php echo$cmd; ?>']").change(function() {
		var file = this.files[0];
		var imagefile = file.type;
		var imagename = file.name;
		var imagesize = file.size;
		
		if(imagesize > 1024*1024){
			alertify.error("<i class='fa fa-close'></i> <?php echo @Lib_Lang::translate(admin_product_image_maxsize); ?>");
		}else if( imagefile != 'image/jpeg' && imagefile != 'image/jpg' && imagefile != 'image/gif' && imagefile != 'image/png' ){
			alertify.error("<i class='fa fa-close'></i> <?php echo @Lib_Lang::translate(admin_product_image_errorfile); ?>");
		}else{
			$("#finishPhoto_<?php echo$cmd; ?>").html('');
			$("#message_<?php echo$cmd; ?>").html('<?php echo @Lib_Lang::translate(admin_product_image_upload); ?>');
			$("#message_<?php echo$cmd; ?>").css({'display':'block'});
			$("input").attr('disabled','disabled');
			var reader = new FileReader();
			reader.onload = function(){
			  var dataURL = reader.result;
			  
				$.ajax({
					url: "<?php echo $this->url(array('controller' => 'admin', 'action' => 'productaddphotosize'), 'default', true); ?>", 
					type: "POST",  
					data: {'type':'<?php echo$cmd; ?>','image_product_<?php echo$cmd; ?>':dataURL.replace(/^data:image\/(gif|png|jpg|jpeg);base64,/, "")},     
					success: function(data)  
					{
						var control = $("[name='image_product_<?php echo$cmd; ?>']");
						control.replaceWith( control = control.clone( true ) );
						$("input").removeAttr('disabled');
						$("#message_<?php echo$cmd; ?>").css({'display':'none'});
						$("#message_<?php echo$cmd; ?>").html('');
						$("#finishPhoto_<?php echo$cmd; ?>").html(data);
					}
				});
				
			};
			reader.readAsDataURL(this.files[0]);
		}
		
		
	});
	
	
	
});

</script>









	
	
	
	
	
	<div class="row">
		<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_size_height); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8">
		
			<div class="col-xs-12 col-sm-2 col-md-2 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_size_height_def); ?></div>
			<div class="col-xs-12 col-sm-2 col-md-2"><input type="number" step="1" min="0" name="product_height_default" class="form-control" value="<?php echo$this->rowProduct['product_height_default']; ?>" /></div>
		
			<div class="col-xs-12 col-sm-2 col-md-2 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_size_height_min); ?></div>
			<div class="col-xs-12 col-sm-2 col-md-2"><input type="number" step="1" min="0" name="product_height_min" class="form-control" value="<?php echo$this->rowProduct['product_height_min']; ?>" /></div>
			
			<div class="col-xs-12 col-sm-2 col-md-2 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_size_height_max); ?></div>
			<div class="col-xs-12 col-sm-2 col-md-2"><input type="number" step="1" min="0" name="product_height_max" class="form-control" value="<?php echo$this->rowProduct['product_height_max']; ?>" /></div>
		
		</div>
	</div>
	
	<div class="row">
		<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_size_height_standard); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8">
		
			<div id="heightStandard"></div>
		
			<br />
			<label><input type="checkbox" value="1" name="product_height_def_only" <?php if( $this->rowProduct['product_height_def_only'] == 1 ) echo'checked="checked"'; ?> /> <?php echo @Lib_Lang::translate(admin_product_def_only); ?></label>
		</div>
	</div>
	
	<div class="row">
		<hr />
	</div>
	
	


<script type="text/javascript" language="javascript">

	$(document).ready(function () {	

	
		$('[name="admin_editproduct"]').click(function(){
			min = parseInt($('[name="product_width_min"]').val());
			max = parseInt($('[name="product_width_max"]').val());
			def = parseInt($('[name="product_width_default"]').val());
			if( max < min ){
				alertify.error("<i class='fa fa-close'></i> <?php echo @Lib_Lang::translate(admin_product_size_width_error); ?>");
				return false;
			}else{
				if( def < min || def > max ){
					alertify.error("<i class='fa fa-close'></i> <?php echo @Lib_Lang::translate(admin_product_size_widthdef_error); ?>");					
					return false;
				}else{
					return true;					
				}
			}
		});
	
	
	});

</script>
	
	
	
	
	
	
	
	
	
	
	
<?php

	$cmd = 'width';

?>
	
	
	
	<div class="row">
		<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_imagesize); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8"><input type="file" name="image_product_<?php echo$cmd; ?>" class="form-control fileInput" />
		
		<div id="message_<?php echo$cmd; ?>" style="padding-top:8px;padding-bottom:8px;display:none;"></div>
		<div class="row" id="finishPhoto_<?php echo$cmd; ?>"></div>
		</div>
	</div>
	
	

				
<script type="text/javascript" language="javascript">
	
$(document).ready(function () {

	<?php if( $this->rowProduct['product_'.$cmd.'_img'] ){ ?>
	$("#message_<?php echo$cmd; ?>").html('<?php echo @Lib_Lang::translate(admin_product_image_upload); ?>');
	$("#message_<?php echo$cmd; ?>").css({'display':'block'});
	$("#finishPhoto_<?php echo$cmd; ?>").load("<?php echo $this->url(array('controller' => 'admin', 'action' => 'productphotosize'), 'default', true); ?>",{'type':'<?php echo$cmd; ?>',filename: '<?php echo$this->rowProduct['product_'.$cmd.'_img']; ?>'}, function(){$("#message_<?php echo$cmd; ?>").css({'display':'none'});$("#message_<?php echo$cmd; ?>").html('');});
	<?php } ?>

	$("[name='image_product_<?php echo$cmd; ?>']").change(function() {
		var file = this.files[0];
		var imagefile = file.type;
		var imagename = file.name;
		var imagesize = file.size;
		
		if(imagesize > 1024*1024){
			alertify.error("<i class='fa fa-close'></i> <?php echo @Lib_Lang::translate(admin_product_image_maxsize); ?>");
		}else if( imagefile != 'image/jpeg' && imagefile != 'image/jpg' && imagefile != 'image/gif' && imagefile != 'image/png' ){
			alertify.error("<i class='fa fa-close'></i> <?php echo @Lib_Lang::translate(admin_product_image_errorfile); ?>");
		}else{
			$("#finishPhoto_<?php echo$cmd; ?>").html('');
			$("#message_<?php echo$cmd; ?>").html('<?php echo @Lib_Lang::translate(admin_product_image_upload); ?>');
			$("#message_<?php echo$cmd; ?>").css({'display':'block'});
			$("input").attr('disabled','disabled');
			var reader = new FileReader();
			reader.onload = function(){
			  var dataURL = reader.result;
			  
				$.ajax({
					url: "<?php echo $this->url(array('controller' => 'admin', 'action' => 'productaddphotosize'), 'default', true); ?>", 
					type: "POST",  
					data: {'type':'<?php echo$cmd; ?>','image_product_<?php echo$cmd; ?>':dataURL.replace(/^data:image\/(gif|png|jpg|jpeg);base64,/, "")},     
					success: function(data)  
					{
						var control = $("[name='image_product_<?php echo$cmd; ?>']");
						control.replaceWith( control = control.clone( true ) );
						$("input").removeAttr('disabled');
						$("#message_<?php echo$cmd; ?>").css({'display':'none'});
						$("#message_<?php echo$cmd; ?>").html('');
						$("#finishPhoto_<?php echo$cmd; ?>").html(data);
					}
				});
				
			};
			reader.readAsDataURL(this.files[0]);
		}
		
		
	});
	
	
	
});

</script>







	
	
	
	
	
	<div class="row">
		<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_size_width); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8">
		
			<div class="col-xs-12 col-sm-2 col-md-2 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_size_width_def); ?></div>
			<div class="col-xs-12 col-sm-2 col-md-2"><input type="number" step="1" min="0" name="product_width_default" class="form-control" value="<?php echo$this->rowProduct['product_width_default']; ?>" /></div>
		
			<div class="col-xs-12 col-sm-2 col-md-2 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_size_width_min); ?></div>
			<div class="col-xs-12 col-sm-2 col-md-2"><input type="number" step="1" min="0" name="product_width_min" class="form-control" value="<?php echo$this->rowProduct['product_width_min']; ?>" /></div>
			
			<div class="col-xs-12 col-sm-2 col-md-2 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_size_width_max); ?></div>
			<div class="col-xs-12 col-sm-2 col-md-2"><input type="number" step="1" min="0" name="product_width_max" class="form-control" value="<?php echo$this->rowProduct['product_width_max']; ?>" /></div>
		
		</div>
	</div>
	
	<div class="row">
		<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_size_width_standard); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8">
		
			<div id="widthStandard"></div>
		
			<br />
			<label><input type="checkbox" value="1" name="product_width_def_only" <?php if( $this->rowProduct['product_width_def_only'] == 1 ) echo'checked="checked"'; ?> /> <?php echo @Lib_Lang::translate(admin_product_def_only); ?></label>
		
		</div>
	</div>
	
	<div class="row">
		<hr />
	</div>
	
	
	


<script type="text/javascript" language="javascript">

	$(document).ready(function () {	

	
		$('[name="admin_editproduct"]').click(function(){
			min = parseInt($('[name="product_depth_min"]').val());
			max = parseInt($('[name="product_depth_max"]').val());
			def = parseInt($('[name="product_depth_default"]').val());
			if( max < min ){
				alertify.error("<i class='fa fa-close'></i> <?php echo @Lib_Lang::translate(admin_product_size_depth_error); ?>");
				return false;
			}else{
				if( def < min || def > max ){
					alertify.error("<i class='fa fa-close'></i> <?php echo @Lib_Lang::translate(admin_product_size_depthdef_error); ?>");					
					return false;
				}else{
					return true;					
				}
			}
		});
	
	
	});

</script>
	
	
	
	
	
	
<?php

	$cmd = 'depth';

?>
	
	
	
	<div class="row">
		<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_imagesize); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8"><input type="file" name="image_product_<?php echo$cmd; ?>" class="form-control fileInput" />
		
		<div id="message_<?php echo$cmd; ?>" style="padding-top:8px;padding-bottom:8px;display:none;"></div>
		<div class="row" id="finishPhoto_<?php echo$cmd; ?>"></div>
		</div>
	</div>
	
	

				
<script type="text/javascript" language="javascript">
	
$(document).ready(function () {

	<?php if( $this->rowProduct['product_'.$cmd.'_img'] ){ ?>
	$("#message_<?php echo$cmd; ?>").html('<?php echo @Lib_Lang::translate(admin_product_image_upload); ?>');
	$("#message_<?php echo$cmd; ?>").css({'display':'block'});
	$("#finishPhoto_<?php echo$cmd; ?>").load("<?php echo $this->url(array('controller' => 'admin', 'action' => 'productphotosize'), 'default', true); ?>",{'type':'<?php echo$cmd; ?>',filename: '<?php echo$this->rowProduct['product_'.$cmd.'_img']; ?>'}, function(){$("#message_<?php echo$cmd; ?>").css({'display':'none'});$("#message_<?php echo$cmd; ?>").html('');});
	<?php } ?>

	$("[name='image_product_<?php echo$cmd; ?>']").change(function() {
		var file = this.files[0];
		var imagefile = file.type;
		var imagename = file.name;
		var imagesize = file.size;
		
		if(imagesize > 1024*1024){
			alertify.error("<i class='fa fa-close'></i> <?php echo @Lib_Lang::translate(admin_product_image_maxsize); ?>");
		}else if( imagefile != 'image/jpeg' && imagefile != 'image/jpg' && imagefile != 'image/gif' && imagefile != 'image/png' ){
			alertify.error("<i class='fa fa-close'></i> <?php echo @Lib_Lang::translate(admin_product_image_errorfile); ?>");
		}else{
			$("#finishPhoto_<?php echo$cmd; ?>").html('');
			$("#message_<?php echo$cmd; ?>").html('<?php echo @Lib_Lang::translate(admin_product_image_upload); ?>');
			$("#message_<?php echo$cmd; ?>").css({'display':'block'});
			$("input").attr('disabled','disabled');
			var reader = new FileReader();
			reader.onload = function(){
			  var dataURL = reader.result;
			  
				$.ajax({
					url: "<?php echo $this->url(array('controller' => 'admin', 'action' => 'productaddphotosize'), 'default', true); ?>", 
					type: "POST",  
					data: {'type':'<?php echo$cmd; ?>','image_product_<?php echo$cmd; ?>':dataURL.replace(/^data:image\/(gif|png|jpg|jpeg);base64,/, "")},     
					success: function(data)  
					{
						var control = $("[name='image_product_<?php echo$cmd; ?>']");
						control.replaceWith( control = control.clone( true ) );
						$("input").removeAttr('disabled');
						$("#message_<?php echo$cmd; ?>").css({'display':'none'});
						$("#message_<?php echo$cmd; ?>").html('');
						$("#finishPhoto_<?php echo$cmd; ?>").html(data);
					}
				});
				
			};
			reader.readAsDataURL(this.files[0]);
		}
		
		
	});
	
	
	
});

</script>







	
	<div class="row">
		<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_size_depth); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8">
		
			<div class="col-xs-12 col-sm-2 col-md-2 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_size_depth_def); ?></div>
			<div class="col-xs-12 col-sm-2 col-md-2"><input type="number" step="1" min="0" name="product_depth_default" class="form-control" value="<?php echo$this->rowProduct['product_depth_default']; ?>" /></div>
		
			<div class="col-xs-12 col-sm-2 col-md-2 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_size_depth_min); ?></div>
			<div class="col-xs-12 col-sm-2 col-md-2"><input type="number" step="1" min="0" name="product_depth_min" class="form-control" value="<?php echo$this->rowProduct['product_depth_min']; ?>" /></div>
			
			<div class="col-xs-12 col-sm-2 col-md-2 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_size_depth_max); ?></div>
			<div class="col-xs-12 col-sm-2 col-md-2"><input type="number" step="1" min="0" name="product_depth_max" class="form-control" value="<?php echo$this->rowProduct['product_depth_max']; ?>" /></div>
		
		</div>
	</div>
	
	<div class="row">
		<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_size_depth_standard); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8">
		
			<div id="depthStandard"></div>
		
			<br />
			<label><input type="checkbox" value="1" name="product_depth_def_only" <?php if( $this->rowProduct['product_depth_def_only'] == 1 ) echo'checked="checked"'; ?> /> <?php echo @Lib_Lang::translate(admin_product_def_only); ?></label>
		
		</div>
	</div>
	
	<div class="row">
		<hr />
	</div>
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	


<script type="text/javascript" language="javascript">

	$(document).ready(function () {	

		<?php if( $this->rowProduct['product_shelf'] == 0 ){ ?>
			$('#productShelf').hide();
		<?php } ?>
		
		$('[name="product_shelf"]').change(function(){
			if( $(this).val() == 1 ) $('#productShelf').show();
			else{
				$('[name="product_shelfamount_default"]').val($('[name="product_shelfamount_max"]').val());
				if( parseInt($('[name="product_shelfamount_max"]').val()) < parseInt($('[name="product_shelfamount_min"]').val()) ){
					$('[name="product_shelfamount_min"]').val(0);
				}
				$('#productShelf').hide();
			}
		});
	
		$('[name="admin_editproduct"]').click(function(){
			min = parseInt($('[name="product_shelfamount_min"]').val());
			max = parseInt($('[name="product_shelfamount_max"]').val());
			def = parseInt($('[name="product_shelfamount_default"]').val());
			if( max < min ){
				alertify.error("<i class='fa fa-close'></i> <?php echo @Lib_Lang::translate(admin_product_size_shelfamount_error); ?>");
				return false;
			}else{
				if( def < min || def > max ){
					alertify.error("<i class='fa fa-close'></i> <?php echo @Lib_Lang::translate(admin_product_size_shelfamountdef_error); ?>");					
					return false;
				}else{
					return true;					
				}
			}
		});
	
	
	});

</script>


	<div class="row">
		<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_size_shelf); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8">
		
			<select name="product_shelf" class="form-control">
				<option value="0" <?php if( $this->rowProduct['product_shelf'] == 0 )echo'selected'; ?>><?php echo @Lib_Lang::translate(admin_product_size_shelf_0); ?></option>
				<option value="1" <?php if( $this->rowProduct['product_shelf'] == 1 )echo'selected'; ?>><?php echo @Lib_Lang::translate(admin_product_size_shelf_1); ?></option>
			</select>
		
		</div>
	</div>

	<div id="productShelf">
	
	
	
	
	
	

	
	
	
<?php

	$cmd = 'shelfamount';

?>
	
	
	
	<div class="row">
		<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_imagesize); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8"><input type="file" name="image_product_<?php echo$cmd; ?>" class="form-control fileInput" />
		
		<div id="message_<?php echo$cmd; ?>" style="padding-top:8px;padding-bottom:8px;display:none;"></div>
		<div class="row" id="finishPhoto_<?php echo$cmd; ?>"></div>
		</div>
	</div>
	
	

				
<script type="text/javascript" language="javascript">
	
$(document).ready(function () {

	<?php if( $this->rowProduct['product_'.$cmd.'_img'] ){ ?>
	$("#message_<?php echo$cmd; ?>").html('<?php echo @Lib_Lang::translate(admin_product_image_upload); ?>');
	$("#message_<?php echo$cmd; ?>").css({'display':'block'});
	$("#finishPhoto_<?php echo$cmd; ?>").load("<?php echo $this->url(array('controller' => 'admin', 'action' => 'productphotosize'), 'default', true); ?>",{'type':'<?php echo$cmd; ?>',filename: '<?php echo$this->rowProduct['product_'.$cmd.'_img']; ?>'}, function(){$("#message_<?php echo$cmd; ?>").css({'display':'none'});$("#message_<?php echo$cmd; ?>").html('');});
	<?php } ?>

	$("[name='image_product_<?php echo$cmd; ?>']").change(function() {
		var file = this.files[0];
		var imagefile = file.type;
		var imagename = file.name;
		var imagesize = file.size;
		
		if(imagesize > 1024*1024){
			alertify.error("<i class='fa fa-close'></i> <?php echo @Lib_Lang::translate(admin_product_image_maxsize); ?>");
		}else if( imagefile != 'image/jpeg' && imagefile != 'image/jpg' && imagefile != 'image/gif' && imagefile != 'image/png' ){
			alertify.error("<i class='fa fa-close'></i> <?php echo @Lib_Lang::translate(admin_product_image_errorfile); ?>");
		}else{
			$("#finishPhoto_<?php echo$cmd; ?>").html('');
			$("#message_<?php echo$cmd; ?>").html('<?php echo @Lib_Lang::translate(admin_product_image_upload); ?>');
			$("#message_<?php echo$cmd; ?>").css({'display':'block'});
			$("input").attr('disabled','disabled');
			var reader = new FileReader();
			reader.onload = function(){
			  var dataURL = reader.result;
			  
				$.ajax({
					url: "<?php echo $this->url(array('controller' => 'admin', 'action' => 'productaddphotosize'), 'default', true); ?>", 
					type: "POST",  
					data: {'type':'<?php echo$cmd; ?>','image_product_<?php echo$cmd; ?>':dataURL.replace(/^data:image\/(gif|png|jpg|jpeg);base64,/, "")},     
					success: function(data)  
					{
						var control = $("[name='image_product_<?php echo$cmd; ?>']");
						control.replaceWith( control = control.clone( true ) );
						$("input").removeAttr('disabled');
						$("#message_<?php echo$cmd; ?>").css({'display':'none'});
						$("#message_<?php echo$cmd; ?>").html('');
						$("#finishPhoto_<?php echo$cmd; ?>").html(data);
					}
				});
				
			};
			reader.readAsDataURL(this.files[0]);
		}
		
		
	});
	
	
	
});

</script>

	
	

	<div class="row">
		<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_size_shelfamount); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8">
		
			<div class="col-xs-12 col-sm-2 col-md-2 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_size_shelfamount_def); ?></div>
			<div class="col-xs-12 col-sm-2 col-md-2"><input type="number" step="1" min="0" name="product_shelfamount_default" class="form-control" value="<?php echo$this->rowProduct['product_shelfamount_default']; ?>" /></div>
		
			<div class="col-xs-12 col-sm-2 col-md-2 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_size_shelfamount_min); ?></div>
			<div class="col-xs-12 col-sm-2 col-md-2"><input type="number" step="1" min="0" name="product_shelfamount_min" class="form-control" value="<?php echo$this->rowProduct['product_shelfamount_min']; ?>" /></div>
			
			<div class="col-xs-12 col-sm-2 col-md-2 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_size_shelfamount_max); ?></div>
			<div class="col-xs-12 col-sm-2 col-md-2"><input type="number" step="1" min="0" name="product_shelfamount_max" class="form-control" value="<?php echo$this->rowProduct['product_shelfamount_max']; ?>" /></div>
		
		</div>
	</div>
	
	<div class="row">
		<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_size_shelfamount_standard); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8">
		
			<div id="shelfamountStandard"></div>
		
			<br />
			<label><input type="checkbox" value="1" name="product_shelfamount_def_only" <?php if( $this->rowProduct['product_shelfamount_def_only'] == 1 ) echo'checked="checked"'; ?> /> <?php echo @Lib_Lang::translate(admin_product_def_only); ?></label>
		
		</div>
	</div>
	
	</div>
	
	<div class="row">
		<hr />
	</div>

	

	
	
	
	
	
	
	
<?php	

foreach( $lit as $key => $l ){
?>

<script type="text/javascript" language="javascript">

	$(document).ready(function () {	

		<?php if( $this->rowProduct['product_wysszer'.$l] == 0 ){ ?>
			$('#productWysszar<?php echo$l; ?>').hide();
		<?php } ?>
		
		$('[name="product_wysszer<?php echo$l; ?>"]').change(function(){
			if( $(this).val() == 1 ) $('#productWysszar<?php echo$l; ?>').show();
			else{
				$('[name="product_wysszer<?php echo$l; ?>amount_default"]').val($('[name="product_wysszer<?php echo$l; ?>amount_max"]').val());
				if( parseInt($('[name="product_wysszer<?php echo$l; ?>amount_max"]').val()) < parseInt($('[name="product_wysszer<?php echo$l; ?>amount_min"]').val()) ){
					$('[name="product_wysszer<?php echo$l; ?>amount_min"]').val(0);
				}
				$('#productWysszar<?php echo$l; ?>').hide();
			}
		});
	
		$('[name="admin_editproduct"]').click(function(){
			min = parseInt($('[name="product_wysszer<?php echo$l; ?>amount_min"]').val());
			max = parseInt($('[name="product_wysszer<?php echo$l; ?>amount_max"]').val());
			def = parseInt($('[name="product_wysszer<?php echo$l; ?>amount_default"]').val());
			if( max < min ){
				alertify.error("<i class='fa fa-close'></i> <?php echo @Lib_Lang::consta(admin_product_size_wysszer.$l.amount_error); ?>");
				return false;
			}else{
				if( def < min || def > max ){
					alertify.error("<i class='fa fa-close'></i> <?php echo @Lib_Lang::consta(admin_product_size_wysszer.$l.amountdef_error); ?>");					
					return false;
				}else{
					return true;					
				}
			}
		});
	
	
	});

</script>


	<div class="row">
		<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"><?php echo @Lib_Lang::consta(admin_product_size_wysszer.$l); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8">
		
			<select name="product_wysszer<?php echo$l; ?>" class="form-control">
				<option value="0" <?php if( $this->rowProduct['product_wysszer'.$l] == 0 )echo'selected'; ?>><?php echo @Lib_Lang::translate(admin_product_size_wysszer_0); ?></option>
				<option value="1" <?php if( $this->rowProduct['product_wysszer'.$l] == 1 )echo'selected'; ?>><?php echo @Lib_Lang::translate(admin_product_size_wysszer_1); ?></option>
			</select>
		
		</div>
	</div>

	<div id="productWysszar<?php echo$l; ?>">

<?php

	$cmd = 'wysszer'.$l.'amount';

?>
	
	<div class="row">
		<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_imagesize); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8"><input type="file" name="image_product_<?php echo$cmd; ?>" class="form-control fileInput" />
		
		<div id="message_<?php echo$cmd; ?>" style="padding-top:8px;padding-bottom:8px;display:none;"></div>
		<div class="row" id="finishPhoto_<?php echo$cmd; ?>"></div>
		</div>
	</div>
	
<script type="text/javascript" language="javascript">
	
$(document).ready(function () {

	<?php if( $this->rowProduct['product_'.$cmd.'_img'] ){ ?>
	$("#message_<?php echo$cmd; ?>").html('<?php echo @Lib_Lang::translate(admin_product_image_upload); ?>');
	$("#message_<?php echo$cmd; ?>").css({'display':'block'});
	$("#finishPhoto_<?php echo$cmd; ?>").load("<?php echo $this->url(array('controller' => 'admin', 'action' => 'productphotosize'), 'default', true); ?>",{'type':'<?php echo$cmd; ?>',filename: '<?php echo$this->rowProduct['product_'.$cmd.'_img']; ?>'}, function(){$("#message_<?php echo$cmd; ?>").css({'display':'none'});$("#message_<?php echo$cmd; ?>").html('');});
	<?php } ?>

	$("[name='image_product_<?php echo$cmd; ?>']").change(function() {
		var file = this.files[0];
		var imagefile = file.type;
		var imagename = file.name;
		var imagesize = file.size;
		
		if(imagesize > 1024*1024){
			alertify.error("<i class='fa fa-close'></i> <?php echo @Lib_Lang::translate(admin_product_image_maxsize); ?>");
		}else if( imagefile != 'image/jpeg' && imagefile != 'image/jpg' && imagefile != 'image/gif' && imagefile != 'image/png' ){
			alertify.error("<i class='fa fa-close'></i> <?php echo @Lib_Lang::translate(admin_product_image_errorfile); ?>");
		}else{
			$("#finishPhoto_<?php echo$cmd; ?>").html('');
			$("#message_<?php echo$cmd; ?>").html('<?php echo @Lib_Lang::translate(admin_product_image_upload); ?>');
			$("#message_<?php echo$cmd; ?>").css({'display':'block'});
			$("input").attr('disabled','disabled');
			var reader = new FileReader();
			reader.onload = function(){
			  var dataURL = reader.result;
			  
				$.ajax({
					url: "<?php echo $this->url(array('controller' => 'admin', 'action' => 'productaddphotosize'), 'default', true); ?>", 
					type: "POST",  
					data: {'type':'<?php echo$cmd; ?>','image_product_<?php echo$cmd; ?>':dataURL.replace(/^data:image\/(gif|png|jpg|jpeg);base64,/, "")},     
					success: function(data)  
					{
						var control = $("[name='image_product_<?php echo$cmd; ?>']");
						control.replaceWith( control = control.clone( true ) );
						$("input").removeAttr('disabled');
						$("#message_<?php echo$cmd; ?>").css({'display':'none'});
						$("#message_<?php echo$cmd; ?>").html('');
						$("#finishPhoto_<?php echo$cmd; ?>").html(data);
					}
				});
				
			};
			reader.readAsDataURL(this.files[0]);
		}
		
		
	});
	
	
	
});

</script>


	<div class="row">
		<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_size_wysszer_amount); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8">
		
			<div class="col-xs-12 col-sm-2 col-md-2 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_size_wysszer_amount_def); ?></div>
			<div class="col-xs-12 col-sm-2 col-md-2"><input type="number" step="1" min="0" name="product_wysszer<?php echo$l; ?>amount_default" class="form-control" value="<?php echo$this->rowProduct['product_wysszer'.$l.'amount_default']; ?>" /></div>
		
			<div class="col-xs-12 col-sm-2 col-md-2 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_size_wysszer_amount_min); ?></div>
			<div class="col-xs-12 col-sm-2 col-md-2"><input type="number" step="1" min="0" name="product_wysszer<?php echo$l; ?>amount_min" class="form-control" value="<?php echo$this->rowProduct['product_wysszer'.$l.'amount_min']; ?>" /></div>
			
			<div class="col-xs-12 col-sm-2 col-md-2 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_size_wysszer_amount_max); ?></div>
			<div class="col-xs-12 col-sm-2 col-md-2"><input type="number" step="1" min="0" name="product_wysszer<?php echo$l; ?>amount_max" class="form-control" value="<?php echo$this->rowProduct['product_wysszer'.$l.'amount_max']; ?>" /></div>
		
		</div>
	</div>
	
	<div class="row">
		<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_product_size_wysszer_amount_standard); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8">
		
			<div id="Wysszar<?php echo$l; ?>Standard"></div>
		
			<br />
			<label><input type="checkbox" value="1" name="product_wysszer<?php echo$l; ?>amount_def_only" <?php if( $this->rowProduct['product_wysszer'.$l.'amount_def_only'] == 1 ) echo'checked="checked"'; ?> /> <?php echo @Lib_Lang::translate(admin_product_def_only); ?></label>
		
		</div>
	</div>
	
	</div>
	
	<div class="row">
		<hr />
	</div>

<?php
}
?>	

	
	
	
	
		
	
	
	
	
	
	
	
	
	
	
	
	
	
	<div class="row">
		<div class="col-xs-12 col-sm-4 col-md-4 text-right"></div>
		<div class="col-xs-12 col-sm-8 col-md-8"><input name="admin_editproduct" class="btn btn-info form-control" type="submit" value="<?php echo @Lib_Lang::translate(admin_product_edit_button); ?>" /></div>
	</div>
	
	</form>	
		
</div>

<?php echo $this->render('admin/footer.phtml'); ?>