
<?php $__env->startSection('title'); ?> Bill Shop List | SHOP <?php $__env->stopSection(); ?>
<?php $__env->startSection('bill-generate-details'); ?> active <?php $__env->stopSection(); ?>
<?php $__env->startSection('bill-generate-details'); ?> 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> Bill Shop List</span></h3>
    </div>
</div>

<div class="card">
    <div class="card-body">
        <div class="col-md-12">
            <div class="d-sm-flex justify-content-between">
                <div class="mb-0 text-start">
                    <div class="bill-generate-details-block">
                        <p class="mb-0">Invoice: <b>#<?php echo e($singleBillGenerateData->billing_id); ?></b></p>
                        <p class="mb-0">Shop Qty: <b>#<?php echo e($singleBillGenerateData->total_shop_qty); ?></b></p>
                        <p class="mb-0">Shop Size: <b>#<?php echo e($singleBillGenerateData->total_shop_size); ?></b></p>
                    </div>
                </div>

                <div class="mb-0 text-start">
                    <div class="bill-generate-details-block">
                        <p class="mb-0">Total Amount: <b><?php echo e($singleBillGenerateData->net_amount); ?> tk</b></p>
                        <p class="mb-0">Total Paid: <b><?php echo e($singleBillGenerateData->paid_amount); ?> tk</b></p>
                        <p class="mb-0">Total Due: <b><?php echo e($singleBillGenerateData->due_amount); ?> tk</b></p>
                    </div>
                </div>
                
                <div class="mb-0 text-start">
                    <div class="bill-generate-details-block">
                        <p class="mb-0">Date: <b><?php echo e(Carbon\Carbon::parse($singleBillGenerateData->bill_generated_date)->format('d-m-Y')); ?></b></p>
                        <p class="mb-0">Month: <b><?php echo e($singleBillGenerateData->bill_generated_month); ?></b></p>
                        <p class="mb-0">Year: <b><?php echo e($singleBillGenerateData->bill_generated_year); ?></b></p>
                    </div>
                </div>
            </div>
        </div>
    </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('bill-generate-details', $singleBillGenerateData->id)); ?>"
                            class="text-primary py-2 px-3 active">All(<?php echo e($allBillGenerateShopCount); ?>)</a>
                    </p>
                </div>
                <div class="d-sm-block">
                    <?php if(Auth::user()->can('bill-generate-list')): ?>
                    <a href="#" class="btn btn-success rounded-0 d-flex align-items-center px-2 border-0">
                        <span class="">Shop List</span>
                    </a>
                    <?php endif; ?>
                </div>
            </div>
        </div>
    </div>



    <div class="row px-3">
        <div class="table-container table-responsive">
            <table id="shopBillTable" class="table table-bordered table-striped w-100">
                <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>Shop Details</span></th>
                        <th class="text-center" scope="col"><span>Amount Details</span></th>
                        <th class="text-center" scope="col"><span>Status</span></th>
                    </tr>
                </thead>
                <tbody class="text-center">

                    <?php $__currentLoopData = $billGenerateShopData; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key=>$item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                    <?php if(isset($item) && $item != null): ?>
                    <tr class="">
                        <td>
                            <b> <?php echo e($key+1); ?></b>
                        </td>
                        <td>
                            <div class="row_title text-start">
                                <b>Shop Id: </b>#<?php echo e($item->shopData->shop_no); ?><br>
                                <b>Shop Name: </b><?php echo e($item->shopData->shop_name); ?><br>
                                <b>Shop Size: </b><?php echo e($item->shop_size); ?> SF<br>
                            </div>
                            <div class="row-actions text-start mt-2">
                                <?php if(Auth::user()->can('bill-generate-edit')): ?>

                                <?php if($item->is_pay == false): ?>
                                
                                <?php endif; ?>
                                
                                <span><a class="text-primary fw-bolder" href="<?php echo e(route('shop-profile', $item->shop_id)); ?>">Shop Profile</a> | </span>

                                <span> <a class="text-success fw-bolder" 
                                    href="<?php echo e(route('shop-payment-invoice', $item->id)); ?>">Invoice View</a></span>
                                <?php endif; ?>
                            </div>
                        </td>
                        
                        <td class="text-start w-25">
                            <b>Charge Amount: </b><?php echo e($item->shop_service_charge); ?> tk<br>
                            <b>Net Amount: </b><?php echo e($item->net_amount); ?> tk<br>
                            <b>Paid Amount: </b><?php echo e($item->paid_amount); ?> tk<br>
                            <b>Due Amount: </b><?php echo e($item->due_amount); ?> tk<br>
                        </td>

                        <td class="text-center">
                            <?php if($item->is_pay == true): ?>
                            <span class="badge bg-success">Paidup</span>
                            <?php else: ?>
                            <span class="badge bg-warning">Unpaid</span>
                            <?php endif; ?>
                        </td>

                    </tr>

                    
                    <div class="modal fade" id="shopBillPay<?php echo e($item->id); ?>" tabindex="-1" aria-labelledby="oneInputModalLabel"
                        aria-hidden="true" data-bs-backdrop="static">
                        <div class="modal-dialog modal-dialog-centered max-width-900px">
                            <div class="modal-content">
                                <div class="modal-header">
                                    <h1 class="modal-title fs-5" id="oneInputModalLabel">Shop Bill Payment</h1>
                                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                                </div>
                                <div class="modal-body p-0">
                                    <form action="<?php echo e(route('add-shop-payment', $item->id)); ?>" method="post" enctype="multipart/form-data"
                                        onsubmit="return checkValidateForUpdate(<?php echo e($item->id); ?>)">
                                        <?php echo csrf_field(); ?>
                                        <input type="hidden" value="<?php echo e($singleBillGenerateData->id); ?>" name="bill_generate_id">
                                        <input type="hidden" value="<?php echo e($item->id); ?>" name="shop_bill_id">
                                        <input type="hidden" value="<?php echo e($item->shop_id); ?>" name="shop_id">
                                        <div class="row px-4">
                    
                                            <div class=" col-md-6 my-1">
                                                <label for="shop_size" class="form-label mb-2">Shop Size(SF) <span
                                                        class="text-danger">(required)</span></label>
                                                <input type="number" class="form-control  form-control-solid custom-readonly-color" name="shop_size"
                                                    id="shop_size" placeholder="Shop Size" value="<?php echo e($item->shop_size); ?>" readonly required>
                    
                                                <?php $__errorArgs = ['shop_size'];
$__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 my-1">
                                                <label for="shop_service_charge" class="form-label mb-2">Charge Amount (Per SF) <span
                                                        class="text-danger">(required)</span></label>
                                                <input type="number" class="form-control  form-control-solid custom-readonly-color" name="shop_service_charge"
                                                    id="shop_service_charge" placeholder="Shop Size" value="<?php echo e($item->shop_service_charge); ?>" readonly required>
                    
                                                <?php $__errorArgs = ['shop_service_charge'];
$__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 my-1">
                                                <label for="net_amount" class="form-label mb-2">Net Amount <span
                                                        class="text-danger">(required)</span></label>
                                                <input type="number" class="form-control  form-control-solid custom-readonly-color" name="net_amount"
                                                    id="net_amount" placeholder="Shop Size" value="<?php echo e($item->net_amount); ?>" readonly required>
                    
                                                <?php $__errorArgs = ['net_amount'];
$__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 my-1">
                                                <label for="due_amount" class="form-label mb-2">Due Amount <span
                                                        class="text-danger">(required)</span></label>
                                                <input type="number" class="form-control  form-control-solid custom-readonly-color" name="due_amount"
                                                    id="due_amount" placeholder="Shop Size" value="<?php echo e($item->due_amount); ?>" readonly required>
                    
                                                <?php $__errorArgs = ['due_amount'];
$__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 my-1">
                                                <label for="paid_amount" class="form-label mb-2">Paid Amount <span
                                                        class="text-danger">(required)</span></label>
                                                <input type="number" class="form-control  form-control-solid" name="paid_amount"
                                                    id="paid_amount<?php echo e($item->id); ?>" placeholder="Shop Size" value="0.00" required>
                    
                                                <?php $__errorArgs = ['paid_amount'];
$__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 my-1">
                                                <div class="form-group">
                                                    <label for="payment_note">Payment Note<span class="text-danger"></span>
                                                    </label>
                                            
                                                    <textarea name="payment_note" id="payment_note" cols="3" rows="3" placeholder="Note"
                                                        class="form-control form-control-solid"></textarea>
                                                </div>
                                            
                                                <?php $__errorArgs = ['payment_note'];
$__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>
                                        <div class="modal-footer">
                                            <div class="">
                                                <button type="submit" class="btn btn-success"
                                                <?php echo e($item->is_pay == true ? 'disabled' : ''); ?>

                                                >Add Payment</button>
                                                <button type="button" class="btn btn-danger" data-bs-dismiss="modal">Cancel</button>
                                            </div>
                                        </div>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </div>
          
                    <?php endif; ?>
                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>


                </tbody>
            </table>
        </div>

        <?php if(isset($allBillGenerateShopCount) && $allBillGenerateShopCount > 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($billGenerateShopData->firstItem()); ?></span>
                    <?php echo e(__('to')); ?>

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

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

                </p>
            </div>

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

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

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

<?php $__env->startSection('scripts'); ?>
<script>
    $(document).ready(function(){
        $('#shopBillTable').DataTable({
        scrollX: true,
        });
    });

    //To show shopBillPay modal...
    function shopBillPay(id) {
      $("#shopBillPay"+id).modal('show');
    }

    //For update...
    function checkValidateForUpdate(id) {
        var paidAmount = $("#paid_amount"+id).val();
        if(paidAmount > 0){
            return true;
        }else{
            event.preventDefault();
            toastr.error('Sorry, Paid Amount Must Be Greter Than 0.!')
            return true;
        }
    }
</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/billGenerate/billGenerateDetails.blade.php ENDPATH**/ ?>