@@ -141,3 +141,68 @@
|
||||
@apply bg-background text-foreground;
|
||||
}
|
||||
}
|
||||
|
||||
/* Shared procurement presentation. Rules and document data remain in their existing owners. */
|
||||
@layer components {
|
||||
.sgc-panel :where(input, select, textarea) {
|
||||
min-inline-size: 0;
|
||||
max-inline-size: 100%;
|
||||
}
|
||||
|
||||
.sgc-panel > div {
|
||||
min-inline-size: 0;
|
||||
}
|
||||
|
||||
.sgc-page-actions > .flex {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.sgc-action-bar > :is(button, a) {
|
||||
min-block-size: 2.5rem;
|
||||
white-space: normal;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.sgc-table-viewport table {
|
||||
inline-size: 100%;
|
||||
border-collapse: collapse;
|
||||
text-align: start;
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
|
||||
.sgc-table-viewport th {
|
||||
vertical-align: bottom;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.sgc-table-viewport :is(th, td) {
|
||||
padding: 0.75rem;
|
||||
}
|
||||
|
||||
.sgc-table-viewport tbody tr:not(:last-child) {
|
||||
border-block-end: 1px solid var(--border);
|
||||
}
|
||||
}
|
||||
|
||||
@media print {
|
||||
.sgc-table-viewport {
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.sgc-table-viewport table {
|
||||
min-inline-size: 0;
|
||||
}
|
||||
|
||||
.sgc-table-viewport thead {
|
||||
display: table-header-group;
|
||||
}
|
||||
|
||||
.sgc-table-viewport tr {
|
||||
break-inside: avoid;
|
||||
}
|
||||
|
||||
.sgc-table-viewport :is(th, td) {
|
||||
white-space: normal;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Link } from '@inertiajs/react';
|
||||
import { ArrowUpRight, ClipboardList } from 'lucide-react';
|
||||
import type { ReactNode } from 'react';
|
||||
import { useId, type ReactNode } from 'react';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { openJourneyHelp } from '@/components/journey-help';
|
||||
import { recoveryHints } from '@/lib/journey-help';
|
||||
@@ -8,7 +8,74 @@ import { date, money, statusLabels } from '@/types/procurement';
|
||||
import type { Requisition } from '@/types/procurement';
|
||||
|
||||
export const controlClass =
|
||||
'h-10 w-full rounded-lg border border-input bg-background px-3 text-sm outline-none focus-visible:ring-2 focus-visible:ring-ring';
|
||||
'h-10 w-full min-w-0 rounded-lg border border-input bg-background px-3 text-sm outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20';
|
||||
|
||||
/** Shared layout only: callers retain their actions, permissions and submit behaviour. */
|
||||
export function ActionBar({
|
||||
children,
|
||||
align = 'start',
|
||||
label = 'Acções disponíveis',
|
||||
className = '',
|
||||
}: {
|
||||
children: ReactNode;
|
||||
align?: 'start' | 'end';
|
||||
label?: string;
|
||||
className?: string;
|
||||
}) {
|
||||
return (
|
||||
<div
|
||||
role="group"
|
||||
aria-label={label}
|
||||
className={`sgc-action-bar flex flex-col gap-3 sm:flex-row sm:flex-wrap sm:items-center ${align === 'end' ? 'sm:justify-end' : ''} print:hidden ${className}`}
|
||||
>
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/** Preserve table semantics and make wide results reachable with a keyboard. */
|
||||
export function TableViewport({
|
||||
children,
|
||||
label = 'Tabela de resultados',
|
||||
}: {
|
||||
children: ReactNode;
|
||||
label?: string;
|
||||
}) {
|
||||
return (
|
||||
<div
|
||||
role="region"
|
||||
aria-label={label}
|
||||
tabIndex={0}
|
||||
className="sgc-table-viewport max-w-full min-w-0 overflow-x-auto rounded-lg focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring"
|
||||
>
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/** Print all already authorised details without changing their on-screen expansion state. */
|
||||
export function PrintableDetails({
|
||||
summary,
|
||||
children,
|
||||
}: {
|
||||
summary: ReactNode;
|
||||
children: ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<details className="print:hidden">
|
||||
<summary className="cursor-pointer underline">
|
||||
{summary}
|
||||
</summary>
|
||||
{children}
|
||||
</details>
|
||||
<div className="hidden print:block">
|
||||
<p className="font-medium">{summary}</p>
|
||||
{children}
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
export function PageTitle({
|
||||
eyebrow,
|
||||
title,
|
||||
@@ -21,20 +88,24 @@ export function PageTitle({
|
||||
action?: ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<div className="flex flex-wrap items-end justify-between gap-4">
|
||||
<div>
|
||||
<header className="sgc-page-title flex min-w-0 flex-col gap-4 sm:flex-row sm:flex-wrap sm:items-end sm:justify-between">
|
||||
<div className="min-w-0">
|
||||
<p className="mb-2 text-xs font-semibold tracking-widest text-teal-700 uppercase dark:text-teal-400">
|
||||
{eyebrow}
|
||||
</p>
|
||||
<h1 className="text-3xl font-semibold tracking-tight">
|
||||
<h1 className="text-2xl font-semibold tracking-tight [overflow-wrap:anywhere] sm:text-3xl">
|
||||
{title}
|
||||
</h1>
|
||||
<p className="mt-2 max-w-2xl text-sm text-muted-foreground">
|
||||
{description}
|
||||
</p>
|
||||
</div>
|
||||
{action}
|
||||
</div>
|
||||
{action && (
|
||||
<div className="sgc-page-actions min-w-0 print:hidden">
|
||||
{action}
|
||||
</div>
|
||||
)}
|
||||
</header>
|
||||
);
|
||||
}
|
||||
export function Panel({
|
||||
@@ -48,12 +119,19 @@ export function Panel({
|
||||
description?: string;
|
||||
children: ReactNode;
|
||||
}) {
|
||||
const headingId = useId();
|
||||
return (
|
||||
<section
|
||||
id={id}
|
||||
className="scroll-mt-24 rounded-xl border bg-card p-5 shadow-xs"
|
||||
aria-labelledby={headingId}
|
||||
className="sgc-panel min-w-0 scroll-mt-24 rounded-xl border bg-card p-4 shadow-xs sm:p-5 print:rounded-none print:shadow-none"
|
||||
>
|
||||
<h2 className="font-semibold">{title}</h2>
|
||||
<h2
|
||||
id={headingId}
|
||||
className="font-semibold [overflow-wrap:anywhere]"
|
||||
>
|
||||
{title}
|
||||
</h2>
|
||||
{description && (
|
||||
<p className="mt-1 text-sm text-muted-foreground">
|
||||
{description}
|
||||
|
||||
@@ -37,6 +37,23 @@ function topic(
|
||||
}
|
||||
|
||||
export const journeyHelp: JourneyHelp[] = [
|
||||
topic(
|
||||
'capital-register',
|
||||
'Ligar compras a projectos e imobilizado',
|
||||
['equipment/capital-register', 'requisitions/capital-assignments'],
|
||||
'Usar o cadastro próprio de Compras e conservar a origem documental da escolha por artigo.',
|
||||
[
|
||||
'Registe o código, designação, departamento e referência documental. Reutilize a ficha física existente quando o equipamento já estiver identificado.',
|
||||
'No rascunho da requisição, seleccione o artigo e a referência activa do respectivo departamento; justifique e guarde a ligação.',
|
||||
'Consulte versões e origens no cadastro para abrir as ordens efectivamente emitidas e as respectivas recepções.',
|
||||
],
|
||||
[
|
||||
'Revisões e arquivo não reescrevem escolhas anteriores nem documentos emitidos; uma alteração do artigo exige rever a ligação.',
|
||||
'A quantidade aceite no original é distinta de devoluções e estornos posteriores. O rastreio não regista capitalização ou depreciação.',
|
||||
],
|
||||
'Se a versão mudou, conserve a preparação, consulte a ligação actual e seleccione a referência activa antes de voltar a guardar.',
|
||||
'Regresse à requisição para os controlos e aprovações existentes; a ligação documental não substitui a distribuição orçamental.',
|
||||
),
|
||||
topic(
|
||||
'import-readiness',
|
||||
'Acompanhar pendências da importação',
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { Head, Link, useForm } from '@inertiajs/react';
|
||||
import {
|
||||
TableViewport,
|
||||
PageTitle,
|
||||
Panel,
|
||||
FormErrors,
|
||||
@@ -146,7 +147,7 @@ export default function AuditMetadata({ filters, events }: Props) {
|
||||
</a>
|
||||
</Panel>
|
||||
<Panel title={`${events.total} eventos encontrados`}>
|
||||
<div className="overflow-x-auto">
|
||||
<TableViewport>
|
||||
<table className="w-full text-left text-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -173,7 +174,7 @@ export default function AuditMetadata({ filters, events }: Props) {
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</TableViewport>
|
||||
{events.data.length === 0 && (
|
||||
<p className="mt-4">Sem eventos para estes filtros.</p>
|
||||
)}
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
import { Head, Link, router } from '@inertiajs/react';
|
||||
import { useState } from 'react';
|
||||
import { PageTitle, Panel, controlClass } from '@/components/procurement';
|
||||
import {
|
||||
TableViewport,
|
||||
PageTitle,
|
||||
Panel,
|
||||
controlClass,
|
||||
} from '@/components/procurement';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
|
||||
@@ -126,7 +131,7 @@ export default function GeographyReview({
|
||||
{total.toLocaleString('pt-PT')} resultados · Página{' '}
|
||||
{filters.page} de {Math.max(1, Math.ceil(total / 50))}
|
||||
</p>
|
||||
<div className="overflow-x-auto">
|
||||
<TableViewport>
|
||||
<table className="w-full text-left text-sm">
|
||||
<thead className="border-b">
|
||||
<tr>
|
||||
@@ -169,7 +174,7 @@ export default function GeographyReview({
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</TableViewport>
|
||||
{records.length === 0 && (
|
||||
<p className="py-5 text-sm">
|
||||
Não existem pendências para estes filtros.
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { Head, useForm } from '@inertiajs/react';
|
||||
import {
|
||||
TableViewport,
|
||||
FormErrors,
|
||||
PageTitle,
|
||||
Panel,
|
||||
@@ -177,7 +178,7 @@ export default function CompanyPage({
|
||||
title="Equipa"
|
||||
description="O perfil define as operações disponíveis. Um administrador não substitui os aprovadores."
|
||||
>
|
||||
<div className="overflow-x-auto">
|
||||
<TableViewport>
|
||||
<table className="w-full text-left text-sm">
|
||||
<thead className="border-b text-muted-foreground">
|
||||
<tr>
|
||||
@@ -211,7 +212,7 @@ export default function CompanyPage({
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</TableViewport>
|
||||
<form
|
||||
className="mt-6 space-y-4 border-t pt-5"
|
||||
autoComplete="off"
|
||||
|
||||
@@ -12,6 +12,7 @@ import type { IntelligencePolicy } from '@/components/intelligence-settings';
|
||||
import { comparisonCriteria } from '@/components/comparison-policy-summary';
|
||||
import type { ComparisonPolicy } from '@/components/comparison-policy-summary';
|
||||
import {
|
||||
ActionBar,
|
||||
PageTitle,
|
||||
Panel,
|
||||
FormErrors,
|
||||
@@ -173,6 +174,7 @@ function Assignment({
|
||||
export default function Parameters({
|
||||
approvalLevels,
|
||||
approvalLevelsReady = false,
|
||||
expiryReady = false,
|
||||
requisitionCategoryOptions = {},
|
||||
companyDetails,
|
||||
companyDetailsReady,
|
||||
@@ -202,6 +204,7 @@ export default function Parameters({
|
||||
}: {
|
||||
approvalLevels?: RequisitionApprovalPlan | null;
|
||||
approvalLevelsReady?: boolean;
|
||||
expiryReady?: boolean;
|
||||
requisitionCategoryOptions?: Record<string, string>;
|
||||
companyDetails: CompanyDetails | null;
|
||||
companyDetailsReady: boolean;
|
||||
@@ -308,6 +311,15 @@ export default function Parameters({
|
||||
{notice}
|
||||
</p>
|
||||
)}
|
||||
{expiryReady && (
|
||||
<Link
|
||||
className="block underline"
|
||||
href="/administracao/prazos-aprovacao"
|
||||
>
|
||||
Configurar prazos, escalamento e expiração das
|
||||
aprovações
|
||||
</Link>
|
||||
)}
|
||||
{activationPreview && (
|
||||
<OrganizationActivationPreview
|
||||
preview={activationPreview}
|
||||
@@ -908,7 +920,7 @@ export default function Parameters({
|
||||
</ul>
|
||||
)}
|
||||
</div>
|
||||
<div className="flex gap-3">
|
||||
<ActionBar>
|
||||
<Button disabled={profile.processing}>
|
||||
{profile.data.id
|
||||
? 'Actualizar perfil'
|
||||
@@ -929,7 +941,7 @@ export default function Parameters({
|
||||
>
|
||||
Novo perfil
|
||||
</Button>
|
||||
</div>
|
||||
</ActionBar>
|
||||
</form>
|
||||
</Panel>
|
||||
<Panel title="Utilizadores e atribuições">
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { Head, Link, useForm, usePage } from '@inertiajs/react';
|
||||
import {
|
||||
TableViewport,
|
||||
FormErrors,
|
||||
PageTitle,
|
||||
Panel,
|
||||
@@ -220,7 +221,7 @@ export default function Conflicts({
|
||||
title="Declarações e correcções"
|
||||
description="O histórico é preservado. Só o autor pode corrigir o fundamento e a data de conhecimento, sem mudar o âmbito ou retirar o conflito."
|
||||
>
|
||||
<div className="overflow-x-auto">
|
||||
<TableViewport>
|
||||
<table className="w-full text-left text-sm">
|
||||
<thead className="border-b text-muted-foreground">
|
||||
<tr>
|
||||
@@ -278,7 +279,7 @@ export default function Conflicts({
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</TableViewport>
|
||||
{declarations.data.length === 0 && (
|
||||
<p className="py-6 text-sm text-muted-foreground">
|
||||
Ainda não existem declarações disponíveis para o seu
|
||||
|
||||
@@ -26,8 +26,34 @@ type Record = {
|
||||
};
|
||||
type Props = {
|
||||
trace?: {
|
||||
orders: { data: { id: number; description: string; quantity: string; unit: string; order_id: number; order_number: string }[]; prev_page_url: string | null; next_page_url: string | null };
|
||||
receipts: { data: { id: number; description: string | null; unit: string | null; receipt_id: number; order_id: number | null; received_on: string | null; quality_status: string; accepted_quantity: string; reversed: boolean; returned_quantity: string }[]; prev_page_url: string | null; next_page_url: string | null };
|
||||
orders: {
|
||||
data: {
|
||||
id: number;
|
||||
description: string;
|
||||
quantity: string;
|
||||
unit: string;
|
||||
order_id: number;
|
||||
order_number: string;
|
||||
}[];
|
||||
prev_page_url: string | null;
|
||||
next_page_url: string | null;
|
||||
};
|
||||
receipts: {
|
||||
data: {
|
||||
id: number;
|
||||
description: string | null;
|
||||
unit: string | null;
|
||||
receipt_id: number;
|
||||
order_id: number | null;
|
||||
received_on: string | null;
|
||||
quality_status: string;
|
||||
accepted_quantity: string;
|
||||
reversed: boolean;
|
||||
returned_quantity: string;
|
||||
}[];
|
||||
prev_page_url: string | null;
|
||||
next_page_url: string | null;
|
||||
};
|
||||
} | null;
|
||||
history: {
|
||||
data: Record[];
|
||||
@@ -133,6 +159,17 @@ export default function CapitalRegister(props: Props) {
|
||||
· versão {record.version}
|
||||
</p>
|
||||
<p>{record.data.reference}</p>
|
||||
{record.data.equipment_id && (
|
||||
<p>
|
||||
Equipamento físico:{' '}
|
||||
<Link
|
||||
className="underline"
|
||||
href={`/equipamentos/${record.data.equipment_id}`}
|
||||
>
|
||||
Consultar ficha #{record.data.equipment_id}
|
||||
</Link>
|
||||
</p>
|
||||
)}
|
||||
<p>{record.reason}</p>
|
||||
<Link
|
||||
className="underline"
|
||||
@@ -210,16 +247,130 @@ export default function CapitalRegister(props: Props) {
|
||||
</nav>
|
||||
</Panel>
|
||||
)}
|
||||
{props.trace && <Panel title="Ordens que preservaram esta referência" description="As ligações vêm dos documentos emitidos, incluindo escolhas anteriores a revisões do cadastro.">
|
||||
{props.trace.orders.data.length === 0 && <p>Ainda não há ordens visíveis com esta referência preservada.</p>}
|
||||
{props.trace.orders.data.map(line => <article key={line.id} className="space-y-2 border-b py-3 break-words"><Link className="underline" href={`/ordens/${line.order_id}`}>{line.order_number}</Link><p>{line.description} · {line.quantity} {line.unit}</p></article>)}
|
||||
<nav className="flex gap-4" aria-label="Ordens de origem">{props.trace.orders.prev_page_url && <Link preserveState href={props.trace.orders.prev_page_url}>Anterior</Link>}{props.trace.orders.next_page_url && <Link preserveState href={props.trace.orders.next_page_url}>Seguinte</Link>}</nav>
|
||||
</Panel>}
|
||||
{props.trace && <Panel title="Recepções destas origens" description="A quantidade aceite é a do documento original. Estornos e devoluções actuais são apresentados separadamente; a recepção não certifica capitalização contabilística.">
|
||||
{props.trace.receipts.data.length === 0 && <p>Ainda não há recepções visíveis nestas origens.</p>}
|
||||
{props.trace.receipts.data.map(receipt => <article key={receipt.id} className="space-y-2 border-b py-3 break-words"><h3 className="font-semibold">Recepção #{receipt.receipt_id} · {receipt.description || 'Descrição por conferir'}</h3><p>Data: {receipt.received_on || 'Por conferir'} · Aceite no original: {receipt.accepted_quantity} {receipt.unit || ''}</p><p>Qualidade registada: {receipt.quality_status === 'compliant' ? 'Conforme' : receipt.quality_status === 'quarantined' ? 'Em quarentena' : 'Com divergência'}</p>{receipt.reversed && <p className="font-semibold">Recepção estornada; o original permanece no histórico.</p>}{receipt.returned_quantity !== '0.000' && <p>Devolução ao fornecedor: {receipt.returned_quantity} {receipt.unit || ''}</p>}{receipt.order_id && <Link className="underline" href={`/ordens/${receipt.order_id}`}>Conferir documentos e movimentos da ordem</Link>}</article>)}
|
||||
<nav className="flex gap-4" aria-label="Recepções de origem">{props.trace.receipts.prev_page_url && <Link preserveState href={props.trace.receipts.prev_page_url}>Anterior</Link>}{props.trace.receipts.next_page_url && <Link preserveState href={props.trace.receipts.next_page_url}>Seguinte</Link>}</nav>
|
||||
</Panel>}
|
||||
{props.trace && (
|
||||
<Panel
|
||||
title="Ordens que preservaram esta referência"
|
||||
description="As ligações vêm dos documentos emitidos, incluindo escolhas anteriores a revisões do cadastro."
|
||||
>
|
||||
{props.trace.orders.data.length === 0 && (
|
||||
<p>
|
||||
Ainda não há ordens visíveis com esta referência
|
||||
preservada.
|
||||
</p>
|
||||
)}
|
||||
{props.trace.orders.data.map((line) => (
|
||||
<article
|
||||
key={line.id}
|
||||
className="space-y-2 border-b py-3 break-words"
|
||||
>
|
||||
<Link
|
||||
className="underline"
|
||||
href={`/ordens/${line.order_id}`}
|
||||
>
|
||||
{line.order_number}
|
||||
</Link>
|
||||
<p>
|
||||
{line.description} · {line.quantity} {line.unit}
|
||||
</p>
|
||||
</article>
|
||||
))}
|
||||
<nav className="flex gap-4" aria-label="Ordens de origem">
|
||||
{props.trace.orders.prev_page_url && (
|
||||
<Link
|
||||
preserveState
|
||||
href={props.trace.orders.prev_page_url}
|
||||
>
|
||||
Anterior
|
||||
</Link>
|
||||
)}
|
||||
{props.trace.orders.next_page_url && (
|
||||
<Link
|
||||
preserveState
|
||||
href={props.trace.orders.next_page_url}
|
||||
>
|
||||
Seguinte
|
||||
</Link>
|
||||
)}
|
||||
</nav>
|
||||
</Panel>
|
||||
)}
|
||||
{props.trace && (
|
||||
<Panel
|
||||
title="Recepções destas origens"
|
||||
description="A quantidade aceite é a do documento original. Estornos e devoluções actuais são apresentados separadamente; a recepção não certifica capitalização contabilística."
|
||||
>
|
||||
{props.trace.receipts.data.length === 0 && (
|
||||
<p>Ainda não há recepções visíveis nestas origens.</p>
|
||||
)}
|
||||
{props.trace.receipts.data.map((receipt) => (
|
||||
<article
|
||||
key={receipt.id}
|
||||
className="space-y-2 border-b py-3 break-words"
|
||||
>
|
||||
<h3 className="font-semibold">
|
||||
Recepção #{receipt.receipt_id} ·{' '}
|
||||
{receipt.description ||
|
||||
'Descrição por conferir'}
|
||||
</h3>
|
||||
<p>
|
||||
Data: {receipt.received_on || 'Por conferir'} ·
|
||||
Aceite no original: {receipt.accepted_quantity}{' '}
|
||||
{receipt.unit || ''}
|
||||
</p>
|
||||
<p>
|
||||
Qualidade registada:{' '}
|
||||
{receipt.quality_status === 'compliant'
|
||||
? 'Conforme'
|
||||
: receipt.quality_status === 'quarantined'
|
||||
? 'Em quarentena'
|
||||
: 'Com divergência'}
|
||||
</p>
|
||||
{receipt.reversed && (
|
||||
<p className="font-semibold">
|
||||
Recepção estornada; o original permanece no
|
||||
histórico.
|
||||
</p>
|
||||
)}
|
||||
{receipt.returned_quantity !== '0.000' && (
|
||||
<p>
|
||||
Devolução ao fornecedor:{' '}
|
||||
{receipt.returned_quantity}{' '}
|
||||
{receipt.unit || ''}
|
||||
</p>
|
||||
)}
|
||||
{receipt.order_id && (
|
||||
<Link
|
||||
className="underline"
|
||||
href={`/ordens/${receipt.order_id}`}
|
||||
>
|
||||
Conferir documentos e movimentos da ordem
|
||||
</Link>
|
||||
)}
|
||||
</article>
|
||||
))}
|
||||
<nav
|
||||
className="flex gap-4"
|
||||
aria-label="Recepções de origem"
|
||||
>
|
||||
{props.trace.receipts.prev_page_url && (
|
||||
<Link
|
||||
preserveState
|
||||
href={props.trace.receipts.prev_page_url}
|
||||
>
|
||||
Anterior
|
||||
</Link>
|
||||
)}
|
||||
{props.trace.receipts.next_page_url && (
|
||||
<Link
|
||||
preserveState
|
||||
href={props.trace.receipts.next_page_url}
|
||||
>
|
||||
Seguinte
|
||||
</Link>
|
||||
)}
|
||||
</nav>
|
||||
</Panel>
|
||||
)}
|
||||
{props.canManage && (
|
||||
<Panel
|
||||
title={
|
||||
|
||||
@@ -0,0 +1,385 @@
|
||||
import { Head, Link, useForm } from '@inertiajs/react';
|
||||
import { useEffect, useRef } from 'react';
|
||||
import {
|
||||
FormErrors,
|
||||
PageTitle,
|
||||
Panel,
|
||||
controlClass,
|
||||
} from '@/components/procurement';
|
||||
import { Button } from '@/components/ui/button';
|
||||
|
||||
type Level = {
|
||||
role: string;
|
||||
expire_minutes: number;
|
||||
reminder_minutes: number | null;
|
||||
escalation_minutes: number | null;
|
||||
profile_ids: number[];
|
||||
};
|
||||
type Policy = {
|
||||
id: number;
|
||||
version: number;
|
||||
state: string;
|
||||
reason: string;
|
||||
data: { enabled: boolean; levels: Level[] };
|
||||
};
|
||||
type Props = {
|
||||
current: Policy | null;
|
||||
profiles: { id: number; name: string }[];
|
||||
roles: Record<string, string>;
|
||||
actorId: number;
|
||||
tenantId: number;
|
||||
history: {
|
||||
data: Policy[];
|
||||
prev_page_url: string | null;
|
||||
next_page_url: string | null;
|
||||
};
|
||||
};
|
||||
type Draft = {
|
||||
role: string;
|
||||
expire_minutes: string;
|
||||
reminder_minutes: string;
|
||||
escalation_minutes: string;
|
||||
profile_ids: number[];
|
||||
};
|
||||
const draft = (level: Level): Draft => ({
|
||||
...level,
|
||||
expire_minutes: String(level.expire_minutes),
|
||||
reminder_minutes:
|
||||
level.reminder_minutes === null ? '' : String(level.reminder_minutes),
|
||||
escalation_minutes:
|
||||
level.escalation_minutes === null
|
||||
? ''
|
||||
: String(level.escalation_minutes),
|
||||
profile_ids: [...level.profile_ids],
|
||||
});
|
||||
export default function ApprovalTimeouts(props: Props) {
|
||||
const url = '/administracao/prazos-aprovacao';
|
||||
const form = useForm(
|
||||
`approval-timeouts:${props.tenantId}:${props.actorId}`,
|
||||
{
|
||||
operation_key: '',
|
||||
version: props.current?.version ?? 0,
|
||||
enabled: props.current?.data.enabled ?? false,
|
||||
levels: props.current?.data.levels.map(draft) ?? ([] as Draft[]),
|
||||
reason: '',
|
||||
},
|
||||
);
|
||||
const current = form.data.version === (props.current?.version ?? 0);
|
||||
const ref = useRef<HTMLFormElement>(null);
|
||||
useEffect(() => {
|
||||
const node = ref.current;
|
||||
window.dispatchEvent(
|
||||
new CustomEvent('sgc:context-dirty', {
|
||||
detail: { form: node, dirty: form.isDirty },
|
||||
}),
|
||||
);
|
||||
return () => {
|
||||
window.dispatchEvent(
|
||||
new CustomEvent('sgc:context-dirty', {
|
||||
detail: { form: node, dirty: false },
|
||||
}),
|
||||
);
|
||||
};
|
||||
}, [form.isDirty]);
|
||||
const edit = () =>
|
||||
form.setData({
|
||||
operation_key: '',
|
||||
version: props.current?.version ?? 0,
|
||||
enabled: props.current?.data.enabled ?? false,
|
||||
levels: props.current?.data.levels.map(draft) ?? [],
|
||||
reason: '',
|
||||
});
|
||||
const change = (index: number, patch: Partial<Draft>) =>
|
||||
form.setData((data) => ({
|
||||
...data,
|
||||
levels: data.levels.map((level, i) =>
|
||||
i === index
|
||||
? {
|
||||
...level,
|
||||
...patch,
|
||||
...(patch.escalation_minutes === ''
|
||||
? { profile_ids: [] }
|
||||
: {}),
|
||||
}
|
||||
: level,
|
||||
),
|
||||
operation_key: '',
|
||||
}));
|
||||
return (
|
||||
<div className="mx-auto grid w-full max-w-6xl min-w-0 gap-6 p-5 lg:p-8">
|
||||
<Head title="Prazos das aprovações" />
|
||||
<PageTitle
|
||||
eyebrow="Administração"
|
||||
title="Prazos das aprovações"
|
||||
description="Configure os prazos que a empresa pretende aplicar nas novas submissões. Não são atribuídas permissões aos destinatários do escalamento."
|
||||
/>
|
||||
<Link className="underline" href="/administracao/parametrizacao">
|
||||
Voltar à parametrização
|
||||
</Link>
|
||||
<Panel
|
||||
title={`Política actual · versão ${props.current?.version ?? 0}`}
|
||||
description="Os valores são minutos corridos desde a activação da etapa, sem calendário de dias úteis implícito."
|
||||
>
|
||||
<p>
|
||||
{props.current?.data.enabled
|
||||
? 'Aplicável a novas submissões'
|
||||
: 'Sem prazos activos para novas submissões'}
|
||||
</p>
|
||||
<form
|
||||
ref={ref}
|
||||
className="mt-5 space-y-5"
|
||||
onSubmit={(event) => {
|
||||
event.preventDefault();
|
||||
const operation =
|
||||
form.data.operation_key || crypto.randomUUID();
|
||||
form.setData('operation_key', operation);
|
||||
form.transform((data) => ({
|
||||
...data,
|
||||
operation_key: operation,
|
||||
levels: data.levels.map((level) => ({
|
||||
...level,
|
||||
reminder_minutes:
|
||||
level.reminder_minutes || null,
|
||||
escalation_minutes:
|
||||
level.escalation_minutes || null,
|
||||
})),
|
||||
}));
|
||||
form.post(url, {
|
||||
preserveScroll: true,
|
||||
onSuccess: () => {
|
||||
form.reset();
|
||||
form.clearErrors();
|
||||
},
|
||||
});
|
||||
}}
|
||||
>
|
||||
<FormErrors errors={form.errors} />
|
||||
{!current && (
|
||||
<p>
|
||||
A política mudou. Reveja a versão actual antes de
|
||||
guardar outra alteração.
|
||||
</p>
|
||||
)}
|
||||
<Button type="button" variant="outline" onClick={edit}>
|
||||
Preparar a política actual
|
||||
</Button>
|
||||
<label className="flex items-center gap-2">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={form.data.enabled}
|
||||
onChange={(e) =>
|
||||
form.setData('enabled', e.target.checked)
|
||||
}
|
||||
/>
|
||||
Aplicar a novas submissões
|
||||
</label>
|
||||
{form.data.levels.map((level, index) => (
|
||||
<fieldset
|
||||
className="min-w-0 space-y-4 rounded-lg border p-4"
|
||||
key={index}
|
||||
>
|
||||
<legend>Nível {index + 1}</legend>
|
||||
<label className="grid gap-2">
|
||||
Etapa
|
||||
<select
|
||||
className={controlClass}
|
||||
value={level.role}
|
||||
onChange={(e) =>
|
||||
change(index, { role: e.target.value })
|
||||
}
|
||||
>
|
||||
{Object.entries(props.roles).map(
|
||||
([key, label]) => (
|
||||
<option key={key} value={key}>
|
||||
{label}
|
||||
</option>
|
||||
),
|
||||
)}
|
||||
</select>
|
||||
</label>
|
||||
<div className="grid gap-4 md:grid-cols-3">
|
||||
{(
|
||||
[
|
||||
'reminder_minutes',
|
||||
'escalation_minutes',
|
||||
'expire_minutes',
|
||||
] as const
|
||||
).map((field) => (
|
||||
<label key={field} className="grid gap-2">
|
||||
{field === 'expire_minutes'
|
||||
? 'Expiração · minutos'
|
||||
: field === 'reminder_minutes'
|
||||
? 'Lembrete · minutos, se aplicável'
|
||||
: 'Escalamento · minutos, se aplicável'}
|
||||
<input
|
||||
type="number"
|
||||
min={1}
|
||||
max={5256000}
|
||||
step={1}
|
||||
required={
|
||||
field === 'expire_minutes'
|
||||
}
|
||||
className={controlClass}
|
||||
value={level[field]}
|
||||
onChange={(e) =>
|
||||
change(index, {
|
||||
[field]: e.target.value,
|
||||
})
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
))}
|
||||
</div>
|
||||
{level.escalation_minutes !== '' && (
|
||||
<fieldset className="space-y-2">
|
||||
<legend>
|
||||
Perfis destinatários do escalamento
|
||||
</legend>
|
||||
{props.profiles.length === 0 && (
|
||||
<p>
|
||||
Configure os perfis da empresa antes
|
||||
de seleccionar destinatários.
|
||||
</p>
|
||||
)}
|
||||
{props.profiles.map((profile) => (
|
||||
<label
|
||||
key={profile.id}
|
||||
className="flex items-center gap-2"
|
||||
>
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={level.profile_ids.includes(
|
||||
profile.id,
|
||||
)}
|
||||
onChange={(e) =>
|
||||
change(index, {
|
||||
profile_ids: e.target
|
||||
.checked
|
||||
? [
|
||||
...level.profile_ids,
|
||||
profile.id,
|
||||
]
|
||||
: level.profile_ids.filter(
|
||||
(id) =>
|
||||
id !==
|
||||
profile.id,
|
||||
),
|
||||
})
|
||||
}
|
||||
/>
|
||||
{profile.name}
|
||||
</label>
|
||||
))}
|
||||
</fieldset>
|
||||
)}
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
onClick={() =>
|
||||
form.setData((data) => ({
|
||||
...data,
|
||||
levels: data.levels.filter(
|
||||
(_, i) => i !== index,
|
||||
),
|
||||
operation_key: '',
|
||||
}))
|
||||
}
|
||||
>
|
||||
Retirar este nível da preparação
|
||||
</Button>
|
||||
</fieldset>
|
||||
))}
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
disabled={form.data.levels.length >= 8}
|
||||
onClick={() => {
|
||||
const role = Object.keys(props.roles).find(
|
||||
(key) =>
|
||||
!form.data.levels.some(
|
||||
(level) => level.role === key,
|
||||
),
|
||||
);
|
||||
if (role)
|
||||
form.setData((data) => ({
|
||||
...data,
|
||||
levels: [
|
||||
...data.levels,
|
||||
{
|
||||
role,
|
||||
expire_minutes: '',
|
||||
reminder_minutes: '',
|
||||
escalation_minutes: '',
|
||||
profile_ids: [],
|
||||
},
|
||||
],
|
||||
operation_key: '',
|
||||
}));
|
||||
}}
|
||||
>
|
||||
Acrescentar etapa
|
||||
</Button>
|
||||
<label className="grid gap-2">
|
||||
Motivo desta versão
|
||||
<textarea
|
||||
required
|
||||
minLength={10}
|
||||
maxLength={4000}
|
||||
className={controlClass}
|
||||
value={form.data.reason}
|
||||
onChange={(e) =>
|
||||
form.setData('reason', e.target.value)
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
Na expiração, o pedido regressa ao requisitante para
|
||||
nova submissão. Os ciclos anteriores ficam preservados;
|
||||
uma alteração desta política não muda os prazos já
|
||||
submetidos.
|
||||
</p>
|
||||
<Button disabled={form.processing || !current}>
|
||||
Guardar política
|
||||
</Button>
|
||||
</form>
|
||||
</Panel>
|
||||
<Panel title="Histórico da política">
|
||||
{props.history.data.map((policy) => (
|
||||
<article
|
||||
key={policy.id}
|
||||
className="space-y-2 border-b py-3"
|
||||
>
|
||||
<h3 className="font-semibold">
|
||||
Versão {policy.version} ·{' '}
|
||||
{policy.data.enabled
|
||||
? 'Activa para novas submissões'
|
||||
: 'Inactiva para novas submissões'}
|
||||
</h3>
|
||||
<p>{policy.reason}</p>
|
||||
{policy.data.levels.map((level) => (
|
||||
<p key={level.role}>
|
||||
{props.roles[level.role]} · expiração em{' '}
|
||||
{level.expire_minutes} minutos corridos
|
||||
</p>
|
||||
))}
|
||||
</article>
|
||||
))}
|
||||
<nav
|
||||
className="mt-3 flex gap-4"
|
||||
aria-label="Histórico da política"
|
||||
>
|
||||
{props.history.prev_page_url && (
|
||||
<Link preserveState href={props.history.prev_page_url}>
|
||||
Anterior
|
||||
</Link>
|
||||
)}
|
||||
{props.history.next_page_url && (
|
||||
<Link preserveState href={props.history.next_page_url}>
|
||||
Seguinte
|
||||
</Link>
|
||||
)}
|
||||
</nav>
|
||||
</Panel>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
import { Head, Link, router, useForm } from '@inertiajs/react';
|
||||
import {
|
||||
ActionBar,
|
||||
PageTitle,
|
||||
Panel,
|
||||
FormErrors,
|
||||
@@ -185,7 +186,7 @@ export default function PeopleIndex({
|
||||
description="Contratação de prestadores individuais e recrutamento de trabalhadores, com critérios próprios e decisão independente."
|
||||
action={
|
||||
ready ? (
|
||||
<div className="flex flex-wrap gap-2">
|
||||
<ActionBar>
|
||||
<Button asChild>
|
||||
<Link href="/pessoas/relatorios">
|
||||
Relatórios
|
||||
@@ -197,7 +198,7 @@ export default function PeopleIndex({
|
||||
>
|
||||
Actualizar
|
||||
</Button>
|
||||
</div>
|
||||
</ActionBar>
|
||||
) : undefined
|
||||
}
|
||||
/>
|
||||
@@ -319,14 +320,14 @@ export default function PeopleIndex({
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
<div className="flex items-center gap-4">
|
||||
<ActionBar>
|
||||
<Button disabled={filtering.processing}>
|
||||
Aplicar filtros
|
||||
</Button>
|
||||
<Link className="underline" href="/pessoas">
|
||||
Limpar filtros
|
||||
</Link>
|
||||
</div>
|
||||
</ActionBar>
|
||||
</form>
|
||||
</Panel>
|
||||
{insights && (
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { Head, Link, useForm } from '@inertiajs/react';
|
||||
import {
|
||||
ActionBar,
|
||||
TableViewport,
|
||||
PageTitle,
|
||||
Panel,
|
||||
FormErrors,
|
||||
@@ -130,7 +132,7 @@ export default function Reports(props: Props) {
|
||||
title="Relatórios"
|
||||
description="Dados reutilizados dos processos que está autorizado a consultar, no contexto seleccionado."
|
||||
/>
|
||||
<div className="people-report-tools flex flex-wrap gap-3">
|
||||
<ActionBar className="people-report-tools">
|
||||
<Link
|
||||
href={`/pessoas/relatorios?${new URLSearchParams({ ...props.filters, view: 'deadlines' }).toString()}`}
|
||||
>
|
||||
@@ -161,7 +163,7 @@ export default function Reports(props: Props) {
|
||||
>
|
||||
Exportar resultados em CSV
|
||||
</a>
|
||||
</div>
|
||||
</ActionBar>
|
||||
<div className="people-report-tools">
|
||||
<Panel
|
||||
title="Filtrar relatório"
|
||||
@@ -292,12 +294,12 @@ export default function Reports(props: Props) {
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
<div className="flex items-end gap-3">
|
||||
<ActionBar>
|
||||
<Button disabled={form.processing}>
|
||||
Aplicar filtros
|
||||
</Button>
|
||||
<Link href="/pessoas/relatorios">Limpar</Link>
|
||||
</div>
|
||||
</ActionBar>
|
||||
<FormErrors errors={form.errors} />
|
||||
</form>
|
||||
</Panel>
|
||||
@@ -341,7 +343,7 @@ export default function Reports(props: Props) {
|
||||
trabalho da equipa; o mesmo processo pode ter várias
|
||||
ocorrências.
|
||||
</p>
|
||||
<div className="overflow-x-auto">
|
||||
<TableViewport>
|
||||
<table className="w-full text-left text-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -388,7 +390,7 @@ export default function Reports(props: Props) {
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</TableViewport>
|
||||
{props.deadlineReport.items.length === 0 && (
|
||||
<p className="mt-3">
|
||||
Sem intervenções ou alertas visíveis neste
|
||||
@@ -592,7 +594,7 @@ export default function Reports(props: Props) {
|
||||
? ` · Pesquisa: ${props.filters.search}`
|
||||
: ''}
|
||||
</p>
|
||||
<div className="overflow-x-auto">
|
||||
<TableViewport>
|
||||
<table className="w-full text-left text-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -641,7 +643,7 @@ export default function Reports(props: Props) {
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</TableViewport>
|
||||
<div className="people-report-tools mt-4 flex gap-4">
|
||||
{props.processes.prev_page_url && (
|
||||
<Link href={props.processes.prev_page_url}>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Head } from '@inertiajs/react';
|
||||
import { useState } from 'react';
|
||||
import { PageTitle, Panel } from '@/components/procurement';
|
||||
import { ActionBar, PageTitle, Panel } from '@/components/procurement';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Label } from '@/components/ui/label';
|
||||
|
||||
@@ -352,7 +352,7 @@ export default function AdmissionProposal() {
|
||||
}
|
||||
/>
|
||||
</Label>
|
||||
<div className="flex flex-wrap gap-2">
|
||||
<ActionBar>
|
||||
<Button
|
||||
variant="outline"
|
||||
disabled={
|
||||
@@ -395,7 +395,7 @@ export default function AdmissionProposal() {
|
||||
>
|
||||
Simular devolução
|
||||
</Button>
|
||||
</div>
|
||||
</ActionBar>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -14,7 +14,13 @@ import {
|
||||
PackageCheck,
|
||||
Warehouse,
|
||||
} from 'lucide-react';
|
||||
import { PageTitle, Panel, Status } from '@/components/procurement';
|
||||
import {
|
||||
ActionBar,
|
||||
TableViewport,
|
||||
PageTitle,
|
||||
Panel,
|
||||
Status,
|
||||
} from '@/components/procurement';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Label } from '@/components/ui/label';
|
||||
@@ -145,7 +151,7 @@ export default function Preview({
|
||||
.includes(search.toLowerCase()),
|
||||
);
|
||||
const requestTable = (
|
||||
<div className="overflow-x-auto">
|
||||
<TableViewport>
|
||||
<table className="w-full text-left text-sm">
|
||||
<thead className="border-b text-xs text-muted-foreground">
|
||||
<tr>
|
||||
@@ -212,7 +218,7 @@ export default function Preview({
|
||||
Nenhum exemplo corresponde à pesquisa.
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
</TableViewport>
|
||||
);
|
||||
return (
|
||||
<>
|
||||
@@ -410,7 +416,7 @@ export default function Preview({
|
||||
title="Matriz de avaliação · DEMO-001"
|
||||
description="Valores ilustrativos. Preço 40% · qualidade 20% · prazo 15% · histórico 15% · pagamento 10%."
|
||||
>
|
||||
<div className="overflow-x-auto">
|
||||
<TableViewport>
|
||||
<table className="w-full text-left text-sm">
|
||||
<thead className="border-b text-xs text-muted-foreground">
|
||||
<tr>
|
||||
@@ -455,7 +461,7 @@ export default function Preview({
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</TableViewport>
|
||||
<p className="mt-5 rounded-lg bg-amber-50 p-4 text-sm text-amber-900">
|
||||
Exemplo de comparação incompleta: uma das
|
||||
propostas ainda não tem duas avaliações. A
|
||||
@@ -803,7 +809,7 @@ export default function Preview({
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div className="mt-6 flex flex-wrap gap-3">
|
||||
<ActionBar className="mt-6">
|
||||
<Button
|
||||
onClick={() =>
|
||||
setDetail({
|
||||
@@ -830,7 +836,7 @@ export default function Preview({
|
||||
<Button disabled>
|
||||
Acção indisponível
|
||||
</Button>
|
||||
</div>
|
||||
</ActionBar>
|
||||
</Panel>
|
||||
</>
|
||||
)}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useState } from 'react';
|
||||
import { InventoryNotice, ReceiptProgressTable } from '@/components/inventory';
|
||||
import { Panel, controlClass } from '@/components/procurement';
|
||||
import { TableViewport, Panel, controlClass } from '@/components/procurement';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Input } from '@/components/ui/input';
|
||||
import { Label } from '@/components/ui/label';
|
||||
@@ -227,7 +227,7 @@ export default function InventoryDemo({
|
||||
onChange={(event) => setSearch(event.target.value)}
|
||||
className="mb-5 max-w-sm"
|
||||
/>
|
||||
<div className="overflow-x-auto">
|
||||
<TableViewport>
|
||||
<table className="w-full text-left text-sm">
|
||||
<thead className="border-b text-muted-foreground">
|
||||
<tr>
|
||||
@@ -272,7 +272,7 @@ export default function InventoryDemo({
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</TableViewport>
|
||||
{visible.length === 0 && (
|
||||
<p className="py-5 text-sm text-muted-foreground">
|
||||
Nenhum exemplo corresponde à pesquisa.
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
import { Head, Link } from '@inertiajs/react';
|
||||
import { Printer } from 'lucide-react';
|
||||
import { useState } from 'react';
|
||||
import { controlClass, PageTitle, Panel } from '@/components/procurement';
|
||||
import {
|
||||
ActionBar,
|
||||
TableViewport,
|
||||
controlClass,
|
||||
PageTitle,
|
||||
Panel,
|
||||
} from '@/components/procurement';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Label } from '@/components/ui/label';
|
||||
|
||||
@@ -312,7 +318,7 @@ export default function RecommendationProposal() {
|
||||
. Os três concorrentes são fornecedores distintos;
|
||||
no cenário pronto têm duas avaliações por proposta.
|
||||
</p>
|
||||
<div className="overflow-x-auto">
|
||||
<TableViewport>
|
||||
<table className="w-full text-left text-sm">
|
||||
<caption className="mb-3 text-left text-xs text-muted-foreground">
|
||||
Pontuações ilustrativas, sem recálculo de
|
||||
@@ -361,7 +367,7 @@ export default function RecommendationProposal() {
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</TableViewport>
|
||||
</Panel>
|
||||
</div>
|
||||
<div className="print:hidden">
|
||||
@@ -509,7 +515,7 @@ export default function RecommendationProposal() {
|
||||
})
|
||||
}
|
||||
/>
|
||||
<div className="flex flex-wrap gap-3">
|
||||
<ActionBar>
|
||||
<Button
|
||||
disabled={
|
||||
(
|
||||
@@ -545,7 +551,7 @@ export default function RecommendationProposal() {
|
||||
>
|
||||
Simular devolução
|
||||
</Button>
|
||||
</div>
|
||||
</ActionBar>
|
||||
</article>
|
||||
))}
|
||||
</div>
|
||||
|
||||
@@ -10,6 +10,7 @@ import AgreementOrderBindings, {
|
||||
import { ComparisonPolicySummary } from '@/components/comparison-policy-summary';
|
||||
import type { ComparisonPolicy } from '@/components/comparison-policy-summary';
|
||||
import {
|
||||
TableViewport,
|
||||
FormErrors,
|
||||
PageTitle,
|
||||
Panel,
|
||||
@@ -135,7 +136,7 @@ export default function Award({
|
||||
}
|
||||
>
|
||||
<ComparisonPolicySummary policy={comparison.policy} />
|
||||
<div className="overflow-x-auto">
|
||||
<TableViewport>
|
||||
<table className="w-full text-left text-sm">
|
||||
<thead className="border-b text-muted-foreground">
|
||||
<tr>
|
||||
@@ -205,7 +206,7 @@ export default function Award({
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</TableViewport>
|
||||
</Panel>
|
||||
<p className="text-sm">
|
||||
{recommendation.adopted
|
||||
|
||||
@@ -4,7 +4,12 @@ import { hasPreparationChanges } from '@/lib/requisition-history';
|
||||
import BudgetDistributionFields, {
|
||||
type BudgetDistributionOption,
|
||||
} from '@/components/budget-distribution-fields';
|
||||
import { FormErrors, PageTitle, Panel } from '@/components/procurement';
|
||||
import {
|
||||
ActionBar,
|
||||
FormErrors,
|
||||
PageTitle,
|
||||
Panel,
|
||||
} from '@/components/procurement';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { money } from '@/types/procurement';
|
||||
|
||||
@@ -98,7 +103,7 @@ export default function Amendment({
|
||||
reason={form.data.reason}
|
||||
onReason={(reason) => form.setData('reason', reason)}
|
||||
/>
|
||||
<div className="flex flex-wrap gap-3">
|
||||
<ActionBar>
|
||||
<Button disabled={form.processing}>
|
||||
Confirmar nova versão
|
||||
</Button>
|
||||
@@ -107,7 +112,7 @@ export default function Amendment({
|
||||
Voltar à ordem
|
||||
</Link>
|
||||
</Button>
|
||||
</div>
|
||||
</ActionBar>
|
||||
</form>
|
||||
<Panel title="Histórico preservado">
|
||||
{history.map((event, index) => (
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Head, Link } from '@inertiajs/react';
|
||||
import { PageTitle, Panel } from '@/components/procurement';
|
||||
import { TableViewport, PageTitle, Panel } from '@/components/procurement';
|
||||
import { money, date } from '@/types/procurement';
|
||||
import type { PurchaseAward, PurchaseOrder } from '@/types/purchase';
|
||||
|
||||
@@ -35,7 +35,7 @@ export default function Orders({
|
||||
Preparar ordens por parcelas ou consolidar origens
|
||||
</Link>
|
||||
)}
|
||||
<div className="overflow-x-auto">
|
||||
<TableViewport>
|
||||
<table className="w-full text-left text-sm">
|
||||
<thead className="border-b text-muted-foreground">
|
||||
<tr>
|
||||
@@ -76,7 +76,7 @@ export default function Orders({
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</TableViewport>
|
||||
{orders.data.length === 0 && (
|
||||
<p className="py-6 text-sm text-muted-foreground">
|
||||
Ainda não foram emitidas ordens.
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { Head, Link, router, useForm } from '@inertiajs/react';
|
||||
import {
|
||||
TableViewport,
|
||||
FormErrors,
|
||||
PageTitle,
|
||||
Panel,
|
||||
@@ -257,7 +258,7 @@ function Confer({ attempt }: { attempt: Attempt }) {
|
||||
}
|
||||
function Matrix({ rows, topIds }: { rows: Row[]; topIds?: number[] }) {
|
||||
return (
|
||||
<div className="overflow-x-auto">
|
||||
<TableViewport>
|
||||
<table className="w-full text-left text-sm">
|
||||
<thead className="border-b">
|
||||
<tr>
|
||||
@@ -294,7 +295,7 @@ function Matrix({ rows, topIds }: { rows: Row[]; topIds?: number[] }) {
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</TableViewport>
|
||||
);
|
||||
}
|
||||
export default function Recommendation(props: Props) {
|
||||
|
||||
@@ -12,7 +12,7 @@ import { QuotationCommercialTerms } from '@/components/quotation-commercial-term
|
||||
import { ExchangeSummary } from '@/components/quotation-exchange-panel';
|
||||
import type { ExchangeBasis } from '@/components/quotation-exchange-panel';
|
||||
import type { CommercialTerms } from '@/components/quotation-commercial-terms';
|
||||
import { PageTitle, Panel, Status } from '@/components/procurement';
|
||||
import { ActionBar, PageTitle, Panel, Status } from '@/components/procurement';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { date, roleLabels, statusLabels } from '@/types/procurement';
|
||||
|
||||
@@ -204,7 +204,7 @@ export default function ReviewReport({
|
||||
title="Relatório de conferência"
|
||||
description={`${report.company} · ${r.department} · Solicitante: ${r.requester}`}
|
||||
action={
|
||||
<div className="flex flex-wrap gap-3 print:hidden">
|
||||
<ActionBar>
|
||||
<Button asChild variant="outline">
|
||||
<Link href="/relatorios">
|
||||
Relatórios de compras
|
||||
@@ -224,7 +224,7 @@ export default function ReviewReport({
|
||||
Exportar conferência completa (CSV)
|
||||
</a>
|
||||
</Button>
|
||||
</div>
|
||||
</ActionBar>
|
||||
}
|
||||
/>
|
||||
<div className="rounded-xl border p-4 text-sm">
|
||||
|
||||
@@ -3,7 +3,7 @@ import { AgreementOrderLimitSummary } from '@/components/agreement-order-binding
|
||||
import { Printer } from 'lucide-react';
|
||||
import { ComparisonPolicySummary } from '@/components/comparison-policy-summary';
|
||||
import { QuotationCommercialTerms } from '@/components/quotation-commercial-terms';
|
||||
import { PageTitle, Panel } from '@/components/procurement';
|
||||
import { TableViewport, PageTitle, Panel } from '@/components/procurement';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { date, money, roleLabels } from '@/types/procurement';
|
||||
import { ExchangeSummary } from '@/components/quotation-exchange-panel';
|
||||
@@ -271,7 +271,7 @@ export default function OrderShow({
|
||||
</Panel>
|
||||
</div>
|
||||
<Panel title="Artigos e valores congelados">
|
||||
<div className="overflow-x-auto">
|
||||
<TableViewport>
|
||||
<table className="w-full text-left text-sm">
|
||||
<thead className="border-b text-muted-foreground">
|
||||
<tr>
|
||||
@@ -310,7 +310,7 @@ export default function OrderShow({
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</TableViewport>
|
||||
<dl className="mt-5 ml-auto max-w-sm space-y-3 text-sm">
|
||||
<div className="flex justify-between gap-4">
|
||||
<dt>Subtotal sem IVA</dt>
|
||||
|
||||
@@ -5,6 +5,9 @@ import {
|
||||
} from '@/components/procurement-payment-insights';
|
||||
import { Download } from 'lucide-react';
|
||||
import {
|
||||
FormErrors,
|
||||
ActionBar,
|
||||
TableViewport,
|
||||
PageTitle,
|
||||
Panel,
|
||||
Status,
|
||||
@@ -232,7 +235,7 @@ export default function ProcurementReports({
|
||||
</option>
|
||||
</select>
|
||||
</label>
|
||||
<div className="flex items-end gap-3">
|
||||
<ActionBar>
|
||||
<Button type="submit" disabled={form.processing}>
|
||||
Aplicar filtros
|
||||
</Button>
|
||||
@@ -242,16 +245,8 @@ export default function ProcurementReports({
|
||||
>
|
||||
Limpar
|
||||
</Link>
|
||||
</div>
|
||||
{Object.entries(form.errors).map(([key, message]) => (
|
||||
<p
|
||||
key={key}
|
||||
role="alert"
|
||||
className="text-sm text-red-700"
|
||||
>
|
||||
{message}
|
||||
</p>
|
||||
))}
|
||||
</ActionBar>
|
||||
<FormErrors errors={form.errors} />
|
||||
</form>
|
||||
</Panel>
|
||||
<section
|
||||
@@ -279,7 +274,7 @@ export default function ProcurementReports({
|
||||
não apenas esta página. Consulta gerada em{' '}
|
||||
{new Date(generatedAt).toLocaleString('pt-MZ')}.
|
||||
</p>
|
||||
<div className="overflow-x-auto">
|
||||
<TableViewport>
|
||||
<table className="w-full min-w-240 text-left text-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -352,7 +347,7 @@ export default function ProcurementReports({
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</TableViewport>
|
||||
{records.data.length === 0 && (
|
||||
<p className="py-6 text-sm">
|
||||
Nenhuma requisição encontrada nos filtros e no
|
||||
|
||||
@@ -2,7 +2,15 @@ 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 {
|
||||
PrintableDetails,
|
||||
FormErrors,
|
||||
ActionBar,
|
||||
TableViewport,
|
||||
PageTitle,
|
||||
Panel,
|
||||
controlClass,
|
||||
} from '@/components/procurement';
|
||||
import { Button } from '@/components/ui/button';
|
||||
|
||||
type Filters = {
|
||||
@@ -96,7 +104,7 @@ export default function SupplierImprovementReport({
|
||||
title="Medidas de melhoria"
|
||||
description="Acompanhar responsáveis, prazos, execução e encerramentos em todas as avaliações autorizadas."
|
||||
action={
|
||||
<div className="flex flex-wrap gap-3 print:hidden">
|
||||
<ActionBar>
|
||||
<Button asChild variant="outline">
|
||||
<Link href="/fornecedores/avaliacoes">
|
||||
Avaliações
|
||||
@@ -114,7 +122,7 @@ export default function SupplierImprovementReport({
|
||||
<Printer className="size-4" />
|
||||
Imprimir esta página
|
||||
</Button>
|
||||
</div>
|
||||
</ActionBar>
|
||||
}
|
||||
/>
|
||||
{geographyEnabled && (
|
||||
@@ -271,24 +279,13 @@ export default function SupplierImprovementReport({
|
||||
/>
|
||||
Só prazos ultrapassados
|
||||
</label>
|
||||
<div className="flex items-end gap-3">
|
||||
<ActionBar>
|
||||
<Button disabled={form.processing}>Aplicar</Button>
|
||||
<Button variant="outline" asChild>
|
||||
<Link href={base}>Limpar</Link>
|
||||
</Button>
|
||||
</div>
|
||||
{Object.keys(form.errors).length > 0 && (
|
||||
<div
|
||||
role="alert"
|
||||
className="text-sm text-red-700 sm:col-span-2 lg:col-span-4"
|
||||
>
|
||||
{Object.entries(form.errors).map(
|
||||
([key, error]) => (
|
||||
<p key={key}>{error}</p>
|
||||
),
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</ActionBar>
|
||||
<FormErrors errors={form.errors} />
|
||||
</form>
|
||||
<p className="mt-3 text-sm text-muted-foreground">
|
||||
Data de referência: {today} · Consulta:{' '}
|
||||
@@ -351,7 +348,7 @@ export default function SupplierImprovementReport({
|
||||
Não existem medidas autorizadas para estes filtros.
|
||||
</p>
|
||||
) : (
|
||||
<div className="overflow-x-auto">
|
||||
<TableViewport>
|
||||
<table className="w-full text-left text-sm">
|
||||
<thead>
|
||||
<tr className="border-b">
|
||||
@@ -399,10 +396,7 @@ export default function SupplierImprovementReport({
|
||||
{states[row.status]} ·
|
||||
Versão {row.version}
|
||||
</p>
|
||||
<details>
|
||||
<summary className="cursor-pointer underline">
|
||||
Resultado e evidência
|
||||
</summary>
|
||||
<PrintableDetails summary="Resultado e evidência">
|
||||
<div className="mt-2 space-y-2 whitespace-pre-wrap">
|
||||
<p>{row.description}</p>
|
||||
<p>
|
||||
@@ -423,7 +417,7 @@ export default function SupplierImprovementReport({
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
</details>
|
||||
</PrintableDetails>
|
||||
</td>
|
||||
<td className="space-y-2 p-3 print:hidden">
|
||||
<Link
|
||||
@@ -443,7 +437,7 @@ export default function SupplierImprovementReport({
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</TableViewport>
|
||||
)}
|
||||
<nav
|
||||
aria-label="Paginação das medidas"
|
||||
|
||||
@@ -2,6 +2,7 @@ import { Head, Link, useForm, usePage } from '@inertiajs/react';
|
||||
import { useEffect, useRef } from 'react';
|
||||
import { hasPreparationChanges } from '@/lib/requisition-history';
|
||||
import {
|
||||
ActionBar,
|
||||
FormErrors,
|
||||
PageTitle,
|
||||
Panel,
|
||||
@@ -245,7 +246,7 @@ export default function Distributions({
|
||||
para separar os centavos. Nenhuma diferença será
|
||||
compensada automaticamente.
|
||||
</p>
|
||||
<div className="flex flex-wrap gap-3">
|
||||
<ActionBar>
|
||||
<Button disabled={form.processing || rows.length === 0}>
|
||||
Guardar distribuição
|
||||
</Button>
|
||||
@@ -254,7 +255,7 @@ export default function Distributions({
|
||||
Voltar ao pedido
|
||||
</Link>
|
||||
</Button>
|
||||
</div>
|
||||
</ActionBar>
|
||||
</form>
|
||||
</div>
|
||||
</>
|
||||
|
||||
@@ -0,0 +1,253 @@
|
||||
import { Head, Link, router, useForm } from '@inertiajs/react';
|
||||
import { useEffect, useRef } from 'react';
|
||||
import {
|
||||
FormErrors,
|
||||
PageTitle,
|
||||
Panel,
|
||||
controlClass,
|
||||
} from '@/components/procurement';
|
||||
import { Button } from '@/components/ui/button';
|
||||
|
||||
type Deadline = {
|
||||
state: string;
|
||||
step_id: number | null;
|
||||
expires_at: string | null;
|
||||
started_at?: string;
|
||||
reminder_at?: string | null;
|
||||
escalation_at?: string | null;
|
||||
basis_hash: string | null;
|
||||
};
|
||||
type Props = {
|
||||
requisition: {
|
||||
id: number;
|
||||
number: string;
|
||||
status: string;
|
||||
process_version: number;
|
||||
approval_cycle: number;
|
||||
};
|
||||
deadline: Deadline;
|
||||
canExpire: boolean;
|
||||
canEdit: boolean;
|
||||
actorId: number;
|
||||
tenantId: number;
|
||||
history: {
|
||||
data: {
|
||||
id: number;
|
||||
data: { cycle: number; next_cycle: number };
|
||||
reason: string;
|
||||
request: { number: string };
|
||||
steps: {
|
||||
id: number;
|
||||
position: number;
|
||||
role: string;
|
||||
decision: string;
|
||||
}[];
|
||||
}[];
|
||||
prev_page_url: string | null;
|
||||
next_page_url: string | null;
|
||||
};
|
||||
};
|
||||
const labels: Record<string, string> = {
|
||||
inactive: 'Sem etapa pendente',
|
||||
unconfigured: 'Sem prazo configurado',
|
||||
unverified: 'Datas por conferir',
|
||||
running: 'Em prazo',
|
||||
expired: 'Prazo terminado',
|
||||
};
|
||||
const time = (value?: string | null) =>
|
||||
value ? new Date(value).toLocaleString('pt-MZ') : 'Por indicar';
|
||||
export default function Expiry(props: Props) {
|
||||
const r = props.requisition;
|
||||
const form = useForm(`expiry:${props.tenantId}:${props.actorId}:${r.id}`, {
|
||||
operation_key: '',
|
||||
process_version: r.process_version,
|
||||
basis_hash: props.deadline.basis_hash || '',
|
||||
comment: '',
|
||||
});
|
||||
const current =
|
||||
form.data.process_version === r.process_version &&
|
||||
form.data.basis_hash === (props.deadline.basis_hash || '');
|
||||
const ref = useRef<HTMLFormElement>(null);
|
||||
useEffect(() => {
|
||||
const node = ref.current;
|
||||
window.dispatchEvent(
|
||||
new CustomEvent('sgc:context-dirty', {
|
||||
detail: { form: node, dirty: form.isDirty },
|
||||
}),
|
||||
);
|
||||
return () => {
|
||||
window.dispatchEvent(
|
||||
new CustomEvent('sgc:context-dirty', {
|
||||
detail: { form: node, dirty: false },
|
||||
}),
|
||||
);
|
||||
};
|
||||
}, [form.isDirty]);
|
||||
return (
|
||||
<div className="mx-auto grid w-full max-w-6xl min-w-0 gap-6 p-5 lg:p-8">
|
||||
<Head title="Prazos da aprovação" />
|
||||
<PageTitle
|
||||
eyebrow={r.number}
|
||||
title="Prazos da aprovação"
|
||||
description="A política preservada na submissão determina os prazos de cada etapa. A devolução mantém o pedido e o histórico para nova submissão pelo requisitante."
|
||||
/>
|
||||
<Link className="underline" href={`/requisicoes/${r.id}`}>
|
||||
Voltar à requisição
|
||||
</Link>
|
||||
<Panel
|
||||
title={`${labels[props.deadline.state] || 'Por conferir'} · ciclo ${r.approval_cycle}`}
|
||||
>
|
||||
<dl className="grid gap-3 text-sm">
|
||||
<div>
|
||||
<dt>Início da etapa</dt>
|
||||
<dd>{time(props.deadline.started_at)}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Expiração</dt>
|
||||
<dd>{time(props.deadline.expires_at)}</dd>
|
||||
</div>
|
||||
{props.deadline.reminder_at && (
|
||||
<div>
|
||||
<dt>Lembrete previsto</dt>
|
||||
<dd>{time(props.deadline.reminder_at)}</dd>
|
||||
</div>
|
||||
)}
|
||||
{props.deadline.escalation_at && (
|
||||
<div>
|
||||
<dt>Escalamento previsto</dt>
|
||||
<dd>{time(props.deadline.escalation_at)}</dd>
|
||||
</div>
|
||||
)}
|
||||
</dl>
|
||||
<p className="mt-4 text-sm text-muted-foreground">
|
||||
Os prazos usam minutos corridos desde a activação da etapa.
|
||||
Uma alteração posterior da política não reescreve o ciclo já
|
||||
submetido.
|
||||
</p>
|
||||
<Button
|
||||
className="mt-4"
|
||||
variant="outline"
|
||||
onClick={() => router.reload()}
|
||||
>
|
||||
Actualizar conferência do prazo
|
||||
</Button>
|
||||
</Panel>
|
||||
{props.canExpire && (
|
||||
<Panel
|
||||
title="Devolver o pedido vencido"
|
||||
description="A reserva remanescente deste ciclo é libertada pelo percurso orçamental. As aprovações anteriores ficam no histórico e a nova submissão exige novas etapas."
|
||||
>
|
||||
<form
|
||||
ref={ref}
|
||||
className="space-y-4"
|
||||
onSubmit={(event) => {
|
||||
event.preventDefault();
|
||||
const operation =
|
||||
form.data.operation_key || crypto.randomUUID();
|
||||
form.setData('operation_key', operation);
|
||||
form.transform((data) => ({
|
||||
...data,
|
||||
operation_key: operation,
|
||||
}));
|
||||
form.post(`/requisicoes/${r.id}/expiracao`, {
|
||||
preserveScroll: true,
|
||||
onSuccess: () => {
|
||||
form.reset();
|
||||
form.clearErrors();
|
||||
},
|
||||
});
|
||||
}}
|
||||
>
|
||||
<FormErrors errors={form.errors} />
|
||||
{!current && (
|
||||
<div className="space-y-2">
|
||||
<p>
|
||||
A etapa mudou. Reveja a conferência actual
|
||||
antes de devolver.
|
||||
</p>
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
onClick={() =>
|
||||
form.setData((data) => ({
|
||||
...data,
|
||||
process_version: r.process_version,
|
||||
basis_hash:
|
||||
props.deadline.basis_hash || '',
|
||||
operation_key: '',
|
||||
}))
|
||||
}
|
||||
>
|
||||
Preparar devolução da etapa actual
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
<label className="grid gap-2">
|
||||
Comentário adicional, quando necessário
|
||||
<textarea
|
||||
className={controlClass}
|
||||
maxLength={2000}
|
||||
value={form.data.comment}
|
||||
onChange={(event) =>
|
||||
form.setData('comment', event.target.value)
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
<Button disabled={form.processing || !current}>
|
||||
Devolver ao requisitante
|
||||
</Button>
|
||||
</form>
|
||||
</Panel>
|
||||
)}
|
||||
{props.canEdit && (
|
||||
<Panel title="Pedido devolvido para preparação">
|
||||
<p>
|
||||
Reveja os dados do rascunho e submeta novamente quando
|
||||
estiver preparado. O ciclo anterior permanece no
|
||||
histórico.
|
||||
</p>
|
||||
<Button className="mt-3" asChild>
|
||||
<Link href={`/requisicoes/${r.id}/editar`}>
|
||||
Rever rascunho
|
||||
</Link>
|
||||
</Button>
|
||||
</Panel>
|
||||
)}
|
||||
<Panel title="Ciclos anteriores">
|
||||
{props.history.data.length === 0 && (
|
||||
<p>Ainda não há devoluções por expiração registadas.</p>
|
||||
)}
|
||||
{props.history.data.map((row) => (
|
||||
<article
|
||||
key={row.id}
|
||||
className="space-y-2 border-b py-4 break-words"
|
||||
>
|
||||
<h3 className="font-semibold">
|
||||
Ciclo {row.data.cycle} · devolvido para o ciclo{' '}
|
||||
{row.data.next_cycle}
|
||||
</h3>
|
||||
<p>{row.reason}</p>
|
||||
<ul>
|
||||
{row.steps.map((step) => (
|
||||
<li key={step.id}>
|
||||
Etapa {step.position}:{' '}
|
||||
{step.decision === 'approved'
|
||||
? 'Aprovação preservada'
|
||||
: 'Etapa pendente no momento da devolução'}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</article>
|
||||
))}
|
||||
<nav className="mt-3 flex gap-4" aria-label="Ciclos anteriores">
|
||||
{props.history.prev_page_url && (
|
||||
<Link href={props.history.prev_page_url}>Anterior</Link>
|
||||
)}
|
||||
{props.history.next_page_url && (
|
||||
<Link href={props.history.next_page_url}>Seguinte</Link>
|
||||
)}
|
||||
</nav>
|
||||
</Panel>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -3,6 +3,7 @@ import { hasPreparationChanges } from '@/lib/requisition-history';
|
||||
import { Plus, Save, Trash2 } from 'lucide-react';
|
||||
import { useEffect, useRef } from 'react';
|
||||
import {
|
||||
ActionBar,
|
||||
FormErrors,
|
||||
PageTitle,
|
||||
Panel,
|
||||
@@ -718,7 +719,7 @@ export default function RequisitionForm({
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
<div className="mt-3 flex justify-end">
|
||||
<ActionBar align="end" className="mt-3">
|
||||
<Button
|
||||
type="button"
|
||||
variant="ghost"
|
||||
@@ -738,7 +739,7 @@ export default function RequisitionForm({
|
||||
<Trash2 className="size-4" />
|
||||
Remover linha
|
||||
</Button>
|
||||
</div>
|
||||
</ActionBar>
|
||||
</fieldset>
|
||||
))}
|
||||
</div>
|
||||
@@ -779,7 +780,7 @@ export default function RequisitionForm({
|
||||
O servidor confirma os cálculos ao guardar.
|
||||
</p>
|
||||
</Panel>
|
||||
<div className="flex justify-end gap-3">
|
||||
<ActionBar align="end">
|
||||
<Button variant="outline" asChild>
|
||||
<Link
|
||||
href={
|
||||
@@ -801,7 +802,7 @@ export default function RequisitionForm({
|
||||
<Save className="size-4" />
|
||||
Guardar rascunho
|
||||
</Button>
|
||||
</div>
|
||||
</ActionBar>
|
||||
</form>
|
||||
</div>
|
||||
</>
|
||||
|
||||
@@ -3,6 +3,8 @@ import { Check, Circle, Pencil, Send } from 'lucide-react';
|
||||
import { ComparisonPolicySummary } from '@/components/comparison-policy-summary';
|
||||
import type { ComparisonPolicy } from '@/components/comparison-policy-summary';
|
||||
import {
|
||||
ActionBar,
|
||||
TableViewport,
|
||||
FormErrors,
|
||||
PageTitle,
|
||||
Panel,
|
||||
@@ -35,6 +37,10 @@ const actions: Record<string, string> = {
|
||||
'budget.distribution_cancel': 'Compromisso distribuído cancelado',
|
||||
'budget.distribution_amended': 'Compromisso reafectado por Finanças',
|
||||
'requisition.submitted': 'Pedido submetido',
|
||||
'requisition.expired_returned': 'Pedido devolvido por expiração',
|
||||
'budget.cycle_opened': 'Novo ciclo orçamental preparado',
|
||||
'budget.cycle_closed':
|
||||
'Ciclo orçamental encerrado após libertação da reserva',
|
||||
'approval.approved': 'Etapa aprovada',
|
||||
'approval.rejected': 'Pedido rejeitado',
|
||||
};
|
||||
@@ -56,9 +62,11 @@ export default function Show({
|
||||
importTariffsReady = false,
|
||||
importEstimatesReady = false,
|
||||
capitalRegisterReady = false,
|
||||
expiryReady = false,
|
||||
}: {
|
||||
importEstimatesReady?: boolean;
|
||||
capitalRegisterReady?: boolean;
|
||||
expiryReady?: boolean;
|
||||
importTariffsReady?: boolean;
|
||||
canPrepareDistributions?: boolean;
|
||||
requisition: Requisition;
|
||||
@@ -176,6 +184,13 @@ export default function Show({
|
||||
</Link>
|
||||
</Button>
|
||||
)}
|
||||
{expiryReady && (
|
||||
<Button asChild variant="outline">
|
||||
<Link href={`/requisicoes/${r.id}/prazos`}>
|
||||
Prazos e ciclos da aprovação
|
||||
</Link>
|
||||
</Button>
|
||||
)}
|
||||
{importEstimatesReady && (
|
||||
<Button asChild variant="outline">
|
||||
<Link
|
||||
@@ -384,7 +399,7 @@ export default function Show({
|
||||
Confira o pedido antes de o enviar para
|
||||
aprovação.
|
||||
</p>
|
||||
<div className="flex gap-2">
|
||||
<ActionBar>
|
||||
<Button asChild variant="outline">
|
||||
<Link href={`/requisicoes/${r.id}/editar`}>
|
||||
<Pencil className="size-4" />
|
||||
@@ -402,7 +417,7 @@ export default function Show({
|
||||
<Send className="size-4" />
|
||||
Submeter para aprovação
|
||||
</Button>
|
||||
</div>
|
||||
</ActionBar>
|
||||
</div>
|
||||
))}
|
||||
<div className="grid gap-6 lg:grid-cols-3">
|
||||
@@ -460,7 +475,7 @@ export default function Show({
|
||||
title="Artigos e valores"
|
||||
description="Moeda: MZN · Montantes estimados"
|
||||
>
|
||||
<div className="overflow-x-auto">
|
||||
<TableViewport>
|
||||
<table className="w-full text-left text-sm">
|
||||
<thead className="border-b text-xs text-muted-foreground">
|
||||
<tr>
|
||||
@@ -544,7 +559,7 @@ export default function Show({
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</TableViewport>
|
||||
<dl className="mt-5 ml-auto max-w-xs space-y-3 text-sm">
|
||||
<div className="flex justify-between">
|
||||
<dt>Subtotal sem IVA</dt>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { Head, Link, useForm } from '@inertiajs/react';
|
||||
import {
|
||||
TableViewport,
|
||||
PageTitle,
|
||||
Panel,
|
||||
FormErrors,
|
||||
@@ -111,7 +112,7 @@ export default function Availability(props: Props) {
|
||||
<p>Seleccione o armazém para consultar.</p>
|
||||
) : (
|
||||
<>
|
||||
<div className="overflow-x-auto">
|
||||
<TableViewport>
|
||||
<table className="w-full text-left text-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -201,7 +202,7 @@ export default function Availability(props: Props) {
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</TableViewport>
|
||||
{props.rows.data.length === 0 && (
|
||||
<p>Sem artigos nos filtros seleccionados.</p>
|
||||
)}
|
||||
|
||||
@@ -7,6 +7,7 @@ import { TerritorialFilter } from '@/components/territorial-filter';
|
||||
import { Head, Link, useForm } from '@inertiajs/react';
|
||||
import { InventoryNotice, InventoryPagination } from '@/components/inventory';
|
||||
import {
|
||||
TableViewport,
|
||||
FormErrors,
|
||||
PageTitle,
|
||||
Panel,
|
||||
@@ -178,7 +179,7 @@ export default function Stock({
|
||||
</select>
|
||||
<Button variant="outline">Filtrar</Button>
|
||||
</form>
|
||||
<div className="overflow-x-auto">
|
||||
<TableViewport>
|
||||
<table className="w-full text-left text-sm">
|
||||
<thead className="border-b text-muted-foreground">
|
||||
<tr>
|
||||
@@ -229,7 +230,7 @@ export default function Stock({
|
||||
})}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</TableViewport>
|
||||
{balances.length === 0 && (
|
||||
<p className="py-6 text-sm text-muted-foreground">
|
||||
Não há entradas confirmadas para estes filtros.
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { Head, Link, useForm } from '@inertiajs/react';
|
||||
import {
|
||||
TableViewport,
|
||||
PageTitle,
|
||||
Panel,
|
||||
FormErrors,
|
||||
@@ -490,7 +491,7 @@ export default function WarehouseRequest(props: Props) {
|
||||
</div>
|
||||
)}
|
||||
<Panel title="Artigos e atendimento">
|
||||
<div className="overflow-x-auto">
|
||||
<TableViewport>
|
||||
<table className="w-full text-left text-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -545,7 +546,7 @@ export default function WarehouseRequest(props: Props) {
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</TableViewport>
|
||||
<p className="mt-4 text-sm">
|
||||
{p.reservation_ready
|
||||
? 'A autorização reserva o material utilizável disponível. Só a entrega confirmada reduz o stock. Retenções de qualidade e validade são revalidadas na entrega.'
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { Head, Link, useForm } from '@inertiajs/react';
|
||||
import {
|
||||
ActionBar,
|
||||
PageTitle,
|
||||
Panel,
|
||||
FormErrors,
|
||||
@@ -535,7 +536,7 @@ export default function Requests(props: Props) {
|
||||
)}
|
||||
</fieldset>
|
||||
))}
|
||||
<div className="flex gap-3">
|
||||
<ActionBar>
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
@@ -559,7 +560,7 @@ export default function Requests(props: Props) {
|
||||
>
|
||||
Guardar rascunho
|
||||
</Button>
|
||||
</div>
|
||||
</ActionBar>
|
||||
{props.costCenters.length === 0 && (
|
||||
<p>
|
||||
É necessário um centro de custo
|
||||
|
||||
@@ -5,6 +5,7 @@ import type {
|
||||
} from '@/components/administrative-location';
|
||||
import { Head, Link, useForm } from '@inertiajs/react';
|
||||
import {
|
||||
ActionBar,
|
||||
FormErrors,
|
||||
PageTitle,
|
||||
Panel,
|
||||
@@ -145,7 +146,7 @@ export default function EditSupplier({
|
||||
/>
|
||||
Fornecedor consta da lista de impedidos
|
||||
</label>
|
||||
<div className="flex justify-end gap-3">
|
||||
<ActionBar align="end">
|
||||
<Button asChild variant="outline">
|
||||
<Link href={`/fornecedores/${supplier.id}`}>
|
||||
Cancelar
|
||||
@@ -154,7 +155,7 @@ export default function EditSupplier({
|
||||
<Button disabled={form.processing}>
|
||||
Guardar alterações
|
||||
</Button>
|
||||
</div>
|
||||
</ActionBar>
|
||||
</form>
|
||||
</Panel>
|
||||
</div>
|
||||
|
||||
@@ -4,7 +4,12 @@ import SupplierImprovements from '@/components/supplier-improvements';
|
||||
import type { ImprovementData } from '@/components/supplier-improvements';
|
||||
import SupplierResponses from '@/components/supplier-responses';
|
||||
import type { ResponseData } from '@/components/supplier-responses';
|
||||
import { PageTitle, Panel, controlClass } from '@/components/procurement';
|
||||
import {
|
||||
ActionBar,
|
||||
PageTitle,
|
||||
Panel,
|
||||
controlClass,
|
||||
} from '@/components/procurement';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import SupplierEvaluationFields, {
|
||||
evaluationStates,
|
||||
@@ -204,7 +209,7 @@ export default function SupplierEvaluation({
|
||||
{error}
|
||||
</p>
|
||||
))}
|
||||
<div className="flex flex-wrap gap-3">
|
||||
<ActionBar>
|
||||
<Button
|
||||
disabled={
|
||||
form.processing || command.processing
|
||||
@@ -224,7 +229,7 @@ export default function SupplierEvaluation({
|
||||
>
|
||||
Submeter para revisão
|
||||
</Button>
|
||||
</div>
|
||||
</ActionBar>
|
||||
{dirty && (
|
||||
<p className="text-sm text-muted-foreground">
|
||||
Guarde as alterações antes de submeter. A
|
||||
@@ -363,7 +368,7 @@ export default function SupplierEvaluation({
|
||||
{error}
|
||||
</p>
|
||||
))}
|
||||
<div className="flex flex-wrap gap-3">
|
||||
<ActionBar>
|
||||
<Button
|
||||
type="button"
|
||||
disabled={command.processing || waiting > 0}
|
||||
@@ -379,7 +384,7 @@ export default function SupplierEvaluation({
|
||||
>
|
||||
Devolver para correcção
|
||||
</Button>
|
||||
</div>
|
||||
</ActionBar>
|
||||
{waiting > 0 && (
|
||||
<p className="text-sm text-amber-800">
|
||||
Existem {waiting} critérios pendentes.
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
import { Head, Link, useForm } from '@inertiajs/react';
|
||||
import { PageTitle, Panel, controlClass } from '@/components/procurement';
|
||||
import {
|
||||
TableViewport,
|
||||
PageTitle,
|
||||
Panel,
|
||||
controlClass,
|
||||
} from '@/components/procurement';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import SupplierEvaluationFields, {
|
||||
emptyEvaluation,
|
||||
@@ -156,7 +161,7 @@ export default function SupplierEvaluations({
|
||||
{records.total} avaliações/revisões no âmbito
|
||||
autorizado.
|
||||
</p>
|
||||
<div className="overflow-x-auto">
|
||||
<TableViewport>
|
||||
<table className="w-full min-w-180 text-left text-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -214,7 +219,7 @@ export default function SupplierEvaluations({
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</TableViewport>
|
||||
{records.data.length === 0 && (
|
||||
<p className="py-4 text-sm">
|
||||
Sem avaliações nos filtros e no âmbito
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { Head, Link, router } from '@inertiajs/react';
|
||||
import { useState } from 'react';
|
||||
import {
|
||||
ActionBar,
|
||||
FormErrors,
|
||||
PageTitle,
|
||||
Panel,
|
||||
@@ -160,7 +161,7 @@ export default function AgreementFollowup({
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
<div className="flex items-center gap-4">
|
||||
<ActionBar>
|
||||
<Button type="submit">Aplicar filtros</Button>
|
||||
<Link
|
||||
href={
|
||||
@@ -172,7 +173,7 @@ export default function AgreementFollowup({
|
||||
>
|
||||
Limpar filtros
|
||||
</Link>
|
||||
</div>
|
||||
</ActionBar>
|
||||
</form>
|
||||
<div className="mt-4">
|
||||
<FormErrors errors={errors} />
|
||||
|
||||
@@ -2,6 +2,7 @@ import { Head, Link, useForm, useRemember } from '@inertiajs/react';
|
||||
import { useEffect, useRef, type RefObject } from 'react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import {
|
||||
ActionBar,
|
||||
FormErrors,
|
||||
PageTitle,
|
||||
Panel,
|
||||
@@ -998,7 +999,7 @@ function CostPreparation(props: Props & { url: string; historyKey: string }) {
|
||||
onChange={(e) => form.setData('reason', e.target.value)}
|
||||
/>
|
||||
</label>
|
||||
<div className="flex flex-wrap gap-3">
|
||||
<ActionBar>
|
||||
<Button disabled={form.processing}>Conferir valores</Button>
|
||||
<Button
|
||||
type="button"
|
||||
@@ -1027,7 +1028,7 @@ function CostPreparation(props: Props & { url: string; historyKey: string }) {
|
||||
>
|
||||
Guardar para revisão
|
||||
</Button>
|
||||
</div>
|
||||
</ActionBar>
|
||||
</form>
|
||||
</Panel>
|
||||
);
|
||||
|
||||
@@ -145,7 +145,9 @@ export default function Notices({
|
||||
Resultado registado:{' '}
|
||||
{notice.outcome === 'approved'
|
||||
? 'requisição aprovada'
|
||||
: 'requisição rejeitada'}
|
||||
: notice.outcome === 'expired'
|
||||
? 'pedido devolvido por expiração'
|
||||
: 'requisição rejeitada'}
|
||||
. Estado actual:{' '}
|
||||
{statusLabels[notice.current_status] ??
|
||||
notice.current_status}
|
||||
|
||||
Reference in New Issue
Block a user