sls/resources/views/client_calls/room.blade.php

576 lines
21 KiB
PHP

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="csrf-token" content="{{ csrf_token() }}">
<title>{{ $meeting->title }} | Live Client Call Room</title>
<!-- Google Fonts: Outfit & Inter -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@500;700;800&display=swap" rel="stylesheet">
<style>
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
font-family: 'Inter', sans-serif;
background-color: #0b0f19;
color: #f3f4f6;
height: 100vh;
display: flex;
flex-direction: column;
overflow: hidden;
}
/* Top Header */
.call-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0.75rem 1.5rem;
background: rgba(17, 24, 39, 0.7);
backdrop-filter: blur(12px);
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
z-index: 20;
}
.header-left {
display: flex;
align-items: center;
gap: 12px;
}
.live-tag {
background: #ef4444;
color: white;
font-size: 0.65rem;
padding: 2px 8px;
border-radius: 999px;
font-weight: 700;
text-transform: uppercase;
animation: pulse-live 2s infinite;
}
@keyframes pulse-live {
0% { opacity: 1; }
50% { opacity: 0.4; }
100% { opacity: 1; }
}
.meeting-title {
font-family: 'Outfit', sans-serif;
font-size: 1.1rem;
font-weight: 700;
color: #f3f4f6;
}
.call-timer {
font-family: monospace;
font-size: 0.9rem;
color: #9ca3af;
background: rgba(255, 255, 255, 0.06);
padding: 3px 8px;
border-radius: 6px;
}
/* Real-Time Live Emotion Indicator Badge */
.emotion-live-indicator {
display: flex;
align-items: center;
gap: 8px;
background: rgba(255, 255, 255, 0.05);
border: 1px solid rgba(255, 255, 255, 0.12);
padding: 4px 12px;
border-radius: 999px;
font-size: 0.8rem;
font-weight: 600;
transition: all 0.3s ease;
}
.emotion-badge-happy { background: rgba(16, 185, 129, 0.2); border-color: rgba(16, 185, 129, 0.4); color: #34d399; }
.emotion-badge-neutral { background: rgba(59, 130, 246, 0.2); border-color: rgba(59, 130, 246, 0.4); color: #60a5fa; }
.emotion-badge-sad { background: rgba(245, 158, 11, 0.2); border-color: rgba(245, 158, 11, 0.4); color: #fbbf24; }
.emotion-badge-angry { background: rgba(239, 68, 68, 0.25); border-color: rgba(239, 68, 68, 0.5); color: #f87171; animation: pulse-angry 1.5s infinite; }
@keyframes pulse-angry {
0% { transform: scale(1); }
50% { transform: scale(1.05); }
100% { transform: scale(1); }
}
/* Main Video Stage */
.call-body {
flex: 1;
display: flex;
position: relative;
overflow: hidden;
}
.video-grid-container {
flex: 1;
display: flex;
justify-content: center;
align-items: center;
padding: 1rem;
overflow-y: auto;
position: relative;
}
.video-grid {
display: grid;
gap: 1rem;
width: 100%;
height: 100%;
max-height: 100%;
grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
justify-items: center;
align-items: center;
}
.video-tile {
position: relative;
background: #1e293b;
border-radius: 16px;
width: 100%;
height: 100%;
min-height: 240px;
max-height: 520px;
overflow: hidden;
display: flex;
align-items: center;
justify-content: center;
border: 1px solid rgba(255, 255, 255, 0.1);
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}
.video-element {
width: 100%;
height: 100%;
object-fit: cover;
border-radius: 16px;
}
.video-overlay {
position: absolute;
bottom: 12px;
left: 12px;
background: rgba(0, 0, 0, 0.6);
backdrop-filter: blur(6px);
padding: 4px 10px;
border-radius: 8px;
font-size: 0.8rem;
font-weight: 600;
display: flex;
align-items: center;
gap: 6px;
color: white;
z-index: 10;
}
.video-avatar-placeholder {
width: 80px;
height: 80px;
border-radius: 50%;
background: linear-gradient(135deg, #4f46e5, #06b6d4);
color: white;
display: flex;
align-items: center;
justify-content: center;
font-size: 2rem;
font-weight: 800;
font-family: 'Outfit', sans-serif;
}
/* Collapsible Side Panel (AI Notes & Chat) */
.side-panel {
width: 360px;
background: #111827;
border-left: 1px solid rgba(255, 255, 255, 0.1);
display: flex;
flex-direction: column;
transition: width 0.3s ease;
z-index: 30;
}
.side-panel.collapsed {
display: none;
}
.panel-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 1rem 1.25rem;
border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.panel-title {
font-family: 'Outfit', sans-serif;
font-size: 1rem;
font-weight: 700;
display: flex;
align-items: center;
gap: 8px;
}
.panel-close-btn {
background: transparent;
border: none;
color: #9ca3af;
cursor: pointer;
font-size: 1.2rem;
}
.panel-tabs {
display: flex;
border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.panel-tab {
flex: 1;
padding: 0.6rem;
text-align: center;
background: transparent;
border: none;
color: #9ca3af;
font-size: 0.8rem;
font-weight: 600;
cursor: pointer;
}
.panel-tab.active {
color: #818cf8;
border-bottom: 2px solid #6366f1;
background: rgba(99, 102, 241, 0.06);
}
.panel-body {
flex: 1;
padding: 1rem;
overflow-y: auto;
display: flex;
flex-direction: column;
gap: 1rem;
}
/* Transcript & Notes */
.transcript-feed {
flex: 1;
background: rgba(255, 255, 255, 0.03);
border: 1px solid rgba(255, 255, 255, 0.08);
border-radius: 10px;
padding: 10px;
overflow-y: auto;
display: flex;
flex-direction: column;
gap: 8px;
font-size: 0.8rem;
max-height: 240px;
}
.transcript-line {
line-height: 1.4;
}
.transcript-speaker {
font-weight: 700;
color: #818cf8;
margin-right: 4px;
}
.transcript-text {
color: #d1d5db;
}
.notes-textarea {
width: 100%;
height: 110px;
background: rgba(255, 255, 255, 0.04);
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 8px;
padding: 8px 10px;
color: #f3f4f6;
font-size: 0.8rem;
outline: none;
resize: none;
}
/* Chat messages */
.chat-feed {
flex: 1;
overflow-y: auto;
display: flex;
flex-direction: column;
gap: 8px;
max-height: 380px;
}
.chat-msg {
background: rgba(255, 255, 255, 0.05);
border-radius: 8px;
padding: 8px 10px;
font-size: 0.8rem;
}
.chat-sender {
font-weight: 700;
color: #38bdf8;
font-size: 0.75rem;
margin-bottom: 2px;
}
.chat-input-box {
display: flex;
gap: 6px;
margin-top: auto;
}
.chat-input {
flex: 1;
background: rgba(255, 255, 255, 0.04);
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 8px;
padding: 8px 10px;
color: #f3f4f6;
font-size: 0.8rem;
outline: none;
}
/* Bottom Controls Bar */
.call-footer {
display: flex;
justify-content: center;
align-items: center;
padding: 1rem 1.5rem;
background: rgba(17, 24, 39, 0.85);
backdrop-filter: blur(12px);
border-top: 1px solid rgba(255, 255, 255, 0.1);
gap: 12px;
z-index: 20;
}
.ctrl-btn {
width: 48px;
height: 48px;
border-radius: 50%;
background: rgba(255, 255, 255, 0.08);
border: 1px solid rgba(255, 255, 255, 0.15);
color: white;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: all 0.2s ease;
}
.ctrl-btn:hover {
background: rgba(255, 255, 255, 0.18);
transform: translateY(-2px);
}
.ctrl-btn.active-off {
background: #ef4444 !important;
border-color: #ef4444 !important;
}
.ctrl-btn.active-on {
background: #4f46e5 !important;
border-color: #4f46e5 !important;
}
.btn-end-call {
padding: 0 1.25rem;
height: 48px;
border-radius: 24px;
background: #ef4444;
color: white;
border: none;
font-weight: 700;
font-size: 0.875rem;
cursor: pointer;
display: flex;
align-items: center;
gap: 8px;
transition: all 0.2s ease;
box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}
.btn-end-call:hover {
background: #dc2626;
transform: translateY(-2px);
}
.toast-notify {
position: fixed;
bottom: 80px;
left: 50%;
transform: translateX(-50%);
background: rgba(17, 24, 39, 0.95);
border: 1px solid #4f46e5;
padding: 10px 20px;
border-radius: 8px;
color: white;
font-size: 0.85rem;
display: none;
z-index: 100;
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}
</style>
</head>
<body>
<!-- Header -->
<header class="call-header">
<div class="header-left">
<span class="live-tag">LIVE</span>
<div class="meeting-title">{{ $meeting->title }}</div>
<div class="call-timer" id="callTimer">00:00</div>
</div>
<div style="display: flex; align-items: center; gap: 12px;">
<!-- Live AI Emotion Indicator -->
<div id="liveEmotionBadge" class="emotion-live-indicator emotion-badge-neutral" title="AI Real-Time Emotion Detection">
<span id="emotionEmoji">😐</span>
<span id="emotionText">Client Emotion: Neutral</span>
</div>
<button class="ctrl-btn" style="width: 36px; height: 36px; border-radius: 8px;" onclick="copyMeetingLink()" title="Copy Meeting Link">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg>
</button>
</div>
</header>
<!-- Call Body -->
<div class="call-body">
<!-- Video Grid -->
<div class="video-grid-container">
<div class="video-grid" id="videoGrid">
<!-- Local User Video Tile -->
<div class="video-tile" id="localVideoTile">
<video id="localVideo" class="video-element" autoplay playsinline muted></video>
<div class="video-overlay">
<span>{{ $participantName }} (You)</span>
</div>
</div>
</div>
</div>
<!-- Collapsible Side Panel -->
<div class="side-panel" id="sidePanel">
<div class="panel-header">
<div class="panel-title">
<span></span> AI Meeting Assistant
</div>
<button class="panel-close-btn" onclick="toggleSidePanel()">&times;</button>
</div>
<div class="panel-tabs">
<button class="panel-tab active" onclick="switchSideTab('notesTab', this)">📝 AI Notes & MoM</button>
<button class="panel-tab" onclick="switchSideTab('chatTab', this)">💬 In-Call Chat</button>
</div>
<!-- TAB 1: AI Live Notes -->
<div id="notesTab" class="panel-body">
<div>
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px;">
<span style="font-size: 0.75rem; font-weight: 700; color: #818cf8; text-transform: uppercase;">Real-Time Speech Transcription</span>
<span id="sttStatus" style="font-size: 0.65rem; color: #34d399;"> Listening</span>
</div>
<div class="transcript-feed" id="transcriptFeed">
<div style="color: #6b7280; font-size: 0.75rem; font-style: italic;">Transcribing live spoken speech...</div>
</div>
</div>
<div>
<div style="font-size: 0.75rem; font-weight: 700; color: #818cf8; text-transform: uppercase; margin-bottom: 6px;">Live Meeting Notes</div>
<textarea id="liveNotesInput" class="notes-textarea" placeholder="Type manual notes, key discussion points, or deliverables agreed during call..."></textarea>
</div>
@if($isHost)
<button onclick="endMeetingAndGenerateMoM()" style="background: linear-gradient(135deg, #4f46e5, #06b6d4); color: white; border: none; padding: 10px; border-radius: 8px; font-weight: 700; font-size: 0.85rem; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px;">
Finish & Generate AI MoM
</button>
@endif
</div>
<!-- TAB 2: Chat -->
<div id="chatTab" class="panel-body" style="display: none;">
<div class="chat-feed" id="chatFeed">
<!-- Chat messages injected dynamically -->
</div>
<div class="chat-input-box">
<input type="text" id="chatInput" class="chat-input" placeholder="Type a message..." onkeydown="if(event.key==='Enter') sendChatMessage()">
<button onclick="sendChatMessage()" style="background: #4f46e5; color: white; border: none; border-radius: 8px; padding: 0 12px; cursor: pointer;"></button>
</div>
</div>
</div>
</div>
<!-- Bottom Controls Footer -->
<footer class="call-footer">
<!-- Mic Toggle -->
<button id="btnToggleMic" class="ctrl-btn" onclick="toggleAudio()" title="Mute / Unmute Microphone">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"></path><path d="M19 10v2a7 7 0 0 1-14 0v-2"></path><line x1="12" y1="19" x2="12" y2="23"></line><line x1="8" y1="23" x2="16" y2="23"></line></svg>
</button>
<!-- Video Toggle -->
<button id="btnToggleVideo" class="ctrl-btn" onclick="toggleVideo()" title="Turn Camera On / Off">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polygon points="23 7 16 12 23 17 23 7"></polygon><rect x="1" y="5" width="15" height="14" rx="2" ry="2"></rect></svg>
</button>
<!-- Screen Share -->
<button id="btnScreenShare" class="ctrl-btn" onclick="toggleScreenShare()" title="Share Screen">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="2" y="3" width="20" height="14" rx="2" ry="2"></rect><line x1="8" y1="21" x2="16" y2="21"></line><line x1="12" y1="17" x2="12" y2="21"></line></svg>
</button>
<!-- Toggle AI Assistant / Notes -->
<button id="btnToggleNotes" class="ctrl-btn active-on" onclick="toggleSidePanel()" title="Toggle AI Notes & Transcriber">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path><polyline points="14 2 14 8 20 8"></polyline><line x1="16" y1="13" x2="8" y2="13"></line><line x1="16" y1="17" x2="8" y2="17"></line><polyline points="10 9 9 9 8 9"></polyline></svg>
</button>
<!-- End Call / Leave Button -->
@if($isHost)
<button class="btn-end-call" onclick="endMeetingAndGenerateMoM()">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M10.68 13.31a16 16 0 0 0 3.41 2.6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7 2 2 0 0 1 1.72 2v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91"></path><line x1="23" y1="1" x2="1" y2="23"></line></svg>
End Call & Generate MoM
</button>
@else
<button class="btn-end-call" onclick="leaveCall()">
Leave Call
</button>
@endif
</footer>
<!-- Hidden Canvas for Face Emotion Snapshots -->
<canvas id="emotionCanvas" style="display: none;"></canvas>
<!-- Toast Notification -->
<div id="toastNotification" class="toast-notify">Link copied to clipboard!</div>
<!-- Pass backend configurations to Javascript -->
<script>
window.CLIENT_CALL_CONFIG = {
meetingCode: '{{ $meeting->meeting_code }}',
clientId: {{ $client->id ?? $meeting->client_id }},
participantName: '{{ $participantName }}',
participantRole: '{{ $participantRole }}',
isHost: {{ $isHost ? 'true' : 'false' }},
isGuest: {{ $isGuest ? 'true' : 'false' }},
detectEmotionUrl: '{{ route('client-calls.detect-emotion', $meeting->meeting_code) }}',
endCallUrl: '{{ route('client-calls.end-call', $meeting->meeting_code) }}',
heartbeatUrl: '{{ route('client-calls.heartbeat', $meeting->meeting_code) }}',
redirectUrl: '{{ route('client-calls.show', $client->id ?? $meeting->client_id) }}'
};
</script>
<!-- Load Client Call Script -->
<script type="module" src="{{ asset('js/client-call.js') }}"></script>
<script>
function showToast(msg) {
const toast = document.getElementById('toastNotification');
toast.innerText = msg;
toast.style.display = 'block';
setTimeout(() => { toast.style.display = 'none'; }, 3000);
}
function copyMeetingLink() {
navigator.clipboard.writeText(window.location.href);
showToast('Meeting link copied to clipboard!');
}
function toggleSidePanel() {
const panel = document.getElementById('sidePanel');
panel.classList.toggle('collapsed');
}
function switchSideTab(tabId, el) {
document.getElementById('notesTab').style.display = 'none';
document.getElementById('chatTab').style.display = 'none';
document.querySelectorAll('.panel-tab').forEach(b => b.classList.remove('active'));
document.getElementById(tabId).style.display = 'flex';
el.classList.add('active');
}
</script>
</body>
</html>