@@ -0,0 +1,938 @@
|
||||
import { Head, Link, router, useForm } from '@inertiajs/react';
|
||||
import {
|
||||
PageTitle,
|
||||
Panel,
|
||||
FormErrors,
|
||||
controlClass,
|
||||
} from '@/components/procurement';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { peopleStates } from '@/lib/people-hiring';
|
||||
import { PeopleOperationalInsights } from '@/components/people-operational-insights';
|
||||
import type { OperationalInsights } from '@/components/people-operational-insights';
|
||||
|
||||
const kinds: Record<string, string> = {
|
||||
service: 'Prestador individual',
|
||||
staff: 'Trabalhador para o quadro',
|
||||
};
|
||||
type WorkItem = {
|
||||
id: string;
|
||||
process_id: number;
|
||||
reference: string;
|
||||
title: string;
|
||||
kind: string;
|
||||
status: string;
|
||||
action: string;
|
||||
label: string;
|
||||
due_on: string | null;
|
||||
href: string;
|
||||
};
|
||||
type Workdesk = {
|
||||
updated_at: string;
|
||||
counts: Record<
|
||||
| 'processes'
|
||||
| 'active'
|
||||
| 'contract_drafts'
|
||||
| 'tasks'
|
||||
| 'approvals'
|
||||
| 'overdue',
|
||||
number
|
||||
>;
|
||||
tasks: WorkItem[];
|
||||
approvals: WorkItem[];
|
||||
alerts: {
|
||||
id?: string;
|
||||
process_id: number;
|
||||
title: string;
|
||||
label: string;
|
||||
due_on: string;
|
||||
href: string;
|
||||
}[];
|
||||
};
|
||||
type Filters = {
|
||||
kind?: string;
|
||||
search?: string;
|
||||
status?: string;
|
||||
from?: string;
|
||||
to?: string;
|
||||
};
|
||||
function Queue({
|
||||
id,
|
||||
title,
|
||||
items,
|
||||
empty,
|
||||
}: {
|
||||
id: string;
|
||||
title: string;
|
||||
items: WorkItem[];
|
||||
empty: string;
|
||||
}) {
|
||||
return (
|
||||
<div id={id} className="scroll-mt-24">
|
||||
<Panel title={title}>
|
||||
{items.length ? (
|
||||
<div className="overflow-auto">
|
||||
<table className="w-full text-left text-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th className="p-2">Acção pendente</th>
|
||||
<th className="p-2">Processo</th>
|
||||
<th className="p-2">Percurso e estado</th>
|
||||
<th className="p-2">Prazo</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{items.map((item) => (
|
||||
<tr key={item.id} className="border-t">
|
||||
<td className="p-2">
|
||||
<Link
|
||||
className="font-medium underline"
|
||||
href={item.href}
|
||||
>
|
||||
{item.label}
|
||||
</Link>
|
||||
</td>
|
||||
<td className="p-2">
|
||||
{item.reference} · {item.title}
|
||||
</td>
|
||||
<td className="p-2">
|
||||
{kinds[item.kind]} ·{' '}
|
||||
{peopleStates[item.status]}
|
||||
</td>
|
||||
<td className="p-2">
|
||||
{item.due_on ?? 'Não definido'}
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
) : (
|
||||
<p>{empty}</p>
|
||||
)}
|
||||
</Panel>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
export default function PeopleIndex({
|
||||
ready,
|
||||
kinds: allowed,
|
||||
canPrepare,
|
||||
processes,
|
||||
administration = [],
|
||||
formFields = {},
|
||||
availableKinds = allowed,
|
||||
workdesk,
|
||||
insights,
|
||||
filters = {},
|
||||
company,
|
||||
}: {
|
||||
ready: boolean;
|
||||
availableKinds?: string[];
|
||||
workdesk?: Workdesk | null;
|
||||
insights?: OperationalInsights | null;
|
||||
filters?: Filters;
|
||||
company?: { name: string };
|
||||
administration?: { id: number; kind: string; status: string }[];
|
||||
formFields?: Record<string, Record<string, string>>;
|
||||
kinds: string[];
|
||||
canPrepare: string[];
|
||||
processes: null | {
|
||||
data: {
|
||||
id: number;
|
||||
title: string;
|
||||
kind: string;
|
||||
status: string;
|
||||
closes_on: string;
|
||||
}[];
|
||||
links: { url: string | null; label: string; active: boolean }[];
|
||||
};
|
||||
}) {
|
||||
const form = useForm({
|
||||
operation_key: crypto.randomUUID(),
|
||||
kind:
|
||||
filters.kind && canPrepare.includes(filters.kind)
|
||||
? filters.kind
|
||||
: (canPrepare[0] ?? allowed[0]),
|
||||
title: '',
|
||||
purpose: '',
|
||||
closes_on: '',
|
||||
minimum_reviews: '1',
|
||||
criteria: [{ label: '', weight: '100' }],
|
||||
annex: {
|
||||
fields: {} as Record<string, string>,
|
||||
requirements: [] as {
|
||||
description: string;
|
||||
classification: string;
|
||||
verification: string;
|
||||
equivalences: string;
|
||||
}[],
|
||||
},
|
||||
});
|
||||
const filtering = useForm({
|
||||
kind: filters.kind ?? '',
|
||||
search: filters.search ?? '',
|
||||
status: filters.status ?? '',
|
||||
from: filters.from ?? '',
|
||||
to: filters.to ?? '',
|
||||
});
|
||||
return (
|
||||
<>
|
||||
<Head title="Pessoas e contratações" />
|
||||
<div className="mx-auto max-w-6xl space-y-6 p-5 lg:p-8">
|
||||
<PageTitle
|
||||
eyebrow="Organização"
|
||||
title="Pessoas e contratações"
|
||||
description="Contratação de prestadores individuais e recrutamento de trabalhadores, com critérios próprios e decisão independente."
|
||||
action={
|
||||
ready ? (
|
||||
<Button
|
||||
variant="outline"
|
||||
onClick={() => router.reload()}
|
||||
>
|
||||
Actualizar
|
||||
</Button>
|
||||
) : undefined
|
||||
}
|
||||
/>
|
||||
{!ready ? (
|
||||
<Panel title="Instalação pendente">
|
||||
<p>O módulo ainda não foi instalado neste ambiente.</p>
|
||||
</Panel>
|
||||
) : (
|
||||
<>
|
||||
{company && (
|
||||
<p className="text-sm font-medium">
|
||||
Entidade activa: {company.name}
|
||||
</p>
|
||||
)}
|
||||
<Panel title="Pesquisar e filtrar processos autorizados">
|
||||
<form
|
||||
className="space-y-4"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
filtering.get('/pessoas', {
|
||||
preserveState: true,
|
||||
preserveScroll: true,
|
||||
});
|
||||
}}
|
||||
>
|
||||
<FormErrors errors={filtering.errors} />
|
||||
<div className="grid gap-4 md:grid-cols-3">
|
||||
<label>
|
||||
Pesquisa por título ou referência
|
||||
<input
|
||||
className={controlClass}
|
||||
type="search"
|
||||
maxLength={100}
|
||||
value={filtering.data.search}
|
||||
onChange={(e) =>
|
||||
filtering.setData(
|
||||
'search',
|
||||
e.target.value,
|
||||
)
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
<label>
|
||||
Percurso
|
||||
<select
|
||||
className={controlClass}
|
||||
value={filtering.data.kind}
|
||||
onChange={(e) =>
|
||||
filtering.setData(
|
||||
'kind',
|
||||
e.target.value,
|
||||
)
|
||||
}
|
||||
>
|
||||
<option value="">
|
||||
Todos os autorizados
|
||||
</option>
|
||||
{availableKinds.map((kind) => (
|
||||
<option key={kind} value={kind}>
|
||||
{kinds[kind]}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
<label>
|
||||
Estado
|
||||
<select
|
||||
className={controlClass}
|
||||
value={filtering.data.status}
|
||||
onChange={(e) =>
|
||||
filtering.setData(
|
||||
'status',
|
||||
e.target.value,
|
||||
)
|
||||
}
|
||||
>
|
||||
<option value="">Todos</option>
|
||||
{Object.entries(peopleStates).map(
|
||||
([key, label]) => (
|
||||
<option
|
||||
key={key}
|
||||
value={key}
|
||||
>
|
||||
{label}
|
||||
</option>
|
||||
),
|
||||
)}
|
||||
</select>
|
||||
</label>
|
||||
<label>
|
||||
Criado desde
|
||||
<input
|
||||
type="date"
|
||||
className={controlClass}
|
||||
value={filtering.data.from}
|
||||
onChange={(e) =>
|
||||
filtering.setData(
|
||||
'from',
|
||||
e.target.value,
|
||||
)
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
<label>
|
||||
Criado até
|
||||
<input
|
||||
type="date"
|
||||
className={controlClass}
|
||||
min={
|
||||
filtering.data.from || undefined
|
||||
}
|
||||
value={filtering.data.to}
|
||||
onChange={(e) =>
|
||||
filtering.setData(
|
||||
'to',
|
||||
e.target.value,
|
||||
)
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
<div className="flex items-center gap-4">
|
||||
<Button disabled={filtering.processing}>
|
||||
Aplicar filtros
|
||||
</Button>
|
||||
<Link className="underline" href="/pessoas">
|
||||
Limpar filtros
|
||||
</Link>
|
||||
</div>
|
||||
</form>
|
||||
</Panel>
|
||||
{insights && (
|
||||
<PeopleOperationalInsights data={insights} />
|
||||
)}
|
||||
{workdesk && (
|
||||
<>
|
||||
<div className="grid gap-3 sm:grid-cols-2 lg:grid-cols-5">
|
||||
{(
|
||||
[
|
||||
[
|
||||
'processes',
|
||||
'Processos autorizados',
|
||||
],
|
||||
[
|
||||
'contract_drafts',
|
||||
'Minutas preparadas',
|
||||
],
|
||||
['tasks', 'As minhas tarefas'],
|
||||
['approvals', 'Aprovações'],
|
||||
['overdue', 'Prazos vencidos'],
|
||||
] as const
|
||||
).map(([key, label]) => (
|
||||
<div
|
||||
className="rounded-xl border p-4"
|
||||
key={key}
|
||||
>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
{label}
|
||||
</p>
|
||||
<strong className="text-2xl">
|
||||
{workdesk.counts[key]}
|
||||
</strong>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
Actualizado em{' '}
|
||||
{new Date(
|
||||
workdesk.updated_at,
|
||||
).toLocaleString('pt-MZ')}
|
||||
. Contagens limitadas aos filtros e aos seus
|
||||
acessos. Tarefas e aprovações contam acções
|
||||
distintas, não pessoas nem processos
|
||||
duplicados.
|
||||
</p>
|
||||
<Queue
|
||||
id="people-tasks"
|
||||
title="As minhas tarefas"
|
||||
items={workdesk.tasks}
|
||||
empty="Sem tarefas operacionais pendentes para os filtros e atribuições actuais."
|
||||
/>
|
||||
<Queue
|
||||
id="people-approvals"
|
||||
title="Aprovações"
|
||||
items={workdesk.approvals}
|
||||
empty="Sem decisões formais pendentes para os filtros e atribuições actuais."
|
||||
/>
|
||||
{workdesk.alerts.length > 0 && (
|
||||
<Panel title="Prazos a acompanhar">
|
||||
<ul className="space-y-2">
|
||||
{workdesk.alerts.map((alert) => (
|
||||
<li
|
||||
key={
|
||||
alert.id ??
|
||||
`${alert.process_id}-${alert.label}`
|
||||
}
|
||||
>
|
||||
<Link
|
||||
className="underline"
|
||||
href={alert.href}
|
||||
>
|
||||
{alert.title} ·{' '}
|
||||
{alert.label} ·{' '}
|
||||
{alert.due_on}
|
||||
</Link>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</Panel>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
{administration.length > 0 && (
|
||||
<Panel
|
||||
title="Organizar equipas"
|
||||
description="Acesso à configuração das atribuições, sem consultar conteúdo dos processos."
|
||||
>
|
||||
<div className="flex flex-wrap gap-4">
|
||||
{administration.map((p) => (
|
||||
<Link
|
||||
key={p.id}
|
||||
href={`/pessoas/${p.id}/acessos`}
|
||||
className="underline"
|
||||
>
|
||||
Processo #{p.id} · {kinds[p.kind]}
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
</Panel>
|
||||
)}
|
||||
<Panel title="Processos">
|
||||
<div className="space-y-3">
|
||||
{processes?.data.map((p) => (
|
||||
<Link
|
||||
className="block rounded-lg border p-4"
|
||||
key={p.id}
|
||||
href={`/pessoas/${p.id}`}
|
||||
>
|
||||
<strong>
|
||||
PES-{p.id} · {p.title}
|
||||
</strong>
|
||||
<p>
|
||||
{kinds[p.kind]} ·{' '}
|
||||
{peopleStates[p.status] ?? p.status}{' '}
|
||||
· candidaturas até {p.closes_on}
|
||||
</p>
|
||||
</Link>
|
||||
))}
|
||||
{!processes?.data.length && (
|
||||
<p>Sem processos acessíveis.</p>
|
||||
)}
|
||||
</div>
|
||||
<nav
|
||||
aria-label="Páginas de processos"
|
||||
className="mt-4 flex gap-3"
|
||||
>
|
||||
{processes?.links.map(
|
||||
(link, i) =>
|
||||
link.url && (
|
||||
<Link
|
||||
key={i}
|
||||
href={link.url}
|
||||
aria-current={
|
||||
link.active
|
||||
? 'page'
|
||||
: undefined
|
||||
}
|
||||
className="underline"
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: link.label,
|
||||
}}
|
||||
/>
|
||||
),
|
||||
)}
|
||||
</nav>
|
||||
</Panel>
|
||||
{canPrepare.length > 0 && (
|
||||
<Panel
|
||||
title="Preparar novo processo"
|
||||
description="A abertura exige outra pessoa. Critérios e mínimo de avaliações ficam preservados neste processo; não são herdados das compras."
|
||||
>
|
||||
<form
|
||||
className="space-y-4"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
form.transform((values) => ({
|
||||
...values,
|
||||
annex: {
|
||||
...values.annex,
|
||||
fields: Object.fromEntries(
|
||||
Object.keys(
|
||||
formFields[
|
||||
values.kind
|
||||
] ?? {},
|
||||
).map((key) => [
|
||||
key,
|
||||
values.annex.fields[
|
||||
key
|
||||
] ?? '',
|
||||
]),
|
||||
),
|
||||
},
|
||||
}));
|
||||
form.post('/pessoas', {
|
||||
onSuccess: () => form.reset(),
|
||||
});
|
||||
}}
|
||||
>
|
||||
<FormErrors errors={form.errors} />
|
||||
<label className="block">
|
||||
Percurso
|
||||
<select
|
||||
className={controlClass}
|
||||
value={form.data.kind}
|
||||
onChange={(e) =>
|
||||
form.setData(
|
||||
'kind',
|
||||
e.target.value,
|
||||
)
|
||||
}
|
||||
>
|
||||
{canPrepare.map((kind) => (
|
||||
<option key={kind} value={kind}>
|
||||
{kinds[kind]}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
<label className="block">
|
||||
Título da necessidade ou vaga
|
||||
<input
|
||||
className={controlClass}
|
||||
required
|
||||
minLength={3}
|
||||
maxLength={200}
|
||||
value={form.data.title}
|
||||
onChange={(e) =>
|
||||
form.setData(
|
||||
'title',
|
||||
e.target.value,
|
||||
)
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
<label className="block">
|
||||
Objectivo, perfil e âmbito
|
||||
<textarea
|
||||
className={controlClass}
|
||||
required
|
||||
minLength={10}
|
||||
maxLength={5000}
|
||||
value={form.data.purpose}
|
||||
onChange={(e) =>
|
||||
form.setData(
|
||||
'purpose',
|
||||
e.target.value,
|
||||
)
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
<div className="grid gap-4 md:grid-cols-2">
|
||||
<label>
|
||||
Fecho de candidaturas
|
||||
<input
|
||||
className={controlClass}
|
||||
type="date"
|
||||
required
|
||||
value={form.data.closes_on}
|
||||
onChange={(e) =>
|
||||
form.setData(
|
||||
'closes_on',
|
||||
e.target.value,
|
||||
)
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
<label>
|
||||
Avaliadores independentes por
|
||||
candidatura
|
||||
<input
|
||||
className={controlClass}
|
||||
type="number"
|
||||
min="1"
|
||||
max="20"
|
||||
required
|
||||
value={
|
||||
form.data.minimum_reviews
|
||||
}
|
||||
onChange={(e) =>
|
||||
form.setData(
|
||||
'minimum_reviews',
|
||||
e.target.value,
|
||||
)
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
<fieldset className="space-y-3">
|
||||
<legend className="font-medium">
|
||||
Critérios de avaliação — soma de
|
||||
100%
|
||||
</legend>
|
||||
{form.data.criteria.map(
|
||||
(criterion, index) => (
|
||||
<div
|
||||
key={index}
|
||||
className="grid gap-3 md:grid-cols-[1fr_8rem_auto]"
|
||||
>
|
||||
<label>
|
||||
Critério
|
||||
<input
|
||||
className={
|
||||
controlClass
|
||||
}
|
||||
required
|
||||
maxLength={150}
|
||||
value={
|
||||
criterion.label
|
||||
}
|
||||
onChange={(e) =>
|
||||
form.setData(
|
||||
'criteria',
|
||||
form.data.criteria.map(
|
||||
(
|
||||
row,
|
||||
i,
|
||||
) =>
|
||||
i ===
|
||||
index
|
||||
? {
|
||||
...row,
|
||||
label: e
|
||||
.target
|
||||
.value,
|
||||
}
|
||||
: row,
|
||||
),
|
||||
)
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
<label>
|
||||
Peso (%)
|
||||
<input
|
||||
className={
|
||||
controlClass
|
||||
}
|
||||
type="number"
|
||||
min="1"
|
||||
max="100"
|
||||
required
|
||||
value={
|
||||
criterion.weight
|
||||
}
|
||||
onChange={(e) =>
|
||||
form.setData(
|
||||
'criteria',
|
||||
form.data.criteria.map(
|
||||
(
|
||||
row,
|
||||
i,
|
||||
) =>
|
||||
i ===
|
||||
index
|
||||
? {
|
||||
...row,
|
||||
weight: e
|
||||
.target
|
||||
.value,
|
||||
}
|
||||
: row,
|
||||
),
|
||||
)
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
disabled={
|
||||
form.data.criteria
|
||||
.length === 1
|
||||
}
|
||||
onClick={() =>
|
||||
form.setData(
|
||||
'criteria',
|
||||
form.data.criteria.filter(
|
||||
(_, i) =>
|
||||
i !==
|
||||
index,
|
||||
),
|
||||
)
|
||||
}
|
||||
>
|
||||
Retirar
|
||||
</Button>
|
||||
</div>
|
||||
),
|
||||
)}
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
disabled={
|
||||
form.data.criteria.length >= 20
|
||||
}
|
||||
onClick={() =>
|
||||
form.setData('criteria', [
|
||||
...form.data.criteria,
|
||||
{ label: '', weight: '' },
|
||||
])
|
||||
}
|
||||
>
|
||||
Adicionar critério
|
||||
</Button>
|
||||
</fieldset>
|
||||
<fieldset className="space-y-4">
|
||||
<legend className="font-semibold">
|
||||
{form.data.kind === 'staff'
|
||||
? 'Anexo A — Ficha da função'
|
||||
: 'Anexo C — Necessidade de serviço'}
|
||||
</legend>
|
||||
<p className="text-sm">
|
||||
Complete os campos aplicáveis. O
|
||||
título e o objectivo acima
|
||||
identificam a necessidade. Ao criar,
|
||||
assume a preparação deste processo;
|
||||
atribua depois a equipa.
|
||||
</p>
|
||||
{Object.entries(
|
||||
formFields[form.data.kind] ?? {},
|
||||
).map(([key, label]) => (
|
||||
<label key={key} className="block">
|
||||
{label}
|
||||
<textarea
|
||||
className={controlClass}
|
||||
maxLength={5000}
|
||||
value={
|
||||
form.data.annex.fields[
|
||||
key
|
||||
] ?? ''
|
||||
}
|
||||
onChange={(e) =>
|
||||
form.setData('annex', {
|
||||
...form.data.annex,
|
||||
fields: {
|
||||
...form.data
|
||||
.annex
|
||||
.fields,
|
||||
[key]: e.target
|
||||
.value,
|
||||
},
|
||||
})
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
))}
|
||||
</fieldset>
|
||||
<fieldset className="space-y-4">
|
||||
<legend className="font-semibold">
|
||||
Requisitos obrigatórios e desejáveis
|
||||
</legend>
|
||||
<p className="text-sm">
|
||||
Registe como verificar cada
|
||||
requisito e as equivalências
|
||||
aceites. A falta de comprovativo não
|
||||
gera exclusão automática.
|
||||
</p>
|
||||
{form.data.annex.requirements.map(
|
||||
(r, index) => (
|
||||
<div
|
||||
className="space-y-3 rounded border p-4"
|
||||
key={index}
|
||||
>
|
||||
{(
|
||||
[
|
||||
'description',
|
||||
'verification',
|
||||
'equivalences',
|
||||
] as const
|
||||
).map((key) => (
|
||||
<label
|
||||
key={key}
|
||||
className="block"
|
||||
>
|
||||
{
|
||||
{
|
||||
description:
|
||||
'Requisito e relação com a função ou serviço',
|
||||
verification:
|
||||
'Método de verificação',
|
||||
equivalences:
|
||||
'Equivalências e adaptações aplicáveis',
|
||||
}[key]
|
||||
}
|
||||
<textarea
|
||||
className={
|
||||
controlClass
|
||||
}
|
||||
required={
|
||||
key !==
|
||||
'equivalences'
|
||||
}
|
||||
maxLength={
|
||||
key ===
|
||||
'description'
|
||||
? 1000
|
||||
: 2000
|
||||
}
|
||||
value={r[key]}
|
||||
onChange={(e) =>
|
||||
form.setData(
|
||||
'annex',
|
||||
{
|
||||
...form
|
||||
.data
|
||||
.annex,
|
||||
requirements:
|
||||
form.data.annex.requirements.map(
|
||||
(
|
||||
row,
|
||||
i,
|
||||
) =>
|
||||
i ===
|
||||
index
|
||||
? {
|
||||
...row,
|
||||
[key]: e
|
||||
.target
|
||||
.value,
|
||||
}
|
||||
: row,
|
||||
),
|
||||
},
|
||||
)
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
))}
|
||||
<label>
|
||||
Classificação
|
||||
<select
|
||||
className={
|
||||
controlClass
|
||||
}
|
||||
value={
|
||||
r.classification
|
||||
}
|
||||
onChange={(e) =>
|
||||
form.setData(
|
||||
'annex',
|
||||
{
|
||||
...form
|
||||
.data
|
||||
.annex,
|
||||
requirements:
|
||||
form.data.annex.requirements.map(
|
||||
(
|
||||
row,
|
||||
i,
|
||||
) =>
|
||||
i ===
|
||||
index
|
||||
? {
|
||||
...row,
|
||||
classification:
|
||||
e
|
||||
.target
|
||||
.value,
|
||||
}
|
||||
: row,
|
||||
),
|
||||
},
|
||||
)
|
||||
}
|
||||
>
|
||||
<option value="mandatory">
|
||||
Obrigatório
|
||||
</option>
|
||||
<option value="desirable">
|
||||
Desejável
|
||||
</option>
|
||||
</select>
|
||||
</label>
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
onClick={() =>
|
||||
form.setData(
|
||||
'annex',
|
||||
{
|
||||
...form.data
|
||||
.annex,
|
||||
requirements:
|
||||
form.data.annex.requirements.filter(
|
||||
(
|
||||
_,
|
||||
i,
|
||||
) =>
|
||||
i !==
|
||||
index,
|
||||
),
|
||||
},
|
||||
)
|
||||
}
|
||||
>
|
||||
Retirar requisito
|
||||
</Button>
|
||||
</div>
|
||||
),
|
||||
)}
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
onClick={() =>
|
||||
form.setData('annex', {
|
||||
...form.data.annex,
|
||||
requirements: [
|
||||
...form.data.annex
|
||||
.requirements,
|
||||
{
|
||||
description: '',
|
||||
classification:
|
||||
'mandatory',
|
||||
verification: '',
|
||||
equivalences: '',
|
||||
},
|
||||
],
|
||||
})
|
||||
}
|
||||
>
|
||||
Adicionar requisito
|
||||
</Button>
|
||||
</fieldset>
|
||||
<Button disabled={form.processing}>
|
||||
Guardar para conferência da abertura
|
||||
</Button>
|
||||
</form>
|
||||
</Panel>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user