commit compras 2711
tests / ci (push) Waiting to run

This commit is contained in:
2026-11-27 13:49:31 +02:00
parent dc73540558
commit e709d900d1
81 changed files with 5352 additions and 107 deletions
+29 -1
View File
@@ -9,6 +9,9 @@ import {
} from '@/components/procurement';
import { orderPartMinor } from '@/lib/order-parts';
import { money } from '@/types/procurement';
import EstimateReconciliation, {
type EstimateSources,
} from '@/components/import-estimate-reconciliation';
import ImportTariffSummary, {
type FrozenImportTariff,
} from '@/components/import-tariff-summary';
@@ -128,6 +131,7 @@ type Props = {
};
}>;
financialReady: boolean;
estimateSources?: EstimateSources;
financialState: {
revision: number;
native_plan_id: number | null;
@@ -1036,6 +1040,7 @@ function FinancialStage({
financialReady,
url,
historyKey,
estimateSources,
}: Props & { url: string; historyKey: string }) {
const form = useForm(`${historyKey}:financial`, {
operation_key: crypto.randomUUID(),
@@ -1061,7 +1066,15 @@ function FinancialStage({
const eligible = (phase: string) =>
selected.some((origin) => origin.phase === phase);
if (current && !importRecord.context_changed) {
if (!state) {
if (
!state &&
!estimateSources?.data.some(
(source) =>
(source.reserved_minor ?? 0) +
(source.committed_minor ?? 0) >
0,
)
) {
if (
Object.values(latest.snapshot.plan.document_details).some(
(document) =>
@@ -1471,6 +1484,21 @@ export default function ImportCosts(props: Props) {
url={url}
historyKey={key}
/>
{props.estimateSources &&
props.financialReady &&
latest?.state === 'approved' &&
!props.importRecord.context_changed && (
<EstimateReconciliation
key={`${key}:estimate:${latest.id}:${props.financialState?.revision ?? 0}`}
sources={props.estimateSources}
planId={latest.id}
url={url}
historyKey={key}
financialRevision={
props.financialState?.revision ?? 0
}
/>
)}
{props.financialEvents.data.length > 0 && (
<Panel title="Histórico orçamental adicional">
{props.financialEvents.data.map((event) => (