Deploy Ladill Queue / deploy (push) Successful in 56s
Phases 1–6: tickets, counters, displays, appointments, workflows, rules, analytics, reports, feedback, admin, device API, and Gitea deploy workflow for queue.ladill.com. Co-authored-by: Cursor <cursoragent@cursor.com>
53 lines
1.7 KiB
PHP
53 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Qms;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Http\Controllers\Qms\Concerns\ScopesToAccount;
|
|
use App\Models\ServiceQueue;
|
|
use App\Models\Ticket;
|
|
use App\Services\Qms\OrganizationResolver;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\View\View;
|
|
|
|
class QueueBoardController extends Controller
|
|
{
|
|
use ScopesToAccount;
|
|
|
|
public function index(Request $request): View
|
|
{
|
|
$this->authorizeAbility($request, 'queues.view');
|
|
$owner = $this->ownerRef($request);
|
|
$organization = $this->organization($request);
|
|
$branchScope = app(OrganizationResolver::class)->branchScope($this->member($request));
|
|
|
|
$queues = ServiceQueue::owned($owner)
|
|
->where('organization_id', $organization->id)
|
|
->when($branchScope, fn ($q) => $q->where('branch_id', $branchScope))
|
|
->where('is_active', true)
|
|
->with('branch')
|
|
->orderBy('name')
|
|
->get();
|
|
|
|
$waiting = Ticket::owned($owner)
|
|
->where('organization_id', $organization->id)
|
|
->where('status', 'waiting')
|
|
->when($branchScope, fn ($q) => $q->where('branch_id', $branchScope))
|
|
->with('serviceQueue')
|
|
->orderBy('issued_at')
|
|
->limit(100)
|
|
->get();
|
|
|
|
$serving = Ticket::owned($owner)
|
|
->where('organization_id', $organization->id)
|
|
->whereIn('status', ['called', 'serving'])
|
|
->when($branchScope, fn ($q) => $q->where('branch_id', $branchScope))
|
|
->with(['serviceQueue', 'counter'])
|
|
->orderByDesc('called_at')
|
|
->limit(20)
|
|
->get();
|
|
|
|
return view('qms.board.index', compact('organization', 'queues', 'waiting', 'serving'));
|
|
}
|
|
}
|