feat: add QA tender and announcement publishing workflow
This commit is contained in:
@@ -48,6 +48,7 @@ export function PortalGroupedMenu() {
|
||||
existingBusinessEnabled?: boolean;
|
||||
businessReviewUrl?: string | null;
|
||||
educationEnabled?: boolean;
|
||||
procurementEnabled?: boolean;
|
||||
aiEnabled?: boolean;
|
||||
legacyContentEnabled?: boolean;
|
||||
profileAccess?: ProfileAccess | null;
|
||||
@@ -66,6 +67,7 @@ export function PortalGroupedMenu() {
|
||||
businesses: props.existingBusinessEnabled,
|
||||
businessReviewUrl: props.businessReviewUrl,
|
||||
education: props.educationEnabled,
|
||||
procurement: props.procurementEnabled,
|
||||
ai: props.aiEnabled,
|
||||
legacyContent: props.legacyContentEnabled,
|
||||
opportunityManagement: props.opportunityManagement,
|
||||
|
||||
@@ -8,6 +8,7 @@ export type PortalNavItem = {
|
||||
children?: PortalNavItem[];
|
||||
};
|
||||
export type PortalNavAccess = {
|
||||
procurement?: boolean;
|
||||
authenticated: boolean;
|
||||
manager: boolean;
|
||||
businesses?: boolean;
|
||||
@@ -461,6 +462,7 @@ export function portalNavigation(access: PortalNavAccess): PortalNavItem[] {
|
||||
),
|
||||
link('sectors', 'Sectores de investimento', '/sectores'),
|
||||
link('locations', 'Localizações', '/oportunidades?view=map'),
|
||||
...(access.procurement ? [link('procurement','Concursos e anúncios','/concursos')] : []),
|
||||
{
|
||||
id: 'related-catalogues',
|
||||
label: 'Catálogos relacionados',
|
||||
|
||||
@@ -3,6 +3,7 @@ import { Frame, card, button } from '@/pages/investment/shared';
|
||||
import { states } from './shared';
|
||||
|
||||
type Access = {
|
||||
procurement?: {index:string;create:string};
|
||||
opportunities?: {index: string; create: string | null; profileWorkflow: boolean};
|
||||
documents?: {index: string; edit: boolean};
|
||||
};
|
||||
@@ -10,6 +11,7 @@ export default function ContentHub({access, counts}: {access: Access; counts: Re
|
||||
return <Frame title="Gestão de conteúdos e oportunidades">
|
||||
<p>Use os cadastros e a biblioteca existentes. Guardar um rascunho, analisar um ficheiro e publicar são operações distintas. Cada acção respeita a sua autorização actual.</p>
|
||||
<div className="grid gap-4 md:grid-cols-2">
|
||||
{access.procurement && <section className={card}><h2 className="text-xl font-semibold">Concursos e anúncios</h2><p>Cadastre o procedimento e os lotes, guarde e recupere a preparação, reveja a prévia e publique os actos autorizados. Esclarecimentos, prorrogações, resultados e cancelamentos conservam versões e histórico. Divulgação de oportunidade e abertura de concurso são operações distintas.</p><Link className={button} href={access.procurement.create}>Novo concurso/anúncio</Link><Link className="block underline" href={access.procurement.index}>Gerir concursos e anúncios</Link><Link className="block underline" href="/concursos">Catálogo público</Link></section>}
|
||||
{access.opportunities && <section className={card}>
|
||||
<h2 className="text-xl font-semibold">Oportunidades</h2>
|
||||
<p>Escolha a modalidade, o sector e a localização; preencha, guarde o rascunho e siga as acções de submissão, revisão e publicação disponíveis no seu perfil.</p>
|
||||
|
||||
@@ -0,0 +1,832 @@
|
||||
import { Link, router, useForm } from '@inertiajs/react';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { Frame, card, button } from '@/pages/investment/shared';
|
||||
import {
|
||||
Field,
|
||||
control,
|
||||
labels,
|
||||
acts,
|
||||
NoticeContent,
|
||||
type Draft,
|
||||
type Lot,
|
||||
type Attachment,
|
||||
type Payload,
|
||||
} from './shared';
|
||||
type Choice = {
|
||||
id: string | number;
|
||||
name?: string;
|
||||
title?: string;
|
||||
location_type?: string;
|
||||
published?: boolean;
|
||||
malware_scan_status?: string;
|
||||
};
|
||||
type References = {
|
||||
regimes: Record<string, string>;
|
||||
acts: Record<string, string>;
|
||||
organizations: Choice[];
|
||||
sectors: Choice[];
|
||||
territories: Choice[];
|
||||
opportunities: Choice[];
|
||||
projects: Choice[];
|
||||
documents: Choice[];
|
||||
};
|
||||
type RecordData = {
|
||||
id: string;
|
||||
version: number;
|
||||
draft: Draft;
|
||||
published: boolean;
|
||||
};
|
||||
type Plan = {
|
||||
id: string;
|
||||
version: number;
|
||||
act: string;
|
||||
payload: Payload;
|
||||
hash: string;
|
||||
};
|
||||
const dates = [
|
||||
'origin_published_at',
|
||||
'clarifications_at',
|
||||
'deadline',
|
||||
'opening_at',
|
||||
];
|
||||
const groups: [string, string[]][] = [
|
||||
[
|
||||
'Identificação e objecto',
|
||||
['title', 'reference', 'modality', 'object', 'quantities'],
|
||||
],
|
||||
[
|
||||
'Regime e financiamento',
|
||||
[
|
||||
'financier',
|
||||
'instrument',
|
||||
'edition',
|
||||
'rule_source',
|
||||
'financing_agreement',
|
||||
],
|
||||
],
|
||||
['Participação', ['eligibility', 'requirements', 'proposal_validity']],
|
||||
[
|
||||
'Calendário e entrega',
|
||||
[
|
||||
'origin_published_at',
|
||||
'clarifications_at',
|
||||
'deadline',
|
||||
'opening_at',
|
||||
'delivery_channel',
|
||||
'delivery_address',
|
||||
'delivery_url',
|
||||
],
|
||||
],
|
||||
['Divulgação e contacto', ['origin_url', 'dissemination']],
|
||||
];
|
||||
export default function Edit({
|
||||
record,
|
||||
references,
|
||||
history,
|
||||
}: {
|
||||
record: RecordData | null;
|
||||
references: References;
|
||||
history: {
|
||||
version: number;
|
||||
act: string;
|
||||
reason: string;
|
||||
actor_id: number;
|
||||
published_at: string | null;
|
||||
created_at: string;
|
||||
}[];
|
||||
}) {
|
||||
const empty: Draft = {
|
||||
timezone: 'Africa/Maputo',
|
||||
lots: [],
|
||||
attachments: [],
|
||||
contact_authorized: false,
|
||||
};
|
||||
const form = useForm({
|
||||
version: record?.version ?? 0,
|
||||
reason: '',
|
||||
draft: record?.draft ?? empty,
|
||||
});
|
||||
const [act, setAct] = useState(
|
||||
record?.published ? 'clarification' : 'initial',
|
||||
);
|
||||
const [preview, setPreview] = useState<Plan | null>(null);
|
||||
const [message, setMessage] = useState('');
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [saved, setSaved] = useState(true);
|
||||
useEffect(() => {
|
||||
form.setData({
|
||||
version: record?.version ?? 0,
|
||||
reason: '',
|
||||
draft: record?.draft ?? empty,
|
||||
});
|
||||
setPreview(null);
|
||||
setSaved(true);
|
||||
}, [record?.id, record?.version]); // A server version is the recovery boundary.
|
||||
const change = (key: string, value: Draft[string]) => {
|
||||
form.setData('draft', { ...form.data.draft, [key]: value });
|
||||
setPreview(null);
|
||||
setSaved(false);
|
||||
};
|
||||
const value = (key: string) => String(form.data.draft[key] ?? '');
|
||||
const select = (key: string, label: string, choices: Choice[]) => (
|
||||
<Field label={label}>
|
||||
<select
|
||||
className={control}
|
||||
value={value(key)}
|
||||
onChange={(e) =>
|
||||
change(
|
||||
key,
|
||||
e.target.value
|
||||
? key === 'sector_id' || key === 'opportunity_id'
|
||||
? Number(e.target.value)
|
||||
: e.target.value
|
||||
: null,
|
||||
)
|
||||
}
|
||||
>
|
||||
<option value="">Por indicar</option>
|
||||
{choices.map((o) => (
|
||||
<option key={o.id} value={o.id}>
|
||||
{o.name ?? o.title}
|
||||
{o.location_type ? ` · ${o.location_type}` : ''}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
);
|
||||
const input = (key: string, label?: string) => (
|
||||
<Field key={key} label={label ?? labels[key] ?? key}>
|
||||
{dates.includes(key) ? (
|
||||
<input
|
||||
type="datetime-local"
|
||||
className={control}
|
||||
value={value(key)}
|
||||
onChange={(e) => change(key, e.target.value)}
|
||||
/>
|
||||
) : (
|
||||
<textarea
|
||||
className={control}
|
||||
rows={key === 'object' ? 4 : 2}
|
||||
value={value(key)}
|
||||
onChange={(e) => change(key, e.target.value)}
|
||||
/>
|
||||
)}
|
||||
</Field>
|
||||
);
|
||||
const lots = (form.data.draft.lots ?? []) as Lot[];
|
||||
const attachments = (form.data.draft.attachments ?? []) as Attachment[];
|
||||
const makePreview = async () => {
|
||||
setBusy(true);
|
||||
setMessage('');
|
||||
try {
|
||||
const token = document.cookie
|
||||
.split('; ')
|
||||
.find((v) => v.startsWith('XSRF-TOKEN='))
|
||||
?.slice(11);
|
||||
const response = await fetch(
|
||||
`/management/concursos/${record!.id}/previa`,
|
||||
{
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Accept: 'application/json',
|
||||
'X-XSRF-TOKEN': decodeURIComponent(token ?? ''),
|
||||
},
|
||||
body: JSON.stringify({ act }),
|
||||
},
|
||||
);
|
||||
const body = await response.json();
|
||||
if (!response.ok)
|
||||
throw new Error(
|
||||
Object.values(body.errors ?? {})
|
||||
.flat()
|
||||
.join(' ') ||
|
||||
body.message ||
|
||||
'Não foi possível preparar a prévia.',
|
||||
);
|
||||
setPreview(body);
|
||||
} catch (error) {
|
||||
setMessage(
|
||||
error instanceof Error ? error.message : 'Erro de ligação.',
|
||||
);
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
};
|
||||
return (
|
||||
<Frame
|
||||
title={record ? 'Editar concurso/anúncio' : 'Novo concurso/anúncio'}
|
||||
>
|
||||
<div className="flex flex-wrap gap-3">
|
||||
<Link className="underline" href="/management/concursos">
|
||||
Recuperar concursos
|
||||
</Link>
|
||||
<Link className="underline" href="/gestao-conteudos">
|
||||
Entrada única de gestão
|
||||
</Link>
|
||||
<a
|
||||
className="underline"
|
||||
href="/management/portal-services?intent=document#receber"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
Carregar / gerir documentos e scan na biblioteca (outra
|
||||
página)
|
||||
</a>
|
||||
<button
|
||||
className="underline"
|
||||
type="button"
|
||||
onClick={() => router.reload({ only: ['references'] })}
|
||||
>
|
||||
Actualizar opções da biblioteca
|
||||
</button>
|
||||
</div>
|
||||
<p>
|
||||
Os campos destinam-se à divulgação após revisão da prévia,
|
||||
excepto as notas internas, os anexos não públicos e o contacto
|
||||
sem autorização. O vínculo a um cadastro privado não publica os
|
||||
seus dados.
|
||||
</p>
|
||||
<p>
|
||||
O rascunho pode ficar incompleto. Alterações guardadas não
|
||||
substituem o acto público; reveja a prévia e publique
|
||||
explicitamente. Publicar concurso não publica a oportunidade nem
|
||||
recebe propostas.
|
||||
</p>
|
||||
<p role="status">
|
||||
{record
|
||||
? `Versão guardada ${record.version}. ${saved ? 'Preparação recuperada do servidor.' : 'Há alterações por guardar.'}`
|
||||
: 'Preparação ainda não guardada.'}
|
||||
</p>
|
||||
{!!Object.keys(form.errors).length && (
|
||||
<div role="alert">
|
||||
{Object.values(form.errors).map((error, i) => (
|
||||
<p key={i}>{error}</p>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
<form
|
||||
className="space-y-5"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
setPreview(null);
|
||||
record
|
||||
? form.put(`/management/concursos/${record.id}`)
|
||||
: form.post('/management/concursos');
|
||||
}}
|
||||
>
|
||||
<section className={`${card} grid gap-3 md:grid-cols-2`}>
|
||||
{select(
|
||||
'organization_id',
|
||||
'Entidade contratante existente',
|
||||
references.organizations,
|
||||
)}
|
||||
{select(
|
||||
'opportunity_id',
|
||||
'Oportunidade relacionada existente',
|
||||
references.opportunities,
|
||||
)}
|
||||
{select(
|
||||
'project_id',
|
||||
'Projecto existente',
|
||||
references.projects,
|
||||
)}
|
||||
{select('sector_id', 'Sector', references.sectors)}
|
||||
{select(
|
||||
'territory_id',
|
||||
'Localização existente',
|
||||
references.territories,
|
||||
)}
|
||||
<p>
|
||||
Os vínculos reutilizam os cadastros; não criam nova
|
||||
entidade, oportunidade, projecto ou limite. Referências
|
||||
privadas não são transformadas em conteúdo público.
|
||||
</p>
|
||||
</section>
|
||||
<section className={card}>
|
||||
<h2 className="text-xl font-semibold">
|
||||
Regime do procedimento
|
||||
</h2>
|
||||
<Field label="Regime">
|
||||
<select
|
||||
className={control}
|
||||
value={value('regime')}
|
||||
onChange={(e) => change('regime', e.target.value)}
|
||||
>
|
||||
<option value="">Por indicar</option>
|
||||
{Object.entries(references.regimes).map(
|
||||
([v, l]) => (
|
||||
<option key={v} value={v}>
|
||||
{l}
|
||||
</option>
|
||||
),
|
||||
)}
|
||||
</select>
|
||||
</Field>
|
||||
{value('regime') === 'state' ? (
|
||||
<>
|
||||
<p>
|
||||
Contratação do Estado: identifique a modalidade,
|
||||
o instrumento e a edição aplicáveis.{' '}
|
||||
<a
|
||||
className="underline"
|
||||
href="https://www.ufsa.gov.mz/divnovoreg.php"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
UFSA — Decreto n.º 79/2022
|
||||
</a>
|
||||
. A referência não atribui automaticamente
|
||||
requisitos ou prazos a todos os procedimentos.
|
||||
</p>
|
||||
{input(
|
||||
'responsible_unit',
|
||||
'UGEA / unidade responsável quando aplicável',
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<p>
|
||||
{value('regime') === 'external' ? (
|
||||
<>
|
||||
<a
|
||||
className="underline"
|
||||
href="https://www.worldbank.org/ext/en/what-we-do/project-procurement/framework"
|
||||
>
|
||||
Quadro e documentos normalizados do
|
||||
Banco Mundial
|
||||
</a>{' '}
|
||||
são referências; indique a edição e o
|
||||
acordo efectivamente aplicáveis.
|
||||
</>
|
||||
) : (
|
||||
'Use as regras documentadas da entidade e deste procedimento.'
|
||||
)}{' '}
|
||||
UGEA, Cadastro Único, garantias e abertura
|
||||
pública não são impostos a este regime.
|
||||
</p>
|
||||
{input(
|
||||
'responsible_unit',
|
||||
'Unidade responsável (quando aplicável)',
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
<Field label="Obras, bens ou serviços">
|
||||
<select
|
||||
className={control}
|
||||
value={value('object_kind')}
|
||||
onChange={(e) =>
|
||||
change('object_kind', e.target.value)
|
||||
}
|
||||
>
|
||||
<option value="">Por indicar</option>
|
||||
{Object.entries({
|
||||
works: 'Obras',
|
||||
goods: 'Bens',
|
||||
services: 'Serviços',
|
||||
mixed: 'Misto',
|
||||
other: 'Outro',
|
||||
}).map(([v, l]) => (
|
||||
<option key={v} value={v}>
|
||||
{l}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
</section>
|
||||
{groups.map(([title, fields]) => (
|
||||
<section className={card} key={title}>
|
||||
<h2 className="mb-3 text-xl font-semibold">{title}</h2>
|
||||
<div className="grid gap-3 md:grid-cols-2">
|
||||
{fields.map((key) =>
|
||||
input(
|
||||
key,
|
||||
key === 'title'
|
||||
? 'Título do concurso/anúncio'
|
||||
: undefined,
|
||||
),
|
||||
)}
|
||||
</div>
|
||||
</section>
|
||||
))}
|
||||
<section className={`${card} space-y-3`}>
|
||||
<h2 className="text-xl font-semibold">
|
||||
Garantias e prazo mínimo documentado
|
||||
</h2>
|
||||
<Field label="Garantias exigidas neste procedimento">
|
||||
<select
|
||||
className={control}
|
||||
value={value('guarantee_status')}
|
||||
onChange={(e) =>
|
||||
change('guarantee_status', e.target.value)
|
||||
}
|
||||
>
|
||||
<option value="unknown">
|
||||
Por determinar nos documentos
|
||||
</option>
|
||||
<option value="required">
|
||||
Exigidas nos documentos
|
||||
</option>
|
||||
<option value="not_required">Não exigidas</option>
|
||||
</select>
|
||||
</Field>
|
||||
{value('guarantee_status') === 'required' &&
|
||||
input('guarantees')}
|
||||
<Field label="Fuso horário IANA do procedimento">
|
||||
<input
|
||||
className={control}
|
||||
value={value('timezone')}
|
||||
onChange={(e) => change('timezone', e.target.value)}
|
||||
placeholder="Africa/Maputo"
|
||||
/>
|
||||
</Field>
|
||||
<p>
|
||||
As datas e horas introduzidas pertencem a este fuso.
|
||||
Publicação no InvesteMoz é registada separadamente pelo
|
||||
servidor; não reinicia o prazo.
|
||||
</p>
|
||||
<Field label="Prazo mínimo documentado em dias (opcional)">
|
||||
<input
|
||||
className={control}
|
||||
type="number"
|
||||
min="0"
|
||||
value={value('minimum_days')}
|
||||
onChange={(e) =>
|
||||
change(
|
||||
'minimum_days',
|
||||
e.target.value === ''
|
||||
? null
|
||||
: Number(e.target.value),
|
||||
)
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
{form.data.draft.minimum_days !== null &&
|
||||
form.data.draft.minimum_days !== undefined && (
|
||||
<div className="grid gap-3 md:grid-cols-2">
|
||||
{input('minimum_source')}
|
||||
{input('minimum_edition')}
|
||||
{input('minimum_modality')}
|
||||
<Field label="Contagem documentada">
|
||||
<select
|
||||
className={control}
|
||||
value={value('minimum_day_basis')}
|
||||
onChange={(e) =>
|
||||
change(
|
||||
'minimum_day_basis',
|
||||
e.target.value,
|
||||
)
|
||||
}
|
||||
>
|
||||
<option value="">Por indicar</option>
|
||||
<option value="calendar">
|
||||
Dias corridos
|
||||
</option>
|
||||
<option value="business">
|
||||
Dias úteis — calendário documentado
|
||||
</option>
|
||||
</select>
|
||||
</Field>
|
||||
{value('minimum_day_basis') === 'business' && (
|
||||
<>
|
||||
{input(
|
||||
'minimum_calendar_source',
|
||||
'Fonte do calendário aplicável e abrangência de feriados',
|
||||
)}
|
||||
{input(
|
||||
'minimum_working_days',
|
||||
'Dias de trabalho documentados: 1=segunda a 7=domingo, separados por vírgula',
|
||||
)}
|
||||
{input(
|
||||
'minimum_holidays',
|
||||
'Feriados / exclusões documentados (AAAA-MM-DD, separados por espaço ou vírgula)',
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
<p>
|
||||
Sem prazo parametrizado não é presumido um mínimo geral.
|
||||
A contagem em dias úteis usa exclusivamente os dias de
|
||||
trabalho e exclusões do calendário documentado neste
|
||||
registo; não adopta um calendário nacional por
|
||||
suposição.
|
||||
</p>
|
||||
</section>
|
||||
<section className={`${card} space-y-3`}>
|
||||
<h2 className="text-xl font-semibold">Lotes</h2>
|
||||
{lots.map((lot, i) => (
|
||||
<fieldset
|
||||
className="grid gap-3 rounded border p-3 md:grid-cols-3"
|
||||
key={i}
|
||||
>
|
||||
<legend>Lote {i + 1}</legend>
|
||||
{(
|
||||
['code', 'description', 'quantities'] as const
|
||||
).map((key) => (
|
||||
<Field
|
||||
key={key}
|
||||
label={
|
||||
{
|
||||
code: 'Referência do lote',
|
||||
description: 'Objecto do lote',
|
||||
quantities: 'Quantidades do lote',
|
||||
}[key]
|
||||
}
|
||||
>
|
||||
<textarea
|
||||
className={control}
|
||||
value={lot[key]}
|
||||
onChange={(e) =>
|
||||
change(
|
||||
'lots',
|
||||
lots.map((r, n) =>
|
||||
n === i
|
||||
? {
|
||||
...r,
|
||||
[key]: e.target
|
||||
.value,
|
||||
}
|
||||
: r,
|
||||
),
|
||||
)
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
))}
|
||||
<button
|
||||
type="button"
|
||||
className="underline"
|
||||
onClick={() =>
|
||||
change(
|
||||
'lots',
|
||||
lots.filter((_, n) => n !== i),
|
||||
)
|
||||
}
|
||||
>
|
||||
Retirar lote do rascunho
|
||||
</button>
|
||||
</fieldset>
|
||||
))}
|
||||
<button
|
||||
type="button"
|
||||
className={button}
|
||||
onClick={() =>
|
||||
change('lots', [
|
||||
...lots,
|
||||
{ code: '', description: '', quantities: '' },
|
||||
])
|
||||
}
|
||||
>
|
||||
Acrescentar lote
|
||||
</button>
|
||||
</section>
|
||||
<section className={`${card} space-y-3`}>
|
||||
<h2 className="text-xl font-semibold">
|
||||
Documentos e anexos
|
||||
</h2>
|
||||
<p>
|
||||
Carregue e classifique os originais na biblioteca
|
||||
existente pelo link acima. Reutilize-os aqui: anúncio,
|
||||
caderno, termos de referência, formulários, anexos ou
|
||||
comprovativos. Publicar exige que cada anexo marcado
|
||||
público já esteja autorizado, publicado e com scan limpo
|
||||
na biblioteca. Os restantes ficam privados no cadastro.
|
||||
</p>
|
||||
{attachments.map((item, i) => (
|
||||
<fieldset
|
||||
key={i}
|
||||
className="space-y-2 rounded border p-3"
|
||||
>
|
||||
<legend>Anexo {i + 1}</legend>
|
||||
<Field label={`Documento do anexo ${i + 1}`}>
|
||||
<select
|
||||
className={control}
|
||||
value={item.resource_id || ''}
|
||||
onChange={(e) =>
|
||||
change(
|
||||
'attachments',
|
||||
attachments.map((r, n) =>
|
||||
n === i
|
||||
? {
|
||||
...r,
|
||||
resource_id: Number(
|
||||
e.target.value,
|
||||
),
|
||||
}
|
||||
: r,
|
||||
),
|
||||
)
|
||||
}
|
||||
>
|
||||
<option value="">
|
||||
Seleccione da biblioteca
|
||||
</option>
|
||||
{references.documents.map((d) => (
|
||||
<option key={d.id} value={d.id}>
|
||||
{d.title} · {d.malware_scan_status}{' '}
|
||||
·{' '}
|
||||
{d.published
|
||||
? 'publicado'
|
||||
: 'privado / rascunho'}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
<Field label={`Finalidade do anexo ${i + 1}`}>
|
||||
<input
|
||||
className={control}
|
||||
value={item.purpose}
|
||||
onChange={(e) =>
|
||||
change(
|
||||
'attachments',
|
||||
attachments.map((r, n) =>
|
||||
n === i
|
||||
? {
|
||||
...r,
|
||||
purpose:
|
||||
e.target.value,
|
||||
}
|
||||
: r,
|
||||
),
|
||||
)
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
<label>
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={item.public}
|
||||
onChange={(e) =>
|
||||
change(
|
||||
'attachments',
|
||||
attachments.map((r, n) =>
|
||||
n === i
|
||||
? {
|
||||
...r,
|
||||
public: e.target
|
||||
.checked,
|
||||
}
|
||||
: r,
|
||||
),
|
||||
)
|
||||
}
|
||||
/>{' '}
|
||||
Incluir este anexo na divulgação pública
|
||||
</label>
|
||||
<button
|
||||
type="button"
|
||||
className="ml-3 underline"
|
||||
onClick={() =>
|
||||
change(
|
||||
'attachments',
|
||||
attachments.filter((_, n) => n !== i),
|
||||
)
|
||||
}
|
||||
>
|
||||
Retirar anexo do rascunho
|
||||
</button>
|
||||
</fieldset>
|
||||
))}
|
||||
<button
|
||||
type="button"
|
||||
className={button}
|
||||
onClick={() =>
|
||||
change('attachments', [
|
||||
...attachments,
|
||||
{ resource_id: 0, purpose: '', public: false },
|
||||
])
|
||||
}
|
||||
>
|
||||
Reutilizar documento
|
||||
</button>
|
||||
</section>
|
||||
<section className={`${card} space-y-3`}>
|
||||
<h2 className="text-xl font-semibold">
|
||||
Contacto e acto a divulgar
|
||||
</h2>
|
||||
{input('public_contact')}
|
||||
<label className="block">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={Boolean(
|
||||
form.data.draft.contact_authorized,
|
||||
)}
|
||||
onChange={(e) =>
|
||||
change('contact_authorized', e.target.checked)
|
||||
}
|
||||
/>{' '}
|
||||
Contacto autorizado para divulgação pública
|
||||
</label>
|
||||
{input('result')}
|
||||
{input(
|
||||
'public_reason',
|
||||
'Motivo público do acto — aparece na prévia e no histórico público',
|
||||
)}
|
||||
{input(
|
||||
'internal_notes',
|
||||
'Notas internas — nunca incluídas na divulgação',
|
||||
)}
|
||||
<Field label="Motivo interno da gravação (20–1000 caracteres)">
|
||||
<textarea
|
||||
className={control}
|
||||
value={form.data.reason}
|
||||
onChange={(e) =>
|
||||
form.setData('reason', e.target.value)
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
<button className={button} disabled={form.processing}>
|
||||
Guardar rascunho
|
||||
</button>
|
||||
</section>
|
||||
</form>
|
||||
{record && (
|
||||
<section className={`${card} my-5 space-y-3`}>
|
||||
<h2 className="text-xl font-semibold">
|
||||
Pré-visualizar e publicar
|
||||
</h2>
|
||||
<Field label="Acto a publicar">
|
||||
<select
|
||||
className={control}
|
||||
value={act}
|
||||
onChange={(e) => {
|
||||
setAct(e.target.value);
|
||||
setPreview(null);
|
||||
}}
|
||||
>
|
||||
{Object.entries(references.acts).map(([v, l]) => (
|
||||
<option key={v} value={v}>
|
||||
{l}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
<button
|
||||
className={button}
|
||||
disabled={!saved || busy}
|
||||
onClick={makePreview}
|
||||
>
|
||||
Preparar prévia pública
|
||||
</button>
|
||||
<p>
|
||||
Guarde antes da prévia. Uma prorrogação identifica o
|
||||
prazo anterior e o novo; o fim do prazo não é
|
||||
adjudicação.
|
||||
</p>
|
||||
{message && <p role="alert">{message}</p>}
|
||||
{preview && (
|
||||
<div className="space-y-3 rounded border p-4">
|
||||
<h3 className="text-xl font-semibold">
|
||||
Prévia do conteúdo público — {acts[preview.act]}
|
||||
</h3>
|
||||
<p>
|
||||
Motivo público:{' '}
|
||||
{String(preview.payload.public_reason)}
|
||||
</p>
|
||||
<NoticeContent p={preview.payload} />
|
||||
<button
|
||||
className={button}
|
||||
onClick={() =>
|
||||
router.post(
|
||||
`/management/concursos/${record.id}/publicar`,
|
||||
{
|
||||
act: preview.act,
|
||||
hash: preview.hash,
|
||||
reason: String(
|
||||
preview.payload.public_reason,
|
||||
),
|
||||
},
|
||||
{ onSuccess: () => setPreview(null) },
|
||||
)
|
||||
}
|
||||
>
|
||||
Publicar este acto
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
{record.published && (
|
||||
<Link
|
||||
className="block underline"
|
||||
href={`/concursos/${record.id}`}
|
||||
>
|
||||
Consultar anúncio público
|
||||
</Link>
|
||||
)}
|
||||
</section>
|
||||
)}
|
||||
<section className={card}>
|
||||
<h2 className="text-xl font-semibold">
|
||||
Histórico de preparação e publicação
|
||||
</h2>
|
||||
{history.map((v) => (
|
||||
<p key={v.version}>
|
||||
Versão {v.version} ·{' '}
|
||||
{v.act === 'draft' ? 'Rascunho' : acts[v.act]} ·
|
||||
responsável {v.actor_id} ·{' '}
|
||||
{v.published_at ?? v.created_at} · {v.reason}
|
||||
</p>
|
||||
))}
|
||||
</section>
|
||||
</Frame>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,196 @@
|
||||
import { Link, useForm } from '@inertiajs/react';
|
||||
import { Frame, card, button } from '@/pages/investment/shared';
|
||||
import { Field, control, states, type Publication } from './shared';
|
||||
type Choice = { id: string; name: string };
|
||||
export default function Index({
|
||||
items,
|
||||
filters,
|
||||
options,
|
||||
regimes,
|
||||
management,
|
||||
}: {
|
||||
items: {
|
||||
data: { id: string; publication: Publication; state: string }[];
|
||||
current_page: number;
|
||||
links: { url: string | null; label: string; active: boolean }[];
|
||||
};
|
||||
filters: Record<string, string>;
|
||||
options: Record<string, Choice[]>;
|
||||
regimes: Record<string, string>;
|
||||
management: boolean;
|
||||
}) {
|
||||
const form = useForm({
|
||||
q: filters.q ?? '',
|
||||
entity: filters.entity ?? '',
|
||||
sector: filters.sector ?? '',
|
||||
territory: filters.territory ?? '',
|
||||
modality: filters.modality ?? '',
|
||||
financier: filters.financier ?? '',
|
||||
state: filters.state ?? '',
|
||||
deadline_before: filters.deadline_before ?? '',
|
||||
regime: filters.regime ?? '',
|
||||
});
|
||||
const query = new URLSearchParams(
|
||||
Object.entries({ ...filters, page: String(items.current_page) }).filter(
|
||||
([, v]) => v != null && v !== '',
|
||||
),
|
||||
).toString();
|
||||
return (
|
||||
<Frame title="Concursos e anúncios">
|
||||
<p>
|
||||
Procedimentos e actos divulgados pelas entidades responsáveis.
|
||||
Uma oportunidade divulgada não é, por si, um concurso aberto.
|
||||
</p>
|
||||
<div className="flex flex-wrap gap-3">
|
||||
<Link className="underline" href="/concursos/acompanhar">
|
||||
Os concursos que acompanho
|
||||
</Link>
|
||||
{management && (
|
||||
<Link className={button} href="/management/concursos">
|
||||
Gerir concursos e anúncios
|
||||
</Link>
|
||||
)}
|
||||
</div>
|
||||
<form
|
||||
className={`${card} grid gap-3 md:grid-cols-3`}
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
form.get('/concursos', { preserveState: true });
|
||||
}}
|
||||
>
|
||||
<Field label="Palavras-chave">
|
||||
<input
|
||||
className={control}
|
||||
value={form.data.q}
|
||||
onChange={(e) => form.setData('q', e.target.value)}
|
||||
/>
|
||||
</Field>
|
||||
{(
|
||||
[
|
||||
'entity',
|
||||
'sector',
|
||||
'territory',
|
||||
'modality',
|
||||
'financier',
|
||||
] as const
|
||||
).map((key) => (
|
||||
<Field
|
||||
key={key}
|
||||
label={
|
||||
{
|
||||
entity: 'Entidade',
|
||||
sector: 'Sector',
|
||||
territory: 'Localização',
|
||||
modality: 'Modalidade',
|
||||
financier: 'Financiador',
|
||||
}[key]
|
||||
}
|
||||
>
|
||||
<select
|
||||
className={control}
|
||||
value={form.data[key]}
|
||||
onChange={(e) => form.setData(key, e.target.value)}
|
||||
>
|
||||
<option value="">Todos</option>
|
||||
{(options[key] ?? []).map((o) => (
|
||||
<option key={o.id} value={o.id}>
|
||||
{o.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
))}
|
||||
<Field label="Regime">
|
||||
<select
|
||||
className={control}
|
||||
value={form.data.regime}
|
||||
onChange={(e) => form.setData('regime', e.target.value)}
|
||||
>
|
||||
<option value="">Todos</option>
|
||||
{Object.entries(regimes).map(([v, l]) => (
|
||||
<option key={v} value={v}>
|
||||
{l}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
<Field label="Estado">
|
||||
<select
|
||||
className={control}
|
||||
value={form.data.state}
|
||||
onChange={(e) => form.setData('state', e.target.value)}
|
||||
>
|
||||
<option value="">Todos</option>
|
||||
{Object.entries(states).map(([v, l]) => (
|
||||
<option key={v} value={v}>
|
||||
{l}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
<Field label="Prazo até (data local do procedimento)">
|
||||
<input
|
||||
className={control}
|
||||
type="date"
|
||||
value={form.data.deadline_before}
|
||||
onChange={(e) =>
|
||||
form.setData('deadline_before', e.target.value)
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
<button className={button}>Pesquisar</button>
|
||||
</form>
|
||||
{!items.data.length && (
|
||||
<p role="status">Nenhum anúncio corresponde aos filtros.</p>
|
||||
)}
|
||||
<div className="grid gap-4 md:grid-cols-2">
|
||||
{items.data.map((item) => (
|
||||
<article key={item.id} className={card}>
|
||||
<h2 className="text-xl font-semibold">
|
||||
<Link
|
||||
className="underline"
|
||||
href={`/concursos/${item.id}${query ? '?' + query : ''}`}
|
||||
>
|
||||
{String(item.publication.payload.title)}
|
||||
</Link>
|
||||
</h2>
|
||||
<p>
|
||||
{String(item.publication.payload.organization_name)}{' '}
|
||||
· {states[item.state]}
|
||||
</p>
|
||||
<p>
|
||||
Entrega:{' '}
|
||||
{String(item.publication.payload.deadline).replace(
|
||||
'T',
|
||||
' ',
|
||||
)}{' '}
|
||||
· {String(item.publication.payload.timezone)}
|
||||
</p>
|
||||
<p>{String(item.publication.payload.object)}</p>
|
||||
</article>
|
||||
))}
|
||||
</div>
|
||||
<nav aria-label="Paginação">
|
||||
{items.links.map((link, i) =>
|
||||
link.url ? (
|
||||
<Link
|
||||
key={i}
|
||||
className={`mx-2 underline ${link.active ? 'font-bold' : ''}`}
|
||||
href={link.url}
|
||||
>
|
||||
{link.label
|
||||
.replace('«', '«')
|
||||
.replace('»', '»')}
|
||||
</Link>
|
||||
) : (
|
||||
<span key={i} className="mx-2">
|
||||
{link.label
|
||||
.replace('«', '«')
|
||||
.replace('»', '»')}
|
||||
</span>
|
||||
),
|
||||
)}
|
||||
</nav>
|
||||
</Frame>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
import { Link } from '@inertiajs/react';
|
||||
import { Frame, card, button } from '@/pages/investment/shared';
|
||||
import { states, type Publication } from './shared';
|
||||
export default function Manage({
|
||||
items,
|
||||
watched = false,
|
||||
}: {
|
||||
items: {
|
||||
id: string;
|
||||
title?: string;
|
||||
version?: number;
|
||||
published?: boolean;
|
||||
publication?: Publication;
|
||||
state?: string;
|
||||
changed?: boolean;
|
||||
}[];
|
||||
watched?: boolean;
|
||||
}) {
|
||||
return (
|
||||
<Frame
|
||||
title={
|
||||
watched
|
||||
? 'Concursos que acompanho'
|
||||
: 'Gestão de concursos e anúncios'
|
||||
}
|
||||
>
|
||||
<Link className="underline" href="/concursos">
|
||||
Catálogo público
|
||||
</Link>
|
||||
{!watched && (
|
||||
<>
|
||||
<Link className={button} href="/management/concursos/novo">
|
||||
Novo concurso/anúncio
|
||||
</Link>
|
||||
<Link className="ml-3 underline" href="/gestao-conteudos">
|
||||
Entrada única de gestão
|
||||
</Link>
|
||||
<p>
|
||||
Guardar → recuperar → pré-visualizar → publicar →
|
||||
actualizar/prorrogar → publicar resultado ou
|
||||
cancelamento. Carregue documentos na biblioteca
|
||||
existente, acompanhe o scan e autorize separadamente os
|
||||
anexos públicos. O rascunho pode ficar incompleto.
|
||||
</p>
|
||||
<p>
|
||||
Para actualizar, reabra o concurso, guarde as
|
||||
alterações, escolha o acto e confira a prévia. A data de
|
||||
publicação no portal não substitui a data de origem.
|
||||
Acompanhar não apresenta proposta.
|
||||
</p>
|
||||
</>
|
||||
)}
|
||||
{!items.length && <p>Sem registos.</p>}
|
||||
{items.map((item) => (
|
||||
<article key={item.id} className={`${card} my-3`}>
|
||||
<h2 className="font-semibold">
|
||||
{item.title ?? String(item.publication?.payload.title)}
|
||||
</h2>
|
||||
{watched ? (
|
||||
<>
|
||||
<p>
|
||||
{states[item.state ?? '']} ·{' '}
|
||||
{item.changed
|
||||
? 'Há novos actos desde que começou a acompanhar'
|
||||
: 'Sem novos actos desde o registo de acompanhamento'}
|
||||
</p>
|
||||
<p>
|
||||
O acompanhamento é consultado nesta área; não
|
||||
afirma envio de alertas por email.
|
||||
</p>
|
||||
<Link
|
||||
className="underline"
|
||||
href={`/concursos/${item.id}`}
|
||||
>
|
||||
Consultar concurso
|
||||
</Link>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<p>
|
||||
Versão {item.version} ·{' '}
|
||||
{item.published
|
||||
? 'Com acto publicado; alterações em preparação são separadas'
|
||||
: 'Rascunho privado'}
|
||||
</p>
|
||||
<Link
|
||||
className="underline"
|
||||
href={`/management/concursos/${item.id}`}
|
||||
>
|
||||
Recuperar e editar
|
||||
</Link>
|
||||
{item.published && (
|
||||
<Link
|
||||
className="ml-3 underline"
|
||||
href={`/concursos/${item.id}`}
|
||||
>
|
||||
Consultar publicação
|
||||
</Link>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</article>
|
||||
))}
|
||||
</Frame>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,253 @@
|
||||
import type { ReactNode } from 'react';
|
||||
|
||||
export type Lot = { code: string; description: string; quantities: string };
|
||||
export type Attachment = {
|
||||
resource_id: number;
|
||||
public: boolean;
|
||||
purpose: string;
|
||||
title?: string;
|
||||
available?: boolean;
|
||||
};
|
||||
export type Draft = {
|
||||
[key: string]: string | number | boolean | null | Lot[] | Attachment[];
|
||||
};
|
||||
export type Payload = Draft & {
|
||||
opportunity?: { title: string; url: string } | null;
|
||||
};
|
||||
export type Publication = {
|
||||
id: string;
|
||||
version: number;
|
||||
act: string;
|
||||
payload: Payload;
|
||||
published_at: string;
|
||||
reason: string;
|
||||
};
|
||||
export const states: Record<string, string> = {
|
||||
open: 'Aberto',
|
||||
extended: 'Prorrogado',
|
||||
deadline_ended: 'Prazo de propostas terminado',
|
||||
cancelled: 'Cancelado',
|
||||
results: 'Resultados publicados',
|
||||
};
|
||||
export const acts: Record<string, string> = {
|
||||
initial: 'Anúncio inicial',
|
||||
clarification: 'Esclarecimento',
|
||||
correction: 'Rectificação',
|
||||
extension: 'Prorrogação',
|
||||
award: 'Resultado / adjudicação',
|
||||
cancellation: 'Cancelamento',
|
||||
other: 'Outro acto',
|
||||
};
|
||||
export const labels: Record<string, string> = {
|
||||
reference: 'Referência',
|
||||
object: 'Objecto',
|
||||
responsible_unit: 'Unidade responsável / UGEA quando aplicável',
|
||||
modality: 'Modalidade',
|
||||
object_kind: 'Natureza do objecto',
|
||||
quantities: 'Quantidades essenciais',
|
||||
financier: 'Financiador',
|
||||
instrument: 'Instrumento aplicável',
|
||||
edition: 'Edição aplicável',
|
||||
rule_source: 'Fonte das regras',
|
||||
financing_agreement: 'Acordo de financiamento',
|
||||
eligibility: 'Elegibilidade',
|
||||
requirements: 'Requisitos de participação',
|
||||
proposal_validity: 'Validade da proposta',
|
||||
guarantee_status: 'Aplicabilidade de garantias',
|
||||
guarantees: 'Garantias documentadas',
|
||||
delivery_channel: 'Canal de entrega',
|
||||
delivery_address: 'Endereço / instruções para apresentar proposta',
|
||||
delivery_url: 'Plataforma de entrega',
|
||||
public_contact: 'Contacto público autorizado',
|
||||
dissemination: 'Meios de divulgação exigidos / adoptados e comprovativos',
|
||||
origin_url: 'Anúncio de origem',
|
||||
origin_published_at: 'Publicação de origem — referência do prazo',
|
||||
clarifications_at: 'Limite para esclarecimentos',
|
||||
deadline: 'Entrega de propostas',
|
||||
opening_at: 'Abertura (quando aplicável)',
|
||||
timezone: 'Fuso horário do procedimento',
|
||||
minimum_days: 'Prazo mínimo documentado (dias)',
|
||||
minimum_source: 'Fonte / citação do prazo mínimo',
|
||||
minimum_edition: 'Edição da regra de prazo',
|
||||
minimum_modality: 'Modalidade da regra de prazo',
|
||||
minimum_day_basis: 'Base de contagem do prazo',
|
||||
minimum_calendar_source: 'Fonte do calendário de dias úteis',
|
||||
minimum_working_days: 'Dias de trabalho (1=segunda, 7=domingo)',
|
||||
minimum_holidays: 'Feriados e exclusões documentados',
|
||||
result: 'Acto ou resultado documentado',
|
||||
};
|
||||
export const control =
|
||||
'w-full rounded border border-slate-400 bg-background p-2 text-foreground';
|
||||
export function Field({
|
||||
label,
|
||||
children,
|
||||
}: {
|
||||
label: string;
|
||||
children: ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<label className="block space-y-1">
|
||||
<span className="font-medium">{label}</span>
|
||||
{children}
|
||||
</label>
|
||||
);
|
||||
}
|
||||
export function NoticeContent({ p }: { p: Payload }) {
|
||||
const links = ['rule_source', 'origin_url', 'delivery_url'];
|
||||
const names: Record<string, string> = {
|
||||
works: 'Obras',
|
||||
goods: 'Bens',
|
||||
services: 'Serviços',
|
||||
mixed: 'Misto',
|
||||
other: 'Outro',
|
||||
required: 'Exigidas',
|
||||
not_required: 'Não exigidas',
|
||||
unknown: 'Por determinar',
|
||||
calendar: 'Dias corridos',
|
||||
business: 'Dias úteis',
|
||||
};
|
||||
return (
|
||||
<div className="space-y-5">
|
||||
<h2 className="text-2xl font-semibold">{String(p.title ?? '')}</h2>
|
||||
<p>
|
||||
<strong>Entidade:</strong>{' '}
|
||||
{String(p.organization_name ?? 'Por indicar')}
|
||||
</p>
|
||||
<p>
|
||||
Regime:{' '}
|
||||
{(
|
||||
{
|
||||
state: 'Contratação pública do Estado',
|
||||
external: 'Financiamento externo',
|
||||
private: 'Concurso privado',
|
||||
other: 'Outro regime documentado',
|
||||
} as Record<string, string>
|
||||
)[String(p.regime)] ?? 'Por indicar'}
|
||||
</p>
|
||||
<section>
|
||||
<h3 className="text-lg font-semibold">
|
||||
Objecto e como participar
|
||||
</h3>
|
||||
<p className="whitespace-pre-wrap">{String(p.object ?? '')}</p>
|
||||
<p className="my-2 rounded border p-3">
|
||||
<strong>Entrega:</strong>{' '}
|
||||
{String(p.deadline ?? 'Por indicar').replace('T', ' ')} ·{' '}
|
||||
{String(p.timezone ?? '')}
|
||||
<br />
|
||||
{String(p.delivery_channel ?? '')} ·{' '}
|
||||
{String(p.delivery_address ?? '')}
|
||||
</p>
|
||||
<p>
|
||||
Sector: {String(p.sector_name ?? 'Por indicar')} ·
|
||||
Localização: {String(p.territory_name ?? 'Por indicar')}
|
||||
</p>
|
||||
{p.project_name && (
|
||||
<p>
|
||||
Projecto relacionado: {String(p.project_name)}. Esta
|
||||
relação não confirma execução ou contratação.
|
||||
</p>
|
||||
)}
|
||||
{p.opportunity && (
|
||||
<a className="underline" href={p.opportunity.url}>
|
||||
Oportunidade relacionada: {p.opportunity.title}
|
||||
</a>
|
||||
)}
|
||||
</section>
|
||||
{p.deadline_previous && (
|
||||
<p className="rounded border p-3">
|
||||
<strong>Prorrogação:</strong> prazo anterior{' '}
|
||||
{String(p.deadline_previous).replace('T', ' ')} (
|
||||
{String(p.timezone_previous)}) → novo prazo{' '}
|
||||
{String(p.deadline).replace('T', ' ')} ({String(p.timezone)}
|
||||
).
|
||||
</p>
|
||||
)}
|
||||
<dl className="grid gap-3 md:grid-cols-2">
|
||||
{Object.entries(labels)
|
||||
.filter(
|
||||
([key]) =>
|
||||
p[key] !== null &&
|
||||
p[key] !== undefined &&
|
||||
p[key] !== '',
|
||||
)
|
||||
.map(([key, label]) => (
|
||||
<div
|
||||
key={key}
|
||||
className="rounded border p-3 break-words"
|
||||
>
|
||||
<dt className="font-semibold">{label}</dt>
|
||||
<dd className="whitespace-pre-wrap">
|
||||
{links.includes(key) ? (
|
||||
<a
|
||||
className="underline"
|
||||
href={String(p[key])}
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
{String(p[key])}
|
||||
</a>
|
||||
) : (
|
||||
(
|
||||
names[String(p[key])] ?? String(p[key])
|
||||
).replace(/^(\d{4}-\d{2}-\d{2})T/, '$1 ')
|
||||
)}
|
||||
</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
<section>
|
||||
<h3 className="text-lg font-semibold">Lotes</h3>
|
||||
{((p.lots ?? []) as Lot[]).length ? (
|
||||
<ul>
|
||||
{(p.lots as Lot[]).map((lot, i) => (
|
||||
<li key={i}>
|
||||
{lot.code} — {lot.description} ·{' '}
|
||||
{lot.quantities}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
) : (
|
||||
<p>Sem lotes indicados.</p>
|
||||
)}
|
||||
</section>
|
||||
<section>
|
||||
<h3 className="text-lg font-semibold">
|
||||
Documentos do concurso
|
||||
</h3>
|
||||
<ul>
|
||||
{((p.attachments ?? []) as Attachment[]).map((item, i) => (
|
||||
<li key={i}>
|
||||
{item.available === false ? (
|
||||
<span>
|
||||
{item.title} — documento actualmente
|
||||
indisponível
|
||||
</span>
|
||||
) : (
|
||||
<a
|
||||
className="underline"
|
||||
href={`/documentos/${item.resource_id}/download`}
|
||||
>
|
||||
{item.title ??
|
||||
`Documento ${item.resource_id}`}{' '}
|
||||
— {item.purpose}
|
||||
</a>
|
||||
)}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
{!((p.attachments as Attachment[]) ?? []).length && (
|
||||
<p>
|
||||
Sem anexos públicos neste acto. Consulte o canal e o
|
||||
anúncio de origem.
|
||||
</p>
|
||||
)}
|
||||
</section>
|
||||
<p className="rounded border p-3">
|
||||
O InvesteMoz divulga este acto e não recebe propostas nesta
|
||||
secção. Apresente a proposta no canal indicado nos documentos.
|
||||
Esta divulgação não substitui os meios oficiais exigidos,
|
||||
não comprova envio à UFSA ou ao financiador e não equivale à
|
||||
execução do investimento.
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
import { Head, Link, router, usePage } from '@inertiajs/react';
|
||||
import { Frame, card, button } from '@/pages/investment/shared';
|
||||
import { NoticeContent, states, acts, type Publication } from './shared';
|
||||
export default function Show({
|
||||
id,
|
||||
publication,
|
||||
state,
|
||||
history,
|
||||
watching,
|
||||
backUrl,
|
||||
printMode,
|
||||
}: {
|
||||
id: string;
|
||||
publication: Publication;
|
||||
state: string;
|
||||
history: Publication[];
|
||||
watching: boolean;
|
||||
backUrl: string;
|
||||
printMode: boolean;
|
||||
}) {
|
||||
const { auth } = usePage<{ auth: { user: unknown | null } }>().props;
|
||||
return (
|
||||
<Frame title="Concurso e anúncio">
|
||||
<Head title={String(publication.payload.title)} />
|
||||
<style>
|
||||
{
|
||||
'@media print { nav, header, aside, footer, [data-slot="sidebar"], .no-print {display:none!important} main {margin:0!important; width:100%!important} details {display:block} }'
|
||||
}
|
||||
</style>
|
||||
<div className="no-print flex flex-wrap gap-4">
|
||||
<Link className="underline" href={backUrl}>
|
||||
Voltar aos resultados
|
||||
</Link>
|
||||
<Link className="underline" href={`/concursos/${id}/imprimir`}>
|
||||
Relatório imprimível
|
||||
</Link>
|
||||
{printMode && (
|
||||
<button className={button} onClick={() => window.print()}>
|
||||
Imprimir anúncio
|
||||
</button>
|
||||
)}
|
||||
{auth?.user ? (
|
||||
<button
|
||||
className={button}
|
||||
onClick={() =>
|
||||
watching
|
||||
? router.delete(`/concursos/${id}/acompanhar`)
|
||||
: router.put(`/concursos/${id}/acompanhar`)
|
||||
}
|
||||
>
|
||||
{watching
|
||||
? 'Deixar de acompanhar'
|
||||
: 'Acompanhar concurso'}
|
||||
</button>
|
||||
) : (
|
||||
<Link className="underline" href="/login">
|
||||
Entrar para acompanhar — conta simples
|
||||
</Link>
|
||||
)}
|
||||
</div>
|
||||
<p className="rounded border p-3">
|
||||
<strong>{states[state]}</strong> · {acts[publication.act]} ·
|
||||
Versão {publication.version}
|
||||
</p>
|
||||
<p>
|
||||
Publicação deste acto no InvesteMoz: {publication.published_at}{' '}
|
||||
(UTC). Esta data não reinicia o prazo de origem.
|
||||
</p>
|
||||
<article className={card}>
|
||||
<NoticeContent p={publication.payload} />
|
||||
</article>
|
||||
<section className={card}>
|
||||
<h2 className="text-xl font-semibold">
|
||||
Actos publicados e histórico
|
||||
</h2>
|
||||
{history.map((v) => (
|
||||
<details key={v.id} open={printMode}>
|
||||
<summary>
|
||||
{acts[v.act]} · versão {v.version} ·{' '}
|
||||
{v.published_at} (UTC)
|
||||
</summary>
|
||||
<p className="my-2">Motivo público: {v.reason}</p>
|
||||
<NoticeContent p={v.payload} />
|
||||
</details>
|
||||
))}
|
||||
</section>
|
||||
</Frame>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user