Файловый менеджер - Редактировать - /home/clickysoft/public_html/travel-guru.clickysoft.net/storage/framework/views/7c35eadb73af3c6b179bee409571cf06.php
Назад
<?php $__env->startSection('title', 'Home'); ?> <?php $__env->startPush('styles'); ?> <link rel="stylesheet" href="<?php echo e(asset('assets/emoji/lib/css/emoji.css')); ?>" /> <?php $__env->stopPush(); ?> <?php $__env->startSection('content'); ?> <!-- DASHBOARD CONTENT SECTION BEGIN --> <section class="dashboard-content-sec"> <h3 class="welcome-john-heading">Welcome back, <?php echo e(auth()->user()->full_name); ?>!</h3> <div class="container-fluid container-fluid-new" x-data="{ rightSide: false, leftSide: false }"> <div class="main"> <div class="dashboard-right-box"> <div class="chat-box-heading-flex review-pg-flex"> <h4>Chats</h4> <a href="<?php echo e(auth()->user()->hasRole('Travel Agent') ? route('agent.dashboard') : route('user.dashboard')); ?>">Back</a> </div> <!-- <div class="search-chat search-chat-mobile-show"> <input type="text" id="search-chat-input" class="form-control" placeholder="Search for <?php echo e(Auth::user()->hasRole('Travel Agent') ? 'users' : 'agents'); ?>..." /> <div class="search-chat-icon"> <span><i class="fa fa-search" aria-hidden="true"></i></span> </div> </div> --> <div class="chat-container"> <aside class="conversations"> <div class="search-chat"> <input type="text" id="search-chat-input" class="form-control" placeholder="Search for <?php echo e(Auth::user()->hasRole('Travel Agent') ? 'users' : 'agents'); ?>..." /> <div class="search-chat-icon"> <span><i class="fa fa-search" aria-hidden="true"></i></span> </div> </div> <div id="user-list"> <?php echo $__env->make('front.user.partials.user_chat_list', [ 'chattedUsers' => $chattedUsers, ], \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?> </div> </aside> <?php if(isset($firstUserData)): ?> <div class="chat-box-ft"> <div class="go-bk-icon"> <button class="go-back" id="back-button">◀</button> <div class="ol-msg-flex"> <div class="ol-data-cont"> <h4 id="chat-full-name"><?php echo e($firstUserData->full_name); ?></h4> <span class="seen-cont-tm" id="status-main-<?php echo e($firstUserData->id); ?>"> <?php if($firstUserData->last_seen): ?> Last seen <?php echo e(\Carbon\Carbon::parse($firstUserData->last_seen)->diffForHumans()); ?> <?php endif; ?> </span> </div> <?php if($firstUserData->hasRole('Travel Agent')): ?> <div class="ol-data-rate"> <a href="javascript:void(0)" id="rate-agent"> Rate this agent <span class="star-span-rate"><i class="fa fa-star" aria-hidden="true"></i></span> </a> </div> <?php endif; ?> </div> <div class="messages scrollbar" id="style-4"> <?php echo $__env->make('front.user.partials.user_chat_messages', [ 'messages' => $messages, ], \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?> </div> <div class="chat-writing-box"> <textarea id="message-input" cols="4" rows="2" class="form-control main-textarea-cls" placeholder="Send a message..." data-emojiable="converted" data-emoji-input="unicode" data-type="original-input" maxlength="1000"></textarea> <div class="main-textarea-cls"> <div class="attachment-links-flex"> <div class="attachment-link-lft"> <input type="file" id="file-input" accept=".jpg,.jpeg,.png,.pdf,.doc,.docx,.xls,.xlsx" style="display: none" /> <a href="javascript:void(0)" class="attach-file-pin" id="attach-file-pin"> <!-- <img src="<?php echo e(asset('assets/front/images/pin-vector.png')); ?>" alt="image" class="img-fluid" /> --> <i class="fa fa-paperclip" aria-hidden="true"></i> </a> <a href="javascript:void(0)" class="emoji-picker" id="emoji-button"> <!-- <img src="<?php echo e(asset('assets/front/images/emoji-icon.png')); ?>" alt="image" class="img-fluid" /> --> <i class="fa fa-meh-o" aria-hidden="true"></i> </a> <div id="emoji-picker" class="emoji-picker" style="display: none;"> </div> </div> <div class="attachment-link-rgt"> <span id="character-counter">0/1000</span> <span class="divider-bar-color">|</span> <a href="javascript:void(0)" id="send-message-btn" class="disabled"> <img src="<?php echo e(asset('assets/front/images/send-icon.png')); ?>" alt="image" class="img-fluid" /> </a> </div> </div> <div id="preview-container"></div> </div> </div> </div> </div> </div> <?php else: ?> <p>No user chat</p> <?php endif; ?> </div> </div> <div class="overlay" @click="rightSide = false; leftSide = false" :class="{ 'active': rightSide || leftSide }"> </div> </div> </section> <!-- DASHBOARD CONTENT SECTION END --> <!-- Modal for Rating --> <input type="hidden" id="receiver-id" value="<?php echo e(isset($firstUserData->id) ? $firstUserData->id : ''); ?>" /> <div class="modal fade" id="exampleModal1-rate" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true"> </div> <!-- MODAL ONE END --> <?php $__env->stopSection(); ?> <?php $__env->startPush('front-scripts'); ?> <script src="<?php echo e(asset('assets/emoji/lib/js/config.min.js')); ?>"></script> <script src="<?php echo e(asset('assets/emoji/lib/js/util.min.js')); ?>"></script> <script src="<?php echo e(asset('assets/emoji/lib/js/jquery.emojiarea.min.js')); ?>"></script> <script src="<?php echo e(asset('assets/emoji/lib/js/emoji-picker.min.js')); ?>"></script> <script> $(function() { const emojiPicker = new EmojiPicker({ emojiable_selector: '[data-emojiable=converted]', assetsPath: '<?php echo e(asset('assets/emoji/lib/img/')); ?>', iconSize: 25 }); emojiPicker.discover(); $('#emoji-button').on('click', function() { const $emojiMenu = $('.emoji-menu[data-id="' + $('.emoji-menu').data('id') + '"]'); $emojiMenu.toggle().siblings('.emoji-menu').hide(); $('#emoji-picker').toggle(); }); $('#emoji-picker').on('emoji:select', function(event) { const emoji = event.detail.unicode; const $messageInput = $('#message-input'); $messageInput.val($messageInput.val() + emoji).focus(); }); $(document).on('click', function(event) { if (!$(event.target).closest('#emoji-button, #emoji-picker').length) { $('#emoji-picker').hide(); } }); }); </script> <script> $(document).ready(function() { $.ajax({ url: '/update-last-seen', method: 'POST', data: { user_id: "<?php echo e(Auth::id()); ?>", _token: "<?php echo e(csrf_token()); ?>" }, success: function(response) { console.log(response.message); }, error: function(error) { console.error('Failed to update last seen:', error); } }); }); </script> <script src="https://cdn.socket.io/4.7.5/socket.io.min.js"></script> <script> const socket = io("<?php echo e(env('SOCKET_URL')); ?>"); socket.on("connect", function() { const userId = "<?php echo e(auth()->user()->id); ?>"; // The logged-in user's ID socket.emit("userConnected", userId); // Emit an event to notify server }); </script> <script> // CHAT BOX SCRIPT BEGIN document.addEventListener("DOMContentLoaded", function() { document.querySelectorAll(".conversation").forEach(function(button) { button.addEventListener("click", function() { if (window.innerWidth <= 529) { document.querySelector(".conversations").classList.add("hidden"); document.querySelector(".chat-box-ft").classList.add("show"); } }); }) document.getElementById("back-button").addEventListener("click", function() { if (window.innerWidth <= 529) { document.querySelector(".conversations").classList.remove("hidden"); document.querySelector(".chat-box-ft").classList.remove("show"); } }); }); // CHAT BOX SCRIPT END const $sendButton = $('#send-message-btn'); function toggleSendButton() { $sendButton.toggleClass('disabled', !($('textarea.main-textarea-cls').val().trim() || $('#file-input')[0].files .length)); } $(document).ready(function() { const $messageInput = $('.emoji-wysiwyg-editor'); const $characterCounter = $('#character-counter'); const maxLength = 1000; $messageInput.on('input', function() { const text = $messageInput.text().substring(0, maxLength); const length = text.length; $characterCounter.text(`${length}/${maxLength}`); // Trim content and set cursor at the end if it exceeds maxLength if (length >= maxLength) { $messageInput.text(text); const range = document.createRange(); const sel = window.getSelection(); range.selectNodeContents($messageInput[0]); range.collapse(false); sel.removeAllRanges(); sel.addRange(range); } $('#send-message-btn').toggleClass('disabled', !(text || $('#file-input')[0].files.length)); }); }); $('body textarea.main-textarea-cls').on('input', function() { toggleSendButton(); }); document.getElementById("attach-file-pin").addEventListener("click", function() { document.getElementById("file-input").click(); }); document.getElementById("file-input").addEventListener("change", function(event) { const file = event.target.files[0]; const previewContainer = document.getElementById("preview-container"); previewContainer.innerHTML = ''; toggleSendButton(); if (file) { const maxFileSize = 15 * 1024 * 1024; // 15MB in bytes if (file.size > maxFileSize) { toastr.error( 'File size exceeds 15MB limit. Please choose a smaller file.'); document.getElementById("file-input").value = ''; return; } const fileType = file.type; const wrapper = document.createElement("div"); wrapper.classList.add("preview-image-wrapper"); const deleteIcon = document.createElement("span"); deleteIcon.classList.add("delete-icon"); deleteIcon.innerHTML = "×"; deleteIcon.addEventListener("click", function() { previewContainer.innerHTML = ''; $('#file-input').val(''); toggleSendButton(); }); // If it's an image if (fileType.includes("image")) { const img = document.createElement("img"); const reader = new FileReader(); reader.onload = function(e) { img.src = e.target.result; wrapper.appendChild(img); wrapper.appendChild(deleteIcon); previewContainer.appendChild(wrapper); }; reader.readAsDataURL(file); } else { // For documents (pdf, doc, etc.), just display the file name const fileName = document.createElement("p"); fileName.textContent = file.name; wrapper.appendChild(fileName); wrapper.appendChild(deleteIcon); previewContainer.appendChild(wrapper); } } }); $('body #send-message-btn').on('click', function(e) { e.preventDefault(); $sendButton.addClass('disabled'); const message = $('textarea.main-textarea-cls').val(); const receiverId = $('#receiver-id').val(); const file = $('#file-input')[0].files[0]; // Get only the first file const formData = new FormData(); // Append text message and receiver ID formData.append('message', message); formData.append('receiver_id', receiverId); // Append the single file if present if (file) { formData.append('file', file); } // AJAX request to send message $.ajax({ url: '/send-chat-message', // Your endpoint here method: 'POST', data: formData, processData: false, // Necessary for FormData contentType: false, // Necessary for FormData headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr( 'content') // Include the CSRF token in headers }, success: function(response) { // Append new message to the chatbox for the sender const fileHtml = response.message.file_path ? (['image/jpeg', 'image/png', 'image/gif'].includes(response.message.file_type) ? `<a href="/storage/${response.message.file_path}" target="_blank"> <img src="/storage/${response.message.file_path}" alt="${response.message.file_name}" class="img-thumbnail"> </a>` : `<a href="/storage/${response.message.file_path}" target="_blank">${response.message.file_name}</a>` ) : ''; const messageTime = moment(response.message.created_at).fromNow(); const messageHtml = ` <div class="message-details"> ${response.message.message ? `<p>${response.message.message}</p>` : ''} ${fileHtml} </div> `; // Append the message on the right side for the sender $('.messages').append(` <div class="right-side-chat"> ${messageHtml} <span class="timestamp">${messageTime}</span> </div> `); const messagesContainer = $('.messages'); messagesContainer.find('img').on('load', function() { messagesContainer.scrollTop(messagesContainer.prop('scrollHeight')); }); messagesContainer.scrollTop(messagesContainer.prop('scrollHeight')); // Emit the socket message to the receiver socket.emit("message", { senderId: "<?php echo e(auth()->user()->id); ?>", receiverId: receiverId, message: response.message }); // Update the last message preview for the sender in the conversation list const userButton = $(`button[data-id="${receiverId}"]`); const messagePreview = response.message.file_path ? (['image/jpeg', 'image/png', 'image/gif'].includes(response.message.file_type) ? 'Image sent' : 'File sent') : response.message.message; userButton.find('.avt-img-cont p').html(messagePreview); // Clear the input and file preview $('.emoji-wysiwyg-editor').text('') $('textarea.main-textarea-cls').val(''); $('#preview-container').empty(); $('#file-input').val(''); // Clear file input }, error: function(xhr) { if (xhr.responseJSON && xhr.responseJSON.errors) { const errors = xhr.responseJSON.errors; let errorMessage = ''; // Loop through each error and display it for (const field in errors) { errorMessage += `${errors[field].join(', ')}\n`; } $sendButton.removeClass('disabled'); // Display error messages using Toastr toastr.error(errorMessage, 'Error'); } else { // Default error message if JSON response is not available $sendButton.removeClass('disabled'); toastr.error('An error occurred while sending the message.', 'Error'); } } }); }); socket.on("message", function(data) { if (data.receiverId == "<?php echo e(auth()->user()->id); ?>" || data.senderId == "<?php echo e(auth()->user()->id); ?>") { let fileHtml = ''; let messageText = ''; // To store the final message text that will be shown in the conversation preview // Check if there's a file associated with the message if (data.message.file_path) { if (['image/jpeg', 'image/png', 'image/gif'].includes(data.message.file_type)) { // If the file is an image fileHtml = ` <a href="/storage/${data.message.file_path}" target="_blank"> <img src="/storage/${data.message.file_path}" alt="${data.message.file_name}" class="img-thumbnail"> </a>`; messageText = data.message.sender_id === "<?php echo e(auth()->user()->id); ?>" ? 'Image sent' : 'Image received'; } else { // If it's a non-image file fileHtml = `<a href="/storage/${data.message.file_path}" target="_blank">${data.message.file_name}</a>`; messageText = data.message.sender_id === "<?php echo e(auth()->user()->id); ?>" ? 'File sent' : 'File received'; } } else { // If it's a plain message messageText = data.message.message; } const messageTime = moment(data.message.created_at).fromNow(); // Update the chat preview for the user conversation button const userButton = $(`button[data-id="${data.senderId}"]`); const messageParagraph = userButton.find('.avt-img-cont p'); if (data.message.status === 'unread') { messageParagraph.html(`<b>${messageText}</b>`); } else { messageParagraph.html(messageText); } // Prepare the message details for display in the chat window const messageHtml = ` <div class="message-details"> ${data.message.message ? `<p>${data.message.message}</p>` : ''} ${fileHtml} </div> `; // Append the message details to the conversation $('.messages').append(` <div class="left-side-chat"> ${messageHtml} <span class="timestamp">${messageTime}</span> </div> `); } }); socket.on('user-online', function(data) { const userItem = document.querySelector(`.user-item[data-id="${data.userId}"]`); if (userItem) { const statusElement = document.getElementById(`status-${data.userId}`); statusElement.innerHTML = ''; let greenDot = userItem.querySelector('.online-green-dot'); if (!greenDot) { const greenDotDiv = document.createElement('div'); greenDotDiv.classList.add('online-green-dot'); const greenDotSpan = document.createElement('span'); greenDotSpan.classList.add('green-dot-on'); greenDotDiv.appendChild(greenDotSpan); userItem.querySelector('.avt-img').appendChild(greenDotDiv); } else { greenDot.querySelector('span').classList.replace('green-dot-off', 'green-dot-on'); } } const receiverId = $('#receiver-id').val(); if (receiverId == data.userId) { const statusMain = document.getElementById(`status-main-${receiverId}`); if (statusMain) statusMain.innerHTML = 'Active'; } }); socket.on('user-offline', function(data) { // Find the user element with the specific user ID const userItem = document.querySelector(`.user-item[data-id="${data.userId}"]`); if (userItem) { $.ajax({ url: '/update-last-seen', method: 'POST', data: { user_id: data.userId, _token: "<?php echo e(csrf_token()); ?>" }, success: function(response) { // Update status based on userId const statusElement = document.getElementById(`status-${data.userId}`); if (statusElement) { statusElement.innerHTML = `Last seen ${response.last_seen}`; } const receiverId = $('#receiver-id').val(); if (receiverId == data.userId) { const statusMain = document.getElementById(`status-main-${receiverId}`); if (statusMain) { statusMain.innerHTML = `Last seen ${response.last_seen}`; } } }, error: function(error) { console.error('Failed to update last seen:', error); } }); const greenDot = userItem.querySelector('.online-green-dot span'); if (greenDot) { greenDot.classList.remove('green-dot-on'); greenDot.classList.add('green-dot-off'); } } }); </script> <script> $(document).ready(function() { // Function to load messages from preloaded data function loadMessagesForUser(userId) { $.ajax({ url: '/get-messages/' + userId, method: 'GET', success: function(response) { $("#chat-full-name").text(response.full_name); if (response.last_seen) { $(".seen-cont-tm").text("Last seen " + response.last_seen); } else { $(".seen-cont-tm").text(""); } $('.messages').html(response.html); scrollToFirstUnread(); }, error: function(xhr, status, error) { console.error('Error loading messages:', error); $('.messages').empty().append('<p>Error loading messages.</p>'); } }); } function rateAgentModal(userId) { $.ajax({ url: '/review/rating/modal/' + userId, method: 'GET', success: function(response) { $("#exampleModal1-rate").html(response.html); // Load the modal content $("#exampleModal1-rate").modal('show'); // Show the modal $(document).on('click', '.rating-stars i', function() { let selectedRating = $(this).data('value'); // Get the star's value $('.rating-stars i').removeClass('fa-star').addClass('fa-star-o'); $('.rating-stars i').each(function(index) { if (index < selectedRating) { $(this).removeClass('fa-star-o').addClass( 'fa-star'); } }); }); $(document).on('click', '#submitReview', function() { let receiverId = $('#receiver-id').val(); let message = $('#review_message').val(); let selectedRating = $('.rating-stars i.fa-star') .length; let hasError = false; $('.error-message').remove(); if (selectedRating === 0) { $('#ratingError').html( '<div class="error-message" style="color: red;">Please select a rating.</div>' ); hasError = true; } if (message.trim() === '') { $('#messageError').html( '<div class="error-message" style="color: red;">Please write a review message.</div>' ); hasError = true; } if (hasError) { return; } $.ajax({ url: "<?php echo e(route('submit.review')); ?>", method: 'POST', data: { agent_id: receiverId, message: message, rating: selectedRating, _token: "<?php echo e(csrf_token()); ?>" }, success: function(response) { if (response.status === 'error') { toastr.error(response .message); } else { toastr.success( 'Review submitted successfully'); $('#exampleModal1-rate').modal( 'hide'); } }, error: function(xhr, status, error) { if (xhr.status === 422) { let errors = xhr.responseJSON.errors; if (errors.rating) { $('#ratingError').html( '<div class="error-message" style="color: red;">' + errors.rating[0] + '</div>'); } if (errors.message) { $('#messageError').html( '<div class="error-message" style="color: red;">' + errors.message[0] + '</div>'); } } else if (xhr.status === 400) { toastr.error(xhr.responseJSON.message); } else { toastr.error( 'Something went wrong. Please try again.' ); } } }); }); }, error: function(xhr, status, error) { console.error('Error loading modal:', error); } }); } $("body #rate-agent").on('click', function() { rateAgentModal($("#receiver-id").val()); }); $('#user-list').on('click', '.user-item', function() { var userId = $(this).data('id'); $(this).find('b').contents().unwrap(); $("#receiver-id").val(userId); loadMessagesForUser(userId); scrollToFirstUnread(); }); $('#search-chat-input').on('input', function() { var searchValue = $(this).val().toLowerCase(); var foundUserId = null; $('#user-list .user-item').filter(function() { var isVisible = $(this).data('fullname').toLowerCase().indexOf(searchValue) > - 1; $(this).toggle(isVisible); if (isVisible && foundUserId === null) { foundUserId = $(this).data('id'); } }); }); }); $(document).ready(function() { $('#submitReview').on('click', function() { let receiverId = $('#agent_id').val(); let message = $('#review_message').val(); let hasError = false; $('.error-message').remove(); if (selectedRating === 0) { $('#ratingError').html( '<div class="error-message" style="color: red;">Please select a rating.</div>'); hasError = true; } if (message.trim() === '') { $('#messageError').html( '<div class="error-message" style="color: red;">Please write a review message.</div>' ); hasError = true; } if (hasError) { return; } $.ajax({ url: "<?php echo e(route('submit.review')); ?>", method: 'POST', data: { agent_id: receiverId, message: message, rating: selectedRating, _token: "<?php echo e(csrf_token()); ?>" }, success: function(response) { if (response.status === 'error') { toastr.error(response.message); } else { toastr.info('Review submitted successfully'); } }, error: function(xhr, status, error) { if (xhr.status === 422) { let errors = xhr.responseJSON.errors; if (errors.rating) { $('#ratingError').html( '<div class="error-message" style="color: red;">' + errors.rating[0] + '</div>'); } if (errors.message) { $('#messageError').html( '<div class="error-message" style="color: red;">' + errors.message[0] + '</div>'); } } else if (xhr.status === 400) { toastr.error(xhr.responseJSON.message); } else { toastr.error('Something went wrong. Please try again.'); } } }); }); }); function scrollToFirstUnread() { var unreadMessage = document.querySelector('body .messages .unread-message'); if (unreadMessage) { // Ensure smooth scroll to the unread message unreadMessage.scrollIntoView({ behavior: 'smooth', block: 'center', // 'center' ensures that the unread message is in the middle of the viewport }); console.log('Scrolling to unread message'); } else { // Scroll to bottom if no unread message is found scrollToBottom(); console.log('No unread messages found, scrolling to bottom'); } } function scrollToBottom() { var messagesContainer = document.querySelector('.messages'); messagesContainer.scrollTop = messagesContainer.scrollHeight; // Scroll to the bottom } // Delay the execution of scrollToFirstUnread to ensure everything is fully loaded window.addEventListener('load', function() { setTimeout(function() { scrollToFirstUnread(); }, 100); // Adjust the delay if needed to allow all content to be fully loaded }); // Select the contenteditable div instead of the textarea const messageInput = document.querySelector('.emoji-wysiwyg-editor'); const characterCounter = document.getElementById('character-counter'); </script> <script> $(document).ready(function() { // Event delegation to handle input event in dynamically loaded modal $('body').on('input', '#review_message', function() { const maxLength = 500; const currentLength = $(this).val().length; $('#character-counter-review').text(`${currentLength}/${maxLength}`); }); }); </script> <?php $__env->stopPush(); ?> <?php echo $__env->make('front.layouts.master', ['is_travel_agent' => false], \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/clickysoft/public_html/travel-guru.clickysoft.net/resources/views/front/user/chat.blade.php ENDPATH**/ ?>
| ver. 1.4 |
Github
|
.
| PHP 8.1.29 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка