 <?php $__env->startSection('content'); ?>
<div class="content-wrapper merchant-right-side">

        <section class="content-header">
          
		
    	<div class="pull-right">
    		<a class="btn btn-primary" href="<?php echo url('merchant/add_privilege'); ?>">Add New Privilege</a>

		</div><br><br>
           <?php echo $__env->make('includes.messages', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>
        </section>

        <!-- Main content -->
        <section class="content">
        <div class="row">
            <div class="col-xs-12">
              <div class="box">
               
                <div class="box-body table-responsive no-padding">
                <?php if(count($data['privilege']) == 0): ?>
					<p class='notice'><?php echo trans('admin::users.pages.no_record_found'); ?></p>
				<?php else: ?> 
				<table class="table table-bordered table-striped">
				<thead>
				<tr>
				<th>S.No</th>
				<th>Image</th>
				<th>Name of Privilege</th>
				<th>Description</th>
				<th>Timing</th>
				<th> Validity </th>
				<th>Valid days</th>
				<th>Edit</th>
				<th>Delete</th>
				</tr></thead>
				<tbody>
				
				<?php /**/ $j=0 /**/ ?>
				 <?php foreach($data['privilege'] as $ad ): ?>
							<?php /**/ $class= ($ad->is_expired==1)?'Active':'Expired'/**/ ?>
							<?php $days=explode(',', $ad->valid_on);
							$day='';
							for($i=0; $i<count($days); $i++){
							if($days[$i]=='1'){
							$day=$day.'SUN, ';
							}
							if($days[$i]=='2'){
								$day=$day.'MON, ';
							}
							if($days[$i]=='3'){
								$day=$day.'TUE, ';
							}
							if($days[$i]=='4'){
								$day=$day.'WED, ';
							}
							if($days[$i]=='5'){
								$day=$day.'THU, ';
							}
							if($days[$i]=='6'){
								$day=$day.'FRI, ';
							}
							if($days[$i]=='7'){
								$day=$day.'SAT, ';
							}
							}
							$string=rtrim($day,', ');
							?>
				<tr>
				<td  align="center"><?php echo $j=$j+1; ?></td>
					<?php
		           	$path=$ad->p_image;
		            ?>
				
				<td><img alt="" src="<?php echo asset($path); ?>" width="100" height="80"></td>
				<td><?php echo $ad->name; ?></td>
				<td><?php echo $ad->description; ?></td>
			
				<td><?php $splittime=explode(',', $ad->timing);
				if($splittime[0]==00.01)
				{
				   $from='00.01 AM';
				}
				elseif ($splittime[0]==12.00) 
				{
					 $from='12.00 PM';
				}
				elseif($splittime[0]>12.00)
				{
				$from=$splittime[0]-12.00;
				
				$from=$from.' PM';
				}
				else{
				$from=$splittime[0].' AM';
				}
				if($splittime[1] == 23.59)
				{
					$to='11.59 PM';
				}
				elseif ($splittime[1]==12.00) {
					$to='12.00 PM';
				}
				elseif($splittime[1]>12.00)
				{
					$to=$splittime[1]-12.00;
					
					$to=$to.' PM';
					
				}
				else{
					$to=$splittime[1].' AM';
				}
		    	
				?><?php echo $from; ?> to <?php echo $to; ?></td>
				<td><?php echo $ad->validity; ?><?php if($ad->validity== 1): ?>  Day <?php else: ?> Days <?php endif; ?></td>
				<td><?php echo $string; ?></td>
				
				<!-- <td><?php echo $class; ?></td> -->
				<td><a href="<?php echo url('merchant/edit/'.$ad->id.'/privilege_list'); ?>"><i class="fa fa-edit"></i> Edit</a></td>
				<td><a href="<?php echo url('merchant/delete/privilege_list/'.$ad->id); ?>"><i class="fa fa-trash"></i> Delete</a></td>
				</tr>
				<?php endforeach; ?>
				</tbody>
				</table>
                
                  <?php endif; ?>
           
		
                </div><!-- /.box-body -->
              </div><!-- /.box -->
            </div>
          </div>
        </section><!-- /.content -->
      </div>
      

<?php $__env->startSection('scripts'); ?>



	<script>
$('.token_summary').keypress(function (e) {
	if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) {
        return false;
    }
});
</script>

<?php $__env->stopSection(); ?>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.merchant-backend-layout', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>