Deploy Ladill Queue / deploy (push) Successful in 33s
Add corporate layout, live preview, URL copy, queue details, and a polished TV display with clock, stats sidebar, and branded now-serving cards. Co-authored-by: Cursor <cursoragent@cursor.com>
51 lines
1.6 KiB
PHP
51 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Qms;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\VoiceAnnouncement;
|
|
use App\Services\Qms\DisplayService;
|
|
use App\Services\Qms\VoiceAnnouncementService;
|
|
use Illuminate\Http\JsonResponse;
|
|
use Illuminate\View\View;
|
|
|
|
class DisplayPublicController extends Controller
|
|
{
|
|
public function __construct(
|
|
protected DisplayService $displays,
|
|
protected VoiceAnnouncementService $voice,
|
|
) {}
|
|
|
|
public function show(string $token): View
|
|
{
|
|
$screen = $this->displays->findByToken($token) ?? abort(404);
|
|
$screen->loadMissing(['organization', 'branch']);
|
|
$this->displays->touch($screen);
|
|
|
|
return view('qms.display.public', [
|
|
'screen' => $screen,
|
|
'dataUrl' => route('qms.display.data', $token),
|
|
'playedUrl' => route('qms.display.announcement.played', ['token' => $token, 'announcement' => '__ID__']),
|
|
'pollMs' => config('qms.display_poll_ms', 1200),
|
|
]);
|
|
}
|
|
|
|
public function data(string $token): JsonResponse
|
|
{
|
|
$screen = $this->displays->findByToken($token) ?? abort(404);
|
|
$this->displays->touch($screen);
|
|
|
|
return response()->json($this->displays->payload($screen));
|
|
}
|
|
|
|
public function played(string $token, VoiceAnnouncement $announcement): JsonResponse
|
|
{
|
|
$screen = $this->displays->findByToken($token) ?? abort(404);
|
|
abort_unless($announcement->branch_id === $screen->branch_id, 404);
|
|
|
|
$this->voice->markPlayed($announcement);
|
|
|
|
return response()->json(['ok' => true]);
|
|
}
|
|
}
|