This commit is contained in:
2026-11-03 11:51:44 +02:00
parent badaada043
commit e753f7a0a4
309 changed files with 14537 additions and 529 deletions
+32 -17
View File
@@ -7,6 +7,8 @@ import {
} from '@/components/procurement';
import { Button } from '@/components/ui/button';
type RecordRow = {
canApprove?: boolean;
canSuspend?: boolean;
id: number;
record_key: string;
version: number;
@@ -72,6 +74,8 @@ function Pagination<T>({
) : null;
}
type Props = {
focusRuleId?: number | null;
focusChanged?: boolean;
ready: boolean;
canPrepare: boolean;
canReview: boolean;
@@ -376,7 +380,19 @@ export default function Replenishment(props: Props) {
</Panel>
) : (
<>
{props.canPrepare && (
{props.focusRuleId != null && (
<Link className="underline" href="/stock/reposicao">
Ver todas as parametrizações e necessidades
</Link>
)}
{props.focusChanged && (
<p className="rounded border p-3 text-sm">
A parametrização mudou desde o encaminhamento.
Confira a versão actual e o histórico antes de
intervir.
</p>
)}
{props.canPrepare && props.focusRuleId == null && (
<Panel title="Parametrizar artigo e armazém">
<RuleForm props={props} />
</Panel>
@@ -458,6 +474,7 @@ export default function Replenishment(props: Props) {
) : (
props.rules?.data.map((r) => (
<div
id={`supply-rule-${r.id}`}
className="mb-4 rounded border p-4"
key={r.id}
>
@@ -477,22 +494,20 @@ export default function Replenishment(props: Props) {
MZN · Imposto {r.data.tax_rate}% ·
Validade {r.data.valid_until}
</p>
{props.canReview &&
r.state === 'draft' && (
<Decision
key={`approve:${r.id}`}
rule={r}
action="approve"
/>
)}
{props.canReview &&
r.state === 'approved' && (
<Decision
key={`suspend:${r.id}`}
rule={r}
action="suspend"
/>
)}
{r.canApprove && (
<Decision
key={`approve:${r.id}`}
rule={r}
action="approve"
/>
)}
{r.canSuspend && (
<Decision
key={`suspend:${r.id}`}
rule={r}
action="suspend"
/>
)}
{props.canPrepare && (
<details className="mt-3">
<summary>