feat(editorial): preserve public editions and add QA review workflow
This commit is contained in:
@@ -36,10 +36,12 @@ export default function Dashboard({
|
||||
investorPath,
|
||||
opportunityManagement,
|
||||
workQueue,
|
||||
editorialQueue,
|
||||
}: {
|
||||
summary: Summary | null;
|
||||
opportunityManagement?: OpportunityManagementAccess | null;
|
||||
workQueue?: DashboardQueue | null;
|
||||
editorialQueue?: { pending: number; unread: number } | null;
|
||||
investorPath?: {
|
||||
contexts: InvestmentContext[];
|
||||
current: {
|
||||
@@ -59,6 +61,21 @@ export default function Dashboard({
|
||||
<ProfileNavigation />
|
||||
<ContentManagementEntry />
|
||||
<DashboardWorkQueue queue={workQueue} />
|
||||
{editorialQueue && (
|
||||
<section
|
||||
className="rounded-lg border p-4"
|
||||
aria-label="Trabalho editorial"
|
||||
>
|
||||
<h2 className="font-semibold">Circuito editorial</h2>
|
||||
<p>
|
||||
{editorialQueue.pending} conteúdos pendentes ·{' '}
|
||||
{editorialQueue.unread} notificações por ler
|
||||
</p>
|
||||
<Link className="underline" href="/management/editorial">
|
||||
Abrir fila editorial e histórico
|
||||
</Link>
|
||||
</section>
|
||||
)}
|
||||
{summary ? (
|
||||
<>
|
||||
<Link
|
||||
|
||||
@@ -3,6 +3,7 @@ import { Frame, card, button } from '@/pages/investment/shared';
|
||||
import { states } from './shared';
|
||||
|
||||
type Access = {
|
||||
editorial?: { index: string };
|
||||
procurement?: { index: string; create: string };
|
||||
opportunities?: {
|
||||
index: string;
|
||||
@@ -26,6 +27,20 @@ export default function ContentHub({
|
||||
acção respeita a sua autorização actual.
|
||||
</p>
|
||||
<div className="grid gap-4 md:grid-cols-2">
|
||||
{access.editorial && (
|
||||
<section className={card}>
|
||||
<h2 className="text-xl font-semibold">
|
||||
Circuito editorial
|
||||
</h2>
|
||||
<p>
|
||||
Preparar, rever, aprovar e publicar versões de
|
||||
artigos, legislação e documentos.
|
||||
</p>
|
||||
<Link className={button} href={access.editorial.index}>
|
||||
Abrir fila editorial
|
||||
</Link>
|
||||
</section>
|
||||
)}
|
||||
{access.procurement && (
|
||||
<section className={card}>
|
||||
<h2 className="text-xl font-semibold">
|
||||
|
||||
@@ -0,0 +1,331 @@
|
||||
import { Link, useForm } from '@inertiajs/react';
|
||||
import { Management, Field, button, control } from './shared';
|
||||
import { states } from './editorial-workflow';
|
||||
|
||||
type Edition = {
|
||||
id: string;
|
||||
revision_no: number;
|
||||
version: number;
|
||||
state: string;
|
||||
content_hash: string;
|
||||
legal_required: boolean;
|
||||
fresh: boolean;
|
||||
payload: {
|
||||
resource: {
|
||||
title: string;
|
||||
description?: string;
|
||||
editorial_content?: string | null;
|
||||
};
|
||||
files: {
|
||||
id: string;
|
||||
file_name: string;
|
||||
version_no: number;
|
||||
sha256: string;
|
||||
}[];
|
||||
};
|
||||
approval: string | null;
|
||||
legal_validation: string | null;
|
||||
};
|
||||
export default function EditorialEdition({
|
||||
resource,
|
||||
edition,
|
||||
manager,
|
||||
legalReviewer,
|
||||
history,
|
||||
editions,
|
||||
reviewers,
|
||||
current,
|
||||
canApprove,
|
||||
independentRequired,
|
||||
}: {
|
||||
resource: {
|
||||
id: number;
|
||||
title: string;
|
||||
published: boolean;
|
||||
public_edition_no?: number | null;
|
||||
};
|
||||
edition: Edition | null;
|
||||
manager: boolean;
|
||||
legalReviewer: boolean;
|
||||
history: {
|
||||
id: number;
|
||||
action: string;
|
||||
actor_user_id: number;
|
||||
after_data: string;
|
||||
occurred_at: string;
|
||||
}[];
|
||||
editions: { id: string; revision_no: number; state: string }[];
|
||||
reviewers: { id: number; name: string }[];
|
||||
current: boolean;
|
||||
canApprove: boolean;
|
||||
independentRequired: boolean;
|
||||
}) {
|
||||
const form = useForm({
|
||||
version: edition?.version ?? 1,
|
||||
action: '',
|
||||
reason: '',
|
||||
assigned_to: '',
|
||||
});
|
||||
const available: Record<string, string[]> = {
|
||||
draft: ['submit', 'archive'],
|
||||
returned: ['submit', 'archive'],
|
||||
submitted: ['start_review', 'archive'],
|
||||
in_review: ['return', 'reject', 'legal_validate', 'approve', 'archive'],
|
||||
approved: ['publish', 'archive'],
|
||||
rejected: ['archive'],
|
||||
published: ['archive'],
|
||||
archived: [],
|
||||
};
|
||||
const labels: Record<string, string> = {
|
||||
submit: 'Submeter',
|
||||
start_review: 'Iniciar revisão',
|
||||
return: 'Devolver',
|
||||
reject: 'Rejeitar',
|
||||
legal_validate: 'Validar juridicamente',
|
||||
approve: 'Aprovar',
|
||||
publish: 'Publicar',
|
||||
archive: 'Arquivar',
|
||||
};
|
||||
return (
|
||||
<Management title={`Edição — ${resource.title}`}>
|
||||
<div className="flex flex-wrap gap-4">
|
||||
<Link className="underline" href="/management/editorial">
|
||||
Fila e notificações
|
||||
</Link>
|
||||
<Link
|
||||
className="underline"
|
||||
href={`/management/portal-services/resources/${resource.id}/article`}
|
||||
>
|
||||
Alterar artigo
|
||||
</Link>
|
||||
<Link className="underline" href="/management/portal-services">
|
||||
Alterar metadados/documento
|
||||
</Link>
|
||||
</div>
|
||||
<p>
|
||||
{resource.published
|
||||
? 'A versão pública continua disponível até uma publicação ou retirada explícita.'
|
||||
: 'Ainda não existe uma versão pública disponível.'}
|
||||
</p>
|
||||
{resource.public_edition_no && (
|
||||
<p>Versão pública: edição {resource.public_edition_no}.</p>
|
||||
)}
|
||||
{edition ? (
|
||||
<>
|
||||
<h2 className="font-semibold">
|
||||
Edição {edition.revision_no} ·{' '}
|
||||
{states[edition.state] ?? edition.state}
|
||||
</h2>
|
||||
{!edition.fresh && (
|
||||
<p role="alert">
|
||||
Os anexos mudaram ou deixaram de estar disponíveis.
|
||||
Guarde uma nova edição e volte a conferir antes da
|
||||
aprovação.
|
||||
</p>
|
||||
)}
|
||||
<p className="text-sm break-all">
|
||||
Identificador da edição: {edition.id}
|
||||
<br />
|
||||
Hash do conteúdo e anexos: {edition.content_hash}
|
||||
</p>
|
||||
<h3 className="font-semibold">Conferir conteúdo</h3>
|
||||
<p>{edition.payload.resource.title}</p>
|
||||
<p className="whitespace-pre-wrap">
|
||||
{edition.payload.resource.description}
|
||||
</p>
|
||||
{edition.payload.resource.editorial_content && (
|
||||
<p className="whitespace-pre-wrap">
|
||||
{
|
||||
(
|
||||
JSON.parse(
|
||||
edition.payload.resource
|
||||
.editorial_content,
|
||||
) as { body?: string }
|
||||
).body
|
||||
}
|
||||
</p>
|
||||
)}
|
||||
<ul>
|
||||
{edition.payload.files.map((file) => (
|
||||
<li key={file.id}>
|
||||
<a
|
||||
className="underline"
|
||||
href={`/management/editorial/resources/${resource.id}/editions/${edition.id}/files/${file.id}`}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
{file.file_name} · versão {file.version_no}
|
||||
</a>
|
||||
<span className="block text-xs break-all">
|
||||
SHA256: {file.sha256}
|
||||
</span>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
<p>
|
||||
{edition.legal_required
|
||||
? 'Validação jurídica obrigatória para esta edição.'
|
||||
: 'Sem validação jurídica obrigatória definida para este tipo de conteúdo.'}
|
||||
</p>
|
||||
<p>
|
||||
{edition.state === 'published' && !edition.approval
|
||||
? 'Publicação anterior conservada, sem fabricar novas aprovações.'
|
||||
: `Aprovação: ${edition.approval ? 'Registada nesta edição' : 'Pendente'}`}{' '}
|
||||
· Validação jurídica:{' '}
|
||||
{edition.legal_validation
|
||||
? 'Registada nesta edição'
|
||||
: 'Não registada'}
|
||||
</p>
|
||||
{independentRequired && current && (
|
||||
<p>
|
||||
Esta edição exige um responsável independente para a
|
||||
aprovação.
|
||||
</p>
|
||||
)}
|
||||
{current ? (
|
||||
<form
|
||||
key={edition.version}
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
form.transform((data) => ({
|
||||
...data,
|
||||
version: edition.version,
|
||||
assigned_to: data.assigned_to || null,
|
||||
}));
|
||||
form.post(
|
||||
`/management/editorial/resources/${resource.id}/editions/${edition.id}`,
|
||||
{
|
||||
onSuccess: () =>
|
||||
form.reset('action', 'reason'),
|
||||
},
|
||||
);
|
||||
}}
|
||||
className="space-y-3"
|
||||
>
|
||||
<Field label="Operação">
|
||||
<select
|
||||
required
|
||||
className={control}
|
||||
value={form.data.action}
|
||||
onChange={(e) =>
|
||||
form.setData('action', e.target.value)
|
||||
}
|
||||
>
|
||||
<option value="">Seleccionar</option>
|
||||
{(available[edition.state] ?? [])
|
||||
.filter(
|
||||
(action) =>
|
||||
(manager ||
|
||||
[
|
||||
'submit',
|
||||
'archive',
|
||||
].includes(action)) &&
|
||||
(action !== 'legal_validate' ||
|
||||
(legalReviewer &&
|
||||
canApprove)) &&
|
||||
(action !== 'approve' ||
|
||||
canApprove) &&
|
||||
(edition.fresh ||
|
||||
action === 'archive'),
|
||||
)
|
||||
.map((action) => (
|
||||
<option key={action} value={action}>
|
||||
{labels[action]}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
{form.data.action === 'submit' && (
|
||||
<Field label="Responsável pela revisão">
|
||||
<select
|
||||
className={control}
|
||||
value={form.data.assigned_to}
|
||||
onChange={(e) =>
|
||||
form.setData(
|
||||
'assigned_to',
|
||||
e.target.value,
|
||||
)
|
||||
}
|
||||
>
|
||||
<option value="">Por atribuir</option>
|
||||
{reviewers.map((reviewer) => (
|
||||
<option
|
||||
key={reviewer.id}
|
||||
value={reviewer.id}
|
||||
>
|
||||
{reviewer.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
)}
|
||||
<Field label="Fundamento">
|
||||
<textarea
|
||||
required
|
||||
minLength={3}
|
||||
maxLength={5000}
|
||||
className={control}
|
||||
value={form.data.reason}
|
||||
onChange={(e) =>
|
||||
form.setData('reason', e.target.value)
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
{Object.entries(form.errors).map(([key, error]) => (
|
||||
<p key={key} role="alert">
|
||||
{error}
|
||||
</p>
|
||||
))}
|
||||
<button
|
||||
className={button}
|
||||
disabled={form.processing || !form.data.action}
|
||||
>
|
||||
Registar operação
|
||||
</button>
|
||||
</form>
|
||||
) : (
|
||||
<p>
|
||||
Versão histórica para consulta.{' '}
|
||||
<Link
|
||||
className="underline"
|
||||
href={`/management/editorial/resources/${resource.id}`}
|
||||
>
|
||||
Voltar à edição actual
|
||||
</Link>
|
||||
</p>
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
<p>
|
||||
Prepare uma edição no editor existente para iniciar a
|
||||
revisão.
|
||||
</p>
|
||||
)}
|
||||
<h2 className="font-semibold">Versões conservadas</h2>
|
||||
<ul>
|
||||
{editions.map((e) => (
|
||||
<li key={e.id}>
|
||||
<Link
|
||||
className="underline"
|
||||
href={`/management/editorial/resources/${resource.id}?edition=${e.id}`}
|
||||
>
|
||||
Edição {e.revision_no}: {states[e.state] ?? e.state}
|
||||
</Link>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
<h2 className="font-semibold">Histórico de operações</h2>
|
||||
<ul>
|
||||
{history.map((event) => (
|
||||
<li key={event.id}>
|
||||
{event.occurred_at} ·{' '}
|
||||
{labels[event.action.replace('editorial_', '')] ??
|
||||
'Edição guardada'}{' '}
|
||||
· Utilizador {event.actor_user_id}
|
||||
<p>{JSON.parse(event.after_data)?.reason}</p>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</Management>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,202 @@
|
||||
import { Link, router } from '@inertiajs/react';
|
||||
import { Field, Management, button, control } from './shared';
|
||||
|
||||
export const states: Record<string, string> = {
|
||||
draft: 'Rascunho',
|
||||
submitted: 'Submetido',
|
||||
in_review: 'Em revisão',
|
||||
approved: 'Aprovado',
|
||||
published: 'Publicado',
|
||||
returned: 'Devolvido',
|
||||
rejected: 'Rejeitado',
|
||||
archived: 'Arquivado',
|
||||
};
|
||||
type Item = {
|
||||
id: number;
|
||||
title: string;
|
||||
revision_no: number;
|
||||
state: string;
|
||||
responsible: string | null;
|
||||
published: boolean;
|
||||
legal_required: boolean;
|
||||
};
|
||||
const eventTitles: Record<string, string> = {
|
||||
submit: 'Submissão',
|
||||
start_review: 'Início da revisão',
|
||||
return: 'Devolução',
|
||||
reject: 'Rejeição',
|
||||
legal_validate: 'Validação jurídica',
|
||||
approve: 'Aprovação',
|
||||
publish: 'Publicação',
|
||||
archive: 'Arquivo',
|
||||
};
|
||||
export default function EditorialWorkflow({
|
||||
items,
|
||||
notices,
|
||||
filters = {},
|
||||
resourceAccess,
|
||||
opportunitiesUrl,
|
||||
opportunityPending,
|
||||
}: {
|
||||
resourceAccess: boolean;
|
||||
opportunitiesUrl: string | null;
|
||||
opportunityPending: number;
|
||||
filters?: { state?: string; kind?: string };
|
||||
items: { data: Item[]; current_page: number; last_page: number };
|
||||
notices: {
|
||||
id: number;
|
||||
action: string;
|
||||
read_at: string | null;
|
||||
href: string;
|
||||
reference: string;
|
||||
}[];
|
||||
}) {
|
||||
const pageUrl = (page: number) =>
|
||||
`/management/editorial?${new URLSearchParams({ ...filters, page: String(page) })}`;
|
||||
return (
|
||||
<Management title="Circuito editorial">
|
||||
<p>
|
||||
Artigos, legislação e documentos: edições privadas e versão
|
||||
pública separadas. As oportunidades mantêm o seu circuito
|
||||
próprio.
|
||||
</p>
|
||||
<div className="flex flex-wrap gap-4">
|
||||
<Link className="underline" href="/dashboard">
|
||||
Painel geral
|
||||
</Link>
|
||||
{resourceAccess && (
|
||||
<Link
|
||||
className="underline"
|
||||
href="/management/portal-services"
|
||||
>
|
||||
Biblioteca e editores
|
||||
</Link>
|
||||
)}
|
||||
{opportunitiesUrl && (
|
||||
<Link className="underline" href={opportunitiesUrl}>
|
||||
Oportunidades
|
||||
</Link>
|
||||
)}
|
||||
</div>
|
||||
{opportunitiesUrl && (
|
||||
<section
|
||||
aria-label="Circuito de oportunidades"
|
||||
className="my-4 rounded border p-4"
|
||||
>
|
||||
<h2 className="font-semibold">Oportunidades</h2>
|
||||
<p>
|
||||
{opportunityPending} conteúdos pendentes no seu âmbito
|
||||
de acesso.
|
||||
</p>
|
||||
<Link className="underline" href={opportunitiesUrl}>
|
||||
Continuar na fila de oportunidades existente
|
||||
</Link>
|
||||
</section>
|
||||
)}
|
||||
{resourceAccess && (
|
||||
<>
|
||||
<form
|
||||
action="/management/editorial"
|
||||
className="my-4 flex flex-wrap items-end gap-3"
|
||||
>
|
||||
<Field label="Conteúdo">
|
||||
<select
|
||||
className={control}
|
||||
name="kind"
|
||||
defaultValue={filters.kind ?? ''}
|
||||
>
|
||||
<option value="">Todos</option>
|
||||
<option value="article">Artigos</option>
|
||||
<option value="legislation">Legislação</option>
|
||||
<option value="document">Documentos</option>
|
||||
</select>
|
||||
</Field>
|
||||
<Field label="Estado da edição">
|
||||
<select
|
||||
className={control}
|
||||
name="state"
|
||||
defaultValue={filters.state ?? ''}
|
||||
>
|
||||
<option value="">Todos</option>
|
||||
{Object.entries(states).map(
|
||||
([state, label]) => (
|
||||
<option key={state} value={state}>
|
||||
{label}
|
||||
</option>
|
||||
),
|
||||
)}
|
||||
</select>
|
||||
</Field>
|
||||
<button className={button}>Filtrar fila</button>
|
||||
</form>
|
||||
<section aria-label="Fila editorial" className="space-y-3">
|
||||
{items.data.map((item) => (
|
||||
<article
|
||||
key={item.id}
|
||||
className="rounded border p-4"
|
||||
>
|
||||
<Link
|
||||
className="font-semibold underline"
|
||||
href={`/management/editorial/resources/${item.id}`}
|
||||
>
|
||||
{item.title}
|
||||
</Link>
|
||||
<p>
|
||||
Edição {item.revision_no} ·{' '}
|
||||
{states[item.state] ?? item.state} ·
|
||||
Responsável:{' '}
|
||||
{item.responsible ?? 'Por atribuir'}
|
||||
</p>
|
||||
<p>
|
||||
{item.published
|
||||
? 'Versão pública disponível'
|
||||
: 'Sem versão pública'}
|
||||
{item.legal_required &&
|
||||
' · Exige validação jurídica'}
|
||||
</p>
|
||||
</article>
|
||||
))}
|
||||
</section>
|
||||
<nav aria-label="Paginação" className="flex gap-4">
|
||||
{items.current_page > 1 && (
|
||||
<Link href={pageUrl(items.current_page - 1)}>
|
||||
Anterior
|
||||
</Link>
|
||||
)}
|
||||
<span>
|
||||
Página {items.current_page} de {items.last_page}
|
||||
</span>
|
||||
{items.current_page < items.last_page && (
|
||||
<Link href={pageUrl(items.current_page + 1)}>
|
||||
Seguinte
|
||||
</Link>
|
||||
)}
|
||||
</nav>
|
||||
</>
|
||||
)}
|
||||
<section aria-label="Notificações editoriais">
|
||||
<h2 className="font-semibold">Notificações</h2>
|
||||
{notices.map((n) => (
|
||||
<p key={n.id}>
|
||||
<Link className="underline" href={n.href}>
|
||||
{eventTitles[n.action] ?? 'Alteração editorial'} ·{' '}
|
||||
{n.reference}
|
||||
</Link>
|
||||
{!n.read_at && (
|
||||
<button
|
||||
className="ml-3 underline"
|
||||
onClick={() =>
|
||||
router.post(
|
||||
`/management/editorial/notices/${n.id}/read`,
|
||||
)
|
||||
}
|
||||
>
|
||||
Marcar como lida
|
||||
</button>
|
||||
)}
|
||||
</p>
|
||||
))}
|
||||
</section>
|
||||
</Management>
|
||||
);
|
||||
}
|
||||
@@ -15,6 +15,8 @@ export default function ArticleEditor({
|
||||
source,
|
||||
images,
|
||||
revisions,
|
||||
workflow,
|
||||
workflowEnabled = false,
|
||||
}: {
|
||||
resource: {
|
||||
id: number;
|
||||
@@ -36,6 +38,8 @@ export default function ArticleEditor({
|
||||
change_type: string;
|
||||
created_at: string;
|
||||
}[];
|
||||
workflowEnabled?: boolean;
|
||||
workflow?: { id: string; state: string; revision_no: number } | null;
|
||||
}) {
|
||||
const initial = () => ({
|
||||
body: content?.body ?? '',
|
||||
@@ -106,9 +110,21 @@ export default function ArticleEditor({
|
||||
<Management title={`Editar artigo — ${resource.title}`}>
|
||||
<p>
|
||||
O original, a origem e as versões permanecem na biblioteca.
|
||||
Guardar cria uma revisão editorial e retira a publicação até à
|
||||
sua acção expressa no acervo.
|
||||
{workflowEnabled
|
||||
? 'Guardar prepara uma edição privada e conserva a versão pública até à publicação explícita da nova edição aprovada.'
|
||||
: 'No editor anterior, guardar retira a publicação até à sua acção expressa no acervo.'}
|
||||
</p>
|
||||
{workflow && (
|
||||
<p>
|
||||
<Link
|
||||
className="underline"
|
||||
href={`/management/editorial/resources/${resource.id}`}
|
||||
>
|
||||
Conferir edição {workflow.revision_no}, revisão e
|
||||
publicação
|
||||
</Link>
|
||||
</p>
|
||||
)}
|
||||
<p role="status">
|
||||
Revisão guardada {resource.metadata_version} ·{' '}
|
||||
{resource.published ? 'Publicado' : 'Rascunho privado'}
|
||||
|
||||
@@ -166,7 +166,9 @@ export default function Manage({
|
||||
editorialScopeOnly = false,
|
||||
managementFilters = {},
|
||||
associationOptions = {},
|
||||
editorialWorkflowEnabled = false,
|
||||
}: {
|
||||
editorialWorkflowEnabled?: boolean;
|
||||
managementFilters?: { q?: string; state?: string; intent?: string };
|
||||
associationOptions?: Record<
|
||||
string,
|
||||
@@ -984,20 +986,24 @@ export default function Manage({
|
||||
/>
|
||||
Destacar como essencial na página inicial
|
||||
</label>
|
||||
<label className="flex gap-2">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={form.data.independent_review}
|
||||
onChange={(e) =>
|
||||
form.setData(
|
||||
'independent_review',
|
||||
e.target.checked,
|
||||
)
|
||||
}
|
||||
/>
|
||||
Foi realizada revisão independente por outro
|
||||
gestor
|
||||
</label>
|
||||
{!editorialWorkflowEnabled && (
|
||||
<label className="flex gap-2">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={
|
||||
form.data.independent_review
|
||||
}
|
||||
onChange={(e) =>
|
||||
form.setData(
|
||||
'independent_review',
|
||||
e.target.checked,
|
||||
)
|
||||
}
|
||||
/>
|
||||
Foi realizada revisão independente por
|
||||
outro gestor
|
||||
</label>
|
||||
)}
|
||||
<fieldset className="space-y-3 rounded border p-4">
|
||||
<legend className="font-semibold">
|
||||
Relações com etapas, módulos e
|
||||
@@ -1401,7 +1407,7 @@ export default function Manage({
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{disclosureAuthorization && (
|
||||
{disclosureAuthorization && !editorialWorkflowEnabled && (
|
||||
<section
|
||||
className="space-y-3 rounded border border-emerald-700 bg-emerald-50 p-5"
|
||||
aria-labelledby="disclosure-authorization-title"
|
||||
@@ -1684,31 +1690,41 @@ export default function Manage({
|
||||
>
|
||||
Ler / pré-visualizar artigo
|
||||
</a>
|
||||
<button
|
||||
type="button"
|
||||
className={button}
|
||||
onClick={() => {
|
||||
setActionError('');
|
||||
router.post(
|
||||
`/management/portal-services/resources/${r.id}`,
|
||||
{ published: !r.published },
|
||||
{
|
||||
preserveScroll: true,
|
||||
onError: (errors) =>
|
||||
setActionError(
|
||||
Object.values(
|
||||
errors,
|
||||
)[0] ??
|
||||
'A transição foi recusada; confirme o estado do ficheiro, fonte e direitos.',
|
||||
),
|
||||
},
|
||||
);
|
||||
}}
|
||||
>
|
||||
{r.published
|
||||
? 'Retirar da publicação'
|
||||
: 'Publicar'}
|
||||
</button>
|
||||
{editorialWorkflowEnabled && (
|
||||
<a
|
||||
className={button}
|
||||
href={`/management/editorial/resources/${r.id}`}
|
||||
>
|
||||
Revisão, aprovação e publicação
|
||||
</a>
|
||||
)}
|
||||
{(!editorialWorkflowEnabled || r.published) && (
|
||||
<button
|
||||
type="button"
|
||||
className={button}
|
||||
onClick={() => {
|
||||
setActionError('');
|
||||
router.post(
|
||||
`/management/portal-services/resources/${r.id}`,
|
||||
{ published: !r.published },
|
||||
{
|
||||
preserveScroll: true,
|
||||
onError: (errors) =>
|
||||
setActionError(
|
||||
Object.values(
|
||||
errors,
|
||||
)[0] ??
|
||||
'A transição foi recusada; confirme o estado do ficheiro, fonte e direitos.',
|
||||
),
|
||||
},
|
||||
);
|
||||
}}
|
||||
>
|
||||
{r.published
|
||||
? 'Retirar da publicação'
|
||||
: 'Publicar'}
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
{actionError && <p role="alert">{actionError}</p>}
|
||||
</article>
|
||||
|
||||
Reference in New Issue
Block a user