
<?php $__env->startSection('title'); ?> Paid Invoice | BDIDEA <?php $__env->stopSection(); ?>
<?php $__env->startSection('paid-bill-invoice-list'); ?> active <?php $__env->stopSection(); ?>
<?php $__env->startSection('paid-bill-invoice-list'); ?> 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> Paid Invoice List</span></h3>
    </div>
</div>

<div class="table_wrapper py-1 card">
    <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('paid-bill-invoice-list')); ?>"
                            class="text-primary py-2 px-3 active">All(<?php echo e($paidInvoiceCount); ?>)</a>
                    </p>
                </div>
                <div class="d-none d-sm-block">
                    <?php if(Auth::user()->can('billing-create')): ?>
                    <a href="javascript:void(0)"
                        class="btn btn-success rounded-0 d-flex align-items-center px-2 border-0"><span class="">Paid
                            List</span></a>
                    <?php endif; ?>
                </div>
            </div>

            <?php if(Auth::user()->can('billing-create')): ?>
            <div class="mt-2 btn btn-success d-block rounded-0 d-sm-none">
                Paid List</div>
            <?php endif; ?>
        </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>Invoice ID</span></th>
                        <th class="text-center" scope="col"><span>Client Name</span></th>
                        <th class="text-center" scope="col"><span>Payment Method</span></th>
                        <th class="text-center" scope="col"><span>Billing Date</span></th>
                        <th class="text-center" scope="col"><span>Status</span></th>
                    </tr>
                </thead>
                <tbody class="text-center">

                    <?php $__currentLoopData = $paidInvoiceData; $__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($item->id); ?></b>
                            </div>
                            <div class="row-actions mt-2">
                                <?php if(Auth::user()->can('billing-edit')): ?>
                                <span><button
                                        class="edit_class_modal border-0 bg-transparent text-success custom-invoice-service-details-sub"
                                        onclick="invoiceServiceList(<?php echo e($item->id); ?>)"> Invoice
                                        Details </button></span>
                                <?php endif; ?>
                            </div>
                        </td>

                        <td>
                            <a href="#" class="text-primary"><?php echo e($item->clientData->client_name); ?></a>
                        </td>
                        <td><?php echo e($item->paymentTypeData->payment_type_name); ?></td>
                        <td><b>Date: </b> <?php echo e(Carbon\Carbon::parse($item->billing_date)->format('d-m-Y')); ?></td>

                        <td>
                            <?php if($item->is_bill_pay == true): ?>
                            <span class="badge bg-success">Paid Up</span>
                            <?php else: ?>
                            <span class="badge bg-danger">Paid Down</span>
                            <?php endif; ?>
                        </td>

                    </tr>

                    
                    <div class="modal fade" id="invoiceServiceList<?php echo e($item->id); ?>" tabindex="-1"
                        aria-labelledby="oneInputModalLabel" aria-hidden="true">
                        <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">Invoice Service List</h1>
                                    <button type="button" class="btn-close" data-bs-dismiss="modal"
                                        aria-label="Close"></button>
                                </div>
                                <div class="modal-body p-0" id="updateBillingServiceDetails<?php echo e($item->id); ?>">
                                    
                                </div>
                                <div class="modal-footer">
                                    <button type="button" class="btn btn-danger"
                                        data-bs-dismiss="modal">Close</button>
                                </div>
                            </div>
                        </div>
                    </div>

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


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

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

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

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

                </p>
            </div>

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

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

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

<?php $__env->startSection('scripts'); ?>

<script>
    function checkValidate() {
        var mobileNumber = $("#client_mobile").val();

        if (mobileNumber != '' && mobileNumber.length != 11) { 
            event.preventDefault();
            toastr.error("Mobile number must be 11 digit."); 
        }

        return true;
    }
    
    //For update...
    function checkValidateForUpdate(id) {
        var mobileNumber = $("#client_mobile"+id).val();

        if (mobileNumber != '' && mobileNumber.length != 11) { 
            event.preventDefault();
            toastr.error("Mobile number must be 11 digit."); 
        }

        return true;
    }

    //To show update modal...
    function invoiceServiceList(id) {
        var url = "<?php echo e(route('get-billing-product-details-with-id')); ?>";
        if (id != '') {
            $.ajaxSetup({
                headers: {
                    'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                }
            });
            $.ajax({
                type: 'post',
                url: url,
                data: {
                    billing_id: id,
                },
                success: function (data) {
                    if(data.error){
                        toastr.error(data.error);
                    }else{
                        $("#invoiceServiceList"+id).modal('show');
                        $("#updateBillingServiceDetails"+id).html(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\update\skin-care\resources\views/admin/billingInvoice/paidBillInvoiceList.blade.php ENDPATH**/ ?>