This commit is contained in:
subhajit 2026-07-27 12:05:52 +05:30
parent 838684affc
commit 178b4a9e4b
4 changed files with 30 additions and 6 deletions

BIN
public/Screenshot_15.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

View File

@ -953,12 +953,25 @@ function analyzeCameraFrame() {
// 5. 2-Way Real-Time Chat Message Polling (No popup alerts!)
function pollCandidateChat() {
fetch(`{{ route('interview.poll', $interview->id) }}`)
.then(r => r.json())
fetch(`{{ route('interview.candidate.poll', $interview->id) }}`, {
headers: { 'Accept': 'application/json' }
})
.then(r => {
if (!r.ok) return null;
const contentType = r.headers.get('content-type');
if (!contentType || !contentType.includes('application/json')) return null;
return r.json();
})
.then(data => {
if (!data) return;
const chatHistory = document.getElementById('candidate-chat-history');
if (!chatHistory) return;
if (data.status === 'blocked' || data.is_expired) {
window.location.reload();
return;
}
if (data.call_status === 'ended') {
candidateLeaveCall();
const badge = document.getElementById('call-status-badge');
@ -988,7 +1001,8 @@ function pollCandidateChat() {
chatHistory.innerHTML = html;
chatHistory.scrollTop = chatHistory.scrollHeight;
}
});
})
.catch(() => {});
}
setInterval(pollCandidateChat, 3000);
pollCandidateChat();

View File

@ -813,9 +813,17 @@ function openReviewModal(id, name, uid) {
function pollReviewData() {
if (!currentInterviewId) return;
fetch(`{{ route('interview.poll', ':id') }}`.replace(':id', currentInterviewId))
.then(r => r.json())
fetch(`{{ route('interview.poll', ':id') }}`.replace(':id', currentInterviewId), {
headers: { 'Accept': 'application/json' }
})
.then(r => {
if (!r.ok) return null;
const contentType = r.headers.get('content-type');
if (!contentType || !contentType.includes('application/json')) return null;
return r.json();
})
.then(data => {
if (!data) return;
document.getElementById('modal-code-lang').innerText = (data.submitted_language || 'UNKNOWN').toUpperCase();
document.getElementById('modal-code-display').innerText = data.submitted_code || '// Candidate has not typed any code yet.';
document.getElementById('modal-output-display').innerText = data.code_output || 'No execution output.';
@ -946,7 +954,8 @@ function pollReviewData() {
} else {
sosBtn.style.display = 'none';
}
});
})
.catch(() => {});
}
function openSosModal() {

View File

@ -36,6 +36,7 @@
Route::post('/candidate/notes/{id}', [InterviewController::class, 'saveCandidateNotes'])->name('interview.candidate.notes');
Route::post('/candidate/drawing/{id}', [InterviewController::class, 'saveCandidateDrawing'])->name('interview.candidate.drawing');
Route::post('/candidate/send-message/{id}', [InterviewController::class, 'candidateSendMessage'])->name('interview.candidate.send-message');
Route::get('/candidate/poll/{id}', [InterviewController::class, 'getPollData'])->name('interview.candidate.poll');
// User Dashboard Portal (requires authenticated user)
Route::middleware(['auth', 'role:user', 'verify-ms-session'])->group(function () {