
<?php $__env->startSection('title'); ?> Shop Wise Report | Bus Ticket <?php $__env->stopSection(); ?>
<?php $__env->startSection('shop-wise-invoice-report'); ?> active <?php $__env->stopSection(); ?>
<?php $__env->startSection('shop-wise-invoice-report'); ?> active <?php $__env->stopSection(); ?>
<?php $__env->startSection('styles'); ?>
<?php $__env->stopSection(); ?>


<?php $__env->startSection('main_content_section'); ?>
<div class="row py-3 ps-2">
    <div class="heading d-flex justify-content-start align-items-center">
        <h3 class="mb-0"><span> Shop Wise Report List</span></h3>
    </div>
</div>

<div class="card">
    <div class="card-body">
        <form action="<?php echo e(route('shop-wise-invoice-report')); ?>" method="post" enctype="multipart/form-data">
            <?php echo csrf_field(); ?>
            <div class="col-md-12">
                <div class="row">
                    <div class="col-md-6 mb-3">
                        <div class="form-group custom-select2-form">
                            <label for="year"> Year <span class=" text-danger">(required)</span>
                            </label>
                            <select name="year" id="year" class="form-select select2" required>
                                <option value="" selected disabled>Select Year</option>

                                <?php $__currentLoopData = $getAllYears; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key=>$singleYear): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <?php if(isset($singleYear) && $singleYear != null): ?>
                                <option value="<?php echo e($singleYear); ?>" <?php echo e($singleYear == $currentYear ? 'selected' : ''); ?>>
                                    <?php echo e($singleYear); ?></option>
                                <?php endif; ?>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </select>
                        </div>

                        <?php $__errorArgs = ['year'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                        <span class=text-danger><?php echo e($message); ?></span>
                        <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                    </div>

                    
                    
                    <div class="col-md-6 mb-3">
                        <div class="form-group custom-select2-form">
                            <label for="shop_id"> Shop <span class=" text-danger">(required)</span>
                            </label>
                            <select name="shop_id" id="shop_id" class="form-select select2" required>
                                <option value="" selected disabled>Select Shop</option>
                                <?php $__currentLoopData = $shopData; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key=>$singleSD): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <?php if(isset($singleSD) && $singleSD != null): ?>
                                <option value="<?php echo e($singleSD->id); ?>" <?php echo e($singleSD->id == $selectedShopData->id ? 'selected' : ''); ?>>
                                    <?php echo e($singleSD->shop_name); ?></option>
                                <?php endif; ?>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </select>
                        </div>

                        <?php $__errorArgs = ['shop_id'];
$__bag = $errors->getBag($__errorArgs[1] ?? 'default');
if ($__bag->has($__errorArgs[0])) :
if (isset($message)) { $__messageOriginal = $message; }
$message = $__bag->first($__errorArgs[0]); ?>
                        <span class=text-danger><?php echo e($message); ?></span>
                        <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
                    </div>

                    <div class="col-md-12">
                        <button type="submit" class="btn btn btn-primary m-0 py-2 d-flex custom-float-right-side">
                            <i class="material-symbols-outlined custom-project-icon">
                                tune
                            </i>
                            <span>
                                Search
                            </span>
                        </button>
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>

<div class="table_wrapper py-1 card mt-4">
    <div class="row my-2 aggregate-section-div">
        <div class="px-3 ">
            <div class=" d-flex justify-content-between align-items-center aggregate-section border">
                <div class="d-flex align-items-center">
                    <p class="mb-0"><a href="<?php echo e(route('shop-wise-invoice-report')); ?>"
                            class="text-primary py-2 px-3 active">All(<?php echo e($totalShopBillCount); ?>)</a>
                    </p>
                </div>
                <div class="d-sm-block">
                    <?php if(Auth::user()->can('shop-invoice-report-access')): ?>
                    <?php if(isset($selectedShopData) && $selectedShopData != null): ?>
                    <a href="<?php echo e(route('print-shop-wise-invoice-report', ['year'=>$currentYear,'shop_id'=>$selectedShopData->id])); ?>"
                        class="btn btn-success rounded-0 d-flex align-items-center px-2 border-0" target="_blank">
                        <span class="">
                            <i class="fa fa-print"></i>
                            Print Report</span>
                    </a>
                    
                    <?php else: ?>
                    <a href="javascript:void(0)"
                        class="btn btn-success rounded-0 d-flex align-items-center px-2 border-0" onclick="checkShopData()">
                        <span class="">
                            <i class="fa fa-print"></i>
                            Print Report</span>
                    </a>
                    <?php endif; ?>
                    <?php endif; ?>
                </div>
            </div>
        </div>
    </div>



    <div class="row px-3">
        <div class="table-container table-responsive">
            <table id="" class="table table-bordered">
                <thead class="text-uppercase">
                    <tr class="me-3">
                        <th class="text-center" scope="col"><span>Serial</span></th>
                        <th class="text-center" scope="col"><span>Month Name</span></th>
                        <th class="text-center" scope="col"><span>Net Amount</span></th>
                        <th class="text-center" scope="col"><span>Paid Amount</span></th>
                        <th class="text-center" scope="col"><span>Due Amount</span></th>
                        <th class="text-center" scope="col"><span>Bill Generate</span></th>
                    </tr>
                </thead>
                <tbody class="text-center">

                    <?php $__currentLoopData = $shopBillData; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key=>$item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <?php if(isset($item) && $item != null): ?>
                    <tr class="">

                        <td>
                            <div class="row_title">
                                <b> #<?php echo e($key+1); ?></b>
                            </div>
                            <div class="row-actions mt-2">
                            </div>
                        </td>

                        <td>
                            <?php echo e($item->billGenerateData->bill_generated_month); ?>

                        </td>

                        <td>
                            <span class="fw-normal"><?php echo e($item->net_amount); ?>tk</span>
                        </td>
                        
                        <td>
                            <span class="fw-normal"><?php echo e($item->paid_amount); ?>tk</span>
                        </td>
                        
                        <td>
                            <span class="fw-normal"><?php echo e($item->due_amount); ?>tk</span>
                        </td>

                        <td>
                            <?php echo e(Carbon\Carbon::parse($item->created_at->toDateString())->format('d-m-Y')); ?>

                        </td>

                    </tr>

                    <?php endif; ?>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>


                </tbody>
                <tfoot class="">
                    <tr class="custom-invoice-table-footer text-center custom-report-table-footer">
                        <th>Total</th>
                        <th>=</th>
                        <th class="fw-bold text-primary"><?php echo e($totalNetAmount); ?>tk</th>
                        <th class="fw-bold text-success"><?php echo e($totalPaidAmount); ?>tk</th>
                        <th class="fw-bold text-danger"><?php echo e($totalDueAmount); ?>tk</th>
                        <th></th>
                    </tr>
                </tfoot>
            </table>
        </div>

        <?php if(isset($shopBillData) && $totalShopBillCount > 10): ?>
        <div class="clearfix d-flex">
            <div class="float-left">
                <p class="text-muted">
                    <?php echo e(__('Showing')); ?>

                    <span class="font-weight-bold"><?php echo e($shopBillData->firstItem()); ?></span>
                    <?php echo e(__('to')); ?>

                    <span class="font-weight-bold"><?php echo e($shopBillData->lastItem()); ?></span>
                    <?php echo e(__('of')); ?>

                    <span class="font-weight-bold"><?php echo e($shopBillData->total()); ?></span>
                    <?php echo e(__('results')); ?>

                </p>
            </div>

            <div class="float-right custom-table-pagination">
                <?php echo $shopBillData->links('pagination::bootstrap-4'); ?>

            </div>
        </div>
        <?php endif; ?>
    </div>
</div>

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

<?php $__env->startSection('scripts'); ?>
<script>
    $(document).ready(function(){
        $("#year").select2();
        $("#month").select2();
        $("#shop_id").select2();
    });

    function checkShopData() {
        toastr.error('Sorry, You  have no data.!');
    }
</script>
<?php $__env->stopSection(); ?>
<?php echo $__env->make('admin.master', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH E:\Project\Personal-Project\Office-Project\Next-Web-Service\muktijoddhe-somobai-somity\resources\views/admin/reports/shopInvoiceReport/shopWiseReportList.blade.php ENDPATH**/ ?>