commit14
This commit is contained in:
@@ -44,6 +44,7 @@ type Decision = {
|
||||
reviews: Review[];
|
||||
};
|
||||
type Props = {
|
||||
focusDecisionId?: number | null;
|
||||
requisition: { id: number; number: string };
|
||||
policy: { id: number; revision: number; enabled: boolean } | null;
|
||||
adoption: Adoption | null;
|
||||
@@ -245,6 +246,7 @@ export default function Admission({
|
||||
canAdopt,
|
||||
canPropose,
|
||||
closed,
|
||||
focusDecisionId = null,
|
||||
}: Props) {
|
||||
const base = `/requisicoes/${requisition.id}`;
|
||||
return (
|
||||
@@ -281,7 +283,7 @@ export default function Admission({
|
||||
O processo está fechado para alterações de admissão.
|
||||
</p>
|
||||
)}
|
||||
{canAdopt && (
|
||||
{focusDecisionId === null && canAdopt && (
|
||||
<Adopt
|
||||
key={policy?.id}
|
||||
requisition={requisition}
|
||||
@@ -320,7 +322,7 @@ export default function Admission({
|
||||
</p>
|
||||
</Panel>
|
||||
)}
|
||||
{canPropose && (
|
||||
{focusDecisionId === null && canPropose && (
|
||||
<Panel title="Propor decisões">
|
||||
<div className="space-y-5">
|
||||
{proposals.map((p) => (
|
||||
@@ -339,12 +341,21 @@ export default function Admission({
|
||||
</Panel>
|
||||
)}
|
||||
<Panel title="Tentativas e conferências">
|
||||
{focusDecisionId !== null && (
|
||||
<Link
|
||||
className="mb-4 inline-block underline"
|
||||
href={`${base}/admissao${selected ? `?version=${selected.id}` : ''}`}
|
||||
>
|
||||
Ver todas as tentativas desta versão
|
||||
</Link>
|
||||
)}
|
||||
<div className="space-y-5">
|
||||
{history.data.length === 0 && (
|
||||
<p>Ainda não há tentativas nesta adopção.</p>
|
||||
)}
|
||||
{history.data.map((d) => (
|
||||
<article
|
||||
id={`admission-${d.id}`}
|
||||
key={d.id}
|
||||
className="rounded-md border p-4"
|
||||
>
|
||||
|
||||
@@ -65,6 +65,7 @@ type Props = {
|
||||
canDefine: boolean;
|
||||
canAssess: boolean;
|
||||
closedForChanges: boolean;
|
||||
focusQuotationId?: number | null;
|
||||
};
|
||||
const categories: Record<string, string> = {
|
||||
legal: 'Jurídica',
|
||||
@@ -257,10 +258,12 @@ function AssessForm({
|
||||
selected,
|
||||
records,
|
||||
actorId,
|
||||
focusQuotationId,
|
||||
}: {
|
||||
selected: Set;
|
||||
records: Assessment[];
|
||||
actorId: number;
|
||||
focusQuotationId: number | null;
|
||||
}) {
|
||||
const blank = (): Answer[] =>
|
||||
selected.criteria.map((criterion) => ({
|
||||
@@ -269,11 +272,18 @@ function AssessForm({
|
||||
evidence: '',
|
||||
reason: '',
|
||||
}));
|
||||
const initial = records.find(
|
||||
(record) =>
|
||||
record.quotation_id === focusQuotationId &&
|
||||
record.analyst_id === actorId,
|
||||
);
|
||||
const form = useForm({
|
||||
previous_id: 0,
|
||||
quotation_id: '',
|
||||
previous_id: initial?.id ?? 0,
|
||||
quotation_id: focusQuotationId === null ? '' : String(focusQuotationId),
|
||||
reason: '',
|
||||
answers: blank(),
|
||||
answers: initial
|
||||
? initial.answers.map((answer) => ({ ...answer }))
|
||||
: blank(),
|
||||
});
|
||||
const choose = (id: string) => {
|
||||
const current = records.find(
|
||||
@@ -532,6 +542,7 @@ export default function QualificationPage(props: Props) {
|
||||
canDefine,
|
||||
canAssess,
|
||||
closedForChanges,
|
||||
focusQuotationId = null,
|
||||
} = props;
|
||||
const { errors } = usePage().props;
|
||||
const base = `/requisicoes/${requisition.id}/qualificacao`;
|
||||
@@ -656,17 +667,20 @@ export default function QualificationPage(props: Props) {
|
||||
)}
|
||||
</Panel>
|
||||
{canAssess && (
|
||||
<Panel
|
||||
title="A minha análise documental"
|
||||
description="O analista deve ser distinto do solicitante. Resultados preenchidos exigem fundamento e, quando aplicável, referência de evidência."
|
||||
>
|
||||
<AssessForm
|
||||
key={selected.id}
|
||||
selected={selected}
|
||||
records={records}
|
||||
actorId={actorId}
|
||||
/>
|
||||
</Panel>
|
||||
<div id="qualification-assess">
|
||||
<Panel
|
||||
title="A minha análise documental"
|
||||
description="O analista deve ser distinto do solicitante. Resultados preenchidos exigem fundamento e, quando aplicável, referência de evidência."
|
||||
>
|
||||
<AssessForm
|
||||
key={`${selected.id}-${focusQuotationId ?? 'all'}-${focusQuotationId === null ? 0 : (records.find((record) => record.quotation_id === focusQuotationId && record.analyst_id === actorId)?.id ?? 0)}`}
|
||||
selected={selected}
|
||||
records={records}
|
||||
actorId={actorId}
|
||||
focusQuotationId={focusQuotationId}
|
||||
/>
|
||||
</Panel>
|
||||
</div>
|
||||
)}
|
||||
<Panel
|
||||
title="Último registo de cada analista por proposta"
|
||||
|
||||
@@ -52,6 +52,7 @@ type Attempt = {
|
||||
reviews: Review[];
|
||||
};
|
||||
type Props = {
|
||||
focusAttemptId?: number | null;
|
||||
requisition: { id: number; number: string };
|
||||
policy: { id: number; revision: number; enabled: boolean } | null;
|
||||
adoption: Adoption | null;
|
||||
@@ -310,6 +311,7 @@ export default function Recommendation(props: Props) {
|
||||
canPropose,
|
||||
closed,
|
||||
hasAdmission,
|
||||
focusAttemptId = null,
|
||||
} = props;
|
||||
const base = `/requisicoes/${requisition.id}`;
|
||||
return (
|
||||
@@ -346,7 +348,7 @@ export default function Recommendation(props: Props) {
|
||||
alterada exige o circuito de revisão autorizado.
|
||||
</p>
|
||||
)}
|
||||
{canAdopt && (
|
||||
{focusAttemptId === null && canAdopt && (
|
||||
<Adopt
|
||||
key={`${policy?.id}-${adoption?.id}`}
|
||||
requisition={requisition}
|
||||
@@ -399,7 +401,7 @@ export default function Recommendation(props: Props) {
|
||||
</p>
|
||||
</Panel>
|
||||
)}
|
||||
{canPropose && (
|
||||
{focusAttemptId === null && canPropose && (
|
||||
<Panel title="Proposta manual por Compras">
|
||||
<Propose
|
||||
key={`${selected?.id}-${previousId}-${basis.hash}`}
|
||||
@@ -410,12 +412,21 @@ export default function Recommendation(props: Props) {
|
||||
</Panel>
|
||||
)}
|
||||
<Panel title="Tentativas e conferências">
|
||||
{focusAttemptId !== null && (
|
||||
<Link
|
||||
className="mb-4 inline-block underline"
|
||||
href={`${base}/recomendacao${selected ? `?version=${selected.id}` : ''}`}
|
||||
>
|
||||
Ver todas as tentativas desta versão
|
||||
</Link>
|
||||
)}
|
||||
<div className="space-y-5">
|
||||
{history.data.length === 0 && (
|
||||
<p>Sem tentativas nesta adopção.</p>
|
||||
)}
|
||||
{history.data.map((attempt) => (
|
||||
<article
|
||||
id={`recommendation-${attempt.id}`}
|
||||
className="rounded-lg border p-4"
|
||||
key={attempt.id}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user