@@ -0,0 +1,178 @@
|
||||
import { Head, Link, useForm } from '@inertiajs/react';
|
||||
import { useEffect } from 'react';
|
||||
import { FormErrors, controlClass } from '@/components/procurement';
|
||||
import { Button } from '@/components/ui/button';
|
||||
|
||||
export default function Access({
|
||||
companyId,
|
||||
purpose,
|
||||
accessStatus,
|
||||
emailDeliveryAvailable,
|
||||
}: {
|
||||
companyId: number;
|
||||
purpose: string;
|
||||
accessStatus: string | null;
|
||||
emailDeliveryAvailable: boolean;
|
||||
}) {
|
||||
const recovery = useForm({ email: '' });
|
||||
const confirmation = useForm({
|
||||
token: '',
|
||||
password: '',
|
||||
password_confirmation: '',
|
||||
});
|
||||
const { setData } = confirmation;
|
||||
useEffect(() => {
|
||||
const token = new URLSearchParams(window.location.hash.slice(1)).get(
|
||||
'token',
|
||||
);
|
||||
if (token) setData('token', token);
|
||||
}, [setData]);
|
||||
const verify = purpose === 'confirmar-email';
|
||||
return (
|
||||
<>
|
||||
<Head title={verify ? 'Confirmar email' : 'Recuperar acesso'} />
|
||||
<main className="mx-auto max-w-xl space-y-5 p-6">
|
||||
<h1 className="text-3xl font-semibold">
|
||||
{verify ? 'Confirmar email' : 'Recuperar acesso'}
|
||||
</h1>
|
||||
<Link className="underline" href={`/candidaturas/${companyId}`}>
|
||||
Entrada de candidatos
|
||||
</Link>
|
||||
{accessStatus === 'completed' ? (
|
||||
<p>
|
||||
{verify
|
||||
? 'Email confirmado. Esta confirmação não verifica a identidade nem constitui candidatura.'
|
||||
: 'Palavra-passe actualizada. Entre novamente; as sessões anteriores perderam o acesso.'}
|
||||
</p>
|
||||
) : (
|
||||
<>
|
||||
{accessStatus === 'requested' && (
|
||||
<p>
|
||||
Se existir uma conta e o envio estiver
|
||||
disponível, receberá uma ligação temporária no
|
||||
email indicado.
|
||||
</p>
|
||||
)}
|
||||
{!emailDeliveryAvailable && (
|
||||
<p>
|
||||
O envio de email ainda não está configurado. O
|
||||
perfil e a entrada com a palavra-passe actual
|
||||
continuam disponíveis.
|
||||
</p>
|
||||
)}
|
||||
{confirmation.data.token ? (
|
||||
<form
|
||||
className="space-y-4"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
confirmation.post(
|
||||
`/candidaturas/${companyId}/${purpose}`,
|
||||
{
|
||||
preserveState: false,
|
||||
onFinish: () =>
|
||||
confirmation.reset(
|
||||
'password',
|
||||
'password_confirmation',
|
||||
),
|
||||
},
|
||||
);
|
||||
}}
|
||||
>
|
||||
<FormErrors errors={confirmation.errors} />
|
||||
{!verify && (
|
||||
<>
|
||||
<label className="grid gap-2">
|
||||
Nova palavra-passe
|
||||
<input
|
||||
className={controlClass}
|
||||
type="password"
|
||||
autoComplete="new-password"
|
||||
required
|
||||
minLength={12}
|
||||
maxLength={128}
|
||||
value={
|
||||
confirmation.data.password
|
||||
}
|
||||
onChange={(e) =>
|
||||
confirmation.setData(
|
||||
'password',
|
||||
e.target.value,
|
||||
)
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
<label className="grid gap-2">
|
||||
Confirmar palavra-passe
|
||||
<input
|
||||
className={controlClass}
|
||||
type="password"
|
||||
autoComplete="new-password"
|
||||
required
|
||||
value={
|
||||
confirmation.data
|
||||
.password_confirmation
|
||||
}
|
||||
onChange={(e) =>
|
||||
confirmation.setData(
|
||||
'password_confirmation',
|
||||
e.target.value,
|
||||
)
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
</>
|
||||
)}
|
||||
<Button disabled={confirmation.processing}>
|
||||
{verify
|
||||
? 'Confirmar o meu email'
|
||||
: 'Definir nova palavra-passe'}
|
||||
</Button>
|
||||
</form>
|
||||
) : !verify ? (
|
||||
<form
|
||||
className="space-y-4"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
recovery.post(
|
||||
`/candidaturas/${companyId}/pedir-recuperacao`,
|
||||
);
|
||||
}}
|
||||
>
|
||||
<FormErrors errors={recovery.errors} />
|
||||
<label className="grid gap-2">
|
||||
Email da conta
|
||||
<input
|
||||
className={controlClass}
|
||||
type="email"
|
||||
required
|
||||
autoComplete="email"
|
||||
value={recovery.data.email}
|
||||
onChange={(e) =>
|
||||
recovery.setData(
|
||||
'email',
|
||||
e.target.value,
|
||||
)
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
<Button
|
||||
disabled={
|
||||
recovery.processing ||
|
||||
!emailDeliveryAvailable
|
||||
}
|
||||
>
|
||||
Pedir ligação de recuperação
|
||||
</Button>
|
||||
</form>
|
||||
) : (
|
||||
<p>
|
||||
Abra a ligação recebida no seu email. Pode pedir
|
||||
outra na sua área de perfil.
|
||||
</p>
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
</main>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,189 @@
|
||||
import { Head, Link, useForm } from '@inertiajs/react';
|
||||
import { FormErrors, controlClass } from '@/components/procurement';
|
||||
import { Button } from '@/components/ui/button';
|
||||
|
||||
export default function Entry({
|
||||
company,
|
||||
portal,
|
||||
}: {
|
||||
company: { id: number; name: string };
|
||||
portal: { version: number; registration_open: boolean; notice: string };
|
||||
}) {
|
||||
const login = useForm({ email: '', password: '' });
|
||||
const register = useForm({
|
||||
email: '',
|
||||
password: '',
|
||||
password_confirmation: '',
|
||||
portal_version: portal.version,
|
||||
notice_acknowledged: false,
|
||||
});
|
||||
const credentials = (form: typeof login, prefix: string) => (
|
||||
<>
|
||||
<label className="grid gap-2">
|
||||
Email
|
||||
<input
|
||||
className={controlClass}
|
||||
type="email"
|
||||
required
|
||||
autoComplete="email"
|
||||
value={form.data.email}
|
||||
onChange={(e) => form.setData('email', e.target.value)}
|
||||
/>
|
||||
</label>
|
||||
<label className="grid gap-2">
|
||||
Palavra-passe
|
||||
<input
|
||||
className={controlClass}
|
||||
type="password"
|
||||
required
|
||||
autoComplete={
|
||||
prefix === 'login' ? 'current-password' : 'new-password'
|
||||
}
|
||||
value={form.data.password}
|
||||
onChange={(e) => form.setData('password', e.target.value)}
|
||||
/>
|
||||
</label>
|
||||
</>
|
||||
);
|
||||
return (
|
||||
<>
|
||||
<Head title="Área do candidato" />
|
||||
<Link
|
||||
href={`/candidaturas/${company.id}/recuperar`}
|
||||
className="m-5 inline-block underline"
|
||||
>
|
||||
Recuperar acesso
|
||||
</Link>
|
||||
<main className="mx-auto max-w-3xl space-y-6 p-6">
|
||||
<p>SGC · Uma solução TEMPO</p>
|
||||
<h1 className="text-3xl font-semibold">
|
||||
Área do candidato · {company.name}
|
||||
</h1>
|
||||
<p>
|
||||
Prepare o seu perfil e candidate-se às oportunidades
|
||||
publicadas. O envio de anexos ainda está em desenvolvimento.
|
||||
Criar um perfil não constitui candidatura ou contratação.
|
||||
</p>
|
||||
<section className="space-y-3">
|
||||
<h2 className="text-xl font-semibold">Entrar</h2>
|
||||
<form
|
||||
className="space-y-3"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
login.post(`/candidaturas/${company.id}/entrar`, {
|
||||
onFinish: () => login.reset('password'),
|
||||
});
|
||||
}}
|
||||
>
|
||||
<FormErrors errors={login.errors} />
|
||||
{credentials(login, 'login')}
|
||||
<Button disabled={login.processing}>
|
||||
Entrar na minha área
|
||||
</Button>
|
||||
</form>
|
||||
</section>
|
||||
<section className="space-y-3">
|
||||
<h2 className="text-xl font-semibold">Criar conta</h2>
|
||||
<p className="whitespace-pre-wrap">{portal.notice}</p>
|
||||
{portal.registration_open ? (
|
||||
<form
|
||||
className="space-y-3"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
register.post(
|
||||
`/candidaturas/${company.id}/registar`,
|
||||
{
|
||||
onFinish: () =>
|
||||
register.reset(
|
||||
'password',
|
||||
'password_confirmation',
|
||||
),
|
||||
},
|
||||
);
|
||||
}}
|
||||
>
|
||||
<FormErrors errors={register.errors} />
|
||||
<label className="grid gap-2">
|
||||
Email
|
||||
<input
|
||||
className={controlClass}
|
||||
type="email"
|
||||
autoComplete="email"
|
||||
required
|
||||
value={register.data.email}
|
||||
onChange={(e) =>
|
||||
register.setData(
|
||||
'email',
|
||||
e.target.value,
|
||||
)
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
<label className="grid gap-2">
|
||||
Palavra-passe (mínimo 12 caracteres)
|
||||
<input
|
||||
className={controlClass}
|
||||
type="password"
|
||||
autoComplete="new-password"
|
||||
minLength={12}
|
||||
maxLength={128}
|
||||
required
|
||||
value={register.data.password}
|
||||
onChange={(e) =>
|
||||
register.setData(
|
||||
'password',
|
||||
e.target.value,
|
||||
)
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
<label className="grid gap-2">
|
||||
Confirmar palavra-passe
|
||||
<input
|
||||
className={controlClass}
|
||||
type="password"
|
||||
autoComplete="new-password"
|
||||
required
|
||||
value={register.data.password_confirmation}
|
||||
onChange={(e) =>
|
||||
register.setData(
|
||||
'password_confirmation',
|
||||
e.target.value,
|
||||
)
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
<label className="flex gap-2">
|
||||
<input
|
||||
type="checkbox"
|
||||
required
|
||||
checked={register.data.notice_acknowledged}
|
||||
onChange={(e) =>
|
||||
register.setData(
|
||||
'notice_acknowledged',
|
||||
e.target.checked,
|
||||
)
|
||||
}
|
||||
/>
|
||||
Tomei conhecimento do aviso apresentado, versão{' '}
|
||||
{portal.version}.
|
||||
</label>
|
||||
<p className="text-sm">
|
||||
Este registo não autoriza a partilha do perfil
|
||||
para outras finalidades ou empresas.
|
||||
</p>
|
||||
<Button disabled={register.processing}>
|
||||
Criar a minha conta
|
||||
</Button>
|
||||
</form>
|
||||
) : (
|
||||
<p>
|
||||
Novos registos estão encerrados. As contas
|
||||
existentes podem continuar a entrar.
|
||||
</p>
|
||||
)}
|
||||
</section>
|
||||
</main>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,215 @@
|
||||
import { Head, Link, useForm } from '@inertiajs/react';
|
||||
import { FormErrors, controlClass } from '@/components/procurement';
|
||||
import { Button } from '@/components/ui/button';
|
||||
|
||||
type Field = { key: string; label: string; type: string; required: boolean };
|
||||
type Location = { province: string; district: string; locality: string };
|
||||
const answerText = (value: string | Location) =>
|
||||
typeof value === 'string' ? value : '';
|
||||
export default function Opportunity({
|
||||
companyId,
|
||||
opportunity,
|
||||
profile,
|
||||
email,
|
||||
emailVerified,
|
||||
}: {
|
||||
companyId: number;
|
||||
opportunity: {
|
||||
id: number;
|
||||
title: string;
|
||||
description: string;
|
||||
closes_on: string;
|
||||
publication_version: number;
|
||||
form: {
|
||||
version: number;
|
||||
definition: {
|
||||
fields: Field[];
|
||||
documents: { key: string; label: string; required: boolean }[];
|
||||
};
|
||||
};
|
||||
};
|
||||
profile: {
|
||||
version: number;
|
||||
data: {
|
||||
name: string;
|
||||
phone?: string;
|
||||
summary: string;
|
||||
availability: Location;
|
||||
};
|
||||
};
|
||||
email: string;
|
||||
emailVerified: boolean;
|
||||
}) {
|
||||
const source: Record<string, string | Location> = {
|
||||
name: profile.data.name,
|
||||
full_name: profile.data.name,
|
||||
email,
|
||||
phone: profile.data.phone ?? '',
|
||||
summary: profile.data.summary,
|
||||
availability_location: profile.data.availability,
|
||||
};
|
||||
const form = useForm({
|
||||
operation_key: crypto.randomUUID(),
|
||||
profile_version: profile.version,
|
||||
publication_version: opportunity.publication_version,
|
||||
answers: Object.fromEntries(
|
||||
opportunity.form.definition.fields.map((field) => [
|
||||
field.key,
|
||||
field.type === 'location'
|
||||
? typeof source[field.key] === 'object'
|
||||
? source[field.key]
|
||||
: { province: '', district: '', locality: '' }
|
||||
: typeof source[field.key] === 'string'
|
||||
? source[field.key]
|
||||
: '',
|
||||
]),
|
||||
) as Record<string, string | Location>,
|
||||
});
|
||||
return (
|
||||
<>
|
||||
<Head title={opportunity.title} />
|
||||
<main className="mx-auto max-w-3xl space-y-5 p-6">
|
||||
<Link
|
||||
href={`/candidaturas/${companyId}/perfil`}
|
||||
className="underline"
|
||||
>
|
||||
O meu perfil
|
||||
</Link>
|
||||
<h1 className="text-3xl font-semibold">{opportunity.title}</h1>
|
||||
<p className="whitespace-pre-wrap">{opportunity.description}</p>
|
||||
<p>
|
||||
Fecho: {opportunity.closes_on} · formulário v
|
||||
{opportunity.form.version} · perfil v{profile.version}
|
||||
</p>
|
||||
<p>
|
||||
Dados existentes foram preenchidos a partir do perfil. As
|
||||
respostas específicas não alteram o perfil. A recepção não
|
||||
constitui aceitação, selecção ou contratação.
|
||||
</p>
|
||||
{!emailVerified && (
|
||||
<p>Confirme o email na sua área antes de submeter.</p>
|
||||
)}
|
||||
{profile.version === 0 && <p>Guarde primeiro o seu perfil.</p>}
|
||||
<form
|
||||
className="space-y-4"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
form.post(
|
||||
`/candidaturas/${companyId}/oportunidades/${opportunity.id}`,
|
||||
);
|
||||
}}
|
||||
>
|
||||
<FormErrors errors={form.errors} />
|
||||
{opportunity.form.definition.fields.map((field) =>
|
||||
field.type === 'location' ? (
|
||||
<fieldset
|
||||
key={field.key}
|
||||
className="grid gap-3 sm:grid-cols-3"
|
||||
>
|
||||
<legend>
|
||||
{field.label}
|
||||
{field.required ? ' *' : ''}
|
||||
</legend>
|
||||
{(
|
||||
[
|
||||
'province',
|
||||
'district',
|
||||
'locality',
|
||||
] as const
|
||||
).map((part) => (
|
||||
<label key={part}>
|
||||
{
|
||||
{
|
||||
province: 'Província',
|
||||
district: 'Distrito',
|
||||
locality: 'Localidade',
|
||||
}[part]
|
||||
}
|
||||
<input
|
||||
className={controlClass}
|
||||
required={field.required}
|
||||
value={
|
||||
(typeof form.data.answers[
|
||||
field.key
|
||||
] === 'object'
|
||||
? (form.data.answers[
|
||||
field.key
|
||||
] as Location)
|
||||
: {
|
||||
province: '',
|
||||
district: '',
|
||||
locality: '',
|
||||
})[part]
|
||||
}
|
||||
onChange={(e) =>
|
||||
form.setData('answers', {
|
||||
...form.data.answers,
|
||||
[field.key]: {
|
||||
...(form.data.answers[
|
||||
field.key
|
||||
] as Location),
|
||||
[part]: e.target.value,
|
||||
},
|
||||
})
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
))}
|
||||
</fieldset>
|
||||
) : (
|
||||
<label className="grid gap-2" key={field.key}>
|
||||
{field.label}
|
||||
{field.required ? ' *' : ''}
|
||||
{field.type === 'textarea' ? (
|
||||
<textarea
|
||||
className={controlClass}
|
||||
required={field.required}
|
||||
value={answerText(
|
||||
form.data.answers[field.key],
|
||||
)}
|
||||
onChange={(e) =>
|
||||
form.setData('answers', {
|
||||
...form.data.answers,
|
||||
[field.key]: e.target.value,
|
||||
})
|
||||
}
|
||||
/>
|
||||
) : (
|
||||
<input
|
||||
className={controlClass}
|
||||
type={field.type}
|
||||
required={field.required}
|
||||
value={answerText(
|
||||
form.data.answers[field.key],
|
||||
)}
|
||||
onChange={(e) =>
|
||||
form.setData('answers', {
|
||||
...form.data.answers,
|
||||
[field.key]: e.target.value,
|
||||
})
|
||||
}
|
||||
/>
|
||||
)}
|
||||
</label>
|
||||
),
|
||||
)}
|
||||
{opportunity.form.definition.documents.length > 0 && (
|
||||
<p>
|
||||
O envio de anexos ainda está em desenvolvimento. Não
|
||||
é possível entregar documentos neste formulário.
|
||||
</p>
|
||||
)}
|
||||
<Button
|
||||
disabled={
|
||||
form.processing ||
|
||||
!emailVerified ||
|
||||
profile.version === 0
|
||||
}
|
||||
>
|
||||
Submeter candidatura e obter comprovativo
|
||||
</Button>
|
||||
</form>
|
||||
</main>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,217 @@
|
||||
import { Head, Link, router, useForm } from '@inertiajs/react';
|
||||
import { FormErrors, controlClass } from '@/components/procurement';
|
||||
import { Button } from '@/components/ui/button';
|
||||
|
||||
type Data = {
|
||||
name: string;
|
||||
phone: string | null;
|
||||
summary: string;
|
||||
availability: { province: string; district: string; locality: string };
|
||||
};
|
||||
export default function Profile({
|
||||
companyId,
|
||||
email,
|
||||
profile,
|
||||
emailVerified = false,
|
||||
emailDeliveryAvailable = false,
|
||||
accessStatus,
|
||||
opportunities = [],
|
||||
submissions = [],
|
||||
}: {
|
||||
companyId: number;
|
||||
email: string;
|
||||
profile: { version: number; data: Data };
|
||||
emailVerified?: boolean;
|
||||
emailDeliveryAvailable?: boolean;
|
||||
accessStatus?: string | null;
|
||||
opportunities?: { id: number; title: string; closes_on: string }[];
|
||||
submissions?: { id: number; reference: string; created_at: string }[];
|
||||
}) {
|
||||
const form = useForm({
|
||||
version: profile.version,
|
||||
...profile.data,
|
||||
phone: profile.data.phone ?? '',
|
||||
reason: '',
|
||||
});
|
||||
return (
|
||||
<>
|
||||
<Head title="O meu perfil" />
|
||||
<section className="mx-auto max-w-3xl space-y-3 p-6">
|
||||
<h2 className="text-xl font-semibold">
|
||||
Oportunidades publicadas
|
||||
</h2>
|
||||
{opportunities.map((item) => (
|
||||
<p key={item.id}>
|
||||
<Link
|
||||
className="underline"
|
||||
href={`/candidaturas/${companyId}/oportunidades/${item.id}`}
|
||||
>
|
||||
{item.title} · {item.closes_on}
|
||||
</Link>
|
||||
</p>
|
||||
))}
|
||||
<h2 className="text-xl font-semibold">
|
||||
As minhas candidaturas
|
||||
</h2>
|
||||
{submissions.map((item) => (
|
||||
<p key={item.id}>
|
||||
<Link
|
||||
className="underline"
|
||||
href={`/candidaturas/${companyId}/submissoes/${item.id}`}
|
||||
>
|
||||
{item.reference} · {item.created_at}
|
||||
</Link>
|
||||
</p>
|
||||
))}
|
||||
</section>
|
||||
<main className="mx-auto max-w-3xl space-y-6 p-6">
|
||||
<p>SGC · Área do candidato</p>
|
||||
<h1 className="text-3xl font-semibold">O meu perfil</h1>
|
||||
<p>
|
||||
{email} · versão {profile.version}
|
||||
</p>
|
||||
<p>
|
||||
{emailVerified
|
||||
? 'Email confirmado. A identidade ainda depende de verificação própria.'
|
||||
: 'Email ainda não confirmado. A entrada comprova apenas o acesso à conta.'}{' '}
|
||||
Pode candidatar-se às oportunidades publicadas. O envio de
|
||||
anexos ainda está em desenvolvimento.
|
||||
</p>
|
||||
{!emailVerified && (
|
||||
<Button
|
||||
variant="outline"
|
||||
disabled={!emailDeliveryAvailable}
|
||||
onClick={() =>
|
||||
router.post(
|
||||
`/candidaturas/${companyId}/pedir-confirmacao`,
|
||||
)
|
||||
}
|
||||
>
|
||||
Pedir confirmação do email
|
||||
</Button>
|
||||
)}
|
||||
{!emailVerified && !emailDeliveryAvailable && (
|
||||
<p>
|
||||
O envio de email ainda não está configurado; pode
|
||||
continuar a preparar o perfil.
|
||||
</p>
|
||||
)}
|
||||
{accessStatus === 'requested' && (
|
||||
<p>
|
||||
Se o envio estiver disponível, receberá uma ligação
|
||||
temporária de confirmação.
|
||||
</p>
|
||||
)}
|
||||
<form
|
||||
className="space-y-4"
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
form.post(`/candidaturas/${companyId}/perfil`, {
|
||||
preserveScroll: true,
|
||||
preserveState: false,
|
||||
});
|
||||
}}
|
||||
>
|
||||
<FormErrors errors={form.errors} />
|
||||
<label className="grid gap-2">
|
||||
Nome completo
|
||||
<input
|
||||
className={controlClass}
|
||||
required
|
||||
minLength={3}
|
||||
maxLength={200}
|
||||
value={form.data.name}
|
||||
onChange={(e) =>
|
||||
form.setData('name', e.target.value)
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
<label className="grid gap-2">
|
||||
Telefone
|
||||
<input
|
||||
className={controlClass}
|
||||
maxLength={50}
|
||||
value={form.data.phone}
|
||||
onChange={(e) =>
|
||||
form.setData('phone', e.target.value)
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
<label className="grid gap-2">
|
||||
Resumo profissional
|
||||
<textarea
|
||||
className={controlClass}
|
||||
required
|
||||
minLength={10}
|
||||
maxLength={5000}
|
||||
value={form.data.summary}
|
||||
onChange={(e) =>
|
||||
form.setData('summary', e.target.value)
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
<fieldset className="grid gap-3 sm:grid-cols-3">
|
||||
<legend>
|
||||
Local de disponibilidade para trabalhar ou prestar
|
||||
serviço
|
||||
</legend>
|
||||
{(['province', 'district', 'locality'] as const).map(
|
||||
(key) => (
|
||||
<label className="grid gap-2" key={key}>
|
||||
{
|
||||
{
|
||||
province: 'Província',
|
||||
district: 'Distrito',
|
||||
locality: 'Localidade',
|
||||
}[key]
|
||||
}
|
||||
<input
|
||||
className={controlClass}
|
||||
required
|
||||
maxLength={150}
|
||||
value={form.data.availability[key]}
|
||||
onChange={(e) =>
|
||||
form.setData('availability', {
|
||||
...form.data.availability,
|
||||
[key]: e.target.value,
|
||||
})
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
),
|
||||
)}
|
||||
</fieldset>
|
||||
<p className="text-sm">
|
||||
Disponibilidade é distinta da morada. Actualizar o
|
||||
perfil cria uma versão para usos futuros, preservando as
|
||||
anteriores.
|
||||
</p>
|
||||
<label className="grid gap-2">
|
||||
Motivo da actualização
|
||||
<textarea
|
||||
className={controlClass}
|
||||
required
|
||||
minLength={10}
|
||||
maxLength={4000}
|
||||
value={form.data.reason}
|
||||
onChange={(e) =>
|
||||
form.setData('reason', e.target.value)
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
<Button disabled={form.processing}>
|
||||
Guardar nova versão do perfil
|
||||
</Button>
|
||||
</form>
|
||||
<Button
|
||||
variant="outline"
|
||||
onClick={() =>
|
||||
router.post(`/candidaturas/${companyId}/sair`)
|
||||
}
|
||||
>
|
||||
Sair da área do candidato
|
||||
</Button>
|
||||
</main>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
import { Head, Link } from '@inertiajs/react';
|
||||
|
||||
export default function Receipt({
|
||||
companyId,
|
||||
receipt,
|
||||
decision,
|
||||
}: {
|
||||
companyId: number;
|
||||
decision?: null | { outcome: string; message: string; decided_at: string };
|
||||
receipt: {
|
||||
reference: string;
|
||||
received_at: string;
|
||||
snapshot: {
|
||||
opportunity: {
|
||||
title: string;
|
||||
form?: {
|
||||
definition: { fields: { key: string; label: string }[] };
|
||||
};
|
||||
};
|
||||
profile: { version: number };
|
||||
answers: Record<
|
||||
string,
|
||||
string | number | null | Record<string, string>
|
||||
>;
|
||||
};
|
||||
};
|
||||
}) {
|
||||
return (
|
||||
<>
|
||||
<Head title="Comprovativo de candidatura" />
|
||||
<main className="mx-auto max-w-3xl space-y-5 p-6">
|
||||
<h1 className="text-3xl font-semibold">Candidatura recebida</h1>
|
||||
{decision && (
|
||||
<section className="space-y-2">
|
||||
<h2 className="text-xl font-semibold">
|
||||
{decision.outcome === 'accepted_for_analysis'
|
||||
? 'Aceite para análise'
|
||||
: 'Não aceite para análise'}
|
||||
</h2>
|
||||
<p>{decision.message}</p>
|
||||
<p>{decision.decided_at}</p>
|
||||
</section>
|
||||
)}
|
||||
<p>{receipt.reference}</p>
|
||||
<p>
|
||||
{receipt.received_at} · {receipt.snapshot.opportunity.title}{' '}
|
||||
· perfil v{receipt.snapshot.profile.version}
|
||||
</p>
|
||||
<p>
|
||||
A recepção não significa aceitação para análise, inclusão na
|
||||
base, selecção ou contratação.
|
||||
</p>
|
||||
<dl>
|
||||
{Object.entries(receipt.snapshot.answers).map(
|
||||
([key, value]) => (
|
||||
<div key={key} className="my-3">
|
||||
<dt className="font-semibold">
|
||||
{receipt.snapshot.opportunity.form?.definition.fields.find(
|
||||
(field) => field.key === key,
|
||||
)?.label ?? 'Resposta'}
|
||||
</dt>
|
||||
<dd>
|
||||
{value !== null && typeof value === 'object'
|
||||
? Object.entries(value).map(
|
||||
([part, text]) => (
|
||||
<p key={part}>
|
||||
{(
|
||||
{
|
||||
province:
|
||||
'Província',
|
||||
district:
|
||||
'Distrito',
|
||||
locality:
|
||||
'Localidade',
|
||||
} as Record<
|
||||
string,
|
||||
string
|
||||
>
|
||||
)[part] ?? 'Local'}
|
||||
: {text}
|
||||
</p>
|
||||
),
|
||||
)
|
||||
: (value ?? 'Não indicado')}
|
||||
</dd>
|
||||
</div>
|
||||
),
|
||||
)}
|
||||
</dl>
|
||||
<Link
|
||||
className="underline"
|
||||
href={`/candidaturas/${companyId}/perfil`}
|
||||
>
|
||||
O meu perfil e candidaturas
|
||||
</Link>
|
||||
</main>
|
||||
</>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user