@@ -0,0 +1,119 @@
|
||||
import { Head, Link, useForm } from '@inertiajs/react';
|
||||
import { FormErrors, PageTitle, controlClass } from '@/components/procurement';
|
||||
import { Button } from '@/components/ui/button';
|
||||
|
||||
export default function Portal({
|
||||
portal,
|
||||
portalUrl,
|
||||
canManage,
|
||||
emailDeliveryAvailable = false,
|
||||
}: {
|
||||
portal: { version: number; registration_open: boolean; notice: string };
|
||||
portalUrl: string;
|
||||
canManage: boolean;
|
||||
emailDeliveryAvailable?: boolean;
|
||||
}) {
|
||||
const form = useForm({
|
||||
version: portal.version,
|
||||
registration_open: portal.registration_open,
|
||||
notice: portal.notice,
|
||||
reason: '',
|
||||
});
|
||||
return (
|
||||
<>
|
||||
<Head title="Área externa do candidato" />
|
||||
<main className="mx-auto max-w-3xl space-y-6 p-6">
|
||||
<PageTitle
|
||||
title="Área externa do candidato"
|
||||
eyebrow="Administração"
|
||||
description="Configure o acesso a perfis de candidatos. Cada oportunidade tem publicação própria; a recepção de anexos ainda está em desenvolvimento."
|
||||
/>
|
||||
<p>
|
||||
{emailDeliveryAvailable
|
||||
? 'Transporte de email configurado; a entrega ainda deve ser conferida no servidor.'
|
||||
: 'Envio de email não configurado. Confirmação e recuperação estão implementadas, sem emissão de ligações para logs.'}
|
||||
</p>
|
||||
<Link
|
||||
className="underline"
|
||||
href="/administracao/candidaturas/formularios"
|
||||
>
|
||||
Formulários de candidaturas
|
||||
</Link>
|
||||
<p>
|
||||
Versão {portal.version}. A abertura permite criar contas e
|
||||
preencher perfis. As candidaturas dependem da publicação de
|
||||
cada oportunidade. Não cria autorizações de partilha entre
|
||||
empresas.
|
||||
</p>
|
||||
{portal.version > 0 && (
|
||||
<Link className="underline" href={portalUrl}>
|
||||
Abrir área do candidato
|
||||
</Link>
|
||||
)}
|
||||
<form
|
||||
className="space-y-4"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
form.post('/administracao/candidaturas/portal', {
|
||||
preserveScroll: true,
|
||||
preserveState: false,
|
||||
});
|
||||
}}
|
||||
>
|
||||
<FormErrors errors={form.errors} />
|
||||
<fieldset
|
||||
disabled={!canManage || form.processing}
|
||||
className="space-y-4"
|
||||
>
|
||||
<label className="flex gap-2">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={form.data.registration_open}
|
||||
onChange={(e) =>
|
||||
form.setData(
|
||||
'registration_open',
|
||||
e.target.checked,
|
||||
)
|
||||
}
|
||||
/>
|
||||
Permitir novos registos de candidatos
|
||||
</label>
|
||||
<label className="grid gap-2">
|
||||
Aviso apresentado antes do registo
|
||||
<textarea
|
||||
className={controlClass}
|
||||
required
|
||||
minLength={30}
|
||||
maxLength={15000}
|
||||
value={form.data.notice}
|
||||
onChange={(e) =>
|
||||
form.setData('notice', e.target.value)
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
<p className="text-sm">
|
||||
A empresa define finalidades, fundamento aplicável,
|
||||
conservação e contacto no aviso. A confirmação de
|
||||
leitura não equivale a consentimento para bolsa ou
|
||||
partilha.
|
||||
</p>
|
||||
<label className="grid gap-2">
|
||||
Motivo da configuração
|
||||
<textarea
|
||||
className={controlClass}
|
||||
required
|
||||
minLength={10}
|
||||
maxLength={4000}
|
||||
value={form.data.reason}
|
||||
onChange={(e) =>
|
||||
form.setData('reason', e.target.value)
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
{canManage && <Button>Guardar configuração</Button>}
|
||||
</fieldset>
|
||||
</form>
|
||||
</main>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -1,4 +1,10 @@
|
||||
import { Head, useForm } from '@inertiajs/react';
|
||||
import { Head, Link, useForm } from '@inertiajs/react';
|
||||
import { AiPlanSettings } from '@/components/ai-plan-settings';
|
||||
import type { AiPlan } from '@/components/ai-plan-settings';
|
||||
import { IntelligenceSettings } from '@/components/intelligence-settings';
|
||||
import type { IntelligencePolicy } from '@/components/intelligence-settings';
|
||||
import { comparisonCriteria } from '@/components/comparison-policy-summary';
|
||||
import type { ComparisonPolicy } from '@/components/comparison-policy-summary';
|
||||
import {
|
||||
PageTitle,
|
||||
Panel,
|
||||
@@ -161,8 +167,20 @@ export default function Parameters({
|
||||
costCenters,
|
||||
notice,
|
||||
companyRules,
|
||||
comparisonPolicy,
|
||||
intelligencePolicy,
|
||||
intelligenceReady = false,
|
||||
aiPlan,
|
||||
aiDomains = {},
|
||||
aiDataScopes = {},
|
||||
}: {
|
||||
ready: boolean;
|
||||
comparisonPolicy: ComparisonPolicy;
|
||||
intelligencePolicy?: IntelligencePolicy;
|
||||
intelligenceReady?: boolean;
|
||||
aiPlan?: AiPlan;
|
||||
aiDomains?: Record<string, string>;
|
||||
aiDataScopes?: Record<string, string>;
|
||||
active: boolean;
|
||||
version: number;
|
||||
permissions: { [key: string]: string };
|
||||
@@ -177,6 +195,7 @@ export default function Parameters({
|
||||
second_limit: string;
|
||||
includes_tax: boolean;
|
||||
provisional: boolean;
|
||||
default_tax_rate: string;
|
||||
};
|
||||
}) {
|
||||
const profile = useForm({
|
||||
@@ -204,10 +223,28 @@ export default function Parameters({
|
||||
reason: '',
|
||||
});
|
||||
const department = useForm({ name: '' });
|
||||
const tax = useForm({
|
||||
version,
|
||||
default_tax_rate: companyRules.default_tax_rate,
|
||||
reason: '',
|
||||
});
|
||||
const center = useForm({ department_id: '', code: '', name: '' });
|
||||
const comparison = useForm({
|
||||
version,
|
||||
minimum_proposals: comparisonPolicy.minimum_proposals,
|
||||
minimum_evaluators: comparisonPolicy.minimum_evaluators,
|
||||
weights: { ...comparisonPolicy.weights },
|
||||
reason: '',
|
||||
});
|
||||
return (
|
||||
<>
|
||||
<Head title="Parametrização da aplicação" />
|
||||
<Link
|
||||
href="/administracao/candidaturas/formularios"
|
||||
className="m-5 inline-block font-semibold underline"
|
||||
>
|
||||
Formulários de inscrições e candidaturas
|
||||
</Link>
|
||||
<div className="mx-auto max-w-6xl space-y-6 px-5 py-8 lg:px-8">
|
||||
<PageTitle
|
||||
eyebrow="Administração"
|
||||
@@ -298,6 +335,220 @@ export default function Parameters({
|
||||
</form>
|
||||
)}
|
||||
</Panel>
|
||||
{intelligencePolicy && (
|
||||
<IntelligenceSettings
|
||||
key={`intelligence-${version}`}
|
||||
policy={intelligencePolicy}
|
||||
version={version}
|
||||
ready={intelligenceReady}
|
||||
/>
|
||||
)}
|
||||
{aiPlan && (
|
||||
<AiPlanSettings
|
||||
key={`ai-plan-${version}`}
|
||||
plan={aiPlan}
|
||||
domains={aiDomains}
|
||||
scopes={aiDataScopes}
|
||||
version={version}
|
||||
ready={intelligenceReady}
|
||||
/>
|
||||
)}
|
||||
<Panel title="Regras de comparação de propostas">
|
||||
<p className="mb-4 text-sm">
|
||||
{comparisonPolicy.configured
|
||||
? `Revisão ${comparisonPolicy.revision} da empresa.`
|
||||
: 'Valores iniciais de compatibilidade.'}{' '}
|
||||
A alteração aplica-se apenas a requisições
|
||||
criadas depois de guardar. Rascunhos e processos
|
||||
existentes conservam a regra anterior. Os
|
||||
avaliadores devem continuar independentes e sem
|
||||
conflito de interesses.
|
||||
</p>
|
||||
<form
|
||||
className="space-y-4"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
comparison.post(base + '/comparison', {
|
||||
preserveState: 'errors',
|
||||
preserveScroll: true,
|
||||
});
|
||||
}}
|
||||
>
|
||||
<FormErrors errors={comparison.errors} />
|
||||
<div className="grid gap-4 md:grid-cols-2">
|
||||
<label className="block space-y-1">
|
||||
Mínimo de fornecedores com proposta
|
||||
elegível
|
||||
<input
|
||||
className={controlClass}
|
||||
type="number"
|
||||
min="1"
|
||||
max="100"
|
||||
step="1"
|
||||
required
|
||||
value={
|
||||
comparison.data
|
||||
.minimum_proposals
|
||||
}
|
||||
onChange={(e) =>
|
||||
comparison.setData(
|
||||
'minimum_proposals',
|
||||
Number(e.target.value),
|
||||
)
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
<label className="block space-y-1">
|
||||
Mínimo de avaliadores independentes por
|
||||
proposta
|
||||
<input
|
||||
className={controlClass}
|
||||
type="number"
|
||||
min="1"
|
||||
max="100"
|
||||
step="1"
|
||||
required
|
||||
value={
|
||||
comparison.data
|
||||
.minimum_evaluators
|
||||
}
|
||||
onChange={(e) =>
|
||||
comparison.setData(
|
||||
'minimum_evaluators',
|
||||
Number(e.target.value),
|
||||
)
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
<fieldset className="grid gap-4 md:grid-cols-3">
|
||||
<legend className="mb-3 font-medium">
|
||||
Ponderações — soma obrigatória de 100%
|
||||
</legend>
|
||||
{Object.entries(comparisonCriteria).map(
|
||||
([key, label]) => (
|
||||
<label
|
||||
key={key}
|
||||
className="block space-y-1"
|
||||
>
|
||||
{label} (%)
|
||||
<input
|
||||
className={controlClass}
|
||||
type="number"
|
||||
min="0"
|
||||
max="100"
|
||||
step="1"
|
||||
required
|
||||
value={
|
||||
comparison.data.weights[
|
||||
key as keyof typeof comparisonCriteria
|
||||
]
|
||||
}
|
||||
onChange={(e) =>
|
||||
comparison.setData(
|
||||
'weights',
|
||||
{
|
||||
...comparison
|
||||
.data
|
||||
.weights,
|
||||
[key]: Number(
|
||||
e.target
|
||||
.value,
|
||||
),
|
||||
},
|
||||
)
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
),
|
||||
)}
|
||||
</fieldset>
|
||||
<p className="text-sm">
|
||||
Soma actual:{' '}
|
||||
{Object.values(
|
||||
comparison.data.weights,
|
||||
).reduce((sum, weight) => sum + weight, 0)}
|
||||
%.
|
||||
</p>
|
||||
<label className="block space-y-1">
|
||||
Fundamento e âmbito da alteração
|
||||
<textarea
|
||||
className={controlClass}
|
||||
required
|
||||
minLength={10}
|
||||
maxLength={4000}
|
||||
value={comparison.data.reason}
|
||||
onChange={(e) =>
|
||||
comparison.setData(
|
||||
'reason',
|
||||
e.target.value,
|
||||
)
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
<Button disabled={comparison.processing}>
|
||||
Guardar para novos processos
|
||||
</Button>
|
||||
</form>
|
||||
</Panel>
|
||||
<Panel title="IVA para novas linhas">
|
||||
<p className="mb-4 text-sm">
|
||||
Taxa inicial para novas linhas de requisição.
|
||||
Pode ser ajustada em cada artigo conforme o
|
||||
enquadramento fiscal. As linhas e propostas
|
||||
anteriores conservam a taxa registada. Os
|
||||
descontos unitários incidem antes do IVA.
|
||||
</p>
|
||||
<form
|
||||
className="space-y-4"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
tax.post(base + '/tax', {
|
||||
preserveState: 'errors',
|
||||
preserveScroll: true,
|
||||
});
|
||||
}}
|
||||
>
|
||||
<FormErrors errors={tax.errors} />
|
||||
<label className="block space-y-1">
|
||||
Taxa de IVA inicial (%)
|
||||
<input
|
||||
className={controlClass}
|
||||
type="number"
|
||||
min="0"
|
||||
max="100"
|
||||
step="0.01"
|
||||
required
|
||||
value={tax.data.default_tax_rate}
|
||||
onChange={(e) =>
|
||||
tax.setData(
|
||||
'default_tax_rate',
|
||||
e.target.value,
|
||||
)
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
<label className="block space-y-1">
|
||||
Fundamento e âmbito fiscal
|
||||
<textarea
|
||||
className={controlClass}
|
||||
required
|
||||
minLength={10}
|
||||
maxLength={4000}
|
||||
value={tax.data.reason}
|
||||
onChange={(e) =>
|
||||
tax.setData(
|
||||
'reason',
|
||||
e.target.value,
|
||||
)
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
<Button disabled={tax.processing}>
|
||||
Guardar taxa inicial
|
||||
</Button>
|
||||
</form>
|
||||
</Panel>
|
||||
<Panel title="Regras de aprovação da empresa">
|
||||
<p className="mb-4 text-sm">
|
||||
{companyRules.provisional
|
||||
|
||||
@@ -0,0 +1,478 @@
|
||||
import { Head, Link, useForm } from '@inertiajs/react';
|
||||
import {
|
||||
FormErrors,
|
||||
PageTitle,
|
||||
Panel,
|
||||
controlClass,
|
||||
} from '@/components/procurement';
|
||||
import { Button } from '@/components/ui/button';
|
||||
|
||||
type Field = { key: string; label: string; type: string; required: boolean };
|
||||
type Document = {
|
||||
key: string;
|
||||
label: string;
|
||||
required: boolean;
|
||||
formats: string[];
|
||||
max_kb: number;
|
||||
};
|
||||
type Definition = {
|
||||
available: boolean;
|
||||
fields: Field[];
|
||||
documents: Document[];
|
||||
};
|
||||
type Revision = {
|
||||
id: number;
|
||||
version: number;
|
||||
created_by: number;
|
||||
created_at: string;
|
||||
reason: string;
|
||||
definition: Definition;
|
||||
};
|
||||
export type SubmissionForm = {
|
||||
audience: string;
|
||||
modality: string;
|
||||
version: number;
|
||||
definition: Definition;
|
||||
history: Revision[];
|
||||
};
|
||||
const audiences: Record<string, string> = {
|
||||
staff: 'Recrutamento',
|
||||
service: 'Prestadores individuais',
|
||||
supplier: 'Fornecedores',
|
||||
};
|
||||
|
||||
function Editor({
|
||||
record,
|
||||
canManage,
|
||||
}: {
|
||||
record: SubmissionForm;
|
||||
canManage: boolean;
|
||||
}) {
|
||||
const form = useForm({
|
||||
audience: record.audience,
|
||||
modality: record.modality,
|
||||
version: record.version,
|
||||
definition: record.definition,
|
||||
reason: '',
|
||||
});
|
||||
const updateField = (index: number, patch: Partial<Field>) =>
|
||||
form.setData('definition', {
|
||||
...form.data.definition,
|
||||
fields: form.data.definition.fields.map((field, i) =>
|
||||
i === index ? { ...field, ...patch } : field,
|
||||
),
|
||||
});
|
||||
const updateDocument = (index: number, patch: Partial<Document>) =>
|
||||
form.setData('definition', {
|
||||
...form.data.definition,
|
||||
documents: form.data.definition.documents.map((document, i) =>
|
||||
i === index ? { ...document, ...patch } : document,
|
||||
),
|
||||
});
|
||||
return (
|
||||
<Panel
|
||||
title={`${audiences[record.audience]} · ${record.modality === 'competition' ? 'Com concurso' : 'Espontânea'} · v${record.version}`}
|
||||
>
|
||||
<form
|
||||
className="space-y-5"
|
||||
onSubmit={(event) => {
|
||||
event.preventDefault();
|
||||
form.post('/administracao/candidaturas/formularios', {
|
||||
preserveScroll: true,
|
||||
});
|
||||
}}
|
||||
>
|
||||
<FormErrors errors={form.errors} />
|
||||
<fieldset
|
||||
disabled={!canManage || form.processing}
|
||||
className="space-y-5"
|
||||
>
|
||||
<label className="flex gap-2">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={form.data.definition.available}
|
||||
onChange={(event) =>
|
||||
form.setData('definition', {
|
||||
...form.data.definition,
|
||||
available: event.target.checked,
|
||||
})
|
||||
}
|
||||
/>
|
||||
Modalidade prevista para recepção
|
||||
</label>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
Esta configuração prepara os próximos formulários. Ainda
|
||||
não abre candidaturas externas. Cada submissão
|
||||
conservará a versão utilizada.
|
||||
</p>
|
||||
<h3 className="font-semibold">Campos do formulário</h3>
|
||||
{form.data.definition.fields.map((field, index) => (
|
||||
<fieldset
|
||||
key={index}
|
||||
className="grid gap-3 rounded border p-3 sm:grid-cols-2"
|
||||
>
|
||||
<legend>Campo {index + 1}</legend>
|
||||
<label>
|
||||
Identificador estável
|
||||
<input
|
||||
className={controlClass}
|
||||
required
|
||||
pattern="[a-z][a-z0-9_]{0,49}"
|
||||
value={field.key}
|
||||
onChange={(e) =>
|
||||
updateField(index, {
|
||||
key: e.target.value,
|
||||
})
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
<label>
|
||||
Designação
|
||||
<input
|
||||
className={controlClass}
|
||||
required
|
||||
maxLength={200}
|
||||
value={field.label}
|
||||
onChange={(e) =>
|
||||
updateField(index, {
|
||||
label: e.target.value,
|
||||
})
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
<label>
|
||||
Tipo
|
||||
<select
|
||||
className={controlClass}
|
||||
value={field.type}
|
||||
onChange={(e) =>
|
||||
updateField(index, {
|
||||
type: e.target.value,
|
||||
})
|
||||
}
|
||||
>
|
||||
{Object.entries({
|
||||
text: 'Texto',
|
||||
textarea: 'Texto longo',
|
||||
email: 'Email',
|
||||
date: 'Data',
|
||||
number: 'Número',
|
||||
location:
|
||||
'Disponibilidade: província, distrito e localidade',
|
||||
}).map(([value, label]) => (
|
||||
<option key={value} value={value}>
|
||||
{label}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
{field.type === 'location' && (
|
||||
<fieldset
|
||||
disabled
|
||||
className="grid gap-2 sm:col-span-2 sm:grid-cols-3"
|
||||
>
|
||||
<legend>
|
||||
Pré-visualização da disponibilidade
|
||||
</legend>
|
||||
{[
|
||||
'Província',
|
||||
'Distrito',
|
||||
'Localidade',
|
||||
].map((label) => (
|
||||
<label key={label}>
|
||||
{label}
|
||||
<input
|
||||
className={controlClass}
|
||||
placeholder={label}
|
||||
/>
|
||||
</label>
|
||||
))}
|
||||
</fieldset>
|
||||
)}
|
||||
<label className="flex items-center gap-2">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={field.required}
|
||||
onChange={(e) =>
|
||||
updateField(index, {
|
||||
required: e.target.checked,
|
||||
})
|
||||
}
|
||||
/>
|
||||
Obrigatório
|
||||
</label>
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
onClick={() =>
|
||||
form.setData('definition', {
|
||||
...form.data.definition,
|
||||
fields: form.data.definition.fields.filter(
|
||||
(_, i) => i !== index,
|
||||
),
|
||||
})
|
||||
}
|
||||
>
|
||||
Retirar campo desta versão
|
||||
</Button>
|
||||
</fieldset>
|
||||
))}
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
disabled={form.data.definition.fields.length >= 40}
|
||||
onClick={() =>
|
||||
form.setData('definition', {
|
||||
...form.data.definition,
|
||||
fields: [
|
||||
...form.data.definition.fields,
|
||||
{
|
||||
key: '',
|
||||
label: '',
|
||||
type: 'text',
|
||||
required: false,
|
||||
},
|
||||
],
|
||||
})
|
||||
}
|
||||
>
|
||||
Adicionar campo
|
||||
</Button>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
Disponibilidade geográfica usa três campos próprios:
|
||||
província, distrito e localidade. É o local onde a
|
||||
pessoa pode trabalhar ou prestar serviço, distinto da
|
||||
morada. A obrigatoriedade é definida neste formulário.
|
||||
</p>
|
||||
<h3 className="font-semibold">Documentos pedidos</h3>
|
||||
{form.data.definition.documents.map((document, index) => (
|
||||
<fieldset
|
||||
key={index}
|
||||
className="grid gap-3 rounded border p-3 sm:grid-cols-2"
|
||||
>
|
||||
<legend>Documento {index + 1}</legend>
|
||||
<label>
|
||||
Identificador estável
|
||||
<input
|
||||
className={controlClass}
|
||||
required
|
||||
pattern="[a-z][a-z0-9_]{0,49}"
|
||||
value={document.key}
|
||||
onChange={(e) =>
|
||||
updateDocument(index, {
|
||||
key: e.target.value,
|
||||
})
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
<label>
|
||||
Designação
|
||||
<input
|
||||
className={controlClass}
|
||||
required
|
||||
maxLength={200}
|
||||
value={document.label}
|
||||
onChange={(e) =>
|
||||
updateDocument(index, {
|
||||
label: e.target.value,
|
||||
})
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
<label>
|
||||
Limite por ficheiro (KB)
|
||||
<input
|
||||
className={controlClass}
|
||||
type="number"
|
||||
required
|
||||
min={1}
|
||||
max={51200}
|
||||
value={document.max_kb || ''}
|
||||
onChange={(e) =>
|
||||
updateDocument(index, {
|
||||
max_kb: Number(e.target.value),
|
||||
})
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
<label className="flex items-center gap-2">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={document.required}
|
||||
onChange={(e) =>
|
||||
updateDocument(index, {
|
||||
required: e.target.checked,
|
||||
})
|
||||
}
|
||||
/>
|
||||
Obrigatório
|
||||
</label>
|
||||
<div className="flex flex-wrap gap-4">
|
||||
{['pdf', 'docx', 'jpg', 'png'].map((format) => (
|
||||
<label key={format}>
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={document.formats.includes(
|
||||
format,
|
||||
)}
|
||||
onChange={(e) =>
|
||||
updateDocument(index, {
|
||||
formats: e.target.checked
|
||||
? [
|
||||
...document.formats,
|
||||
format,
|
||||
]
|
||||
: document.formats.filter(
|
||||
(v) =>
|
||||
v !== format,
|
||||
),
|
||||
})
|
||||
}
|
||||
/>{' '}
|
||||
{format.toUpperCase()}
|
||||
</label>
|
||||
))}
|
||||
</div>
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
onClick={() =>
|
||||
form.setData('definition', {
|
||||
...form.data.definition,
|
||||
documents:
|
||||
form.data.definition.documents.filter(
|
||||
(_, i) => i !== index,
|
||||
),
|
||||
})
|
||||
}
|
||||
>
|
||||
Retirar documento desta versão
|
||||
</Button>
|
||||
</fieldset>
|
||||
))}
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
disabled={form.data.definition.documents.length >= 20}
|
||||
onClick={() =>
|
||||
form.setData('definition', {
|
||||
...form.data.definition,
|
||||
documents: [
|
||||
...form.data.definition.documents,
|
||||
{
|
||||
key: '',
|
||||
label: '',
|
||||
required: false,
|
||||
formats: [],
|
||||
max_kb: 0,
|
||||
},
|
||||
],
|
||||
})
|
||||
}
|
||||
>
|
||||
Adicionar documento
|
||||
</Button>
|
||||
<label className="grid gap-2">
|
||||
Motivo da alteração
|
||||
<textarea
|
||||
className={controlClass}
|
||||
required
|
||||
minLength={10}
|
||||
maxLength={4000}
|
||||
value={form.data.reason}
|
||||
onChange={(e) =>
|
||||
form.setData('reason', e.target.value)
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
{canManage && <Button>Guardar nova versão</Button>}
|
||||
</fieldset>
|
||||
</form>
|
||||
<details className="mt-5">
|
||||
<summary>
|
||||
Histórico e definições anteriores ({record.history.length})
|
||||
</summary>
|
||||
{record.history.map((revision) => (
|
||||
<div key={revision.id} className="my-3 border-t py-3">
|
||||
<p>
|
||||
Versão {revision.version} · {revision.created_at} ·
|
||||
utilizador {revision.created_by}
|
||||
</p>
|
||||
<p>{revision.reason}</p>
|
||||
<p>
|
||||
{revision.definition.available
|
||||
? 'Prevista para recepção'
|
||||
: 'Indisponível para novas submissões'}
|
||||
</p>
|
||||
<ul>
|
||||
{revision.definition.fields.map((field) => (
|
||||
<li key={field.key}>
|
||||
{field.label} · {field.type} ·{' '}
|
||||
{field.required
|
||||
? 'Obrigatório'
|
||||
: 'Opcional'}
|
||||
</li>
|
||||
))}
|
||||
{revision.definition.documents.map((document) => (
|
||||
<li key={document.key}>
|
||||
{document.label} ·{' '}
|
||||
{document.formats.join(', ')} ·{' '}
|
||||
{document.max_kb} KB ·{' '}
|
||||
{document.required
|
||||
? 'Obrigatório'
|
||||
: 'Opcional'}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
))}
|
||||
</details>
|
||||
</Panel>
|
||||
);
|
||||
}
|
||||
|
||||
export default function SubmissionForms({
|
||||
forms,
|
||||
canManage,
|
||||
ready,
|
||||
}: {
|
||||
forms: SubmissionForm[];
|
||||
canManage: boolean;
|
||||
ready: boolean;
|
||||
externalPortalAvailable: boolean;
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<Head title="Formulários de candidaturas" />
|
||||
<Link className="m-5 inline-block underline" href="/administracao/candidaturas/portal">Configurar área externa do candidato</Link>
|
||||
<div className="mx-auto max-w-5xl space-y-6 p-5 lg:p-8">
|
||||
<PageTitle
|
||||
title="Inscrições e candidaturas electrónicas"
|
||||
eyebrow="Administração"
|
||||
description="Configure separadamente recrutamento, prestadores individuais e fornecedores, com concurso ou por inscrição espontânea."
|
||||
/>
|
||||
<Link
|
||||
className="underline"
|
||||
href="/administracao/parametrizacao"
|
||||
>
|
||||
Parametrização da aplicação
|
||||
</Link>
|
||||
<p>
|
||||
Portal externo em desenvolvimento. Guardar estas definições
|
||||
não publica oportunidades nem altera processos existentes.
|
||||
</p>
|
||||
{!ready ? (
|
||||
<p>Instalação dos formulários pendente.</p>
|
||||
) : (
|
||||
forms.map((record) => (
|
||||
<Editor
|
||||
key={`${record.audience}:${record.modality}:${record.version}`}
|
||||
record={record}
|
||||
canManage={canManage}
|
||||
/>
|
||||
))
|
||||
)}
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user