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

<div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
          <h1 class="pull-left">Sub Accounts </h1>
    	<div class="pull-right">
     		<a class="btn btn-primary" href="<?php echo url('merchant/addemployee/add'); ?>">Add Sub-Account</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-12">
              <div class="box">
               <div>
              <center>  <h5></h6><label style="color:#008B8B;"><strong>No. of Sub-Accounts Allowed : <?php echo $merchant_info->no_sub_account; ?></strong></label></h5></center>
        </div>
             <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>
                  				<tr>
								<th>Name</th>
								<th>Email</th>
								<th>Password</th>
								<th>Business Name</th>
                                <th>Business Location</th>
                                <th>Category</th>
                                <th>Note</th>
               
								<th>Permission</th>

                               <?php if($loyalty->loyalty_type==2 && $loyalty->structure_type==0): ?> 
                               <th>Loyalty Program %</th>
                               <?php endif; ?>
								<th style='width:150px'>Action</th>
								</tr>
								</thead>
								<tbody>
							<style>
						tr td table{
							text-align: left;
							}
							tr td table tr th{
							}
							</style>	
                    <?php foreach( $data as $ad ): ?>
                    <?php if($ad->deleted==0): ?>
                  
                 
                  <tr>
                  				<td>
                  				<?php echo $ad->name; ?>

                  				</td>
                  				<td><?php echo $ad->email; ?></td>
								<td><?php echo $ad->orginialpassword; ?></td>
								 <td><?php echo $ad->business_name; ?></td>
                                <td><?php echo $ad->business_location; ?></td>
                                <td><?php echo $ad->category; ?></td>
                                
                                <td><?php echo $ad->note; ?></td>
                               
								<?php $split=explode(',', $ad->permission);
								$permission='';
								for($i=0;$i<count($split);$i++){
									if($split[$i]==1){
									$text="<span class='label label-success'>Add Credits/Stamps</span>";
									}else if($split[$i]==2){
										$text="<span class='label label-success'>Verify Coupon </span>";
									}else if($split[$i]==3){
										$text="<span class='label label-success'> User Details</span>";
									}else if($split[$i]==4){
										$text="<span class='label label-success'>Loyalty  Request</span>";
									}
									else if($split[$i]==5){
										$text="<span class='label label-success'>Redeem Credits/stamps</span>";
									}
									else if($split[$i]==6) {
										$text="<span class='label label-success'>Ewallet</span>";
									}
									else {
										$text="<span class='label label-success'>Program Overview</span>";
									}
									$permission.=$text.' ';
								}

								?>
								<td><?php echo rtrim($permission,','); ?></td>
								<?php if($loyalty->loyalty_type==2 && $loyalty->structure_type==0): ?> 
                                <td><?php echo $ad->loyalty_percentage; ?></td>
                                <?php endif; ?>
							<td>
							<?php if($ad->is_active==0): ?>
							Blocked by service Provider
							<?php elseif($ad->is_active==1): ?>
							<a href="<?php echo url('merchant/editemployee/edit/'.$ad->id); ?>"><i class="fa fa-edit" ></i> Edit</a>&emsp;<a href="<?php echo url('merchant/delete/employee/'.$ad->id); ?>" onclick="return deleteuser();" ><i class="fa fa-trash" ></i> Delete</a>
							<?php endif; ?>
							</td>

							</tr>
							<?php endif; ?>
							<?php endforeach; ?>
							</tbody>
                  </table>
                  <?php endif; ?>
                </div><!-- /.box-body -->
              </div><!-- /.box -->
            </div>
          </div>
       	  <div class="row">
           <h1 class="pull-left" style="font-size: 24px; margin-left: 16px;">Reports </h1>
           	 <div class="col-md-12">
           	  		 <div class="box">
            			 <div class="box-body">
	            			  <table id="userdetail" class="table table-bordered table-striped">
				            			  <thead>
				                  				<tr>
												<th>Sub-Account</th>

												<!--<th><?php if($loyalty->loyalty_type=='2'): ?> Credits <?php else: ?> Stamps <?php endif; ?> Given</th>
												<th><?php if($loyalty->loyalty_type=='2'): ?>Credits <?php else: ?> Stamps <?php endif; ?> Redeemed</th>
												<th>Rewards Redeemed</th>
												<th>Requests Accepted</th>
												<th>Requests Rejected</th>-->
												<th>Members Added</th>
												</tr>
												</thead>
												<body>
													<style>
										        	tr td table{
											    	text-align: left;
											     	}
											    	tr td table tr th{
											    	}
										     	  </style>	
				                          <?php foreach( $data as $ad ): ?>
				                           <?php 
// $key1=(new BaseController())->generate_key_string();

// $en1=(new BaseController())->encryption($key1.'_'.$ad->email);

// $str1=strtr(base64_encode($en1), '+/=', '-_,');


?>
				                           	 <tr>
				                  				<td><a href="<?php echo url('merchant/sub_account/'.$ad->id ); ?>"><?php echo $ad->email; ?></a></td>
				                  							
				                  				<td><?php echo $totaladd[$ad->email]; ?></td>
				                  								
											</tr>
										<?php endforeach; ?>
											</tbody>
				            	 </table>
             			</div>
             		</div>
             	</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 ]
});
</script>
<?php $__env->stopSection(); ?>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.merchant-backend-layout', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>