Compare commits
3
Commits
9be2aa3468
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a58647a67d | ||
|
|
47bed5a5ab | ||
|
|
bac9b0a1e5 |
@@ -90,6 +90,8 @@ LAVERIE_BOOKING_PENALTY_AMOUNT=3.00
|
|||||||
|
|
||||||
# Machines
|
# Machines
|
||||||
LAVERIE_MACHINE_OFFLINE_THRESHOLD_MINUTES=10
|
LAVERIE_MACHINE_OFFLINE_THRESHOLD_MINUTES=10
|
||||||
|
# Désactiver le passage automatique en hors ligne (démo / dev sans matériel)
|
||||||
|
LAVERIE_MACHINE_OFFLINE_CHECK_ENABLED=false
|
||||||
|
|
||||||
# Paiements
|
# Paiements
|
||||||
LAVERIE_PAYMENT_PROVIDER=stripe
|
LAVERIE_PAYMENT_PROVIDER=stripe
|
||||||
|
|||||||
@@ -89,6 +89,10 @@ class MachinePageController extends Controller
|
|||||||
$validated['qr_code'] = $this->resolveQrCode($validated['qr_code'] ?? null);
|
$validated['qr_code'] = $this->resolveQrCode($validated['qr_code'] ?? null);
|
||||||
$validated['status'] = $validated['status'] ?? 'available';
|
$validated['status'] = $validated['status'] ?? 'available';
|
||||||
|
|
||||||
|
if ($validated['status'] === 'available') {
|
||||||
|
$validated['last_heartbeat_at'] = now();
|
||||||
|
}
|
||||||
|
|
||||||
$machine = Machine::query()->create($validated);
|
$machine = Machine::query()->create($validated);
|
||||||
$this->createSimulatedIntegration($machine);
|
$this->createSimulatedIntegration($machine);
|
||||||
|
|
||||||
@@ -108,6 +112,14 @@ class MachinePageController extends Controller
|
|||||||
unset($validated['qr_code']);
|
unset($validated['qr_code']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
array_key_exists('status', $validated)
|
||||||
|
&& $validated['status'] === 'available'
|
||||||
|
&& $machine->status !== 'available'
|
||||||
|
) {
|
||||||
|
$validated['last_heartbeat_at'] = now();
|
||||||
|
}
|
||||||
|
|
||||||
$machine->update($validated);
|
$machine->update($validated);
|
||||||
|
|
||||||
return redirect()->route('supervisor.machines.index')
|
return redirect()->route('supervisor.machines.index')
|
||||||
|
|||||||
@@ -15,6 +15,10 @@ class RefreshOfflineMachines implements ShouldQueue
|
|||||||
|
|
||||||
public function handle(): void
|
public function handle(): void
|
||||||
{
|
{
|
||||||
|
if (! config('laverie.machine.offline_check_enabled', true)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$thresholdMinutes = (int) config('laverie.machine.offline_threshold_minutes', 10);
|
$thresholdMinutes = (int) config('laverie.machine.offline_threshold_minutes', 10);
|
||||||
$cutoff = now()->subMinutes($thresholdMinutes);
|
$cutoff = now()->subMinutes($thresholdMinutes);
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -5,7 +5,7 @@
|
|||||||
"description": "The skeleton application for the Laravel framework.",
|
"description": "The skeleton application for the Laravel framework.",
|
||||||
"keywords": ["laravel", "framework"],
|
"keywords": ["laravel", "framework"],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"version": "0.0.2",
|
"version": "0.0.3",
|
||||||
"require": {
|
"require": {
|
||||||
"php": "^8.3",
|
"php": "^8.3",
|
||||||
"inertiajs/inertia-laravel": "^2.0",
|
"inertiajs/inertia-laravel": "^2.0",
|
||||||
|
|||||||
@@ -16,6 +16,10 @@ return [
|
|||||||
|
|
||||||
'machine' => [
|
'machine' => [
|
||||||
'offline_threshold_minutes' => (int) env('LAVERIE_MACHINE_OFFLINE_THRESHOLD_MINUTES', 10),
|
'offline_threshold_minutes' => (int) env('LAVERIE_MACHINE_OFFLINE_THRESHOLD_MINUTES', 10),
|
||||||
|
'offline_check_enabled' => filter_var(
|
||||||
|
env('LAVERIE_MACHINE_OFFLINE_CHECK_ENABLED', true),
|
||||||
|
FILTER_VALIDATE_BOOL
|
||||||
|
),
|
||||||
],
|
],
|
||||||
|
|
||||||
'payment' => [
|
'payment' => [
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
"$schema": "https://www.schemastore.org/package.json",
|
"$schema": "https://www.schemastore.org/package.json",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "0.0.2",
|
"version": "0.0.3",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"prod": "vite build",
|
"prod": "vite build",
|
||||||
"dev": "vite"
|
"dev": "vite"
|
||||||
|
|||||||
Reference in New Issue
Block a user