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

<?php $__env->startPush('css'); ?>
    <link  href="<?php echo e(asset('backend/plugins/datepicker/datepicker.css')); ?>" rel="stylesheet">
<?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>Factory Chalan 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('wastage.list')); ?>" id="searchForm" method="Get">
                                    <div class="col-sm-3">
                                        <select class="form-control" name="show" id="show">
                                            <option value="<?php echo e($wastages->count()); ?>"><?php echo e($wastages->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>
                                        </select>
                                    </div>
                                    <div class="col-sm-6"></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>Date</th>
                                        <th>Product</th>
                                        <th>Supplier</th>
                                        <th>Category</th>
                                        <th>Code</th>
                                        <th>PP</th>
                                        <th>Return Price</th>
                                        <th>Return Qty</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <?php $__currentLoopData = $wastages; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $i=>$pc): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <tr>
                                            <td> <?php echo e($i+1); ?></td>
                                            <td> <?php echo e(date('d-m-Y',strtotime($pc->return_date))); ?></td>
                                            <td><?php echo e($pc->product->product_name); ?> </td>
                                            <td><?php echo e($pc->supplier->name); ?> </td>
                                            <td><?php echo e($pc->category->name); ?> </td>
                                            <td> <?php echo e($pc->code); ?></td>
                                            <td><?php echo e($pc->purchase_price); ?> </td>
                                            <td> <?php echo e($pc->return_price); ?></td>
                                            <td> <?php echo e($pc->return_quantity); ?></td>
                                        </tr>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </tbody>
                                    <tfoot>
                                    <tr>
                                        <td colspan="6">Grand Total</td>
                                        <td><?php echo e($wastages->sum('purchase_price')); ?></td>
                                        <td><?php echo e($wastages->sum('return_price')); ?></td>
                                        <td><?php echo e($wastages->sum('return_quantity')); ?></td>
                                       
                                    </tr>
                                    </tfoot>
                                </table>
                            </div>
                            <div class="text-center">
                                <?php echo e($wastages->links()); ?>

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

    <script src="<?php echo e(asset('backend/plugins/datepicker/datepicker.js')); ?>"></script>
    <script type="text/javascript">
        $('[data-toggle="start"]').datepicker({
            format: 'yyyy-mm-dd'
        });

        $('[data-toggle="end"]').datepicker({
            format: 'yyyy-mm-dd'
        });
    </script>
<?php $__env->stopPush(); ?>
<?php echo $__env->make('backend.layouts.master', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>