@@ -1,7 +1,10 @@
|
||||
import { Link, useForm } from "@inertiajs/react";
|
||||
import { useState } from "react";
|
||||
import { Management, Field, control, button } from "../management/shared";
|
||||
import { TerritoryFields, type TerritoryOption } from "@/components/investment-territory";
|
||||
import { Link, useForm } from '@inertiajs/react';
|
||||
import { useState } from 'react';
|
||||
import { Management, Field, control, button } from '../management/shared';
|
||||
import {
|
||||
TerritoryFields,
|
||||
type TerritoryOption,
|
||||
} from '@/components/investment-territory';
|
||||
export default function Analysis({
|
||||
demand,
|
||||
candidates,
|
||||
@@ -43,41 +46,47 @@ export default function Analysis({
|
||||
const [selectedTerritory, setSelectedTerritory] = useState(territoryPath);
|
||||
const form = useForm({
|
||||
demand_version: demand.version_no,
|
||||
sector_id: "",
|
||||
title: "",
|
||||
intervention: "",
|
||||
equipment_needs: "",
|
||||
trainer_needs: "",
|
||||
funding_plan: "",
|
||||
risks: "",
|
||||
source: "",
|
||||
currency: "MZN",
|
||||
province_id: territoryPath[0]?.id ?? "",
|
||||
district_id: territoryPath[1]?.id ?? "",
|
||||
admin_post_id: territoryPath[2]?.id ?? "",
|
||||
locality_id: territoryPath[3]?.id ?? "",
|
||||
sector_id: '',
|
||||
title: '',
|
||||
intervention: '',
|
||||
equipment_needs: '',
|
||||
trainer_needs: '',
|
||||
funding_plan: '',
|
||||
risks: '',
|
||||
source: '',
|
||||
currency: 'MZN',
|
||||
province_id: territoryPath[0]?.id ?? '',
|
||||
district_id: territoryPath[1]?.id ?? '',
|
||||
admin_post_id: territoryPath[2]?.id ?? '',
|
||||
locality_id: territoryPath[3]?.id ?? '',
|
||||
});
|
||||
return (
|
||||
<Management title="Análise assistida de competências">
|
||||
<p>
|
||||
Procura: {demand.quantity} trabalhadores · {demand.qualification}
|
||||
Procura: {demand.quantity} trabalhadores ·{' '}
|
||||
{demand.qualification}
|
||||
</p>
|
||||
<p>
|
||||
Localização da procura: {territoryPath.map((territory) => territory.name).join(" · ") || "Não indicada"}
|
||||
Localização da procura:{' '}
|
||||
{territoryPath.map((territory) => territory.name).join(' · ') ||
|
||||
'Não indicada'}
|
||||
</p>
|
||||
<p className="rounded border p-4">
|
||||
{gap.state === "expired"
|
||||
? "Fonte expirada. Actualize a declaração antes de analisar."
|
||||
{gap.state === 'expired'
|
||||
? 'Fonte expirada. Actualize a declaração antes de analisar.'
|
||||
: !eligible
|
||||
? "A procura exige revisão independente antes da análise."
|
||||
: "Lacuna quantitativa não determinada: falta evidência de trabalhadores qualificados e disponíveis. Vagas em cursos não são trabalhadores disponíveis."}
|
||||
? 'A procura exige revisão independente antes da análise.'
|
||||
: 'Lacuna quantitativa não determinada: falta evidência de trabalhadores qualificados e disponíveis. Vagas em cursos não são trabalhadores disponíveis.'}
|
||||
</p>
|
||||
<h2 className="text-xl font-semibold">Oferta potencialmente compatível</h2>
|
||||
<h2 className="text-xl font-semibold">
|
||||
Oferta potencialmente compatível
|
||||
</h2>
|
||||
<p>
|
||||
Critérios: mesma ocupação, competência principal, território e texto de
|
||||
qualificação; fonte vigente e revisão interna; conclusão até ao início da
|
||||
necessidade. Esta correspondência não comprova equivalência curricular, acreditação,
|
||||
conclusão ou contratação.
|
||||
Critérios: mesma ocupação, competência principal, território e
|
||||
texto de qualificação; fonte vigente e revisão interna;
|
||||
conclusão até ao início da necessidade. Esta correspondência não
|
||||
comprova equivalência curricular, acreditação, conclusão ou
|
||||
contratação.
|
||||
</p>
|
||||
{candidates.map((c) => (
|
||||
<article className="rounded border p-4" key={c.id}>
|
||||
@@ -89,34 +98,47 @@ export default function Analysis({
|
||||
))}
|
||||
{!candidates.length && (
|
||||
<p>
|
||||
Não há oferta que satisfaça estes critérios. Isto não prova ausência de
|
||||
instituições no território.
|
||||
Não há oferta que satisfaça estes critérios. Isto não prova
|
||||
ausência de instituições no território.
|
||||
</p>
|
||||
)}
|
||||
<p>
|
||||
As capacidades não são somadas nem alocadas: podem partilhar formadores, instalações
|
||||
ou equipamentos.
|
||||
As capacidades não são somadas nem alocadas: podem partilhar
|
||||
formadores, instalações ou equipamentos.
|
||||
</p>
|
||||
<section className="space-y-4 rounded border p-4">
|
||||
<h2 className="text-xl font-semibold">Preparação do investimento educativo</h2>
|
||||
<h2 className="text-xl font-semibold">
|
||||
Preparação do investimento educativo
|
||||
</h2>
|
||||
<p>
|
||||
A ficha permanece em rascunho até à validação institucional da lacuna e da
|
||||
resposta formativa. Não garante emprego ou financiamento.
|
||||
A ficha permanece em rascunho até à validação institucional
|
||||
da lacuna e da resposta formativa. Não garante emprego ou
|
||||
financiamento.
|
||||
</p>
|
||||
{proposal ? (
|
||||
<>
|
||||
{proposal.demand_version !== demand.version_no && (
|
||||
<p role="alert">
|
||||
A procura foi alterada desde a criação da ficha. É necessária
|
||||
reconciliação.
|
||||
A procura foi alterada desde a criação da ficha.
|
||||
É necessária reconciliação.
|
||||
</p>
|
||||
)}
|
||||
<p>{proposal.intervention}</p>
|
||||
<p>
|
||||
Equipamentos: {proposal.equipment_needs || "Pendente de levantamento"}
|
||||
Equipamentos:{' '}
|
||||
{proposal.equipment_needs ||
|
||||
'Pendente de levantamento'}
|
||||
</p>
|
||||
<p>
|
||||
Formadores:{' '}
|
||||
{proposal.trainer_needs ||
|
||||
'Pendente de levantamento'}
|
||||
</p>
|
||||
<p>
|
||||
Financiamento:{' '}
|
||||
{proposal.funding_plan ||
|
||||
'Pendente de levantamento'}
|
||||
</p>
|
||||
<p>Formadores: {proposal.trainer_needs || "Pendente de levantamento"}</p>
|
||||
<p>Financiamento: {proposal.funding_plan || "Pendente de levantamento"}</p>
|
||||
<p>Riscos: {proposal.risks}</p>
|
||||
<p>Fonte: {proposal.source}</p>
|
||||
<Link
|
||||
@@ -135,13 +157,19 @@ export default function Analysis({
|
||||
...data,
|
||||
demand_version: demand.version_no,
|
||||
}));
|
||||
form.post(`/management/education/demands/${demand.id}/investment`);
|
||||
form.post(
|
||||
`/management/education/demands/${demand.id}/investment`,
|
||||
);
|
||||
}}
|
||||
>
|
||||
<div className="space-y-2 md:col-span-2">
|
||||
<p className="font-medium">Localização da oportunidade educativa</p>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
Inicialmente preenchida com a localização da procura. Confirme ou ajuste cada nível territorial.
|
||||
<p className="font-medium">
|
||||
Localização da oportunidade educativa
|
||||
</p>
|
||||
<p className="text-muted-foreground text-sm">
|
||||
Inicialmente preenchida com a localização da
|
||||
procura. Confirme ou ajuste cada nível
|
||||
territorial.
|
||||
</p>
|
||||
<TerritoryFields
|
||||
initial={selectedTerritory}
|
||||
@@ -150,15 +178,15 @@ export default function Analysis({
|
||||
setSelectedTerritory(path);
|
||||
form.setData((data) => ({
|
||||
...data,
|
||||
province_id: path[0]?.id ?? "",
|
||||
district_id: path[1]?.id ?? "",
|
||||
admin_post_id: path[2]?.id ?? "",
|
||||
locality_id: path[3]?.id ?? "",
|
||||
province_id: path[0]?.id ?? '',
|
||||
district_id: path[1]?.id ?? '',
|
||||
admin_post_id: path[2]?.id ?? '',
|
||||
locality_id: path[3]?.id ?? '',
|
||||
}));
|
||||
}}
|
||||
/>
|
||||
{Object.entries(form.errors)
|
||||
.filter(([key]) => key.endsWith("_id"))
|
||||
.filter(([key]) => key.endsWith('_id'))
|
||||
.map(([key, error]) => (
|
||||
<p role="alert" key={key}>
|
||||
{error}
|
||||
@@ -170,7 +198,9 @@ export default function Analysis({
|
||||
required
|
||||
className={control}
|
||||
value={form.data.sector_id}
|
||||
onChange={(e) => form.setData("sector_id", e.target.value)}
|
||||
onChange={(e) =>
|
||||
form.setData('sector_id', e.target.value)
|
||||
}
|
||||
>
|
||||
<option value="">Seleccionar sector</option>
|
||||
{sectors.map((s) => (
|
||||
@@ -186,37 +216,49 @@ export default function Analysis({
|
||||
maxLength={200}
|
||||
className={control}
|
||||
value={form.data.title}
|
||||
onChange={(e) => form.setData("title", e.target.value)}
|
||||
onChange={(e) =>
|
||||
form.setData('title', e.target.value)
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
{(
|
||||
[
|
||||
"intervention",
|
||||
"equipment_needs",
|
||||
"trainer_needs",
|
||||
"funding_plan",
|
||||
"risks",
|
||||
"source",
|
||||
'intervention',
|
||||
'equipment_needs',
|
||||
'trainer_needs',
|
||||
'funding_plan',
|
||||
'risks',
|
||||
'source',
|
||||
] as const
|
||||
).map((key) => (
|
||||
<Field
|
||||
key={key}
|
||||
label={
|
||||
{
|
||||
intervention: "Resposta formativa proposta",
|
||||
equipment_needs: "Necessidades de equipamentos (opcional)",
|
||||
trainer_needs: "Necessidades de formadores (opcional)",
|
||||
funding_plan: "Financiamento e sustentabilidade (opcional)",
|
||||
risks: "Riscos e limitações",
|
||||
source: "Fonte e responsável pela proposta",
|
||||
intervention:
|
||||
'Resposta formativa proposta',
|
||||
equipment_needs:
|
||||
'Necessidades de equipamentos (opcional)',
|
||||
trainer_needs:
|
||||
'Necessidades de formadores (opcional)',
|
||||
funding_plan:
|
||||
'Financiamento e sustentabilidade (opcional)',
|
||||
risks: 'Riscos e limitações',
|
||||
source: 'Fonte e responsável pela proposta',
|
||||
}[key]
|
||||
}
|
||||
>
|
||||
<textarea
|
||||
required={["intervention", "risks", "source"].includes(key)}
|
||||
required={[
|
||||
'intervention',
|
||||
'risks',
|
||||
'source',
|
||||
].includes(key)}
|
||||
className={control}
|
||||
value={form.data[key]}
|
||||
onChange={(e) => form.setData(key, e.target.value)}
|
||||
onChange={(e) =>
|
||||
form.setData(key, e.target.value)
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
))}
|
||||
@@ -224,9 +266,11 @@ export default function Analysis({
|
||||
<select
|
||||
className={control}
|
||||
value={form.data.currency}
|
||||
onChange={(e) => form.setData("currency", e.target.value)}
|
||||
onChange={(e) =>
|
||||
form.setData('currency', e.target.value)
|
||||
}
|
||||
>
|
||||
{["MZN", "USD", "EUR", "ZAR"].map((c) => (
|
||||
{['MZN', 'USD', 'EUR', 'ZAR'].map((c) => (
|
||||
<option key={c}>{c}</option>
|
||||
))}
|
||||
</select>
|
||||
@@ -237,13 +281,19 @@ export default function Analysis({
|
||||
{value}
|
||||
</p>
|
||||
))}
|
||||
<button className={button} disabled={form.processing}>
|
||||
<button
|
||||
className={button}
|
||||
disabled={form.processing}
|
||||
>
|
||||
Guardar ficha em rascunho
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
) : (
|
||||
<p>Reveja a procura e a validade da fonte antes de preparar a ficha.</p>
|
||||
<p>
|
||||
Reveja a procura e a validade da fonte antes de preparar
|
||||
a ficha.
|
||||
</p>
|
||||
)}
|
||||
</section>
|
||||
</Management>
|
||||
|
||||
@@ -1,8 +1,17 @@
|
||||
import { Link, useForm } from "@inertiajs/react";
|
||||
import { useState } from "react";
|
||||
import { Management, Field, control, button, Pagination } from "../management/shared";
|
||||
import type { Paginated } from "../management/shared";
|
||||
import { TerritoryFields, type TerritoryOption } from "@/components/investment-territory";
|
||||
import { Link, useForm } from '@inertiajs/react';
|
||||
import { useState } from 'react';
|
||||
import {
|
||||
Management,
|
||||
Field,
|
||||
control,
|
||||
button,
|
||||
Pagination,
|
||||
} from '../management/shared';
|
||||
import type { Paginated } from '../management/shared';
|
||||
import {
|
||||
TerritoryFields,
|
||||
type TerritoryOption,
|
||||
} from '@/components/investment-territory';
|
||||
type Option = { id: string; name?: string; title?: string; code?: string };
|
||||
type RecordRow = {
|
||||
id: string;
|
||||
@@ -33,14 +42,20 @@ type Props = {
|
||||
pending_demands: number;
|
||||
};
|
||||
};
|
||||
const territoryLevels = ["province", "district", "admin_post", "locality"];
|
||||
const territoryLevels = ['province', 'district', 'admin_post', 'locality'];
|
||||
|
||||
function territoryPath(id: string, territories: TerritoryOption[]): TerritoryOption[] {
|
||||
const byId = new Map(territories.map((territory) => [territory.id, territory]));
|
||||
function territoryPath(
|
||||
id: string,
|
||||
territories: TerritoryOption[],
|
||||
): TerritoryOption[] {
|
||||
const byId = new Map(
|
||||
territories.map((territory) => [territory.id, territory]),
|
||||
);
|
||||
const path: TerritoryOption[] = [];
|
||||
let current = byId.get(id);
|
||||
while (current && path.length < territoryLevels.length) {
|
||||
if (territoryLevels.includes(current.location_type)) path.unshift(current);
|
||||
if (territoryLevels.includes(current.location_type))
|
||||
path.unshift(current);
|
||||
current = current.parent_id ? byId.get(current.parent_id) : undefined;
|
||||
}
|
||||
return path;
|
||||
@@ -79,7 +94,7 @@ function Select({
|
||||
<option value="">Seleccione</option>
|
||||
{options.map((o) => (
|
||||
<option key={o.id} value={o.id}>
|
||||
{o.code ? `${o.code} — ` : ""}
|
||||
{o.code ? `${o.code} — ` : ''}
|
||||
{o.name ?? o.title}
|
||||
</option>
|
||||
))}
|
||||
@@ -87,8 +102,16 @@ function Select({
|
||||
</Field>
|
||||
);
|
||||
}
|
||||
function Catalog({ kind, title, providers }: { kind: string; title: string; providers: Option[] }) {
|
||||
const form = useForm({ name: "", title: "", code: "", provider_id: "" });
|
||||
function Catalog({
|
||||
kind,
|
||||
title,
|
||||
providers,
|
||||
}: {
|
||||
kind: string;
|
||||
title: string;
|
||||
providers: Option[];
|
||||
}) {
|
||||
const form = useForm({ name: '', title: '', code: '', provider_id: '' });
|
||||
return (
|
||||
<details className="rounded border p-4">
|
||||
<summary className="cursor-pointer font-semibold">{title}</summary>
|
||||
@@ -105,28 +128,37 @@ function Catalog({ kind, title, providers }: { kind: string; title: string; prov
|
||||
<input
|
||||
className={control}
|
||||
required
|
||||
value={kind === "courses" ? form.data.title : form.data.name}
|
||||
value={
|
||||
kind === 'courses'
|
||||
? form.data.title
|
||||
: form.data.name
|
||||
}
|
||||
onChange={(e) =>
|
||||
form.setData(kind === "courses" ? "title" : "name", e.target.value)
|
||||
form.setData(
|
||||
kind === 'courses' ? 'title' : 'name',
|
||||
e.target.value,
|
||||
)
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
{kind !== "providers" && (
|
||||
{kind !== 'providers' && (
|
||||
<Field label="Código">
|
||||
<input
|
||||
className={control}
|
||||
required
|
||||
value={form.data.code}
|
||||
onChange={(e) => form.setData("code", e.target.value)}
|
||||
onChange={(e) =>
|
||||
form.setData('code', e.target.value)
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
)}
|
||||
{kind === "courses" && (
|
||||
{kind === 'courses' && (
|
||||
<Select
|
||||
label="Instituição"
|
||||
value={form.data.provider_id}
|
||||
options={providers}
|
||||
onChange={(v) => form.setData("provider_id", v)}
|
||||
onChange={(v) => form.setData('provider_id', v)}
|
||||
/>
|
||||
)}
|
||||
<Errors errors={form.errors} />
|
||||
@@ -137,28 +169,36 @@ function Catalog({ kind, title, providers }: { kind: string; title: string; prov
|
||||
</details>
|
||||
);
|
||||
}
|
||||
function Intake({ kind, props }: { kind: "demands" | "capacities"; props: Props }) {
|
||||
const demand = kind === "demands";
|
||||
function Intake({
|
||||
kind,
|
||||
props,
|
||||
}: {
|
||||
kind: 'demands' | 'capacities';
|
||||
props: Props;
|
||||
}) {
|
||||
const demand = kind === 'demands';
|
||||
const [territoryResetKey, setTerritoryResetKey] = useState(0);
|
||||
const form = useForm({
|
||||
project_id: "",
|
||||
course_id: "",
|
||||
occupation_id: "",
|
||||
skill_id: "",
|
||||
geo_location_id: "",
|
||||
employer: "",
|
||||
qualification: "",
|
||||
quantity: "",
|
||||
period_start: "",
|
||||
period_end: "",
|
||||
source: "",
|
||||
project_id: '',
|
||||
course_id: '',
|
||||
occupation_id: '',
|
||||
skill_id: '',
|
||||
geo_location_id: '',
|
||||
employer: '',
|
||||
qualification: '',
|
||||
quantity: '',
|
||||
period_start: '',
|
||||
period_end: '',
|
||||
source: '',
|
||||
reference_date: props.today,
|
||||
valid_until: "",
|
||||
valid_until: '',
|
||||
});
|
||||
return (
|
||||
<details className="rounded border p-4">
|
||||
<summary className="cursor-pointer font-semibold">
|
||||
{demand ? "Declarar procura de trabalhadores" : "Declarar vagas de formação"}
|
||||
{demand
|
||||
? 'Declarar procura de trabalhadores'
|
||||
: 'Declarar vagas de formação'}
|
||||
</summary>
|
||||
<form
|
||||
className="mt-4 grid gap-4 md:grid-cols-2"
|
||||
@@ -173,29 +213,34 @@ function Intake({ kind, props }: { kind: "demands" | "capacities"; props: Props
|
||||
}}
|
||||
>
|
||||
<Select
|
||||
label={demand ? "Projecto" : "Curso"}
|
||||
label={demand ? 'Projecto' : 'Curso'}
|
||||
options={demand ? props.projects : props.courses}
|
||||
value={demand ? form.data.project_id : form.data.course_id}
|
||||
onChange={(v) => form.setData(demand ? "project_id" : "course_id", v)}
|
||||
onChange={(v) =>
|
||||
form.setData(demand ? 'project_id' : 'course_id', v)
|
||||
}
|
||||
/>
|
||||
<Select
|
||||
label="Ocupação"
|
||||
options={props.occupations}
|
||||
value={form.data.occupation_id}
|
||||
onChange={(v) => form.setData("occupation_id", v)}
|
||||
onChange={(v) => form.setData('occupation_id', v)}
|
||||
/>
|
||||
<Select
|
||||
label="Competência principal"
|
||||
options={props.skills}
|
||||
value={form.data.skill_id}
|
||||
onChange={(v) => form.setData("skill_id", v)}
|
||||
onChange={(v) => form.setData('skill_id', v)}
|
||||
/>
|
||||
<div className="md:col-span-2">
|
||||
<TerritoryFields
|
||||
key={territoryResetKey}
|
||||
endpoint="/management/territory-options"
|
||||
onChange={(path) =>
|
||||
form.setData("geo_location_id", path[path.length - 1]?.id ?? "")
|
||||
form.setData(
|
||||
'geo_location_id',
|
||||
path[path.length - 1]?.id ?? '',
|
||||
)
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
@@ -205,7 +250,9 @@ function Intake({ kind, props }: { kind: "demands" | "capacities"; props: Props
|
||||
className={control}
|
||||
required
|
||||
value={form.data.employer}
|
||||
onChange={(e) => form.setData("employer", e.target.value)}
|
||||
onChange={(e) =>
|
||||
form.setData('employer', e.target.value)
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
)}
|
||||
@@ -214,14 +261,16 @@ function Intake({ kind, props }: { kind: "demands" | "capacities"; props: Props
|
||||
className={control}
|
||||
required
|
||||
value={form.data.qualification}
|
||||
onChange={(e) => form.setData("qualification", e.target.value)}
|
||||
onChange={(e) =>
|
||||
form.setData('qualification', e.target.value)
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
<Field
|
||||
label={
|
||||
demand
|
||||
? "Trabalhadores necessários"
|
||||
: "Vagas disponíveis (não trabalhadores)"
|
||||
? 'Trabalhadores necessários'
|
||||
: 'Vagas disponíveis (não trabalhadores)'
|
||||
}
|
||||
>
|
||||
<input
|
||||
@@ -230,43 +279,50 @@ function Intake({ kind, props }: { kind: "demands" | "capacities"; props: Props
|
||||
min="1"
|
||||
required
|
||||
value={form.data.quantity}
|
||||
onChange={(e) => form.setData("quantity", e.target.value)}
|
||||
onChange={(e) =>
|
||||
form.setData('quantity', e.target.value)
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
{(["period_start", "period_end", "reference_date", "valid_until"] as const).map(
|
||||
(key) => (
|
||||
<Field
|
||||
key={key}
|
||||
label={
|
||||
{
|
||||
period_start: demand
|
||||
? "Início da necessidade"
|
||||
: "Início da formação",
|
||||
period_end: demand
|
||||
? "Fim da necessidade"
|
||||
: "Conclusão prevista",
|
||||
reference_date: "Data de referência da fonte",
|
||||
valid_until: "Fonte válida até",
|
||||
}[key]
|
||||
}
|
||||
>
|
||||
<input
|
||||
className={control}
|
||||
type="date"
|
||||
required
|
||||
value={form.data[key]}
|
||||
onChange={(e) => form.setData(key, e.target.value)}
|
||||
/>
|
||||
</Field>
|
||||
),
|
||||
)}
|
||||
{(
|
||||
[
|
||||
'period_start',
|
||||
'period_end',
|
||||
'reference_date',
|
||||
'valid_until',
|
||||
] as const
|
||||
).map((key) => (
|
||||
<Field
|
||||
key={key}
|
||||
label={
|
||||
{
|
||||
period_start: demand
|
||||
? 'Início da necessidade'
|
||||
: 'Início da formação',
|
||||
period_end: demand
|
||||
? 'Fim da necessidade'
|
||||
: 'Conclusão prevista',
|
||||
reference_date: 'Data de referência da fonte',
|
||||
valid_until: 'Fonte válida até',
|
||||
}[key]
|
||||
}
|
||||
>
|
||||
<input
|
||||
className={control}
|
||||
type="date"
|
||||
required
|
||||
value={form.data[key]}
|
||||
onChange={(e) => form.setData(key, e.target.value)}
|
||||
/>
|
||||
</Field>
|
||||
))}
|
||||
<Field label="Fonte, referência da evidência e responsável pelos dados">
|
||||
<textarea
|
||||
className={control}
|
||||
required
|
||||
minLength={10}
|
||||
value={form.data.source}
|
||||
onChange={(e) => form.setData("source", e.target.value)}
|
||||
onChange={(e) => form.setData('source', e.target.value)}
|
||||
/>
|
||||
</Field>
|
||||
<div>
|
||||
@@ -279,32 +335,40 @@ function Intake({ kind, props }: { kind: "demands" | "capacities"; props: Props
|
||||
</details>
|
||||
);
|
||||
}
|
||||
function Review({ row, kind, today }: { row: RecordRow; kind: string; today: string }) {
|
||||
function Review({
|
||||
row,
|
||||
kind,
|
||||
today,
|
||||
}: {
|
||||
row: RecordRow;
|
||||
kind: string;
|
||||
today: string;
|
||||
}) {
|
||||
const form = useForm({
|
||||
version_no: row.version_no,
|
||||
status: "reviewed",
|
||||
review_reason: "",
|
||||
status: 'reviewed',
|
||||
review_reason: '',
|
||||
});
|
||||
return (
|
||||
<article className="space-y-3 rounded border p-4">
|
||||
<p className="font-semibold">
|
||||
{row.qualification} · {row.quantity}{" "}
|
||||
{kind === "demands" ? "trabalhadores" : "vagas formativas"}
|
||||
{row.qualification} · {row.quantity}{' '}
|
||||
{kind === 'demands' ? 'trabalhadores' : 'vagas formativas'}
|
||||
</p>
|
||||
<p>
|
||||
{row.period_start} a {row.period_end} ·{" "}
|
||||
{row.period_start} a {row.period_end} ·{' '}
|
||||
{row.valid_until < today
|
||||
? "Fonte expirada"
|
||||
? 'Fonte expirada'
|
||||
: (
|
||||
{
|
||||
submitted: "Submetido",
|
||||
reviewed: "Revisto internamente",
|
||||
rejected: "Rejeitado",
|
||||
submitted: 'Submetido',
|
||||
reviewed: 'Revisto internamente',
|
||||
rejected: 'Rejeitado',
|
||||
} as Record<string, string>
|
||||
)[row.status]}
|
||||
</p>
|
||||
<p className="break-words">Fonte: {row.source}</p>
|
||||
{kind === "demands" && (
|
||||
{kind === 'demands' && (
|
||||
<Link
|
||||
className="underline"
|
||||
href={`/management/education/demands/${row.id}/analysis`}
|
||||
@@ -322,17 +386,23 @@ function Review({ row, kind, today }: { row: RecordRow; kind: string; today: str
|
||||
...data,
|
||||
version_no: row.version_no,
|
||||
}));
|
||||
form.post(`/management/education/${kind}/${row.id}/review`);
|
||||
form.post(
|
||||
`/management/education/${kind}/${row.id}/review`,
|
||||
);
|
||||
}}
|
||||
>
|
||||
<Field label="Decisão interna">
|
||||
<select
|
||||
className={control}
|
||||
value={form.data.status}
|
||||
onChange={(e) => form.setData("status", e.target.value)}
|
||||
onChange={(e) =>
|
||||
form.setData('status', e.target.value)
|
||||
}
|
||||
>
|
||||
<option value="reviewed">Registar revisão</option>
|
||||
<option value="rejected">Rejeitar declaração</option>
|
||||
<option value="rejected">
|
||||
Rejeitar declaração
|
||||
</option>
|
||||
</select>
|
||||
</Field>
|
||||
<Field label="Justificação e evidência da revisão">
|
||||
@@ -341,7 +411,9 @@ function Review({ row, kind, today }: { row: RecordRow; kind: string; today: str
|
||||
minLength={15}
|
||||
required
|
||||
value={form.data.review_reason}
|
||||
onChange={(e) => form.setData("review_reason", e.target.value)}
|
||||
onChange={(e) =>
|
||||
form.setData('review_reason', e.target.value)
|
||||
}
|
||||
/>
|
||||
</Field>
|
||||
<Errors errors={form.errors} />
|
||||
@@ -355,39 +427,50 @@ function Review({ row, kind, today }: { row: RecordRow; kind: string; today: str
|
||||
}
|
||||
export default function Index(props: Props) {
|
||||
const search = useForm({
|
||||
q: props.filters.q ?? "",
|
||||
status: props.filters.status ?? "",
|
||||
geo_location_id: props.filters.geo_location_id ?? "",
|
||||
q: props.filters.q ?? '',
|
||||
status: props.filters.status ?? '',
|
||||
geo_location_id: props.filters.geo_location_id ?? '',
|
||||
});
|
||||
return (
|
||||
<Management title="Competências e investimento em educação">
|
||||
<p>
|
||||
Declarações internas de procura e oferta. A revisão não constitui acreditação,
|
||||
certificação ou validação institucional. Não introduza dados pessoais de formandos.
|
||||
Declarações internas de procura e oferta. A revisão não
|
||||
constitui acreditação, certificação ou validação institucional.
|
||||
Não introduza dados pessoais de formandos.
|
||||
</p>
|
||||
<section aria-label="Indicadores internos" className="grid gap-4 md:grid-cols-4">
|
||||
<section
|
||||
aria-label="Indicadores internos"
|
||||
className="grid gap-4 md:grid-cols-4"
|
||||
>
|
||||
<p>
|
||||
Declarações de procura: <strong>{props.indicators.demand_records}</strong>
|
||||
Declarações de procura:{' '}
|
||||
<strong>{props.indicators.demand_records}</strong>
|
||||
</p>
|
||||
<p>
|
||||
Declarações de oferta: <strong>{props.indicators.capacity_records}</strong>
|
||||
Declarações de oferta:{' '}
|
||||
<strong>{props.indicators.capacity_records}</strong>
|
||||
</p>
|
||||
<p>
|
||||
Procuras a rever: <strong>{props.indicators.pending_demands}</strong>
|
||||
Procuras a rever:{' '}
|
||||
<strong>{props.indicators.pending_demands}</strong>
|
||||
</p>
|
||||
<p>
|
||||
Procuras com fonte expirada: <strong>{props.indicators.expired_demands}</strong>
|
||||
Procuras com fonte expirada:{' '}
|
||||
<strong>{props.indicators.expired_demands}</strong>
|
||||
</p>
|
||||
</section>
|
||||
<p>
|
||||
Indicadores globais de registos internos, sem aplicação dos filtros. Não representam
|
||||
totais de trabalhadores, lacunas validadas ou resultados educativos.
|
||||
Indicadores globais de registos internos, sem aplicação dos
|
||||
filtros. Não representam totais de trabalhadores, lacunas
|
||||
validadas ou resultados educativos.
|
||||
</p>
|
||||
<form
|
||||
className="grid gap-4 md:grid-cols-4"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
search.get("/management/education", { preserveState: true });
|
||||
search.get('/management/education', {
|
||||
preserveState: true,
|
||||
});
|
||||
}}
|
||||
>
|
||||
<Field label="Pesquisar qualificação">
|
||||
@@ -395,28 +478,40 @@ export default function Index(props: Props) {
|
||||
className={control}
|
||||
maxLength={150}
|
||||
value={search.data.q}
|
||||
onChange={(e) => search.setData("q", e.target.value)}
|
||||
onChange={(e) => search.setData('q', e.target.value)}
|
||||
/>
|
||||
</Field>
|
||||
<Field label="Estado">
|
||||
<select
|
||||
className={control}
|
||||
value={search.data.status}
|
||||
onChange={(e) => search.setData("status", e.target.value)}
|
||||
onChange={(e) =>
|
||||
search.setData('status', e.target.value)
|
||||
}
|
||||
>
|
||||
<option value="">Todos</option>
|
||||
<option value="submitted">Por rever, fonte vigente</option>
|
||||
<option value="submitted">
|
||||
Por rever, fonte vigente
|
||||
</option>
|
||||
<option value="reviewed">Revisto, fonte vigente</option>
|
||||
<option value="rejected">Rejeitado, fonte vigente</option>
|
||||
<option value="rejected">
|
||||
Rejeitado, fonte vigente
|
||||
</option>
|
||||
<option value="expired">Fonte expirada</option>
|
||||
</select>
|
||||
</Field>
|
||||
<div className="md:col-span-2">
|
||||
<TerritoryFields
|
||||
initial={territoryPath(search.data.geo_location_id, props.territories)}
|
||||
initial={territoryPath(
|
||||
search.data.geo_location_id,
|
||||
props.territories,
|
||||
)}
|
||||
endpoint="/management/territory-options"
|
||||
onChange={(path) =>
|
||||
search.setData("geo_location_id", path[path.length - 1]?.id ?? "")
|
||||
search.setData(
|
||||
'geo_location_id',
|
||||
path[path.length - 1]?.id ?? '',
|
||||
)
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
@@ -424,7 +519,10 @@ export default function Index(props: Props) {
|
||||
<button className={button} disabled={search.processing}>
|
||||
Filtrar
|
||||
</button>
|
||||
<Link className="ml-3 underline" href="/management/education">
|
||||
<Link
|
||||
className="ml-3 underline"
|
||||
href="/management/education"
|
||||
>
|
||||
Limpar
|
||||
</Link>
|
||||
<Errors errors={search.errors} />
|
||||
@@ -432,25 +530,35 @@ export default function Index(props: Props) {
|
||||
</form>
|
||||
<section className="grid gap-3 md:grid-cols-2">
|
||||
{[
|
||||
["skills", "Competências"],
|
||||
["occupations", "Ocupações"],
|
||||
["providers", "Instituições"],
|
||||
["courses", "Cursos"],
|
||||
['skills', 'Competências'],
|
||||
['occupations', 'Ocupações'],
|
||||
['providers', 'Instituições'],
|
||||
['courses', 'Cursos'],
|
||||
].map(([kind, title]) => (
|
||||
<Catalog key={kind} kind={kind} title={title} providers={props.providers} />
|
||||
<Catalog
|
||||
key={kind}
|
||||
kind={kind}
|
||||
title={title}
|
||||
providers={props.providers}
|
||||
/>
|
||||
))}
|
||||
</section>
|
||||
<Intake kind="demands" props={props} />
|
||||
<Intake kind="capacities" props={props} />
|
||||
{(["demands", "capacities"] as const).map((kind) => (
|
||||
{(['demands', 'capacities'] as const).map((kind) => (
|
||||
<section key={kind} className="space-y-3">
|
||||
<h2 className="text-xl font-semibold">
|
||||
{kind === "demands"
|
||||
? "Procura de mão-de-obra"
|
||||
: "Oferta formativa declarada"}
|
||||
{kind === 'demands'
|
||||
? 'Procura de mão-de-obra'
|
||||
: 'Oferta formativa declarada'}
|
||||
</h2>
|
||||
{props[kind].data.map((row) => (
|
||||
<Review key={row.id} row={row} kind={kind} today={props.today} />
|
||||
<Review
|
||||
key={row.id}
|
||||
row={row}
|
||||
kind={kind}
|
||||
today={props.today}
|
||||
/>
|
||||
))}
|
||||
{!props[kind].data.length && <p>Ainda sem declarações.</p>}
|
||||
<Pagination page={props[kind]} />
|
||||
|
||||
Reference in New Issue
Block a user