<?php 
$get = $controller->_get->raw();
?>
<div class="container-fluid pjCpbContainer">
	<div class="panel panel-default pjCpbPanel">
		<div class="panel-heading clearfix pjCpbHead">
			<h1 class="panel-title pull-left pjCpbTitle"><?php __('front_select_your_dates')?></h1><!-- /.panel-title pull-left pjCpbTitle -->
			<div class="btn-group pull-right pjCpbLanguage">
				<?php
				include_once PJ_VIEWS_PATH . 'pjFront/elements/locale.php';
				?>
			</div><!-- /.btn-group pull-right pjCpbLanguage -->
		</div><!-- /.panel-heading clearfix pjCpbHead -->
		<div class="panel-body pjCpbBody">
			<div class="row pjCpbForm pjCpbFormChoose">
				<?php
				$time_format = 'HH:mm';
				if((strpos($tpl['option_arr']['o_time_format'], 'a') > -1))
				{
				    $time_format = 'hh:mm a';
				}
				if((strpos($tpl['option_arr']['o_time_format'], 'A') > -1))
				{
				    $time_format = 'hh:mm A';
				}
				$months = __('months', true);
				ksort($months);
				$short_days = __('short_days', true);
								
				$STORE = @$_SESSION[$controller->defaultStore];
				
				if(isset($STORE['from']))
				{
					$from = date($tpl['option_arr']['o_date_format'], strtotime($STORE['from'])) . ' ' . date($tpl['option_arr']['o_time_format'], strtotime($STORE['from']));
					$to = date($tpl['option_arr']['o_date_format'], strtotime($STORE['to'])) . ' ' . date($tpl['option_arr']['o_time_format'], strtotime($STORE['to']));
				} else {
					$tomorrow = date('Y-m-d 10:00:00', strtotime('+1 day'));
					$after_tomorrow = date('Y-m-d 10:00:00', strtotime('+2 day'));					
					$from = date($tpl['option_arr']['o_date_format'], strtotime($tomorrow)) . ' ' . date($tpl['option_arr']['o_time_format'], strtotime($tomorrow));
					$to = date($tpl['option_arr']['o_date_format'], strtotime($after_tomorrow)) . ' ' . date($tpl['option_arr']['o_time_format'], strtotime($after_tomorrow));
				}
				?>
				<form id="pjCpSearchForm_<?php echo $get['index']?>" action="#" method="post">
					<div id="pjCpCalendarLocale_<?php echo $get['index']?>" style="display:none;" data-wstart="<?php echo (int) $tpl['option_arr']['o_week_start']; ?>" data-dateformat="<?php echo pjUtil::toMomemtJS($tpl['option_arr']['o_date_format']); ?>" data-format="<?php echo pjUtil::toMomemtJS($tpl['option_arr']['o_date_format']); ?> <?php echo $time_format;?>" data-months="<?php echo implode("_", $months);?>" data-days="<?php echo implode("_", $short_days);?>"></div>
					<div class="col-lg-9 col-md-9 col-sm-12 col-xs-12">
						<div class="row">
							<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
								<div class="form-group">
									<div class="row pjCbCalendar">
										<label for="" class="col-lg-12 col-md-12 col-sm-12 col-xs-12 control-label"><?php __('front_entry_date_time');?></label>
										<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
											<div class="input-group date pjCpbDatePicker">
												<input type="text" name="from" id="from" value="<?php echo $from;?>" data-wt="open" readonly="readonly" class="form-control pjCpbDateTimePicker pjCpbDateTimeFrom required" data-msg-required="<?php __('front_field_required');?>"/>
												
												<span class="input-group-addon pjCpbDateTimeIcon">
													<i class="fa fa-calendar"></i>
												</span>
											</div><!-- /.input-group date pjCpbDatePicker -->
											<div class="help-block with-errors"><ul class="list-unstyled"></ul></div>
										</div><!-- /.col-lg-6 col-md-6 col-sm-6 col-xs-6 -->
									</div>
								</div><!-- /.form-group -->
							</div><!-- /.col-lg-6 col-md-6 col-sm-6 col-xs-12 -->
							<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
								<div class="form-group">
									<div class="row pjCbCalendar">
										<label for="" class="col-lg-12 col-md-12 col-sm-12 col-xs-12 control-label"><?php __('front_exit_date_time');?></label>
										<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
											<div class="input-group date pjCpbDatePicker">
												<input type="text" name="to" id="to" value="<?php echo $to;?>" data-wt="open" readonly="readonly" data-min="<?php echo date('Y-m-d-H-i-0', strtotime($from));?>" class="form-control pjCpbDateTimePicker pjCpbDateTimeTo required" data-msg-required="<?php __('front_field_required');?>"/>
												
												<span class="input-group-addon pjCpbDateTimeIcon">
													<i class="fa fa-calendar"></i>
												</span>
											</div><!-- /.input-group date pjCpbDatePicker -->
											<div class="help-block with-errors"><ul class="list-unstyled"></ul></div>
										</div><!-- /.col-lg-6 col-md-6 col-sm-6 col-xs-6 -->
									</div>
								</div><!-- /.form-group -->
							</div><!-- /.col-lg-6 col-md-6 col-sm-6 col-xs-12 -->
						</div><!-- /.row -->
					</div><!-- /.col-lg-9 col-md-9 col-sm-12 col-xs-12 -->
					<div class="col-lg-3 col-md-3 col-sm-12 col-xs-12 pjCpbFormActions">
						<input type="submit" class="btn btn-default btn-block pjCpbBtn pjCpbBtnPrimary pjCpbSelectorButton pjCpbBtnSearch" value="<?php __('front_btn_choose_your_space');?>" />
					</div><!-- /.col-lg-3 col-md-3 col-sm-12 col-xs-12 pjCpbFormActions -->
				</form>
			</div><!-- /.row pjCpbForm pjCpbFormChoose -->
		</div><!-- /.panel-body pjCpbBody -->
	</div>
</div>