feat: add QA tender and announcement publishing workflow
This commit is contained in:
@@ -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