@@ -1,9 +1,12 @@
|
||||
import { TerritorialFilter } from '@/components/territorial-filter';
|
||||
import type { GeographyDescription } from '@/components/administrative-location';
|
||||
import { Head, Link, useForm } from '@inertiajs/react';
|
||||
import { Printer } from 'lucide-react';
|
||||
import { PageTitle, Panel, controlClass } from '@/components/procurement';
|
||||
import { Button } from '@/components/ui/button';
|
||||
|
||||
type Filters = {
|
||||
location?: string;
|
||||
supplier_id?: string;
|
||||
responsible_id?: string;
|
||||
status?: string;
|
||||
@@ -50,6 +53,8 @@ export default function SupplierImprovementReport({
|
||||
responsibles,
|
||||
today,
|
||||
generatedAt,
|
||||
geographyEnabled = false,
|
||||
geographyFilter = null,
|
||||
}: {
|
||||
records: {
|
||||
data: Row[];
|
||||
@@ -62,6 +67,8 @@ export default function SupplierImprovementReport({
|
||||
next_page_url: string | null;
|
||||
};
|
||||
filters: Filters;
|
||||
geographyEnabled?: boolean;
|
||||
geographyFilter?: GeographyDescription;
|
||||
counts: Record<string, number>;
|
||||
overdue: number;
|
||||
suppliers: { id: number; name: string }[];
|
||||
@@ -70,6 +77,7 @@ export default function SupplierImprovementReport({
|
||||
generatedAt: string;
|
||||
}) {
|
||||
const form = useForm({
|
||||
location: filters.location ?? '',
|
||||
supplier_id: filters.supplier_id ?? '',
|
||||
responsible_id: filters.responsible_id ?? '',
|
||||
status: filters.status ?? '',
|
||||
@@ -109,6 +117,49 @@ export default function SupplierImprovementReport({
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
{geographyEnabled && (
|
||||
<Panel title="Território actual dos fornecedores">
|
||||
<div className="print:hidden">
|
||||
<TerritorialFilter
|
||||
target={base}
|
||||
initial={geographyFilter}
|
||||
extra={Object.fromEntries(
|
||||
Object.entries(filters)
|
||||
.filter(
|
||||
([key, value]) =>
|
||||
key !== 'location' &&
|
||||
value !== undefined &&
|
||||
value !== null,
|
||||
)
|
||||
.map(([key, value]) => [
|
||||
key,
|
||||
String(value),
|
||||
]),
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
<p className="mt-3 text-sm">
|
||||
{geographyFilter?.path
|
||||
.map((node) => node.name)
|
||||
.join(' / ') || 'Todos os territórios'}
|
||||
. O filtro usa a localização actual da ficha; os
|
||||
dados preservados nas avaliações mantêm a sua
|
||||
origem. Para incluir fichas sem referência ou de
|
||||
outra edição, retire o filtro.
|
||||
</p>
|
||||
{filters.location && (
|
||||
<Link
|
||||
className="mt-2 inline-block text-sm underline"
|
||||
href={
|
||||
base +
|
||||
query({ ...filters, location: undefined })
|
||||
}
|
||||
>
|
||||
Retirar filtro territorial
|
||||
</Link>
|
||||
)}
|
||||
</Panel>
|
||||
)}
|
||||
<Panel title="Filtros do acompanhamento">
|
||||
<form
|
||||
className="grid gap-4 sm:grid-cols-2 lg:grid-cols-4 print:hidden"
|
||||
|
||||
Reference in New Issue
Block a user