@@ -0,0 +1,353 @@
|
||||
import { Link, useForm } from '@inertiajs/react';
|
||||
import { Management, Field, button, control } from '../management/shared';
|
||||
import { titles, statuses, stages, roles } from './types';
|
||||
import type { Structure, StructureRecord, Chain } from './types';
|
||||
import ValueNetwork from './value-network';
|
||||
import type { ChainLink, Gap } from './value-network';
|
||||
|
||||
function ChainForm({ clusterId, chain }: { clusterId: string; chain?: Chain }) {
|
||||
const form = useForm({
|
||||
code: chain?.code ?? '',
|
||||
name: chain?.name ?? '',
|
||||
stage: chain?.stage ?? 'input',
|
||||
});
|
||||
return (
|
||||
<form
|
||||
className="space-y-3 rounded border p-4"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
const url = `/management/clusters/${clusterId}/chains`;
|
||||
if (chain)
|
||||
form.put(`${url}/${chain.id}`, { preserveScroll: true });
|
||||
else
|
||||
form.post(url, {
|
||||
preserveScroll: true,
|
||||
onSuccess: () => form.reset(),
|
||||
});
|
||||
}}
|
||||
>
|
||||
<h3 className="font-semibold">
|
||||
{chain ? chain.name : 'Nova etapa'}
|
||||
</h3>
|
||||
<Field label="Código da etapa" error={form.errors.code}>
|
||||
<input
|
||||
className={control}
|
||||
value={form.data.code}
|
||||
onChange={(e) => form.setData('code', e.target.value)}
|
||||
/>
|
||||
</Field>
|
||||
<Field label="Nome da etapa" error={form.errors.name}>
|
||||
<input
|
||||
className={control}
|
||||
value={form.data.name}
|
||||
onChange={(e) => form.setData('name', e.target.value)}
|
||||
/>
|
||||
</Field>
|
||||
<Field label="Fase da cadeia" error={form.errors.stage}>
|
||||
<select
|
||||
className={control}
|
||||
value={form.data.stage}
|
||||
onChange={(e) => form.setData('stage', e.target.value)}
|
||||
>
|
||||
{Object.entries(stages).map(([value, label]) => (
|
||||
<option key={value} value={value}>
|
||||
{label}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
<button className={button} disabled={form.processing}>
|
||||
Guardar etapa
|
||||
</button>
|
||||
</form>
|
||||
);
|
||||
}
|
||||
|
||||
export default function Editor({
|
||||
structure,
|
||||
record,
|
||||
projects,
|
||||
chains,
|
||||
memberships,
|
||||
chainLinks,
|
||||
gaps,
|
||||
}: {
|
||||
structure: Structure;
|
||||
record: StructureRecord | null;
|
||||
projects: { id: string; name: string; code: string }[];
|
||||
chains: Chain[];
|
||||
chainLinks: ChainLink[];
|
||||
gaps: Gap[];
|
||||
memberships: {
|
||||
id: string;
|
||||
project_id: string;
|
||||
name: string;
|
||||
role: string;
|
||||
}[];
|
||||
}) {
|
||||
const isProject = structure === 'projects';
|
||||
const form = useForm({
|
||||
code: record?.code ?? '',
|
||||
name: record?.name ?? '',
|
||||
status: record?.status ?? (isProject ? 'draft' : 'planned'),
|
||||
sector: record?.sector ?? '',
|
||||
description: record?.description ?? '',
|
||||
budget_amount: record?.budget_amount ?? '',
|
||||
budget_currency: record?.budget_currency ?? '',
|
||||
start_date: record?.start_date?.slice(0, 10) ?? '',
|
||||
end_date: record?.end_date?.slice(0, 10) ?? '',
|
||||
});
|
||||
const association = useForm({ project_id: '', role: 'complementary' });
|
||||
return (
|
||||
<Management
|
||||
title={`${record ? 'Editar' : 'Criar'} ${isProject ? 'projecto' : 'cluster'}`}
|
||||
>
|
||||
<Link className="underline" href={`/management/${structure}`}>
|
||||
Voltar a {titles[structure].toLowerCase()}
|
||||
</Link>
|
||||
<p>
|
||||
Registo interno de gestão. O estado activo não publica este
|
||||
conteúdo no portal.
|
||||
</p>
|
||||
<form
|
||||
className="max-w-3xl space-y-4"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
if (record)
|
||||
form.put(`/management/${structure}/${record.id}`);
|
||||
else form.post(`/management/${structure}`);
|
||||
}}
|
||||
>
|
||||
<Field label="Código" error={form.errors.code}>
|
||||
<input
|
||||
className={control}
|
||||
value={form.data.code}
|
||||
onChange={(e) => form.setData('code', e.target.value)}
|
||||
/>
|
||||
</Field>
|
||||
<Field label="Nome" error={form.errors.name}>
|
||||
<input
|
||||
className={control}
|
||||
value={form.data.name}
|
||||
onChange={(e) => form.setData('name', e.target.value)}
|
||||
/>
|
||||
</Field>
|
||||
<Field label="Estado" error={form.errors.status}>
|
||||
<select
|
||||
className={control}
|
||||
value={form.data.status}
|
||||
onChange={(e) => form.setData('status', e.target.value)}
|
||||
>
|
||||
{Object.entries(statuses[structure]).map(
|
||||
([value, label]) => (
|
||||
<option key={value} value={value}>
|
||||
{label}
|
||||
</option>
|
||||
),
|
||||
)}
|
||||
</select>
|
||||
</Field>
|
||||
{!isProject && (
|
||||
<Field label="Sector do cluster" error={form.errors.sector}>
|
||||
<input
|
||||
className={control}
|
||||
value={form.data.sector}
|
||||
onChange={(e) =>
|
||||
form.setData('sector', e.target.value)
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
)}
|
||||
{isProject && (
|
||||
<>
|
||||
<Field
|
||||
label="Descrição"
|
||||
error={form.errors.description}
|
||||
>
|
||||
<textarea
|
||||
className={control}
|
||||
rows={5}
|
||||
value={form.data.description}
|
||||
onChange={(e) =>
|
||||
form.setData('description', e.target.value)
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
<Field
|
||||
label="Orçamento (use ponto para os decimais)"
|
||||
error={form.errors.budget_amount}
|
||||
>
|
||||
<input
|
||||
inputMode="decimal"
|
||||
className={control}
|
||||
value={form.data.budget_amount}
|
||||
onChange={(e) =>
|
||||
form.setData(
|
||||
'budget_amount',
|
||||
e.target.value,
|
||||
)
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
<Field
|
||||
label="Moeda (código de três letras)"
|
||||
error={form.errors.budget_currency}
|
||||
>
|
||||
<input
|
||||
maxLength={3}
|
||||
className={control}
|
||||
value={form.data.budget_currency}
|
||||
onChange={(e) =>
|
||||
form.setData(
|
||||
'budget_currency',
|
||||
e.target.value.toUpperCase(),
|
||||
)
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
<Field
|
||||
label="Data de início"
|
||||
error={form.errors.start_date}
|
||||
>
|
||||
<input
|
||||
type="date"
|
||||
className={control}
|
||||
value={form.data.start_date}
|
||||
onChange={(e) =>
|
||||
form.setData('start_date', e.target.value)
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
<Field
|
||||
label="Data de conclusão"
|
||||
error={form.errors.end_date}
|
||||
>
|
||||
<input
|
||||
type="date"
|
||||
className={control}
|
||||
value={form.data.end_date}
|
||||
onChange={(e) =>
|
||||
form.setData('end_date', e.target.value)
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
</>
|
||||
)}
|
||||
<button className={button} disabled={form.processing}>
|
||||
Guardar
|
||||
</button>
|
||||
</form>
|
||||
{!isProject && record && (
|
||||
<>
|
||||
<section className="max-w-3xl space-y-4">
|
||||
<h2 className="text-xl font-semibold">
|
||||
Projectos associados
|
||||
</h2>
|
||||
{memberships.map((member) => (
|
||||
<p key={member.id}>
|
||||
<Link
|
||||
className="underline"
|
||||
href={`/management/projects/${member.project_id}/edit`}
|
||||
>
|
||||
{member.name}
|
||||
</Link>{' '}
|
||||
· {roles[member.role]}
|
||||
</p>
|
||||
))}
|
||||
{!memberships.length && (
|
||||
<p>Ainda não existem projectos associados.</p>
|
||||
)}
|
||||
<form
|
||||
className="space-y-3"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
association.post(
|
||||
`/management/clusters/${record.id}/projects`,
|
||||
{ preserveScroll: true },
|
||||
);
|
||||
}}
|
||||
>
|
||||
<Field
|
||||
label="Projecto"
|
||||
error={association.errors.project_id}
|
||||
>
|
||||
<select
|
||||
className={control}
|
||||
value={association.data.project_id}
|
||||
onChange={(e) =>
|
||||
association.setData(
|
||||
'project_id',
|
||||
e.target.value,
|
||||
)
|
||||
}
|
||||
>
|
||||
<option value="">Seleccione</option>
|
||||
{projects.map((project) => (
|
||||
<option
|
||||
key={project.id}
|
||||
value={project.id}
|
||||
>
|
||||
{project.code} — {project.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
<Field
|
||||
label="Papel no cluster"
|
||||
error={association.errors.role}
|
||||
>
|
||||
<select
|
||||
className={control}
|
||||
value={association.data.role}
|
||||
onChange={(e) =>
|
||||
association.setData(
|
||||
'role',
|
||||
e.target.value,
|
||||
)
|
||||
}
|
||||
>
|
||||
{Object.entries(roles).map(
|
||||
([value, label]) => (
|
||||
<option key={value} value={value}>
|
||||
{label}
|
||||
</option>
|
||||
),
|
||||
)}
|
||||
</select>
|
||||
</Field>
|
||||
<button
|
||||
className={button}
|
||||
disabled={association.processing}
|
||||
>
|
||||
Guardar associação
|
||||
</button>
|
||||
<p className="text-sm">
|
||||
Seleccionar um projecto já associado permite
|
||||
actualizar o seu papel.
|
||||
</p>
|
||||
</form>
|
||||
</section>
|
||||
<section className="max-w-3xl space-y-4">
|
||||
<h2 className="text-xl font-semibold">
|
||||
Etapas da cadeia de valor
|
||||
</h2>
|
||||
{chains.map((chain) => (
|
||||
<ChainForm
|
||||
key={chain.id}
|
||||
clusterId={record.id}
|
||||
chain={chain}
|
||||
/>
|
||||
))}
|
||||
<ChainForm clusterId={record.id} />
|
||||
</section>
|
||||
<ValueNetwork
|
||||
clusterId={record.id}
|
||||
chains={chains}
|
||||
links={chainLinks}
|
||||
gaps={gaps}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</Management>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
import { Link, useForm } from '@inertiajs/react';
|
||||
import {
|
||||
Management,
|
||||
Field,
|
||||
Pagination,
|
||||
button,
|
||||
control,
|
||||
} from '../management/shared';
|
||||
import type { Paginated } from '../management/shared';
|
||||
import { titles, statuses } from './types';
|
||||
import type { Structure, StructureRecord } from './types';
|
||||
|
||||
export default function Index({
|
||||
structure,
|
||||
records,
|
||||
filters,
|
||||
}: {
|
||||
structure: Structure;
|
||||
records: Paginated<StructureRecord>;
|
||||
filters: { q?: string };
|
||||
}) {
|
||||
const form = useForm({ q: filters.q ?? '' });
|
||||
return (
|
||||
<Management title={titles[structure]}>
|
||||
<Link className={button} href={`/management/${structure}/create`}>
|
||||
{structure === 'projects' ? 'Criar projecto' : 'Criar cluster'}
|
||||
</Link>
|
||||
<form
|
||||
className="flex flex-wrap items-end gap-3"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
form.get(`/management/${structure}`);
|
||||
}}
|
||||
>
|
||||
<Field label="Pesquisar por nome ou código">
|
||||
<input
|
||||
className={control}
|
||||
value={form.data.q}
|
||||
onChange={(e) => form.setData('q', e.target.value)}
|
||||
/>
|
||||
</Field>
|
||||
<button className={button}>Pesquisar</button>
|
||||
</form>
|
||||
<div className="space-y-3">
|
||||
{records.data.map((record) => (
|
||||
<article
|
||||
key={record.id}
|
||||
className="rounded border p-4 break-words"
|
||||
>
|
||||
<Link
|
||||
className="font-semibold underline"
|
||||
href={`/management/${structure}/${record.id}/edit`}
|
||||
>
|
||||
{record.name}
|
||||
</Link>
|
||||
<p>
|
||||
{record.code} · {statuses[structure][record.status]}
|
||||
</p>
|
||||
{record.sector && <p>{record.sector}</p>}
|
||||
</article>
|
||||
))}
|
||||
</div>
|
||||
{!records.data.length && <p>Nenhum registo encontrado.</p>}
|
||||
<Pagination page={records} />
|
||||
</Management>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
export type Structure = 'projects' | 'clusters';
|
||||
export type StructureRecord = {
|
||||
id: string;
|
||||
code: string;
|
||||
name: string;
|
||||
status: string;
|
||||
sector?: string;
|
||||
description?: string | null;
|
||||
budget_amount?: string | null;
|
||||
budget_currency?: string | null;
|
||||
start_date?: string | null;
|
||||
end_date?: string | null;
|
||||
};
|
||||
export const titles = { projects: 'Projectos', clusters: 'Clusters' };
|
||||
export const statuses: Record<Structure, Record<string, string>> = {
|
||||
projects: {
|
||||
draft: 'Rascunho',
|
||||
planned: 'Planeado',
|
||||
active: 'Activo',
|
||||
suspended: 'Suspenso',
|
||||
completed: 'Concluído',
|
||||
cancelled: 'Cancelado',
|
||||
},
|
||||
clusters: { planned: 'Planeado', active: 'Activo', inactive: 'Inactivo' },
|
||||
};
|
||||
export const stages: Record<string, string> = {
|
||||
input: 'Insumos',
|
||||
production: 'Produção',
|
||||
processing: 'Transformação',
|
||||
logistics: 'Logística',
|
||||
market: 'Mercado',
|
||||
};
|
||||
export const roles: Record<string, string> = {
|
||||
anchor: 'Âncora',
|
||||
complementary: 'Complementar',
|
||||
supporting: 'Apoio',
|
||||
};
|
||||
export type Chain = { id: string; code: string; name: string; stage: string };
|
||||
@@ -0,0 +1,313 @@
|
||||
import { useForm } from '@inertiajs/react';
|
||||
import { Field, button, control } from '../management/shared';
|
||||
import type { Chain } from './types';
|
||||
|
||||
export type ChainLink = {
|
||||
id: string;
|
||||
origin: string;
|
||||
destination: string;
|
||||
link_type: string;
|
||||
};
|
||||
export type Gap = {
|
||||
id: string;
|
||||
value_chain_id: string;
|
||||
title: string;
|
||||
location: string;
|
||||
required_capacity: string;
|
||||
rationale: string;
|
||||
status: string;
|
||||
call_to_action: string;
|
||||
};
|
||||
const linkTypes: Record<string, string> = {
|
||||
supplies: 'Fornece a',
|
||||
processes: 'Transforma para',
|
||||
distributes: 'Distribui para',
|
||||
supports: 'Apoia',
|
||||
};
|
||||
const gapStates: Record<string, string> = {
|
||||
identified: 'Identificada',
|
||||
in_review: 'Em análise',
|
||||
resolved: 'Resolvida',
|
||||
withdrawn: 'Retirada',
|
||||
};
|
||||
|
||||
function RemoveLink({
|
||||
clusterId,
|
||||
link,
|
||||
}: {
|
||||
clusterId: string;
|
||||
link: ChainLink;
|
||||
}) {
|
||||
const form = useForm({});
|
||||
return (
|
||||
<li className="flex flex-wrap items-center justify-between gap-3 rounded border p-3 break-words">
|
||||
<span>
|
||||
{link.origin} → {linkTypes[link.link_type]} → {link.destination}
|
||||
</span>
|
||||
<button
|
||||
type="button"
|
||||
className="underline disabled:opacity-50"
|
||||
disabled={form.processing}
|
||||
aria-label={`Retirar ligação de ${link.origin} para ${link.destination}`}
|
||||
onClick={() =>
|
||||
form.delete(
|
||||
`/management/clusters/${clusterId}/chain-links/${link.id}`,
|
||||
{ preserveScroll: true },
|
||||
)
|
||||
}
|
||||
>
|
||||
Retirar ligação
|
||||
</button>
|
||||
</li>
|
||||
);
|
||||
}
|
||||
|
||||
function GapForm({
|
||||
clusterId,
|
||||
chains,
|
||||
gap,
|
||||
}: {
|
||||
clusterId: string;
|
||||
chains: Chain[];
|
||||
gap?: Gap;
|
||||
}) {
|
||||
const form = useForm({
|
||||
value_chain_id: gap?.value_chain_id ?? '',
|
||||
title: gap?.title ?? '',
|
||||
location: gap?.location ?? '',
|
||||
required_capacity: gap?.required_capacity ?? '',
|
||||
rationale: gap?.rationale ?? '',
|
||||
status: gap?.status ?? 'identified',
|
||||
call_to_action: gap?.call_to_action ?? '',
|
||||
});
|
||||
const textFields = {
|
||||
title: 'Título da lacuna',
|
||||
location: 'Localização',
|
||||
required_capacity: 'Capacidade necessária',
|
||||
rationale: 'Justificação',
|
||||
call_to_action: 'Chamada para acção',
|
||||
} as const;
|
||||
return (
|
||||
<form
|
||||
className="space-y-3 rounded border p-4"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
const url = `/management/clusters/${clusterId}/gaps`;
|
||||
if (gap) form.put(`${url}/${gap.id}`, { preserveScroll: true });
|
||||
else
|
||||
form.post(url, {
|
||||
preserveScroll: true,
|
||||
onSuccess: () => form.reset(),
|
||||
});
|
||||
}}
|
||||
>
|
||||
<h3 className="font-semibold">{gap ? gap.title : 'Nova lacuna'}</h3>
|
||||
<Field label="Etapa com lacuna" error={form.errors.value_chain_id}>
|
||||
<select
|
||||
className={control}
|
||||
value={form.data.value_chain_id}
|
||||
onChange={(e) =>
|
||||
form.setData('value_chain_id', e.target.value)
|
||||
}
|
||||
>
|
||||
<option value="">Seleccione</option>
|
||||
{chains.map((chain) => (
|
||||
<option key={chain.id} value={chain.id}>
|
||||
{chain.code} — {chain.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
{(Object.keys(textFields) as (keyof typeof textFields)[]).map(
|
||||
(field) => (
|
||||
<Field
|
||||
key={field}
|
||||
label={textFields[field]}
|
||||
error={form.errors[field]}
|
||||
>
|
||||
<textarea
|
||||
className={control}
|
||||
rows={field === 'title' ? 1 : 2}
|
||||
value={form.data[field]}
|
||||
onChange={(e) =>
|
||||
form.setData(field, e.target.value)
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
),
|
||||
)}
|
||||
<Field label="Estado da lacuna" error={form.errors.status}>
|
||||
<select
|
||||
className={control}
|
||||
value={form.data.status}
|
||||
onChange={(e) => form.setData('status', e.target.value)}
|
||||
>
|
||||
{Object.entries(gapStates).map(([value, label]) => (
|
||||
<option key={value} value={value}>
|
||||
{label}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
<button className={button} disabled={form.processing}>
|
||||
Guardar lacuna
|
||||
</button>
|
||||
</form>
|
||||
);
|
||||
}
|
||||
|
||||
export default function ValueNetwork({
|
||||
clusterId,
|
||||
chains,
|
||||
links,
|
||||
gaps,
|
||||
}: {
|
||||
clusterId: string;
|
||||
chains: Chain[];
|
||||
links: ChainLink[];
|
||||
gaps: Gap[];
|
||||
}) {
|
||||
const form = useForm({
|
||||
from_value_chain_id: '',
|
||||
to_value_chain_id: '',
|
||||
link_type: 'supplies',
|
||||
});
|
||||
return (
|
||||
<>
|
||||
<section className="max-w-3xl space-y-4">
|
||||
<h2 className="text-xl font-semibold">Ligações entre etapas</h2>
|
||||
{links.length ? (
|
||||
<ul className="space-y-2">
|
||||
{links.map((link) => (
|
||||
<RemoveLink
|
||||
key={link.id}
|
||||
clusterId={clusterId}
|
||||
link={link}
|
||||
/>
|
||||
))}
|
||||
</ul>
|
||||
) : (
|
||||
<p>Ainda não existem ligações entre etapas.</p>
|
||||
)}
|
||||
{chains.length < 2 ? (
|
||||
<p>Crie pelo menos duas etapas para as ligar.</p>
|
||||
) : (
|
||||
<form
|
||||
className="space-y-3"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
form.post(
|
||||
`/management/clusters/${clusterId}/chain-links`,
|
||||
{ preserveScroll: true },
|
||||
);
|
||||
}}
|
||||
>
|
||||
<Field
|
||||
label="Etapa de origem"
|
||||
error={form.errors.from_value_chain_id}
|
||||
>
|
||||
<select
|
||||
className={control}
|
||||
value={form.data.from_value_chain_id}
|
||||
onChange={(e) =>
|
||||
form.setData(
|
||||
'from_value_chain_id',
|
||||
e.target.value,
|
||||
)
|
||||
}
|
||||
>
|
||||
<option value="">Seleccione</option>
|
||||
{chains.map((chain) => (
|
||||
<option key={chain.id} value={chain.id}>
|
||||
{chain.code} — {chain.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
<Field
|
||||
label="Etapa de destino"
|
||||
error={form.errors.to_value_chain_id}
|
||||
>
|
||||
<select
|
||||
className={control}
|
||||
value={form.data.to_value_chain_id}
|
||||
onChange={(e) =>
|
||||
form.setData(
|
||||
'to_value_chain_id',
|
||||
e.target.value,
|
||||
)
|
||||
}
|
||||
>
|
||||
<option value="">Seleccione</option>
|
||||
{chains
|
||||
.filter(
|
||||
(chain) =>
|
||||
chain.id !==
|
||||
form.data.from_value_chain_id,
|
||||
)
|
||||
.map((chain) => (
|
||||
<option key={chain.id} value={chain.id}>
|
||||
{chain.code} — {chain.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
<Field
|
||||
label="Tipo de ligação"
|
||||
error={form.errors.link_type}
|
||||
>
|
||||
<select
|
||||
className={control}
|
||||
value={form.data.link_type}
|
||||
onChange={(e) =>
|
||||
form.setData('link_type', e.target.value)
|
||||
}
|
||||
>
|
||||
{Object.entries(linkTypes).map(
|
||||
([value, label]) => (
|
||||
<option key={value} value={value}>
|
||||
{label}
|
||||
</option>
|
||||
),
|
||||
)}
|
||||
</select>
|
||||
</Field>
|
||||
<button className={button} disabled={form.processing}>
|
||||
Guardar ligação
|
||||
</button>
|
||||
</form>
|
||||
)}
|
||||
</section>
|
||||
<section className="max-w-3xl space-y-4">
|
||||
<h2 className="text-xl font-semibold">
|
||||
Lacunas de investimento
|
||||
</h2>
|
||||
<p>
|
||||
{
|
||||
gaps.filter((gap) =>
|
||||
['identified', 'in_review'].includes(gap.status),
|
||||
).length
|
||||
}{' '}
|
||||
lacunas por resolver.
|
||||
</p>
|
||||
{gaps.map((gap) => (
|
||||
<details key={gap.id} className="rounded border p-3">
|
||||
<summary className="cursor-pointer break-words">
|
||||
{gap.title} · {gapStates[gap.status]}
|
||||
</summary>
|
||||
<GapForm
|
||||
clusterId={clusterId}
|
||||
chains={chains}
|
||||
gap={gap}
|
||||
/>
|
||||
</details>
|
||||
))}
|
||||
{chains.length ? (
|
||||
<GapForm clusterId={clusterId} chains={chains} />
|
||||
) : (
|
||||
<p>Crie uma etapa antes de registar lacunas.</p>
|
||||
)}
|
||||
</section>
|
||||
</>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user