vrsao 2
tests / ci (push) Canceled after 0s

This commit is contained in:
2026-10-08 14:02:01 +02:00
parent bdd766c68a
commit 1106509116
354 changed files with 48275 additions and 24635 deletions
+22 -22
View File
@@ -1,8 +1,8 @@
import { Link, router } from "@inertiajs/react";
import { useState } from "react";
import { Link, router } from '@inertiajs/react';
import { useState } from 'react';
import InteractiveInvestmentMap, {
type InvestmentMapFeature,
} from "@/components/interactive-investment-map";
} from '@/components/interactive-investment-map';
import {
Frame,
Field,
@@ -10,10 +10,10 @@ import {
button,
type Catalogues,
type Partnership,
} from "./shared";
} from './shared';
type Result = Pick<
Partnership,
"id" | "title" | "kind" | "partnership_type" | "deadline"
'id' | 'title' | 'kind' | 'partnership_type' | 'deadline'
> & { summary: string | null; province: string; sector: string };
export default function Catalogue(
p: Catalogues & {
@@ -41,22 +41,22 @@ export default function Catalogue(
className="grid gap-4 rounded border p-5 md:grid-cols-3"
onSubmit={(e) => {
e.preventDefault();
router.get("/parcerias", filters);
router.get('/parcerias', filters);
}}
>
<Field label="Pesquisar">
<input
className={control}
value={filters.q ?? ""}
onChange={(e) => set("q", e.target.value)}
value={filters.q ?? ''}
onChange={(e) => set('q', e.target.value)}
/>
</Field>
<Field label="Tipo de parceria">
<select
className={control}
value={filters.partnership_type ?? ""}
value={filters.partnership_type ?? ''}
onChange={(e) =>
set("partnership_type", e.target.value)
set('partnership_type', e.target.value)
}
>
<option value="">Todos</option>
@@ -70,8 +70,8 @@ export default function Catalogue(
<Field label="Oferta ou procura">
<select
className={control}
value={filters.kind ?? ""}
onChange={(e) => set("kind", e.target.value)}
value={filters.kind ?? ''}
onChange={(e) => set('kind', e.target.value)}
>
<option value="">Ambas</option>
<option value="offering">Oferta</option>
@@ -81,8 +81,8 @@ export default function Catalogue(
<Field label="Setor">
<select
className={control}
value={filters.sector_id ?? ""}
onChange={(e) => set("sector_id", e.target.value)}
value={filters.sector_id ?? ''}
onChange={(e) => set('sector_id', e.target.value)}
>
<option value="">Todos</option>
{p.sectors.map((x) => (
@@ -95,8 +95,8 @@ export default function Catalogue(
<Field label="Território">
<select
className={control}
value={filters.territory_id ?? ""}
onChange={(e) => set("territory_id", e.target.value)}
value={filters.territory_id ?? ''}
onChange={(e) => set('territory_id', e.target.value)}
>
<option value="">Todos</option>
{p.territories.map((x) => (
@@ -118,24 +118,24 @@ export default function Catalogue(
className="space-y-3 rounded border p-5"
>
<h2 className="text-xl font-bold">
<Link href={"/parcerias/" + item.id}>
<Link href={'/parcerias/' + item.id}>
{item.title}
</Link>
</h2>
<p>
{item.partnership_type
? p.types[item.partnership_type]
: "Tipo por completar"}{" "}
· {item.kind === "offering" ? "Oferta" : "Procura"}
: 'Tipo por completar'}{' '}
· {item.kind === 'offering' ? 'Oferta' : 'Procura'}
</p>
<p>{item.summary}</p>
<p>
{item.sector || "Setor por completar"} ·{" "}
{item.province || "Território na ficha"}
{item.sector || 'Setor por completar'} ·{' '}
{item.province || 'Território na ficha'}
</p>
{item.deadline && <p>Prazo: {item.deadline}</p>}
<Link
href={"/parcerias/" + item.id}
href={'/parcerias/' + item.id}
className="underline"
>
Consultar parceria
+17 -17
View File
@@ -1,7 +1,7 @@
import { Link, router } from "@inertiajs/react";
import { Frame, labels, button, type Partnership } from "./shared";
import { Link, router } from '@inertiajs/react';
import { Frame, labels, button, type Partnership } from './shared';
type Props = {
mine: Pick<Partnership, "id" | "title" | "status">[];
mine: Pick<Partnership, 'id' | 'title' | 'status'>[];
interests: {
id: number;
partnership_id: number;
@@ -10,7 +10,7 @@ type Props = {
decision_reason: string | null;
room_id: number | null;
}[];
moderation: Pick<Partnership, "id" | "title" | "status">[];
moderation: Pick<Partnership, 'id' | 'title' | 'status'>[];
notifications: {
id: number;
title: string;
@@ -33,20 +33,20 @@ export default function Dashboard(p: Props) {
<article className="mt-4 rounded border p-4" key={x.id}>
<Link
className="font-semibold underline"
href={"/parcerias/" + x.id}
href={'/parcerias/' + x.id}
>
{x.title || "Ideia sem título"}
{x.title || 'Ideia sem título'}
</Link>
<p>{labels[x.status] ?? x.status}</p>
<p>
Próxima ação:{" "}
{["draft", "returned", "rejected"].includes(
Próxima ação:{' '}
{['draft', 'returned', 'rejected'].includes(
x.status,
)
? "Completar e pré-visualizar para submissão"
: x.status === "published"
? "Consultar candidatos e esclarecer pendências"
: "Acompanhar a decisão"}
? 'Completar e pré-visualizar para submissão'
: x.status === 'published'
? 'Consultar candidatos e esclarecer pendências'
: 'Acompanhar a decisão'}
</p>
</article>
))}
@@ -59,7 +59,7 @@ export default function Dashboard(p: Props) {
<article className="my-4 rounded border p-4" key={x.id}>
<Link
className="underline"
href={"/parcerias/" + x.partnership_id}
href={'/parcerias/' + x.partnership_id}
>
{x.title}
</Link>
@@ -69,7 +69,7 @@ export default function Dashboard(p: Props) {
{x.room_id && (
<Link
className={button}
href={"/parcerias/salas/" + x.room_id}
href={'/parcerias/salas/' + x.room_id}
>
Abrir conexão privada
</Link>
@@ -84,7 +84,7 @@ export default function Dashboard(p: Props) {
<p key={x.id}>
<Link
className="underline"
href={"/parcerias/" + x.id}
href={'/parcerias/' + x.id}
>
{x.title} · {labels[x.status]}
</Link>
@@ -106,9 +106,9 @@ export default function Dashboard(p: Props) {
className="ml-4 underline"
onClick={() =>
router.post(
"/parcerias/notificacoes/" +
'/parcerias/notificacoes/' +
n.id +
"/ler",
'/ler',
)
}
>
+95 -95
View File
@@ -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>
))}
+48 -48
View File
@@ -1,5 +1,5 @@
import { Link, useForm } from "@inertiajs/react";
import { useState } from "react";
import { Link, useForm } from '@inertiajs/react';
import { useState } from 'react';
import {
Frame,
Field,
@@ -8,7 +8,7 @@ import {
button,
type Partnership,
type Catalogues,
} from "./shared";
} from './shared';
type Location = {
geo_location_id: string;
role: string;
@@ -24,19 +24,19 @@ function Editor(p: Props) {
const form = useForm({
client_key: crypto.randomUUID(),
version: p.record?.version ?? null,
title: p.record?.title ?? "",
offer: p.record?.offer ?? "",
seeking: p.record?.seeking ?? "",
organization_id: p.record?.organization_id ?? "",
sector_id: p.record?.sector_id?.toString() ?? "",
kind: p.record?.kind ?? "seeking",
partnership_type: p.record?.partnership_type ?? "",
deadline: p.record?.deadline ?? "",
title: p.record?.title ?? '',
offer: p.record?.offer ?? '',
seeking: p.record?.seeking ?? '',
organization_id: p.record?.organization_id ?? '',
sector_id: p.record?.sector_id?.toString() ?? '',
kind: p.record?.kind ?? 'seeking',
partnership_type: p.record?.partnership_type ?? '',
deadline: p.record?.deadline ?? '',
payload: {
summary: p.record?.payload.summary ?? "",
requirements: p.record?.payload.requirements ?? "",
summary: p.record?.payload.summary ?? '',
requirements: p.record?.payload.requirements ?? '',
mandatory: p.record?.payload.mandatory ?? ([] as string[]),
confidentiality: p.record?.payload.confidentiality ?? "public",
confidentiality: p.record?.payload.confidentiality ?? 'public',
consent: p.record?.payload.consent ?? false,
},
locations: p.locations.map((x) => ({
@@ -49,12 +49,12 @@ function Editor(p: Props) {
target_id: x.target_id,
})),
});
const [place, setPlace] = useState("");
const [role, setRole] = useState("primary");
const [source, setSource] = useState("Declaração do proponente");
const [origin, setOrigin] = useState("");
const [place, setPlace] = useState('');
const [role, setRole] = useState('primary');
const [source, setSource] = useState('Declaração do proponente');
const [origin, setOrigin] = useState('');
return (
<Frame title={p.record ? "Editar parceria" : "Preparar parceria"}>
<Frame title={p.record ? 'Editar parceria' : 'Preparar parceria'}>
<p className="mb-5">
Guarde uma ideia e retome-a no seu painel. Empresa constituída,
NUIT, documentos e verificação não são exigidos para preparar o
@@ -64,8 +64,8 @@ function Editor(p: Props) {
className="space-y-5"
onSubmit={(e) => {
e.preventDefault();
if (p.record) form.put("/parcerias/" + p.record.id);
else form.post("/parcerias/rascunhos");
if (p.record) form.put('/parcerias/' + p.record.id);
else form.post('/parcerias/rascunhos');
}}
>
<Errors errors={form.errors} />
@@ -73,7 +73,7 @@ function Editor(p: Props) {
<input
className={control}
value={form.data.title}
onChange={(e) => form.setData("title", e.target.value)}
onChange={(e) => form.setData('title', e.target.value)}
/>
</Field>
<div className="grid gap-5 md:grid-cols-2">
@@ -82,7 +82,7 @@ function Editor(p: Props) {
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="">
@@ -100,7 +100,7 @@ function Editor(p: Props) {
className={control}
value={form.data.kind}
onChange={(e) =>
form.setData("kind", e.target.value)
form.setData('kind', e.target.value)
}
>
<option value="seeking">Procura</option>
@@ -112,7 +112,7 @@ function Editor(p: Props) {
className={control}
value={form.data.partnership_type}
onChange={(e) =>
form.setData("partnership_type", e.target.value)
form.setData('partnership_type', e.target.value)
}
>
<option value="">Por definir</option>
@@ -128,7 +128,7 @@ function Editor(p: Props) {
className={control}
value={form.data.sector_id}
onChange={(e) =>
form.setData("sector_id", e.target.value)
form.setData('sector_id', e.target.value)
}
>
<option value="">Por definir</option>
@@ -145,7 +145,7 @@ function Editor(p: Props) {
className={control}
value={form.data.payload.summary}
onChange={(e) =>
form.setData("payload", {
form.setData('payload', {
...form.data.payload,
summary: e.target.value,
})
@@ -156,7 +156,7 @@ function Editor(p: Props) {
<textarea
className={control}
value={form.data.offer}
onChange={(e) => form.setData("offer", e.target.value)}
onChange={(e) => form.setData('offer', e.target.value)}
/>
</Field>
<Field label="O que procura">
@@ -164,7 +164,7 @@ function Editor(p: Props) {
className={control}
value={form.data.seeking}
onChange={(e) =>
form.setData("seeking", e.target.value)
form.setData('seeking', e.target.value)
}
/>
</Field>
@@ -173,7 +173,7 @@ function Editor(p: Props) {
className={control}
value={form.data.payload.requirements}
onChange={(e) =>
form.setData("payload", {
form.setData('payload', {
...form.data.payload,
requirements: e.target.value,
})
@@ -198,7 +198,7 @@ function Editor(p: Props) {
k,
)}
onChange={(e) =>
form.setData("payload", {
form.setData('payload', {
...form.data.payload,
mandatory: e.target.checked
? [
@@ -211,7 +211,7 @@ function Editor(p: Props) {
),
})
}
/>{" "}
/>{' '}
{v}
</label>
))}
@@ -223,7 +223,7 @@ function Editor(p: Props) {
className={control}
value={form.data.deadline}
onChange={(e) =>
form.setData("deadline", e.target.value)
form.setData('deadline', e.target.value)
}
/>
</Field>
@@ -232,7 +232,7 @@ function Editor(p: Props) {
className={control}
value={form.data.payload.confidentiality}
onChange={(e) =>
form.setData("payload", {
form.setData('payload', {
...form.data.payload,
confidentiality: e.target.value,
})
@@ -302,7 +302,7 @@ function Editor(p: Props) {
x.role === role,
)
)
form.setData("locations", [
form.setData('locations', [
...form.data.locations,
{
geo_location_id: place,
@@ -320,14 +320,14 @@ function Editor(p: Props) {
p.territories.find(
(t) => t.id === l.geo_location_id,
)?.name
}{" "}
· {l.role} · {l.source_reference}{" "}
}{' '}
· {l.role} · {l.source_reference}{' '}
<button
type="button"
className="underline"
onClick={() =>
form.setData(
"locations",
'locations',
form.data.locations.filter(
(_, j) => j !== i,
),
@@ -353,8 +353,8 @@ function Editor(p: Props) {
</option>
{p.sources?.map((x) => (
<option
key={x.type + ":" + x.target_id}
value={x.type + ":" + x.target_id}
key={x.type + ':' + x.target_id}
value={x.type + ':' + x.target_id}
>
{x.title}
</option>
@@ -366,7 +366,7 @@ function Editor(p: Props) {
className={button}
disabled={!origin}
onClick={() => {
const [type, target_id] = origin.split(":");
const [type, target_id] = origin.split(':');
if (
!form.data.origins.some(
(x) =>
@@ -374,7 +374,7 @@ function Editor(p: Props) {
x.target_id === target_id,
)
)
form.setData("origins", [
form.setData('origins', [
...form.data.origins,
{ type, target_id },
]);
@@ -388,13 +388,13 @@ function Editor(p: Props) {
(x) =>
x.type === o.type &&
x.target_id === o.target_id,
)?.title ?? "Origem documental ligada"}{" "}
)?.title ?? 'Origem documental ligada'}{' '}
<button
type="button"
className="underline"
onClick={() =>
form.setData(
"origins",
'origins',
form.data.origins.filter(
(_, j) => j !== i,
),
@@ -411,12 +411,12 @@ function Editor(p: Props) {
type="checkbox"
checked={form.data.payload.consent}
onChange={(e) =>
form.setData("payload", {
form.setData('payload', {
...form.data.payload,
consent: e.target.checked,
})
}
/>{" "}
/>{' '}
Autorizo submeter o conteúdo indicado para divulgação no
âmbito escolhido. Não confirma verificação ou certificação.
</label>
@@ -427,7 +427,7 @@ function Editor(p: Props) {
{p.record && (
<Link
className="underline"
href={"/parcerias/" + p.record.id}
href={'/parcerias/' + p.record.id}
>
Pré-visualizar e submeter
</Link>
@@ -440,7 +440,7 @@ function Editor(p: Props) {
export default function Page(p: Props) {
return (
<Editor
key={`${p.record?.id ?? "new"}:${p.record?.version ?? 0}`}
key={`${p.record?.id ?? 'new'}:${p.record?.version ?? 0}`}
{...p}
/>
);
@@ -1,6 +1,6 @@
import { useForm, Link } from "@inertiajs/react";
import { Management } from "../management/shared";
import { Errors, button, labels } from "./shared";
import { useForm, Link } from '@inertiajs/react';
import { Management } from '../management/shared';
import { Errors, button, labels } from './shared';
type Props = {
hash: string;
installed: boolean;
@@ -17,17 +17,17 @@ export default function Installation(p: Props) {
<Management title="Aplicação da Bolsa de Parcerias">
<div className="space-y-5">
<p>
Destino: {p.target.database}:{p.target.port}. Estado:{" "}
Destino: {p.target.database}:{p.target.port}. Estado:{' '}
{p.installed
? "Instalada"
: "Preparada para aplicação autenticada"}
? 'Instalada'
: 'Preparada para aplicação autenticada'}
.
</p>
<p>
Backup e restauro:{" "}
{p.backupVerified ? "Comprovados" : "Pendentes"} ·{" "}
{p.backupDate}. QA desta versão:{" "}
{p.qaVerified ? "Comprovada" : "Pendente"}.
Backup e restauro:{' '}
{p.backupVerified ? 'Comprovados' : 'Pendentes'} ·{' '}
{p.backupDate}. QA desta versão:{' '}
{p.qaVerified ? 'Comprovada' : 'Pendente'}.
</p>
<ul className="list-disc pl-5">
{p.changes.map((change) => (
@@ -39,7 +39,7 @@ export default function Installation(p: Props) {
</h2>
{p.records.map((record) => (
<p key={record.id}>
{record.id} · {record.title} · Autor {record.user_id} ·{" "}
{record.id} · {record.title} · Autor {record.user_id} ·{' '}
{labels[record.status] ?? record.status}
</p>
))}
@@ -47,7 +47,7 @@ export default function Installation(p: Props) {
<form
onSubmit={(e) => {
e.preventDefault();
form.post("/management/partnerships-install");
form.post('/management/partnerships-install');
}}
>
<Errors errors={form.errors} />
+65 -62
View File
@@ -1,4 +1,4 @@
import { useForm, usePage, Link, router } from "@inertiajs/react";
import { useForm, usePage, Link, router } from '@inertiajs/react';
import {
Frame,
Field,
@@ -7,7 +7,7 @@ import {
button,
labels,
type Partnership,
} from "./shared";
} from './shared';
type Room = {
id: number;
status: string;
@@ -52,11 +52,11 @@ type Props = {
};
function MilestoneForm({ p, item }: { p: Props; item?: Milestone }) {
const form = useForm({
title: item?.title ?? "",
title: item?.title ?? '',
responsible_id: item?.responsible_id ?? p.partnership.user_id,
due_date: item?.due_date ?? "",
status: item?.status ?? "pending",
evidence: item?.evidence ?? "",
due_date: item?.due_date ?? '',
status: item?.status ?? 'pending',
evidence: item?.evidence ?? '',
version: item?.version ?? null,
});
return (
@@ -76,13 +76,13 @@ function MilestoneForm({ p, item }: { p: Props; item?: Milestone }) {
}}
>
<h3 className="font-bold">
{item ? "Atualizar marco" : "Acrescentar marco"}
{item ? 'Atualizar marco' : 'Acrescentar marco'}
</h3>
<Field label="Entregável">
<input
className={control}
value={form.data.title}
onChange={(e) => form.setData("title", e.target.value)}
onChange={(e) => form.setData('title', e.target.value)}
/>
</Field>
<Field label="Responsável">
@@ -90,7 +90,7 @@ function MilestoneForm({ p, item }: { p: Props; item?: Milestone }) {
className={control}
value={form.data.responsible_id}
onChange={(e) =>
form.setData("responsible_id", Number(e.target.value))
form.setData('responsible_id', Number(e.target.value))
}
>
<option value={p.partnership.user_id}>Proponente</option>
@@ -102,18 +102,18 @@ function MilestoneForm({ p, item }: { p: Props; item?: Milestone }) {
className={control}
type="date"
value={form.data.due_date}
onChange={(e) => form.setData("due_date", e.target.value)}
onChange={(e) => form.setData('due_date', e.target.value)}
/>
</Field>
<Field label="Estado">
<select
className={control}
value={form.data.status}
onChange={(e) => form.setData("status", e.target.value)}
onChange={(e) => form.setData('status', e.target.value)}
>
{["pending", "progress", "completed"].map((x) => (
{['pending', 'progress', 'completed'].map((x) => (
<option key={x} value={x}>
{x === "pending" ? "Pendente" : labels[x]}
{x === 'pending' ? 'Pendente' : labels[x]}
</option>
))}
</select>
@@ -122,7 +122,7 @@ function MilestoneForm({ p, item }: { p: Props; item?: Milestone }) {
<textarea
className={control}
value={form.data.evidence}
onChange={(e) => form.setData("evidence", e.target.value)}
onChange={(e) => form.setData('evidence', e.target.value)}
/>
</Field>
<Errors errors={form.errors} />
@@ -133,17 +133,17 @@ function MilestoneForm({ p, item }: { p: Props; item?: Milestone }) {
);
}
export default function Page(p: Props) {
return <RoomPage key={p.room.id + ":" + p.room.version} {...p} />;
return <RoomPage key={p.room.id + ':' + p.room.version} {...p} />;
}
function RoomPage(p: Props) {
const { auth } = usePage<{ auth: { user: { id: number } } }>().props;
const message = useForm({ body: "", client_key: crypto.randomUUID() });
const message = useForm({ body: '', client_key: crypto.randomUUID() });
const agreement = useForm({
version: p.room.version,
action: "record",
title: p.room.agreement?.title ?? "",
terms: p.room.agreement?.terms ?? "",
reason: "",
action: 'record',
title: p.room.agreement?.title ?? '',
terms: p.room.agreement?.terms ?? '',
reason: '',
});
const upload = useForm<{ file: File | null; shared: boolean }>({
file: null,
@@ -156,13 +156,13 @@ function RoomPage(p: Props) {
});
};
const mutable =
p.canWrite && !["closed", "cancelled"].includes(p.room.status);
p.canWrite && !['closed', 'cancelled'].includes(p.room.status);
return (
<Frame title={"Conexão privada — " + p.partnership.title}>
<Frame title={'Conexão privada — ' + p.partnership.title}>
<div className="space-y-6">
<Link
className="underline"
href={"/parcerias/" + p.partnership.id}
href={'/parcerias/' + p.partnership.id}
>
Regressar à parceria
</Link>
@@ -176,7 +176,7 @@ function RoomPage(p: Props) {
Mensagens e esclarecimentos
</h2>
{p.messages.map((m) => (
<article className="rounded bg-muted p-4" key={m.id}>
<article className="bg-muted rounded p-4" key={m.id}>
<p className="font-semibold">
{m.name} · {m.created_at}
</p>
@@ -194,7 +194,7 @@ function RoomPage(p: Props) {
preserveScroll: true,
onSuccess: () => {
message.setData({
body: "",
body: '',
client_key: crypto.randomUUID(),
});
},
@@ -207,7 +207,7 @@ function RoomPage(p: Props) {
className={control}
value={message.data.body}
onChange={(e) =>
message.setData("body", e.target.value)
message.setData('body', e.target.value)
}
/>
</Field>
@@ -234,10 +234,10 @@ function RoomPage(p: Props) {
{p.documents.map((d) => (
<article key={d.id}>
<p>
{d.file_name} ·{" "}
{d.file_name} ·{' '}
{d.shared
? "Partilhado com a contraparte"
: "Privado do autor"}{" "}
? 'Partilhado com a contraparte'
: 'Privado do autor'}{' '}
· Análise: {d.malware_scan_status}
</p>
{mutable && d.owner_id === auth.user.id && (
@@ -252,12 +252,12 @@ function RoomPage(p: Props) {
}
>
{d.shared
? "Retirar autorização de partilha"
: "Autorizar partilha com a contraparte"}
? 'Retirar autorização de partilha'
: 'Autorizar partilha com a contraparte'}
</button>
)}
{d.status === "active" &&
d.malware_scan_status === "clean" && (
{d.status === 'active' &&
d.malware_scan_status === 'clean' && (
<a
className="underline"
href={`/parcerias/salas/${p.room.id}/documentos/${d.id}`}
@@ -284,11 +284,11 @@ function RoomPage(p: Props) {
<Field label="Anexar PDF ou imagem">
<input
type="file"
className="w-full min-w-0 max-w-full"
className="w-full max-w-full min-w-0"
accept=".pdf,.jpg,.jpeg,.png"
onChange={(e) =>
upload.setData(
"file",
'file',
e.target.files?.[0] ?? null,
)
}
@@ -300,11 +300,11 @@ function RoomPage(p: Props) {
checked={upload.data.shared}
onChange={(e) =>
upload.setData(
"shared",
'shared',
e.target.checked,
)
}
/>{" "}
/>{' '}
Autorizo a consulta pela contraparte desta sala.
</label>
<Errors errors={upload.errors} />
@@ -339,13 +339,13 @@ function RoomPage(p: Props) {
{p.room.agreement.terms}
</p>
<p>
Confirmações:{" "}
Confirmações:{' '}
{Object.entries(p.room.agreement.confirmations)
.map(
([party, c]) =>
`${party}: autor ${c.actor_id}, ${c.date}`,
)
.join("; ") || "Pendentes"}
.join('; ') || 'Pendentes'}
</p>
</>
)}
@@ -357,13 +357,13 @@ function RoomPage(p: Props) {
value={agreement.data.reason}
onChange={(e) =>
agreement.setData(
"reason",
'reason',
e.target.value,
)
}
/>
</Field>
{["negotiation", "agreement_recorded"].includes(
{['negotiation', 'agreement_recorded'].includes(
p.room.status,
) && (
<>
@@ -373,7 +373,7 @@ function RoomPage(p: Props) {
value={agreement.data.title}
onChange={(e) =>
agreement.setData(
"title",
'title',
e.target.value,
)
}
@@ -386,7 +386,7 @@ function RoomPage(p: Props) {
value={agreement.data.terms}
onChange={(e) =>
agreement.setData(
"terms",
'terms',
e.target.value,
)
}
@@ -398,50 +398,50 @@ function RoomPage(p: Props) {
agreement.processing ||
!agreement.data.reason
}
onClick={() => act("record")}
onClick={() => act('record')}
>
Registar versão do acordo
</button>
</>
)}
<div className="flex flex-wrap gap-3">
{p.room.status === "agreement_recorded" && (
{p.room.status === 'agreement_recorded' && (
<button
className={button}
disabled={
agreement.processing ||
!agreement.data.reason
}
onClick={() => act("confirm")}
onClick={() => act('confirm')}
>
Confirmar pela minha parte
</button>
)}
{p.room.status === "agreed" && (
{p.room.status === 'agreed' && (
<button
className={button}
disabled={
agreement.processing ||
!agreement.data.reason
}
onClick={() => act("start")}
onClick={() => act('start')}
>
Iniciar acompanhamento
</button>
)}
{p.room.status === "execution" && (
{p.room.status === 'execution' && (
<button
className={button}
disabled={
agreement.processing ||
!agreement.data.reason
}
onClick={() => act("complete")}
onClick={() => act('complete')}
>
Concluir após os marcos
</button>
)}
{["agreed", "execution"].includes(
{['agreed', 'execution'].includes(
p.room.status,
) && (
<button
@@ -450,7 +450,7 @@ function RoomPage(p: Props) {
agreement.processing ||
!agreement.data.reason
}
onClick={() => act("renew")}
onClick={() => act('renew')}
>
Registar renovação
</button>
@@ -461,7 +461,7 @@ function RoomPage(p: Props) {
agreement.processing ||
!agreement.data.reason
}
onClick={() => act("cancel")}
onClick={() => act('cancel')}
>
Cancelar conexão com motivo
</button>
@@ -473,29 +473,32 @@ function RoomPage(p: Props) {
<section className="space-y-4">
<h2 className="text-xl font-bold">Marcos e responsáveis</h2>
<p>
Participação atual:{" "}
Participação atual:{' '}
{auth.user.id === p.partnership.user_id
? "Proponente"
? 'Proponente'
: auth.user.id === p.interest.user_id
? "Candidato"
: "Representante autorizado"}
? 'Candidato'
: 'Representante autorizado'}
.
</p>
{p.milestones.map((m) => (
<article
key={m.id + ":" + m.version}
key={m.id + ':' + m.version}
className="space-y-3"
>
<p>
{m.title} · {m.status === "pending" ? "Pendente" : labels[m.status]} · Prazo:{" "}
{m.due_date ?? "Pendente"} · Responsável ID{" "}
{m.responsible_id}
{m.title} ·{' '}
{m.status === 'pending'
? 'Pendente'
: labels[m.status]}{' '}
· Prazo: {m.due_date ?? 'Pendente'} ·
Responsável ID {m.responsible_id}
</p>
{mutable && <MilestoneForm p={p} item={m} />}
</article>
))}
{mutable &&
["agreement_recorded", "agreed", "execution"].includes(
['agreement_recorded', 'agreed', 'execution'].includes(
p.room.status,
) && <MilestoneForm p={p} />}
</section>
+29 -29
View File
@@ -1,6 +1,6 @@
import { Link } from "@inertiajs/react";
import { cloneElement, isValidElement, useId, type ReactNode } from "react";
import { Layout } from "../portfolio/shared";
import { Link } from '@inertiajs/react';
import { cloneElement, isValidElement, useId, type ReactNode } from 'react';
import { Layout } from '../portfolio/shared';
export type Option = { id: string | number; name: string };
export type Territory = {
@@ -79,32 +79,32 @@ export type Interest = {
room_id: number | null;
};
export const labels: Record<string, string> = {
draft: "Rascunho",
pending: "Submetida — legado",
submitted: "Submetida",
returned: "Devolvida",
rejected: "Rejeitada",
published: "Publicada",
suspended: "Suspensa",
archived: "Arquivada",
withdrawn: "Retirada",
clarification: "Em esclarecimento",
shortlisted: "Lista curta",
negotiation: "Em negociação",
agreement_recorded: "Acordo registado",
agreed: "Confirmado pelas partes",
execution: "Em execução",
closed: "Concluída",
cancelled: "Cancelada",
progress: "Em curso",
completed: "Concluído",
met: "Comprovadamente cumprido",
unmet: "Comprovadamente incumprido",
unknown: "Informação insuficiente",
draft: 'Rascunho',
pending: 'Submetida — legado',
submitted: 'Submetida',
returned: 'Devolvida',
rejected: 'Rejeitada',
published: 'Publicada',
suspended: 'Suspensa',
archived: 'Arquivada',
withdrawn: 'Retirada',
clarification: 'Em esclarecimento',
shortlisted: 'Lista curta',
negotiation: 'Em negociação',
agreement_recorded: 'Acordo registado',
agreed: 'Confirmado pelas partes',
execution: 'Em execução',
closed: 'Concluída',
cancelled: 'Cancelada',
progress: 'Em curso',
completed: 'Concluído',
met: 'Comprovadamente cumprido',
unmet: 'Comprovadamente incumprido',
unknown: 'Informação insuficiente',
};
export const control = "w-full rounded border bg-background p-2";
export const control = 'w-full rounded border bg-background p-2';
export const button =
"inline-flex rounded bg-emerald-800 px-4 py-2 text-white disabled:opacity-50";
'inline-flex rounded bg-emerald-800 px-4 py-2 text-white disabled:opacity-50';
export function Frame({
title,
children,
@@ -151,8 +151,8 @@ export function Field({
<span id={id} className="font-medium">
{label}
</span>
{isValidElement<{ "aria-labelledby"?: string }>(children)
? cloneElement(children, { "aria-labelledby": id })
{isValidElement<{ 'aria-labelledby'?: string }>(children)
? cloneElement(children, { 'aria-labelledby': id })
: children}
</label>
);