<div class="card pa payment_method_card_wrapper">
    <div class="form-row">
        <div id="accordion" class="col-12">
            <div class="card">
                <div id="collapseTwo" class="collapse show"
                    aria-labelledby="headingTwo" data-parent="#accordion">
                    <div class="card-body">
                        <input type="hidden" name="payment_method" id="payment_method" value="cod">
                        <?php if(setting('g_cod') == 'true'): ?>
                            <label for="cod" class="payment_method_label hover:bg-gray-300 dark:bg-gray-900 dark:text-indigo-300 border-x border-t dark:border border-gray-300  dark:border-indigo-300 cursor-pointer">
                                <input type="radio" name="pay_with"
                                    class="payment_method" value="Cash on Delivery"
                                    id="cod" checked>
                                <img src="<?php echo e(asset('/')); ?>icon/delivery-man.png">
                                Cash on delivery
                            </label>
                        <?php endif; ?>
                        <?php if(auth()->guard()->check()): ?>
                        <?php if(setting('g_wallate')=='true'): ?>
                        <label for="wallate" class="payment_method_label hover:bg-gray-300 dark:bg-gray-900 dark:text-indigo-300 border-x border-t dark:border border-gray-300  dark:border-indigo-300 cursor-pointer">
                            <input type="radio" name="pay_with"
                                class="payment_method" value="wallate" id="wallate">
                            <img src="<?php echo e(asset('/')); ?>icon/wallet.png">
                            Wallate
                            <p><?php echo e(auth()->user()->wallate); ?></p>
                        </label>
                        <?php endif; ?>
                        <?php endif; ?>
                        <?php if(setting('g_aamar') == 'true'): ?>
                            <label for="aamarpay" class="payment_method_label hover:bg-gray-300 dark:bg-gray-900 dark:text-indigo-300 border-x border-t dark:border border-gray-300  dark:border-indigo-300 cursor-pointer">
                                <input type="radio" name="pay_with"
                                    class="payment_method" value="aamarpay"
                                    id="aamarpay">
                                <img src="<?php echo e(asset('/')); ?>icon/aamarpay_logo.png">
                                Aamarpay
                            </label>
                        <?php endif; ?>
                        <?php if(setting('g_uddok') == 'true'): ?>
                            <label for="uddoktapay" class="payment_method_label hover:bg-gray-300 dark:bg-gray-900 dark:text-indigo-300 border-x border-t dark:border border-gray-300  dark:border-indigo-300 cursor-pointer">
                                <input type="radio" name="pay_with"
                                    class="payment_method" value="uddoktapay"
                                    id="uddoktapay">
                                <img src="<?php echo e(asset('/')); ?>icon/uddoktapay.png">
                                Uddoktapay
                            </label>
                        <?php endif; ?>
                        <?php if(setting('g_bkash') == 'true'): ?>
                            <label for="Bkash" class="payment_method_label hover:bg-gray-300 dark:bg-gray-900 dark:text-indigo-300 border-x border-t dark:border border-gray-300  dark:border-indigo-300 cursor-pointer" >
                                <input type="radio" name="pay_with"
                                    class="payment_method" value="Bkash"
                                    id="Bkash">
                                <img title="Bkash Personal" src="<?php echo e(asset('/')); ?>icon/bkash.png">
                                Bkash
                            </label>
                        <?php endif; ?>
                        <?php if(setting('g_bkash_marchant') == 'true'): ?>
                            <label for="Bkash_marchant" class="payment_method_label hover:bg-gray-300 dark:bg-gray-900 dark:text-indigo-300 border-x border-t dark:border border-gray-300  dark:border-indigo-300 cursor-pointer">
                                <input type="radio" name="pay_with"
                                    class="payment_method" value="Bkash_marchant"
                                    id="Bkash_marchant">
                                <img title="Bkash Marchant" src="https://avatars.githubusercontent.com/u/37193329?s=100">
                                Bkash Marchant
                            </label>
                        <?php endif; ?>
                        <?php if(setting('g_nagad') == 'true'): ?>
                            <label for="Nagad" class="payment_method_label hover:bg-gray-300 dark:bg-gray-900 dark:text-indigo-300 border-x border-t dark:border border-gray-300  dark:border-indigo-300 cursor-pointer">
                                <input type="radio" name="pay_with"
                                    class="payment_method" value="Nagad"
                                    id="Nagad">
                                <img src="<?php echo e(asset('/')); ?>icon/nagad.png">
                                Nagad
                            </label>
                        <?php endif; ?>
                        <?php if(setting('g_rocket') == 'true'): ?>
                            <label for="Rocket" class="payment_method_label hover:bg-gray-300 dark:bg-gray-900 dark:text-indigo-300 border-x border-t dark:border border-gray-300  dark:border-indigo-300 cursor-pointer">
                                <input type="radio" name="pay_with"
                                    class="payment_method" value="Rocket"
                                    id="Rocket">
                                <img src="<?php echo e(asset('/')); ?>icon/rocket.png">
                                Rocket
                            </label>
                        <?php endif; ?>
                        <?php if(setting('g_bank') == 'true'): ?>
                            <label for="Bank" class="payment_method_label hover:bg-gray-300 dark:bg-gray-900 dark:text-indigo-300 border-x border-t dark:border border-gray-300  dark:border-indigo-300 cursor-pointer">
                                <input type="radio" name="pay_with"
                                    class="payment_method" value="Bank"
                                    id="Bank">
                                <img src="<?php echo e(asset('/')); ?>icon/bank.png">
                                Bank
                            </label>
                        <?php endif; ?>
                    </div>
                </div>
            </div>
            
        </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]); ?>
            <small class="form-text text-danger"><?php echo e($message); ?></small>
        <?php unset($message);
if (isset($__messageOriginal)) { $message = $__messageOriginal; }
endif;
unset($__errorArgs, $__bag); ?>
    </div>
    <p class="my-3 shadow-md dark:text-indigo-300 dark:bg-black px-2 py-2 rounded-md" id="appended"><?php echo setting('COD_notice') ?? 'পণ্য হাতে পেয়ে টাকা দিন।'; ?></p>
    <div id="payment-details" class="dark:text-indigo-300 dark:bg-gray-900"></div>
</div>
<?php $__env->startPush('js'); ?>
<style>
    .payment_method_label_active_inactive{
        background-color: yellow;
    }
</style>
<script>
    $(document).ready(function(){


            function email_show(){
                $('#email_wrap').removeClass('d-none');
            }
            function email_hide(){
                // $('#email').removeAttr('required');
                $('#email_wrap').addClass('d-none');
                $('#email_wrap').addClass('hidden');
            }
            function email_required(){
                $('#email_sup').text('*');
                $('#email').prop('required', true);
            }
            function email_un_required(){
                // $('#email').removeAttr('required');
                $('#email').prop('required', false);
                $('#email_sup').text('');
            }

            // Email Off
            function off_email(e){
                e.preventDefault();
                var email_visible = <?php echo e(setting('EMAIL_VISIBLE_WHILE_CHECKOUT') ?? 1); ?>;
                var email_required = <?php echo e(setting('REQUIRED_EMAIL_ADDRESS_WHILE_CHECKOUT') ?? 0); ?>;
                console.log('email_visible', email_visible);
                console.log('email_required', email_required);

                
                if(email_visible == 0 || email_visible == "0" || email_visible == ""){
                    email_hide();
                    email_un_required();
                } else{
                    email_show();
                }

                if(email_required == 0 || email_required == "0" || email_required == ""){   
                    email_un_required();
                } else{
                    email_required();
                }

                
                
                // console.log('off_email');
            }

            // default COD - Payment Method
            $('#cod').parent("label").addClass("payment_method_label_active_inactive");
            
            $('.payment_method').change(function(e) {
                // Check if the selected payment method is not "Cash on Delivery"
                if ($(this).val() !== 'Cash on Delivery') {
                    // If not, automatically select the "Cash on Delivery" option
                    $(".payment_method_label").removeClass("payment_method_label_active_inactive");
                    $(this).parent("label").addClass("payment_method_label_active_inactive");
                    // $('#cod').parent("label").addClass("payment_method_label_active_inactive");
                    // off_email(e);
                }
            });

            $(document).on('click', '.payment_method', function(e) {
                $(".payment_method_label").removeClass("payment_method_label_active_inactive");
                $(this).parent("label").addClass("payment_method_label_active_inactive");
                
                // Use jQuery's `change` event to handle the radio button selection
                $('input[name="pay_with"]').not(this).prop('checked', false); // Uncheck all payment methods except the clicked one
                $(this).prop('checked', true); // Set the clicked payment method as checked
                $('#payment_method').val($(this).val());
                console.log($(this).val());



                let method = $(this).val();
                let html = '';
                var Bkash_marchant = "<?php echo e(setting('Bkash_marchant')); ?>";
                var bkash = "<?php echo e(setting('bkash')); ?>";
                var nogod = "<?php echo e(setting('nagad')); ?>";
                var rocket = "<?php echo e(setting('rocket')); ?>";
                var bank = "<?php echo setting('bank_name'); ?>";
                var branch = "<?php echo setting('branch_name'); ?>";
                var holder = "<?php echo setting('holder_name'); ?>";
                var account = "<?php echo setting('bank_account'); ?>";
                var appended = $('#appended');;
                
                if (method == 'Bkash_marchant') {
                    appended.html('Pay with Bkash Online.');
                    off_email(e);

                } else if (method == 'Bkash') {
                    appended.html(bkash + ' - এই নাম্বারে টাকা পাঠিয়ে নিচের ফিল্ডে  Transaction ID টি দিন');
                    off_email(e);

                } else if (method == 'Nagad') {
                    appended.html(nogod + ' - এই নাম্বারে টাকা পাঠিয়ে নিচের ফিল্ডে  Transaction ID টি দিন');
                    off_email(e);

                } else if (method == 'Nagad') {
                    appended.html(nogod + ' - এই নাম্বারে টাকা পাঠিয়ে নিচের ফিল্ডে  Transaction ID টি দিন');
                    off_email(e);

                } else if (method == 'Rocket') {
                    appended.html(rocket +
                        ' - এই নাম্বারে টাকা পাঠিয়ে নিচের ফিল্ডে  Transaction ID টি দিন');
                    off_email(e);

                } else if (method == 'Bank') {
                    appended.html('নিচে দেয়া ব্যাংকে টাকা পাঠিয়ে নিচের ফিল্ডগুলো পূরণ করুন <br> ' +
                        'Bank Name: ' + bank + '<br>Branch: ' + branch + '<br>holder: ' + holder +
                        '<br>Account: ' + account);
                        off_email(e);

                } else if (method == 'Cash on Delivery') {
                    appended.html('<?php echo setting('COD_notice') ?? 'পণ্য হাতে পেয়ে টাকা দিন।'; ?>');
                    off_email(e);

                } else if (method == 'wallate') {
                    appended.html('Selected Wallet balence.');
                    off_email(e);

                } else if (method == 'uddoktapay') {
                    // Email On
                    $('#email_wrap').removeClass('d-none');
                    $('#email_wrap').removeClass('hidden');
                    $('#email').prop('required', true);
                    $('#email_sup').text('*');
                    appended.html('Pay with online.');

                } else {

                    appended.html('');
                    off_email(e);
                }



                if (method == 'Bkash' || method == 'Nagad' || method == 'Rocket') {
                    // off_email(e);
                    html += '<div class="form-group">'
                    html += '<label for="mobile_number" class="dark:text-indigo-300">Mobile Number</label>'
                    html +=
                        '<input required type="text" name="mobile_number" id="mobile_number" class="form-control bg-white dark:bg-gray-900 dark:text-indigo-300" placeholder="Enter your mobile number"/>'
                    html += '</div>'
                    html += '<div class="form-group">'
                    html += '<label for="transaction_id" class="dark:text-indigo-300">Transaction ID</label>'
                    html +=
                        '<input required type="text" name="transaction_id" id="transaction_id" class="form-control bg-white dark:bg-gray-900 dark:text-indigo-300" placeholder="Enter transaction ID"/>'
                    html += '</div>'

                } else if (method == 'Bank') {
                    // off_email(e);
                    html += '<div class="form-group">'
                    html += '<label for="bank_name" class="dark:text-indigo-300">Bank Name</label>'
                    html +=
                        '<input required type="text" name="bank_name" id="bank_name" class="form-control bg-white dark:bg-gray-900 dark:text-indigo-300" placeholder="Enter bank name"/>'
                    html += '</div>'
                    html += '<div class="form-group">'
                    html += '<label for="account_number" class="dark:text-indigo-300">Account Number</label>'
                    html +=
                        '<input required type="text" name="account_number" id="account_number" class="form-control bg-white dark:bg-gray-900 dark:text-indigo-300" placeholder="Enter account number"/>'
                    html += '</div>'
                    html += '<div class="form-group">'
                    html += '<label for="holder_name" class="dark:text-indigo-300">Holder Name</label>'
                    html +=
                        '<input required type="text" name="holder_name" id="holder_name" class="form-control bg-white dark:bg-gray-900 dark:text-indigo-300" placeholder="Enter holder name"/>'
                    html += '</div>'
                    html += '<div class="form-group">'
                    html += '<label for="branch" class="dark:text-indigo-300">Branch Name</label>'
                    html +=
                        '<input required type="text" name="branch" id="branch" class="form-control bg-white dark:bg-gray-900 dark:text-indigo-300" placeholder="Enter branch name"/>'
                    html += '</div>'
                    html += '<div class="form-group">'
                    html += '<label for="routing" class="dark:text-indigo-300">Routing Number</label>'
                    html +=
                        '<input required type="text" name="routing" id="routing" class="form-control bg-white dark:bg-gray-900 dark:text-indigo-300" placeholder="Enter routing number"/>'
                    html += '</div>'
                } else {
                    html = '';
                }
                $('#payment-details').html(html);
            });

    });
</script>
<?php $__env->stopPush(); ?><?php /**PATH /home/apleusbj/shopping.apleefix.com/resources/views/frontend/partial/checkout/checkout_part/payment_methode_minimal.blade.php ENDPATH**/ ?>