feat: dodaj servisni kontekst u task detalji modal
Some checks failed
ERP CI/CD Pipeline / test (push) Has been cancelled
ERP CI/CD Pipeline / Deploy (server git pull + compose) (push) Has been cancelled

Dodaj gumb 'Postavi servisni kontekst' u zaglavlje modala Radni zadatak detalji i poveži ga s postojećom logikom postavljanja konteksta prema dizalici zadatka.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
mariomitte
2026-07-20 12:00:54 +02:00
parent b92596f6a6
commit 42fcd836ed
2 changed files with 22 additions and 8 deletions

View File

@@ -1364,6 +1364,10 @@ export default function FleetDashboardShell({ initialSection = 'dashboard', page
setServiceRecordCrane(taskCrane ?? null);
setServiceRecordOpen(true);
}}
onSetServiceContext={(task) => {
const taskCrane = cranes.find((item) => String(item.id) === String(task?.vehicle));
handleSetServiceContextForCrane(taskCrane);
}}
/>
</AnimatedPage>
);

View File

@@ -36,6 +36,7 @@ export default function TaskServiceRecordsModal({
onAssignWorkOrder,
onUpdateTask,
onCreateServiceRecord,
onSetServiceContext,
}) {
const [showWorkOrderEditor, setShowWorkOrderEditor] = useState(false);
const [selectedWorkOrderId, setSelectedWorkOrderId] = useState('');
@@ -170,14 +171,23 @@ export default function TaskServiceRecordsModal({
Radni zadatak: {task.title || '-'} Status: {getStatusLabel(task.status || '-')} Zapisa: {records.length}
</p>
</div>
<button
type="button"
onClick={onClose}
className="rounded-md px-2 py-1 text-sm text-text-muted hover:bg-canvas-deep"
aria-label="Zatvori"
>
</button>
<div className="flex items-center gap-2">
<button
type="button"
onClick={() => onSetServiceContext?.(task)}
className="btn-erp rounded-md bg-emerald-600 px-3 py-1 text-xs font-semibold normal-case tracking-normal text-white hover:bg-emerald-700"
>
Postavi servisni kontekst
</button>
<button
type="button"
onClick={onClose}
className="rounded-md px-2 py-1 text-sm text-text-muted hover:bg-canvas-deep"
aria-label="Zatvori"
>
</button>
</div>
</div>
<div className="max-h-[calc(100vh-12rem)] overflow-y-auto p-4">