Implement chat support functionality: update .env.example for Reverb integration, enhance ChatController with support conversation methods, and modify Conversation model for improved chat handling. Add middleware for chat operator checks and update broadcasting configuration for Reverb.
This commit is contained in:
63
resources/views/nova/chat.blade.php
Normal file
63
resources/views/nova/chat.blade.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
<meta name="robots" content="noindex">
|
||||
<title>{{ __('Chat') }} — {{ config('nova.name', config('app.name')) }}</title>
|
||||
<link rel="stylesheet" href="{{ asset('assets/panel/css/chat.css') }}">
|
||||
</head>
|
||||
<body>
|
||||
<div class="mm-chat" id="mm-chat">
|
||||
<header class="mm-chat__top">
|
||||
<a class="mm-chat__back" href="{{ url('/panel') }}">{{ __('Back to panel') }}</a>
|
||||
<h1>{{ __('Chat') }}</h1>
|
||||
<span class="mm-chat__badge" id="mm-chat-unread" hidden>0</span>
|
||||
</header>
|
||||
|
||||
<div class="mm-chat__shell">
|
||||
<aside class="mm-chat__inbox">
|
||||
<div class="mm-chat__inbox-head">{{ __('Conversations') }}</div>
|
||||
<div class="mm-chat__list" id="mm-chat-list"></div>
|
||||
<p class="mm-chat__empty" id="mm-chat-empty-inbox" hidden>{{ __('No conversations yet.') }}</p>
|
||||
</aside>
|
||||
|
||||
<section class="mm-chat__thread">
|
||||
<div class="mm-chat__thread-head" id="mm-chat-thread-head">{{ __('Select a conversation') }}</div>
|
||||
<div class="mm-chat__messages" id="mm-chat-messages"></div>
|
||||
<form class="mm-chat__composer" id="mm-chat-form" hidden>
|
||||
<textarea
|
||||
id="mm-chat-input"
|
||||
rows="1"
|
||||
maxlength="5000"
|
||||
placeholder="{{ __('Write a message...') }}"
|
||||
autocomplete="off"
|
||||
></textarea>
|
||||
<button type="submit" id="mm-chat-send">{{ __('Send') }}</button>
|
||||
</form>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
window.MM_CHAT = {
|
||||
conversationsUrl: @json(url('/panel/chat/conversations')),
|
||||
messagesUrl: @json(url('/panel/chat/conversations')),
|
||||
csrf: @json(csrf_token()),
|
||||
broadcastAuth: @json(url('/panel/broadcasting/auth')),
|
||||
pusher: @json($pusher),
|
||||
strings: {
|
||||
select: @json(__('Select a conversation')),
|
||||
noMessages: @json(__('No messages yet.')),
|
||||
you: @json(__('You')),
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@if (! empty($pusher['key']))
|
||||
<script src="https://js.pusher.com/8.4.0/pusher.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/laravel-echo@1.16.1/dist/echo.iife.js"></script>
|
||||
@endif
|
||||
<script src="{{ asset('assets/panel/js/chat.js') }}"></script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user