Deploy Ladill Queue / deploy (push) Successful in 36s
Remove waiting, estimate, and service queue sidebar; replace text header with customer logo when uploaded. Co-authored-by: Cursor <cursoragent@cursor.com>
62 lines
2.0 KiB
PHP
62 lines
2.0 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 App\Support\OrganizationBranding;
|
|
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);
|
|
|
|
$payload = $this->displays->payload($screen);
|
|
$organization = $screen->organization;
|
|
|
|
return view('qms.display.public', [
|
|
'screen' => $screen,
|
|
'initialPayload' => $payload,
|
|
'dataUrl' => '/display/'.$token.'/data',
|
|
'playedUrl' => '/display/'.$token.'/announcements/__ID__/played',
|
|
'pollMs' => config('qms.display_poll_ms', 1200),
|
|
'logoUrl' => $organization
|
|
? OrganizationBranding::logoUrl($organization)
|
|
: asset(OrganizationBranding::DEFAULT_LOGO),
|
|
'logoAlt' => $organization
|
|
? OrganizationBranding::logoAlt($organization)
|
|
: 'Ladill Queue',
|
|
]);
|
|
}
|
|
|
|
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]);
|
|
}
|
|
}
|