@@ -124,161 +124,264 @@ export default function ProcurementReports({
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
<nav
|
||||
aria-label="Secções dos relatórios"
|
||||
className="flex flex-wrap gap-2 print:hidden"
|
||||
>
|
||||
{[
|
||||
{
|
||||
id: 'report-filters',
|
||||
label: 'Filtros e requisições',
|
||||
available: true,
|
||||
},
|
||||
{
|
||||
id: 'report-operational',
|
||||
label: 'Acompanhamento',
|
||||
available: !!insights,
|
||||
},
|
||||
{
|
||||
id: 'report-payables',
|
||||
label: 'Obrigações',
|
||||
available: !!payableInsights,
|
||||
},
|
||||
{
|
||||
id: 'report-deliveries',
|
||||
label: 'Entregas',
|
||||
available: !!deliveryInsights,
|
||||
},
|
||||
{
|
||||
id: 'report-payments',
|
||||
label: 'Despesa confirmada',
|
||||
available: !!paymentInsights,
|
||||
},
|
||||
{
|
||||
id: 'report-contracts',
|
||||
label: 'Contratos',
|
||||
available: !!contractInsights,
|
||||
},
|
||||
]
|
||||
.filter((section) => section.available)
|
||||
.map((section) => (
|
||||
<a
|
||||
key={section.id}
|
||||
href={`#${section.id}`}
|
||||
className="rounded-lg border bg-card px-3 py-2 text-sm font-medium hover:border-teal-600 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-teal-700"
|
||||
>
|
||||
{section.label}
|
||||
</a>
|
||||
))}
|
||||
</nav>
|
||||
{insights && (
|
||||
<ProcurementOperationalInsights
|
||||
data={insights}
|
||||
neededPastHref={`/relatorios?${attentionParams}`}
|
||||
withoutQuotesHref={`/relatorios?${quoteParams}`}
|
||||
withoutOrderHref={`/relatorios?${orderParams}`}
|
||||
/>
|
||||
<section
|
||||
id="report-operational"
|
||||
aria-label="Acompanhamento"
|
||||
tabIndex={-1}
|
||||
className="scroll-mt-24 lg:scroll-mt-72"
|
||||
>
|
||||
<ProcurementOperationalInsights
|
||||
data={insights}
|
||||
neededPastHref={`/relatorios?${attentionParams}`}
|
||||
withoutQuotesHref={`/relatorios?${quoteParams}`}
|
||||
withoutOrderHref={`/relatorios?${orderParams}`}
|
||||
/>
|
||||
</section>
|
||||
)}
|
||||
{payableInsights && (
|
||||
<ProcurementPayableInsights
|
||||
data={payableInsights}
|
||||
exportHref={`/relatorios/obrigacoes.csv?${params}`}
|
||||
/>
|
||||
<section
|
||||
id="report-payables"
|
||||
aria-label="Obrigações"
|
||||
tabIndex={-1}
|
||||
className="scroll-mt-24 lg:scroll-mt-72"
|
||||
>
|
||||
<ProcurementPayableInsights
|
||||
data={payableInsights}
|
||||
exportHref={`/relatorios/obrigacoes.csv?${params}`}
|
||||
/>
|
||||
</section>
|
||||
)}
|
||||
{deliveryInsights && (
|
||||
<ProcurementDeliveryInsights
|
||||
data={deliveryInsights}
|
||||
pageHref={`/relatorios?${params}`}
|
||||
exportHref={`/relatorios/entregas.csv?${params}`}
|
||||
/>
|
||||
<section
|
||||
id="report-deliveries"
|
||||
aria-label="Entregas"
|
||||
tabIndex={-1}
|
||||
className="scroll-mt-24 lg:scroll-mt-72"
|
||||
>
|
||||
<ProcurementDeliveryInsights
|
||||
data={deliveryInsights}
|
||||
pageHref={`/relatorios?${params}`}
|
||||
exportHref={`/relatorios/entregas.csv?${params}`}
|
||||
/>
|
||||
</section>
|
||||
)}
|
||||
{paymentInsights && (
|
||||
<ProcurementPaymentInsights
|
||||
data={paymentInsights}
|
||||
exportHref={`/relatorios/despesa.csv?${params}`}
|
||||
pageHref={`/relatorios?${params}`}
|
||||
/>
|
||||
<section
|
||||
id="report-payments"
|
||||
aria-label="Despesa confirmada"
|
||||
tabIndex={-1}
|
||||
className="scroll-mt-24 lg:scroll-mt-72"
|
||||
>
|
||||
<ProcurementPaymentInsights
|
||||
data={paymentInsights}
|
||||
exportHref={`/relatorios/despesa.csv?${params}`}
|
||||
pageHref={`/relatorios?${params}`}
|
||||
/>
|
||||
</section>
|
||||
)}
|
||||
{contractInsights && (
|
||||
<ProcurementContractInsights
|
||||
data={contractInsights}
|
||||
exportHref={`/relatorios/contratos.csv?${params}`}
|
||||
/>
|
||||
)}
|
||||
<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."
|
||||
>
|
||||
<form
|
||||
className="grid gap-4 sm:grid-cols-2 lg:grid-cols-3"
|
||||
onSubmit={(event) => {
|
||||
event.preventDefault();
|
||||
form.get('/relatorios', { preserveState: true });
|
||||
}}
|
||||
<section
|
||||
id="report-contracts"
|
||||
aria-label="Contratos"
|
||||
tabIndex={-1}
|
||||
className="scroll-mt-24 lg:scroll-mt-72"
|
||||
>
|
||||
<label className="grid gap-1 text-sm">
|
||||
Número da requisição
|
||||
<input
|
||||
className={controlClass}
|
||||
value={form.data.search}
|
||||
onChange={(event) =>
|
||||
form.setData('search', event.target.value)
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
<label className="grid gap-1 text-sm">
|
||||
Estado da requisição
|
||||
<select
|
||||
className={controlClass}
|
||||
value={form.data.status}
|
||||
onChange={(event) =>
|
||||
form.setData('status', event.target.value)
|
||||
}
|
||||
>
|
||||
<option value="">Todos</option>
|
||||
{Object.entries(statusLabels).map(
|
||||
([value, label]) => (
|
||||
<option key={value} value={value}>
|
||||
{label}
|
||||
</option>
|
||||
),
|
||||
)}
|
||||
</select>
|
||||
</label>
|
||||
<label className="grid gap-1 text-sm">
|
||||
Departamento
|
||||
<select
|
||||
className={controlClass}
|
||||
value={form.data.department_id}
|
||||
onChange={(event) =>
|
||||
form.setData(
|
||||
'department_id',
|
||||
event.target.value,
|
||||
)
|
||||
}
|
||||
>
|
||||
<option value="">Todos os autorizados</option>
|
||||
{departments.map((item) => (
|
||||
<option key={item.id} value={item.id}>
|
||||
{item.name}
|
||||
<ProcurementContractInsights
|
||||
data={contractInsights}
|
||||
exportHref={`/relatorios/contratos.csv?${params}`}
|
||||
/>
|
||||
</section>
|
||||
)}
|
||||
<section
|
||||
id="report-filters"
|
||||
aria-label="Filtros e requisições"
|
||||
tabIndex={-1}
|
||||
className="scroll-mt-24 lg:scroll-mt-72"
|
||||
>
|
||||
<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."
|
||||
>
|
||||
<form
|
||||
data-query-form="true"
|
||||
className="grid gap-4 sm:grid-cols-2 lg:grid-cols-3"
|
||||
onSubmit={(event) => {
|
||||
event.preventDefault();
|
||||
form.get('/relatorios', {
|
||||
preserveState: true,
|
||||
});
|
||||
}}
|
||||
>
|
||||
<label className="grid gap-1 text-sm">
|
||||
Número da requisição
|
||||
<input
|
||||
className={controlClass}
|
||||
value={form.data.search}
|
||||
onChange={(event) =>
|
||||
form.setData(
|
||||
'search',
|
||||
event.target.value,
|
||||
)
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
<label className="grid gap-1 text-sm">
|
||||
Estado da requisição
|
||||
<select
|
||||
className={controlClass}
|
||||
value={form.data.status}
|
||||
onChange={(event) =>
|
||||
form.setData(
|
||||
'status',
|
||||
event.target.value,
|
||||
)
|
||||
}
|
||||
>
|
||||
<option value="">Todos</option>
|
||||
{Object.entries(statusLabels).map(
|
||||
([value, label]) => (
|
||||
<option key={value} value={value}>
|
||||
{label}
|
||||
</option>
|
||||
),
|
||||
)}
|
||||
</select>
|
||||
</label>
|
||||
<label className="grid gap-1 text-sm">
|
||||
Departamento
|
||||
<select
|
||||
className={controlClass}
|
||||
value={form.data.department_id}
|
||||
onChange={(event) =>
|
||||
form.setData(
|
||||
'department_id',
|
||||
event.target.value,
|
||||
)
|
||||
}
|
||||
>
|
||||
<option value="">
|
||||
Todos os autorizados
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
<label className="grid gap-1 text-sm">
|
||||
Criada desde
|
||||
<input
|
||||
type="date"
|
||||
className={controlClass}
|
||||
value={form.data.from}
|
||||
onChange={(event) =>
|
||||
form.setData('from', event.target.value)
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
<label className="grid gap-1 text-sm">
|
||||
Criada até
|
||||
<input
|
||||
type="date"
|
||||
className={controlClass}
|
||||
value={form.data.to}
|
||||
onChange={(event) =>
|
||||
form.setData('to', event.target.value)
|
||||
}
|
||||
/>
|
||||
</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>
|
||||
<ActionBar>
|
||||
<Button type="submit" disabled={form.processing}>
|
||||
Aplicar filtros
|
||||
</Button>
|
||||
<Link
|
||||
className="py-2 text-sm underline"
|
||||
href="/relatorios"
|
||||
>
|
||||
Limpar
|
||||
</Link>
|
||||
</ActionBar>
|
||||
<FormErrors errors={form.errors} />
|
||||
</form>
|
||||
</Panel>
|
||||
{departments.map((item) => (
|
||||
<option key={item.id} value={item.id}>
|
||||
{item.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
<label className="grid gap-1 text-sm">
|
||||
Criada desde
|
||||
<input
|
||||
type="date"
|
||||
className={controlClass}
|
||||
value={form.data.from}
|
||||
onChange={(event) =>
|
||||
form.setData('from', event.target.value)
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
<label className="grid gap-1 text-sm">
|
||||
Criada até
|
||||
<input
|
||||
type="date"
|
||||
className={controlClass}
|
||||
value={form.data.to}
|
||||
onChange={(event) =>
|
||||
form.setData('to', event.target.value)
|
||||
}
|
||||
/>
|
||||
</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>
|
||||
<ActionBar>
|
||||
<Button
|
||||
type="submit"
|
||||
disabled={form.processing}
|
||||
>
|
||||
Aplicar filtros
|
||||
</Button>
|
||||
<Link
|
||||
className="py-2 text-sm underline"
|
||||
href="/relatorios"
|
||||
>
|
||||
Limpar
|
||||
</Link>
|
||||
</ActionBar>
|
||||
<FormErrors errors={form.errors} />
|
||||
</form>
|
||||
</Panel>
|
||||
</section>
|
||||
<section
|
||||
aria-label="Resumo dos resultados"
|
||||
className="flex flex-wrap gap-3"
|
||||
|
||||
Reference in New Issue
Block a user