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

<div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
          <h1 class="pull-left">My Database</h1>
    	<div class="pull-right">
<!--     		<a class="btn btn-primary" href="<?php echo url('admin/merchant/register'); ?>">Add new Merchant</a> -->
<!-- 			<?php echo $__env->make('includes.search', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?> -->
		</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-md-4" style="">&nbsp;</div>
			<div class="col-md-4" style="">
				<a href="<?php echo url('merchant/getcrmDownloadReport'); ?>"><input type="button" class="btn btn-primary" name="view report" value="Download Excel"></a>
			</div>
<div class="col-md-4" style="float:right;">
<?php echo Form::open(array('url'=>'merchant/appuser','method'=>'GET','role'=>"form",
							'files'=>true,'id'=>'adds-add-form')); ?>

                            
                            <div class="col-md-8">
		<div class="form_group">
			<?php echo Form::text('name',Input::old('name'),array('class' => 'form-control')); ?>

		</div>
		</div>
        <div class="form_group">
        <?php echo Form::label('', '',['class' => '']); ?>

		<input type="submit" class='btn btn-primary' name="Search" value="Search">&emsp;
		</div>
        <?php echo Form::close(); ?>


</div><br/><br/>
            <div class="col-md-12">
              <div class="box">
             <div class="box-body">
                <?php if(count($data) == 0): ?>
					<p class='notice'><?php echo trans('admin::users.pages.no_record_found'); ?></p>
				<?php else: ?>
				 <table id="userdetail" class="table table-bordered table-striped">
                  				<thead style="font-size: 12px;">
                  				<tr>
								<th>Name</th>
								<th>Membership Number</th>
								<th>Email</th>
								 <th>Mobile Number</th>
								 <th>Gender</th>
								 <th>City</th>
								 <th>Birth date</th>
								 <th>Anniversary date</th>
								 <?php if($loyalty->loyalty_type==2): ?>
								 <th>Current Credits</th>
								 <th>Credits Redeemed</th>
								 <th>Total Credits</th>
								 <?php elseif($loyalty->loyalty_type==1): ?>
								  <th>Current Stamps</th>
								 <th>Stamps Redeemed</th>
								 <th>Total Stamps</th>
								 <?php endif; ?>
								  <th>Card Validity</th>
								
								<!--<th>Current <?php if($loyalty->loyalty_type==2): ?> Points <?php else: ?> Stamps <?php endif; ?></th>
								<th>Total <?php if($loyalty->loyalty_type==2): ?> Points <?php else: ?> Stamps <?php endif; ?></th>-->
								<!-- <th>Email</th>
								<th>Mobile</th>
								<th>Address</th>
								<th>Location</th>
								<th>Login Type</th>
								<th>Device</th> -->
                                
                               
								<!-- <th>Edit</th> -->
								<th style='width:150px'>Action</th>
								</tr>
								</thead>
								<tbody style="font-size: 12px;">
							<style>
						tr td table{
							text-align: left;
							font-size: 12px;
							}
							tr td table tr th{
							}
							</style>	
                    <?php foreach( $data as $ad ): ?>
                                 <?php 
$key1=(new BaseController())->generate_key_string();
$key2=(new BaseController())->generate_key_string();

$en1=(new BaseController())->encryption($key2.'_'.$ad->user->id);
$en2=(new BaseController())->encryption($key1.'_'.$ad->merchant_id);
$str1=strtr(base64_encode($en1), '+/=', '-_,');
$str2=strtr(base64_encode($en2), '+/=', '-_,');
//$str2=strtr(base64_encode($key1.'_'.$ad->merchant_id), '+/=', '-_,');
//$str1=strtr(base64_encode($key2.'_'.$ad->user->id), '+/=', '-_,');

?>
                 
                  <tr>
                  				<td>
                  				<?php echo $ad->user->name; ?>

                  				</td>
                  				<td><?php echo $ad->member_id; ?></td>
                  				<td><?php echo $ad->user->email; ?></td>
                  				<td><a href="<?php echo url('merchant/appuser/view/'.$str1.'/'.$str2); ?>"><?php echo $ad->user->mobile; ?></a></td>
                   				<td><?php if($ad->user->gender=='Female'): ?> F <?php else: ?> M   <?php endif; ?></td>
                  				<td><?php echo $ad->user->city; ?></td>
                  				<?php if($ad->user->dob=='0000-00-00'): ?>
                  				<td><?php echo 'N/A'; ?></td>
                  				<?php else: ?>

                  				<td><?php echo date('jS  F', strtotime($ad->user->dob)); ?></td>
                  				<?php endif; ?>
                  				<td><?php if($ad->user->marital=='Married' and $ad->user->anniversary_date=='0000-00-00' ): ?> Not Given <?php elseif($ad->user->marital=='Married' and $ad->user->anniversary_date !='0000-00-00' ): ?> <?php echo date('jS  F', strtotime($ad->user->anniversary_date)); ?> <?php else: ?> Single   <?php endif; ?></td>
                  				<td><?php echo $ad->current_points; ?></td>
                  				<td><?php echo $ad->total_points-$ad->current_points; ?></td>
                  				<td><?php echo $ad->total_points; ?></td>
                  				<td><?php if($ad->user_validity=='2027-01-01'): ?> Lifetime <?php else: ?> <?php echo $ad->user_validity; ?> <?php endif; ?></td>
                  				
								<!--<td><?php echo date('jS  F', strtotime($ad->user->anniversary_date)); ?></td>-->
								
								<!--<td><?php echo $ad->card_type; ?></td>
								<td><?php echo $ad->current_points; ?></td>
								<td><?php echo $ad->total_points; ?></td>-->
								
								<!-- <td><a href="<?php echo url('admin/merchant/edit/'.$ad->id); ?>" ><i class="fa fa-edit"></i> Edit</a></td> -->
								<td><?php if($ad->is_blocked==0){?><a href="<?php echo url('merchant/block/'.$str1); ?>" onclick="return blockuser();" ><i class="fa fa-ban"></i> Block</a> <?php }elseif($ad->is_blocked==1){?><a href="<?php echo url('merchant/unblock/'.$str1); ?>" onclick="return unblockuser();" ><i class="fa fa-check"></i> Unblock</a><?php }?> <!--<a href="<?php echo url('merchant/delete/user/'.$str1); ?>" onclick="return deleteuser();" ><i class="fa fa-trash" ></i> Delete</a>--><a href="<?php echo url('merchant/card_valide/'.$str1); ?>" ><i class="fa fa-edit" ></i> Edit</a></td>

							</tr>
							<?php endforeach; ?>
							</tbody>
                  </table>
                  <?php endif; ?>
                </div><!-- /.box-body -->
              </div><!-- /.box -->
<?php $name = Input::get('name'); ?>
<?php echo $data->appends(array('name' => $name))->links(); ?>
<!--<?php echo $data->links(); ?>-->
            </div>
          </div>
        </section><!-- /.content -->
	
      </div>
      <?php $__env->startSection('scripts'); ?>
<script type="text/javascript">

/*$('#userdetail').DataTable({
	
    "pageLength":10,
    "ordering": false,
    "lengthMenu": [5, 10, 25, 50, 75, 100 ]
});
$(document).ready(function() {
    $('#userdetail').DataTable( {
        "processing": true,
        "serverSide": true,
	"pageLength":10,
   	 "ordering": false,
    	"lengthMenu": [5, 10, 20, 50, 75, 100 ]
        "ajax": "<?php echo url('merchant/appuser1'); ?>"
    } );
} );*/
</script>

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