@@ -3,6 +3,8 @@ export type ComparisonPolicy = {
|
||||
configured: boolean;
|
||||
minimum_proposals: number;
|
||||
minimum_evaluators: number;
|
||||
urgent_minimum_proposals?: number;
|
||||
normal_minimum_proposals?: number;
|
||||
weights: Record<
|
||||
'price' | 'quality' | 'delivery' | 'history' | 'payment',
|
||||
number
|
||||
@@ -32,6 +34,21 @@ export function ComparisonPolicySummary({
|
||||
fornecedores distintos e {policy.minimum_evaluators} avaliações
|
||||
independentes por proposta.
|
||||
</p>
|
||||
{policy.normal_minimum_proposals !== undefined ? (
|
||||
<p>
|
||||
Redução urgente aplicada após conferência documentada do
|
||||
stock mínimo. O mínimo normal é{' '}
|
||||
{policy.normal_minimum_proposals}; as avaliações e
|
||||
aprovações mantêm-se.
|
||||
</p>
|
||||
) : policy.urgent_minimum_proposals !== undefined ? (
|
||||
<p>
|
||||
A empresa permite reduzir para{' '}
|
||||
{policy.urgent_minimum_proposals} propostas numa urgência
|
||||
justificada, após documentar o stock mínimo aplicável a
|
||||
todas as linhas.
|
||||
</p>
|
||||
) : null}
|
||||
<p>
|
||||
{Object.entries(comparisonCriteria)
|
||||
.map(
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
import { Panel } from '@/components/procurement';
|
||||
|
||||
export type FrozenOperationalOrder = {
|
||||
id: number;
|
||||
snapshot: {
|
||||
item: { description: string };
|
||||
source: {
|
||||
data: {
|
||||
type: string;
|
||||
reference: string;
|
||||
utilisation_location: string;
|
||||
description: string;
|
||||
};
|
||||
snapshot: {
|
||||
author: { name: string };
|
||||
department: { name: string };
|
||||
policy: { data: { mode: string } };
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
export default function OperationalOrderSummary({
|
||||
records,
|
||||
}: {
|
||||
records?: Record<number, FrozenOperationalOrder>;
|
||||
}) {
|
||||
const rows = Object.values(records ?? {});
|
||||
if (rows.length === 0) return null;
|
||||
return (
|
||||
<Panel
|
||||
title="Ordens de origem"
|
||||
description="Produção e manutenção: documentos preservados na emissão desta ordem de compra."
|
||||
>
|
||||
<ul className="space-y-4">
|
||||
{rows.map((record) => {
|
||||
const source = record.snapshot.source;
|
||||
return (
|
||||
<li key={record.id}>
|
||||
<p className="font-semibold">
|
||||
{record.snapshot.item.description} ·{' '}
|
||||
{source.data.reference} ·{' '}
|
||||
{source.data.type === 'production'
|
||||
? 'Produção'
|
||||
: 'Manutenção'}
|
||||
</p>
|
||||
<p className="text-sm">
|
||||
{source.snapshot.department.name} ·{' '}
|
||||
{source.data.utilisation_location} ·{' '}
|
||||
{source.snapshot.author.name} ·{' '}
|
||||
{source.snapshot.policy.data.mode ===
|
||||
'utilisation'
|
||||
? 'Origem no local de utilização'
|
||||
: 'Registada pelo procurement'}
|
||||
</p>
|
||||
<p className="mt-2 text-sm whitespace-pre-wrap">
|
||||
{source.data.description}
|
||||
</p>
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
</Panel>
|
||||
);
|
||||
}
|
||||
@@ -1,8 +1,12 @@
|
||||
import { Link } from '@inertiajs/react';
|
||||
import { Panel } from '@/components/procurement';
|
||||
import { money, roleLabels } from '@/types/procurement';
|
||||
import UrgentQuotationSummary, {
|
||||
type FrozenUrgentBasis,
|
||||
} from '@/components/urgent-quotation-summary';
|
||||
|
||||
export type OrderPartFrame = {
|
||||
urgent_quotation_basis?: FrozenUrgentBasis[];
|
||||
requisition: { id: number; number: string };
|
||||
department: { name: string };
|
||||
cost_center: { code: string; name: string };
|
||||
@@ -66,6 +70,9 @@ export function OrderPartsSummary({ sources }: { sources: OrderPartFrame[] }) {
|
||||
{source.requisition.number}
|
||||
</Link>
|
||||
</h3>
|
||||
<UrgentQuotationSummary
|
||||
records={source.urgent_quotation_basis}
|
||||
/>
|
||||
<p className="break-words">
|
||||
{source.department.name} · {source.cost_center.code}{' '}
|
||||
· {source.cost_center.name}
|
||||
|
||||
@@ -53,6 +53,8 @@ export function SgcWorkspaceShell({ children }: { children: ReactNode }) {
|
||||
page.props.payablesAvailable === true,
|
||||
undefined,
|
||||
page.props.orderCancellationAvailable === true,
|
||||
page.props.operationalOrdersAvailable === true,
|
||||
page.props.privateAuditAvailable === true,
|
||||
).flatMap((group) => group.entries.map((entry) => entry.id)),
|
||||
);
|
||||
const groups = procurementNavigation(
|
||||
@@ -60,6 +62,8 @@ export function SgcWorkspaceShell({ children }: { children: ReactNode }) {
|
||||
page.props.payablesAvailable === true,
|
||||
publicNavigation?.paths,
|
||||
page.props.orderCancellationAvailable === true,
|
||||
page.props.operationalOrdersAvailable === true,
|
||||
page.props.privateAuditAvailable === true,
|
||||
)
|
||||
.map((group) => ({
|
||||
...group,
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
import { Panel } from '@/components/procurement';
|
||||
import { date } from '@/types/procurement';
|
||||
|
||||
export type FrozenUrgentBasis = {
|
||||
id: number;
|
||||
created_at: string;
|
||||
reason: string;
|
||||
snapshot: {
|
||||
item: { description: string };
|
||||
author: { name: string };
|
||||
stock_policy: {
|
||||
minimum_stock_milli: number;
|
||||
usage_context: string | null;
|
||||
warehouse: { name: string };
|
||||
};
|
||||
availability: { free_milli: number | null };
|
||||
};
|
||||
};
|
||||
export default function UrgentQuotationSummary({
|
||||
records,
|
||||
}: {
|
||||
records?: FrozenUrgentBasis[];
|
||||
}) {
|
||||
if (!records?.length) return null;
|
||||
return (
|
||||
<Panel
|
||||
title="Fundamento da redução urgente de cotações"
|
||||
description="Conferências preservadas do momento em que o mínimo parametrizado foi atingido. Orçamento e aprovações mantêm-se."
|
||||
>
|
||||
<ul className="space-y-3">
|
||||
{records.map((record) => (
|
||||
<li key={record.id} className="text-sm">
|
||||
<p className="font-semibold">
|
||||
{record.snapshot.item.description} ·{' '}
|
||||
{record.snapshot.stock_policy.warehouse.name}
|
||||
</p>
|
||||
<p>
|
||||
Mínimo:{' '}
|
||||
{record.snapshot.stock_policy.minimum_stock_milli /
|
||||
1000}
|
||||
; stock livre no momento:{' '}
|
||||
{record.snapshot.availability.free_milli === null
|
||||
? 'Indeterminado'
|
||||
: record.snapshot.availability.free_milli /
|
||||
1000}
|
||||
.
|
||||
</p>
|
||||
<p>
|
||||
{record.snapshot.author.name} ·{' '}
|
||||
{date(record.created_at)}
|
||||
</p>
|
||||
{record.snapshot.stock_policy.usage_context && (
|
||||
<p>{record.snapshot.stock_policy.usage_context}</p>
|
||||
)}
|
||||
<p className="whitespace-pre-wrap">{record.reason}</p>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</Panel>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user