inspection-editor: блок «Заметки механика» поднят под схему
Раньше textarea для заметок жил в самом низу страницы, после фото-сетки и списка меток — на плановом осмотре приходилось много скроллить чтобы добраться до основного поля ввода. Перенёс Card 'Заметки механика' сразу под Card 'Схема'. На плановом осмотре текстовое поле теперь второе на странице — не надо листать.
This commit is contained in:
@@ -230,6 +230,48 @@ export default function InspectionEditor() {
|
||||
/>
|
||||
</Card>
|
||||
|
||||
{/* Блок «Заметки» поднят сразу под схему — главное текстовое поле для
|
||||
планового осмотра, не хочется чтобы механик пролистывал фото+метки
|
||||
чтобы добраться до textarea. */}
|
||||
<Card className="p-4 space-y-2">
|
||||
<h2 className="text-sm font-semibold text-muted-foreground">
|
||||
Заметки механика
|
||||
</h2>
|
||||
{editable ? (
|
||||
<>
|
||||
<textarea
|
||||
value={notesDraft}
|
||||
onChange={(e) => setNotesDraft(e.target.value)}
|
||||
placeholder="Текст осмотра, замечания, рекомендации…"
|
||||
rows={Math.max(3, Math.min(notesDraft.split("\n").length + 1, 12))}
|
||||
className="w-full text-sm p-2 rounded border border-input bg-background resize-y focus:outline-none focus:ring-2 focus:ring-ring"
|
||||
/>
|
||||
{(notesDraft ?? "") !== (ins.notes ?? "") && (
|
||||
<div className="flex gap-2 justify-end">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setNotesDraft(ins.notes ?? "")}
|
||||
className="text-xs text-muted-foreground hover:text-foreground px-3 py-1"
|
||||
disabled={notesMutation.isPending}
|
||||
>
|
||||
Отменить
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => notesMutation.mutate(notesDraft)}
|
||||
disabled={notesMutation.isPending}
|
||||
className="text-xs bg-primary text-primary-foreground rounded px-3 py-1 disabled:opacity-60"
|
||||
>
|
||||
{notesMutation.isPending ? "Сохраняю…" : "Сохранить"}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
<div className="text-sm whitespace-pre-wrap">{ins.notes || "—"}</div>
|
||||
)}
|
||||
</Card>
|
||||
|
||||
{/* Multi-step damage flow */}
|
||||
{flow.kind === "confirm" && (
|
||||
<ZoneConfirmDialog
|
||||
@@ -468,46 +510,6 @@ export default function InspectionEditor() {
|
||||
</div>
|
||||
)}
|
||||
|
||||
<Card className="p-4 space-y-2">
|
||||
<h2 className="text-sm font-semibold text-muted-foreground">
|
||||
Заметки механика
|
||||
</h2>
|
||||
{editable ? (
|
||||
<>
|
||||
<textarea
|
||||
value={notesDraft}
|
||||
onChange={(e) => setNotesDraft(e.target.value)}
|
||||
placeholder="Текст осмотра, замечания, рекомендации…"
|
||||
rows={Math.max(3, Math.min(notesDraft.split("\n").length + 1, 12))}
|
||||
className="w-full text-sm p-2 rounded border border-input bg-background resize-y focus:outline-none focus:ring-2 focus:ring-ring"
|
||||
/>
|
||||
{(notesDraft ?? "") !== (ins.notes ?? "") && (
|
||||
<div className="flex gap-2 justify-end">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setNotesDraft(ins.notes ?? "")}
|
||||
className="text-xs text-muted-foreground hover:text-foreground px-3 py-1"
|
||||
disabled={notesMutation.isPending}
|
||||
>
|
||||
Отменить
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => notesMutation.mutate(notesDraft)}
|
||||
disabled={notesMutation.isPending}
|
||||
className="text-xs bg-primary text-primary-foreground rounded px-3 py-1 disabled:opacity-60"
|
||||
>
|
||||
{notesMutation.isPending ? "Сохраняю…" : "Сохранить"}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
// Осмотр уже завершён — показываем как read-only текст.
|
||||
<div className="text-sm whitespace-pre-wrap">{ins.notes || "—"}</div>
|
||||
)}
|
||||
</Card>
|
||||
|
||||
{editable && (
|
||||
<Button
|
||||
className="w-full"
|
||||
|
||||
Reference in New Issue
Block a user