update TTS

This commit is contained in:
Vckynando12 2025-08-12 23:38:35 +07:00
parent 2999084323
commit 5d833d6d42
16 changed files with 670 additions and 193 deletions

View File

@ -12,6 +12,7 @@
use App\Models\Antrian;
use App\Models\Poli;
use App\Models\RiwayatPanggilan;
use App\Services\AudioService;
use Barryvdh\DomPDF\Facade\Pdf;
@ -724,4 +725,96 @@ public function cetakAntrian(Antrian $antrian)
], 500);
}
}
/**
* Play audio for queue call
*/
public function playQueueCallAudio(Request $request)
{
try {
$request->validate([
'poli_name' => 'required|string'
]);
$poliName = $request->input('poli_name');
// Get audio sequence from AudioService
$audioService = app(AudioService::class);
$result = $audioService->getQueueCallAudio($poliName);
return response()->json($result);
} catch (\Exception $e) {
return response()->json([
'success' => false,
'message' => 'Error playing audio: ' . $e->getMessage()
], 500);
}
}
/**
* Panggil antrian selanjutnya berdasarkan poli
*/
public function panggilSelanjutnya(Request $request)
{
try {
$request->validate([
'poli_name' => 'required|string'
]);
$poliName = $request->input('poli_name');
// Cari antrian berikutnya yang status 'menunggu'
$antrianSelanjutnya = Antrian::whereHas('poli', function($query) use ($poliName) {
$query->where('nama_poli', $poliName);
})
->where('status', 'menunggu')
->whereDate('created_at', today())
->orderBy('created_at', 'asc')
->first();
if (!$antrianSelanjutnya) {
return response()->json([
'success' => false,
'message' => 'Tidak ada antrian yang menunggu untuk ' . $poliName
]);
}
// Update status menjadi 'dipanggil'
$antrianSelanjutnya->update([
'status' => 'dipanggil',
'waktu_panggil' => now()
]);
// Catat di riwayat panggilan
\App\Models\RiwayatPanggilan::create([
'antrian_id' => $antrianSelanjutnya->id,
'waktu_panggilan' => now(),
'admin_id' => auth()->id()
]);
// Get audio sequence
$audioService = app(AudioService::class);
$audioResult = $audioService->getQueueCallAudio($poliName);
return response()->json([
'success' => true,
'message' => 'Antrian ' . $antrianSelanjutnya->no_antrian . ' berhasil dipanggil',
'antrian' => [
'id' => $antrianSelanjutnya->id,
'no_antrian' => $antrianSelanjutnya->no_antrian,
'poli_name' => $poliName,
'user_name' => $antrianSelanjutnya->user->nama,
'status' => 'dipanggil'
],
'audio_sequence' => $audioResult['audio_sequence']
]);
} catch (\Exception $e) {
return response()->json([
'success' => false,
'message' => 'Terjadi kesalahan: ' . $e->getMessage()
], 500);
}
}
}

View File

@ -0,0 +1,67 @@
<?php
namespace App\Http\Controllers;
use App\Services\AudioService;
use Illuminate\Http\Request;
class AudioController extends Controller
{
protected $audioService;
public function __construct(AudioService $audioService)
{
$this->audioService = $audioService;
}
/**
* Show audio management page
*/
public function index()
{
return view('admin.audio.index');
}
/**
* Get audio sequence for queue call
*/
public function getQueueCallAudio(Request $request)
{
$request->validate([
'poli_name' => 'required|string'
]);
$poliName = $request->input('poli_name');
$result = $this->audioService->getQueueCallAudio($poliName);
return response()->json($result);
}
/**
* Get available audio files
*/
public function getAvailableAudioFiles()
{
$files = $this->audioService->getAvailableAudioFiles();
return response()->json([
'success' => true,
'files' => $files
]);
}
/**
* Test audio playback
*/
public function testAudio(Request $request)
{
$request->validate([
'poli_name' => 'required|string'
]);
$poliName = $request->input('poli_name');
$result = $this->audioService->getQueueCallAudio($poliName);
return response()->json($result);
}
}

View File

@ -10,54 +10,73 @@ class DisplayController extends Controller
{
public function index()
{
// Get all available polis
$polis = Poli::all();
// Current: sedang dipanggil per poli
$poliUmumCurrent = Antrian::where('poli_id', 1)
$poliUmumCurrent = Antrian::whereHas('poli', function($query) {
$query->where('nama_poli', 'umum');
})
->where('status', 'dipanggil')
->whereDate('created_at', today())
->orderByDesc('updated_at')
->first();
$poliGigiCurrent = Antrian::where('poli_id', 2)
$poliGigiCurrent = Antrian::whereHas('poli', function($query) {
$query->where('nama_poli', 'gigi');
})
->where('status', 'dipanggil')
->whereDate('created_at', today())
->orderByDesc('updated_at')
->first();
$poliJiwaCurrent = Antrian::where('poli_id', 3)
$poliJiwaCurrent = Antrian::whereHas('poli', function($query) {
$query->where('nama_poli', 'kesehatan jiwa');
})
->where('status', 'dipanggil')
->whereDate('created_at', today())
->orderByDesc('updated_at')
->first();
$poliTradisionalCurrent = Antrian::where('poli_id', 4)
$poliTradisionalCurrent = Antrian::whereHas('poli', function($query) {
$query->where('nama_poli', 'kesehatan tradisional');
})
->where('status', 'dipanggil')
->whereDate('created_at', today())
->orderByDesc('updated_at')
->first();
// Next: menunggu per poli (maks 3)
$poliUmumNext = Antrian::where('poli_id', 1)
$poliUmumNext = Antrian::whereHas('poli', function($query) {
$query->where('nama_poli', 'umum');
})
->where('status', 'menunggu')
->whereDate('created_at', today())
->orderBy('created_at', 'asc')
->take(3)
->get();
$poliGigiNext = Antrian::where('poli_id', 2)
$poliGigiNext = Antrian::whereHas('poli', function($query) {
$query->where('nama_poli', 'gigi');
})
->where('status', 'menunggu')
->whereDate('created_at', today())
->orderBy('created_at', 'asc')
->take(3)
->get();
$poliJiwaNext = Antrian::where('poli_id', 3)
$poliJiwaNext = Antrian::whereHas('poli', function($query) {
$query->where('nama_poli', 'kesehatan jiwa');
})
->where('status', 'menunggu')
->whereDate('created_at', today())
->orderBy('created_at', 'asc')
->take(3)
->get();
$poliTradisionalNext = Antrian::where('poli_id', 4)
$poliTradisionalNext = Antrian::whereHas('poli', function($query) {
$query->where('nama_poli', 'kesehatan tradisional');
})
->where('status', 'menunggu')
->whereDate('created_at', today())
->orderBy('created_at', 'asc')
@ -107,19 +126,25 @@ public function checkNewCalls(Request $request)
public function getDisplayData()
{
// Current: sedang dipanggil per poli
$poliUmumCurrent = Antrian::where('poli_id', 1)
$poliUmumCurrent = Antrian::whereHas('poli', function($query) {
$query->where('nama_poli', 'umum');
})
->where('status', 'dipanggil')
->whereDate('created_at', today())
->orderByDesc('updated_at')
->first();
$poliGigiCurrent = Antrian::where('poli_id', 2)
$poliGigiCurrent = Antrian::whereHas('poli', function($query) {
$query->where('nama_poli', 'gigi');
})
->where('status', 'dipanggil')
->whereDate('created_at', today())
->orderByDesc('updated_at')
->first();
$poliJiwaCurrent = Antrian::where('poli_id', 3)
$poliJiwaCurrent = Antrian::whereHas('poli', function($query) {
$query->where('nama_poli', 'kesehatan jiwa');
})
->where('status', 'dipanggil')
->whereDate('created_at', today())
->orderByDesc('updated_at')
@ -132,21 +157,26 @@ public function getDisplayData()
->first();
// Next: menunggu per poli (maks 3)
$poliUmumNext = Antrian::where('poli_id', 1)
$poliUmumNext = Antrian::whereHas('poli', function($query) {
$query->where('nama_poli', 'umum');
})
->where('status', 'menunggu')
->whereDate('created_at', today())
->orderBy('created_at', 'asc')
->take(3)
->get();
$poliGigiNext = Antrian::where('poli_id', 2)
$poliGigiNext = Antrian::whereHas('poli', function($query) {
$query->where('nama_poli', 'gigi');
})
->where('status', 'menunggu')
->whereDate('created_at', today())
->orderBy('created_at', 'asc')
->take(3)
->get();
$poliJiwaNext = Antrian::where('poli_id', 3)
$poliJiwaNext = Antrian::whereHas('poli', function($query) {
$query->where('nama_poli', 'kesehatan jiwa');
})
->where('status', 'menunggu')
->whereDate('created_at', today())
->orderBy('created_at', 'asc')

View File

@ -0,0 +1,81 @@
<?php
namespace App\Services;
class AudioService
{
/**
* Get audio sequence for queue call
*/
public function getQueueCallAudio($poliName)
{
// Normalize poli name for file matching
$normalizedPoliName = $this->normalizePoliName($poliName);
// Check if audio file exists for this poli
$poliAudioFile = "assets/music/tts/antrian selanjutnya. poli {$normalizedPoliName}.mp3";
if (!file_exists(public_path($poliAudioFile))) {
// Fallback to default audio
$poliAudioFile = "assets/music/tts/antrian selanjutnya. poli umum.mp3";
}
return [
'success' => true,
'audio_sequence' => [
[
'type' => 'audio_file',
'url' => asset('assets/music/announcement.mp3'),
'duration' => 4000 // 4 seconds
],
[
'type' => 'delay',
'duration' => 1000 // 1 second delay between announcement and antrian
],
[
'type' => 'audio_file',
'url' => asset($poliAudioFile),
'duration' => 4000 // 4 seconds
]
]
];
}
/**
* Normalize poli name to match audio file names
*/
private function normalizePoliName($poliName)
{
$poliName = strtolower(trim($poliName));
// Map poli names to match audio files
$poliMap = [
'umum' => 'umum',
'gigi' => 'gigi',
'kesehatan jiwa' => 'jiwa',
'jiwa' => 'jiwa',
'kesehatan tradisional' => 'Tradisional',
'tradisional' => 'Tradisional'
];
return $poliMap[$poliName] ?? 'umum';
}
/**
* Get all available audio files
*/
public function getAvailableAudioFiles()
{
$audioDir = public_path('assets/music/tts');
$files = [];
if (is_dir($audioDir)) {
$audioFiles = glob($audioDir . '/*.mp3');
foreach ($audioFiles as $file) {
$files[] = basename($file);
}
}
return $files;
}
}

View File

@ -36,7 +36,7 @@
],
'google' => [
'tts_api_key' => env('GOOGLE_TTS_API_KEY'),
],
];

View File

@ -0,0 +1,244 @@
@extends('layouts.app')
@section('title', 'Audio Management')
@section('content')
<div class="min-h-screen bg-gray-50">
@include('admin.partials.top-nav')
<div class="flex">
@include('admin.partials.sidebar')
<!-- Main Content -->
<div class="flex-1 lg:ml-0">
<div class="px-4 sm:px-6 lg:px-8 py-6 md:py-8">
<!-- Header -->
<div class="mb-8">
<h1 class="text-3xl font-bold text-gray-900 mb-2">🎵 Audio Management</h1>
<p class="text-gray-600">Kelola dan test audio untuk panggilan antrian</p>
</div>
<!-- Audio Test Panel -->
<div class="bg-white shadow rounded-lg mb-8">
<div class="px-6 py-4 border-b border-gray-200">
<h2 class="text-xl font-semibold text-gray-900">🧪 Test Audio</h2>
<p class="mt-1 text-sm text-gray-500">Test audio untuk setiap poli</p>
</div>
<div class="p-6">
<form id="audio-test-form">
@csrf
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<!-- Poli Selection -->
<div>
<label for="poli_name" class="block text-sm font-medium text-gray-700 mb-2">Pilih Poli</label>
<select name="poli_name" id="poli_name" required
class="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500">
<option value="">Pilih Poli</option>
<option value="umum">Poli Umum</option>
<option value="gigi">Poli Gigi</option>
<option value="kesehatan jiwa">Poli Kesehatan Jiwa</option>
<option value="kesehatan tradisional">Poli Kesehatan Tradisional</option>
</select>
</div>
<!-- Test Button -->
<div class="flex items-end">
<button type="submit" id="test-audio-btn"
class="w-full bg-blue-600 text-white px-4 py-2 rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 transition duration-200">
<svg class="w-4 h-4 mr-2 inline" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14.828 14.828a4 4 0 01-5.656 0M9 10h1m4 0h1m-6 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
</svg>
Test Audio
</button>
</div>
</div>
</form>
<!-- Test Result -->
<div id="test-result" class="mt-6 hidden">
<div class="bg-gray-50 rounded-lg p-4">
<h3 class="text-lg font-medium text-gray-900 mb-2">Audio Sequence:</h3>
<div id="audio-sequence-info" class="text-sm text-gray-600"></div>
</div>
</div>
</div>
</div>
<!-- Available Audio Files -->
<div class="bg-white shadow rounded-lg">
<div class="px-6 py-4 border-b border-gray-200">
<h2 class="text-xl font-semibold text-gray-900">📁 Available Audio Files</h2>
<p class="mt-1 text-sm text-gray-500">Daftar file audio yang tersedia</p>
</div>
<div class="p-6">
<div id="audio-files-list" class="space-y-3">
<div class="text-center text-gray-500 py-8">
<svg class="w-8 h-8 mx-auto mb-2 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 19V6l12-3v13M9 19c0 1.105-1.343 2-3 2s-3-.895-3-2 1.343-2 3-2 3 .895 3 2zm12-3c0 1.105-1.343 2-3 2s-3-.895-3-2 1.343-2 3-2 3 .895 3 2zM9 10l12-3"></path>
</svg>
<p>Loading audio files...</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
@push('scripts')
<script>
const audioTestForm = document.getElementById('audio-test-form');
const testAudioBtn = document.getElementById('test-audio-btn');
const testResult = document.getElementById('test-result');
const audioSequenceInfo = document.getElementById('audio-sequence-info');
const audioFilesList = document.getElementById('audio-files-list');
// Load available audio files
async function loadAudioFiles() {
try {
const response = await fetch('{{ route('audio.files') }}');
const data = await response.json();
if (data.success && data.files.length > 0) {
audioFilesList.innerHTML = data.files.map(file => `
<div class="flex items-center justify-between p-3 bg-gray-50 rounded-lg border border-gray-200">
<div class="flex items-center">
<svg class="w-5 h-5 text-gray-400 mr-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 19V6l12-3v13M9 19c0 1.105-1.343 2-3 2s-3-.895-3-2 1.343-2 3-2 3 .895 3 2zm12-3c0 1.105-1.343 2-3 2s-3-.895-3-2 1.343-2 3-2 3 .895 3 2zM9 10l12-3"></path>
</svg>
<span class="text-sm font-medium text-gray-900">${file}</span>
</div>
<button onclick="playAudioFile('${file}')"
class="text-blue-600 hover:text-blue-800 text-sm font-medium">
Play
</button>
</div>
`).join('');
} else {
audioFilesList.innerHTML = `
<div class="text-center text-gray-500 py-8">
<svg class="w-8 h-8 mx-auto mb-2 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.34 16.5c-.77.833.192 2.5 1.732 2.5z"></path>
</svg>
<p>No audio files found</p>
</div>
`;
}
} catch (error) {
console.error('Error loading audio files:', error);
audioFilesList.innerHTML = `
<div class="text-center text-red-500 py-8">
<svg class="w-8 h-8 mx-auto mb-2 text-red-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.34 16.5c-.77.833.192 2.5 1.732 2.5z"></path>
</svg>
<p>Error loading audio files</p>
</div>
`;
}
}
// Play single audio file
function playAudioFile(filename) {
const audio = new Audio(`/assets/music/tts/${filename}`);
audio.play().catch(error => {
console.error('Error playing audio:', error);
});
}
// Handle form submission
audioTestForm.addEventListener('submit', async function(e) {
e.preventDefault();
const formData = new FormData(audioTestForm);
const poliName = formData.get('poli_name');
if (!poliName) {
alert('Pilih poli terlebih dahulu');
return;
}
testAudioBtn.disabled = true;
testAudioBtn.innerHTML = `
<svg class="w-4 h-4 mr-2 inline animate-spin" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"></path>
</svg>
Testing...
`;
try {
const response = await fetch('{{ route('audio.test') }}', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').content
},
body: JSON.stringify({
poli_name: poliName
})
});
const result = await response.json();
if (result.success) {
showTestResult(result.audio_sequence);
testResult.classList.remove('hidden');
} else {
alert('Error: ' + result.message);
}
} catch (error) {
console.error('Error testing audio:', error);
alert('Terjadi kesalahan saat test audio');
} finally {
testAudioBtn.disabled = false;
testAudioBtn.innerHTML = `
<svg class="w-4 h-4 mr-2 inline" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14.828 14.828a4 4 0 01-5.656 0M9 10h1m4 0h1m-6 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
</svg>
Test Audio
`;
}
});
// Show test result
function showTestResult(audioSequence) {
const sequenceHtml = audioSequence.map((item, index) => {
if (item.type === 'audio_file') {
return `
<div class="mb-2 p-2 bg-white rounded border">
<strong>Step ${index + 1}:</strong> Audio File
<br>
<small class="text-gray-500">URL: ${item.url}</small>
<br>
<small class="text-gray-500">Duration: ${item.duration}ms</small>
</div>
`;
} else if (item.type === 'delay') {
return `
<div class="mb-2 p-2 bg-gray-100 rounded border">
<strong>Step ${index + 1}:</strong> Delay
<br>
<small class="text-gray-500">Duration: ${item.duration}ms</small>
</div>
`;
} else {
return `
<div class="mb-2 p-2 bg-white rounded border">
<strong>Step ${index + 1}:</strong> ${item.type}
<br>
<small class="text-gray-500">Duration: ${item.duration}ms</small>
</div>
`;
}
}).join('');
audioSequenceInfo.innerHTML = sequenceHtml;
}
// Load audio files on page load
document.addEventListener('DOMContentLoaded', function() {
loadAudioFiles();
});
</script>
@endpush
@endsection

View File

@ -103,6 +103,19 @@ class="flex items-center px-4 py-3 rounded-xl {{ request()->routeIs('admin.lapor
<!-- Audio Management -->
<div>
<a href="{{ route('admin.audio.index') }}"
class="flex items-center px-4 py-3 rounded-xl {{ request()->routeIs('admin.audio.*') ? 'bg-blue-50 text-blue-700 border border-blue-200' : 'text-gray-700 hover:bg-gray-50' }} transition duration-200">
<svg class="w-5 h-5 mr-3" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M19 11a7 7 0 01-7 7m0 0a7 7 0 01-7-7m7 7v4m0 0H8m4 0h4m-4-8a3 3 0 01-3-3V5a3 3 0 116 0v6a3 3 0 01-3 3z">
</path>
</svg>
<span class="font-medium">Audio Management</span>
</a>
</div>
<!-- Display -->
<div>
<a href="{{ route('display') }}"

View File

@ -184,6 +184,121 @@ class="text-lg md:text-xl font-bold text-gray-900">{{ $antrian->no_antrian }}</s
@push('scripts')
<script>
// Audio Player for Queue Calls
class AudioPlayer {
constructor() {
this.audioQueue = [];
this.isPlaying = false;
}
// Play complete audio sequence
async playAudioSequence(audioSequence) {
if (this.isPlaying) {
console.log('Audio already playing, queueing...');
this.audioQueue.push(audioSequence);
return;
}
this.isPlaying = true;
for (let i = 0; i < audioSequence.length; i++) {
const audioItem = audioSequence[i];
await this.playAudioItem(audioItem);
// Wait between audio items (0.5 second gap)
if (i < audioSequence.length - 1) {
await this.delay(500);
}
}
this.isPlaying = false;
// Play next in queue if available
if (this.audioQueue.length > 0) {
const nextSequence = this.audioQueue.shift();
this.playAudioSequence(nextSequence);
}
}
// Play single audio item
playAudioItem(audioItem) {
return new Promise((resolve) => {
if (audioItem.type === 'audio_file') {
const audio = new Audio(audioItem.url);
audio.addEventListener('loadeddata', () => {
console.log('Audio loaded, playing...');
audio.play().catch(error => {
console.error('Audio play error:', error);
resolve();
});
});
audio.addEventListener('ended', () => {
console.log('Audio ended');
resolve();
});
audio.addEventListener('error', (error) => {
console.error('Audio playback error:', error);
resolve();
});
// Fallback timeout
setTimeout(() => {
resolve();
}, audioItem.duration || 5000);
} else if (audioItem.type === 'delay') {
// Handle delay between audio files
console.log(`Waiting ${audioItem.duration}ms delay...`);
setTimeout(() => {
console.log('Delay finished');
resolve();
}, audioItem.duration);
} else {
console.warn('Unknown audio type:', audioItem.type);
resolve();
}
});
}
// Utility function for delays
delay(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
// Play audio for queue call
async playQueueCall(poliName) {
try {
console.log('Playing audio for:', poliName);
const response = await fetch('{{ route('audio.queue-call') }}', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').content
},
body: JSON.stringify({
poli_name: poliName
})
});
const data = await response.json();
if (data.success && data.audio_sequence) {
console.log('Audio sequence received:', data.audio_sequence);
await this.playAudioSequence(data.audio_sequence);
} else {
console.error('Failed to get audio sequence:', data.message);
}
} catch (error) {
console.error('Error playing audio:', error);
}
}
}
// Initialize Audio Player
const audioPlayer = new AudioPlayer();
@ -292,7 +407,8 @@ function checkForNewCalls() {
if (data.has_new_call && data.antrian) {
console.log('New call detected:', data.antrian);
// Play audio for the called queue
audioPlayer.playQueueCall(data.antrian.poli_name);
// Show notification
showNewCallNotification(data.antrian.poli_name, data.antrian.queue_number);

View File

@ -1,46 +0,0 @@
@if ($paginator->hasPages())
<nav>
<ul class="pagination">
{{-- Previous Page Link --}}
@if ($paginator->onFirstPage())
<li class="page-item disabled" aria-disabled="true" aria-label="@lang('pagination.previous')">
<span class="page-link" aria-hidden="true">&lsaquo;</span>
</li>
@else
<li class="page-item">
<a class="page-link" href="{{ $paginator->previousPageUrl() }}" rel="prev" aria-label="@lang('pagination.previous')">&lsaquo;</a>
</li>
@endif
{{-- Pagination Elements --}}
@foreach ($elements as $element)
{{-- "Three Dots" Separator --}}
@if (is_string($element))
<li class="page-item disabled" aria-disabled="true"><span class="page-link">{{ $element }}</span></li>
@endif
{{-- Array Of Links --}}
@if (is_array($element))
@foreach ($element as $page => $url)
@if ($page == $paginator->currentPage())
<li class="page-item active" aria-current="page"><span class="page-link">{{ $page }}</span></li>
@else
<li class="page-item"><a class="page-link" href="{{ $url }}">{{ $page }}</a></li>
@endif
@endforeach
@endif
@endforeach
{{-- Next Page Link --}}
@if ($paginator->hasMorePages())
<li class="page-item">
<a class="page-link" href="{{ $paginator->nextPageUrl() }}" rel="next" aria-label="@lang('pagination.next')">&rsaquo;</a>
</li>
@else
<li class="page-item disabled" aria-disabled="true" aria-label="@lang('pagination.next')">
<span class="page-link" aria-hidden="true">&rsaquo;</span>
</li>
@endif
</ul>
</nav>
@endif

View File

@ -1,130 +0,0 @@
@if ($paginator->hasPages())
<nav role="navigation" aria-label="{{ __('Pagination Navigation') }}" class="flex items-center justify-between">
<div class="flex justify-between flex-1 sm:hidden">
@if ($paginator->onFirstPage())
<span
class="relative inline-flex items-center px-4 py-2 text-sm font-medium text-gray-500 bg-white border border-gray-300 cursor-default leading-5 rounded-md">
{!! __('pagination.previous') !!}
</span>
@else
<a href="{{ $paginator->previousPageUrl() }}"
class="relative inline-flex items-center px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 leading-5 rounded-md hover:text-gray-500 focus:outline-none focus:ring ring-gray-300 focus:border-blue-300 active:bg-gray-100 active:text-gray-700 transition ease-in-out duration-150">
{!! __('pagination.previous') !!}
</a>
@endif
@if ($paginator->hasMorePages())
<a href="{{ $paginator->nextPageUrl() }}"
class="relative inline-flex items-center px-4 py-2 ml-3 text-sm font-medium text-gray-700 bg-white border border-gray-300 leading-5 rounded-md hover:text-gray-500 focus:outline-none focus:ring ring-gray-300 focus:border-blue-300 active:bg-gray-100 active:text-gray-700 transition ease-in-out duration-150">
{!! __('pagination.next') !!}
</a>
@else
<span
class="relative inline-flex items-center px-4 py-2 ml-3 text-sm font-medium text-gray-500 bg-white border border-gray-300 cursor-default leading-5 rounded-md">
{!! __('pagination.next') !!}
</span>
@endif
</div>
<div class="hidden sm:flex-1 sm:flex sm:items-center sm:justify-between">
<div>
<p class="text-sm text-gray-700 leading-5">
{!! __('Showing') !!}
@if ($paginator->firstItem())
<span class="font-medium">{{ $paginator->firstItem() }}</span>
{!! __('to') !!}
<span class="font-medium">{{ $paginator->lastItem() }}</span>
@else
{{ $paginator->count() }}
@endif
{!! __('of') !!}
<span class="font-medium">{{ $paginator->total() }}</span>
{!! __('results') !!}
</p>
</div>
<div>
<span class="relative z-0 inline-flex shadow-sm rounded-md">
{{-- Previous Page Link --}}
@if ($paginator->onFirstPage())
<span aria-disabled="true" aria-label="{{ __('pagination.previous') }}">
<span
class="relative inline-flex items-center px-2 py-2 text-sm font-medium text-gray-500 bg-white border border-gray-300 cursor-default rounded-l-md leading-5"
aria-hidden="true">
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd"
d="M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z"
clip-rule="evenodd" />
</svg>
</span>
</span>
@else
<a href="{{ $paginator->previousPageUrl() }}" rel="prev"
class="relative inline-flex items-center px-2 py-2 text-sm font-medium text-gray-500 bg-white border border-gray-300 rounded-l-md leading-5 hover:text-gray-400 focus:z-10 focus:outline-none focus:ring ring-gray-300 focus:border-blue-300 active:bg-gray-100 active:text-gray-500 transition ease-in-out duration-150"
aria-label="{{ __('pagination.previous') }}">
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd"
d="M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z"
clip-rule="evenodd" />
</svg>
</a>
@endif
{{-- Pagination Elements --}}
@foreach ($elements as $element)
{{-- "Three Dots" Separator --}}
@if (is_string($element))
<span aria-disabled="true">
<span
class="relative inline-flex items-center px-4 py-2 -ml-px text-sm font-medium text-gray-700 bg-white border border-gray-300 cursor-default leading-5">{{ $element }}</span>
</span>
@endif
{{-- Array Of Links --}}
@if (is_array($element))
@foreach ($element as $page => $url)
@if ($page == $paginator->currentPage())
<span aria-current="page">
<span
class="relative inline-flex items-center px-4 py-2 -ml-px text-sm font-medium text-white bg-blue-600 border border-blue-600 cursor-default leading-5">{{ $page }}</span>
</span>
@else
<a href="{{ $url }}"
class="relative inline-flex items-center px-4 py-2 -ml-px text-sm font-medium text-gray-700 bg-white border border-gray-300 leading-5 hover:text-gray-500 focus:z-10 focus:outline-none focus:ring ring-gray-300 focus:border-blue-300 active:bg-gray-100 active:text-gray-700 transition ease-in-out duration-150"
aria-label="{{ __('Go to page :page', ['page' => $page]) }}">
{{ $page }}
</a>
@endif
@endforeach
@endif
{{-- Next Page Link --}}
@if ($paginator->hasMorePages())
<a href="{{ $paginator->nextPageUrl() }}" rel="next"
class="relative inline-flex items-center px-2 py-2 -ml-px text-sm font-medium text-gray-500 bg-white border border-gray-300 rounded-r-md leading-5 hover:text-gray-400 focus:z-10 focus:outline-none focus:ring ring-gray-300 focus:border-blue-300 active:bg-gray-100 active:text-gray-500 transition ease-in-out duration-150"
aria-label="{{ __('pagination.next') }}">
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd"
d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z"
clip-rule="evenodd" />
</svg>
</a>
@else
<span aria-disabled="true" aria-label="{{ __('pagination.next') }}">
<span
class="relative inline-flex items-center px-2 py-2 -ml-px text-sm font-medium text-gray-500 bg-white border border-gray-300 cursor-default rounded-r-md leading-5"
aria-hidden="true">
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd"
d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z"
clip-rule="evenodd" />
</svg>
</span>
</span>
@endif
@endforeach
</span>
</div>
</div>
</nav>
@endif

View File

@ -6,6 +6,7 @@
use App\Http\Controllers\DashboardController;
use App\Http\Controllers\DisplayController;
use App\Http\Controllers\AdminController;
use App\Http\Controllers\AudioController;
// Landing Page
@ -64,6 +65,9 @@
Route::post('/admin/selesai-antrian', [AdminController::class, 'selesaiAntrian'])->name('admin.selesai-antrian');
Route::post('/admin/antrian/batal', [AdminController::class, 'batalAntrian'])->name('admin.batal-antrian');
Route::post('/admin/panggil-antrian/{antrian}', [AdminController::class, 'panggilAntrianById'])->name('admin.panggil-antrian-id');
Route::post('/admin/play-audio', [AdminController::class, 'playQueueCallAudio'])->name('admin.play-audio');
Route::post('/admin/panggil-selanjutnya', [AdminController::class, 'panggilSelanjutnya'])->name('admin.panggil-selanjutnya');
Route::get('/admin/audio', [AudioController::class, 'index'])->name('admin.audio.index');
// User Management Routes
Route::get('/admin/users', [AdminController::class, 'manageUsers'])->name('admin.users.index');
@ -89,6 +93,11 @@
// Audio Routes
Route::post('/audio/queue-call', [AudioController::class, 'getQueueCallAudio'])->name('audio.queue-call');
Route::get('/audio/files', [AudioController::class, 'getAvailableAudioFiles'])->name('audio.files');
Route::post('/audio/test', [AudioController::class, 'testAudio'])->name('audio.test');
// API Routes for display
Route::get('/api/check-new-calls', [DisplayController::class, 'checkNewCalls'])->name('api.check-new-calls');
Route::get('/api/display-data', [DisplayController::class, 'getDisplayData'])->name('api.display-data');