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

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

	$(document).ready(function () {

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

		function acceptlogin() {
			var response = 0;
			$.ajax({  
				type: "POST",  
				url: "<?php echo $this->url(array('controller' => 'account', 'action' => 'checklogin'), 'default', true); ?>", 				
				async: false,
				data: { client_login: $('[name="client_login"]').val() },
				success: function(data){   
					response = data;
				}
			});
			if(response == 0)
			{
				return true;
			}
			else
			{
				alertify.error("<i class='fa fa-close'></i> <?php echo @Lib_Lang::translate(front_registration_login_exist); ?>");
				$('[name="client_login"]').focus();
				return false;
			}
		};
		
		$('#formReg').submit(acceptlogin);

		$('#formReg').validate({
			errorClass: "formError",
			errorElement: "div",
			rules: {
				client_login: {
					required: true,
					email: true
				},
				client_pass: {
					required: true
				},
				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
				},
				client_pass_rep: { 
					equalTo: "#client_pass"				
				}
			},
			messages: {
				client_login: {
					required: "<?php echo @Lib_Lang::translate(front_registration_required); ?>",
					email: "<?php echo @Lib_Lang::translate(front_registration_email); ?>"
				},
				client_pass: {
					required: "<?php echo @Lib_Lang::translate(front_registration_required); ?>"
				},
				client_firstname: {
					required: "<?php echo @Lib_Lang::translate(front_registration_required); ?>"
				},
				client_secondname: {
					required: "<?php echo @Lib_Lang::translate(front_registration_required); ?>"
				},
				client_address: {
					required: "<?php echo @Lib_Lang::translate(front_registration_required); ?>"
				},
				client_zipcode: {
					required: "<?php echo @Lib_Lang::translate(front_registration_required); ?>"
				},
				client_city: {
					required: "<?php echo @Lib_Lang::translate(front_registration_required); ?>"
				},
				client_country: {
					required: "<?php echo @Lib_Lang::translate(front_registration_required); ?>"
				},
				client_phone: {
					required: "<?php echo @Lib_Lang::translate(front_registration_required); ?>"
				},
				client_pass_rep: { 
					equalTo: "<?php echo @Lib_Lang::translate(front_registration_pass); ?>"				
				}
			}
		});	
	
	});

</script>


<div class="conBox">
<div class="container widthDiv" style="padding-top:15px;">
	<div class="row">
		<div class="col-lg-12 categoryBox" style="padding-bottom:15px;">
		
		
		<h1 style="margin:0;font-size:26px;"><?php echo @Lib_Lang::translate(front_account_registration_top); ?></h1>		
		<form id="formReg" method="post">
		
		<div class="row vcenter">
			<div class="col-lg-2"></div>
			<div class="col-lg-2 text-right vcenter"><?php echo @Lib_Lang::translate(front_account_registration_login); ?></div>
			<div class="col-lg-6"><input name="client_login" class="form-control" /></div>
			<div class="col-lg-2"></div>
		</div>
		
		<div class="row vcenter">
			<div class="col-lg-2"></div>
			<div class="col-lg-2 text-right vcenter"><?php echo @Lib_Lang::translate(front_account_registration_pass); ?></div>
			<div class="col-lg-6"><input type="password" id="client_pass" name="client_pass" class="form-control" /></div>
			<div class="col-lg-2"></div>
		</div>
		
		<div class="row vcenter">
			<div class="col-lg-2"></div>
			<div class="col-lg-2 text-right vcenter"><?php echo @Lib_Lang::translate(front_account_registration_reppass); ?></div>
			<div class="col-lg-6"><input type="password" name="client_pass_rep" class="form-control" /></div>
			<div class="col-lg-2"></div>
		</div>
		
		
		
		
	
	
<script type="text/javascript" language="javascript">

	$(document).ready(function () {	
		$('.companyBox').hide();
		$('.shipmentBox').hide();
	
		$('[name="client_type"]').change(function(){		
			var s = $(this).val();				
			$("#formReg").validate(); 
			if( s == 0 ){
				$('.companyBox').hide();	
				$( '[name="client_company"]' ).rules( "remove" );
				$( '[name="client_nip"]' ).rules( "remove" );
			}else{
				$('.companyBox').show();	
				$( '[name="client_company"]' ).rules( "add", {
				  required: true,
				  messages: {
					required: "<?php echo @Lib_Lang::translate(front_registration_required); ?>"
				  }
				});
				$( '[name="client_nip"]' ).rules( "add", {
				  required: true,
				  messages: {
					required: "<?php echo @Lib_Lang::translate(front_registration_required); ?>"
				  }
				});
			}
		
		});
	
		$('[name="client_shipment"]').change(function(){		
			var s = $(this).val();
			$("#formReg").validate(); 
			if( s == 0 ){
				$('.shipmentBox').hide();
				$( '[name="client_shipment_name"]' ).rules( "remove" );
				$( '[name="client_shipment_address"]' ).rules( "remove" );
				$( '[name="client_shipment_zipcode"]' ).rules( "remove" );
				$( '[name="client_shipment_city"]' ).rules( "remove" );
				$( '[name="client_shipment_country"]' ).rules( "remove" );
			}else{
				$('.shipmentBox').show();
				$( '[name="client_shipment_name"]' ).rules( "add", {
				  required: true,
				  messages: {
					required: "<?php echo @Lib_Lang::translate(front_registration_required); ?>"
				  }
				});
				$( '[name="client_shipment_address"]' ).rules( "add", {
				  required: true,
				  messages: {
					required: "<?php echo @Lib_Lang::translate(front_registration_required); ?>"
				  }
				});
				$( '[name="client_shipment_zipcode"]' ).rules( "add", {
				  required: true,
				  messages: {
					required: "<?php echo @Lib_Lang::translate(front_registration_required); ?>"
				  }
				});
				$( '[name="client_shipment_city"]' ).rules( "add", {
				  required: true,
				  messages: {
					required: "<?php echo @Lib_Lang::translate(front_registration_required); ?>"
				  }
				});
				$( '[name="client_shipment_country"]' ).rules( "add", {
				  required: true,
				  messages: {
					required: "<?php echo @Lib_Lang::translate(front_registration_required); ?>"
				  }
				});
			}
		});
			
	});

</script>
		
		
		<div class="row vcenter">
			<div class="col-lg-2"></div>
			<div class="col-lg-2 text-right vcenter"><?php echo @Lib_Lang::translate(front_account_registration_type); ?></div>
			<div class="col-lg-6">
			
			<select name="client_type" class="form-control">
				<option value="0"><?php echo @Lib_Lang::translate(front_client_type0); ?></option>
				<option value="1"><?php echo @Lib_Lang::translate(front_client_type1); ?></option>
			</select>	
						
			</div>
			<div class="col-lg-2"></div>
		</div>		
		
		
		<div class="companyBox">
		<div class="row vcenter">
			<div class="col-lg-2"></div>
			<div class="col-lg-2 text-right vcenter"><?php echo @Lib_Lang::translate(front_account_registration_company); ?></div>
			<div class="col-lg-6"><input name="client_company" class="form-control" /></div>
			<div class="col-lg-2"></div>
		</div>
		<div class="row vcenter">
			<div class="col-lg-2"></div>
			<div class="col-lg-2 text-right vcenter"><?php echo @Lib_Lang::translate(front_account_registration_nip); ?></div>
			<div class="col-lg-6"><input name="client_nip" class="form-control" /></div>
			<div class="col-lg-2"></div>
		</div>
		</div>
		
		
		
		
		
		<div class="row vcenter">
			<div class="col-lg-2"></div>
			<div class="col-lg-2 text-right vcenter"><?php echo @Lib_Lang::translate(front_account_registration_firstname); ?></div>
			<div class="col-lg-6"><input name="client_firstname" class="form-control" /></div>
			<div class="col-lg-2"></div>
		</div>
		
		<div class="row vcenter">
			<div class="col-lg-2"></div>
			<div class="col-lg-2 text-right vcenter"><?php echo @Lib_Lang::translate(front_account_registration_secondname); ?></div>
			<div class="col-lg-6"><input name="client_secondname" class="form-control" /></div>
			<div class="col-lg-2"></div>
		</div>
		
		<div class="row vcenter">
			<div class="col-lg-2"></div>
			<div class="col-lg-2 text-right vcenter"><?php echo @Lib_Lang::translate(front_account_registration_address); ?></div>
			<div class="col-lg-6"><input name="client_address" class="form-control" /></div>
			<div class="col-lg-2"></div>
		</div>
		
		<div class="row vcenter">
			<div class="col-lg-2"></div>
			<div class="col-lg-2 text-right vcenter"><?php echo @Lib_Lang::translate(front_account_registration_zipcode); ?></div>
			<div class="col-lg-6"><input name="client_zipcode" class="form-control" /></div>
			<div class="col-lg-2"></div>
		</div>
		
		<div class="row vcenter">
			<div class="col-lg-2"></div>
			<div class="col-lg-2 text-right vcenter"><?php echo @Lib_Lang::translate(front_account_registration_city); ?></div>
			<div class="col-lg-6"><input name="client_city" class="form-control" /></div>
			<div class="col-lg-2"></div>
		</div>
		
		<div class="row vcenter">
			<div class="col-lg-2"></div>
			<div class="col-lg-2 text-right vcenter"><?php echo @Lib_Lang::translate(front_account_registration_country); ?></div>
			<div class="col-lg-6"><input name="client_country" class="form-control" /></div>
			<div class="col-lg-2"></div>
		</div>
		
		<div class="row vcenter">
			<div class="col-lg-2"></div>
			<div class="col-lg-2 text-right vcenter"><?php echo @Lib_Lang::translate(front_account_registration_phone); ?></div>
			<div class="col-lg-6"><input name="client_phone" class="form-control" /></div>
			<div class="col-lg-2"></div>
		</div>		
		
		<div class="row vcenter">
			<div class="col-lg-2"></div>
			<div class="col-lg-2 text-right vcenter"><?php echo @Lib_Lang::translate(front_account_registration_shipment); ?></div>
			<div class="col-lg-6">
			
				<select name="client_shipment" class="form-control">
					<option value="0"><?php echo @Lib_Lang::translate(front_account_registration_shipment_0); ?></option>
					<option value="1"><?php echo @Lib_Lang::translate(front_account_registration_shipment_1); ?></option>
				</select>
			
			</div>
			<div class="col-lg-2"></div>
		</div>
		
		
		
		<div class="shipmentBox">
		
		<div class="row vcenter">
			<div class="col-lg-2"></div>
			<div class="col-lg-2 text-right vcenter"><?php echo @Lib_Lang::translate(front_account_registration_shipment_name); ?></div>
			<div class="col-lg-6"><input name="client_shipment_name" class="form-control" /></div>
			<div class="col-lg-2"></div>
		</div>
		
		<div class="row vcenter">
			<div class="col-lg-2"></div>
			<div class="col-lg-2 text-right vcenter"><?php echo @Lib_Lang::translate(front_account_registration_shipment_address); ?></div>
			<div class="col-lg-6"><input name="client_shipment_address" class="form-control" /></div>
			<div class="col-lg-2"></div>
		</div>
		
		<div class="row vcenter">
			<div class="col-lg-2"></div>
			<div class="col-lg-2 text-right vcenter"><?php echo @Lib_Lang::translate(front_account_registration_shipment_zipcode); ?></div>
			<div class="col-lg-6"><input name="client_shipment_zipcode" class="form-control" /></div>
			<div class="col-lg-2"></div>
		</div>
		
		<div class="row vcenter">
			<div class="col-lg-2"></div>
			<div class="col-lg-2 text-right vcenter"><?php echo @Lib_Lang::translate(front_account_registration_shipment_city); ?></div>
			<div class="col-lg-6"><input name="client_shipment_city" class="form-control" /></div>
			<div class="col-lg-2"></div>
		</div>
		
		<div class="row vcenter">
			<div class="col-lg-2"></div>
			<div class="col-lg-2 text-right vcenter"><?php echo @Lib_Lang::translate(front_account_registration_shipment_country); ?></div>
			<div class="col-lg-6"><input name="client_shipment_country" class="form-control" /></div>
			<div class="col-lg-2"></div>
		</div>
		
		</div>
		
		
		
		
		
		<div class="row vcenter">
			<div class="col-lg-2"></div>
			<div class="col-lg-2 text-right vcenter"></div>
			<div class="col-lg-6"><input name="client_registration" class="form-control" type="submit" value="<?php echo @Lib_Lang::translate(front_account_registration_submit); ?>" /></div>
			<div class="col-lg-2"></div>
		</div>
		</form>
		
		</div>
	</div>
</div>
</div>

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

