@@ -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
|
||||
|
||||
Reference in New Issue
Block a user