<?php 
$today = pjDateTime::formatDate(date('Y-m-d'), 'Y-m-d', $tpl['option_arr']['o_date_format']);
$months = __('months', true);
ksort($months);
$bs = __('booking_statuses', true); 
?>
<div class="wrapper wrapper-content animated fadeInRight">
	<div class="ibox float-e-margins">
		<div class="ibox-title">
			<h5><?php __('label_today');?></h5>
		</div>
		<div class="ibox-content">
			<div class="row">
				<div class="col-xs-4">
					<p class="h1 no-margins"><?php echo $tpl['spaces_occupied_today'];?></p>
					<small class="text-info"><?php $tpl['spaces_occupied_today'] != 1 ? __('lblDashSpacesOccupiedToday') : __('lblDashSpaceOccupiedToday');?></small>        
				</div><!-- /.col-xs-6 -->
	
				<div class="col-xs-4">
					<p class="h1 no-margins"><?php echo $tpl['car_coming_today'];?></p>
					<small class="text-info"><?php $tpl['car_coming_today'] != 1 ? __('lblDashCarsComingToday') : __('lblDashCarComingToday');?></small>        
				</div><!-- /.col-xs-6 -->

				<div class="col-xs-4">
					<p class="h1 no-margins"><?php echo $tpl['car_leaving_today'];?></p>
					<small class="text-info"><?php $tpl['car_leaving_today'] != 1 ? __('lblDashCarsLeavingToday') : __('lblDashCarLeavingToday');?></small>        
				</div><!-- /.col-xs-6 -->
			</div><!-- /.row -->
		</div>
	</div><!-- /.row -->

	<div class="row">
		<div class="col-lg-4">
			<div class="ibox float-e-margins">
				<div class="ibox-content ibox-heading clearfix">
					<div class="pull-left">
						<h3><?php __('lblDashLatestBookings');?></h3>
						<small>
						<?php
						if ($tpl['spaces_occupied_today'] != 1) { 
							echo sprintf(__('lblDashTotalBookingsToday', true), $tpl['spaces_occupied_today']);
						} else {
							echo sprintf(__('lblDashTotalBookingToday', true), $tpl['spaces_occupied_today']);
						}
						?>
						</small>
					</div><!-- /.pull-left -->

					<div class="pull-right m-t-md">
						<a href="<?php echo $_SERVER['PHP_SELF']; ?>?controller=pjAdminBookings&amp;action=pjActionIndex" class="btn btn-primary btn-sm btn-outline m-n"><?php __('lblDashViewAll');?></a>
					</div><!-- /.pull-right -->
				</div>

				<div class="ibox-content inspinia-timeline">
					<?php if (count($tpl['latest_bookings']) > 0) { ?>
						<?php foreach ($tpl['latest_bookings'] as $k => $v) { ?>
						<div class="timeline-item">
							<div class="row">
								<div class="col-xs-3 date">
									<i class="fa fa-calendar"></i>
									<?php echo date('dS', strtotime($v['from']));?>, <?php echo @$months[date('n', strtotime($v['from']))];?> <?php echo date($tpl['option_arr']['o_time_format'], strtotime($v['from']));?>
								</div>
								<div class="col-xs-7 content">
									<a href="<?php echo $_SERVER['PHP_SELF']; ?>?controller=pjAdminBookings&amp;action=pjActionUpdate&amp;id=<?php echo $v['id']; ?>">
										<p class="m-b-xs"><strong><?php echo pjSanitize::html($v['c_name']);?></strong></p>
	
										<p class="m-n"><?php __('lblDashMake')?>: <em><?php echo pjSanitize::html($v['c_make']);?></em></p>
										<p class="m-n"><?php __('lblDashModel')?>: <em><?php echo pjSanitize::html($v['c_model']);?></em></p>
										<p class="m-n"><?php __('lblDashRegistration')?>: <em><?php echo pjSanitize::html($v['c_regno']);?></em></p>
										<p class="m-b-sm"><?php echo $v['days'] != 1 ? __('lblDashDays', true) : __('lblDashDay', true)?>: <em><?php echo $v['days'];?></em></p>
									</a>
								</div>
	
								<div class="badge bg-<?php echo $v['status'];?> b-r-sm pull-right m-t-md m-r-sm"><?php echo @$bs[$v['status']];?></div>
							</div>
						</div>
						<?php } ?>
					<?php } else { ?>
						<p><?php __('lblDashNoBookingsFound');?></p>
					<?php } ?>
				</div>
			</div>
		</div><!-- /.col-lg-4 -->

		<div class="col-lg-4">
			<div class="ibox float-e-margins">
				<div class="ibox-content ibox-heading clearfix">
					<div class="pull-left">
						<h3><?php __('lblDashComingToday');?></h3>
						<small><?php echo sprintf(__('lblDashTotalComingToday', true), $tpl['car_coming_today']);?></small>
					</div><!-- /.pull-left -->

					<div class="pull-right m-t-md">
						<a href="<?php echo $_SERVER['PHP_SELF']; ?>?controller=pjAdminBookings&amp;action=pjActionIndex&amp;from=<?php echo urlencode($today); ?>" class="btn btn-primary btn-sm btn-outline m-n"><?php __('lblDashViewAll');?></a>
					</div><!-- /.pull-right -->
				</div>

				<div class="ibox-content inspinia-timeline">
					<?php if (count($tpl['coming_bookings']) > 0) { ?>
						<?php foreach ($tpl['coming_bookings'] as $k => $v) { ?>
							<div class="timeline-item">
								<div class="row">
									<div class="col-xs-3 date">
										<i class="fa fa-calendar"></i>
										<?php echo @$months[date('n', strtotime($v['from']))];?> <?php echo date($tpl['option_arr']['o_time_format'], strtotime($v['from']));?>
									</div>
									<div class="col-xs-7 content">
										<a href="<?php echo $_SERVER['PHP_SELF']; ?>?controller=pjAdminBookings&amp;action=pjActionUpdate&amp;id=<?php echo $v['id']; ?>">
											<p class="m-b-xs"><strong><?php echo pjSanitize::html($v['c_name']);?></strong></p>
		
											<p class="m-n"><?php __('lblDashMake')?>: <em><?php echo pjSanitize::html($v['c_make']);?></em></p>
											<p class="m-n"><?php __('lblDashModel')?>: <em><?php echo pjSanitize::html($v['c_model']);?></em></p>
											<p class="m-n"><?php __('lblDashRegistration')?>: <em><?php echo pjSanitize::html($v['c_regno']);?></em></p>
											<p class="m-b-sm"><?php echo $v['days'] != 1 ? __('lblDashDays', true) : __('lblDashDay', true)?>: <em><?php echo $v['days'];?></em></p>
										</a>
									</div>
								</div>
							</div>
						<?php } ?>
					<?php } else { ?>
						<p><?php __('lblDashNoCarsFound');?></p>
					<?php } ?>
				</div>
			</div>
		</div><!-- /.col-lg-4 -->

		<div class="col-lg-4">
			<div class="ibox float-e-margins">
				<div class="ibox-content ibox-heading clearfix">
					<div class="pull-left">
						<h3><?php __('lblDashLeavingToday');?></h3>
						<small><?php echo sprintf(__('lblDashTotalLeavingToday', true), $tpl['car_leaving_today']);?></small>
					</div><!-- /.pull-left -->

					<div class="pull-right m-t-md">
						<a href="<?php echo $_SERVER['PHP_SELF']; ?>?controller=pjAdminBookings&amp;action=pjActionIndex&amp;to=<?php echo urlencode($today); ?>" class="btn btn-primary btn-sm btn-outline m-n"><?php __('lblDashViewAll');?></a>
					</div><!-- /.pull-right -->
				</div>

				<div class="ibox-content inspinia-timeline">
					<?php if (count($tpl['leaving_bookings']) > 0) { ?>
						<?php foreach ($tpl['leaving_bookings'] as $k => $v) { ?>
							<div class="timeline-item">
								<div class="row">
									<div class="col-xs-3 date">
										<i class="fa fa-calendar"></i>
										<?php echo @$months[date('n', strtotime($v['from']))];?> <?php echo date($tpl['option_arr']['o_time_format'], strtotime($v['from']));?>
									</div>
									<div class="col-xs-7 content">
										<a href="<?php echo $_SERVER['PHP_SELF']; ?>?controller=pjAdminBookings&amp;action=pjActionUpdate&amp;id=<?php echo $v['id']; ?>">
											<p class="m-b-xs"><strong><?php echo pjSanitize::html($v['c_name']);?></strong></p>
		
											<p class="m-n"><?php __('lblDashMake')?>: <em><?php echo pjSanitize::html($v['c_make']);?></em></p>
											<p class="m-n"><?php __('lblDashModel')?>: <em><?php echo pjSanitize::html($v['c_model']);?></em></p>
											<p class="m-n"><?php __('lblDashRegistration')?>: <em><?php echo pjSanitize::html($v['c_regno']);?></em></p>
											<p class="m-b-sm"><?php echo $v['days'] != 1 ? __('lblDashDays', true) : __('lblDashDay', true)?>: <em><?php echo $v['days'];?></em></p>
										</a>
									</div>
								</div>
							</div>
						<?php } ?>
					<?php } else { ?>
						<p><?php __('lblDashNoCarsFound');?></p>
					<?php } ?>
				</div>
			</div>
		</div><!-- /.col-lg-4 -->
	</div><!-- /.row -->
</div><!-- /.wrapper wrapper-content -->