10-04-2026

This commit is contained in:
Kevin Adametz 2026-04-10 17:18:17 +02:00
parent 4d6b4930b2
commit 4bb89aad8c
836 changed files with 52961 additions and 5950 deletions

View file

@ -0,0 +1,54 @@
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Models\CabinetTabletSetting;
use Illuminate\Http\JsonResponse;
class CabinetTabletController extends Controller
{
/**
* Full status response for the info-tablet.
*/
public function status(): JsonResponse
{
$settings = CabinetTabletSetting::current();
$computed = $settings->computeStatus();
return response()->json([
'store_status' => $computed['status'],
'today_close' => $computed['today_close'],
'next_open' => $computed['next_open'],
'notice_headline' => $settings->notice_headline,
'notice_subtext' => $settings->notice_subtext,
'override_open_today' => $settings->override_open_today,
'override_close_today' => $settings->override_close_today,
'next_appointment' => [
'date' => $settings->next_appointment_date?->format('Y-m-d'),
'time' => $settings->next_appointment_time,
],
'hours' => $settings->getHoursArray(),
'contact' => [
'phone' => $settings->contact_phone,
'email' => $settings->contact_email,
],
'updated_at' => $settings->updated_at?->toIso8601String(),
]);
}
/**
* Lightweight check returns the timestamp and current computed status
* so the tablet can detect both settings changes and time-based open/close transitions.
*/
public function check(): JsonResponse
{
$settings = CabinetTabletSetting::current();
$computed = $settings->computeStatus();
return response()->json([
'updated_at' => $settings->updated_at?->toIso8601String(),
'store_status' => $computed['status'],
]);
}
}