Initial Ladill Queue release — enterprise QMS standalone app.
Deploy Ladill Queue / deploy (push) Successful in 56s
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>
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api;
|
||||
|
||||
use App\Http\Controllers\Api\Concerns\ScopesApiToAccount;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Services\Qms\OrganizationResolver;
|
||||
use App\Services\Qms\ReportService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
class ReportController extends Controller
|
||||
{
|
||||
use ScopesApiToAccount;
|
||||
|
||||
public function show(Request $request, string $type, ReportService $reports): JsonResponse
|
||||
{
|
||||
abort_unless(array_key_exists($type, config('qms.report_types')), 404);
|
||||
$this->authorizeAbility($request, 'reports.view');
|
||||
|
||||
$organization = $this->organization($request);
|
||||
$branchScope = app(OrganizationResolver::class)->branchScope($this->member($request));
|
||||
$branchId = $request->input('branch_id') ? (int) $request->input('branch_id') : $branchScope;
|
||||
$from = Carbon::parse($request->input('from', now()->subDays(30)->toDateString()))->startOfDay();
|
||||
$to = Carbon::parse($request->input('to', now()->toDateString()))->endOfDay();
|
||||
$owner = $this->ownerRef($request);
|
||||
|
||||
$data = match ($type) {
|
||||
'tickets' => $reports->ticketsReport($owner, $organization->id, $from, $to, $branchId),
|
||||
'wait_times' => $reports->waitTimesReport($owner, $organization->id, $from, $to, $branchId),
|
||||
'counters' => $reports->countersReport($owner, $organization->id, $from, $to, $branchId),
|
||||
'appointments' => $reports->appointmentsReport($owner, $organization->id, $from, $to, $branchId),
|
||||
'feedback' => $reports->feedbackReport($owner, $organization->id, $from, $to, $branchId),
|
||||
'service_sessions' => $reports->serviceSessionsReport($owner, $organization->id, $from, $to, $branchId),
|
||||
default => abort(404),
|
||||
};
|
||||
|
||||
return response()->json(['data' => $data, 'from' => $from->toDateString(), 'to' => $to->toDateString()]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user