<?php
ini_set("default_charset", "UTF-8");
header('Content-type: text/html; charset=UTF-8');
ini_set('memory_limit', '256M');
// error_reporting(0);
require('connect.php');
include('header.php');
require('includes/resizeImage.class.php');
$qry = "SELECT * FROM production WHERE id=".$_GET['id'];
$res = mysqli_query($dbC, $qry);
$row = mysqli_fetch_assoc($res);
$q2 = "SELECT fullname, ALogin FROM users";
$r2 = mysqli_query($dbC, $q2);
// print_r($row);
$var_par = json_decode($row['varh_proiontwn']);
$varh_tel = json_decode($row['varh_tel']);
$varh_sums = json_decode($row['varh_sums']);
$proeleush = json_decode($row['proeleush']);
$hm_paralav = json_decode($row['hm_paralav']);
$eidos = json_decode($row['eidos_megethos']);
$pics = json_decode($row['picture']);
?>
<link rel="stylesheet" href="css/control_styles.css">
<script src="js/plupload.full.min.js"></script>
<script src="js/jquery.plupload.queue/jquery.plupload.queue.js"></script>
<script src="js/control_functions.js"></script>
<script type="text/javascript">
function getDate(id, order){
	$.ajax({
		method: 'POST',
		url: 'get_date.php',
		data: {id: id},
		success: function(r){
			var res = JSON.parse(r);
			$("[name='hm_paralav[]'][data-order='"+order+"']").val(res['hm_paralav']);
			$("[name='eidos_megethos[]'][data-order='"+order+"']").val(res['eidos']);
		}
	})
}


	function check_totals(show_total=true){
		var box = 0;
		var total = [];
		// var filter = /^.(\d+)[/]?(\d+)?[+]?$/;
		// var qty = $('[name="eidos"]').val();
		// qty = filter.exec(qty);
		$('[name^="par_kiv"]').each(function(){
			box = $(this).data('order');
			num = parseInt($(this).val());
			// $(this).removeClass('red green blue');
			if(!isNaN(num)){
				// if($(this).val()!=""){
				// 	if($(this).val()<parseInt(qty[1])*100){
				// 		$(this).addClass('red');
				// 	} else if ($(this).val()>parseInt(qty[2])*100) {
				// 		$(this).addClass('blue');
				// 	} else {
				// 		$(this).addClass('green');
				// 	}
				// }
				if(typeof total[box] == 'undefined') {
					total[box]=num;
				} else {
					total[box]+=num;
				}
			}
			if(show_total==true){
				$('#athr'+box+' input').val(total[box]);
			}
		})
		console.log(total);
	}

	function title(){
		regx = /^([^-\s]){1}.*\s([^-\s]){1}.*/;
		res = regx.exec($('[name="proion1"]').val());
		document.title = res[1]+res[2]+($('[name="proion"]').val()!="" ? " - "+$('[name="proion"]').val() : "");
	}

	$(document).ready(function(){
		title();
		$('[name="proion1"], [name="proion"]').on('change keyup', function(){
			title();
		})

		$('[name^="par_kiv"]').on('change', function(){
		 check_totals();
		});

		$('#partbl_head').on('click',function(){
        	$('#partbl_body').toggle();
         	if($('#toggle_partbl').hasClass('glyphicon-plus')){
            	$('#toggle_partbl').switchClass('glyphicon-plus', 'glyphicon-minus');
         	} else {
            	$('#toggle_partbl').switchClass('glyphicon-minus', 'glyphicon-plus');
         	}
        });
        $('#submit').on('click', function(){
        	prod2db('edit', <?php echo $_GET['id']; ?>);
        });
				$('[name="proeleush[]"]').on('change', function(){
					val = $(this).val();
					if(val!="" && Number.isInteger(parseInt(val))){
						getDate($(this).val(),$(this).data('order'));
					}

				})
	})

</script>
<style>
	.botbord .row:not(:last-child) {
	    border-bottom: solid 1px rgba(0,0,0,0.1) !important;
	}
	.botbord .row{
		padding-bottom: 0.5rem;
	    padding-top: 0.5rem;
	}
	#partbl_head{
		cursor: pointer;
	}
	.panel-heading{
		font-weight: 600;
	}
	* {
      font-size: 12px !important;
    }
</style>

<div id="piczoom" style="display:none;padding:1rem;"></div>
<div class="container-fluid">
	<div class="row">
		<div class="col-sm-6">
			<div class="panel panel-default">
				<div class="panel-heading">ΑΥΛΗ</div>
				<div class="panel-body botbord">
					<div class="row">
						<div class="col-sm-4">ΠΡΟΕΛΕΥΣΗ</div>
						<div class="col-sm-8">
							<div class="row">
								<div class="col-sm-4">
									<input class="form-control" type="text" data-order="0" name="proeleush[]" value="<?php echo $proeleush[0]; ?>"/>
								</div>
								<div class="col-sm-4">
									<input class="form-control" type="text" data-order="1" name="proeleush[]" value="<?php echo $proeleush[1]; ?>"/>
								</div>
								<div class="col-sm-4">
									<input class="form-control" type="text" data-order="2" name="proeleush[]" value="<?php echo $proeleush[2]; ?>"/>
								</div>
							</div>
							<div class="row">
								<div class="col-sm-4">
									<input class="form-control" type="text" data-order="3" name="proeleush[]" value="<?php echo $proeleush[3]; ?>"/>
								</div>
								<div class="col-sm-4">
									<input class="form-control" type="text" data-order="4" name="proeleush[]" value="<?php echo $proeleush[4]; ?>"/>
								</div>
								<div class="col-sm-4">
									<input class="form-control" type="text" data-order="5" name="proeleush[]" value="<?php echo $proeleush[5]; ?>"/>
								</div>
							</div>
						</div>
					</div>
					<div class="row">
						<div class="col-sm-4">ΗΜ/ΝΙΑ ΠΑΡΑΛΑΒΗΣ</div>
						<div class="col-sm-8">
							<div class="row">
								<div class="col-sm-4">
									<input class="form-control" type="date" data-order="0" name="hm_paralav[]" value="<?php echo $hm_paralav[0]; ?>" />
								</div>
								<div class="col-sm-4">
									<input class="form-control" type="date" data-order="1" name="hm_paralav[]" value="<?php echo $hm_paralav[1]; ?>" />
								</div>
								<div class="col-sm-4">
									<input class="form-control" type="date" data-order="2" name="hm_paralav[]" value="<?php echo $hm_paralav[2]; ?>" />
								</div>
							</div>
							<div class="row">
								<div class="col-sm-4">
									<input class="form-control" type="date" data-order="3" name="hm_paralav[]" value="<?php echo $hm_paralav[3]; ?>" />
								</div>
								<div class="col-sm-4">
									<input class="form-control" type="date" data-order="4" name="hm_paralav[]" value="<?php echo $hm_paralav[4]; ?>" />
								</div>
								<div class="col-sm-4">
									<input class="form-control" type="date" data-order="5" name="hm_paralav[]" value="<?php echo $hm_paralav[5]; ?>" />
								</div>
							</div>
						</div>
					</div>
					<div class="row">
						<div class="col-sm-4">ΕΙΔΟΣ-ΜΕΓΕΘΟΣ</div>
						<div class="col-sm-8">
							<div class="row">
								<div class="col-sm-4">
									<input class="form-control" type="text" data-order="0" value="<?php echo $eidos[0]; ?>" name="eidos_megethos[]" />
								</div>
								<div class="col-sm-4">
									<input class="form-control" type="text" data-order="1" value="<?php echo $eidos[1]; ?>" name="eidos_megethos[]" />
								</div>
								<div class="col-sm-4">
									<input class="form-control" type="text" data-order="2" value="<?php echo $eidos[2]; ?>" name="eidos_megethos[]" />
								</div>
							</div>
							<div class="row">
								<div class="col-sm-4">
									<input class="form-control" type="text" data-order="3" value="<?php echo $eidos[3]; ?>" name="eidos_megethos[]" />
								</div>
								<div class="col-sm-4">
									<input class="form-control" type="text" data-order="4" value="<?php echo $eidos[4]; ?>" name="eidos_megethos[]" />
								</div>
								<div class="col-sm-4">
									<input class="form-control" type="text" data-order="5" value="<?php echo $eidos[5]; ?>" name="eidos_megethos[]" />
								</div>
							</div>
						</div>
					</div>
					<div class="row">
						<div class="col-sm-4">ΠΟΣΟΤΗΤΑ</div>
						<div class="col-sm-8"><input class="form-control" type="text" name="posothta" value="<?php echo $row['posothta']; ?>"/></div>
					</div>
					<div class="row">
						<div class="col-sm-4">ΘΕΡΜ/ΣΙΑ ΠΑΡΑΛΑΒΗΣ</div>
						<div class="col-sm-8"><input class="form-control" type="number" name="therm_paralav" value="<?php echo $row['therm_paralav']; ?>"/></div>
					</div>
				</div>
			</div>
		</div>

		<div class="col-sm-6">
			<div class="panel panel-default">
				<div class="panel-heading">ΠΡΟΙΟΝ</div>
				<div class="panel-body botbord">
					<div class="row">
						<div class="col-sm-6">ΗΜ/ΝΙΑ ΕΠΕΞΕΡΓΑΣΙΑΣ</div>
						<div class="col-sm-6"><input class="form-control" type="date" name="hm_epex"  value="<?php echo $row['hm_epex']; ?>" /></div>
					</div>
					<div class="row">
						<div class="col-sm-6">ΗΜ/ΝΙΑ ΑΝΑΧΩΡΗΣΗΣ</div>
						<div class="col-sm-6"><input class="form-control" type="date" name="hm_anaxwrhshs"  value="<?php echo $row['hm_anaxwrhshs']; ?>" /></div>
					</div>
					<div class="row">
						<div class="col-sm-6">ΕΛΕΓΚΤΗΣ</div>
						<div class="col-sm-6">
							<div class="form-group">
								<?php
									$el1 = "";
									$el2 = "";
									while($users = mysqli_fetch_assoc($r2)){
										$el1.="<option value=\"".$users['ALogin']."\" ".($users['ALogin']==$row['elegkths'] ? 'selected' : '').">".$users['fullname']."</option>";
										$el2.="<option value=\"".$users['ALogin']."\" ".($users['ALogin']==$row['elegkths2'] ? 'selected' : '').">".$users['fullname']."</option>";
									}
								?>
								<select class="form-control" name="elegkths">
									<?php
										echo $el1;
									?>
								</select>
								<select class="form-control" name="elegkths2">
									<?php
										echo $el2;
									?>
								</select>
							</div>
						</div>
					</div>
					<div class="row">
						<div class="col-sm-6">ΕΓΚΑΤΑΣΤΑΣΗ</div>
						<div class="col-sm-6">
							<div class="form-group">
								<select class="form-control" name="egkatastash">
									<option value="02KN130" <?php echo ($row['egkatastash']=='02KN130' ? "selected" : ""); ?>>02KN130</option>
									<option value="04KN152" <?php echo ($row['egkatastash']=='04KN152' ? "selected" : ""); ?>>04KN152</option>
								</select>
							</div>
					</div>
					</div>
					<div class="row">
						<div class="col-sm-6">ΠΟΣΟΤΗΤΑ</div>
						<div class="col-sm-6"><input class="form-control" type="text" name="posothta2"  value="<?php echo $row['posothta2']; ?>" /></div>
					</div>
					<div class="row">
						<div class="col-sm-6">ΠΡΟΙΟΝ</div>
						<div class="col-sm-6">
							<div class="row">
								<div class="col-sm-6">
									<div class="form-group">
										<select class="form-control" name="proion1">
											<option value="Φιλέτο Λαυράκι" <?php echo ($row['proion1']=='Φιλέτο Λαυράκι' ? "selected" : ""); ?>>Φιλέτο Λαυράκι</option>
											<option value="Φιλέτο Τσιπούρα" <?php echo ($row['proion1']=='Φιλέτο Τσιπούρα' ? "selected" : ""); ?>>Φιλέτο Τσιπούρα</option>
											<option value="Απεντέρωση Λαυράκι" <?php echo ($row['proion1']=='Απεντέρωση Λαυράκι' ? "selected" : ""); ?>>Απεντέρωση Λαυράκι</option>
											<option value="Απεντέρωση Τσιπούρα" <?php echo ($row['proion1']=='Απεντέρωση Τσιπούρα' ? "selected" : ""); ?>>Απεντέρωση Τσιπούρα</option>
										</select>
									</div>
								</div>
								<div class="col-sm-6">
									<input class="form-control" type="text" value="<?php echo $row['proion']; ?>" name="proion" />
								</div>
							</div>
					</div>
					<div class="row">
						<div class="col-sm-6">ΘΕΡΜ/ΣΙΑ ΕΠΕΞΕΡΓΑΣΙΑΣ(Πρίν την προσθήκη πάγου)</div>
						<div class="col-sm-6"><input class="form-control" type="number" name="therm_epex" value="<?php echo $row['therm_epex']; ?>" /></div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<div class="row">
		<div class="col-sm-12">
			<div class="panel panel-default">
       		    <div class="panel-heading" id="partbl_head">ΒΑΡΗ ΠΡΟΪΟΝΤΩΝ ΑΝΑ ΤΜΧ <span class="pull-right"><i id="toggle_partbl" class="glyphicon glyphicon-plus" style="cursor:pointer;"></i></span></div>
       		    <div class="panel-body" style="display: none;" id="partbl_body">
       		       <table class="table table-striped table-responsive table-bordered">
       		          <thead>
       		             <tr>
       		                <th></th>
       		                <th style="text-align: center;">Κιβώτιο 1</th>
       		                <th style="text-align: center;">Κιβώτιο 2</th>
       		                <th style="text-align: center;">Κιβώτιο 3</th>
       		                <th style="text-align: center;">Κιβώτιο 4</th>
       		                <th style="text-align: center;">Κιβώτιο 5</th>
       		                <th style="text-align: center;">Κιβώτιο 6</th>
       		                <th style="text-align: center;">Κιβώτιο 7</th>
       		                <th style="text-align: center;">Κιβώτιο 8</th>
       		                <th style="text-align: center;">Κιβώτιο 9</th>
       		                <th style="text-align: center;">Κιβώτιο 10</th>
       		                <th style="text-align: center;width:2rem;">Βάρη Κιβωτίων Τελικού Προϊόντος</th>
       		             </tr>
       		          </thead>
       		          <tbody>
       		             <?php
       		                for($y=1;$y<=40;$y++){
       		                   echo
       		                   "<tr>
       		                      <td>".$y."</td>
       		                      <td><center><input class=\"form-control\" data-order=\"1\" type='number' name='par_kiv1[]'  value=\"".$var_par[0][$y-1]."\" /></center></td>
       		                      <td><center><input class=\"form-control\" data-order=\"2\" type='number' name='par_kiv2[]'  value=\"".$var_par[1][$y-1]."\" /></center></td>
       		                      <td><center><input class=\"form-control\" data-order=\"3\" type='number' name='par_kiv3[]'  value=\"".$var_par[2][$y-1]."\" /></center></td>
       		                      <td><center><input class=\"form-control\" data-order=\"4\" type='number' name='par_kiv4[]'  value=\"".$var_par[3][$y-1]."\" /></center></td>
       		                      <td><center><input class=\"form-control\" data-order=\"5\" type='number' name='par_kiv5[]'  value=\"".$var_par[4][$y-1]."\" /></center></td>
       		                      <td><center><input class=\"form-control\" data-order=\"6\" type='number' name='par_kiv6[]'  value=\"".$var_par[5][$y-1]."\" /></center></td>
       		                      <td><center><input class=\"form-control\" data-order=\"7\" type='number' name='par_kiv7[]'  value=\"".$var_par[6][$y-1]."\" /></center></td>
       		                      <td><center><input class=\"form-control\" data-order=\"8\" type='number' name='par_kiv8[]'  value=\"".$var_par[7][$y-1]."\" /></center></td>
       		                      <td><center><input class=\"form-control\" data-order=\"9\" type='number' name='par_kiv9[]'  value=\"".$var_par[8][$y-1]."\" /></center></td>
       		                      <td><center><input class=\"form-control\" data-order=\"10\" type='number' name='par_kiv10[]'  value=\"".$var_par[9][$y-1]."\" /></center></td>
       		                      <td><center><input class=\"form-control\" data-order=\"11\" type='number' name='varh_tel[]'  value=\"".$varh_tel[$y-1]."\" /></center></td>
       		                   </tr>";
       		                }
       		             ?>
       		          </tbody>
										<tfoot>
											<tr>
												<td>Sum</td>
												<td id="athr1"><input class="form-control" value="<?php echo $varh_sums[0]; ?>" type="number" name="varh_sums[]" /></td>
												<td id="athr2"><input class="form-control" value="<?php echo $varh_sums[1]; ?>" type="number" name="varh_sums[]" /></td>
												<td id="athr3"><input class="form-control" value="<?php echo $varh_sums[2]; ?>" type="number" name="varh_sums[]" /></td>
												<td id="athr4"><input class="form-control" value="<?php echo $varh_sums[3]; ?>" type="number" name="varh_sums[]" /></td>
												<td id="athr5"><input class="form-control" value="<?php echo $varh_sums[4]; ?>" type="number" name="varh_sums[]" /></td>
												<td id="athr6"><input class="form-control" value="<?php echo $varh_sums[5]; ?>" type="number" name="varh_sums[]" /></td>
												<td id="athr7"><input class="form-control" value="<?php echo $varh_sums[6]; ?>" type="number" name="varh_sums[]" /></td>
												<td id="athr8"><input class="form-control" value="<?php echo $varh_sums[7]; ?>" type="number" name="varh_sums[]" /></td>
												<td id="athr9"><input class="form-control" value="<?php echo $varh_sums[8]; ?>" type="number" name="varh_sums[]" /></td>
												<td id="athr10"><input class="form-control" value="<?php echo $varh_sums[9]; ?>"  type="number" name="varh_sums[]" /></td>
												<td id="athr11"><input class="form-control" value="<?php echo $varh_sums[10]; ?>"  type="number" name="varh_sums[]" /></td>
											</tr>
										</tfoot>
       		       </table>
       		    </div>
       		</div>
		</div>
	</div>

	<div class="row">
		<div class="col-sm-6">
			<div class="panel panel-default">
				<div class="panel-heading">
					<div class="row">
						<div class="col-sm-10">ΕΜΦΑΝΙΣΗ ΕΠΕΞΕΡΓΑΣΜΕΝΟΥ</div>
						<div class="col-sm-2">%</div>
					</div>
				</div>
				<div class="panel-body botbord">
					<div class="row">
						<div class="col-sm-10" style="text-align: left;">GAPS</div>
						<div class="col-sm-2"><input class="form-control" type="number" name="gaps"  value="<?php echo $row['gaps']; ?>" /></div>
					</div>
					<div class="row">
						<div class="col-sm-10" style="text-align: left;">ΑΙΜΑΤΩΜΑΤΑ</div>
						<div class="col-sm-2"><input class="form-control" type="number" name="aimatwmata"  value="<?php echo $row['aimatwmata']; ?>" /></div>
					</div>
					<div class="row">
						<div class="col-sm-10" style="text-align: left;">ΧΡΩΜΑΤΙΣΜΟΙ(ΠΧ ΑΠΟ ΧΟΛΗ)</div>
						<div class="col-sm-2"><input class="form-control" type="number" name="xrwmatismoi"  value="<?php echo $row['xrwmatismoi']; ?>" /></div>
					</div>
					<div class="row">
						<div class="col-sm-10" style="text-align: left;">ΚΟΚΚΑΛΑ ΣΤΗΝ ΚΟΙΛΙΑΚΗ ΧΩΡΑ</div>
						<div class="col-sm-2"><input class="form-control" type="number" name="kokkala"  value="<?php echo $row['kokkala']; ?>" /></div>
					</div>
					<div class="row">
						<div class="col-sm-10" style="text-align: left;">ΠΛΗΡΟΤΗΤΑ ΠΑΓΟΥ ΣΤΟ ΚΙΒ</div>
						<div class="col-sm-2"><input class="form-control" type="number" name="plhrothta_pagou"  value="<?php echo $row['plhrothta_pagou']; ?>" /></div>
					</div>
					<div class="row">
						<div class="col-sm-10" style="text-align: left;">PINBONES (ΜΟΝΟ ΓΙΑ V-CUT)</div>
						<div class="col-sm-2"><input class="form-control" type="number" name="pinbones"  value="<?php echo $row['pinbones']; ?>" /></div>
					</div>
					<div class="row">
						<div class="col-sm-10" style="text-align: left;">ΑΠΟΛΕΠΙΣΗ</div>
						<div class="col-sm-2">
							<div class="form-group">
								<select class="form-control" name="apolepish">
									<option value="0" <?php echo ($row['apolepish']==0 ? 'selected' : ''); ?>>ΟΧΙ</option>
									<option value="1" <?php echo ($row['apolepish']==1 ? 'selected' : ''); ?>>ΝΑΙ</option>
								</select>
							</div>
						</div>
					</div>
					<div class="row">
						<div class="col-sm-10" style="text-align: left;">ΑΠΕΝΤΕΡΩΣΗ</div>
						<div class="col-sm-2">
							<div class="form-group">
								<select class="form-control" name="apenterwsh">
									<option value="0" <?php echo ($row['apenterwsh']==0 ? 'selected' : ''); ?>>ΟΧΙ</option>
									<option value="1" <?php echo ($row['apenterwsh']==1 ? 'selected' : ''); ?>>ΝΑΙ</option>
								</select>
							</div>
						</div>
					</div>
					<div class="row">
						<div class="col-sm-10" style="text-align: left;">ΑΠΟΥΣΙΑ ΒΡΑΓΧΙΩΝ</div>
						<div class="col-sm-2">
							<div class="form-group">
								<select class="form-control" name="apousia_vragxiwn">
									<option value="0" <?php echo ($row['apousia_vragxiwn']==0 ? 'selected' : ''); ?>>ΟΧΙ</option>
									<option value="1" <?php echo ($row['apousia_vragxiwn']==1 ? 'selected' : ''); ?>>ΝΑΙ</option>
								</select>
							</div>
						</div>
					</div>
					<div class="row">
						<div class="col-sm-10" style="text-align: left;">ΑΠΟΥΣΙΑ ΠΤΕΡΥΓΙΩΝ</div>
						<div class="col-sm-2">
							<div class="form-group">
								<select class="form-control" name="apousia_pterugiwn">
									<option value="0" <?php echo ($row['apousia_pterugiwn']==0 ? 'selected' : ''); ?>>ΟΧΙ</option>
									<option value="1" <?php echo ($row['apousia_pterugiwn']==1 ? 'selected' : ''); ?>>ΝΑΙ</option>
								</select>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<div class="col-sm-6">
			<div class="row">
				<div class="panel panel-default">
					<div class="panel-heading">ΓΕΝΙΚΑ - ΠΑΡΑΤΗΡΗΣΕΙΣ</div>
					<div class="panel-body">
						<div class="form-group">
	 							<label for="comment">Σχόλια:</label>
	 							<textarea class="form-control" rows="5" id="comment" name="comments"><?php echo $row['comments']; ?></textarea>
						</div>
						<div class="row">
							<div class="col-sm-6 col-md-6 col-lg-4 pull-right">
								<div class="panel panel-default">
									<div class="panel-body">
										<div class="checkbox">
	           					<label><input type="checkbox" value="1" name="pros_emporio" <?php echo ($row['pros_emporio']==1 ? 'checked' : ''); ?>> ΑΠΕΛΕΥΘΕΡΩΣΗ ΠΑΡΤΙΔΑΣ ΠΡΟΣ ΕΜΠΟΡΙΑ</label>
	           				</div>
	           			</div>
	           		</div>
							</div>
						</div>
					</div>
				</div>
			</div>
			<div class="row">
				<div class="panel panel-default">
					<div class="panel-heading">Φωτογραφίες</div>
					<div class="panel-body" id="pics">
						<div class="row">
							<div class="col-sm-6 col-sm-offset-3" style="text-align:center;">
								<div id="filelist">Your browser doesn't have Flash, Silverlight or HTML5 support.</div>
								<div id="console"></div>
		            <div id="upcontainer">
		              <a id="pickfiles" href="javascript:;" class="btn btn-default">Select files</a>
		              <a id="uploadfiles" href="javascript:;" class="btn btn-default">Upload files</a>
		            </div>
								<input type="hidden" name="picture" id="picinp" value='<?php echo $row['picture']; ?>' /><input type="hidden" id="freskothta" name="freskothta" value="" />
							</div>
						</div>
						<div class="row" style="margin-top:1rem;">
							<?php
							if(sizeof($pics)>0){
								$ii=1;
								foreach($pics as $pic){
									try{
							 			$resize = new ResizeImage('uploads/images/'.$pic);
							 			$resize->resizeTo(300, 300, 'maxHeight');
							 			$resize->saveImage('uploads/images/temp/'.$pic);
							 			echo "<div class='pic col-sm-4' data-name='".$pic."'><center>
								 		<div class='row' style='margin-bottom:1rem;margin-top:1rem;'>
									 		<div class='col-sm-12'>
										 		<button class='btn btn-danger' onclick=\"delphoto('".$pic."');\">Διαγραφή <i class='glyphicon glyphicon-remove' style=\"font-size:1rem;\"></i></button>
									 		</div>
								 		</div>
								 		<div class='row'>
									 		<div class='col-sm-12'>
										 		<img class='img-responsive' height=\"300\" onclick=\"zoom('".$pic."');\" src=\"uploads/images/temp/".$pic."\" />
									 		</div>
								 		</div>
						 			</center></div>";

							} catch (Exception $e) {
							 // echo 'Caught exception: ',  $e->getMessage(), "\n";
							}

							 if($ii%3==0){
								 echo "</div><div class='row'>";
							 }
							 $ii++;
							}
							}
							?>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<div class="row">
		<div class="col-sm-1 pull-right">
			<?php
				if(isset($_GET['type']) && $_GET['type']=='edit'){
			?>
					<input type="button" class="btn btn-danger btn-lg pull-right" id="submit" value="Αποθήκευση Αλλαγών" />
			<?php
				}
			?>
		</div>
		<div class="row" style="height:5rem;"></div>
	</div>
</div>
</body>
<footer>
	<div class="row">
		<div class="col-sm-6 col-sm-offset-3">
			<h3 class="h3"><b><u>Selonda Group - Δ09Ε09 ΕΝΤΥΠΟ ΕΛΕΓΧΟΥ ΕΠΕΞΕΡΓΑΣΜΕΝΩΝ ΠΡΟΙΟΝΤΩΝ_ΜΑΝΔΡΑ v03 d20110601</u></b></h3>
		</div>
	</div>
</footer>
