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

<?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>Purchase List</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="">
                            <div class="row search-section">
                                <form action="<?php echo e(route('purchase.list')); ?>" id="searchForm" method="Get">
                                    <div class="col-sm-2">
                                        <select class="form-control" name="show" id="show">
                                            <option value="<?php echo e($purchases->count()); ?>"><?php echo e($purchases->count()); ?></option>
                                            <option value="10">10</option>
                                            <option value="25">25</option>
                                            <option value="50">50</option>
                                            <option value="100">100</option>
                                            <option value="250">250</option>
                                            <option value="500">500</option>
                                            <option value="1000">1000</option>
                                        </select>
                                    </div>
                                    <div class="col-sm-7"></div>
                                    <div class="col-sm-3">
                                        <div class="input-group">
                                            <input type="text" id="myInput" class="form-control" placeholder="Search">
                                            <span class="input-group-btn">
                                                <button type="button" class="btn btn-primary">
                                                <span class="ace-icon fa fa-search icon-on-right bigger-110"></span></button>
                                            </span>
                                        </div>
                                    </div>
                                </form> 
                            </div>
                            <div class="x_content table-responsive">
                                <table class="table table-condensed table-bordered table-hover" id="categorytable">
                                <thead>
                                <tr class="bg-primary">
                                    <th>SL</th>
                                    <th>Purchase Date</th>
                                    <!--<th>Purchase By</th>-->
                                    <th>Supplier</th>
                                    <th>Chalan NO</th>
                                    <th>Total Amount</th>
                                    <th>Paid Amount</th>
                                    <th>Action</th>
                                </tr>
                                </thead>
                                <tbody>
                                <?php $__currentLoopData = $purchases; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $p=>$paid): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <tr>
                                        <th> <?php echo e($p+1); ?></th>
                                        <td> <?php echo e(date('d-m-Y',strtotime($paid->created_at))); ?></td>
                                        <!--<td> <?php echo e($paid->user->name); ?></td>-->
                                        <td> <?php echo e($paid->supplier->name); ?></td>
                                        <td> <?php echo e($paid->chalan_no); ?></td>
                                        <td> <?php echo e($paid->grand_total); ?></td>
                                        <td> <?php echo e($paid->paid_amount); ?></td>
                                        <td>
                                            <a href="<?php echo e(route('sales.print',$paid->id)); ?>" class="btn-xs btn-primary" target="_blank"><i class="fa fa-print fa-x"></i></a>  
                                            <a href="<?php echo e(route('purchase.show',$paid->id)); ?>" class="btn-xs btn-primary"><i class="fa fa-eye fa-x"></i></a>  
                                        </td>
                                    </tr>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                <tr>
                                    <td colspan="4">Total </td>
                                    <td><?php echo e($purchases->sum('grand_total')); ?></td>
                                    <td><?php echo e($purchases->sum('paid_amount')); ?></td>
                                    <td></td>
                                </tr>
                                </tbody>
                            </table>
                            </div>
                            <div class="text-center">
                                <?php echo e($purchases->links()); ?>

                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- /page content -->
<?php $__env->stopSection(); ?>

<?php $__env->startPush('js'); ?>

   
    <script type="text/javascript">

    </script>
<?php $__env->stopPush(); ?>
<?php echo $__env->make('backend.layouts.master', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>