$editor->listing(), 'schedulingAvailable' => app(DeskServiceAvailability::class)->scheduled(), 'today' => now()->toDateString(), 'calendarTimezone' => config('app.timezone')]; return $request->expectsJson() ? response()->json($data) : Inertia::render('desk/service-editor', $data); } public function publish(Request $request, DeskServiceEditor $editor, string $code): JsonResponse|RedirectResponse { $row = $editor->publish($request->user(), $code, $request->all()); return $request->expectsJson() ? response()->json(['id' => $row->id, 'version' => $row->version, 'effective_from' => $row->effective_from ?? null], 201) : back()->with('success', 'Versão publicada'.(($row->effective_from ?? null) ? ' com entrada em vigor em '.$row->effective_from : '').'. Os pedidos existentes conservam a sua versão.'); } public function history(Request $request, DeskServiceEditor $editor, string $code): JsonResponse { $data = $request->validate(['page' => ['nullable', 'integer', 'min:1']]); return response()->json($editor->history($code, (int) ($data['page'] ?? 1))); } }