diff --git a/mechanic-pwa/frontend/src/pages/InspectionReview.tsx b/mechanic-pwa/frontend/src/pages/InspectionReview.tsx index 30ebb1a..567c5a2 100644 --- a/mechanic-pwa/frontend/src/pages/InspectionReview.tsx +++ b/mechanic-pwa/frontend/src/pages/InspectionReview.tsx @@ -14,6 +14,7 @@ import { AuthImg } from "@/components/AuthImg"; import { ttImageUrl } from "@/api/vehicles"; import { VendorVehicleScheme } from "@/components/vehicle-scheme/VendorVehicleScheme"; import { Card } from "@/components/ui/card"; +import { Button } from "@/components/ui/button"; import { loadZoneLabels } from "@/data/zoneLabels"; const STATUS_LABELS: Record = { @@ -138,6 +139,19 @@ export default function InspectionReview() { onError: () => toast.error("Не удалось сохранить заметку"), }); + // Осмотр закрыт не механиком, а автоматикой — вернуть в работу и дать + // доснять. Без этой кнопки механик, вернувшийся через три часа, упирается в + // заблокированную карточку и вынужден заводить осмотр заново. + const reopenMutation = useMutation({ + mutationFn: () => patchInspection(insId, { status: "in_progress" }), + onSuccess: (updated) => { + queryClient.setQueryData(["inspection", insId], updated); + queryClient.invalidateQueries({ queryKey: ["vehicle"] }); + navigate(`/inspections/${insId}/edit`); + }, + onError: () => toast.error("Не удалось вернуть осмотр в работу"), + }); + if (isLoading) return
Загружаю…
; if (isError || !ins) return
Осмотр не найден.
; @@ -233,6 +247,27 @@ export default function InspectionReview() { )} + {ins.meta?.auto_completed === true && ( + +
+
Закрыт автоматически
+

+ Осмотр несколько часов никто не открывал, поэтому система завершила + его сама — чтобы фотографии не пропали из отчётов. Если работа не + доделана, верните осмотр в работу и продолжите. +

+
+ +
+ )} +

Заметки механика