Files
compras/resources/js/pages/receipts/index.tsx
T

95 lines
4.1 KiB
TypeScript

import { Head, Link } from '@inertiajs/react';
import { InventoryNotice, InventoryPagination } from '@/components/inventory';
import { PageTitle, Panel } from '@/components/procurement';
import { date } from '@/types/procurement';
import { receiptStates } from '@/types/inventory';
import type { Page, Receipt, ReceiptProgress } from '@/types/inventory';
type IncomingOrder = {
id: number;
number: string;
supplier_name: string;
progress: ReceiptProgress;
};
export default function Receipts({
orders,
receipts,
}: {
orders: Page<IncomingOrder>;
receipts: Page<Receipt>;
}) {
return (
<>
<Head title="Recepção de bens" />
<div className="mx-auto flex w-full max-w-7xl flex-col gap-7 p-5 lg:p-8">
<PageTitle
eyebrow="Conferência e armazém"
title="Recepção de bens e serviços"
description="Recepções parciais e totais, conferência de qualidade e quantidades pendentes por ordem emitida."
/>
<InventoryNotice />
<Panel title="Ordens para conferência">
<div className="divide-y">
{orders.data.map((order) => (
<Link
key={order.id}
href={`/ordens/${order.id}/recepcoes`}
className="flex flex-wrap items-center justify-between gap-3 py-4 text-sm"
>
<div>
<strong>{order.number}</strong>
<p className="mt-1 text-muted-foreground">
{order.supplier_name}
</p>
</div>
<span>
{receiptStates[order.progress.state]}
</span>
</Link>
))}
</div>
{orders.data.length === 0 && (
<p className="py-6 text-sm text-muted-foreground">
Ainda não existem ordens emitidas disponíveis para o
seu perfil.
</p>
)}
<InventoryPagination page={orders} />
</Panel>
<Panel title="Histórico de confirmações">
<div className="divide-y">
{receipts.data.map((receipt) => (
<Link
key={receipt.id}
href={`/recepcoes/${receipt.id}`}
className="flex flex-wrap justify-between gap-3 py-4 text-sm"
>
<div>
<strong>{receipt.number}</strong> ·{' '}
{receipt.snapshot.order.number}
<p className="mt-1 text-muted-foreground">
Guia {receipt.delivery_note} ·{' '}
{receipt.snapshot.receiver.name}
</p>
</div>
<span>
{date(receipt.received_on)} ·{' '}
{receiptStates[receipt.status]}
</span>
</Link>
))}
</div>
{receipts.data.length === 0 && (
<p className="py-6 text-sm text-muted-foreground">
As recepções confirmadas ficam preservadas neste
histórico.
</p>
)}
<InventoryPagination page={receipts} />
</Panel>
</div>
</>
);
}
Receipts.layout = { breadcrumbs: [{ title: 'Recepção', href: '/recepcoes' }] };