<div class="container-fluid pjCrContainer">
	<?php include_once dirname(__FILE__) . '/elements/menu.php';?>
	<div class="panel panel-default">
		<div class="panel-heading clearfix pjCrHeading">
        	<div class="row">
        		<div class="col-xs-12 pjCrHeadTitle"><?php __('front_orders_history');?></div>
        	</div>
        </div>
		<div class="panel-body pjCrBody">
			<div class="row">
        		<div class="pjCrOrdersContainer col-sm-12">
        			<table class="table table-bordered pjCrTblOrders">
        				<thead>
        					<tr>
        						<th><?php __('front_orders_id');?></th>
        						<th><?php __('front_orders_pickup_return');?></th>
        						<th><?php __('front_orders_type');?></th>
        						<th><?php __('front_orders_car');?></th>
        						<th><?php __('front_orders_total');?></th>
        						<th><?php __('front_orders_status');?></th>
        						<th><?php __('front_booking_files');?></th>
        					</tr>
        				</thead>
        				<tbody>
        					<?php if (count($tpl['arr']) > 0) { 
        					    $bs = __('booking_statuses', true);
        					    ?>
        						<?php foreach ($tpl['arr'] as $k => $item) { ?>
        						<tr>
        							<td data-title="<?php __('front_orders_id');?>"><?php echo pjSanitize::html($item['uuid']);?></td>
        							<td data-title="<?php __('front_orders_pickup_return');?>"><?php echo $item['pick_drop'];?></td>
        							<td data-title="<?php __('front_orders_type');?>"><?php echo pjSanitize::html($item['type']);?></td>
        							<td data-title="<?php __('front_orders_car');?>"><?php echo $item['car_info'];?></td>
        							<td data-title="<?php __('front_orders_total');?>" align="right"><?php echo pjCurrency::formatPrice($item['total_price']);?></td>
        							<td data-title="<?php __('front_orders_status');?>" align="center">
										<?php if ($item['status'] == 'confirmed') { ?>
											<div class="btn bg-confirmed btn-xs no-margin"><i class="fa fa-check"></i><?php echo $bs['confirmed'];?></div>
										<?php } elseif ($item['status'] == 'cancelled') { ?>
											<div class="btn bg-cancelled btn-xs no-margin"><i class="fa fa-times"></i><?php echo $bs['cancelled'];?></div>
										<?php } elseif ($item['status'] == 'pending') { ?>
											<div class="btn bg-pending btn-xs no-margin"><i class="fa fa-exclamation-triangle"></i><?php echo $bs['pending'];?></div>
										<?php } elseif ($item['status'] == 'collected') { ?>
											<div class="btn bg-collected btn-xs no-margin"><i class="fa fa-check"></i><?php echo $bs['collected'];?></div>
										<?php } elseif ($item['status'] == 'completed') { ?>
											<div class="btn bg-completed btn-xs no-margin"><i class="fa fa-check"></i><?php echo $bs['completed'];?></div>
										<?php } ?>
									</td>
									<td data-title="<?php __('front_booking_files');?>">
										<?php if (isset($tpl['booking_file_arr'][$item['id']])) { ?>
											<?php foreach ($tpl['booking_file_arr'][$item['id']] as $bf) { ?>
                                        		<div class="row">
                                        			<div class="col-xs-12"><a target="_blank" href="<?php echo $_SERVER['PHP_SELF']; ?>?controller=pjFront&amp;action=pjActionDownloadFile&amp;uuid=<?php echo sha1($bf['id'].PJ_SALT);?>"><?php 
                                            echo pjSanitize::html(
                                                mb_strlen($bf['file_name']) > 50 
                                                    ? mb_substr($bf['file_name'], 0, 30) . '...' 
                                                    : $bf['file_name']
                                            ); 
                                            ?></a></div>
                                        		</div>
                                    		<?php } ?>      
										<?php } else { ?>
											&nbsp;
										<?php } ?>
									</td>
        						</tr>
        						<?php } ?>
        					<?php } else { ?>
        						<tr>
        							<td colspan="6" align="center" class="pjFpRowsEmpty"><?php __('front_orders_empty');?></td>
        						</tr>
        					<?php } ?>
        				</tbody>
        			</table>
        		</div>
        	</div>	
        	<div class="row">
        		<div class="col-xs-12">
        		<?php 
        		$type = 'Orders';
        		include_once PJ_VIEWS_PATH . 'pjFront/elements/pagination.php';
        		?>
        		</div>
        	</div>
		</div><!-- /.panel-body pjCrBody -->
	</div><!-- /.panel panel-default -->
</div><!-- /.container-fluid pjCrContainer -->