
<?php $__env->startSection('title'); ?> Shop Profile | SHOP <?php $__env->stopSection(); ?>
<?php $__env->startSection('shop-profile'); ?> active <?php $__env->stopSection(); ?>
<?php $__env->startSection('styles'); ?>
<style>
    .custom-select2-form-due .select2-container--default .select2-selection--single .select2-selection__rendered{
        line-height: 31px;
    }
    .custom-select2-form-due .select2-container--default .select2-selection--single .select2-selection__arrow b{
        margin-top: 30px;
    }
</style>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('main_content_section'); ?>
<div class="container-fluid p-0">
    <div class=" d-flex align-items-center justify-content-between my-3">
        <div class="d-flex align-items-center">
            <h3 class="mb-0 pb-0">Shop Profile</h3>
        </div>
    </div>

    <div class="row">

        <?php echo $__env->make('admin.shop.profile.partials.sidebar', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?>

        <div class="col-md-9 mb-2">
            <div class="h-100 border-0">

                <div class="table_data rounded p-0">
                    <div class="card shadow">
                        <div class="card border-0">
                            <div class="row card-header aggregate-section-div">
                                <div class="">
                                    <div class=" d-flex justify-content-between align-items-center border-0">
                                        <div class="d-flex align-items-center">
                                            <h4 class="m-0">Service Invoice</h4>
                                        </div>
                                        <div class="d-sm-block">
                                            <a href="javascript:void(0)" class="btn btn-success rounded-0 d-flex align-items-center px-2 border-0"
                                                data-bs-toggle="modal" data-bs-target="#shopDuePayment">
                                                <i class=" fa fa-coins pr-2"></i>
                                                <span class="px-2">Due Pay</span>
                                            </a>
                                        </div>
                                    </div>
                                </div>
                            </div>


                            <div id="card_body_1" class="card-body">
                                <div class="">
                                    <section class="row">
                                        <div class="col-lg-12 table-responsive">
                                            <table class="table table-bordered table-striped">
                                                <thead>
                                                    <tr>
                                                        <th class="text-center" scope="col"><span>Invoice</span></th>
                                                        <th class="text-center" scope="col"><span>Payment Details</span></th>
                                                        <th class="text-center" scope="col"><span>Net</span></th>
                                                        <th class="text-center" scope="col"><span>Paid</span></th>
                                                        <th class="text-center" scope="col"><span>Due</span></th>
                                                        <th class="text-center" scope="col"><span>Status</span></th>
                                                    </tr>
                                                </thead>
                                                <tbody>

                                                    <?php $i = 1; ?>
                                                    <?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 class="text-center">
                                                            <b> #<?php echo e($item->id); ?></b>
                                                        </td>
                                                        <td>
                                                            <div class="row_title text-start">
                                                                <b>Month: </b><?php echo e($item->billGenerateData->bill_generated_month); ?><br>
                                                                <b>Year: </b><?php echo e($item->billGenerateData->bill_generated_year); ?>

                                                            </div>
                                                            <div class="row-actions text-start mt-2">
                                                                <?php if(Auth::user()->can('bill-generate-edit')): ?>
                                                    
                                                                <?php if($item->is_pay == false): ?>
                                                                <span><a class="text-primary fw-bolder" href="javascript:void(0)" onclick="shopBillPay(<?php echo e($item->id); ?>)">Bill
                                                                        Pay</a> | </span>
                                                                <?php endif; ?>
                                                    
                                                                <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-center">
                                                            <span class="text-primary fw-bolder"><?php echo e($item->net_amount); ?> tk</span>
                                                        </td>
                                                        <td class="text-center">
                                                            <span class="text-success fw-bolder"><?php echo e($item->paid_amount); ?> tk</span>
                                                        </td>
                                                        <td class="text-center">
                                                            <span class="text-danger fw-bolder"><?php echo e($item->due_amount); ?> tk</span>
                                                        </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($item->bill_generate_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-6 my-1">
                                                                                <div class="form-group custom-select2-form custom-select2-form-due">
                                                                                    <label for="payment_method<?php echo e($item->id); ?>" class="form-label mb-2 text-normal"> Paymnet Type <span
                                                                                            class=" text-danger">(required)</span>
                                                                                    </label>
                                                                                    <select name="payment_method" id="payment_method<?php echo e($item->id); ?>" class="form-select select2" required>
                                                                            
                                                                                        <?php $__currentLoopData = $paymentTypeData; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key=>$singlePaymentTyep): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                                                        <?php if(isset($singlePaymentTyep) && $singlePaymentTyep != null): ?>
                                                                                        <option value="<?php echo e($singlePaymentTyep); ?>" 
                                                                                        <?php echo e($singlePaymentTyep == 'Hand Cash' ? 'selected' : ''); ?>

                                                                                        >
                                                                                            <?php echo e($singlePaymentTyep); ?></option>
                                                                                        <?php endif; ?>
                                                                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                                                                    </select>
                                                                                </div>
                                                                            
                                                                                <?php $__errorArgs = ['payment_method'];
$__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="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($allShopBillCount) && $allShopBillCount > 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; ?>
                                    </section>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="table_data rounded mt-4 p-0">
                    <div class="card shadow">
                        <div class="card border-0">
                            <div class="row card-header aggregate-section-div">
                                <div class="">
                                    <div class=" d-flex justify-content-between align-items-center border-0">
                                        <div class="d-flex align-items-center">
                                            <h4 class="m-0">Shop Due Payment</h4>
                                        </div>
                                        <div class="d-none d-sm-block">
                                        </div>
                                    </div>
                
                                    <div class="mt-2 btn btn-success d-block rounded-0 d-sm-none">
                                    </div>
                                </div>
                            </div>
                            <div id="card_body_1" class="card-body">
                                <div class="">
                                    <div class="row">
                                        <div class="table-container table-responsive">
                                            <table id="" class="table table-bordered min-w-1150">
                                                <thead class="text-uppercase">
                                                    <tr class="me-3">
                                                        <th class="text-center" scope="col"><span>Created</span></th>
                                                        <th class="text-center" scope="col"><span>Payment Id</span></th>
                                                        <th class="text-center" scope="col"><span>Invoice Id</span></th>
                                                        <th class="text-center" scope="col"><span>Paid Amount</span></th>
                                                        <th class="text-center" scope="col"><span>Payment Method</span></th>
                                                    </tr>
                                                </thead>
                                                <tbody class="text-center">
                
                                                    <?php $__currentLoopData = $dueInvoiceData; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key=>$item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                    <?php if(isset($item) && $item != null): ?>
                                                    <tr class="">
                                                        <td class="custom-w-150 text-start">
                                                            <div class="row_title">
                                                                <b>Date: </b>
                                                                <?php echo e(Carbon\Carbon::parse($item->paid_date)->format('d-m-Y')); ?> <br>
                                                                <b>Time: </b>
                                                                <?php echo e(Carbon\Carbon::create($item->created_at->toTimeString())->format('h:i')); ?>

                                                            </div>
                                                            <div class="row-actions">
                                                                <?php if(Auth::user()->can('bill-generate-edit')): ?>
                                                                <span><a class="edit_class_modal border-0 bg-transparent text-primary custom-invoice-service-details-sub"
                                                                        href="<?php echo e(route('get-shop-due-payment-invoice', $item->id)); ?>">
                                                                        Invoice View
                                                                    </a></span>
                                                                <?php endif; ?>
                                                            </div>
                                                        </td>
                
                                                        <td>
                                                            <b>#<?php echo e($item->id); ?></b>
                                                        </td>
                
                                                        <td>
                                                            <b>#<?php echo e($item->shopBillData->id); ?></b>
                                                        </td>
                
                                                        <td>
                                                            <span class="fw-bolder text-success"><?php echo e($item->paid_amount); ?>tk</span>
                                                        </td>
                                                        <td>
                                                            <span class="fw-bolder text-info"><?php echo e($item->payment_method); ?></span>
                                                        </td>
                
                                                    </tr>
                
                                                    <?php endif; ?>
                                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                
                
                                                </tbody>
                                            </table>
                                        </div>
                
                                        <?php if(isset($dueInvoiceCount) && $dueInvoiceCount >= 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($dueInvoiceData->firstItem()); ?></span>
                                                    <?php echo e(__('to')); ?>

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

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

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

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

            </div>

        </div>
    </div>


    
    <div class="modal fade" id="shopDuePayment" tabindex="-1" 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">Service Due Payment</h1>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                
                <form action="<?php echo e(route('add-due-bill-payment-shop-wise')); ?>" method="post" enctype="multipart/form-data" 
                    onsubmit="return checkValidate()">
                    <?php echo csrf_field(); ?>
    
                    <input type="hidden" name="shop_id" value="<?php echo e($singleShopData->id); ?>">
                    <input type="hidden" name="total_net_amount" value="<?php echo e($totalNetPrice); ?>">
                    <input type="hidden" name="total_due_amount" id="totalDueAmount" value="<?php echo e($totalDuePrice); ?>">
                    <input type="hidden" name="total_paid_amount" id="totalPaidAmount" value="<?php echo e($totalPaidPrice); ?>">
                    <input type="hidden" name="total_change_amount" id="totalChangeAmount" value="0">
    
                    <div class="modal-body p-0">
                        <div class="row px-4 mt-4 mb-2">
                            <div class="col-12">
                                <div class="table-container table-responsive">
                                    <div class="table_wrap" id="serviceBillPaymentProduct">
                                        <table class="table table-bordered py-3">
                                            <thead>
                                                <tr>
                                                    <th scope="col" class="text-center"><strong>Items:</strong></th>
                                                    <th scope="col" class="text-center"><strong>Price:</strong></th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                                <tr>
                                                    <td class="text-no-wrap custom-payment-table-items"><strong>Total Due
                                                            Amount(TK):</strong>
                                                    </td>
                                                    <td class="text-no-wrap custom-payment-table-items px-3 text-center">
                                                        <span class="text-primary"><b><?php echo e($totalDuePrice); ?></b></span>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td class="text-no-wrap custom-payment-table-items"><strong>Current Paid
                                                            Amount(TK):</strong>
                                                    </td>
                                                    <td class="text-no-wrap custom-payment-table-items px-3 text-center">
                                                        <span class="text-success">
                                                            <b id="currentPaidAmountText">0</b>
                                                        </span>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td class="text-no-wrap custom-payment-table-items"><strong>Current Due
                                                            Amount(TK):</strong>
                                                    </td>
                                                    <td class="text-no-wrap custom-payment-table-items px-3 text-center">
                                                        <span class="text-danger">
                                                            <b id="finalDueAmountText"><?php echo e($totalDuePrice); ?></b>
                                                        </span>
                                                    </td>
                                                </tr>
                                            </tbody>
    
                                        </table>
                                    </div>
                                </div>
                            </div>
                        </div>
    
                        <div class="row px-4 mb-4">
                            <div class="col-md-6 mb-2">
                                <div class="form-group custom-select2-form">
                                    <label for="payment_method" class="custom-payment-form-label"> Paymnet Type <span
                                            class=" text-danger">(required)</span>
                                    </label>
                                    <select name="payment_method" id="payment_method" class="form-select select2" required>
    
                                        <?php $__currentLoopData = $paymentTypeData; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key=>$singlePaymentTyep): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <?php if(isset($singlePaymentTyep) && $singlePaymentTyep != null): ?>
                                        <option value="<?php echo e($singlePaymentTyep); ?>"
                                            <?php echo e($singlePaymentTyep == 'Hand Cash' ? 'selected' : ''); ?>>
                                            <?php echo e($singlePaymentTyep); ?></option>
                                        <?php endif; ?>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </select>
                                </div>
    
                                <?php $__errorArgs = ['payment_method'];
$__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-2">
                                <label for="duePaymentAmount" class="custom-payment-form-label">Paid Amount<span
                                        class=" text-danger">(required)</span></label>
                                <input type="number" class="form-control" id="duePaymentAmount"
                                    placeholder="Enter Payment Amount" name="paid_amount" step="0.01" value="0"
                                    onblur="updateDuePayAmount()" 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-12 mb-4">
                                <label for="payment_note" class="custom-payment-form-label">Payment Note</label>
                                <textarea class="form-control form-control-solid" name="payment_note" id="payment_note"
                                    cols="5" rows="3" placeholder="Enter Note (Optional)"></textarea>

                                <?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>
                            <!--begin::Col-->
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="submit" class="btn btn-success" <?php echo e($totalDuePrice > 0 ? '' : 'disabled'); ?>>Submit Payment</button>
                        <button type="button" class="btn btn-danger" data-bs-dismiss="modal">Cancel</button>
                    </div>
                </form>
            </div>
        </div>
    </div>

</div>

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


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

<script>
    $(document).ready(function(){
        $("#floor_id").select2({
        dropdownParent: $('#editShop')
        });
        $("#business_type_id").select2({
        dropdownParent: $('#editShop')
        });
        $("#service_charge_id").select2({
        dropdownParent: $('#editShop')
        });
        $("#shop_owner_id").select2({
        dropdownParent: $('#editShop')
        });
        $("#shop_keeper_id").select2({
        dropdownParent: $('#editShop')
        });
        $("#payment_method").select2({
        dropdownParent: $('#shopDuePayment')
        });
    });
</script>

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

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

        var mobileNumber = $("#customer_mobile_2").val();

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

        return true;
    }


    function checkValidate() {
        var mobileNumber = $("#mobile_1").val();

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

        var mobileNumber = $("#mobile_2").val();

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

        return true;
    }


    //For image preview...
    function PreviewImageFP(selectFile, previewImg) {
        var oFReader = new FileReader();
        oFReader.readAsDataURL(document.getElementById(selectFile).files[0]);

        oFReader.onload = function (oFREvent) {
            document.getElementById(previewImg).src = oFREvent.target.result;
        };
    }

    function cancelPreviewFP(selectFile, previewImg) {
        const img = document.getElementById(previewImg);
        img.src = window.location.origin + "/backend/template-assets/images/img_preview.png";
        $("#" + selectFile).val('');
    }

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

        $("#payment_method"+id).select2({
            dropdownParent: $('#shopBillPay'+id)
        });
    }

    //For update...
    function checkValidate(id) {
        var paymentAmount = $("#duePaymentAmount").val();
        
        if (paymentAmount <= 0) { 
            event.preventDefault();
        }

        return true;
    }
    
    //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;
        }
    }

    //To calculate payment amount...
    function updateDuePayAmount() {
        let totalProductPrice = parseFloat(<?php echo e($totalNetPrice); ?>);
        let paymentAmount = parseFloat($("#duePaymentAmount").val());
        let totalPaidAmount = parseFloat($("#totalPaidAmount").val());
        let totalDueAmount = parseFloat($("#totalDueAmount").val());
        

        if(paymentAmount < 0){ 
            toastr.error('Sorry, Negative number not applicable.!'); 
            $("#duePaymentAmount").val(0);
            event.preventDefault();
        }else{
            if (paymentAmount > 0) {
                let grandTotalPaidAmount = totalPaidAmount+paymentAmount;
                let finalAmount = totalDueAmount-paymentAmount;
                $("#currentPaidAmountText").text(paymentAmount);
                if(finalAmount >= 0){
                    if(finalAmount == 0){
                        $("#finalDueAmountText").text('0');
                    }else{
                        $("#finalDueAmountText").text(finalAmount);
                    }
                }else{
                    let changeAmount = Math.abs(finalAmount);
                    $("#finalDueAmountText").text('0');
                }
            }else{
                toastr.error('Sorry, You can not submit with payment amount 0.!');
                event.preventDefault();
            }
        }
    }
    

</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/shop/profile/shopDetails.blade.php ENDPATH**/ ?>