 <?php $__env->startSection('content'); ?>
<div class="content-wrapper merchant-right-side">
        <!-- Content Header (Page header) -->
        <section class="content-header">
          
           <h1 class="pull-left">Loyalty Program Rewards</h1>
    	<div class="pull-right">
    		<a class="btn btn-primary" href="<?php echo url('merchant/createrewards'); ?>">Add new Rewards</a>
<!-- 			<?php echo $__env->make('includes.search', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?> -->
		</div><br><br>
         
<!--           <ol class="breadcrumb"> -->
<!--             <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li> -->
<!--             <li><a href="#">Tables</a></li> -->
<!--             <li class="active">Simple</li> -->
<!--           </ol> -->
           <?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['rewards']) == 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>Name</th>
				<?php if($data['type']==1): ?>
				<th>Stamps</th>
				<?php else: ?>
				<th>Credits</th>
				<?php endif; ?>
				
				<th>Location</th>
				<th>Timing</th>
				<th>Validity</th>
				<th>Valid days</th>
				<!-- <th>Expiry</th> -->
				<th>Edit</th>
				<th>Delete</th>
				</tr></thead>
				<tbody>
				
				<?php /**/ $j=0 /**/ ?>
				 <?php foreach($data['rewards'] 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><?php echo $j=$j+1; ?></td>
				<td><?php echo $ad->name; ?></td>
				<td><?php echo $ad->points; ?></td>
				<td><?php echo $ad->location; ?></td>
				<td><?php $splittime=explode(',', $ad->timing);
				if($splittime[0]>11.59)
				{
				$from=$splittime[0]-12;
				$from=$from.'.00 PM';
				}
				else{
				$from=$splittime[0].'.00 AM';
				}
				if($splittime[1]>11.59)
				{
					$to=$splittime[1]-12;
					$to=$to.'.00 PM';
				}
				else{
					$to=$splittime[1].'.00 AM';
				}
				?><?php echo $from; ?> to <?php echo $to; ?></td>
				<td><?php echo $ad->validity; ?></td>
				<td><?php echo $string; ?></td>
				<!-- <td><?php echo $class; ?></td> -->
				<td><a href="<?php echo url('merchant/edit/'.$ad->id.'/reward'); ?>"><i class="fa fa-edit"></i> Edit</a></td>
				<td><a href="<?php echo url('merchant/delete/reward/'.$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->stopSection(); ?>

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