+284
-141
@@ -1,8 +1,8 @@
|
||||
import { Link, router, useForm } from "@inertiajs/react";
|
||||
import { useState } from "react";
|
||||
import { Management, Field, control, button } from "../management/shared";
|
||||
import { capabilities, purposes, states } from "./labels";
|
||||
import { ProvinceSelect } from "@/components/investment-territory";
|
||||
import { Link, router, useForm } from '@inertiajs/react';
|
||||
import { useState } from 'react';
|
||||
import { Management, Field, control, button } from '../management/shared';
|
||||
import { capabilities, purposes, states } from './labels';
|
||||
import { ProvinceSelect } from '@/components/investment-territory';
|
||||
|
||||
type Source = {
|
||||
id: string;
|
||||
@@ -25,49 +25,61 @@ type Props = {
|
||||
}[];
|
||||
today: string;
|
||||
};
|
||||
export default function Index({ controls, sources, documents, runs, today }: Props) {
|
||||
const [language, setLanguage] = useState<"pt" | "en">("pt");
|
||||
const t = (pt: string, en: string) => (language === "pt" ? pt : en);
|
||||
export default function Index({
|
||||
controls,
|
||||
sources,
|
||||
documents,
|
||||
runs,
|
||||
today,
|
||||
}: Props) {
|
||||
const [language, setLanguage] = useState<'pt' | 'en'>('pt');
|
||||
const t = (pt: string, en: string) => (language === 'pt' ? pt : en);
|
||||
const query = useForm({
|
||||
capability: "assistant",
|
||||
language: "pt",
|
||||
purpose: "investment_information",
|
||||
query: "",
|
||||
source_id: "",
|
||||
interest_id: "",
|
||||
province: "",
|
||||
maturity_level: "",
|
||||
capability: 'assistant',
|
||||
language: 'pt',
|
||||
purpose: 'investment_information',
|
||||
query: '',
|
||||
source_id: '',
|
||||
interest_id: '',
|
||||
province: '',
|
||||
maturity_level: '',
|
||||
});
|
||||
const upload = useForm<{ file: File | null; authorised: boolean }>({
|
||||
file: null,
|
||||
authorised: false,
|
||||
});
|
||||
const source = useForm({
|
||||
document_id: "",
|
||||
title: "",
|
||||
language: "pt",
|
||||
nature: "pending",
|
||||
source_url: "",
|
||||
source_owner: "",
|
||||
evidence_reference: "",
|
||||
document_id: '',
|
||||
title: '',
|
||||
language: 'pt',
|
||||
nature: 'pending',
|
||||
source_url: '',
|
||||
source_owner: '',
|
||||
evidence_reference: '',
|
||||
source_date: today,
|
||||
valid_until: "",
|
||||
valid_until: '',
|
||||
authorised: false,
|
||||
});
|
||||
const [actionError, setActionError] = useState("");
|
||||
const [actionError, setActionError] = useState('');
|
||||
const post = (url: string, data: Record<string, string | boolean>) => {
|
||||
setActionError("");
|
||||
setActionError('');
|
||||
router.post(url, data, {
|
||||
onError: (errors) => setActionError(Object.values(errors).join(" ")),
|
||||
onError: (errors) =>
|
||||
setActionError(Object.values(errors).join(' ')),
|
||||
});
|
||||
};
|
||||
return (
|
||||
<Management title={t("Assistência, fontes e revisão", "Assistance, sources and review")}>
|
||||
<Management
|
||||
title={t(
|
||||
'Assistência, fontes e revisão',
|
||||
'Assistance, sources and review',
|
||||
)}
|
||||
>
|
||||
<Field label="Idioma / Language">
|
||||
<select
|
||||
className={control}
|
||||
value={language}
|
||||
onChange={(e) => setLanguage(e.target.value as "pt" | "en")}
|
||||
onChange={(e) => setLanguage(e.target.value as 'pt' | 'en')}
|
||||
>
|
||||
<option value="pt">Português</option>
|
||||
<option value="en">English</option>
|
||||
@@ -75,8 +87,8 @@ export default function Index({ controls, sources, documents, runs, today }: Pro
|
||||
</Field>
|
||||
<p className="rounded border p-4">
|
||||
{t(
|
||||
"Ferramentas assistivas com fontes e regras. Não há modelo generativo activo. Os resultados não são decisões oficiais nem garantias de retorno ou aprovação.",
|
||||
"Assistive tools using sources and rules. No generative model is active. Results are not official decisions or guarantees of return or approval.",
|
||||
'Ferramentas assistivas com fontes e regras. Não há modelo generativo activo. Os resultados não são decisões oficiais nem garantias de retorno ou aprovação.',
|
||||
'Assistive tools using sources and rules. No generative model is active. Results are not official decisions or guarantees of return or approval.',
|
||||
)}
|
||||
</p>
|
||||
<form
|
||||
@@ -86,50 +98,78 @@ export default function Index({ controls, sources, documents, runs, today }: Pro
|
||||
query.transform((data) => ({
|
||||
...data,
|
||||
language,
|
||||
purpose: purposes[data.capability] ?? "investment_information",
|
||||
purpose:
|
||||
purposes[data.capability] ??
|
||||
'investment_information',
|
||||
}));
|
||||
query.post("/management/ai/runs");
|
||||
query.post('/management/ai/runs');
|
||||
}}
|
||||
>
|
||||
<Field label={t("Capacidade", "Capability")}>
|
||||
<Field label={t('Capacidade', 'Capability')}>
|
||||
<select
|
||||
className={control}
|
||||
value={query.data.capability}
|
||||
onChange={(e) => query.setData("capability", e.target.value)}
|
||||
onChange={(e) =>
|
||||
query.setData('capability', e.target.value)
|
||||
}
|
||||
>
|
||||
{controls.map((c) => (
|
||||
<option key={c.capability} value={c.capability} disabled={c.suspended}>
|
||||
{capabilities[c.capability]?.[language === "pt" ? 0 : 1]}
|
||||
{c.suspended ? t(" (suspensa)", " (suspended)") : ""}
|
||||
<option
|
||||
key={c.capability}
|
||||
value={c.capability}
|
||||
disabled={c.suspended}
|
||||
>
|
||||
{
|
||||
capabilities[c.capability]?.[
|
||||
language === 'pt' ? 0 : 1
|
||||
]
|
||||
}
|
||||
{c.suspended
|
||||
? t(' (suspensa)', ' (suspended)')
|
||||
: ''}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</Field>
|
||||
{["assistant", "search"].includes(query.data.capability) && (
|
||||
<Field label={t("Pergunta ou termos de pesquisa", "Question or search terms")}>
|
||||
{['assistant', 'search'].includes(query.data.capability) && (
|
||||
<Field
|
||||
label={t(
|
||||
'Pergunta ou termos de pesquisa',
|
||||
'Question or search terms',
|
||||
)}
|
||||
>
|
||||
<textarea
|
||||
required
|
||||
maxLength={1000}
|
||||
minLength={3}
|
||||
className={control}
|
||||
value={query.data.query}
|
||||
onChange={(e) => query.setData("query", e.target.value)}
|
||||
onChange={(e) =>
|
||||
query.setData('query', e.target.value)
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
)}
|
||||
{["assistant", "search", "summary"].includes(query.data.capability) && (
|
||||
<Field label={t("Fonte autorizada", "Authorised source")}>
|
||||
{['assistant', 'search', 'summary'].includes(
|
||||
query.data.capability,
|
||||
) && (
|
||||
<Field label={t('Fonte autorizada', 'Authorised source')}>
|
||||
<select
|
||||
required={query.data.capability === "summary"}
|
||||
required={query.data.capability === 'summary'}
|
||||
className={control}
|
||||
value={query.data.source_id}
|
||||
onChange={(e) => query.setData("source_id", e.target.value)}
|
||||
onChange={(e) =>
|
||||
query.setData('source_id', e.target.value)
|
||||
}
|
||||
>
|
||||
<option value="">
|
||||
{t("Todas as fontes elegíveis", "All eligible sources")}
|
||||
{t(
|
||||
'Todas as fontes elegíveis',
|
||||
'All eligible sources',
|
||||
)}
|
||||
</option>
|
||||
{sources
|
||||
.filter((s) => s.status === "approved")
|
||||
.filter((s) => s.status === 'approved')
|
||||
.map((s) => (
|
||||
<option key={s.id} value={s.id}>
|
||||
{s.title}
|
||||
@@ -138,11 +178,11 @@ export default function Index({ controls, sources, documents, runs, today }: Pro
|
||||
</select>
|
||||
</Field>
|
||||
)}
|
||||
{query.data.capability === "classify" && (
|
||||
{query.data.capability === 'classify' && (
|
||||
<Field
|
||||
label={t(
|
||||
"Número interno do pedido (requer consentimento específico)",
|
||||
"Internal request number (specific consent required)",
|
||||
'Número interno do pedido (requer consentimento específico)',
|
||||
'Internal request number (specific consent required)',
|
||||
)}
|
||||
>
|
||||
<input
|
||||
@@ -151,28 +191,55 @@ export default function Index({ controls, sources, documents, runs, today }: Pro
|
||||
min={1}
|
||||
className={control}
|
||||
value={query.data.interest_id}
|
||||
onChange={(e) => query.setData("interest_id", e.target.value)}
|
||||
onChange={(e) =>
|
||||
query.setData('interest_id', e.target.value)
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
)}
|
||||
{query.data.capability === "recommend" && (
|
||||
{query.data.capability === 'recommend' && (
|
||||
<>
|
||||
<Field label={t("Província declarada", "Declared province")}>
|
||||
<Field
|
||||
label={t(
|
||||
'Província declarada',
|
||||
'Declared province',
|
||||
)}
|
||||
>
|
||||
<ProvinceSelect
|
||||
value={query.data.province}
|
||||
onChange={(province) => query.setData("province", province)}
|
||||
onChange={(province) =>
|
||||
query.setData('province', province)
|
||||
}
|
||||
className={control}
|
||||
placeholder={t("Seleccione uma província", "Select a province")}
|
||||
label={t("Província declarada", "Declared province")}
|
||||
placeholder={t(
|
||||
'Seleccione uma província',
|
||||
'Select a province',
|
||||
)}
|
||||
label={t(
|
||||
'Província declarada',
|
||||
'Declared province',
|
||||
)}
|
||||
/>
|
||||
</Field>
|
||||
<Field label={t("Maturidade pretendida", "Desired maturity")}>
|
||||
<Field
|
||||
label={t(
|
||||
'Maturidade pretendida',
|
||||
'Desired maturity',
|
||||
)}
|
||||
>
|
||||
<select
|
||||
className={control}
|
||||
value={query.data.maturity_level}
|
||||
onChange={(e) => query.setData("maturity_level", e.target.value)}
|
||||
onChange={(e) =>
|
||||
query.setData(
|
||||
'maturity_level',
|
||||
e.target.value,
|
||||
)
|
||||
}
|
||||
>
|
||||
<option value="">{t("Não indicada", "Not specified")}</option>
|
||||
<option value="">
|
||||
{t('Não indicada', 'Not specified')}
|
||||
</option>
|
||||
{[1, 2, 3, 4, 5, 6].map((n) => (
|
||||
<option key={n}>{n}</option>
|
||||
))}
|
||||
@@ -189,17 +256,19 @@ export default function Index({ controls, sources, documents, runs, today }: Pro
|
||||
<button
|
||||
disabled={
|
||||
query.processing ||
|
||||
controls.find((c) => c.capability === query.data.capability)?.suspended
|
||||
controls.find(
|
||||
(c) => c.capability === query.data.capability,
|
||||
)?.suspended
|
||||
}
|
||||
className={button}
|
||||
>
|
||||
{t("Consultar", "Run assistance")}
|
||||
{t('Consultar', 'Run assistance')}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
<section className="space-y-3">
|
||||
<h2 className="text-xl font-semibold">
|
||||
{t("Suspensão imediata", "Immediate suspension")}
|
||||
{t('Suspensão imediata', 'Immediate suspension')}
|
||||
</h2>
|
||||
{actionError && <p role="alert">{actionError}</p>}
|
||||
<div className="flex flex-wrap gap-3">
|
||||
@@ -208,75 +277,112 @@ export default function Index({ controls, sources, documents, runs, today }: Pro
|
||||
className={button}
|
||||
key={c.capability}
|
||||
onClick={() =>
|
||||
post(`/management/ai/controls/${c.capability}`, {
|
||||
suspended: !c.suspended,
|
||||
})
|
||||
post(
|
||||
`/management/ai/controls/${c.capability}`,
|
||||
{
|
||||
suspended: !c.suspended,
|
||||
},
|
||||
)
|
||||
}
|
||||
>
|
||||
{t(
|
||||
c.suspended ? "Retomar" : "Suspender",
|
||||
c.suspended ? "Resume" : "Suspend",
|
||||
)}{" "}
|
||||
· {capabilities[c.capability]?.[language === "pt" ? 0 : 1]}
|
||||
c.suspended ? 'Retomar' : 'Suspender',
|
||||
c.suspended ? 'Resume' : 'Suspend',
|
||||
)}{' '}
|
||||
·{' '}
|
||||
{
|
||||
capabilities[c.capability]?.[
|
||||
language === 'pt' ? 0 : 1
|
||||
]
|
||||
}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
<section className="space-y-3">
|
||||
<h2 className="text-xl font-semibold">
|
||||
{t("Resultados recentes e revisão humana", "Recent results and human review")}
|
||||
{t(
|
||||
'Resultados recentes e revisão humana',
|
||||
'Recent results and human review',
|
||||
)}
|
||||
</h2>
|
||||
{runs.length === 0 && <p>{t("Ainda sem consultas.", "No runs yet.")}</p>}
|
||||
{runs.length === 0 && (
|
||||
<p>{t('Ainda sem consultas.', 'No runs yet.')}</p>
|
||||
)}
|
||||
{runs.map((r) => (
|
||||
<p key={r.id}>
|
||||
<Link className="underline" href={`/management/ai/runs/${r.id}`}>
|
||||
{capabilities[r.capability]?.[language === "pt" ? 0 : 1]} ·{" "}
|
||||
{r.created_at}
|
||||
</Link>{" "}
|
||||
— {language === "pt" ? states[r.review_status] : r.review_status}
|
||||
{r.review_requested && t(" · revisão solicitada", " · review requested")}
|
||||
<Link
|
||||
className="underline"
|
||||
href={`/management/ai/runs/${r.id}`}
|
||||
>
|
||||
{
|
||||
capabilities[r.capability]?.[
|
||||
language === 'pt' ? 0 : 1
|
||||
]
|
||||
}{' '}
|
||||
· {r.created_at}
|
||||
</Link>{' '}
|
||||
—{' '}
|
||||
{language === 'pt'
|
||||
? states[r.review_status]
|
||||
: r.review_status}
|
||||
{r.review_requested &&
|
||||
t(' · revisão solicitada', ' · review requested')}
|
||||
</p>
|
||||
))}
|
||||
</section>
|
||||
<section className="space-y-3">
|
||||
<h2 className="text-xl font-semibold">
|
||||
{t("Fontes documentais", "Document sources")}
|
||||
{t('Fontes documentais', 'Document sources')}
|
||||
</h2>
|
||||
<p>
|
||||
{t(
|
||||
"Apenas ficheiros de texto UTF-8 do cadastro documental privado, activos e não confidenciais. A autorização de uso deve ser confirmada por outra pessoa.",
|
||||
"Only active, non-confidential UTF-8 text files from the private document registry. Another person must confirm permission to use the source.",
|
||||
'Apenas ficheiros de texto UTF-8 do cadastro documental privado, activos e não confidenciais. A autorização de uso deve ser confirmada por outra pessoa.',
|
||||
'Only active, non-confidential UTF-8 text files from the private document registry. Another person must confirm permission to use the source.',
|
||||
)}
|
||||
</p>
|
||||
{sources.map((s) => (
|
||||
<article className="space-y-2 rounded border p-3" key={s.id}>
|
||||
<article
|
||||
className="space-y-2 rounded border p-3"
|
||||
key={s.id}
|
||||
>
|
||||
<p>
|
||||
{s.title} · {s.language.toUpperCase()} ·{" "}
|
||||
{language === "pt" ? states[s.status] : s.status} · {s.valid_until}
|
||||
{s.title} · {s.language.toUpperCase()} ·{' '}
|
||||
{language === 'pt' ? states[s.status] : s.status} ·{' '}
|
||||
{s.valid_until}
|
||||
</p>
|
||||
<p>{language === "pt" ? states[s.nature] : s.nature}</p>
|
||||
<p>{language === 'pt' ? states[s.nature] : s.nature}</p>
|
||||
<div className="flex gap-3">
|
||||
<button
|
||||
className={button}
|
||||
onClick={() =>
|
||||
post(`/management/ai/sources/${s.id}/review`, {
|
||||
status: "approved",
|
||||
expected_status: s.status,
|
||||
})
|
||||
post(
|
||||
`/management/ai/sources/${s.id}/review`,
|
||||
{
|
||||
status: 'approved',
|
||||
expected_status: s.status,
|
||||
},
|
||||
)
|
||||
}
|
||||
>
|
||||
{t("Confirmar autorização", "Confirm authorisation")}
|
||||
{t(
|
||||
'Confirmar autorização',
|
||||
'Confirm authorisation',
|
||||
)}
|
||||
</button>
|
||||
<button
|
||||
className={button}
|
||||
onClick={() =>
|
||||
post(`/management/ai/sources/${s.id}/review`, {
|
||||
status: "revoked",
|
||||
expected_status: s.status,
|
||||
})
|
||||
post(
|
||||
`/management/ai/sources/${s.id}/review`,
|
||||
{
|
||||
status: 'revoked',
|
||||
expected_status: s.status,
|
||||
},
|
||||
)
|
||||
}
|
||||
>
|
||||
{t("Revogar", "Revoke")}
|
||||
{t('Revogar', 'Revoke')}
|
||||
</button>
|
||||
</div>
|
||||
</article>
|
||||
@@ -285,15 +391,15 @@ export default function Index({ controls, sources, documents, runs, today }: Pro
|
||||
<details className="rounded border p-4">
|
||||
<summary>
|
||||
{t(
|
||||
"Adicionar documento de texto autorizado",
|
||||
"Add an authorised text document",
|
||||
'Adicionar documento de texto autorizado',
|
||||
'Add an authorised text document',
|
||||
)}
|
||||
</summary>
|
||||
<form
|
||||
className="mt-4 space-y-3"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
upload.post("/management/ai/documents", {
|
||||
upload.post('/management/ai/documents', {
|
||||
forceFormData: true,
|
||||
onSuccess: () => upload.reset(),
|
||||
});
|
||||
@@ -301,8 +407,8 @@ export default function Index({ controls, sources, documents, runs, today }: Pro
|
||||
>
|
||||
<Field
|
||||
label={t(
|
||||
"Ficheiro .txt UTF-8 (até 195 KiB)",
|
||||
"UTF-8 .txt file (up to 195 KiB)",
|
||||
'Ficheiro .txt UTF-8 (até 195 KiB)',
|
||||
'UTF-8 .txt file (up to 195 KiB)',
|
||||
)}
|
||||
>
|
||||
<input
|
||||
@@ -310,7 +416,12 @@ export default function Index({ controls, sources, documents, runs, today }: Pro
|
||||
type="file"
|
||||
accept=".txt,text/plain"
|
||||
className={control}
|
||||
onChange={(e) => upload.setData("file", e.target.files?.[0] ?? null)}
|
||||
onChange={(e) =>
|
||||
upload.setData(
|
||||
'file',
|
||||
e.target.files?.[0] ?? null,
|
||||
)
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
<label className="flex gap-2">
|
||||
@@ -318,11 +429,13 @@ export default function Index({ controls, sources, documents, runs, today }: Pro
|
||||
required
|
||||
type="checkbox"
|
||||
checked={upload.data.authorised}
|
||||
onChange={(e) => upload.setData("authorised", e.target.checked)}
|
||||
onChange={(e) =>
|
||||
upload.setData('authorised', e.target.checked)
|
||||
}
|
||||
/>
|
||||
{t(
|
||||
"Tenho autorização e confirmei a ausência de dados confidenciais ou pessoais desnecessários.",
|
||||
"I am authorised and have confirmed there is no confidential or unnecessary personal data.",
|
||||
'Tenho autorização e confirmei a ausência de dados confidenciais ou pessoais desnecessários.',
|
||||
'I am authorised and have confirmed there is no confidential or unnecessary personal data.',
|
||||
)}
|
||||
</label>
|
||||
{Object.entries(upload.errors).map(([key, value]) => (
|
||||
@@ -331,32 +444,38 @@ export default function Index({ controls, sources, documents, runs, today }: Pro
|
||||
</p>
|
||||
))}
|
||||
<button className={button} disabled={upload.processing}>
|
||||
{t("Guardar documento", "Save document")}
|
||||
{t('Guardar documento', 'Save document')}
|
||||
</button>
|
||||
</form>
|
||||
</details>
|
||||
<details className="rounded border p-4">
|
||||
<summary>
|
||||
{t(
|
||||
"Registar fonte existente para revisão",
|
||||
"Register an existing source for review",
|
||||
'Registar fonte existente para revisão',
|
||||
'Register an existing source for review',
|
||||
)}
|
||||
</summary>
|
||||
<form
|
||||
className="mt-4 grid gap-4 md:grid-cols-2"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
source.post("/management/ai/sources", { onSuccess: () => source.reset() });
|
||||
source.post('/management/ai/sources', {
|
||||
onSuccess: () => source.reset(),
|
||||
});
|
||||
}}
|
||||
>
|
||||
<Field label={t("Documento", "Document")}>
|
||||
<Field label={t('Documento', 'Document')}>
|
||||
<select
|
||||
required
|
||||
className={control}
|
||||
value={source.data.document_id}
|
||||
onChange={(e) => source.setData("document_id", e.target.value)}
|
||||
onChange={(e) =>
|
||||
source.setData('document_id', e.target.value)
|
||||
}
|
||||
>
|
||||
<option value="">{t("Seleccionar", "Select")}</option>
|
||||
<option value="">
|
||||
{t('Seleccionar', 'Select')}
|
||||
</option>
|
||||
{documents.map((d) => (
|
||||
<option key={d.id} value={d.id}>
|
||||
{d.file_name}
|
||||
@@ -366,64 +485,84 @@ export default function Index({ controls, sources, documents, runs, today }: Pro
|
||||
</Field>
|
||||
{(
|
||||
[
|
||||
"title",
|
||||
"source_url",
|
||||
"source_owner",
|
||||
"evidence_reference",
|
||||
"source_date",
|
||||
"valid_until",
|
||||
'title',
|
||||
'source_url',
|
||||
'source_owner',
|
||||
'evidence_reference',
|
||||
'source_date',
|
||||
'valid_until',
|
||||
] as const
|
||||
).map((key) => (
|
||||
<Field
|
||||
key={key}
|
||||
label={
|
||||
{
|
||||
title: t("Título", "Title"),
|
||||
source_url: t("Fonte HTTPS", "HTTPS source"),
|
||||
source_owner: t("Entidade proprietária", "Source owner"),
|
||||
evidence_reference: t(
|
||||
"Referência da evidência e autorização",
|
||||
"Evidence and authorisation reference",
|
||||
title: t('Título', 'Title'),
|
||||
source_url: t(
|
||||
'Fonte HTTPS',
|
||||
'HTTPS source',
|
||||
),
|
||||
source_date: t("Data da fonte", "Source date"),
|
||||
valid_until: t("Válida até", "Valid until"),
|
||||
source_owner: t(
|
||||
'Entidade proprietária',
|
||||
'Source owner',
|
||||
),
|
||||
evidence_reference: t(
|
||||
'Referência da evidência e autorização',
|
||||
'Evidence and authorisation reference',
|
||||
),
|
||||
source_date: t(
|
||||
'Data da fonte',
|
||||
'Source date',
|
||||
),
|
||||
valid_until: t('Válida até', 'Valid until'),
|
||||
}[key]
|
||||
}
|
||||
>
|
||||
<input
|
||||
required
|
||||
type={
|
||||
["source_date", "valid_until"].includes(key)
|
||||
? "date"
|
||||
: key === "source_url"
|
||||
? "url"
|
||||
: "text"
|
||||
['source_date', 'valid_until'].includes(key)
|
||||
? 'date'
|
||||
: key === 'source_url'
|
||||
? 'url'
|
||||
: 'text'
|
||||
}
|
||||
className={control}
|
||||
value={source.data[key]}
|
||||
onChange={(e) => source.setData(key, e.target.value)}
|
||||
onChange={(e) =>
|
||||
source.setData(key, e.target.value)
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
))}
|
||||
<Field label={t("Idioma da fonte", "Source language")}>
|
||||
<Field label={t('Idioma da fonte', 'Source language')}>
|
||||
<select
|
||||
className={control}
|
||||
value={source.data.language}
|
||||
onChange={(e) => source.setData("language", e.target.value)}
|
||||
onChange={(e) =>
|
||||
source.setData('language', e.target.value)
|
||||
}
|
||||
>
|
||||
<option value="pt">Português</option>
|
||||
<option value="en">English</option>
|
||||
</select>
|
||||
</Field>
|
||||
<Field label={t("Natureza declarada", "Declared nature")}>
|
||||
<Field label={t('Natureza declarada', 'Declared nature')}>
|
||||
<select
|
||||
className={control}
|
||||
value={source.data.nature}
|
||||
onChange={(e) => source.setData("nature", e.target.value)}
|
||||
onChange={(e) =>
|
||||
source.setData('nature', e.target.value)
|
||||
}
|
||||
>
|
||||
{["pending", "official", "historical", "illustrative"].map((n) => (
|
||||
{[
|
||||
'pending',
|
||||
'official',
|
||||
'historical',
|
||||
'illustrative',
|
||||
].map((n) => (
|
||||
<option key={n} value={n}>
|
||||
{language === "pt" ? states[n] : n}
|
||||
{language === 'pt' ? states[n] : n}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
@@ -433,11 +572,13 @@ export default function Index({ controls, sources, documents, runs, today }: Pro
|
||||
required
|
||||
type="checkbox"
|
||||
checked={source.data.authorised}
|
||||
onChange={(e) => source.setData("authorised", e.target.checked)}
|
||||
onChange={(e) =>
|
||||
source.setData('authorised', e.target.checked)
|
||||
}
|
||||
/>
|
||||
{t(
|
||||
"Confirmo autorização para consulta interna e ausência de dados confidenciais ou pessoais desnecessários.",
|
||||
"I confirm authorisation for internal use and the absence of confidential or unnecessary personal data.",
|
||||
'Confirmo autorização para consulta interna e ausência de dados confidenciais ou pessoais desnecessários.',
|
||||
'I confirm authorisation for internal use and the absence of confidential or unnecessary personal data.',
|
||||
)}
|
||||
</label>
|
||||
<div>
|
||||
@@ -447,10 +588,12 @@ export default function Index({ controls, sources, documents, runs, today }: Pro
|
||||
</p>
|
||||
))}
|
||||
<button
|
||||
disabled={source.processing || documents.length === 0}
|
||||
disabled={
|
||||
source.processing || documents.length === 0
|
||||
}
|
||||
className={button}
|
||||
>
|
||||
{t("Submeter fonte", "Submit source")}
|
||||
{t('Submeter fonte', 'Submit source')}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user