
<?php $__env->startSection('title', 'Account List'); ?>

<?php $__env->startSection('page-header'); ?>
<header class="header bg-ui-general">
     <div class="header-info">
          <h1 class="header-title">
               <strong>Account</strong>
          </h1>
     </div>

     <div class="header-action">
          <nav class="nav">
               <a class="nav-link active" href="<?php echo e(route('bank_account.index')); ?>">
                    <i class="fa fa-plus"></i>
                    Account
               </a>
               
               
          </nav>
     </div>
</header>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('content'); ?>
<div class="col-12">
     <div class="card">
          <?php if(isset($account)): ?>
          <h4 class="card-title">Update Account</h4>
          <?php else: ?>
          <h4 class="card-title">New Account</h4>
          <?php endif; ?>
          <div class="card-body">
               <form action="<?php if(isset($account)): ?> <?php echo e(route('bank_account.update', $account->id)); ?> <?php else: ?> <?php echo e(route('bank_account.store')); ?> <?php endif; ?>"
                    method="POST">
                    <?php echo csrf_field(); ?>
                    <?php if(isset($account)): ?>
                    <?php echo method_field('PUT'); ?>
                    <?php endif; ?>
                    <div class="form-row">
                         <div class="form-group col-md-4 mt-4">
                              
                              <input type="text" name="name" placeholder="Enter Account Name"
                                   class="form-control <?php echo e($errors->has('name') ? 'is-invalid': ''); ?>" <?php if(isset($account)): ?>
                                   value="<?php echo e($account->name); ?>" <?php endif; ?>>
                              <?php if($errors->has('name')): ?>
                              <span class="invalid-feedback"><?php echo e($errors->first('name')); ?></span>
                              <?php endif; ?>
                         </div>

                         <?php if(isset($account)): ?>
                         <?php else: ?>
                         <div class="form-group col-md-4 mt-4">
                              
                              <input type="text" name="opening_balance" placeholder="Opening Balance"
                                   value="<?php echo e(old("opening_balance")); ?>" class="form-control">
                              <?php if($errors->has('opening_balance')): ?>
                              <div class="alert alert-danger"><?php echo e($errors->first('opening_blanace')); ?></div>
                              <?php endif; ?>
                         </div>
                         <?php endif; ?>
                         
                    <div class="form-group col-md-4">
                         <button type="submit" class="btn btn-primary mt-4">
                              <?php if(isset($account)): ?>
                              <i class="fa fa-refresh"></i>
                              Update
                              <?php else: ?>
                              <i class="fa fa-save"></i>
                              Save
                              <?php endif; ?>

                         </button>
                    </div>
          </div>
          <hr style="margin:0px">
          </form>
     </div>
</div>
</div>
<div class="col-12">
     <div class="card">
          <h4 class="card-title"><strong>Accounts</strong></h4>
          <div class="card-body card-body-soft">
               <?php if($accounts->count() > 0): ?>
               <div class="table-responsive-sm table-bordered">
                    <table class="table table-soft">
                         <thead>
                              <tr class="bg-primary">
                                   <th style="width:10%;">#</th>
                                   <th>Name</th>
                                   <th>Opening Balance</th>
                                   <th>Current Balance</th>
                                   
                                   <th style="width:20%;">Actions</th>
                              </tr>
                         </thead>
                         <tbody>
                              <?php $__currentLoopData = $accounts; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                              <tr>
                                   <td><?php echo e((isset($_GET['page']))? ($_GET['page']-1)*20+$key+1 : $key+1); ?></td>
                                   <td><?php echo e($item->name); ?></td>
                                   <td>Tk.<?php echo e(number_format($item->opening_balance, 2)); ?></td>
                                   <td>Tk.<?php echo e(number_format($item->balance(), 2)); ?></td>
                                   
                                   <td>


                                        <a href="<?php echo e(route("bank_account.add_money",$item->id)); ?>"
                                             class="edit btn btn-outline btn-primary" data-toggle="modal"
                                             data-target="#edit" id="Add Balance"><i
                                                  class="la la-edit text-primary"></i>Add Balance </a>
                                        <a href="<?php echo e(route("bank_account.withdraw_money",$item->id)); ?>"
                                             class="edit btn btn-outline btn-primary" data-toggle="modal"
                                             data-target="#edit" id="Withdraw Balance"><i
                                                  class="la la-edit text-primary"></i>Withdraw Balance </a>


                                        

                                        <a href="<?php echo e(route("bank_account.transfer",$item->id)); ?>"
                                             class="edit btn btn-outline btn-primary" data-toggle="modal"
                                             data-target="#edit" id="Add Payment"><i
                                                  class="la la-edit text-primary"></i>Transfer </a>

                                        <a href="<?php echo e(route('bank_account.history', $item->id)); ?>"
                                             class="btn btn-primary btn-sm">
                                             <i class="fa fa-edit"></i>
                                             History
                                        </a>

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

                         </tbody>
                    </table>

                    
               </div>
               <?php else: ?>
               <div class="alert alert-danger text-center" role="alert">
                    <strong>You have no Accounts </strong>
               </div>
               <?php endif; ?>
          </div>
     </div>


</div>



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

<?php $__env->startSection('styles'); ?>
<style>
     .alert {
          display: block;
     }
</style>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('scripts'); ?>
     <?php echo $__env->make('includes.delete-alert', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
     <?php echo $__env->make('includes.placeholder_model', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>
     <script src="<?php echo e(asset('js/modal_form.js')); ?>"></script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('layouts.master', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/demosoftghor/sm.demo.softghor.com/resources/views/pages/account/index.blade.php ENDPATH**/ ?>