
<li id="all_supports" class="fixed_what">
    <span id="support_toggle" style="color:var(--primary_bg_color_text);background:var(--primary_color);border-radius: 50%;width: 45px;display: block;height: 45px;text-align: center;line-height: 45px;font-size: 25px;position: fixed;right: 10px;bottom: 80px;z-index: 999999;box-shadow: 0px 0px 10px gainsboro;cursor: pointer;">
        <i class="fal fa-headset"></i>
    </span>
    <div id="support_drawer" style="display: none; position: fixed; right: 10px; bottom: 130px; z-index: 999999;">
        <ul style="list-style: none; padding: 0; margin: 0;">
            <?php if(setting('FLOAT_LIVE_CHAT') == 0 || setting('FLOAT_LIVE_CHAT') == 1): ?>
            <li style="margin-bottom: 10px;">
                <a href="<?php echo e(url('/connection/live-chat')); ?>">
                    <i class="support_icon fal fa-headset"></i>
                </a>
            </li>
            <?php endif; ?>
            <?php if((setting('FLOAT_LIVE_CHAT') == 2 || setting('FLOAT_LIVE_CHAT') == 0) && !empty(setting('whatsapp'))): ?>
            <li style="margin-bottom: 10px;">
                <a href="https://wa.me/<?php echo e(setting('whatsapp')); ?>">
                    <i class="support_icon icofont icofont-social-whatsapp"></i>
                </a>
            </li>
            <?php endif; ?>
            <?php if(setting('GPT_STATUS') == 1): ?>
            <li>
                <span id="live_gpt" data-toggle="modal" data-target="#live_gpt_modal">
                    <i class="support_icon far fa-user-headset"></i>
                </span>
            </li>
            <?php endif; ?>
        </ul>
    </div>
</li>



<div id="live_gpt_modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="live_gpt_modal_label" aria-hidden="true">
    <div class="modal-dialog modal-lg" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title" id="live_gpt_modal_label">Chat with Live GPT</h5>
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">&times;</span>
                </button>
            </div>
            <div class="modal-body">
                <div class="chat-box">
                    <div class="chat-messages" style="height: 400px; overflow-y: auto;">
                        <!-- Chat messages will be dynamically loaded here -->
                    </div>
                    <div class="chat-input mt-3">
                        <input type="text" class="form-control" id="chat_message" placeholder="Type your message...">
                        <button type="button" class="btn btn-primary mt-2" id="send_message">Send</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<?php $__env->startPush('js'); ?>

<style>
    .support_icon {
        font-size: 30px;
        color: var(--primary_color);
        padding: 10px;
        border-radius: 50%;
        cursor: pointer;
    }
</style>


<script>
    // Support drawer
    $(document).ready(function() {
        $('#support_toggle').on('click', function() {
            $('#support_drawer').toggle();
        });
    });
    // Live GPT chat modal
    $(document).ready(function() {
        $('#live_gpt').on('click', function() {
            $('#live_gpt_modal').modal('toggle');
        });
    });

    // Live GPT chat functionality
    $(document).ready(function() {
        $('#send_message').on('click', function() {
            var userMessage = $('#chat_message').val();
            if (userMessage.trim() !== '') {
                $('.chat-messages').append('<br/><div class="text-right"><strong>You:</strong> ' + userMessage + '</div>');
                $('#chat_message').val('');
                $('.chat-messages').scrollTop($('.chat-messages')[0].scrollHeight);
                $.ajax({
                    url: '<?php echo e(route('live_gpt')); ?>',
                    type: 'POST',
                    data: {
                        _token: '<?php echo e(csrf_token()); ?>',
                        msg: userMessage
                    },
                    success: function(response) {
                        $('.chat-messages').append('<br/><div class="text-left"><strong><?php echo setting("site_name") ?? "Lems"; ?>:</strong> ' + response.message + '</div>');
                        $('.chat-messages').scrollTop($('.chat-messages')[0].scrollHeight);
                    },
                    error: function() {
                        $('.chat-messages').append('<div class="text-left"><strong>Agent:</strong> Sorry, there was an error processing your request.</div>');
                        $('.chat-messages').scrollTop($('.chat-messages')[0].scrollHeight);
                    }
                });
            }
        });
    });


</script>
<?php $__env->stopPush(); ?><?php /**PATH /home/apleusbj/shopping.apleefix.com/resources/views/layouts/frontend/partials/partial-part/live_gpt.blade.php ENDPATH**/ ?>