@@ -0,0 +1,114 @@
|
||||
import { useForm } from '@inertiajs/react';
|
||||
import { Panel, FormErrors, controlClass } from '@/components/procurement';
|
||||
import { Button } from '@/components/ui/button';
|
||||
|
||||
export function PeopleContractFormalization({
|
||||
id,
|
||||
version,
|
||||
}: {
|
||||
id: number;
|
||||
version: number;
|
||||
}) {
|
||||
const form = useForm<{
|
||||
version: number;
|
||||
operation_key: string;
|
||||
reference: string;
|
||||
signed_on: string;
|
||||
reason: string;
|
||||
no_conflict: boolean;
|
||||
signed_document: File | null;
|
||||
}>({
|
||||
version,
|
||||
operation_key: crypto.randomUUID(),
|
||||
reference: '',
|
||||
signed_on: '',
|
||||
reason: '',
|
||||
no_conflict: false,
|
||||
signed_document: null,
|
||||
});
|
||||
return (
|
||||
<Panel title="Confirmar contrato assinado — Direcção">
|
||||
<form
|
||||
className="space-y-4"
|
||||
onSubmit={(event) => {
|
||||
event.preventDefault();
|
||||
if (!form.processing)
|
||||
form.post(`/pessoas/${id}/formalizar`, {
|
||||
forceFormData: true,
|
||||
preserveState: 'errors',
|
||||
preserveScroll: true,
|
||||
});
|
||||
}}
|
||||
>
|
||||
<FormErrors errors={form.errors} />
|
||||
<label className="block">
|
||||
Referência do contrato assinado
|
||||
<input
|
||||
required
|
||||
maxLength={200}
|
||||
className={controlClass}
|
||||
value={form.data.reference}
|
||||
onChange={(event) =>
|
||||
form.setData('reference', event.target.value)
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
<label className="block">
|
||||
Data da assinatura
|
||||
<input
|
||||
required
|
||||
type="date"
|
||||
className={controlClass}
|
||||
value={form.data.signed_on}
|
||||
onChange={(event) =>
|
||||
form.setData('signed_on', event.target.value)
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
<label className="block">
|
||||
Contrato assinado (PDF, até 10 MB)
|
||||
<input
|
||||
required
|
||||
type="file"
|
||||
accept="application/pdf"
|
||||
className={controlClass}
|
||||
onChange={(event) =>
|
||||
form.setData(
|
||||
'signed_document',
|
||||
event.target.files?.[0] ?? null,
|
||||
)
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
<label className="block">
|
||||
Fundamento da confirmação
|
||||
<textarea
|
||||
required
|
||||
minLength={10}
|
||||
maxLength={4000}
|
||||
className={controlClass}
|
||||
value={form.data.reason}
|
||||
onChange={(event) =>
|
||||
form.setData('reason', event.target.value)
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
<label className="flex items-start gap-2">
|
||||
<input
|
||||
required
|
||||
type="checkbox"
|
||||
checked={form.data.no_conflict}
|
||||
onChange={(event) =>
|
||||
form.setData('no_conflict', event.target.checked)
|
||||
}
|
||||
/>
|
||||
Confirmo a assinatura e a ausência de conflito de interesses
|
||||
nesta intervenção.
|
||||
</label>
|
||||
<Button disabled={form.processing} type="submit">
|
||||
Confirmar formalização
|
||||
</Button>
|
||||
</form>
|
||||
</Panel>
|
||||
);
|
||||
}
|
||||
@@ -343,11 +343,15 @@ export function SgcWorkspaceShell({ children }: { children: ReactNode }) {
|
||||
</div>
|
||||
)}
|
||||
{publicNavigation && (
|
||||
<p className="border-b bg-background p-3 text-center text-sm">
|
||||
Consulta pública de desenvolvimento · Sem organização
|
||||
seleccionada e sem registos privados. Alterações exigem
|
||||
autenticação.
|
||||
</p>
|
||||
<div className="flex flex-wrap items-center justify-center gap-3 border-b bg-amber-50 px-4 py-3 text-sm text-amber-950">
|
||||
<p>
|
||||
Consulta pública sem sessão. Os registos e as acções da
|
||||
empresa ficam disponíveis depois de entrar.
|
||||
</p>
|
||||
<Button asChild size="sm">
|
||||
<Link href="/login">Entrar na aplicação</Link>
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
<a
|
||||
href="#sgc-main"
|
||||
@@ -496,6 +500,11 @@ export function SgcWorkspaceShell({ children }: { children: ReactNode }) {
|
||||
</div>
|
||||
{searchField()}
|
||||
<div className="flex shrink-0 items-center gap-2">
|
||||
{!user && (
|
||||
<Button asChild size="sm">
|
||||
<Link href="/login">Entrar</Link>
|
||||
</Button>
|
||||
)}
|
||||
{page.props.canRequest === true && (
|
||||
<Button
|
||||
asChild
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { Link } from '@inertiajs/react';
|
||||
import AppLogoIcon from '@/components/app-logo-icon';
|
||||
import { home } from '@/routes';
|
||||
import type { AuthLayoutProps } from '@/types';
|
||||
|
||||
@@ -17,8 +16,11 @@ export default function AuthSimpleLayout({
|
||||
href={home()}
|
||||
className="flex flex-col items-center gap-2 font-medium"
|
||||
>
|
||||
<div className="mb-1 flex h-9 w-9 items-center justify-center rounded-md">
|
||||
<AppLogoIcon className="size-9 fill-current text-[var(--foreground)] dark:text-white" />
|
||||
<div
|
||||
aria-label="SGC"
|
||||
className="mb-1 flex h-10 w-10 items-center justify-center rounded-xl bg-rose-600 text-sm font-bold text-white"
|
||||
>
|
||||
SGC
|
||||
</div>
|
||||
<span className="sr-only">{title}</span>
|
||||
</Link>
|
||||
|
||||
@@ -530,6 +530,12 @@ export function procurementNavigation(
|
||||
path: '/administracao/parametrizacao',
|
||||
roles: ['admin'],
|
||||
},
|
||||
{
|
||||
id: 'business_clients',
|
||||
label: 'Clientes',
|
||||
path: '/empresa/clientes',
|
||||
roles: ['admin'],
|
||||
},
|
||||
{
|
||||
id: 'admission_policy',
|
||||
label: 'Política de admissão',
|
||||
|
||||
@@ -22,9 +22,7 @@ export default function Login({ status, canResetPassword }: Props) {
|
||||
<Head title="Entrar" />
|
||||
|
||||
<Button asChild variant="outline" className="mb-5 w-full">
|
||||
<TextLink href="/consulta">
|
||||
Consultar demonstração sem entrar
|
||||
</TextLink>
|
||||
<TextLink href="/apresentacao">Conhecer a aplicação</TextLink>
|
||||
</Button>
|
||||
|
||||
<Form
|
||||
|
||||
@@ -0,0 +1,265 @@
|
||||
import { Form, Head, Link, router } from '@inertiajs/react';
|
||||
import { useState } from 'react';
|
||||
import { PageTitle, Panel, controlClass } from '@/components/procurement';
|
||||
import { Button } from '@/components/ui/button';
|
||||
|
||||
type Client = {
|
||||
id: number;
|
||||
client_key: string;
|
||||
code: string;
|
||||
name: string;
|
||||
tax_number: string | null;
|
||||
address: string | null;
|
||||
email: string | null;
|
||||
active: boolean;
|
||||
version: number;
|
||||
};
|
||||
function Fields({ client, prefix }: { client?: Client; prefix: string }) {
|
||||
return (
|
||||
<div className="grid gap-4 sm:grid-cols-2">
|
||||
{(
|
||||
[
|
||||
['code', 'Código', 40],
|
||||
['name', 'Nome da entidade cliente', 180],
|
||||
['tax_number', 'Identificação fiscal', 40],
|
||||
['email', 'Email institucional', 254],
|
||||
] as const
|
||||
).map(([field, label, max]) => (
|
||||
<label
|
||||
key={field}
|
||||
className="grid gap-1 text-sm"
|
||||
htmlFor={`${prefix}-${field}`}
|
||||
>
|
||||
{label}
|
||||
<input
|
||||
id={`${prefix}-${field}`}
|
||||
className={controlClass}
|
||||
name={field}
|
||||
type={field === 'email' ? 'email' : 'text'}
|
||||
defaultValue={client?.[field] ?? ''}
|
||||
required={field === 'code' || field === 'name'}
|
||||
maxLength={max}
|
||||
/>
|
||||
</label>
|
||||
))}
|
||||
<label
|
||||
className="grid gap-1 text-sm sm:col-span-2"
|
||||
htmlFor={`${prefix}-address`}
|
||||
>
|
||||
Morada
|
||||
<textarea
|
||||
id={`${prefix}-address`}
|
||||
className={controlClass}
|
||||
name="address"
|
||||
defaultValue={client?.address ?? ''}
|
||||
maxLength={2000}
|
||||
/>
|
||||
</label>
|
||||
<label className="grid gap-1 text-sm" htmlFor={`${prefix}-active`}>
|
||||
Situação
|
||||
<select
|
||||
id={`${prefix}-active`}
|
||||
className={controlClass}
|
||||
name="active"
|
||||
defaultValue={client?.active === false ? '0' : '1'}
|
||||
>
|
||||
<option value="1">Activo</option>
|
||||
<option value="0">Inactivo</option>
|
||||
</select>
|
||||
</label>
|
||||
<label
|
||||
className="grid gap-1 text-sm sm:col-span-2"
|
||||
htmlFor={`${prefix}-reason`}
|
||||
>
|
||||
Fundamento
|
||||
<textarea
|
||||
id={`${prefix}-reason`}
|
||||
className={controlClass}
|
||||
name="reason"
|
||||
required
|
||||
minLength={10}
|
||||
maxLength={4000}
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
export default function Clients({
|
||||
clients,
|
||||
canManage,
|
||||
filters,
|
||||
}: {
|
||||
clients: {
|
||||
data: Client[];
|
||||
current_page: number;
|
||||
last_page: number;
|
||||
prev_page_url: string | null;
|
||||
next_page_url: string | null;
|
||||
};
|
||||
canManage: boolean;
|
||||
filters: { search?: string };
|
||||
}) {
|
||||
const [createKey, setCreateKey] = useState(() => crypto.randomUUID());
|
||||
return (
|
||||
<>
|
||||
<Head title="Clientes" />
|
||||
<div className="mx-auto flex w-full max-w-7xl flex-col gap-6 p-5 lg:p-8">
|
||||
<PageTitle
|
||||
eyebrow="Cadastro da empresa"
|
||||
title="Clientes"
|
||||
description="Entidades clientes dos serviços de contratação e das operações comerciais. Cada processo conserva a identificação aceite na sua preparação."
|
||||
/>
|
||||
<Panel title="Entidades registadas">
|
||||
<form
|
||||
className="mb-5 flex flex-wrap gap-3"
|
||||
onSubmit={(event) => {
|
||||
event.preventDefault();
|
||||
const data = new FormData(event.currentTarget);
|
||||
const search = data.get('search');
|
||||
router.get('/empresa/clientes', {
|
||||
search: typeof search === 'string' ? search : '',
|
||||
});
|
||||
}}
|
||||
>
|
||||
<input
|
||||
name="search"
|
||||
aria-label="Procurar cliente"
|
||||
className={controlClass}
|
||||
defaultValue={filters.search ?? ''}
|
||||
placeholder="Código ou nome"
|
||||
maxLength={180}
|
||||
/>
|
||||
<Button type="submit">Procurar</Button>
|
||||
</form>
|
||||
<div className="space-y-4">
|
||||
{clients.data.map((client) => (
|
||||
<details
|
||||
key={`${client.id}-${client.version}`}
|
||||
className="rounded-lg border p-4"
|
||||
>
|
||||
<summary className="cursor-pointer text-sm font-medium">
|
||||
{client.code} · {client.name} ·{' '}
|
||||
{client.active ? 'Activo' : 'Inactivo'}
|
||||
</summary>
|
||||
{canManage ? (
|
||||
<Form
|
||||
action={`/empresa/clientes/${client.id}`}
|
||||
method="patch"
|
||||
className="mt-5 space-y-4"
|
||||
>
|
||||
{({ errors, processing }) => (
|
||||
<>
|
||||
<input
|
||||
type="hidden"
|
||||
name="version"
|
||||
value={client.version}
|
||||
/>
|
||||
{Object.values(errors).map(
|
||||
(error, index) => (
|
||||
<p
|
||||
key={index}
|
||||
role="alert"
|
||||
className="text-sm text-red-700"
|
||||
>
|
||||
{String(error)}
|
||||
</p>
|
||||
),
|
||||
)}
|
||||
<Fields
|
||||
client={client}
|
||||
prefix={`client-${client.id}`}
|
||||
/>
|
||||
<Button
|
||||
type="submit"
|
||||
disabled={processing}
|
||||
>
|
||||
Guardar alterações
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
</Form>
|
||||
) : (
|
||||
<dl className="mt-4 grid gap-2 text-sm">
|
||||
{client.tax_number && (
|
||||
<div>
|
||||
<dt>Identificação fiscal</dt>
|
||||
<dd>{client.tax_number}</dd>
|
||||
</div>
|
||||
)}
|
||||
{client.address && (
|
||||
<div>
|
||||
<dt>Morada</dt>
|
||||
<dd>{client.address}</dd>
|
||||
</div>
|
||||
)}
|
||||
{client.email && (
|
||||
<div>
|
||||
<dt>Email institucional</dt>
|
||||
<dd>{client.email}</dd>
|
||||
</div>
|
||||
)}
|
||||
</dl>
|
||||
)}
|
||||
</details>
|
||||
))}
|
||||
{clients.data.length === 0 && (
|
||||
<p className="text-sm text-muted-foreground">
|
||||
Sem clientes neste resultado.
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
<nav
|
||||
aria-label="Páginas de clientes"
|
||||
className="mt-5 flex flex-wrap items-center gap-4 text-sm"
|
||||
>
|
||||
{clients.prev_page_url && (
|
||||
<Link href={clients.prev_page_url}>Anterior</Link>
|
||||
)}
|
||||
<span>
|
||||
Página {clients.current_page} de {clients.last_page}
|
||||
</span>
|
||||
{clients.next_page_url && (
|
||||
<Link href={clients.next_page_url}>Seguinte</Link>
|
||||
)}
|
||||
</nav>
|
||||
</Panel>
|
||||
{canManage && (
|
||||
<Panel title="Registar cliente">
|
||||
<Form
|
||||
key={createKey}
|
||||
action="/empresa/clientes"
|
||||
method="post"
|
||||
className="space-y-4"
|
||||
onSuccess={() => setCreateKey(crypto.randomUUID())}
|
||||
>
|
||||
{({ errors, processing }) => (
|
||||
<>
|
||||
<input
|
||||
type="hidden"
|
||||
name="client_key"
|
||||
value={createKey}
|
||||
/>
|
||||
{Object.values(errors).map(
|
||||
(error, index) => (
|
||||
<p
|
||||
key={index}
|
||||
role="alert"
|
||||
className="text-sm text-red-700"
|
||||
>
|
||||
{String(error)}
|
||||
</p>
|
||||
),
|
||||
)}
|
||||
<Fields prefix="new-client" />
|
||||
<Button type="submit" disabled={processing}>
|
||||
Registar cliente
|
||||
</Button>
|
||||
</>
|
||||
)}
|
||||
</Form>
|
||||
</Panel>
|
||||
)}
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
+50
-22
@@ -16,8 +16,8 @@ const areas = [
|
||||
description:
|
||||
'Registe necessidades e acompanhe as decisões de cada departamento.',
|
||||
icon: ClipboardList,
|
||||
href: '/consulta/requisicoes',
|
||||
label: 'Explorar requisições',
|
||||
href: '/login',
|
||||
label: 'Entrar para gerir requisições',
|
||||
step: '01',
|
||||
},
|
||||
{
|
||||
@@ -25,8 +25,8 @@ const areas = [
|
||||
description:
|
||||
'Compare propostas, fundamente a escolha e acompanhe as ordens de compra.',
|
||||
icon: Users,
|
||||
href: '/consulta/fornecedores',
|
||||
label: 'Explorar fornecedores',
|
||||
href: '/login',
|
||||
label: 'Entrar para gerir compras',
|
||||
step: '02',
|
||||
},
|
||||
{
|
||||
@@ -34,10 +34,37 @@ const areas = [
|
||||
description:
|
||||
'Confira as entregas, registe a qualidade e consulte as existências aceites.',
|
||||
icon: PackageCheck,
|
||||
href: '/consulta/recepcoes',
|
||||
label: 'Explorar recepção',
|
||||
href: '/login',
|
||||
label: 'Entrar para gerir o armazém',
|
||||
step: '03',
|
||||
},
|
||||
{
|
||||
title: 'Orçamento e finanças',
|
||||
description:
|
||||
'Controle dotações e acompanhe facturas, pagamentos registados e contabilidade.',
|
||||
icon: FileCheck2,
|
||||
href: '/login',
|
||||
label: 'Entrar para gerir finanças',
|
||||
step: '04',
|
||||
},
|
||||
{
|
||||
title: 'Importações',
|
||||
description:
|
||||
'Organize o dossiê e acompanhe os documentos aduaneiros e o suporte bancário.',
|
||||
icon: ClipboardList,
|
||||
href: '/login',
|
||||
label: 'Entrar para acompanhar importações',
|
||||
step: '05',
|
||||
},
|
||||
{
|
||||
title: 'Pessoas e contratações',
|
||||
description:
|
||||
'Acompanhe candidaturas, avaliações, selecção e formalização de contratos.',
|
||||
icon: Users,
|
||||
href: '/login',
|
||||
label: 'Entrar para gerir contratações',
|
||||
step: '06',
|
||||
},
|
||||
];
|
||||
|
||||
export default function Home() {
|
||||
@@ -48,7 +75,7 @@ export default function Home() {
|
||||
<header className="border-b">
|
||||
<div className="mx-auto flex max-w-7xl flex-wrap items-center justify-between gap-4 px-6 py-5 lg:px-10">
|
||||
<Link href="/" className="flex items-center gap-3">
|
||||
<span className="grid size-10 place-items-center rounded-xl bg-teal-800 text-lg font-semibold text-white">
|
||||
<span className="grid size-10 place-items-center rounded-xl bg-rose-600 text-lg font-semibold text-white">
|
||||
SGC
|
||||
</span>
|
||||
<div>
|
||||
@@ -72,10 +99,10 @@ export default function Home() {
|
||||
Início
|
||||
</Link>
|
||||
<Link
|
||||
href="/consulta"
|
||||
href="#areas-title"
|
||||
className="text-muted-foreground hover:text-foreground"
|
||||
>
|
||||
Demonstração
|
||||
Funcionalidades
|
||||
</Link>
|
||||
<Button asChild>
|
||||
<Link href="/login">
|
||||
@@ -102,9 +129,9 @@ export default function Home() {
|
||||
<p className="mt-6 max-w-xl text-base leading-7 text-muted-foreground">
|
||||
Um percurso organizado para a sua equipa:
|
||||
necessidades, fornecedores, prestadores,
|
||||
recrutamento, decisões e entregas. Escolha a
|
||||
área em que quer trabalhar ou conheça primeiro
|
||||
os exemplos de demonstração.
|
||||
recrutamento, decisões e entregas, ligados ao
|
||||
acompanhamento do orçamento e das finanças.
|
||||
Escolha a área em que quer trabalhar.
|
||||
</p>
|
||||
<div className="mt-8 flex flex-wrap gap-3">
|
||||
<Button
|
||||
@@ -112,21 +139,22 @@ export default function Home() {
|
||||
size="lg"
|
||||
className="bg-teal-800 text-white hover:bg-teal-900"
|
||||
>
|
||||
<Link href="/consulta">
|
||||
Explorar a demonstração{' '}
|
||||
<Link href="/login">
|
||||
Entrar na aplicação{' '}
|
||||
<ArrowRight className="size-4" />
|
||||
</Link>
|
||||
</Button>
|
||||
<Button asChild size="lg" variant="outline">
|
||||
<Link href="/login">
|
||||
Aceder ao espaço de trabalho
|
||||
<Link href="#areas-title">
|
||||
Conhecer as funcionalidades
|
||||
</Link>
|
||||
</Button>
|
||||
</div>
|
||||
<p className="mt-5 flex items-center gap-2 text-xs text-muted-foreground">
|
||||
<ShieldCheck className="size-4 shrink-0" />
|
||||
Demonstração com dados fictícios. O espaço de
|
||||
trabalho exige autenticação.
|
||||
O espaço de trabalho exige autenticação e
|
||||
apresenta os registos autorizados para o seu
|
||||
perfil.
|
||||
</p>
|
||||
</div>
|
||||
<div className="rounded-2xl border bg-muted/25 p-6 sm:p-8">
|
||||
@@ -201,10 +229,10 @@ export default function Home() {
|
||||
</h2>
|
||||
</div>
|
||||
<Link
|
||||
href="/consulta"
|
||||
href="/login"
|
||||
className="inline-flex items-center gap-2 text-sm font-medium text-teal-700 dark:text-teal-400"
|
||||
>
|
||||
Ver todos os módulos{' '}
|
||||
Aceder aos módulos{' '}
|
||||
<ArrowRight className="size-4" />
|
||||
</Link>
|
||||
</div>
|
||||
@@ -261,8 +289,8 @@ export default function Home() {
|
||||
</span>
|
||||
<span>
|
||||
Consulte no processo as decisões e o controlo
|
||||
orçamental. Documentos de desenvolvimento não
|
||||
autorizam compras reais.
|
||||
orçamental, com os acessos definidos para cada
|
||||
interveniente.
|
||||
</span>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
@@ -126,6 +126,8 @@ export default function PeopleIndex({
|
||||
insights,
|
||||
filters = {},
|
||||
company,
|
||||
clientMode = false,
|
||||
clients = [],
|
||||
}: {
|
||||
ready: boolean;
|
||||
availableKinds?: string[];
|
||||
@@ -133,6 +135,8 @@ export default function PeopleIndex({
|
||||
insights?: OperationalInsights | null;
|
||||
filters?: Filters;
|
||||
company?: { name: string };
|
||||
clientMode?: boolean;
|
||||
clients?: { id: number; code: string; name: string; version: number }[];
|
||||
administration?: { id: number; kind: string; status: string }[];
|
||||
formFields?: Record<string, Record<string, string>>;
|
||||
kinds: string[];
|
||||
@@ -144,12 +148,15 @@ export default function PeopleIndex({
|
||||
kind: string;
|
||||
status: string;
|
||||
closes_on: string;
|
||||
client?: { code: string; name: string };
|
||||
}[];
|
||||
links: { url: string | null; label: string; active: boolean }[];
|
||||
};
|
||||
}) {
|
||||
const form = useForm({
|
||||
operation_key: crypto.randomUUID(),
|
||||
client_id: '',
|
||||
client_version: '',
|
||||
kind:
|
||||
filters.kind && canPrepare.includes(filters.kind)
|
||||
? filters.kind
|
||||
@@ -182,8 +189,16 @@ export default function PeopleIndex({
|
||||
<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."
|
||||
title={
|
||||
clientMode
|
||||
? 'Contratações para clientes'
|
||||
: 'Pessoas e contratações'
|
||||
}
|
||||
description={
|
||||
clientMode
|
||||
? 'Processos da entidade cliente, conduzidos pela prestadora. A decisão final e a confirmação do contrato competem à Direcção da prestadora.'
|
||||
: 'Contratação de prestadores individuais e recrutamento de trabalhadores, com critérios próprios e decisão independente.'
|
||||
}
|
||||
action={
|
||||
ready ? (
|
||||
<ActionBar>
|
||||
@@ -440,6 +455,12 @@ export default function PeopleIndex({
|
||||
<strong>
|
||||
PES-{p.id} · {p.title}
|
||||
</strong>
|
||||
{p.client && (
|
||||
<p className="text-sm text-muted-foreground">
|
||||
Cliente: {p.client.code} ·{' '}
|
||||
{p.client.name}
|
||||
</p>
|
||||
)}
|
||||
<p>
|
||||
{kinds[p.kind]} ·{' '}
|
||||
{peopleStates[p.status] ?? p.status}{' '}
|
||||
@@ -485,7 +506,16 @@ export default function PeopleIndex({
|
||||
onSubmit={(e) => {
|
||||
e.preventDefault();
|
||||
form.transform((values) => ({
|
||||
...values,
|
||||
...Object.fromEntries(
|
||||
Object.entries(values).filter(
|
||||
([key]) =>
|
||||
clientMode ||
|
||||
![
|
||||
'client_id',
|
||||
'client_version',
|
||||
].includes(key),
|
||||
),
|
||||
),
|
||||
annex: {
|
||||
...values.annex,
|
||||
fields: Object.fromEntries(
|
||||
@@ -503,11 +533,93 @@ export default function PeopleIndex({
|
||||
},
|
||||
}));
|
||||
form.post('/pessoas', {
|
||||
onSuccess: () => form.reset(),
|
||||
onSuccess: () => {
|
||||
form.reset();
|
||||
form.setData(
|
||||
'operation_key',
|
||||
crypto.randomUUID(),
|
||||
);
|
||||
},
|
||||
});
|
||||
}}
|
||||
>
|
||||
<FormErrors errors={form.errors} />
|
||||
{clientMode && (
|
||||
<div className="space-y-2 rounded-lg border p-4">
|
||||
<label
|
||||
className="grid gap-1"
|
||||
htmlFor="people-client"
|
||||
>
|
||||
Entidade cliente
|
||||
<select
|
||||
id="people-client"
|
||||
name="client_id"
|
||||
className={controlClass}
|
||||
value={form.data.client_id}
|
||||
required
|
||||
onChange={(event) => {
|
||||
const client =
|
||||
clients.find(
|
||||
(row) =>
|
||||
String(
|
||||
row.id,
|
||||
) ===
|
||||
event.target
|
||||
.value,
|
||||
);
|
||||
form.setData(
|
||||
(values) => ({
|
||||
...values,
|
||||
client_id:
|
||||
event.target
|
||||
.value,
|
||||
client_version:
|
||||
client
|
||||
? String(
|
||||
client.version,
|
||||
)
|
||||
: '',
|
||||
}),
|
||||
);
|
||||
}}
|
||||
>
|
||||
<option value="">
|
||||
Escolher cliente
|
||||
</option>
|
||||
{clients.map((client) => (
|
||||
<option
|
||||
key={client.id}
|
||||
value={client.id}
|
||||
>
|
||||
{client.code} ·{' '}
|
||||
{client.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
<p className="text-sm text-muted-foreground">
|
||||
A identificação do cliente fica
|
||||
preservada neste processo.{' '}
|
||||
<Link
|
||||
href="/empresa/clientes"
|
||||
className="underline"
|
||||
>
|
||||
Consultar cadastro de
|
||||
clientes
|
||||
</Link>
|
||||
</p>
|
||||
{clients.length === 0 && (
|
||||
<p
|
||||
role="status"
|
||||
className="text-sm"
|
||||
>
|
||||
Registe ou active um cliente
|
||||
no cadastro antes de
|
||||
preparar o processo.
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
<label className="block">
|
||||
Percurso
|
||||
<select
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { CandidateAvailability } from '@/components/candidate-availability';
|
||||
import { PeopleContractFormalization } from '@/components/people-contract-formalization';
|
||||
import type { AvailabilityLocation } from '@/components/candidate-availability';
|
||||
import { Head, Link, useForm, usePage } from '@inertiajs/react';
|
||||
import {
|
||||
@@ -26,6 +27,9 @@ type Process = {
|
||||
version: number;
|
||||
closes_on: string;
|
||||
rules: {
|
||||
client?: { code: string; name: string; version: number };
|
||||
provider?: { tenant_id: number; name: string };
|
||||
decision_authority?: string;
|
||||
submission_form?: {
|
||||
id: number;
|
||||
version: number;
|
||||
@@ -61,6 +65,10 @@ type Process = {
|
||||
starts_on: string;
|
||||
terms: string;
|
||||
status: string;
|
||||
signed_on?: string;
|
||||
signed_reference?: string;
|
||||
formalized_by?: number;
|
||||
signed_document?: { sha256: string; bytes: number };
|
||||
};
|
||||
};
|
||||
type Candidate = {
|
||||
@@ -104,6 +112,7 @@ const states: Record<string, string> = {
|
||||
selection_review: 'Selecção por conferir',
|
||||
selected: 'Selecção aprovada',
|
||||
contract_draft: 'Minuta contratual preparada',
|
||||
contract_formalized: 'Contrato formalizado',
|
||||
};
|
||||
const commands: Record<string, string> = {
|
||||
open: 'Conferir e abrir',
|
||||
@@ -531,6 +540,7 @@ export default function PeopleShow({
|
||||
canReview,
|
||||
canApprove = false,
|
||||
canContract = false,
|
||||
canFormalize = false,
|
||||
canManage = false,
|
||||
formFields = {},
|
||||
clarifications,
|
||||
@@ -546,6 +556,7 @@ export default function PeopleShow({
|
||||
canReview: boolean;
|
||||
canApprove?: boolean;
|
||||
canContract?: boolean;
|
||||
canFormalize?: boolean;
|
||||
canManage?: boolean;
|
||||
formFields?: Record<string, string>;
|
||||
clarifications?: ClarificationData;
|
||||
@@ -569,7 +580,12 @@ export default function PeopleShow({
|
||||
];
|
||||
const rows =
|
||||
p.selection &&
|
||||
['selection_review', 'selected', 'contract_draft'].includes(p.status)
|
||||
[
|
||||
'selection_review',
|
||||
'selected',
|
||||
'contract_draft',
|
||||
'contract_formalized',
|
||||
].includes(p.status)
|
||||
? p.selection.rows
|
||||
: candidates;
|
||||
return (
|
||||
@@ -593,6 +609,21 @@ export default function PeopleShow({
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
{p.rules.client && (
|
||||
<Panel
|
||||
title={`Cliente · ${p.rules.client.code} · ${p.rules.client.name}`}
|
||||
>
|
||||
<p className="text-sm">
|
||||
Prestadora: {p.rules.provider?.name}. A decisão
|
||||
final e a confirmação do contrato competem à
|
||||
Direcção da prestadora.
|
||||
</p>
|
||||
<p className="mt-1 text-xs text-muted-foreground">
|
||||
Identificação do cliente preservada na versão{' '}
|
||||
{p.rules.client.version}.
|
||||
</p>
|
||||
</Panel>
|
||||
)}
|
||||
<Link className="underline" href="/pessoas">
|
||||
Voltar a Pessoas e contratações
|
||||
</Link>
|
||||
@@ -836,7 +867,11 @@ export default function PeopleShow({
|
||||
{p.contract && (
|
||||
<Panel
|
||||
id="people-report-contract"
|
||||
title="Minuta contratual — preparação interna"
|
||||
title={
|
||||
p.contract.status === 'formalized'
|
||||
? 'Contrato formalizado'
|
||||
: 'Minuta contratual — preparação interna'
|
||||
}
|
||||
>
|
||||
<p>
|
||||
{p.contract.reference} · início proposto{' '}
|
||||
@@ -845,13 +880,38 @@ export default function PeopleShow({
|
||||
<p className="whitespace-pre-wrap">
|
||||
{p.contract.terms}
|
||||
</p>
|
||||
<p className="mt-3 text-sm">
|
||||
Não comprova assinatura ou contratação concluída.
|
||||
</p>
|
||||
{p.contract.status === 'formalized' ? (
|
||||
<div className="mt-3 space-y-2 text-sm">
|
||||
<p>
|
||||
Assinatura: {p.contract.signed_on} ·{' '}
|
||||
{p.contract.signed_reference} · Confirmado
|
||||
pela direcção, pessoa #
|
||||
{p.contract.formalized_by}
|
||||
</p>
|
||||
<a
|
||||
className="underline"
|
||||
href={`/pessoas/${p.id}/contrato-assinado`}
|
||||
>
|
||||
Descarregar contrato assinado
|
||||
</a>
|
||||
</div>
|
||||
) : (
|
||||
<p className="mt-3 text-sm">
|
||||
Não comprova assinatura ou contratação
|
||||
concluída.
|
||||
</p>
|
||||
)}
|
||||
</Panel>
|
||||
)}
|
||||
<PeopleClarifications processId={p.id} data={clarifications} />
|
||||
<div className="space-y-6 print:hidden">
|
||||
{canFormalize && p.status === 'contract_draft' && (
|
||||
<PeopleContractFormalization
|
||||
key={`formalize-${p.version}`}
|
||||
id={p.id}
|
||||
version={p.version}
|
||||
/>
|
||||
)}
|
||||
{actions.map((command) => (
|
||||
<div
|
||||
id={`people-${command}`}
|
||||
|
||||
Reference in New Issue
Block a user