<?php
$extra_per = __('extra_per',true);
$get = $controller->_get->raw();
$post = $controller->_post->raw();
$voucher_msg = __('apply_voucher_msg_ARRAY_200', true);
$STORAGE = @$_SESSION[$controller->default_product][$controller->default_order];
$voucher_valid = false;
$voucher_msg = '';
if(isset($STORAGE['voucher_item']))
{
    if($STORAGE['voucher_item'] != NULL)
    {
        $voucher_valid = true;
        $voucher_msg = __('apply_voucher_msg_ARRAY_200', true);
    }
}
$CLIENT =  @$_SESSION[$controller->defaultClient];
$client_account_required = __('client_account_required', true);

$months = __('months', true);
$short_months = __('short_months', true);
ksort($months);
ksort($short_months);
$days = __('days', true);
$short_days = __('short_days', true);
$week_start = isset($tpl['option_arr']['o_week_start']) && in_array((int) $tpl['option_arr']['o_week_start'], range(0,6)) ? (int) $tpl['option_arr']['o_week_start'] : 0;
?>
<div id="pjCrCalendarLocale" style="display: none;" data-months="<?php echo implode("_", $months);?>" data-days="<?php echo implode("_", $short_days);?>" data-fday="<?php echo $week_start;?>"></div>
<div class="container-fluid pjCrContainer">
	<?php include_once dirname(__FILE__) . '/elements/menu.php';?>
	<div class="panel panel-default">
		<?php include_once dirname(__FILE__) . '/elements/header.php';?>
		
		<div class="panel-body pjCrBody">
			<button class="btn btn-default text-capitalize pjCrBtnPannelTrigger visible-xs-block"><?php __('front_3_booking'); ?></button>
			<br class="visible-xs-inline" />
			
			<div class="row">
				<div class="col-lg-4 col-md-4 col-sm-12 col-xs-12 hidden-xs pjCrPanelLeft">
					<div class="panel panel-default">
						<div class="panel-heading">
							<h1 class="panel-title"><?php __('front_3_booking'); ?></h1><!-- /.panel-title -->
						</div><!-- /.panel-heading -->

						<div class="panel-body">
							<p class="clearfix">
								<strong><?php __('front_3_when'); ?></strong>

								<a href="<?php echo $_SERVER['PHP_SELF']; ?>" id="crBtnWhen" class="pull-right text-capitalize pjCrColorPrimary"><?php __('front_3_change'); ?></a>
							</p>

							<div class="row">
								<div class="col-lg-5 col-md-5 col-sm-5 col-xs-12"><span class="text-muted"><?php __('front_3_pickup'); ?>:</span></div><!-- /.col-lg-5 col-md-5 col-sm-5 col-xs-12 -->

								<div class="col-lg-7 col-md-7 col-sm-7 col-xs-12">
									<?php echo stripslashes($tpl['pickup_location']['name']); ?><br/>
									<?php 
									$dt_from = $_SESSION[$controller->default_product][$controller->default_order]['date_from'] . " " . $_SESSION[$controller->default_product][$controller->default_order]['hour_from'] . ":" . $_SESSION[$controller->default_product][$controller->default_order]['minutes_from'] . ":00";
									echo date($tpl['option_arr']['o_date_format'], strtotime($dt_from)).', '.date($tpl['option_arr']['o_time_format'], strtotime($dt_from)); 
									?>
									</div><!-- /.col-lg-7 col-md-7 col-sm-7 col-xs-12 -->
							</div><!-- /.row -->

							<div class="row">
								<div class="col-lg-5 col-md-5 col-sm-5 col-xs-12"><span class="text-muted"><?php __('front_3_return'); ?>:</span></div><!-- /.col-lg-5 col-md-5 col-sm-5 col-xs-12 -->

								<div class="col-lg-7 col-md-7 col-sm-7 col-xs-12">
									<?php echo isset($tpl['return_location']['name']) ? stripslashes($tpl['return_location']['name']) : stripslashes($tpl['pickup_location']['name']); ?><br/>
									<?php
									$dt_to = $_SESSION[$controller->default_product][$controller->default_order]['date_to'] . " " . $_SESSION[$controller->default_product][$controller->default_order]['hour_to'] . ":" . $_SESSION[$controller->default_product][$controller->default_order]['minutes_to'] . ":00";
									echo date($tpl['option_arr']['o_date_format'], strtotime($dt_to)).', '.date($tpl['option_arr']['o_time_format'], strtotime($dt_to)); 
									?>
									</div><!-- /.col-lg-7 col-md-7 col-sm-7 col-xs-12 -->
							</div><!-- /.row -->
							<?php
							$rental_hours = $_SESSION[$controller->default_product][$controller->default_order]['rental_hours'];
							$hours = $rental_hours %24;
							if($tpl['option_arr']['o_booking_periods'] == 'perday') 
							{
								$days = $_SESSION[$controller->default_product][$controller->default_order]['rental_days'];
								?>
								<div class="row">
									<div class="col-lg-5 col-md-5 col-sm-5 col-xs-12"><span class="text-muted"><?php __('front_3_rental'); ?>:</span></div><!-- /.col-lg-5 col-md-5 col-sm-5 col-xs-12 -->
	
									<div class="col-lg-7 col-md-7 col-sm-7 col-xs-12"><?php echo $days == 1 ? $days ." ". __('front_label_day',true) : $days ." ". __('front_3_days',true); ?><?php echo $days > 0 && $hours > 0 ? ' ' :'';?><?php echo $hours > 0 ?  $hours." ".__('front_3_hours',true) : ''?></div><!-- /.col-lg-7 col-md-7 col-sm-7 col-xs-12 -->
								</div><!-- /.row -->
								<?php
							}else{
								$days = 0;
								if($hours == 0 )
								{
									$days = $rental_hours / 24;
								}else {
									$days = floor($rental_hours / 24);
								}
								?>
								<div class="row">
									<div class="col-lg-5 col-md-5 col-sm-5 col-xs-12"><span class="text-muted"><?php __('front_3_rental_duration'); ?>:</span></div><!-- /.col-lg-5 col-md-5 col-sm-5 col-xs-12 -->
	
									<div class="col-lg-7 col-md-7 col-sm-7 col-xs-12"><?php echo $rental_duration = $days > 0 ? ($days == 1 ? $days ." ". __('front_label_day',true) : $days ." ". __('front_3_days',true) ) : ''?><?php echo $days > 0 && $hours > 0 ? ' ' :'';?><?php echo $hours > 0 ?  $hours." ".__('front_3_hours',true) : ''?></div><!-- /.col-lg-7 col-md-7 col-sm-7 col-xs-12 -->
								</div><!-- /.row -->
								<?php
							} 
							?>

							<br />

							<p class="clearfix">
								<strong><?php __('front_3_choise'); ?></strong>

								<a href="<?php echo $_SERVER['PHP_SELF']; ?>" id="crBtnChoise" class="pull-right text-capitalize pjCrColorPrimary"><?php __('front_3_change'); ?></a>
							</p>

							<div class="row">
								<div class="col-lg-4 col-md-4 col-sm-4 col-xs-4">
									<img src="<?php echo isset($tpl['type_arr']['thumb_path']) && !empty($tpl['type_arr']['thumb_path']) && is_file($tpl['type_arr']['thumb_path']) ? PJ_INSTALL_URL . $tpl['type_arr']['thumb_path'] : PJ_INSTALL_URL . PJ_IMG_PATH . 'frontend/dummy_1.png'; ?>" alt="" class="img-responsive"/>
								</div><!-- /.col-lg-4 col-md-4 col-sm-4 col-xs-4 -->

								<div class="col-lg-8 col-md-8 col-sm-8 col-xs-8">
									<p><strong><?php echo stripslashes(@$tpl['type_arr']['name']); ?></strong></p>
									<p>(<?php __('front_3_example'); ?>: <?php echo stripslashes(@$tpl['type_arr']['example']['make'] . " " . @$tpl['type_arr']['example']['model']); ?>)</p>
								</div><!-- /.col-lg-8 col-md-8 col-sm-8 col-xs-8 -->
							</div><!-- /.row -->
						</div><!-- /.panel-body -->
					</div><!-- /.panel panel-default pjCrPanelLeft -->
				</div><!-- /.col-lg-4 col-md-4 col-sm-12 col-xs-12 pjCrPanelLeft -->

				<div class="col-lg-8 col-md-8 col-sm-12 col-xs-12 pjCrPanelRight">
					<div id="pjCrBookingSummaryBox">
    					<?php include_once dirname(__FILE__) . '/elements/summary.php';?>
    				</div>
				</div><!-- /.col-lg-8 col-md-8 col-sm-12 col-xs-12 pjCrPanelRight -->
			</div><!-- /.row -->
			
			<form id="crCheckoutForm" name="crCheckoutForm" class="pjCrFormCheckout" action="" method="post" role="form" data-toggle="validator">
				<?php
				if(in_array($tpl['option_arr']['o_bf_include_title'], array(2, 3)) || 
				    in_array($tpl['option_arr']['o_bf_include_fname'], array(2, 3)) ||
				    in_array($tpl['option_arr']['o_bf_include_lname'], array(2, 3)) ||
				    in_array($tpl['option_arr']['o_bf_include_email'], array(2, 3)) ||
				    in_array($tpl['option_arr']['o_bf_include_phone'], array(2, 3)) ||
				    in_array($tpl['option_arr']['o_bf_include_notes'], array(2, 3)))
				{
    				?>
    				<div class="panel panel-default">
    					<div class="panel-heading">
    						<h2 class="panel-title text-muted"><?php __('front_4_personal'); ?></h2><!-- /.panel-title text-muted -->
    					</div><!-- /.panel-heading -->
    				
    					<div class="panel-body">
    						<div class="row">
    							<?php
    							if (in_array($tpl['option_arr']['o_bf_include_title'], array(2, 3)))
    							{
    								$title_arr = pjUtil::getTitles();
    								$name_titles = __('personal_titles', true, false);
    								?>
    								<div class="col-lg-4 col-md-4 col-sm-6 col-xs-12">
    									<div class="form-group">
    										<label for="" class="control-label"><?php __('front_4_title'); ?> <?php if ($tpl['option_arr']['o_bf_include_title'] == 3) : ?><span class="text-danger">*</span><?php endif; ?></label>
    																	
    										<select name="c_title" class="form-control<?php echo ($tpl['option_arr']['o_bf_include_title'] == 3) ? ' required' : NULL; ?>" data-msg-required="<?php echo htmlspecialchars(stripslashes(__('front_4_v_title', true))); ?>">
    											<option value=""><?php __('front_4_select_title'); ?></option>
    											<?php
    											foreach ($title_arr as $v)
    											{
    											    ?><option value="<?php echo $v; ?>" <?php echo isset($CLIENT['customer_title']) && $CLIENT['customer_title'] == $v ? 'selected="selected"' : '';?>><?php echo $name_titles[$v]; ?></option><?php
    											}
    											?>
    										</select>
    										<div class="help-block with-errors"><ul class="list-unstyled"></ul></div>
    									</div><!-- /.form-group -->
    								</div><!-- /.col-lg-3 col-md-3 col-sm-6 col-xs-12 -->
    								<?php
    							}
    							if (in_array($tpl['option_arr']['o_bf_include_fname'], array(2, 3)))
    							{
    								?>
    								<div class="col-lg-4 col-md-4 col-sm-6 col-xs-12">
    									<div class="form-group">
    										<label for="" class="control-label"><?php __('front_4_fname'); ?> <?php if ($tpl['option_arr']['o_bf_include_fname'] == 3) : ?><span class="text-danger">*</span><?php endif; ?></label>
    																	
    										<input type="text" name="c_fname" value="<?php echo isset($CLIENT['fname']) ? pjSanitize::html($CLIENT['fname']) : '';?>" class="form-control<?php echo ($tpl['option_arr']['o_bf_include_fname'] == 3) ? ' required' : NULL; ?>" data-msg-required="<?php echo htmlspecialchars(stripslashes(__('front_4_v_fname', true))); ?>" />
    										
    										<div class="help-block with-errors"><ul class="list-unstyled"></ul></div>
    									</div><!-- /.form-group -->
    								</div><!-- /.col-lg-3 col-md-3 col-sm-6 col-xs-12 -->
    								<?php
    							} 
    							if (in_array($tpl['option_arr']['o_bf_include_lname'], array(2, 3)))
    							{
    							    ?>
    								<div class="col-lg-4 col-md-4 col-sm-6 col-xs-12">
    									<div class="form-group">
    										<label for="" class="control-label"><?php __('front_4_lname'); ?> <?php if ($tpl['option_arr']['o_bf_include_lname'] == 3) : ?><span class="text-danger">*</span><?php endif; ?></label>
    																	
    										<input type="text" name="c_lname" value="<?php echo isset($CLIENT['lname']) ? pjSanitize::html($CLIENT['lname']) : '';?>" class="form-control<?php echo ($tpl['option_arr']['o_bf_include_lname'] == 3) ? ' required' : NULL; ?>" data-msg-required="<?php echo htmlspecialchars(stripslashes(__('front_4_v_lname', true))); ?>" />
    										
    										<div class="help-block with-errors"><ul class="list-unstyled"></ul></div>
    									</div><!-- /.form-group -->
    								</div><!-- /.col-lg-3 col-md-3 col-sm-6 col-xs-12 -->
    								<?php
    							} 
    							if (in_array($tpl['option_arr']['o_bf_include_email'], array(2, 3)))
    							{
    								?>
    								<div class="col-lg-4 col-md-4 col-sm-6 col-xs-12">
    									<div class="form-group">
    										<label for="" class="control-label"><?php  __('front_4_email'); ?> <?php if ($tpl['option_arr']['o_bf_include_email'] == 3) : ?><span class="text-danger">*</span><?php endif; ?></label>
    																	
    										<input type="text" id="crEmail" name="c_email" value="<?php echo isset($CLIENT['email']) ? pjSanitize::html($CLIENT['email']) : '';?>" class="form-control email<?php echo ($tpl['option_arr']['o_bf_include_email'] == 3) ? ' required' : NULL; ?>" data-msg-required="<?php echo htmlspecialchars(stripslashes(__('front_4_v_email', true))); ?>" data-msg-email="<?php echo htmlspecialchars(stripslashes(__('front_4_v_email_invalid', true))); ?>"/>
    										<div class="help-block with-errors"><ul class="list-unstyled"></ul></div>
    									</div><!-- /.form-group -->
    								</div><!-- /.col-lg-3 col-md-3 col-sm-6 col-xs-12 -->
    								<?php
    							}
    							if (in_array($tpl['option_arr']['o_bf_include_phone'], array(2, 3)))
    							{
    								?>
    								<div class="col-lg-4 col-md-4 col-sm-6 col-xs-12">
    									<div class="form-group">
    										<label for="" class="control-label"><?php  __('front_4_phone'); ?> <?php if ($tpl['option_arr']['o_bf_include_phone'] == 3) : ?><span class="text-danger">*</span><?php endif; ?></label>
    																	
    										<input type="text" name="c_phone" value="<?php echo isset($CLIENT['phone']) ? pjSanitize::html($CLIENT['phone']) : '';?>" class="form-control<?php echo ($tpl['option_arr']['o_bf_include_phone'] == 3) ? ' required' : NULL; ?>" data-msg-required="<?php echo htmlspecialchars(stripslashes(__('front_4_v_phone', true))); ?>" />
    										<div class="help-block with-errors"><ul class="list-unstyled"></ul></div>
    									</div><!-- /.form-group -->
    								</div><!-- /.col-lg-3 col-md-3 col-sm-6 col-xs-12 -->
    								<?php
    							} 
    							
    							if (in_array($tpl['option_arr']['o_bf_include_driver_license_number'], array(2, 3)))
    							{
    							    ?>
    								<div class="col-lg-4 col-md-4 col-sm-6 col-xs-12">
    									<div class="form-group">
    										<label for="" class="control-label"><?php  __('front_driver_license_number'); ?> <?php if ($tpl['option_arr']['o_bf_include_driver_license_number'] == 3) : ?><span class="text-danger">*</span><?php endif; ?></label>
    																	
    										<input type="text" name="c_driver_license" value="<?php echo isset($CLIENT['customer_driver_license']) ? pjSanitize::html($CLIENT['customer_driver_license']) : '';?>" class="form-control<?php echo ($tpl['option_arr']['o_bf_include_driver_license_number'] == 3) ? ' required' : NULL; ?>" data-msg-required="<?php echo htmlspecialchars(stripslashes(__('front_4_v_driver_license', true))); ?>" />
    										<div class="help-block with-errors"><ul class="list-unstyled"></ul></div>
    									</div><!-- /.form-group -->
    								</div><!-- /.col-lg-3 col-md-3 col-sm-6 col-xs-12 -->
    								<?php
    							} 
    							if (in_array($tpl['option_arr']['o_bf_include_birthday'], array(2, 3)))
    							{
    							    ?>
    								<div class="col-lg-4 col-md-4 col-sm-6 col-xs-12">
    									<div class="form-group">
    										<label for="" class="control-label"><?php  __('front_birthday'); ?> <?php if ($tpl['option_arr']['o_bf_include_birthday'] == 3) : ?><span class="text-danger">*</span><?php endif; ?></label>
    										<div id="pjCrDateBirthday" class="input-group pjCrDatePicker pjCrDateBirthday">
        										<span class="input-group-addon pjCrCursorPointer">
        											<span class="glyphicon glyphicon-calendar" aria-hidden="true"></span>
        										</span>
        	
        										<input type="text" id="c_birthday" name="c_birthday" class="form-control <?php echo ($tpl['option_arr']['o_bf_include_birthday'] == 3) ? ' required' : NULL; ?>" value="<?php echo isset($CLIENT['customer_birthday']) && !empty($CLIENT['customer_birthday']) ? date($tpl['option_arr']['o_date_format'], strtotime($CLIENT['customer_birthday'])) : '';?>" readonly="readonly" data-msg-required="<?php echo htmlspecialchars(stripslashes(__('front_4_v_birthday', true))); ?>"/>
        									</div><!-- /.input-group pjCrDatePicker pjCrDateBirthday -->
											<div class="help-block with-errors"><ul class="list-unstyled"></ul></div>
    									</div><!-- /.form-group -->
    								</div><!-- /.col-lg-3 col-md-3 col-sm-6 col-xs-12 -->
    								<?php
    							} 
    							?>
    						</div><!-- /.row -->
    						<?php
    						if (in_array($tpl['option_arr']['o_bf_include_notes'], array(2, 3)))
    						{
    							?>
    							<div class="row">
    								<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
    									<label for="" class="control-label"><?php  __('front_4_notes'); ?> <?php if ($tpl['option_arr']['o_bf_include_notes'] == 3) : ?><span class="text-danger">*</span><?php endif; ?></label>
    									<textarea name="c_notes" rows="6"  class="form-control<?php echo ($tpl['option_arr']['o_bf_include_notes'] == 3) ? ' required' : NULL; ?>" data-msg-required="<?php echo htmlspecialchars(stripslashes(__('front_4_v_notes', true))); ?>"><?php echo isset($CLIENT['customer_notes']) ? pjSanitize::html($CLIENT['customer_notes']) : '';?></textarea>
    									<div class="help-block with-errors"><ul class="list-unstyled"></ul></div>
    								</div>
    							</div><!-- /.row -->
    							<?php
    						}
    						?>
    					</div><!-- /.panel-body -->
    				</div><!-- /.panel panel-default -->
    				<?php
				}
				if(in_array($tpl['option_arr']['o_bf_include_company'], array(2, 3)) || 
				    in_array($tpl['option_arr']['o_bf_include_address'], array(2, 3)) || 
				    in_array($tpl['option_arr']['o_bf_include_city'], array(2, 3)) ||
				    in_array($tpl['option_arr']['o_bf_include_state'], array(2, 3)) ||
				    in_array($tpl['option_arr']['o_bf_include_zip'], array(2, 3)) ||
				    in_array($tpl['option_arr']['o_bf_include_country'], array(2, 3)))
				{
    				?>
    				<div class="panel panel-default">
    					<div class="panel-heading">
    						<h2 class="panel-title text-muted"><?php  __('front_4_billing'); ?></h2><!-- /.panel-title text-muted -->
    					</div><!-- /.panel-heading -->
    				
    					<div class="panel-body">
    						<div class="row">
    							<?php
    							if (in_array($tpl['option_arr']['o_bf_include_company'], array(2, 3)))
    							{
    								?>
    								<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
    									<div class="form-group">
    										<label for="" class="control-label"><?php  __('front_4_company'); ?> <?php if ($tpl['option_arr']['o_bf_include_company'] == 3) : ?><span class="text-danger">*</span><?php endif; ?></label>
    																	
    										<input type="text" name="c_company" value="<?php echo isset($CLIENT['customer_company']) ? pjSanitize::html($CLIENT['customer_company']) : '';?>" class="form-control<?php echo ($tpl['option_arr']['o_bf_include_company'] == 3) ? ' required' : NULL; ?>" data-msg-required="<?php echo htmlspecialchars(stripslashes(__('front_4_v_company', true))); ?>"/>
    										<div class="help-block with-errors"><ul class="list-unstyled"></ul></div>
    									</div><!-- /.form-group -->
    								</div><!-- /.col-lg-3 col-md-3 col-sm-6 col-xs-12 -->
    								<?php
    							}
    							if (in_array($tpl['option_arr']['o_bf_include_address'], array(2, 3)))
    							{
    								?>
    								<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
    									<div class="form-group">
    										<label for="" class="control-label"><?php  __('front_4_address'); ?> <?php if ($tpl['option_arr']['o_bf_include_address'] == 3) : ?><span class="text-danger">*</span><?php endif; ?></label>
    																	
    										<input type="text" name="c_address" value="<?php echo isset($CLIENT['customer_address_1']) ? pjSanitize::html($CLIENT['customer_address_1']) : '';?>" class="form-control<?php echo ($tpl['option_arr']['o_bf_include_address'] == 3) ? ' required' : NULL; ?>" data-msg-required="<?php echo htmlspecialchars(stripslashes(__('front_4_v_address', true))); ?>"/>
    										<div class="help-block with-errors"><ul class="list-unstyled"></ul></div>
    									</div><!-- /.form-group -->
    								</div><!-- /.col-lg-3 col-md-3 col-sm-6 col-xs-12 -->
    								<?php
    							}
    							if (in_array($tpl['option_arr']['o_bf_include_city'], array(2, 3)))
    							{
    								?>
    								<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
    									<div class="form-group">
    										<label for="" class="control-label"><?php  __('front_4_city'); ?> <?php if ($tpl['option_arr']['o_bf_include_city'] == 3) : ?><span class="text-danger">*</span><?php endif; ?></label>
    																	
    										<input type="text" name="c_city" value="<?php echo isset($CLIENT['customer_city']) ? pjSanitize::html($CLIENT['customer_city']) : '';?>" class="form-control<?php echo ($tpl['option_arr']['o_bf_include_city'] == 3) ? ' required' : NULL; ?>" data-msg-required="<?php echo htmlspecialchars(stripslashes(__('front_4_v_city', true))); ?>"/>
    										<div class="help-block with-errors"><ul class="list-unstyled"></ul></div>
    									</div><!-- /.form-group -->
    								</div><!-- /.col-lg-3 col-md-3 col-sm-6 col-xs-12 -->
    								<?php
    							}
    							if (in_array($tpl['option_arr']['o_bf_include_state'], array(2, 3)))
    							{
    								?>
    								<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
    									<div class="form-group">
    										<label for="" class="control-label"><?php  __('front_4_state'); ?> <?php if ($tpl['option_arr']['o_bf_include_state'] == 3) : ?><span class="text-danger">*</span><?php endif; ?></label>
    																	
    										<input type="text" name="c_state" value="<?php echo isset($CLIENT['customer_state']) ? pjSanitize::html($CLIENT['customer_state']) : '';?>" class="form-control<?php echo ($tpl['option_arr']['o_bf_include_state'] == 3) ? ' required' : NULL; ?>" data-msg-required="<?php echo htmlspecialchars(stripslashes(__('front_4_v_city', true))); ?>"/>
    										<div class="help-block with-errors"><ul class="list-unstyled"></ul></div>
    									</div><!-- /.form-group -->
    								</div><!-- /.col-lg-3 col-md-3 col-sm-6 col-xs-12 -->
    								<?php
    							}
    							if (in_array($tpl['option_arr']['o_bf_include_zip'], array(2, 3)))
    							{
    								?>
    								<div class="col-lg-3 col-md-3 col-sm-6 col-xs-12">
    									<div class="form-group">
    										<label for="" class="control-label"><?php  __('front_4_zip'); ?> <?php if ($tpl['option_arr']['o_bf_include_zip'] == 3) : ?><span class="text-danger">*</span><?php endif; ?></label>
    																	
    										<input type="text" name="c_zip" value="<?php echo isset($CLIENT['customer_zip']) ? pjSanitize::html($CLIENT['customer_zip']) : '';?>" class="form-control<?php echo ($tpl['option_arr']['o_bf_include_zip'] == 3) ? ' required' : NULL; ?>" data-msg-required="<?php echo htmlspecialchars(stripslashes(__('front_4_v_city', true))); ?>"/>
    										<div class="help-block with-errors"><ul class="list-unstyled"></ul></div>
    									</div><!-- /.form-group -->
    								</div><!-- /.col-lg-3 col-md-3 col-sm-6 col-xs-12 -->
    								<?php
    							}
    							if (in_array($tpl['option_arr']['o_bf_include_country'], array(2, 3)))
    							{
    								?>
    								<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
    									<div class="form-group">
    										<label for="" class="control-label"><?php  __('front_4_country'); ?> <?php if ($tpl['option_arr']['o_bf_include_country'] == 3) : ?><span class="text-danger">*</span><?php endif; ?></label>
    																	
    										<select name="c_country" class="form-control<?php echo ($tpl['option_arr']['o_bf_include_country'] == 3) ? ' required' : NULL; ?>" data-msg-required="<?php echo htmlspecialchars(stripslashes(__('front_4_v_country', true))); ?>">
    											<option value=""><?php echo __('front_4_select_country'); ?></option>
    											<?php
    											foreach ($tpl['country_arr'] as $country)
    											{
    											    ?><option value="<?php echo $country['id']; ?>" <?php echo isset($CLIENT['customer_country']) && $CLIENT['customer_country'] == $country['id'] ? 'selected="selected"' : '';?>><?php echo stripslashes($country['country_title']); ?></option><?php
    											}
    											?>
    										</select>
    										<div class="help-block with-errors"><ul class="list-unstyled"></ul></div>
    									</div><!-- /.form-group -->
    								</div><!-- /.col-lg-3 col-md-3 col-sm-6 col-xs-12 -->
    								<?php
    							}  
    							?>
    						</div><!-- /.row -->
    					</div><!-- /.panel-body -->
    				</div><!-- /.panel panel-default -->
    				<?php
				}
				if ($tpl['option_arr']['o_payment_disable'] == '0')
				{ 
					?>
					<div class="panel panel-default">
						<div class="panel-heading">
							<h2 class="panel-title text-muted"><?php  __('front_4_payment'); ?> </h2><!-- /.panel-title text-muted -->
						</div><!-- /.panel-heading -->
					
						<div class="panel-body">
							<div class="row">
								<div class="col-lg-4 col-md-4 col-sm-6 col-xs-12">
									<div class="form-group">
										<label for="" class="control-label"><?php  __('front_4_payment'); ?> <span class="text-danger">*</span></label>
										<?php
										$plugins_payment_methods = pjObject::getPlugin('pjPayments') !== NULL? pjPayments::getPaymentMethods(): array();
										$haveOnline = $haveOffline = false;
										foreach ($tpl['payment_titles'] as $k => $v)
										{
										    if( $k != 'cash' && $k != 'bank' )
										    {
										        if( (int) $tpl['payment_option_arr'][$k]['is_active'] == 1)
										        {
										            $haveOnline = true;
										            break;
										        }
										    }
										}
										foreach ($tpl['payment_titles'] as $k => $v)
										{
										    if( $k == 'cash' || $k == 'bank' )
										    {
										        if( (int) $tpl['payment_option_arr'][$k]['is_active'] == 1)
										        {
										            $haveOffline = true;
										            break;
										        }
										    }
										}
										?>							
										<select name="payment_method" class="form-control required" data-msg-required="<?php echo htmlspecialchars(stripslashes(__('front_4_v_payment', true))); ?>">
											<option value=""><?php echo __('front_4_select_payment'); ?></option>
											<?php
											if ($haveOnline && $haveOffline)
											{
											    ?><optgroup label="<?php __('script_online_payment_gateway', false, true); ?>"><?php
						                    }
						                    foreach ($tpl['payment_titles'] as $k => $v)
						                    {
						                        if($k == 'cash' || $k == 'bank' ){
						                            continue;
						                        }
						                        if (array_key_exists($k, $plugins_payment_methods))
						                        {
						                            if(!isset($tpl['payment_option_arr'][$k]['is_active']) || (isset($tpl['payment_option_arr']) && $tpl['payment_option_arr'][$k]['is_active'] == 0) )
						                            {
						                                continue;
						                            }
						                        }
						                        ?><option value="<?php echo $k; ?>"<?php echo isset($FORM['payment_method']) && $FORM['payment_method']==$k ? ' selected="selected"' : NULL;?>><?php echo $v; ?></option><?php
						                    }
						                    if ($haveOnline && $haveOffline)
						                    {
						                        ?>
						                    	</optgroup>
						                    	<optgroup label="<?php __('script_offline_payment', false, true); ?>">
						                    	<?php 
						                    }
						                    foreach ($tpl['payment_titles'] as $k => $v)
						                    {
						                        if( $k == 'cash' || $k == 'bank' )
						                        {
						                            if( (int) $tpl['payment_option_arr'][$k]['is_active'] == 1)
						                            {
						                                ?><option value="<?php echo $k; ?>"<?php echo isset($FORM['payment_method']) && $FORM['payment_method']==$k ? ' selected="selected"' : NULL;?>><?php echo $v; ?></option><?php
						                            }
						                        }
						                    }
						                    if ($haveOnline && $haveOffline)
						                    {
						                        ?></optgroup><?php
						                    }
											?>
										</select>
										<div class="help-block with-errors"><ul class="list-unstyled"></ul></div>
									</div><!-- /.form-group -->
								</div><!-- /.col-lg-3 col-md-3 col-sm-6 col-xs-12 -->
							</div><!-- /.row -->
							
							<br />
							
							<div id="crBankData" style="display:none">
								<div class="crLeft100">
									<p>
										<strong><?php __('front_4_bank_account'); ?> </strong>
									</p>
									<p><?php echo pjSanitize::html($tpl['bank_account']); ?></p>
								</div>
							</div>
							
							
						</div><!-- /.panel-body -->
					</div><!-- /.panel panel-default -->
					<?php
				}
				if (in_array($tpl['option_arr']['o_bf_include_captcha'], array(2, 3)))
				{ 
					?>
					<div class="panel panel-default">
						<div class="panel-heading">
							<h2 class="panel-title text-muted"><?php echo __('front_4_captcha'); ?></h2><!-- /.panel-title text-muted -->
						</div><!-- /.panel-heading -->
					
						<div class="panel-body">
							<div class="form-group">
								<?php
								if($tpl['option_arr']['o_captcha_type_front'] == 'system')
								{
    								?>
									<div class="row">
										<div class="col-lg-6 col-md-6 col-sm-6 col-sx-12">
											<input type="text" id="pjCrCaptchaField" name="captcha" class="form-control<?php echo (int) $tpl['option_arr']['o_bf_include_captcha'] === 3 ? ' required' : NULL; ?>" maxlength="<?php echo $tpl['option_arr']['o_captcha_mode_front'] == 'string'? (int) $tpl['option_arr']['o_captcha_length_front']: 10 ?>" autocomplete="off" data-msg-required="<?php __('front_4_v_captcha', false, true); ?>" data-msg-remote="<?php __('front_4_v_captcha_incorrect', false, true); ?>" />
										</div>
										<div class="col-lg-6 col-md-6 col-sm-6 col-sx-12">
											<img id="pjCrCaptchaImage" alt="Captcha" src="<?php echo PJ_INSTALL_URL; ?>index.php?controller=pjFront&action=pjActionCaptcha&rand=<?php echo rand(1000, 999999); ?>&session_id=<?php echo $controller->_get->check('session_id') ? pjObject::escapeString($controller->_get->toString('session_id')) : NULL;?>" style="vertical-align: middle; cursor: pointer;" />
										</div>
									</div>
									<?php 
								} else {
									?>
								    <div id="g-recaptcha" class="g-recaptcha" data-sitekey="<?php echo $tpl['option_arr']['o_captcha_site_key_front'] ?>"></div>
									<input type="hidden" id="recaptcha" name="recaptcha" class="recaptcha<?php echo ($tpl['option_arr']['o_bf_include_captcha'] == 3) ? ' required' : NULL; ?>" autocomplete="off" data-msg-required="<?php __('front_4_v_captcha');?>" data-msg-remote="<?php __('front_4_v_captcha_incorrect');?>"/>
									<?php 
								}
								?>
								<div class="help-block with-errors"><ul class="list-unstyled"></ul></div>
							</div>
						</div><!-- /.panel-body -->
					</div><!-- /.panel panel-default -->
					<?php
				} 
				?>
				
				<div class="panel panel-default">
					<div class="panel-heading">
						<h2 class="panel-title text-muted"><?php echo __('front_4_terms'); ?></h2><!-- /.panel-title text-muted -->
					</div><!-- /.panel-heading -->
				
					<div class="panel-body">
						<div class="form-group">
							<div class="checkbox">
								<label><input type="checkbox" name="c_agree" value="1" class="required" data-msg-required="<?php echo htmlspecialchars(stripslashes(__('front_4_v_agree', true))); ?>" /> <?php echo __('front_4_agree'); ?></label>
								<div class="help-block with-errors"><ul class="list-unstyled"></ul></div>
							</div><!-- /.checkbox -->
						</div><!-- /.form-group -->
						<?php
						if(!empty($tpl['term_arr'][0]['content']))
						{ 
							?>
							<a href="#" class="pjCrColorPrimary" data-pj-toggle="modal" data-pj-target="#myModal"><?php echo __('front_4_click'); ?></a>
							<?php
						} 
						?>
						<br />
						<br />
						<input type="button" value="<?php  __('front_btn_back'); ?>" id="crBtnBack" class="btn btn-default text-capitalize pjCrBtntDefault" />	
						<input type="submit" value="<?php  __('front_btn_confirm'); ?>" id="crBtnConfirm" class="btn btn-default pull-right text-capitalize pjCrBtntDefault crBtnConfirm" />
						
						<div class="crError text-danger text-center" style="display: none;"></div>
					</div><!-- /.panel-body -->
				</div><!-- /.panel panel-default -->
			</form><!-- /.pjCrFormCheckout -->
		</div><!-- /.panel-body pjCrBody -->
		
		<div class="modal fade" id="pjCrLoginModal" tabindex="-1" role="dialog" aria-hidden="true" aria-labelledby="myModalLabel">
          	<div class="modal-dialog modal-md" role="document">
        	    <div class="modal-content">
        		      <div class="modal-header">
        		        	<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        		        	<h4 class="modal-title"><?php __('front_login_form'); ?></h4>
        		      </div>
        		      <div class="modal-body">
        		      	<form id="pjCrLoginForm" class="pjCrForm" action="#" method="post">
        					<input type="hidden" name="client_login" value="1" />
        					<div class="row">
        						<div class="col-xs-12"><div class="alert alert-info"><?php __('front_login_form_popup_desc');?></div></div>
        					</div>
        			      	<div class="row">
        						<div class="col-md-12 col-sm-12 col-xs-12">
        						  	<div class="form-group required">
        						    	<label class="control-label"><?php __('front_client_email'); ?><span class="asterisk">*</span></label>
        						    	<input type="text" name="email" class="form-control email required" data-msg-required="<?php echo $client_account_required['email']; ?>" data-msg-email="<?php echo $client_account_required['invalid_email']; ?>" />
        						    	<div class="help-block with-errors"><ul class="list-unstyled"></ul></div>
        						  	</div>
        						</div>
        					</div>
        				
        					<div class="row">
        						<div class="col-md-12 col-sm-12 col-xs-12">
        						  	<div class="form-group required">
        						    	<label class="control-label"><?php __('client_password'); ?><span class="asterisk">*</span></label>
        						    	<input type="password" name="password" class="form-control required" data-msg-required="<?php echo $client_account_required['password']; ?>" />
        						    	<div class="help-block with-errors"><ul class="list-unstyled"></ul></div>
        						  	</div>
        						</div>
        					</div>
        				
        					<div class="row form-group">
        						<div class="col-md-6 col-sm-6"><a href="<?php echo pjUtil::getReferer(); ?>#!/ForgotPassword" class="pjCrForgotPassword"><?php __('front_forgot_password_link'); ?></a></div>
        						<div class="col-md-6 col-sm-6 col-xs-12 text-right">
        							<button type="button" class="btn btn-default" data-dismiss="modal"><?php __('front_btn_cancel');?></button>
        				        	<button type="submit" class="btn btn-primary"><?php __('front_btn_login');?></button>
        				        </div>
        			        </div>
        			        <div class="row" style="display: none;">
        	            		<div class="col-lg-12 col-md-12 col-sm-12">
        	                		<div id="pjLoginMessage" class="alert alert-danger text-center"></div>
        	                	</div>
        	                </div>
        		       	</form>
        		     </div>
        	    </div><!-- /.modal-content -->
          	</div><!-- /.modal-dialog -->
        </div><!-- /.modal -->
		
	</div><!-- /.panel panel-default -->
</div><!-- /.container-fluid pjCrContainer -->