import { Head, Link, useForm } from '@inertiajs/react'; import { PageTitle, Panel, FormErrors, controlClass, } from '@/components/procurement'; import { Button } from '@/components/ui/button'; type Item = { id: number; code: string; name: string; unit: string }; type Line = { stock_item_id: string; quantity: string; use: string; equipment_id: string; }; type Snapshot = { requester: { name: string }; warehouse: { name: string }; cost_center: { code: string; name: string }; destination: string; reason: string; priority: string; lines: { item: Item; quantity_milli: number; use: string; destination: string; equipment: { code: string; description: string } | null; }[]; }; type Props = { ready: boolean; canPrepare: boolean; items: Item[]; warehouses: { id: number; code: string; name: string }[]; costCenters: { id: number; code: string; name: string }[]; equipment: { id: number; code: string; description: string }[]; records: null | { data: { id: number; status: string; snapshot: Snapshot; progress?: { state: string }; }[]; prev_page_url: string | null; next_page_url: string | null; }; }; const blank = (): Line => ({ stock_item_id: '', quantity: '', use: 'internal', equipment_id: '', }); export default function Requests(props: Props) { const form = useForm({ operation_key: crypto.randomUUID(), warehouse_id: '', cost_center_id: '', destination: '', reason: '', priority: 'normal', lines: [blank()], }); const line = (index: number, values: Partial) => form.setData( 'lines', form.data.lines.map((row, i) => i === index ? { ...row, ...values } : row, ), ); return ( <>

Uso interno sem factura: a requisição autorizada acompanha a saída e as entregas. Reserva física exclusiva e geração automática de compra por falta ainda estão em implementação. A venda a terceiros pertence à composição SGF.

Consultar disponibilidade (conforme o seu acesso) {!props.ready ? (

O registo de requisições ainda não está instalado.

) : ( props.canPrepare && (
{ e.preventDefault(); form.post('/stock/requisicoes', { preserveState: 'errors', }); }} >