commit21
This commit is contained in:
@@ -16,6 +16,7 @@ type Row = {
|
||||
number: string;
|
||||
status: string;
|
||||
created_at: string;
|
||||
needed_by: string | null;
|
||||
department: string | null;
|
||||
requester: string | null;
|
||||
total_minor: string;
|
||||
@@ -23,6 +24,7 @@ type Row = {
|
||||
order_number: string | null;
|
||||
};
|
||||
type Filters = {
|
||||
attention?: string;
|
||||
search?: string;
|
||||
status?: string;
|
||||
from?: string;
|
||||
@@ -61,11 +63,18 @@ export default function ProcurementReports({
|
||||
from: filters.from ?? '',
|
||||
to: filters.to ?? '',
|
||||
department_id: String(filters.department_id ?? ''),
|
||||
attention: filters.attention ?? '',
|
||||
});
|
||||
const params = new URLSearchParams();
|
||||
for (const [key, value] of Object.entries(filters))
|
||||
if (value !== null && value !== undefined && value !== '')
|
||||
params.set(key, String(value));
|
||||
const attentionParams = new URLSearchParams(params);
|
||||
attentionParams.set('attention', 'unapproved_needed');
|
||||
const quoteParams = new URLSearchParams(params);
|
||||
quoteParams.set('attention', 'approved_without_quotes');
|
||||
const orderParams = new URLSearchParams(params);
|
||||
orderParams.set('attention', 'approved_without_order');
|
||||
return (
|
||||
<>
|
||||
<Head title="Relatórios de compras" />
|
||||
@@ -83,7 +92,14 @@ export default function ProcurementReports({
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
{insights && <ProcurementOperationalInsights data={insights} />}
|
||||
{insights && (
|
||||
<ProcurementOperationalInsights
|
||||
data={insights}
|
||||
neededPastHref={`/relatorios?${attentionParams}`}
|
||||
withoutQuotesHref={`/relatorios?${quoteParams}`}
|
||||
withoutOrderHref={`/relatorios?${orderParams}`}
|
||||
/>
|
||||
)}
|
||||
<Panel
|
||||
title="Filtrar requisições"
|
||||
description="O período refere-se à criação da requisição. Os resultados respeitam o seu acesso à empresa e ao departamento."
|
||||
@@ -166,6 +182,31 @@ export default function ProcurementReports({
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
<label className="grid gap-1 text-sm">
|
||||
Acompanhamento
|
||||
<select
|
||||
className={controlClass}
|
||||
value={form.data.attention}
|
||||
onChange={(event) =>
|
||||
form.setData(
|
||||
'attention',
|
||||
event.target.value,
|
||||
)
|
||||
}
|
||||
>
|
||||
<option value="">Todos</option>
|
||||
<option value="unapproved_needed">
|
||||
Data de necessidade ultrapassada, por
|
||||
aprovar
|
||||
</option>
|
||||
<option value="approved_without_quotes">
|
||||
Aprovadas sem propostas registadas
|
||||
</option>
|
||||
<option value="approved_without_order">
|
||||
Aprovadas sem ordem visível
|
||||
</option>
|
||||
</select>
|
||||
</label>
|
||||
<div className="flex items-end gap-3">
|
||||
<Button type="submit" disabled={form.processing}>
|
||||
Aplicar filtros
|
||||
@@ -240,6 +281,12 @@ export default function ProcurementReports({
|
||||
<span className="block text-muted-foreground">
|
||||
{date(row.created_at)}
|
||||
</span>
|
||||
{row.needed_by && (
|
||||
<span className="block text-sm">
|
||||
Necessário em{' '}
|
||||
{row.needed_by}
|
||||
</span>
|
||||
)}
|
||||
</td>
|
||||
<td className="p-2">
|
||||
{row.department ??
|
||||
|
||||
Reference in New Issue
Block a user