<div class="mb-2">
    <button class="btn btn-primary" onclick="export2csv()">Download csv</button>
</div>

        <div class="col-md-12">
            <div class="badge badge-info float-right m-1" style="text-align: ">Total Row: <?php echo e($list->count()); ?></div>
            <div class="badge badge-info float-right m-1" style="text-align: ">Total Amount: <?php echo e($list->sum('amount')); ?></div>
            <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('show_reseller_cost_in_pop')): ?>
                <div class="badge badge-info float-right m-1" style="text-align: ">Total Reseller Amount: <?php echo e($list->sum('reseller_cost')); ?></div>
            <?php endif; ?>
            <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('show_reseller_cost_in_pop')): ?>
                <div class="badge badge-info float-right m-1" style="text-align: ">Total Sub Manager Miscellaneous Expense <?php echo e($list->sum('commission')); ?></div>
            <?php endif; ?>
        </div>
        <div class="table-responsive">
          <table class="table table-bordered table-condensed table-striped" id="tableId">
              <thead class="bg-blue-50">
                  <tr>
                      <th scope="col" class="">
                          ID
                      </th>
                      <th scope="col" class="">
                          Date
                      </th>

                      <th scope="col" class="">
                          Pop Name
                      </th>

                      <th scope="col" class="">
                        User ID
                      </th>
                      <th scope="col" class="">
                        Action
                      </th>

                      <th scope="col" class="">
                          Amount
                      </th>
                      <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('show_reseller_cost_in_pop')): ?>

                        <th scope="col" class="">
                                Reseller Amount
                        </th>
                      <?php endif; ?>
                      <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('show_commission_sub_reseller_balance_log')): ?>

                        <th scope="col" class="">
                            Sub Manager Miscellaneous Expense
                        </th>
                      <?php endif; ?>


                      <th scope="col" class="">
                          Remarks
                      </th>
                  </tr>
              </thead>
              <tbody class="bg-white divide-y divide-gray-200">
                    <?php $total = 0;   ?>
                  <?php $__currentLoopData = $list; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $r): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>

                  <tr>
                      <td class="px-6 py-2 whitespace-nowrap">
                          <?php echo e($r->id); ?>

                      </td>
                      <td class="px-6 py-2 whitespace-nowrap">
                          <?php echo e(date('d-M-Y h:i:sa',strtotime($r->created_at))); ?>

                      </td>

                      <td class="px-6 py-2 whitespace-nowrap text-sm text-gray-500">
                        <?php $__currentLoopData = $pops; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $pop): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                            <?php if($pop->id == $r->sub_reseller_id): ?>
                            <?php echo e($pop->popname); ?>

                            <?php endif; ?>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                      </td>

                      <td class="px-6 py-2 whitespace-nowrap text-sm text-gray-500">
                          <?php echo e($r->client->userid ?? ''); ?>

                      </td>

                      <td class="px-6 py-2 whitespace-nowrap text-sm text-gray-500">
                          <?php echo e($r->action ?? ''); ?>

                      </td>

                      <td class="px-6 py-2 whitespace-nowrap text-right">

                        <?php $total+=$r->amount ?>
                          <?php echo e($r->amount); ?>

                      </td>
                      <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('show_reseller_cost_in_pop')): ?>

                        <td class="px-6 py-2 whitespace-nowrap text-right">
                            <?php echo e($r->reseller_cost ?? 0); ?>

                        </td>
                      <?php endif; ?>
                      <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('show_commission_sub_reseller_balance_log')): ?>

                        <td class="px-6 py-2 whitespace-nowrap text-right">
                            <?php echo e($r->comission ?? 0); ?>

                        </td>
                      <?php endif; ?>


                      <td class="px-6 py-2 whitespace-nowrap text-sm text-gray-500 text-right">
                          <?php echo e($r->remarks); ?>

                      </td>

                  </tr>

                  <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

                  <tr>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                      <td class="text-right">Total</td>
                      <td class="px-6 py-2 whitespace-nowrap text-right"><?php echo e(number_format($total, 2, '.', '')); ?></td>
                      <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('show_reseller_cost_in_pop')): ?>

                        <td class="px-6 py-2 whitespace-nowrap text-right"><?php echo e(number_format($list->sum('reseller_cost') , 2, '.', '')); ?></td>
                      <?php endif; ?>
                      <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('show_commission_sub_reseller_balance_log')): ?>

                         <td class="px-6 py-2 whitespace-nowrap text-right"><?php echo e(number_format($list->sum('comission') , 2, '.', '')); ?></td>
                      <?php endif; ?>
                      <td></td>
                  </tr>

                  <!-- More items... -->
              </tbody>
          </table>
</div>
          <div class="p-5">
              
          </div>
<?php /**PATH /var/www/html/sajib/radius-circle/resources/views/subresellerBalanceLog/result.blade.php ENDPATH**/ ?>