<?php $__env->startSection('title'); ?>
   Supplier Management
<?php $__env->stopSection(); ?>
<?php $__env->startPush('css'); ?>

<?php $__env->stopPush(); ?>
<!-- page content -->
<?php $__env->startSection('content'); ?>
    <div class="right_col" role="main">
        <div class="">
            <div class="clearfix"></div>
            <?php if(Session::has('success')): ?>
                <div class="alert alert-success">
                    <?php echo e(Session::get('success')); ?>

                </div>
            <?php endif; ?>
            <?php if(Session::has('error')): ?>
                <div class="alert alert-danger">
                    <?php echo e(Session::get('error')); ?>

                </div>
            <?php endif; ?>
            <div class="row">
                <div class="col-md-12 col-sm-12 col-xs-12">
                    <div class="x_panel">
                        <div class="x_title">
                            <h2>Supplier Details
                                 <a href="<?php echo e(route('account.spi')); ?>" class="btn btn-xs btn-primary"> Payment</a>
                                  <a href="<?php echo e(route('supplier.create')); ?>" class="btn btn-xs btn-primary">New Supplier</a>
                             </h2>
                            <ul class="nav navbar-right panel_toolbox">
                                <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                                </li>
                                <li class="dropdown">
                                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-wrench"></i></a>
                                    <ul class="dropdown-menu" role="menu">
                                        <li><a href="#">Settings 1</a>
                                        </li>
                                        <li><a href="#">Settings 2</a>
                                        </li>
                                    </ul>
                                </li>
                                <li><a class="close-link"><i class="fa fa-close"></i></a>
                                </li>
                            </ul>
                            <div class="clearfix"></div>
                        </div>
                        <div class="x_content">
                            <table class="table table-condensed table-bordered table-hover" id="categorytable">
                                <thead>
                                <tr class="bg-primary" >
                                    <th>SL</th>
                                    <th>Supplier Name</th>
                                    <th>Phone</th>
                                    <th>Email</th>
                                    <th>Address</th>
                                    <th>Due Amount</th>
                                    <th>Action</th>
                                </tr>
                                </thead>
                                <tbody>
                                <?php $__currentLoopData = $suppliers; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $i=>$pc): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <tr>
                                        <th> <?php echo e($i+1); ?></th>
                                        <td> <?php echo e($pc->name); ?></td>
                                        <td> <?php echo e($pc->phone); ?></td>
                                        <td> <?php echo e($pc->email); ?></td>
                                        <td> <?php echo e($pc->address); ?></td>
                                        <td> <?php echo e($pc->purchase->sum('due_amount')); ?></td>
                                        <td>
                                            <div class="row">
                                                <div class="col-md-4">
                                                    <a href="<?php echo e(route('supplier.edit',$pc->id)); ?>" class=" btn-xs btn-warning"><i class="fa fa-pencil"></i></a>
                                                </div>
                                                <?php if (app(\Illuminate\Contracts\Auth\Access\Gate::class)->check('supplier-delete')): ?>
                                                <div class="col-md-4">
                                                    <form action="<?php echo e(route('supplier.delete' ,$pc->id)); ?>" method="post">
                                                        <input type="hidden" name="_method" value="DELETE">
                                                        <?php echo e(csrf_field()); ?>

                                                        <button type="submit" class="btn btn-xs btn-danger" onclick="return confirm('are you sure to delete?')" ><i class="fa fa-trash-o"></i> Delete</button>
                                                    </form>
                                                </div>
                                                <?php endif; ?>
                                            </div>
                                        </td>
                                    </tr>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- /page content -->
<?php $__env->stopSection(); ?>

<?php $__env->startPush('script'); ?>
    
    <script type="text/javascript">
        $(document).ready(function() {
            
        });
    </script>
<?php $__env->stopPush(); ?>
<?php echo $__env->make('backend.layouts.master', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>