@@ -0,0 +1,97 @@
|
||||
import { controlClass } from '@/components/procurement';
|
||||
|
||||
export type BudgetDistributionInput = {
|
||||
allocation_key: string;
|
||||
line_id: number;
|
||||
centre_id: number;
|
||||
subtotal: string;
|
||||
total: string;
|
||||
};
|
||||
export type BudgetDistributionOption = BudgetDistributionInput & {
|
||||
line_label: string;
|
||||
centre_label: string;
|
||||
};
|
||||
|
||||
export default function BudgetDistributionFields({
|
||||
options,
|
||||
rows,
|
||||
onChange,
|
||||
reason,
|
||||
onReason,
|
||||
}: {
|
||||
options: BudgetDistributionOption[];
|
||||
rows: BudgetDistributionInput[];
|
||||
onChange: (rows: BudgetDistributionInput[]) => void;
|
||||
reason: string;
|
||||
onReason: (reason: string) => void;
|
||||
}) {
|
||||
return (
|
||||
<fieldset className="space-y-4 rounded border p-4">
|
||||
<legend>Distribuição explícita em MZN</legend>
|
||||
<p className="text-sm">
|
||||
Confira o valor sem IVA e o total de cada parcela com o
|
||||
documento actual. As parcelas conservam os artigos e centros
|
||||
aprovados. Nenhuma diferença será distribuída automaticamente.
|
||||
</p>
|
||||
{rows.map((row, index) => {
|
||||
const option = options.find(
|
||||
(item) => item.allocation_key === row.allocation_key,
|
||||
);
|
||||
return (
|
||||
<fieldset
|
||||
key={row.allocation_key}
|
||||
className="grid gap-3 sm:grid-cols-2"
|
||||
>
|
||||
<legend className="text-sm font-medium">
|
||||
{option?.line_label} · {option?.centre_label}
|
||||
</legend>
|
||||
{(['subtotal', 'total'] as const).map((field) => (
|
||||
<label key={field}>
|
||||
{field === 'subtotal'
|
||||
? 'Sem IVA (MZN)'
|
||||
: 'Total (MZN)'}
|
||||
<input
|
||||
required
|
||||
inputMode="decimal"
|
||||
pattern="[0-9]+([.][0-9]{1,2})?"
|
||||
className={controlClass}
|
||||
value={row[field]}
|
||||
onChange={(event) =>
|
||||
onChange(
|
||||
rows.map((item, i) =>
|
||||
i === index
|
||||
? {
|
||||
...item,
|
||||
[field]:
|
||||
event.target
|
||||
.value,
|
||||
}
|
||||
: item,
|
||||
),
|
||||
)
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
))}
|
||||
</fieldset>
|
||||
);
|
||||
})}
|
||||
<label>
|
||||
Motivo da imputação
|
||||
<textarea
|
||||
required
|
||||
minLength={10}
|
||||
maxLength={4000}
|
||||
className={controlClass}
|
||||
value={reason}
|
||||
onChange={(event) => onReason(event.target.value)}
|
||||
/>
|
||||
</label>
|
||||
<p className="text-sm">
|
||||
Use ponto para separar os centavos. Se a referência cambial ou a
|
||||
conferência tiver mudado, os valores terão de ser novamente
|
||||
conferidos.
|
||||
</p>
|
||||
</fieldset>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
import { Panel } from '@/components/procurement';
|
||||
import { Button } from '@/components/ui/button';
|
||||
|
||||
export type PayableInsights = {
|
||||
method: 'native_payable_positions_v1';
|
||||
coverage: {
|
||||
invoices: number;
|
||||
recognised: number;
|
||||
unrecognised: number;
|
||||
indeterminate: number;
|
||||
};
|
||||
currencies: {
|
||||
currency: string;
|
||||
count: number;
|
||||
principal_minor: string;
|
||||
confirmed_payments_minor: string;
|
||||
allocated_payments_minor: string;
|
||||
balance_minor: string;
|
||||
}[];
|
||||
};
|
||||
|
||||
export function exactMinorAmount(minor: string, currency: string): string {
|
||||
if (!/^-?\d+$/.test(minor)) return 'Indeterminado';
|
||||
const sign = minor.startsWith('-') ? '-' : '';
|
||||
const digits = minor.replace(/^-/, '').padStart(3, '0');
|
||||
const whole = digits.slice(0, -2).replace(/\B(?=(\d{3})+(?!\d))/g, '.');
|
||||
return `${sign}${whole},${digits.slice(-2)} ${currency}`;
|
||||
}
|
||||
|
||||
export function ProcurementPayableInsights({
|
||||
data,
|
||||
exportHref,
|
||||
}: {
|
||||
data: PayableInsights;
|
||||
exportHref?: string;
|
||||
}) {
|
||||
return (
|
||||
<Panel title="Posição actual das obrigações aos fornecedores">
|
||||
<div className="space-y-4 text-sm">
|
||||
<p>
|
||||
Posições financeiras reconhecidas para as facturas dos
|
||||
pedidos nos filtros actuais, incluindo todas as páginas. O
|
||||
período dos filtros refere-se à criação do pedido; os saldos
|
||||
são os actuais, na data de geração do relatório.
|
||||
</p>
|
||||
<p>
|
||||
{data.coverage.recognised} de {data.coverage.invoices}{' '}
|
||||
facturas com posição reconhecida e determinada. Por
|
||||
reconhecer: {data.coverage.unrecognised}. Posição
|
||||
indeterminada ou origem divergente:{' '}
|
||||
{data.coverage.indeterminate}.
|
||||
</p>
|
||||
{(data.coverage.unrecognised > 0 ||
|
||||
data.coverage.indeterminate > 0) && (
|
||||
<p role="status">
|
||||
Os totais seguintes abrangem apenas as posições
|
||||
determinadas. A ausência de reconhecimento ou a
|
||||
divergência não é tratada como saldo zero.
|
||||
</p>
|
||||
)}
|
||||
{data.currencies.map((row) => (
|
||||
<div
|
||||
key={row.currency}
|
||||
className="space-y-3 rounded-lg border p-4"
|
||||
>
|
||||
<h3 className="font-semibold">
|
||||
{row.currency} · {row.count} obrigações
|
||||
</h3>
|
||||
<dl className="grid gap-4 sm:grid-cols-2">
|
||||
<div>
|
||||
<dt>Principal reconhecido</dt>
|
||||
<dd className="font-medium break-words">
|
||||
{exactMinorAmount(
|
||||
row.principal_minor,
|
||||
row.currency,
|
||||
)}
|
||||
</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Saldo actual</dt>
|
||||
<dd className="font-medium break-words">
|
||||
{exactMinorAmount(
|
||||
row.balance_minor,
|
||||
row.currency,
|
||||
)}
|
||||
</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Pagamentos históricos conferidos</dt>
|
||||
<dd className="break-words">
|
||||
{exactMinorAmount(
|
||||
row.confirmed_payments_minor,
|
||||
row.currency,
|
||||
)}
|
||||
</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Liquidações imputadas</dt>
|
||||
<dd className="break-words">
|
||||
{exactMinorAmount(
|
||||
row.allocated_payments_minor,
|
||||
row.currency,
|
||||
)}
|
||||
</dd>
|
||||
</div>
|
||||
</dl>
|
||||
</div>
|
||||
))}
|
||||
{data.currencies.length === 0 && (
|
||||
<p>
|
||||
Sem posições determinadas neste âmbito para totalizar.
|
||||
</p>
|
||||
)}
|
||||
<p>
|
||||
As moedas são apresentadas separadamente, sem conversão
|
||||
adicional. Os valores representam a posição actual das
|
||||
obrigações, sem estimar vencimentos ou atrasos.
|
||||
</p>
|
||||
<a className="underline" href="/obrigacoes-fornecedores">
|
||||
Conferir obrigações e respectivas origens
|
||||
</a>
|
||||
{exportHref && (
|
||||
<div>
|
||||
<Button asChild variant="outline">
|
||||
<a href={exportHref} download>
|
||||
Exportar posição actual (CSV)
|
||||
</a>
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</Panel>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,384 @@
|
||||
import { useForm } from '@inertiajs/react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { FormErrors, Panel, controlClass } from '@/components/procurement';
|
||||
|
||||
type SavedLevel = {
|
||||
name: string;
|
||||
profile_ids: number[];
|
||||
scope: 'company' | 'department';
|
||||
min_minor: number | null;
|
||||
categories: string[];
|
||||
cost_center_ids: number[];
|
||||
};
|
||||
export type RequisitionApprovalPlan = {
|
||||
revision: number;
|
||||
enabled: boolean;
|
||||
quorum: 'one_eligible';
|
||||
levels: SavedLevel[];
|
||||
};
|
||||
type Profile = { id: number; name: string; permissions: string[] };
|
||||
const amountInput = (minor: number | null) => {
|
||||
if (minor === null) return '';
|
||||
const digits = String(minor).padStart(3, '0');
|
||||
return `${digits.slice(0, -2)}.${digits.slice(-2)}`;
|
||||
};
|
||||
const newLevel = () => ({
|
||||
name: '',
|
||||
profile_ids: [] as number[],
|
||||
scope: 'department' as 'company' | 'department',
|
||||
min_amount: '',
|
||||
categories_text: '',
|
||||
cost_center_ids: [] as number[],
|
||||
});
|
||||
|
||||
export function RequisitionApprovalSettings({
|
||||
plan,
|
||||
ready,
|
||||
profiles,
|
||||
costCenters,
|
||||
version,
|
||||
}: {
|
||||
plan?: RequisitionApprovalPlan | null;
|
||||
ready: boolean;
|
||||
profiles: Profile[];
|
||||
costCenters: { id: number; code: string; name: string }[];
|
||||
version: number;
|
||||
}) {
|
||||
const form = useForm({
|
||||
version,
|
||||
enabled: plan?.enabled ?? false,
|
||||
reason: '',
|
||||
levels:
|
||||
plan?.levels.map((level) => ({
|
||||
name: level.name,
|
||||
profile_ids: level.profile_ids,
|
||||
scope: level.scope,
|
||||
min_amount: amountInput(level.min_minor),
|
||||
categories_text: level.categories.join('\n'),
|
||||
cost_center_ids: level.cost_center_ids,
|
||||
})) ?? [],
|
||||
});
|
||||
const eligibleProfiles = profiles.filter((profile) =>
|
||||
profile.permissions.includes('requisition_approve'),
|
||||
);
|
||||
const change = (
|
||||
index: number,
|
||||
values: Partial<ReturnType<typeof newLevel>>,
|
||||
) =>
|
||||
form.setData(
|
||||
'levels',
|
||||
form.data.levels.map((level, position) =>
|
||||
position === index ? { ...level, ...values } : level,
|
||||
),
|
||||
);
|
||||
return (
|
||||
<Panel
|
||||
title="Níveis adicionais de aprovação"
|
||||
description="Conserva os controlos de chefia, Compras e Finanças definidos pelas alçadas. Pode acrescentar até cinco níveis condicionais, até oito no total. Uma pessoa elegível decide cada nível; a mesma pessoa não decide duas etapas do processo."
|
||||
>
|
||||
{!ready ? (
|
||||
<p>
|
||||
Os níveis adicionais ainda não estão disponíveis nesta
|
||||
instalação. O circuito actual permanece em vigor.
|
||||
</p>
|
||||
) : (
|
||||
<form
|
||||
className="space-y-5"
|
||||
onSubmit={(event) => {
|
||||
event.preventDefault();
|
||||
form.transform((values) => ({
|
||||
version,
|
||||
enabled: values.enabled,
|
||||
reason: values.reason,
|
||||
levels: values.levels.map((level) => ({
|
||||
name: level.name,
|
||||
profile_ids: level.profile_ids,
|
||||
scope: level.scope,
|
||||
min_amount: level.min_amount || null,
|
||||
categories: level.categories_text
|
||||
.split('\n')
|
||||
.map((value) => value.trim())
|
||||
.filter(Boolean),
|
||||
cost_center_ids: level.cost_center_ids,
|
||||
})),
|
||||
}));
|
||||
form.post(
|
||||
'/administracao/parametrizacao/approval_levels',
|
||||
{ preserveScroll: true },
|
||||
);
|
||||
}}
|
||||
>
|
||||
<FormErrors errors={form.errors} />
|
||||
<p className="text-sm">
|
||||
O plano aplica-se apenas a novas submissões. Os níveis
|
||||
já submetidos conservam o plano original; permissões,
|
||||
vigências e conflitos são sempre conferidos no momento
|
||||
da decisão. A configuração não concede funções aos
|
||||
utilizadores.
|
||||
</p>
|
||||
<label className="flex items-center gap-2 text-sm">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={form.data.enabled}
|
||||
onChange={(event) =>
|
||||
form.setData('enabled', event.target.checked)
|
||||
}
|
||||
/>
|
||||
Aplicar o plano nas novas submissões
|
||||
</label>
|
||||
{eligibleProfiles.length === 0 && (
|
||||
<p>
|
||||
Configure primeiro os perfis com a competência
|
||||
«Aprovar níveis adicionais de requisições». Não são
|
||||
atribuídos automaticamente.
|
||||
</p>
|
||||
)}
|
||||
{form.data.levels.map((level, index) => (
|
||||
<fieldset
|
||||
className="min-w-0 space-y-4 rounded border p-4"
|
||||
key={index}
|
||||
>
|
||||
<legend className="px-2">
|
||||
Nível adicional {index + 1}
|
||||
</legend>
|
||||
<div className="grid gap-4 sm:grid-cols-2">
|
||||
<label
|
||||
className="grid gap-2 text-sm"
|
||||
htmlFor={`approval-name-${index}`}
|
||||
>
|
||||
Designação
|
||||
<input
|
||||
id={`approval-name-${index}`}
|
||||
className={controlClass}
|
||||
required
|
||||
maxLength={120}
|
||||
value={level.name}
|
||||
onChange={(event) =>
|
||||
change(index, {
|
||||
name: event.target.value,
|
||||
})
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
<label
|
||||
className="grid gap-2 text-sm"
|
||||
htmlFor={`approval-scope-${index}`}
|
||||
>
|
||||
Âmbito
|
||||
<select
|
||||
id={`approval-scope-${index}`}
|
||||
className={controlClass}
|
||||
value={level.scope}
|
||||
onChange={(event) =>
|
||||
change(index, {
|
||||
scope: event.target
|
||||
.value as SavedLevel['scope'],
|
||||
})
|
||||
}
|
||||
>
|
||||
<option value="department">
|
||||
Do departamento da requisição
|
||||
</option>
|
||||
<option value="company">
|
||||
Da empresa
|
||||
</option>
|
||||
</select>
|
||||
</label>
|
||||
<label
|
||||
className="grid gap-2 text-sm"
|
||||
htmlFor={`approval-amount-${index}`}
|
||||
>
|
||||
Aplicar a partir de (MZN, opcional)
|
||||
<input
|
||||
id={`approval-amount-${index}`}
|
||||
className={controlClass}
|
||||
inputMode="decimal"
|
||||
value={level.min_amount}
|
||||
onChange={(event) =>
|
||||
change(index, {
|
||||
min_amount: event.target.value,
|
||||
})
|
||||
}
|
||||
/>
|
||||
<span className="text-xs text-muted-foreground">
|
||||
Usa a mesma base com ou sem IVA das
|
||||
alçadas. Vazio aplica-se a qualquer
|
||||
valor.
|
||||
</span>
|
||||
</label>
|
||||
<label
|
||||
className="grid gap-2 text-sm"
|
||||
htmlFor={`approval-categories-${index}`}
|
||||
>
|
||||
Categorias exactas (opcional, uma por linha)
|
||||
<textarea
|
||||
id={`approval-categories-${index}`}
|
||||
className={controlClass}
|
||||
value={level.categories_text}
|
||||
onChange={(event) =>
|
||||
change(index, {
|
||||
categories_text:
|
||||
event.target.value,
|
||||
})
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
<fieldset className="space-y-2">
|
||||
<legend className="text-sm font-medium">
|
||||
Perfis elegíveis — basta um aprovador
|
||||
</legend>
|
||||
<div className="flex flex-wrap gap-4">
|
||||
{profiles
|
||||
.filter(
|
||||
(profile) =>
|
||||
profile.permissions.includes(
|
||||
'requisition_approve',
|
||||
) ||
|
||||
level.profile_ids.includes(
|
||||
profile.id,
|
||||
),
|
||||
)
|
||||
.map((profile) => (
|
||||
<label
|
||||
className="flex items-center gap-2 text-sm"
|
||||
key={profile.id}
|
||||
>
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={level.profile_ids.includes(
|
||||
profile.id,
|
||||
)}
|
||||
onChange={(event) =>
|
||||
change(index, {
|
||||
profile_ids: event
|
||||
.target.checked
|
||||
? [
|
||||
...level.profile_ids,
|
||||
profile.id,
|
||||
]
|
||||
: level.profile_ids.filter(
|
||||
(id) =>
|
||||
id !==
|
||||
profile.id,
|
||||
),
|
||||
})
|
||||
}
|
||||
/>
|
||||
{profile.name}
|
||||
{!profile.permissions.includes(
|
||||
'requisition_approve',
|
||||
) &&
|
||||
' · Sem competência de aprovação actualmente; retire da selecção ou reveja o perfil.'}
|
||||
</label>
|
||||
))}
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset className="space-y-2">
|
||||
<legend className="text-sm font-medium">
|
||||
Centros de custo (vazio aplica-se a todos)
|
||||
</legend>
|
||||
<div className="flex flex-wrap gap-4">
|
||||
{costCenters.map((center) => (
|
||||
<label
|
||||
className="flex items-center gap-2 text-sm"
|
||||
key={center.id}
|
||||
>
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={level.cost_center_ids.includes(
|
||||
center.id,
|
||||
)}
|
||||
onChange={(event) =>
|
||||
change(index, {
|
||||
cost_center_ids: event
|
||||
.target.checked
|
||||
? [
|
||||
...level.cost_center_ids,
|
||||
center.id,
|
||||
]
|
||||
: level.cost_center_ids.filter(
|
||||
(id) =>
|
||||
id !==
|
||||
center.id,
|
||||
),
|
||||
})
|
||||
}
|
||||
/>
|
||||
{center.code} · {center.name}
|
||||
</label>
|
||||
))}
|
||||
</div>
|
||||
</fieldset>
|
||||
<div className="flex flex-wrap gap-3">
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
disabled={index === 0}
|
||||
onClick={() => {
|
||||
const levels = [...form.data.levels];
|
||||
[levels[index - 1], levels[index]] = [
|
||||
levels[index],
|
||||
levels[index - 1],
|
||||
];
|
||||
form.setData('levels', levels);
|
||||
}}
|
||||
>
|
||||
Subir nível
|
||||
</Button>
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
onClick={() =>
|
||||
form.setData(
|
||||
'levels',
|
||||
form.data.levels.filter(
|
||||
(_, position) =>
|
||||
position !== index,
|
||||
),
|
||||
)
|
||||
}
|
||||
>
|
||||
Retirar do novo plano
|
||||
</Button>
|
||||
</div>
|
||||
</fieldset>
|
||||
))}
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
disabled={form.data.levels.length >= 5}
|
||||
onClick={() =>
|
||||
form.setData('levels', [
|
||||
...form.data.levels,
|
||||
newLevel(),
|
||||
])
|
||||
}
|
||||
>
|
||||
Acrescentar nível
|
||||
</Button>
|
||||
<label
|
||||
className="grid gap-2 text-sm"
|
||||
htmlFor="approval-plan-reason"
|
||||
>
|
||||
Motivo da alteração
|
||||
<textarea
|
||||
id="approval-plan-reason"
|
||||
className={controlClass}
|
||||
required
|
||||
minLength={10}
|
||||
maxLength={4000}
|
||||
value={form.data.reason}
|
||||
onChange={(event) =>
|
||||
form.setData('reason', event.target.value)
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
<Button disabled={form.processing}>
|
||||
Guardar plano de aprovação
|
||||
</Button>
|
||||
</form>
|
||||
)}
|
||||
</Panel>
|
||||
);
|
||||
}
|
||||
@@ -37,6 +37,41 @@ function topic(
|
||||
}
|
||||
|
||||
export const journeyHelp: JourneyHelp[] = [
|
||||
topic(
|
||||
'budget-distributions',
|
||||
'Distribuir um pedido por centros de custo',
|
||||
['requisitions/distributions'],
|
||||
'Preparar parcelas explícitas por artigo, conservando os valores do pedido.',
|
||||
[
|
||||
'Complete os artigos e valores do rascunho.',
|
||||
'Adicione as parcelas e escolha centros do departamento.',
|
||||
'Indique os valores sem IVA e com IVA de cada parcela, explique o motivo e guarde.',
|
||||
],
|
||||
[
|
||||
'As parcelas de cada artigo devem coincidir exactamente com os seus totais.',
|
||||
'Guardar a preparação não reserva fundos; a reserva ocorre na submissão.',
|
||||
],
|
||||
'Se o pedido mudar, confira e guarde novamente a distribuição. Não compense diferenças com valores arbitrários.',
|
||||
'Regresse ao pedido e submeta-o quando os dados estiverem completos.',
|
||||
),
|
||||
topic(
|
||||
'budget-distribution-amendment',
|
||||
'Conferir a reafectação de um compromisso',
|
||||
['purchases/distribution-amendment'],
|
||||
'Permitir a Finanças confirmar explicitamente a imputação em MZN exigida por uma factura parcial em moeda estrangeira.',
|
||||
[
|
||||
'Confira a ordem e a referência cambial congelada.',
|
||||
'Indique as parcelas em MZN, conservando os totais nativos e os consumos anteriores.',
|
||||
'Registe o motivo e confirme uma nova versão.',
|
||||
],
|
||||
[
|
||||
'A reafectação exige saldo disponível.',
|
||||
'O histórico conserva a distribuição anterior e o autor.',
|
||||
'A confirmação da reafectação não valida a factura.',
|
||||
],
|
||||
'Se a versão mudou, consulte a distribuição actual antes de tentar novamente. Não altere a taxa ou o documento para fazer coincidir os totais.',
|
||||
'Regresse à factura para a conferência independente por outra pessoa de Finanças.',
|
||||
),
|
||||
topic(
|
||||
'start',
|
||||
'Escolher a área de trabalho',
|
||||
@@ -163,12 +198,7 @@ export const journeyHelp: JourneyHelp[] = [
|
||||
topic(
|
||||
'process',
|
||||
'Consultar o processo de compra',
|
||||
[
|
||||
'purchases/index',
|
||||
'purchases/process',
|
||||
'purchases/review-report',
|
||||
'reports/procurement',
|
||||
],
|
||||
['purchases/index', 'purchases/process', 'purchases/review-report'],
|
||||
'Acompanhar a necessidade, as decisões e os documentos sem repetir registos.',
|
||||
[
|
||||
'Abra o processo pela requisição ou referência.',
|
||||
@@ -182,6 +212,25 @@ export const journeyHelp: JourneyHelp[] = [
|
||||
'Se faltar informação, confirme o filtro, o processo e o âmbito do seu acesso antes de concluir que o registo desapareceu.',
|
||||
'Abra a próxima etapa pendente indicada no processo.',
|
||||
),
|
||||
topic(
|
||||
'procurement-report',
|
||||
'Analisar os relatórios de Compras',
|
||||
['reports/procurement'],
|
||||
'Conferir os processos filtrados e as posições financeiras disponíveis dentro do seu acesso.',
|
||||
[
|
||||
'Escolha os filtros; o período refere-se à criação do pedido e abrange todas as páginas.',
|
||||
'Confira as pendências e os tempos de aprovação, distinguindo datas conhecidas de indeterminadas.',
|
||||
'Se tiver acesso financeiro, confira a cobertura das posições reconhecidas e abra as respectivas obrigações para consultar a origem.',
|
||||
'O CSV de processos e o CSV da posição financeira têm conteúdos distintos; escolha a exportação correspondente à conferência pretendida.',
|
||||
],
|
||||
[
|
||||
'Os saldos financeiros são os actuais na data de geração; não são saldos históricos do período filtrado.',
|
||||
'Facturas por reconhecer ou com posição divergente ficam identificadas e fora dos totais; não são saldo zero.',
|
||||
'As moedas são totalizadas separadamente. Principal, pagamentos históricos conferidos, liquidações imputadas e saldo são rubricas distintas.',
|
||||
],
|
||||
'Se a cobertura estiver incompleta, abra as obrigações e confira as origens. Não complete montantes em falta com valores presumidos.',
|
||||
'Use o processo e o relatório correspondente para conferir os documentos; a consulta não executa decisões ou pagamentos.',
|
||||
),
|
||||
topic(
|
||||
'opening',
|
||||
'Registar a abertura das propostas',
|
||||
@@ -637,7 +686,8 @@ export const journeyHelp: JourneyHelp[] = [
|
||||
'Abra o processo pretendido para consultar o detalhe autorizado.',
|
||||
],
|
||||
[
|
||||
'Esta entrega não inclui Pessoas, facturas ou pesquisa dentro dos anexos.',
|
||||
'Quando a pesquisa financeira estiver disponível para o seu perfil, procure facturas pelo número; os resultados apresentam apenas referência e estado. Os valores e documentos são consultados na própria factura.',
|
||||
'A pesquisa não inclui Pessoas, conteúdo dos anexos ou arquivos externos.',
|
||||
'Nenhum resultado significa ausência no âmbito e nos critérios actuais; não comprova eliminação de registos.',
|
||||
],
|
||||
'Confira o texto e o contexto de trabalho. Os caracteres % e _ são procurados literalmente.',
|
||||
|
||||
@@ -82,7 +82,7 @@ export function procurementNavigation(
|
||||
id: 'pending_approvals',
|
||||
label: 'Pendentes para mim',
|
||||
path: '/requisicoes?view=approvals',
|
||||
roles: readers,
|
||||
roles: [...readers, 'requisition_approve'],
|
||||
},
|
||||
{
|
||||
id: 'workflow_notices',
|
||||
@@ -93,7 +93,7 @@ export function procurementNavigation(
|
||||
id: 'decisions',
|
||||
label: 'Minhas decisões',
|
||||
path: '/requisicoes?view=decided',
|
||||
roles: readers,
|
||||
roles: [...readers, 'requisition_approve'],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
function canonical(value: unknown): unknown {
|
||||
if (Array.isArray(value)) return value.map(canonical);
|
||||
if (value !== null && typeof value === 'object') {
|
||||
return Object.fromEntries(
|
||||
Object.entries(value)
|
||||
.sort(([a], [b]) => a.localeCompare(b))
|
||||
.map(([key, item]) => [key, canonical(item)]),
|
||||
);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
function preparation(data: Record<string, unknown>): unknown {
|
||||
const { operation_key: _operationKey, ...fields } = data;
|
||||
return canonical({
|
||||
...fields,
|
||||
items: Array.isArray(fields.items)
|
||||
? fields.items.map((item) => {
|
||||
if (
|
||||
item !== null &&
|
||||
typeof item === 'object' &&
|
||||
!Array.isArray(item)
|
||||
) {
|
||||
const { key: _rowKey, ...values } = item;
|
||||
return values;
|
||||
}
|
||||
return item;
|
||||
})
|
||||
: fields.items,
|
||||
});
|
||||
}
|
||||
|
||||
export function hasPreparationChanges(
|
||||
initial: Record<string, unknown>,
|
||||
current: Record<string, unknown>,
|
||||
): boolean {
|
||||
return (
|
||||
JSON.stringify(preparation(initial)) !==
|
||||
JSON.stringify(preparation(current))
|
||||
);
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
import { RequisitionApprovalSettings } from '@/components/requisition-approval-settings';
|
||||
import type { RequisitionApprovalPlan } from '@/components/requisition-approval-settings';
|
||||
import { CompanyDetailsSettings } from '@/components/company-details-settings';
|
||||
import type { CompanyDetails } from '@/components/company-details-settings';
|
||||
import { CompanyAdministrativeLocation } from '@/components/administrative-location';
|
||||
@@ -169,6 +171,8 @@ function Assignment({
|
||||
);
|
||||
}
|
||||
export default function Parameters({
|
||||
approvalLevels,
|
||||
approvalLevelsReady = false,
|
||||
companyDetails,
|
||||
companyDetailsReady,
|
||||
ready,
|
||||
@@ -195,6 +199,8 @@ export default function Parameters({
|
||||
workContextConfiguration,
|
||||
enabledWorkContexts = [],
|
||||
}: {
|
||||
approvalLevels?: RequisitionApprovalPlan | null;
|
||||
approvalLevelsReady?: boolean;
|
||||
companyDetails: CompanyDetails | null;
|
||||
companyDetailsReady: boolean;
|
||||
ready: boolean;
|
||||
@@ -307,6 +313,13 @@ export default function Parameters({
|
||||
tasks={workflowTasks}
|
||||
/>
|
||||
)}
|
||||
<RequisitionApprovalSettings
|
||||
plan={approvalLevels}
|
||||
ready={approvalLevelsReady}
|
||||
profiles={profiles}
|
||||
costCenters={costCenters}
|
||||
version={version}
|
||||
/>
|
||||
<CompanyDetailsSettings
|
||||
details={companyDetails}
|
||||
ready={companyDetailsReady && ready}
|
||||
|
||||
@@ -1,5 +1,17 @@
|
||||
import { Head, Link, router, useForm } from '@inertiajs/react';
|
||||
import { useState } from 'react';
|
||||
import {
|
||||
Head,
|
||||
Link,
|
||||
router,
|
||||
useForm,
|
||||
usePage,
|
||||
useRemember,
|
||||
} from '@inertiajs/react';
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
import { hasPreparationChanges } from '@/lib/requisition-history';
|
||||
import BudgetDistributionFields, {
|
||||
type BudgetDistributionInput,
|
||||
type BudgetDistributionOption,
|
||||
} from '@/components/budget-distribution-fields';
|
||||
import {
|
||||
FormErrors,
|
||||
PageTitle,
|
||||
@@ -14,6 +26,7 @@ import type { Page } from '@/types/inventory';
|
||||
|
||||
type Source = {
|
||||
id: number;
|
||||
requisition_item_id?: number;
|
||||
description: string;
|
||||
unit: string;
|
||||
unit_price_minor: number;
|
||||
@@ -67,6 +80,7 @@ export default function Invoices({
|
||||
currency?: string;
|
||||
supplier: string;
|
||||
items: Source[];
|
||||
budgetDistributionOptions?: BudgetDistributionOption[] | null;
|
||||
}[];
|
||||
canManage: boolean;
|
||||
focusInvoiceId?: number | null;
|
||||
@@ -89,17 +103,31 @@ export default function Invoices({
|
||||
event_on: string;
|
||||
}[];
|
||||
}) {
|
||||
const [orderId, setOrderId] = useState(
|
||||
const actor = usePage().props.auth?.user;
|
||||
const historyKey = `invoice-preparation:${actor?.tenant_id}:${actor?.id}:${focusOrderId ?? 'all'}`;
|
||||
const [orderId, setOrderId] = useRemember(
|
||||
focusOrderId === null ? '' : String(focusOrderId),
|
||||
`${historyKey}:order`,
|
||||
);
|
||||
const [validationError, setValidationError] = useState('');
|
||||
const [validating, setValidating] = useState<number | null>(null);
|
||||
const form = useForm({
|
||||
const initialData = {
|
||||
number: '',
|
||||
issued_on: '',
|
||||
subtotal: '',
|
||||
tax: '',
|
||||
total: '',
|
||||
reason: '',
|
||||
budget_distribution_preparation: (
|
||||
orders.find((source) => source.id === focusOrderId)
|
||||
?.budgetDistributionOptions ?? []
|
||||
).map(({ allocation_key, line_id, centre_id }) => ({
|
||||
allocation_key,
|
||||
line_id,
|
||||
centre_id,
|
||||
subtotal: '',
|
||||
total: '',
|
||||
})) as BudgetDistributionInput[],
|
||||
items: (orders
|
||||
.find((source) => source.id === focusOrderId)
|
||||
?.items.map((line) => ({
|
||||
@@ -109,8 +137,29 @@ export default function Invoices({
|
||||
unit_price: (line.unit_price_minor / 100).toFixed(2),
|
||||
tax_rate: String(line.tax_rate),
|
||||
})) ?? []) as Line[],
|
||||
});
|
||||
};
|
||||
const form = useForm(historyKey, initialData);
|
||||
const formElement = useRef<HTMLFormElement>(null);
|
||||
const dirty = hasPreparationChanges(initialData, form.data);
|
||||
useEffect(() => {
|
||||
window.dispatchEvent(
|
||||
new CustomEvent('sgc:context-dirty', {
|
||||
detail: { form: formElement.current, dirty },
|
||||
}),
|
||||
);
|
||||
}, [dirty]);
|
||||
const order = orders.find((o) => String(o.id) === orderId);
|
||||
const activeLineIds = form.data.items
|
||||
.filter((line) => line.quantity !== '')
|
||||
.map(
|
||||
(line) =>
|
||||
order?.items.find(
|
||||
(source) => source.id === line.purchase_order_item_id,
|
||||
)?.requisition_item_id,
|
||||
);
|
||||
const activeAllocations = form.data.budget_distribution_preparation.filter(
|
||||
(row) => activeLineIds.includes(row.line_id),
|
||||
);
|
||||
return (
|
||||
<>
|
||||
<Head title="Facturas" />
|
||||
@@ -190,11 +239,19 @@ export default function Invoices({
|
||||
description="Reutilize a encomenda e indique os dados novos do documento do fornecedor. Unidade, preço e IVA vêm da encomenda; os totais do documento continuam a exigir coincidência exacta e conferência independente."
|
||||
>
|
||||
<form
|
||||
ref={formElement}
|
||||
className="grid gap-4"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
form.transform((d) => ({
|
||||
...d,
|
||||
budget_distribution_preparation:
|
||||
d.budget_distribution_preparation.filter(
|
||||
(row) =>
|
||||
activeLineIds.includes(
|
||||
row.line_id,
|
||||
),
|
||||
),
|
||||
items: d.items
|
||||
.filter((l) => l.quantity !== '')
|
||||
.map(
|
||||
@@ -224,6 +281,30 @@ export default function Invoices({
|
||||
value={orderId}
|
||||
onChange={(e) => {
|
||||
setOrderId(e.target.value);
|
||||
form.setData('reason', '');
|
||||
form.setData(
|
||||
'budget_distribution_preparation',
|
||||
(
|
||||
orders.find(
|
||||
(source) =>
|
||||
String(source.id) ===
|
||||
e.target.value,
|
||||
)?.budgetDistributionOptions ??
|
||||
[]
|
||||
).map(
|
||||
({
|
||||
allocation_key,
|
||||
line_id,
|
||||
centre_id,
|
||||
}) => ({
|
||||
allocation_key,
|
||||
line_id,
|
||||
centre_id,
|
||||
subtotal: '',
|
||||
total: '',
|
||||
}),
|
||||
),
|
||||
);
|
||||
form.setData(
|
||||
'items',
|
||||
orders
|
||||
@@ -371,6 +452,42 @@ export default function Invoices({
|
||||
</label>
|
||||
),
|
||||
)}
|
||||
{order?.budgetDistributionOptions != null && (
|
||||
<div className="space-y-3">
|
||||
{order.currency !== 'MZN' && (
|
||||
<Link
|
||||
className="underline"
|
||||
href={`/ordens/${order.id}/reafectacao`}
|
||||
>
|
||||
Conferir ou reafectar compromisso em
|
||||
MZN
|
||||
</Link>
|
||||
)}
|
||||
<BudgetDistributionFields
|
||||
options={
|
||||
order.budgetDistributionOptions
|
||||
}
|
||||
rows={activeAllocations}
|
||||
reason={form.data.reason}
|
||||
onReason={(value) =>
|
||||
form.setData('reason', value)
|
||||
}
|
||||
onChange={(rows) =>
|
||||
form.setData(
|
||||
'budget_distribution_preparation',
|
||||
form.data.budget_distribution_preparation.map(
|
||||
(row) =>
|
||||
rows.find(
|
||||
(changed) =>
|
||||
changed.allocation_key ===
|
||||
row.allocation_key,
|
||||
) ?? row,
|
||||
),
|
||||
)
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
<Button disabled={!orderId || form.processing}>
|
||||
Registar para conferência independente
|
||||
</Button>
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
import { Head, Link, useForm } from '@inertiajs/react';
|
||||
import { Head, Link, useForm, usePage } from '@inertiajs/react';
|
||||
import BudgetDistributionFields, {
|
||||
type BudgetDistributionOption,
|
||||
} from '@/components/budget-distribution-fields';
|
||||
import AgreementOrderBindings, {
|
||||
type OrderAgreementBinding,
|
||||
type OrderAgreementOption,
|
||||
@@ -19,11 +22,12 @@ import { money, roleLabels, date } from '@/types/procurement';
|
||||
import type { MatrixRow, PurchaseAward } from '@/types/purchase';
|
||||
|
||||
type Props = {
|
||||
budgetDistributionOptions?: BudgetDistributionOption[] | null;
|
||||
agreementOrderLimitsReady?: boolean;
|
||||
agreementOptions?: OrderAgreementOption[];
|
||||
agreementLines?: OrderAgreementLine[];
|
||||
agreementSearch?: string;
|
||||
requisition: { id: number; number: string };
|
||||
requisition: { id: number; number: string; process_version?: number };
|
||||
comparison: {
|
||||
rows: MatrixRow[];
|
||||
ready: boolean;
|
||||
@@ -50,17 +54,51 @@ export default function Award({
|
||||
agreementOptions = [],
|
||||
agreementLines = [],
|
||||
agreementSearch = '',
|
||||
budgetDistributionOptions = null,
|
||||
}: Props) {
|
||||
const selection = useForm({
|
||||
quotation_id: '',
|
||||
justification: '',
|
||||
delivery_date: '',
|
||||
delivery_location: '',
|
||||
});
|
||||
const actor = usePage().props.auth?.user;
|
||||
const selection = useForm(
|
||||
`award-selection:${actor?.tenant_id}:${actor?.id}:${requisition.id}:${requisition.process_version ?? 0}`,
|
||||
{
|
||||
quotation_id: '',
|
||||
justification: '',
|
||||
delivery_date: '',
|
||||
delivery_location: '',
|
||||
...(budgetDistributionOptions === null
|
||||
? {}
|
||||
: {
|
||||
budget_distribution_preparation:
|
||||
budgetDistributionOptions.map(
|
||||
({
|
||||
allocation_key,
|
||||
line_id,
|
||||
centre_id,
|
||||
subtotal,
|
||||
total,
|
||||
}) => ({
|
||||
allocation_key,
|
||||
line_id,
|
||||
centre_id,
|
||||
subtotal,
|
||||
total,
|
||||
}),
|
||||
),
|
||||
reason: '',
|
||||
}),
|
||||
},
|
||||
);
|
||||
const decision = useForm({ decision: 'approved', comment: '' });
|
||||
const issue = useForm({
|
||||
agreement_bindings: [] as OrderAgreementBinding[],
|
||||
});
|
||||
const selectedQuote = comparison.rows.find(
|
||||
(row) => String(row.id) === selection.data.quotation_id,
|
||||
);
|
||||
const selectedReference =
|
||||
selectedQuote?.reference_amounts ??
|
||||
(selectedQuote && (selectedQuote.currency ?? 'MZN') === 'MZN'
|
||||
? selectedQuote
|
||||
: null);
|
||||
return (
|
||||
<>
|
||||
<Head title={`Adjudicação · ${requisition.number}`} />
|
||||
@@ -81,9 +119,12 @@ export default function Award({
|
||||
/>
|
||||
<div className="rounded-xl border border-amber-200 bg-amber-50 p-5 text-sm text-amber-900 dark:border-amber-900 dark:bg-amber-950 dark:text-amber-100">
|
||||
Ambiente de desenvolvimento: os documentos não autorizam
|
||||
compras reais. O orçamento ainda não é verificado. Excepções
|
||||
à regra preservada neste processo ou à maior pontuação
|
||||
exigem um circuito próprio de revisão.
|
||||
compras reais.{' '}
|
||||
{budgetDistributionOptions === null
|
||||
? 'O orçamento ainda não é verificado.'
|
||||
: 'O saldo de cada parcela é conferido no controlo orçamental.'}{' '}
|
||||
Excepções à regra preservada neste processo ou à maior
|
||||
pontuação exigem um circuito próprio de revisão.
|
||||
</div>
|
||||
<Panel
|
||||
title="Comparação actual"
|
||||
@@ -201,12 +242,14 @@ export default function Award({
|
||||
className={controlClass}
|
||||
required
|
||||
value={selection.data.quotation_id}
|
||||
onChange={(e) =>
|
||||
onChange={(e) => {
|
||||
selection.setData(
|
||||
'quotation_id',
|
||||
e.target.value,
|
||||
)
|
||||
}
|
||||
);
|
||||
if (budgetDistributionOptions !== null)
|
||||
selection.setData('reason', '');
|
||||
}}
|
||||
>
|
||||
<option value="">
|
||||
Seleccione uma proposta no topo
|
||||
@@ -233,6 +276,37 @@ export default function Award({
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
{budgetDistributionOptions !== null &&
|
||||
selection.data.quotation_id !== '' && (
|
||||
<div className="space-y-3">
|
||||
<p>
|
||||
{selectedReference
|
||||
? `Referência da proposta em MZN: sem IVA ${money(selectedReference.subtotal_minor, 'MZN')} · total ${money(selectedReference.total_minor, 'MZN')}. Confira as parcelas abaixo.`
|
||||
: 'Referência em MZN indisponível. Confira a proposta e a taxa congelada.'}
|
||||
</p>
|
||||
<BudgetDistributionFields
|
||||
options={budgetDistributionOptions}
|
||||
rows={
|
||||
selection.data
|
||||
.budget_distribution_preparation ??
|
||||
[]
|
||||
}
|
||||
onChange={(rows) =>
|
||||
selection.setData(
|
||||
'budget_distribution_preparation',
|
||||
rows,
|
||||
)
|
||||
}
|
||||
reason={selection.data.reason ?? ''}
|
||||
onReason={(value) =>
|
||||
selection.setData(
|
||||
'reason',
|
||||
value,
|
||||
)
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
<div className="space-y-2">
|
||||
<Label htmlFor="award-justification">
|
||||
Justificação da adjudicação
|
||||
@@ -297,7 +371,11 @@ export default function Award({
|
||||
</p>
|
||||
<Button
|
||||
disabled={
|
||||
selection.processing || !comparison.ready
|
||||
selection.processing ||
|
||||
!comparison.ready ||
|
||||
(budgetDistributionOptions !== null &&
|
||||
selectedQuote !== undefined &&
|
||||
selectedReference === null)
|
||||
}
|
||||
>
|
||||
Registar adjudicação para aprovação
|
||||
|
||||
@@ -0,0 +1,139 @@
|
||||
import { Head, Link, useForm, usePage } from '@inertiajs/react';
|
||||
import { useEffect, useRef } from 'react';
|
||||
import { hasPreparationChanges } from '@/lib/requisition-history';
|
||||
import BudgetDistributionFields, {
|
||||
type BudgetDistributionOption,
|
||||
} from '@/components/budget-distribution-fields';
|
||||
import { FormErrors, PageTitle, Panel } from '@/components/procurement';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { money } from '@/types/procurement';
|
||||
|
||||
export default function Amendment({
|
||||
order,
|
||||
options,
|
||||
planHash,
|
||||
version,
|
||||
history,
|
||||
}: {
|
||||
order: { id: number; number: string; currency: string };
|
||||
options: BudgetDistributionOption[];
|
||||
planHash: string;
|
||||
version: number;
|
||||
history: {
|
||||
kind: string;
|
||||
created_at: string;
|
||||
created_by: number;
|
||||
version: number | null;
|
||||
reason: string | null;
|
||||
allocations: {
|
||||
allocation_key: string;
|
||||
line_id: number;
|
||||
centre_id: number;
|
||||
subtotal_minor: number;
|
||||
total_minor: number;
|
||||
}[];
|
||||
}[];
|
||||
}) {
|
||||
const actor = usePage().props.auth?.user;
|
||||
const initial = {
|
||||
operation_key: crypto.randomUUID(),
|
||||
expected_plan_hash: planHash,
|
||||
reason: '',
|
||||
budget_distribution_preparation: options.map(
|
||||
({ allocation_key, line_id, centre_id, subtotal, total }) => ({
|
||||
allocation_key,
|
||||
line_id,
|
||||
centre_id,
|
||||
subtotal,
|
||||
total,
|
||||
}),
|
||||
),
|
||||
};
|
||||
const form = useForm(
|
||||
`distribution-amendment:${actor?.tenant_id}:${actor?.id}:${order.id}:${planHash}`,
|
||||
initial,
|
||||
);
|
||||
const formElement = useRef<HTMLFormElement>(null);
|
||||
const dirty = hasPreparationChanges(initial, form.data);
|
||||
useEffect(() => {
|
||||
window.dispatchEvent(
|
||||
new CustomEvent('sgc:context-dirty', {
|
||||
detail: { form: formElement.current, dirty },
|
||||
}),
|
||||
);
|
||||
}, [dirty]);
|
||||
return (
|
||||
<>
|
||||
<Head title={`Reafectação · ${order.number}`} />
|
||||
<div className="mx-auto flex w-full max-w-5xl flex-col gap-6 p-5 lg:p-8">
|
||||
<PageTitle
|
||||
eyebrow="Finanças"
|
||||
title="Reafectar compromisso em MZN"
|
||||
description={`${order.number} · Documento em ${order.currency} · Versão ${version}`}
|
||||
/>
|
||||
<p>
|
||||
Confira a imputação exigida pela conversão cumulativa da
|
||||
factura parcial. Os totais documentais e a taxa congelada
|
||||
permanecem preservados. A alteração exige saldo disponível e
|
||||
conserva os valores já consumidos.
|
||||
</p>
|
||||
<FormErrors errors={form.errors} />
|
||||
<form
|
||||
ref={formElement}
|
||||
className="space-y-5"
|
||||
onSubmit={(event) => {
|
||||
event.preventDefault();
|
||||
form.post(`/ordens/${order.id}/reafectacao`);
|
||||
}}
|
||||
>
|
||||
<BudgetDistributionFields
|
||||
options={options}
|
||||
rows={form.data.budget_distribution_preparation}
|
||||
onChange={(rows) =>
|
||||
form.setData(
|
||||
'budget_distribution_preparation',
|
||||
rows,
|
||||
)
|
||||
}
|
||||
reason={form.data.reason}
|
||||
onReason={(reason) => form.setData('reason', reason)}
|
||||
/>
|
||||
<div className="flex flex-wrap gap-3">
|
||||
<Button disabled={form.processing}>
|
||||
Confirmar nova versão
|
||||
</Button>
|
||||
<Button variant="outline" asChild>
|
||||
<Link href={`/ordens/${order.id}`}>
|
||||
Voltar à ordem
|
||||
</Link>
|
||||
</Button>
|
||||
</div>
|
||||
</form>
|
||||
<Panel title="Histórico preservado">
|
||||
{history.map((event, index) => (
|
||||
<details key={index} className="border-b py-3">
|
||||
<summary>
|
||||
{event.version === null
|
||||
? event.kind
|
||||
: `Reafectação · versão ${event.version}`}{' '}
|
||||
· {event.created_at} · Interveniente #
|
||||
{event.created_by}
|
||||
</summary>
|
||||
{event.reason && <p>{event.reason}</p>}
|
||||
<ul>
|
||||
{event.allocations.map((row) => (
|
||||
<li key={row.allocation_key}>
|
||||
Artigo #{row.line_id} · Centro #
|
||||
{row.centre_id} · Sem IVA:{' '}
|
||||
{money(row.subtotal_minor)} · Total:{' '}
|
||||
{money(row.total_minor)}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</details>
|
||||
))}
|
||||
</Panel>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -49,14 +49,14 @@ export default function Orders({
|
||||
{order.number}
|
||||
</Link>
|
||||
<p className="mt-1 text-xs text-muted-foreground">
|
||||
{
|
||||
order.snapshot.requisition
|
||||
.number
|
||||
}
|
||||
{order.snapshot.requisition
|
||||
?.number ??
|
||||
'Referência não preservada no original'}
|
||||
</p>
|
||||
</td>
|
||||
<td className="pr-4">
|
||||
{order.snapshot.supplier.name}
|
||||
{order.snapshot.supplier?.name ??
|
||||
'Fornecedor não preservado no original'}
|
||||
</td>
|
||||
<td className="pr-4">
|
||||
{date(order.issued_at)}
|
||||
|
||||
@@ -26,6 +26,7 @@ type Props = {
|
||||
decisions: {
|
||||
area: string;
|
||||
role: string;
|
||||
role_label?: string | null;
|
||||
decision: string;
|
||||
actor: string | null;
|
||||
date: string | null;
|
||||
@@ -60,6 +61,7 @@ const events: Record<string, string> = {
|
||||
'opening.recorded': 'Versão da acta de abertura registada',
|
||||
'requisition.created': 'Requisição criada',
|
||||
'requisition.updated': 'Requisição actualizada',
|
||||
'requisition.allocations_prepared': 'Distribuição preparada',
|
||||
'requisition.submitted': 'Requisição submetida',
|
||||
'requisition.revision_created': 'Revisão criada em novo processo',
|
||||
'approval.approved': 'Etapa da estimativa aprovada',
|
||||
@@ -80,6 +82,12 @@ const events: Record<string, string> = {
|
||||
'budget.award': 'Reserva ajustada à adjudicação',
|
||||
'budget.commit': 'Compromisso registado',
|
||||
'budget.release': 'Reserva libertada',
|
||||
'budget.distribution_reserve': 'Reserva distribuída registada',
|
||||
'budget.distribution_award': 'Distribuição da adjudicação confirmada',
|
||||
'budget.distribution_commit': 'Compromisso distribuído registado',
|
||||
'budget.distribution_release': 'Reserva distribuída libertada',
|
||||
'budget.distribution_cancel': 'Compromisso distribuído cancelado',
|
||||
'budget.distribution_amended': 'Compromisso reafectado por Finanças',
|
||||
'cancellation.requested': 'Cancelamento solicitado',
|
||||
'cancellation.approved': 'Cancelamento aprovado',
|
||||
'cancellation.rejected': 'Cancelamento rejeitado',
|
||||
@@ -217,7 +225,8 @@ export default function PurchaseProcess({
|
||||
<div className="flex flex-wrap justify-between gap-2">
|
||||
<strong className="font-medium">
|
||||
{decision.area} ·{' '}
|
||||
{roleLabels[decision.role] ??
|
||||
{decision.role_label ??
|
||||
roleLabels[decision.role] ??
|
||||
decision.role}
|
||||
</strong>
|
||||
<span>
|
||||
|
||||
@@ -28,12 +28,81 @@ export default function OrderShow({
|
||||
order,
|
||||
history,
|
||||
orderCancellation,
|
||||
snapshotComplete = true,
|
||||
}: {
|
||||
order: PurchaseOrder;
|
||||
history: History[];
|
||||
orderCancellation?: OrderCancellationState;
|
||||
snapshotComplete?: boolean;
|
||||
}) {
|
||||
const snapshot = order.snapshot;
|
||||
if (!snapshotComplete) {
|
||||
return (
|
||||
<>
|
||||
<Head title={order.number} />
|
||||
<div className="mx-auto grid w-full max-w-6xl min-w-0 gap-6 p-5 lg:p-8">
|
||||
<PageTitle
|
||||
eyebrow="Compras"
|
||||
title={order.number}
|
||||
description="Consulta dos dados preservados na emissão."
|
||||
/>
|
||||
<Panel title="Documento original incompleto">
|
||||
<p>
|
||||
Este documento não conserva todos os elementos da
|
||||
emissão. Os dados disponíveis são apresentados sem
|
||||
reconstruir condições ou aprovações a partir dos
|
||||
cadastros actuais.
|
||||
</p>
|
||||
<dl className="mt-4 grid gap-3 text-sm">
|
||||
<div>
|
||||
<dt>Fornecedor preservado</dt>
|
||||
<dd>
|
||||
{snapshot.supplier?.name ??
|
||||
'Não registado no original'}
|
||||
</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Emissão</dt>
|
||||
<dd>{date(order.issued_at)}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Total com IVA</dt>
|
||||
<dd>
|
||||
{money(order.total_minor, order.currency)}
|
||||
</dd>
|
||||
</div>
|
||||
</dl>
|
||||
<p className="mt-4">
|
||||
Confira o documento de origem antes de o utilizar
|
||||
como comprovativo completo.
|
||||
</p>
|
||||
</Panel>
|
||||
<Panel title="Artigos preservados">
|
||||
<ul className="grid gap-3">
|
||||
{order.items.map((item) => (
|
||||
<li key={item.id} className="break-words">
|
||||
{item.description} · {item.quantity}{' '}
|
||||
{item.unit} ·{' '}
|
||||
{money(item.total_minor, order.currency)}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</Panel>
|
||||
<a
|
||||
className="underline"
|
||||
href={`/ordens/${order.id}/imprimir`}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
Imprimir os dados preservados
|
||||
</a>
|
||||
<Link className="underline" href="/ordens">
|
||||
Voltar às ordens
|
||||
</Link>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<>
|
||||
<Head title={order.number} />
|
||||
|
||||
@@ -10,6 +10,10 @@ import { Button } from '@/components/ui/button';
|
||||
import { date, statusLabels } from '@/types/procurement';
|
||||
import { ProcurementOperationalInsights } from '@/components/procurement-operational-insights';
|
||||
import type { ProcurementInsights } from '@/components/procurement-operational-insights';
|
||||
import {
|
||||
ProcurementPayableInsights,
|
||||
type PayableInsights,
|
||||
} from '@/components/procurement-payable-insights';
|
||||
|
||||
type Row = {
|
||||
id: number;
|
||||
@@ -43,6 +47,7 @@ export default function ProcurementReports({
|
||||
departments,
|
||||
generatedAt,
|
||||
insights,
|
||||
payableInsights,
|
||||
}: {
|
||||
records: {
|
||||
data: Row[];
|
||||
@@ -57,6 +62,7 @@ export default function ProcurementReports({
|
||||
departments: { id: number; name: string }[];
|
||||
generatedAt: string;
|
||||
insights?: ProcurementInsights;
|
||||
payableInsights?: PayableInsights | null;
|
||||
}) {
|
||||
const form = useForm({
|
||||
search: filters.search ?? '',
|
||||
@@ -101,6 +107,12 @@ export default function ProcurementReports({
|
||||
withoutOrderHref={`/relatorios?${orderParams}`}
|
||||
/>
|
||||
)}
|
||||
{payableInsights && (
|
||||
<ProcurementPayableInsights
|
||||
data={payableInsights}
|
||||
exportHref={`/relatorios/obrigacoes.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."
|
||||
|
||||
@@ -0,0 +1,262 @@
|
||||
import { Head, Link, useForm, usePage } from '@inertiajs/react';
|
||||
import { useEffect, useRef } from 'react';
|
||||
import { hasPreparationChanges } from '@/lib/requisition-history';
|
||||
import {
|
||||
FormErrors,
|
||||
PageTitle,
|
||||
Panel,
|
||||
controlClass,
|
||||
} from '@/components/procurement';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { money } from '@/types/procurement';
|
||||
import type { Requisition } from '@/types/procurement';
|
||||
|
||||
type Allocation = {
|
||||
allocation_key: string;
|
||||
line_id: number;
|
||||
centre_id: number;
|
||||
subtotal_minor: number;
|
||||
total_minor: number;
|
||||
};
|
||||
const decimal = (value: number) =>
|
||||
`${Math.floor(value / 100)}.${String(value % 100).padStart(2, '0')}`;
|
||||
|
||||
export default function Distributions({
|
||||
requisition: r,
|
||||
centres,
|
||||
preparation,
|
||||
}: {
|
||||
requisition: Omit<Requisition, 'items'> & {
|
||||
items: (Requisition['items'][number] & { id: number })[];
|
||||
};
|
||||
centres: { id: number; code: string; name: string }[];
|
||||
preparation: { allocations: Allocation[]; reason: string } | null;
|
||||
}) {
|
||||
const actor = usePage().props.auth?.user;
|
||||
const initial = {
|
||||
operation_key: crypto.randomUUID(),
|
||||
process_version: r.process_version,
|
||||
reason: '',
|
||||
budget_distribution_preparation: (preparation?.allocations ?? []).map(
|
||||
(row) => ({
|
||||
allocation_key: row.allocation_key,
|
||||
line_id: row.line_id,
|
||||
centre_id: row.centre_id,
|
||||
subtotal: decimal(row.subtotal_minor),
|
||||
total: decimal(row.total_minor),
|
||||
}),
|
||||
),
|
||||
};
|
||||
const form = useForm(
|
||||
`distribution:${actor?.tenant_id}:${actor?.id}:${r.id}:${r.process_version}`,
|
||||
initial,
|
||||
);
|
||||
const formElement = useRef<HTMLFormElement>(null);
|
||||
const dirty = hasPreparationChanges(initial, form.data);
|
||||
useEffect(() => {
|
||||
window.dispatchEvent(
|
||||
new CustomEvent('sgc:context-dirty', {
|
||||
detail: { form: formElement.current, dirty },
|
||||
}),
|
||||
);
|
||||
}, [dirty]);
|
||||
const rows = form.data.budget_distribution_preparation;
|
||||
return (
|
||||
<>
|
||||
<Head title={`Distribuição · ${r.number}`} />
|
||||
<div className="mx-auto flex w-full max-w-5xl flex-col gap-6 p-5 lg:p-8">
|
||||
<PageTitle
|
||||
eyebrow="Requisição de compra"
|
||||
title="Distribuir por centros de custo"
|
||||
description={r.number}
|
||||
/>
|
||||
<p>
|
||||
Indique os valores de cada artigo por centro. As parcelas
|
||||
devem corresponder exactamente ao valor sem IVA e ao total
|
||||
do artigo. Guardar prepara a distribuição; a reserva ocorre
|
||||
ao submeter o pedido.
|
||||
</p>
|
||||
<FormErrors errors={form.errors} />
|
||||
<form
|
||||
ref={formElement}
|
||||
className="flex flex-col gap-6"
|
||||
onSubmit={(event) => {
|
||||
event.preventDefault();
|
||||
form.post(`/requisicoes/${r.id}/distribuicoes`);
|
||||
}}
|
||||
>
|
||||
{r.items.map((line) => (
|
||||
<Panel key={line.id} title={line.description}>
|
||||
<p>
|
||||
Sem IVA: {money(line.subtotal_minor)} · Total:{' '}
|
||||
{money(line.total_minor)}
|
||||
</p>
|
||||
{rows.map((row, index) =>
|
||||
row.line_id !== line.id ? null : (
|
||||
<fieldset
|
||||
key={row.allocation_key}
|
||||
className="my-4 grid gap-3 rounded border p-3 sm:grid-cols-3"
|
||||
>
|
||||
<legend>
|
||||
Parcela{' '}
|
||||
{
|
||||
rows.filter(
|
||||
(item, i) =>
|
||||
i <= index &&
|
||||
item.line_id ===
|
||||
line.id,
|
||||
).length
|
||||
}
|
||||
</legend>
|
||||
<label>
|
||||
Centro de custo
|
||||
<select
|
||||
required
|
||||
className={controlClass}
|
||||
value={row.centre_id || ''}
|
||||
onChange={(event) =>
|
||||
form.setData(
|
||||
'budget_distribution_preparation',
|
||||
rows.map((item, i) =>
|
||||
i === index
|
||||
? {
|
||||
...item,
|
||||
centre_id:
|
||||
Number(
|
||||
event
|
||||
.target
|
||||
.value,
|
||||
),
|
||||
}
|
||||
: item,
|
||||
),
|
||||
)
|
||||
}
|
||||
>
|
||||
<option value="">
|
||||
Seleccione
|
||||
</option>
|
||||
{centres.map((centre) => (
|
||||
<option
|
||||
key={centre.id}
|
||||
value={centre.id}
|
||||
>
|
||||
{centre.code} ·{' '}
|
||||
{centre.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
{(['subtotal', 'total'] as const).map(
|
||||
(field) => (
|
||||
<label key={field}>
|
||||
{field === 'subtotal'
|
||||
? 'Sem IVA (MZN)'
|
||||
: 'Total (MZN)'}
|
||||
<input
|
||||
required
|
||||
inputMode="decimal"
|
||||
pattern="[0-9]+([.][0-9]{1,2})?"
|
||||
className={controlClass}
|
||||
value={row[field]}
|
||||
onChange={(event) =>
|
||||
form.setData(
|
||||
'budget_distribution_preparation',
|
||||
rows.map(
|
||||
(
|
||||
item,
|
||||
i,
|
||||
) =>
|
||||
i ===
|
||||
index
|
||||
? {
|
||||
...item,
|
||||
[field]:
|
||||
event
|
||||
.target
|
||||
.value,
|
||||
}
|
||||
: item,
|
||||
),
|
||||
)
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
),
|
||||
)}
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
onClick={() =>
|
||||
form.setData(
|
||||
'budget_distribution_preparation',
|
||||
rows.filter(
|
||||
(_, i) => i !== index,
|
||||
),
|
||||
)
|
||||
}
|
||||
>
|
||||
Remover parcela
|
||||
</Button>
|
||||
</fieldset>
|
||||
),
|
||||
)}
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
disabled={rows.length >= 500}
|
||||
onClick={() =>
|
||||
form.setData(
|
||||
'budget_distribution_preparation',
|
||||
[
|
||||
...rows,
|
||||
{
|
||||
allocation_key:
|
||||
crypto.randomUUID(),
|
||||
line_id: line.id,
|
||||
centre_id: 0,
|
||||
subtotal: '',
|
||||
total: '',
|
||||
},
|
||||
],
|
||||
)
|
||||
}
|
||||
>
|
||||
Adicionar parcela
|
||||
</Button>
|
||||
</Panel>
|
||||
))}
|
||||
<label>
|
||||
Motivo da distribuição
|
||||
<textarea
|
||||
required
|
||||
minLength={10}
|
||||
maxLength={4000}
|
||||
className={controlClass}
|
||||
value={form.data.reason}
|
||||
onChange={(event) =>
|
||||
form.setData('reason', event.target.value)
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
<p className="text-sm">
|
||||
Se os artigos ou valores forem alterados, será
|
||||
necessário conferir novamente a distribuição. Use ponto
|
||||
para separar os centavos. Nenhuma diferença será
|
||||
compensada automaticamente.
|
||||
</p>
|
||||
<div className="flex flex-wrap gap-3">
|
||||
<Button disabled={form.processing || rows.length === 0}>
|
||||
Guardar distribuição
|
||||
</Button>
|
||||
<Button asChild variant="outline">
|
||||
<Link href={`/requisicoes/${r.id}`}>
|
||||
Voltar ao pedido
|
||||
</Link>
|
||||
</Button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Head, Link, useForm, usePage } from '@inertiajs/react';
|
||||
import { hasPreparationChanges } from '@/lib/requisition-history';
|
||||
import { Plus, Save, Trash2 } from 'lucide-react';
|
||||
import { useEffect, useRef } from 'react';
|
||||
import {
|
||||
@@ -100,7 +101,10 @@ export default function RequisitionForm({
|
||||
catalogue?: CatalogueOptions;
|
||||
incompleteDraftsAvailable?: boolean;
|
||||
}) {
|
||||
const ready = usePage().props.internalRequisitionReady === true;
|
||||
const page = usePage();
|
||||
const ready = page.props.internalRequisitionReady === true;
|
||||
const actor = page.props.auth?.user;
|
||||
const historyKey = `requisition:${String(actor?.tenant_id ?? 'none')}:${actor?.id ?? 'none'}:${requisition?.id ?? 'new'}:${requisition?.process_version ?? 0}`;
|
||||
const prepared = requisition?.draft_input?.values;
|
||||
const preparedLines = prepared?.items?.map(
|
||||
(row) =>
|
||||
@@ -113,7 +117,7 @@ export default function RequisitionForm({
|
||||
]),
|
||||
) as Line,
|
||||
);
|
||||
const form = useForm({
|
||||
const initialData = {
|
||||
operation_key: ready ? crypto.randomUUID() : null,
|
||||
process_version: requisition?.process_version ?? null,
|
||||
cost_center_id:
|
||||
@@ -149,15 +153,17 @@ export default function RequisitionForm({
|
||||
production_area: i.production_area ?? '',
|
||||
downtime_started_at: i.downtime_started_at?.slice(0, 16) ?? '',
|
||||
})) ?? [emptyLine(defaultTaxRate)],
|
||||
});
|
||||
};
|
||||
const form = useForm(historyKey, initialData);
|
||||
const preparationDirty = hasPreparationChanges(initialData, form.data);
|
||||
const formElement = useRef<HTMLFormElement>(null);
|
||||
useEffect(() => {
|
||||
window.dispatchEvent(
|
||||
new CustomEvent('sgc:context-dirty', {
|
||||
detail: { form: formElement.current, dirty: form.isDirty },
|
||||
detail: { form: formElement.current, dirty: preparationDirty },
|
||||
}),
|
||||
);
|
||||
}, [form.isDirty]);
|
||||
}, [preparationDirty]);
|
||||
const changeLine = (index: number, field: keyof Line, value: string) =>
|
||||
form.setData(
|
||||
'items',
|
||||
@@ -319,7 +325,7 @@ export default function RequisitionForm({
|
||||
</Panel>
|
||||
<Panel
|
||||
title="Artigos e serviços"
|
||||
description="Preços em MZN. Indique a taxa de IVA aplicável; o valor inicial de 0% deve ser revisto por Finanças."
|
||||
description="Preços em MZN. Confira a taxa de IVA aplicável a cada artigo antes de submeter."
|
||||
>
|
||||
<div className="space-y-5">
|
||||
{catalogue?.ready && (
|
||||
|
||||
@@ -26,6 +26,13 @@ const actions: Record<string, string> = {
|
||||
'requisition.automatically_created':
|
||||
'Rascunho de reposição criado automaticamente',
|
||||
'requisition.updated': 'Rascunho actualizado',
|
||||
'requisition.allocations_prepared': 'Distribuição preparada',
|
||||
'budget.distribution_reserve': 'Reserva distribuída registada',
|
||||
'budget.distribution_award': 'Distribuição da adjudicação confirmada',
|
||||
'budget.distribution_commit': 'Compromisso distribuído registado',
|
||||
'budget.distribution_release': 'Reserva distribuída libertada',
|
||||
'budget.distribution_cancel': 'Compromisso distribuído cancelado',
|
||||
'budget.distribution_amended': 'Compromisso reafectado por Finanças',
|
||||
'requisition.submitted': 'Pedido submetido',
|
||||
'approval.approved': 'Etapa aprovada',
|
||||
'approval.rejected': 'Pedido rejeitado',
|
||||
@@ -44,10 +51,13 @@ export default function Show({
|
||||
automaticSource,
|
||||
approvalRouting,
|
||||
canRefreshRouting = false,
|
||||
canPrepareDistributions = false,
|
||||
}: {
|
||||
canPrepareDistributions?: boolean;
|
||||
requisition: Requisition;
|
||||
canRefreshRouting?: boolean;
|
||||
approvalRouting?: {
|
||||
label?: string | null;
|
||||
status: string;
|
||||
step_id: number | null;
|
||||
role: string | null;
|
||||
@@ -150,6 +160,13 @@ export default function Show({
|
||||
}
|
||||
/>
|
||||
<FormErrors errors={submission.errors} />
|
||||
{canPrepareDistributions && (
|
||||
<Button asChild variant="outline">
|
||||
<Link href={`/requisicoes/${r.id}/distribuicoes`}>
|
||||
Distribuir por centros de custo
|
||||
</Link>
|
||||
</Button>
|
||||
)}
|
||||
{automaticSource && (
|
||||
<Panel title="Origem na reposição automática">
|
||||
<p>
|
||||
@@ -584,9 +601,11 @@ export default function Show({
|
||||
>
|
||||
<p className="text-sm">
|
||||
Etapa:{' '}
|
||||
{roleLabels[
|
||||
approvalRouting.role ?? ''
|
||||
] ?? approvalRouting.role}
|
||||
{approvalRouting.label ??
|
||||
roleLabels[
|
||||
approvalRouting.role ?? ''
|
||||
] ??
|
||||
approvalRouting.role}
|
||||
.
|
||||
</p>
|
||||
{canRefreshRouting && (
|
||||
@@ -702,7 +721,9 @@ export default function Show({
|
||||
</span>
|
||||
<div>
|
||||
<p className="text-sm font-medium">
|
||||
{roleLabels[s.role]}
|
||||
{s.routing?.name ??
|
||||
roleLabels[s.role] ??
|
||||
s.role}
|
||||
</p>
|
||||
<p className="mt-1 text-xs text-muted-foreground">
|
||||
{s.decision === 'pending'
|
||||
|
||||
@@ -28,13 +28,16 @@ const statuses: Record<string, string> = {
|
||||
issued: 'Emitida',
|
||||
active: 'Activo',
|
||||
inactive: 'Inactivo',
|
||||
confirmed: 'Confirmada',
|
||||
};
|
||||
export default function ProcurementSearch({
|
||||
term,
|
||||
groups,
|
||||
invoiceSearchAvailable = false,
|
||||
}: {
|
||||
term: string;
|
||||
groups: Group[];
|
||||
invoiceSearchAvailable?: boolean;
|
||||
}) {
|
||||
const form = useForm({ q: term });
|
||||
return (
|
||||
@@ -48,7 +51,7 @@ export default function ProcurementSearch({
|
||||
/>
|
||||
<Panel
|
||||
title="Pesquisa transversal de Compras"
|
||||
description="Pesquise requisições, ordens, fornecedores, recepções, equipamentos, artigos e armazéns por referência, necessidade, nome, código ou NUIT. Esta entrega ainda não pesquisa Pessoas, facturas, conteúdo de anexos ou arquivos externos."
|
||||
description={`Pesquise requisições, ordens, fornecedores, recepções, equipamentos, artigos e armazéns por referência, necessidade, nome, código ou NUIT.${invoiceSearchAvailable ? ' Pode também procurar facturas de fornecedor pelo número, dentro do seu acesso financeiro.' : ''} A pesquisa não inclui Pessoas, conteúdo de anexos ou arquivos externos.`}
|
||||
>
|
||||
<form
|
||||
className="flex flex-wrap items-end gap-3"
|
||||
@@ -79,6 +82,13 @@ export default function ProcurementSearch({
|
||||
<Button disabled={form.processing}>Pesquisar</Button>
|
||||
</form>
|
||||
<FormErrors errors={form.errors} />
|
||||
{invoiceSearchAvailable && (
|
||||
<p className="mt-3 text-sm text-muted-foreground">
|
||||
Os resultados de facturas mostram a referência e o
|
||||
estado. Abra a factura para consultar os valores e
|
||||
documentos autorizados.
|
||||
</p>
|
||||
)}
|
||||
</Panel>
|
||||
{term.trim().length < 2 && (
|
||||
<p role="status">
|
||||
|
||||
@@ -15,6 +15,7 @@ type Props = {
|
||||
id: number;
|
||||
reference: string;
|
||||
role: string;
|
||||
role_label?: string | null;
|
||||
kind: string;
|
||||
outcome: string | null;
|
||||
current_status: string;
|
||||
@@ -135,7 +136,9 @@ export default function Notices({
|
||||
href={notice.href}
|
||||
>
|
||||
{notice.reference} ·{' '}
|
||||
{roleLabels[notice.role] ?? notice.role}
|
||||
{notice.role_label ??
|
||||
roleLabels[notice.role] ??
|
||||
notice.role}
|
||||
</Link>
|
||||
{notice.kind === 'outcome' && (
|
||||
<p className="mt-2 text-sm">
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
export type User = {
|
||||
id: number;
|
||||
tenant_id?: number | null;
|
||||
name: string;
|
||||
email: string;
|
||||
purchasing_role?:
|
||||
|
||||
@@ -42,6 +42,7 @@ export type RequisitionItem = {
|
||||
total_minor: number;
|
||||
};
|
||||
export type ApprovalStep = {
|
||||
routing?: { name: string; scope: 'company' | 'department'; profile_ids: number[] } | null;
|
||||
id: number;
|
||||
position: number;
|
||||
role: string;
|
||||
|
||||
Reference in New Issue
Block a user