@@ -1,5 +1,6 @@
|
||||
import { Head, Link, useForm } from '@inertiajs/react';
|
||||
import { Head, Link, router, useForm } from '@inertiajs/react';
|
||||
import { useState } from 'react';
|
||||
import type { LegacyArticle } from '@/pages/portal/legacy';
|
||||
|
||||
export type InvestmentContext = {
|
||||
id: string;
|
||||
@@ -10,15 +11,31 @@ export type InvestmentContext = {
|
||||
|
||||
export default function InvestmentContexts({
|
||||
contexts,
|
||||
contentSource,
|
||||
}: {
|
||||
contexts: InvestmentContext[];
|
||||
contentSource?: LegacyArticle;
|
||||
}) {
|
||||
const [key] = useState(() => globalThis.crypto.randomUUID());
|
||||
const form = useForm({ title: '', client_key: key, reuse_consent: false });
|
||||
const form = useForm({
|
||||
title: '',
|
||||
client_key: key,
|
||||
reuse_consent: false,
|
||||
content_resource_id: contentSource?.id,
|
||||
});
|
||||
return (
|
||||
<main className="mx-auto max-w-5xl space-y-6 p-4 md:p-8">
|
||||
<Head title="Os meus investimentos" />
|
||||
<h1 className="text-2xl font-semibold">Os meus investimentos</h1>
|
||||
{contentSource && (
|
||||
<p>
|
||||
Preparar a partir de{' '}
|
||||
<Link className="underline" href={contentSource.href}>
|
||||
{contentSource.title}
|
||||
</Link>
|
||||
. A fonte e a versão serão guardadas no dossier escolhido.
|
||||
</p>
|
||||
)}
|
||||
<p>
|
||||
Prepare cada investimento no seu dossier. Pode trabalhar em
|
||||
várias etapas em paralelo.
|
||||
@@ -36,6 +53,23 @@ export default function InvestmentContexts({
|
||||
Guardado em{' '}
|
||||
{new Date(item.updated_at).toLocaleString('pt-MZ')}
|
||||
</p>
|
||||
{contentSource && (
|
||||
<button
|
||||
type="button"
|
||||
className="mt-3 rounded border p-2"
|
||||
onClick={() =>
|
||||
router.post(
|
||||
`/investimentos/${item.id}/conteudos`,
|
||||
{
|
||||
version: item.version,
|
||||
resource_id: contentSource.id,
|
||||
},
|
||||
)
|
||||
}
|
||||
>
|
||||
Continuar neste dossier com o artigo
|
||||
</button>
|
||||
)}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
|
||||
Reference in New Issue
Block a user