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


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

	$(document).ready(function () {

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

</script>

<div class="container">		

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


	<div class="row">
		<div class="col-xs-3 col-sm-3 col-md-3">
		</div>
		<div class="col-xs-9 col-sm-9 col-md-9 text-right">
			<a href="<?php echo @$this->url(array('controller' => 'admin', 'action' => 'client'), 'default', true); ?>" class="btn btn-default btn-sm"><i class='fa fa-users'></i> <?php echo @Lib_Lang::translate(admin_client_menu_list); ?></a>
		</div>
	</div>


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

	$(document).ready(function () {	

		$('#formEditClient').validate({
			errorClass: "formError",
			errorElement: "div",
			rules: {
				client_firstname: {
					required: true
				},
				client_secondname: {
					required: true
				},
				client_address: {
					required: true
				},
				client_zipcode: {
					required: true
				},
				client_city: {
					required: true
				},
				client_country: {
					required: true
				},
				client_phone: {
					required: true
				}
			},
			messages: {
				client_firstname: {
					required: "<?php echo @Lib_Lang::translate(admin_client_required); ?>"
				},
				client_secondname: {
					required: "<?php echo @Lib_Lang::translate(admin_client_required); ?>"
				},
				client_address: {
					required: "<?php echo @Lib_Lang::translate(admin_client_required); ?>"
				},
				client_zipcode: {
					required: "<?php echo @Lib_Lang::translate(admin_client_required); ?>"
				},
				client_city: {
					required: "<?php echo @Lib_Lang::translate(admin_client_required); ?>"
				},
				client_country: {
					required: "<?php echo @Lib_Lang::translate(admin_client_required); ?>"
				},
				client_phone: {
					required: "<?php echo @Lib_Lang::translate(admin_client_required); ?>"
				}
			}
		});	
	
	
	});

</script>

	
	<div class="row">
		<div class="col-xs-3 col-sm-3 col-md-3">
			<h3><?php echo @Lib_Lang::translate(admin_client_edit_top); ?></h3>
		</div>
		<div class="col-xs-9 col-sm-9 col-md-9 text-right">
			<?php echo @Lib_Lang::translate(admin_users_stat_option); ?> <a href="<?php echo @$this->url(array('controller' => 'admin', 'action' => 'clienthistory', 'id' => $this->rowClient['client_id']), 'default', true); ?>" class="btn btn-primary btn-sm"><i class='fa fa-history'></i> <?php echo @Lib_Lang::translate(admin_users_stat_history); ?></a>
			
			<a href="<?php echo @$this->url(array('controller' => 'admin', 'action' => 'loginclient', 'id' => $this->rowClient['client_id']), 'default', true); ?>" class="btn btn-success btn-sm"><i class='fa fa-edit'></i> <?php echo @Lib_Lang::translate(admin_client_list_loginbutton); ?></a>
		</div>
	</div>


		
	<form id="formEditClient" method="post" class="form-horizontal">
	
	<div class="row">
		<div class="col-xs-12 col-sm-4 col-md-4 text-right"><?php echo @Lib_Lang::translate(admin_client_login); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8"><?php echo$this->rowClient['client_login']; ?></div>
	</div>
	
	
	
	
<script type="text/javascript" language="javascript">

	$(document).ready(function () {	
	
	
		$('[name="client_type"]').change(function(){
		
			var s = $(this).val();
			
			if( s == 0 ){
				$('.companyBox').hide();
			}else{
				$('.companyBox').show();			
			}
		
		});
		
			<?php if( $this->rowClient['client_type'] == 0 ){ ?>
			$('.companyBox').hide();
			<?php } ?>
		
			<?php if( $this->rowClient['client_type'] == 1 ){ ?>
			$('.companyBox').show();
			<?php } ?>
	
	});

</script>
	
	<div class="row">
		<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_client_type); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8">
		
			<select name="client_type" class="form-control">
				<option value="0" <?php if( $this->rowClient['client_type'] == 0 ) echo'selected'; ?>><?php echo @Lib_Lang::translate(admin_client_type0); ?></option>
				<option value="1" <?php if( $this->rowClient['client_type'] == 1 ) echo'selected'; ?>><?php echo @Lib_Lang::translate(admin_client_type1); ?></option>
			</select>	
		
		</div>
	</div>
	
	
	
	<div class="companyBox">
	
		<div class="row">
			<div class="col-xs-12 col-sm-4 col-md-4 text-right formLabelMarginTop"><?php echo @Lib_Lang::translate(admin_client_company); ?></div>
			<div class="col-xs-12 col-sm-8 col-md-8"><input maxlength="100" name="client_company" class="form-control" value="<?php echo$this->rowClient['client_company']; ?>" /></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_client_nip); ?></div>
			<div class="col-xs-12 col-sm-8 col-md-8"><input maxlength="100" name="client_nip" class="form-control" value="<?php echo$this->rowClient['client_nip']; ?>" /></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_client_firstname); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8"><input maxlength="100" name="client_firstname" class="form-control" value="<?php echo$this->rowClient['client_firstname']; ?>" /></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_client_secondname); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8"><input maxlength="100" name="client_secondname" class="form-control" value="<?php echo$this->rowClient['client_secondname']; ?>" /></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_client_address); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8"><input maxlength="100" name="client_address" class="form-control" value="<?php echo$this->rowClient['client_address']; ?>" /></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_client_zipcode); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8"><input maxlength="100" name="client_zipcode" class="form-control" value="<?php echo$this->rowClient['client_zipcode']; ?>" /></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_client_city); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8"><input maxlength="100" name="client_city" class="form-control" value="<?php echo$this->rowClient['client_city']; ?>" /></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_client_country); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8"><input maxlength="100" name="client_country" class="form-control" value="<?php echo$this->rowClient['client_country']; ?>" /></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_client_phone); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8"><input maxlength="100" name="client_phone" class="form-control" value="<?php echo$this->rowClient['client_phone']; ?>" /></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_client_info); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8"><textarea rows="5" name="client_info" class="form-control"><?php echo$this->rowClient['client_info']; ?></textarea></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_client_opinion); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8">
		
			<select name="client_opinion" class="form-control">
				<option value="0" <?php if( $this->rowClient['client_opinion'] == 0 ) echo'selected'; ?>><?php echo @Lib_Lang::translate(admin_client_opinion0); ?></option>
				<option value="1" <?php if( $this->rowClient['client_opinion'] == 1 ) echo'selected'; ?>><?php echo @Lib_Lang::translate(admin_client_opinion1); ?></option>
			</select>	
		
		</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_client_rabat_1); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8"><input step="0.01" type="number" name="client_rabat_1" class="form-control" value="<?php echo$this->rowClient['client_rabat_1']; ?>" /></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_client_rabat_2); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8"><input step="0.01" type="number" name="client_rabat_2" class="form-control" value="<?php echo$this->rowClient['client_rabat_2']; ?>" /></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_client_rabat_3); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8"><input step="0.01" type="number" name="client_rabat_3" class="form-control" value="<?php echo$this->rowClient['client_rabat_3']; ?>" /></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_client_rabat_4); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8"><input step="0.01" type="number" name="client_rabat_4" class="form-control" value="<?php echo$this->rowClient['client_rabat_4']; ?>" /></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_client_rabat_5); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8"><input step="0.01" type="number" name="client_rabat_5" class="form-control" value="<?php echo$this->rowClient['client_rabat_5']; ?>" /></div>
	</div>
	
	
	

	
	<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_editclient" class="btn btn-info form-control" type="submit" value="<?php echo @Lib_Lang::translate(admin_client_edit_button); ?>" /></div>
	</div>
	
	</form>	
		
		
		
	
	<div class="row">
		<div class="col-xs-12 col-sm-4 col-md-4 text-right"><?php echo @Lib_Lang::translate(admin_client_basket); ?></div>
		<div class="col-xs-12 col-sm-8 col-md-8">
		
		
		
		
			<table class="table table-striped">
			

	<tr>
		<td><?php echo @Lib_Lang::translate(admin_client_basked_name); ?></td>
		<td><?php echo @Lib_Lang::translate(admin_client_basked_amount); ?></td>
		<td><?php echo @Lib_Lang::translate(admin_client_basked_price); ?></td>
	</tr>
				
			<?php
			
				$product = json_decode($this->rowClient['client_order'],true);
			
			
				foreach( $product as $key => $val ){
				
				
					echo '<tr><td>'.Lib_Lang::consta(product_name_.$val['idProduct']).'</td><td>'.$val['amount'].'</td><td>'.number_format($val['price'], 2, ',', ' ').' zł</td>';
				
				
				}
			
			
			?>
			</table>
		
		
		
		
		</div>
	</div>
		
</div>

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