diff --git a/src/pages/Supplies.tsx b/src/pages/Supplies.tsx index 151a65d..b2d717f 100644 --- a/src/pages/Supplies.tsx +++ b/src/pages/Supplies.tsx @@ -2659,6 +2659,7 @@ const PurchaseNeedsScreen = () => { const PurchaseOrdersScreen = () => { const [orders, setOrders] = useState([]); const [suppliers, setSuppliers] = useState([]); + const [isAddingSupplier, setIsAddingSupplier] = useState(false); const [busy, setBusy] = useState(false); const [message, setMessage] = useState(''); const [form, setForm] = useState({ supplier: '', material: '', quantity: '', unit: 'kg', unitCost: '', expectedDate: '', notes: '' }); @@ -2676,13 +2677,13 @@ const PurchaseOrdersScreen = () => { event.preventDefault(); setBusy(true); setMessage(''); try { await createSupplyPurchaseOrder({ supplier: form.supplier, expectedDate: form.expectedDate || null, notes: form.notes, items: [{ material: form.material, quantity: parseDecimal(form.quantity), unit: form.unit, unitCost: form.unitCost ? parseDecimal(form.unitCost) : null }] }); - setForm({ supplier: '', material: '', quantity: '', unit: 'kg', unitCost: '', expectedDate: '', notes: '' }); await load(); setMessage('Ordem de compra criada. Envie ao fornecedor e atualize o status conforme o andamento.'); + setForm({ supplier: '', material: '', quantity: '', unit: 'kg', unitCost: '', expectedDate: '', notes: '' }); setIsAddingSupplier(false); await load(); setMessage('Ordem de compra criada. Envie ao fornecedor e atualize o status conforme o andamento.'); } catch (error) { setMessage(error instanceof Error ? error.message : 'Não foi possível criar a OC.'); } finally { setBusy(false); } }; const changeStatus = async (id: number, status: SupplyPurchaseOrderStatus) => { setBusy(true); try { await updateSupplyPurchaseOrderStatus(id, status); await load(); } catch (error) { setMessage(error instanceof Error ? error.message : 'Não foi possível atualizar a OC.'); } finally { setBusy(false); } }; return
{message &&
{message}
} -

Nova ordem de compra

Uma OC começa com um material. Use uma OC por fornecedor para manter o recebimento rastreável.

{suppliers.map(supplier =>