@@ -1,7 +1,7 @@
|
||||
import { Link, useForm, usePage } from "@inertiajs/react";
|
||||
import { Link, useForm, usePage } from '@inertiajs/react';
|
||||
import StructureGeographyPanel, {
|
||||
type StructureGeography,
|
||||
} from "@/components/structure-geography";
|
||||
} from '@/components/structure-geography';
|
||||
import {
|
||||
Frame,
|
||||
Errors,
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
type Interest,
|
||||
type Partnership,
|
||||
type Source,
|
||||
} from "./shared";
|
||||
} from './shared';
|
||||
type Props = Catalogues & {
|
||||
record: Partnership;
|
||||
owner: boolean;
|
||||
@@ -36,10 +36,10 @@ type Props = Catalogues & {
|
||||
}[];
|
||||
};
|
||||
function Publication({ p }: { p: Props }) {
|
||||
const form = useForm({ version: p.record.version, action: "", reason: "" });
|
||||
const form = useForm({ version: p.record.version, action: '', reason: '' });
|
||||
const action = (value: string) => {
|
||||
form.transform((data) => ({ ...data, action: value }));
|
||||
form.post("/parcerias/" + p.record.id + "/estado", {
|
||||
form.post('/parcerias/' + p.record.id + '/estado', {
|
||||
preserveScroll: true,
|
||||
});
|
||||
};
|
||||
@@ -55,27 +55,27 @@ function Publication({ p }: { p: Props }) {
|
||||
<textarea
|
||||
className={control}
|
||||
value={form.data.reason}
|
||||
onChange={(e) => form.setData("reason", e.target.value)}
|
||||
onChange={(e) => form.setData('reason', e.target.value)}
|
||||
/>
|
||||
</Field>
|
||||
<Errors errors={form.errors} />
|
||||
<div className="flex flex-wrap gap-3">
|
||||
{p.canEdit &&
|
||||
["draft", "returned", "rejected"].includes(
|
||||
['draft', 'returned', 'rejected'].includes(
|
||||
p.record.status,
|
||||
) && (
|
||||
<button
|
||||
className={button}
|
||||
disabled={form.processing || !form.data.reason}
|
||||
onClick={() => action("submit")}
|
||||
onClick={() => action('submit')}
|
||||
>
|
||||
Submeter para publicação
|
||||
</button>
|
||||
)}
|
||||
{p.moderator &&
|
||||
!p.owner &&
|
||||
["submitted", "pending"].includes(p.record.status) &&
|
||||
["publish", "return", "reject"].map((value) => (
|
||||
['submitted', 'pending'].includes(p.record.status) &&
|
||||
['publish', 'return', 'reject'].map((value) => (
|
||||
<button
|
||||
className={button}
|
||||
key={value}
|
||||
@@ -84,33 +84,33 @@ function Publication({ p }: { p: Props }) {
|
||||
>
|
||||
{
|
||||
{
|
||||
publish: "Publicar",
|
||||
return: "Devolver para correção",
|
||||
reject: "Rejeitar com fundamento",
|
||||
publish: 'Publicar',
|
||||
return: 'Devolver para correção',
|
||||
reject: 'Rejeitar com fundamento',
|
||||
}[value]
|
||||
}
|
||||
</button>
|
||||
))}
|
||||
{p.canEdit &&
|
||||
["published", "suspended", "archived"].includes(
|
||||
['published', 'suspended', 'archived'].includes(
|
||||
p.record.status,
|
||||
) && (
|
||||
<button
|
||||
className={button}
|
||||
disabled={form.processing || !form.data.reason}
|
||||
onClick={() => action("renew")}
|
||||
onClick={() => action('renew')}
|
||||
>
|
||||
Renovar em rascunho
|
||||
</button>
|
||||
)}
|
||||
{p.canEdit &&
|
||||
["draft", "published", "suspended", "rejected"].includes(
|
||||
['draft', 'published', 'suspended', 'rejected'].includes(
|
||||
p.record.status,
|
||||
) && (
|
||||
<button
|
||||
className={button}
|
||||
disabled={form.processing || !form.data.reason}
|
||||
onClick={() => action("archive")}
|
||||
onClick={() => action('archive')}
|
||||
>
|
||||
Arquivar publicação
|
||||
</button>
|
||||
@@ -118,7 +118,7 @@ function Publication({ p }: { p: Props }) {
|
||||
{p.canEdit && (
|
||||
<Link
|
||||
className="underline"
|
||||
href={"/parcerias/" + p.record.id + "/editar"}
|
||||
href={'/parcerias/' + p.record.id + '/editar'}
|
||||
>
|
||||
Editar rascunho
|
||||
</Link>
|
||||
@@ -134,17 +134,17 @@ function InterestForm({
|
||||
}: {
|
||||
record: Partnership;
|
||||
interest?: Interest;
|
||||
organizations: Catalogues["organizations"];
|
||||
organizations: Catalogues['organizations'];
|
||||
}) {
|
||||
const form = useForm({
|
||||
version: interest?.version ?? null,
|
||||
organization_id: interest?.organization_id ?? "",
|
||||
proposal: interest?.proposal ?? "",
|
||||
organization_id: interest?.organization_id ?? '',
|
||||
proposal: interest?.proposal ?? '',
|
||||
payload: {
|
||||
capacity: interest?.payload.capacity ?? "",
|
||||
availability: interest?.payload.availability ?? "",
|
||||
contribution: interest?.payload.contribution ?? "",
|
||||
conflicts: interest?.payload.conflicts ?? "",
|
||||
capacity: interest?.payload.capacity ?? '',
|
||||
availability: interest?.payload.availability ?? '',
|
||||
contribution: interest?.payload.contribution ?? '',
|
||||
conflicts: interest?.payload.conflicts ?? '',
|
||||
consent: interest?.payload.consent ?? false,
|
||||
},
|
||||
});
|
||||
@@ -153,15 +153,15 @@ function InterestForm({
|
||||
className="space-y-4 rounded border p-5"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
form.post("/parcerias/" + record.id + "/interesses", {
|
||||
form.post('/parcerias/' + record.id + '/interesses', {
|
||||
preserveScroll: true,
|
||||
});
|
||||
}}
|
||||
>
|
||||
<h2 className="text-xl font-bold">
|
||||
{interest
|
||||
? "Atualizar manifestação de interesse"
|
||||
: "Manifestar interesse"}
|
||||
? 'Atualizar manifestação de interesse'
|
||||
: 'Manifestar interesse'}
|
||||
</h2>
|
||||
<p>
|
||||
Declarações são informações comunicadas por si; não atribuem
|
||||
@@ -174,7 +174,7 @@ function InterestForm({
|
||||
className={control}
|
||||
value={form.data.organization_id}
|
||||
onChange={(e) =>
|
||||
form.setData("organization_id", e.target.value)
|
||||
form.setData('organization_id', e.target.value)
|
||||
}
|
||||
>
|
||||
<option value="">Participação pessoal</option>
|
||||
@@ -189,25 +189,25 @@ function InterestForm({
|
||||
<textarea
|
||||
className={control}
|
||||
value={form.data.proposal}
|
||||
onChange={(e) => form.setData("proposal", e.target.value)}
|
||||
onChange={(e) => form.setData('proposal', e.target.value)}
|
||||
/>
|
||||
</Field>
|
||||
{(
|
||||
[
|
||||
"capacity",
|
||||
"availability",
|
||||
"contribution",
|
||||
"conflicts",
|
||||
'capacity',
|
||||
'availability',
|
||||
'contribution',
|
||||
'conflicts',
|
||||
] as const
|
||||
).map((key) => (
|
||||
<Field
|
||||
key={key}
|
||||
label={
|
||||
{
|
||||
capacity: "Capacidade disponível",
|
||||
availability: "Disponibilidade",
|
||||
contribution: "Contribuição proposta",
|
||||
conflicts: "Conflitos de interesse declarados",
|
||||
capacity: 'Capacidade disponível',
|
||||
availability: 'Disponibilidade',
|
||||
contribution: 'Contribuição proposta',
|
||||
conflicts: 'Conflitos de interesse declarados',
|
||||
}[key]
|
||||
}
|
||||
>
|
||||
@@ -215,7 +215,7 @@ function InterestForm({
|
||||
className={control}
|
||||
value={form.data.payload[key]}
|
||||
onChange={(e) =>
|
||||
form.setData("payload", {
|
||||
form.setData('payload', {
|
||||
...form.data.payload,
|
||||
[key]: e.target.value,
|
||||
})
|
||||
@@ -228,12 +228,12 @@ function InterestForm({
|
||||
type="checkbox"
|
||||
checked={form.data.payload.consent}
|
||||
onChange={(e) =>
|
||||
form.setData("payload", {
|
||||
form.setData('payload', {
|
||||
...form.data.payload,
|
||||
consent: e.target.checked,
|
||||
})
|
||||
}
|
||||
/>{" "}
|
||||
/>{' '}
|
||||
Autorizo a partilha desta candidatura com o responsável pela
|
||||
parceria.
|
||||
</label>
|
||||
@@ -254,30 +254,30 @@ function Candidacy({
|
||||
owner: boolean;
|
||||
canEdit: boolean;
|
||||
record: Partnership;
|
||||
organizations: Catalogues["organizations"];
|
||||
organizations: Catalogues['organizations'];
|
||||
}) {
|
||||
const assessment = Object.fromEntries(
|
||||
interest.match.criteria.map((c) => [
|
||||
c.code,
|
||||
{
|
||||
state: interest.assessment[c.code]?.state ?? "unknown",
|
||||
evidence: interest.assessment[c.code]?.evidence ?? "",
|
||||
state: interest.assessment[c.code]?.state ?? 'unknown',
|
||||
evidence: interest.assessment[c.code]?.evidence ?? '',
|
||||
},
|
||||
]),
|
||||
);
|
||||
const form = useForm({
|
||||
version: interest.version,
|
||||
action: "",
|
||||
reason: "",
|
||||
action: '',
|
||||
reason: '',
|
||||
assessment,
|
||||
});
|
||||
const act = (action: string) => {
|
||||
form.transform((data) => ({
|
||||
...data,
|
||||
action,
|
||||
assessment: action === "assess" ? data.assessment : {},
|
||||
assessment: action === 'assess' ? data.assessment : {},
|
||||
}));
|
||||
form.post("/parcerias/candidaturas/" + interest.id, {
|
||||
form.post('/parcerias/candidaturas/' + interest.id, {
|
||||
preserveScroll: true,
|
||||
});
|
||||
};
|
||||
@@ -289,23 +289,23 @@ function Candidacy({
|
||||
<p>{interest.proposal}</p>
|
||||
<p>{interest.payload.capacity}</p>
|
||||
<p>
|
||||
Disponibilidade:{" "}
|
||||
{interest.payload.availability || "Por esclarecer"}
|
||||
Disponibilidade:{' '}
|
||||
{interest.payload.availability || 'Por esclarecer'}
|
||||
</p>
|
||||
<p>
|
||||
Contribuição:{" "}
|
||||
{interest.payload.contribution || "Por esclarecer"}
|
||||
Contribuição:{' '}
|
||||
{interest.payload.contribution || 'Por esclarecer'}
|
||||
</p>
|
||||
<p>
|
||||
Conflitos declarados:{" "}
|
||||
{interest.payload.conflicts || "Sem informação"}
|
||||
Conflitos declarados:{' '}
|
||||
{interest.payload.conflicts || 'Sem informação'}
|
||||
</p>
|
||||
{interest.decision_reason && (
|
||||
<p>Última decisão: {interest.decision_reason}</p>
|
||||
)}
|
||||
<p>
|
||||
Correspondência: {interest.match.score_min}–
|
||||
{interest.match.score_max}% · Elegibilidade:{" "}
|
||||
{interest.match.score_max}% · Elegibilidade:{' '}
|
||||
{labels[interest.match.eligibility]}. O intervalo distingue
|
||||
dados desconhecidos de incumprimentos; não é uma aprovação.
|
||||
</p>
|
||||
@@ -313,7 +313,7 @@ function Candidacy({
|
||||
{interest.match.criteria.map((c) => (
|
||||
<li key={c.code}>
|
||||
{c.label} · peso {c.weight} · {labels[c.state]}
|
||||
{c.mandatory ? " · Obrigatório" : ""}
|
||||
{c.mandatory ? ' · Obrigatório' : ''}
|
||||
{c.evidence && <> · Evidência: {c.evidence}</>}
|
||||
<p className="text-sm">{c.explanation}</p>
|
||||
</li>
|
||||
@@ -322,14 +322,14 @@ function Candidacy({
|
||||
{interest.room_id && (
|
||||
<Link
|
||||
className={button}
|
||||
href={"/parcerias/salas/" + interest.room_id}
|
||||
href={'/parcerias/salas/' + interest.room_id}
|
||||
>
|
||||
Abrir conexão privada
|
||||
</Link>
|
||||
)}
|
||||
{owner &&
|
||||
canEdit &&
|
||||
["submitted", "clarification", "shortlisted"].includes(
|
||||
['submitted', 'clarification', 'shortlisted'].includes(
|
||||
interest.status,
|
||||
) && (
|
||||
<>
|
||||
@@ -348,7 +348,7 @@ function Candidacy({
|
||||
.state
|
||||
}
|
||||
onChange={(e) =>
|
||||
form.setData("assessment", {
|
||||
form.setData('assessment', {
|
||||
...form.data.assessment,
|
||||
[c.code]: {
|
||||
...form.data.assessment[
|
||||
@@ -359,7 +359,7 @@ function Candidacy({
|
||||
})
|
||||
}
|
||||
>
|
||||
{["unknown", "met", "unmet"].map(
|
||||
{['unknown', 'met', 'unmet'].map(
|
||||
(state) => (
|
||||
<option
|
||||
key={state}
|
||||
@@ -379,7 +379,7 @@ function Candidacy({
|
||||
.evidence
|
||||
}
|
||||
onChange={(e) =>
|
||||
form.setData("assessment", {
|
||||
form.setData('assessment', {
|
||||
...form.data.assessment,
|
||||
[c.code]: {
|
||||
...form.data.assessment[
|
||||
@@ -400,18 +400,18 @@ function Candidacy({
|
||||
className={control}
|
||||
value={form.data.reason}
|
||||
onChange={(e) =>
|
||||
form.setData("reason", e.target.value)
|
||||
form.setData('reason', e.target.value)
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
<div className="flex flex-wrap gap-3">
|
||||
{[
|
||||
"assess",
|
||||
"clarify",
|
||||
"shortlist",
|
||||
"reject",
|
||||
...(interest.status === "shortlisted"
|
||||
? ["connect"]
|
||||
'assess',
|
||||
'clarify',
|
||||
'shortlist',
|
||||
'reject',
|
||||
...(interest.status === 'shortlisted'
|
||||
? ['connect']
|
||||
: []),
|
||||
].map((action) => (
|
||||
<button
|
||||
@@ -424,12 +424,12 @@ function Candidacy({
|
||||
>
|
||||
{
|
||||
{
|
||||
assess: "Guardar avaliação",
|
||||
clarify: "Pedir esclarecimento",
|
||||
assess: 'Guardar avaliação',
|
||||
clarify: 'Pedir esclarecimento',
|
||||
shortlist:
|
||||
"Adicionar à lista curta",
|
||||
reject: "Não selecionar",
|
||||
connect: "Abrir negociação",
|
||||
'Adicionar à lista curta',
|
||||
reject: 'Não selecionar',
|
||||
connect: 'Abrir negociação',
|
||||
}[action]
|
||||
}
|
||||
</button>
|
||||
@@ -438,7 +438,7 @@ function Candidacy({
|
||||
</>
|
||||
)}
|
||||
{!owner &&
|
||||
["submitted", "clarification", "shortlisted"].includes(
|
||||
['submitted', 'clarification', 'shortlisted'].includes(
|
||||
interest.status,
|
||||
) && (
|
||||
<>
|
||||
@@ -447,21 +447,21 @@ function Candidacy({
|
||||
className={control}
|
||||
value={form.data.reason}
|
||||
onChange={(e) =>
|
||||
form.setData("reason", e.target.value)
|
||||
form.setData('reason', e.target.value)
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
<button
|
||||
className={button}
|
||||
disabled={form.processing || !form.data.reason}
|
||||
onClick={() => act("withdraw")}
|
||||
onClick={() => act('withdraw')}
|
||||
>
|
||||
Retirar candidatura
|
||||
</button>
|
||||
</>
|
||||
)}
|
||||
{!owner &&
|
||||
["submitted", "clarification", "withdrawn"].includes(
|
||||
['submitted', 'clarification', 'withdrawn'].includes(
|
||||
interest.status,
|
||||
) && (
|
||||
<InterestForm
|
||||
@@ -477,13 +477,13 @@ function Candidacy({
|
||||
export default function Detail(p: Props) {
|
||||
const { auth } = usePage<{ auth: { user: unknown } }>().props;
|
||||
return (
|
||||
<Frame title={p.record.title || "Pré-visualização da ideia"}>
|
||||
<Frame title={p.record.title || 'Pré-visualização da ideia'}>
|
||||
<div className="space-y-6">
|
||||
<p>
|
||||
{p.record.partnership_type
|
||||
? p.types[p.record.partnership_type]
|
||||
: "Tipo por completar"}{" "}
|
||||
· {p.record.kind === "offering" ? "Oferta" : "Procura"} ·{" "}
|
||||
: 'Tipo por completar'}{' '}
|
||||
· {p.record.kind === 'offering' ? 'Oferta' : 'Procura'} ·{' '}
|
||||
{labels[p.record.status] ?? p.record.status}
|
||||
</p>
|
||||
<p className="whitespace-pre-wrap">
|
||||
@@ -500,7 +500,7 @@ export default function Detail(p: Props) {
|
||||
</p>
|
||||
)}
|
||||
<p>{p.record.payload.requirements}</p>
|
||||
<p>Prazo: {p.record.deadline ?? "Por definir"}</p>
|
||||
<p>Prazo: {p.record.deadline ?? 'Por definir'}</p>
|
||||
</section>
|
||||
<section className="space-y-3 rounded border p-5">
|
||||
<h2 className="text-xl font-bold">
|
||||
@@ -509,14 +509,14 @@ export default function Detail(p: Props) {
|
||||
{p.locations.length ? (
|
||||
p.locations.map((l, i) => (
|
||||
<p key={i}>
|
||||
{l.path.map((n) => n.name).join(" → ")} ·{" "}
|
||||
{l.path.map((n) => n.name).join(' → ')} ·{' '}
|
||||
{
|
||||
{
|
||||
primary: "Principal",
|
||||
operating: "Área de atuação",
|
||||
coverage: "Abrangência",
|
||||
primary: 'Principal',
|
||||
operating: 'Área de atuação',
|
||||
coverage: 'Abrangência',
|
||||
}[l.role]
|
||||
}{" "}
|
||||
}{' '}
|
||||
· Fonte: {l.source_reference}. Validação
|
||||
independente pendente.
|
||||
</p>
|
||||
@@ -528,7 +528,7 @@ export default function Detail(p: Props) {
|
||||
{p.origins.map((source, i) => (
|
||||
<section key={i} className="space-y-3 rounded border p-5">
|
||||
<h2 className="text-xl font-bold">
|
||||
Origem:{" "}
|
||||
Origem:{' '}
|
||||
<Link className="underline" href={source.href}>
|
||||
{source.title}
|
||||
</Link>
|
||||
@@ -540,8 +540,8 @@ export default function Detail(p: Props) {
|
||||
{source.geography && (
|
||||
<StructureGeographyPanel
|
||||
geography={source.geography}
|
||||
cluster={source.type === "cluster"}
|
||||
dossierId={"partnership-source-" + i}
|
||||
cluster={source.type === 'cluster'}
|
||||
dossierId={'partnership-source-' + i}
|
||||
/>
|
||||
)}
|
||||
</section>
|
||||
@@ -576,10 +576,10 @@ export default function Detail(p: Props) {
|
||||
{i.match.criteria
|
||||
.filter(
|
||||
(c) =>
|
||||
c.state === "unknown",
|
||||
c.state === 'unknown',
|
||||
)
|
||||
.map((c) => c.label)
|
||||
.join(", ")}
|
||||
.join(', ')}
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
@@ -589,7 +589,7 @@ export default function Detail(p: Props) {
|
||||
)}
|
||||
{p.interests.map((i) => (
|
||||
<Candidacy
|
||||
key={i.id + ":" + i.version}
|
||||
key={i.id + ':' + i.version}
|
||||
interest={i}
|
||||
owner={p.owner}
|
||||
canEdit={p.canEdit}
|
||||
@@ -598,7 +598,7 @@ export default function Detail(p: Props) {
|
||||
/>
|
||||
))}
|
||||
{!p.owner &&
|
||||
p.record.status === "published" &&
|
||||
p.record.status === 'published' &&
|
||||
auth.user &&
|
||||
!p.interests.length && (
|
||||
<InterestForm
|
||||
@@ -606,7 +606,7 @@ export default function Detail(p: Props) {
|
||||
organizations={p.organizations}
|
||||
/>
|
||||
)}
|
||||
{!auth.user && p.record.status === "published" && (
|
||||
{!auth.user && p.record.status === 'published' && (
|
||||
<Link className={button} href="/login">
|
||||
Entrar para manifestar interesse
|
||||
</Link>
|
||||
@@ -616,7 +616,7 @@ export default function Detail(p: Props) {
|
||||
<summary>Histórico e decisões</summary>
|
||||
{p.history.map((h, i) => (
|
||||
<p key={i}>
|
||||
{h.occurred_at} · Autor {h.actor_id} ·{" "}
|
||||
{h.occurred_at} · Autor {h.actor_id} ·{' '}
|
||||
{h.event_type}
|
||||
</p>
|
||||
))}
|
||||
|
||||
Reference in New Issue
Block a user