<?php $__env->startSection('section-title', 'Return Sale'); ?>
<?php $__env->startSection('page-title', 'Return Sale List'); ?>
<?php $__env->startPush('css'); ?>
<style>
    @media print {
        @page {
        size: auto;
        }

        body {
            width: 100%;
            height: 100%;
            margin: 0;
            padding: 0;
            font-family: Roboto,sans-serif;
        }

        .print_area {
            position: absolute;
            top: 0;
            width: 100%;
        }

        .print_area * {
            visibility: visible !important;
        }
    }
</style>
<?php $__env->stopPush(); ?>
<?php $__env->startSection('content'); ?>
    <div class="row">
        <div class="col-lg-12">
            <div class="card card-body mb-2 card_style" style="margin-top: -3px" id="h-hide">
                <form action="<?php echo e(route('return.sale')); ?>">
                    <div class="form-row">
                        <div class="form-group col-md-4">
                            <select class="select2" name="customer_id">
                                <option selected value="">Select Customer</option>
                                <?php $__currentLoopData = $customers; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $customer): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <option value="<?php echo e($customer->id); ?>" <?php echo e(($customer->id == $customer_id)?'selected': ''); ?>><?php echo e($customer->name); ?></option>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </select>
                        </div>
                        <div class="form-group col-md-4">
                            <input type="date" name="startDate" class="form-control" value="<?php echo e($startDate); ?>">
                        </div>
                        <div class="form-group col-md-4">
                            <input type="date" name="endDate" class="form-control" value="<?php echo e($endDate); ?>">
                        </div>
                    </div>
                    <div class="form-row mt-2">
                        <div class="form-group col-12">
                            <button class="btn add_list_btn" type="submit">
                                    <i class="fa fa-sliders"></i> Filter
                            </button>
                            <a href="<?php echo e(route('return.sale')); ?>" class="btn add_list_btn_reset">Reset</a>
                            <a href="" class="btn add_list_btn float-right" onclick="window.print()">Print</a>
                        </div>
                    </div>
                </form>
            </div>
            <div class="card m-b-30 card_style" style="margin-top: -35px">
                <div class="card-body">
                    <div class="table-responsive">
                        <table id="datatable-buttons" class="table table-striped">
                            <thead class="header_bg">
                                <tr>
                                    <th class="header_style_left">#SL</th>
                                    <th>Date</th>
                                    <th>Invoice No</th>
                                    <th>Product</th>
                                    
                                    <th>Biller</th>
                                    <th>Customer</th>
                                    <th>Price</th>
                                    
                                    <th class="header_style_right">Action</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php
                                    $total_amt = 0;
                                ?>
                                <?php $__empty_1 = true; $__currentLoopData = $returns; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key=> $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); $__empty_1 = false; ?>
                                    <?php
                                        $returnItems = App\Models\ReturnItem::where('return_id',$item->id)->get();
                                        $date = date_create($item->date);
                                        $total_amt += $item->total_return;
                                    ?>
                                    <tr>
                                        <td class="table_data_style_left"><?php echo e($key+1); ?></td>
                                        <td><?php echo e(date('Y-m-d',strtotime($item->date))); ?></td>
                                        <td><?php echo e($item->invoice?->invoice_no); ?></td>
                                        
                                        <td>
                                            <?php $__currentLoopData = $returnItems; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $rtnItem): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <ul>
                                                    <li>
                                                        <?php if($rtnItem->product->unit->related_unit == null): ?>
                                                            <?php echo e($rtnItem->product->name); ?> (<?php echo e($rtnItem->main_qty); ?> <?php echo e($rtnItem->product->unit->name); ?>) <br>
                                                        <?php else: ?>
                                                            <?php echo e($rtnItem->product->name); ?>

                                                            (
                                                                <?php echo e($rtnItem->main_qty); ?> <?php echo e($rtnItem->product->unit->name); ?> -
                                                                <?php echo e($rtnItem->sub_qty); ?> <?php echo e($rtnItem->product->unit->related_unit->name); ?>

                                                            ) <br>
                                                        <?php endif; ?>
                                                    </li>
                                                </ul>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                        </td>
                                        
                                        <td><?php echo e($item->user?->name); ?></td>
                                        <td><?php echo e($item->customer?->name); ?></td>
                                        
                                        <td><?php echo e($item->total_return); ?></td>
                                        <td class="table_data_style_right">
                                            <div class="dropdown">
                                                <button class="btn add_list_btn btn-sm dropdown-toggle" type="button"
                                                    id="dropdownMenuButton" data-toggle="dropdown">
                                                    Action
                                                </button>
                                                <div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
                                                    
                                                    <?php if(check_permission('return.delete')): ?>
                                                        <a class="dropdown-item text-danger" href="#" data-toggle="modal"
                                                            data-target="#deleteModal-<?php echo e($item->id); ?>">
                                                            <i class="feather icon-trash"></i> Delete
                                                        </a>
                                                    <?php endif; ?>
                                                </div>
                                            </div>
                                            
                                            <form action="<?php echo e(route('return.delete', $item->id)); ?>" method="GET">
                                                <?php echo csrf_field(); ?>
                                                <?php if (isset($component)) { $__componentOriginal37b7f052626c638ba0443fdb400d6f57 = $component; } ?>
<?php if (isset($attributes)) { $__attributesOriginal37b7f052626c638ba0443fdb400d6f57 = $attributes; } ?>
<?php $component = App\View\Components\DeleteModal::resolve([] + (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag ? (array) $attributes->getIterator() : [])); ?>
<?php $component->withName('delete-modal'); ?>
<?php if ($component->shouldRender()): ?>
<?php $__env->startComponent($component->resolveView(), $component->data()); ?>
<?php if (isset($attributes) && $attributes instanceof Illuminate\View\ComponentAttributeBag && $constructor = (new ReflectionClass(App\View\Components\DeleteModal::class))->getConstructor()): ?>
<?php $attributes = $attributes->except(collect($constructor->getParameters())->map->getName()->all()); ?>
<?php endif; ?>
<?php $component->withAttributes(['title' => 'Return','id' => ''.e($item->id).'']); ?>
<?php echo $__env->renderComponent(); ?>
<?php endif; ?>
<?php if (isset($__attributesOriginal37b7f052626c638ba0443fdb400d6f57)): ?>
<?php $attributes = $__attributesOriginal37b7f052626c638ba0443fdb400d6f57; ?>
<?php unset($__attributesOriginal37b7f052626c638ba0443fdb400d6f57); ?>
<?php endif; ?>
<?php if (isset($__componentOriginal37b7f052626c638ba0443fdb400d6f57)): ?>
<?php $component = $__componentOriginal37b7f052626c638ba0443fdb400d6f57; ?>
<?php unset($__componentOriginal37b7f052626c638ba0443fdb400d6f57); ?>
<?php endif; ?>
                                            </form>
                                        </td>
                                    </tr>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); if ($__empty_1): ?>
                                    <tr>
                                        <td colspan="100%" class="text-center text-danger no_data_style">No Data Available</td>
                                    </tr>
                                <?php endif; ?>
                            </tbody>
                            <tfoot>
                                <tr class="text-white text-right footer_style"  style=" font-size: 20px; font-width: 700; font-family:sans-serif">
                                    <td colspan="6" class="table_data_style_left text-white"><strong>Total: </strong></td>
                                    <td colspan="2" class="text-white"> <strong><?php echo e(number_format($total_amt,2)); ?> TK</strong></td>
                                    <td colspan="" class="table_data_style_right"></td>
                                </tr>
                            </tfoot>
                        </table>
                        
                    </div>
                </div>
            </div>
        </div>
    </div>
<?php $__env->stopSection(); ?>

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

<?php echo $__env->make('backend.layouts.master', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/fastitco/nvs.fastit.com.bd/resources/views/backend/pages/return/sale/index.blade.php ENDPATH**/ ?>