@@ -126,7 +126,7 @@ export default function Reports(props: Props) {
|
||||
'@media print { .people-report-tools { display: none !important; } }'
|
||||
}
|
||||
</style>
|
||||
<div className="space-y-6 p-6">
|
||||
<div className="sgc-wide-report space-y-6 p-6">
|
||||
<PageTitle
|
||||
eyebrow="Pessoas e contratações"
|
||||
title="Relatórios"
|
||||
|
||||
@@ -191,7 +191,7 @@ export default function ReviewReport({
|
||||
return (
|
||||
<>
|
||||
<Head title={`Relatório de conferência · ${r.number}`} />
|
||||
<style>{`@media print { @page { size: A4 landscape; margin: 14mm; } .review-report { max-width: none; padding: 0; font-size: 11px; gap: 18px; } .review-report section { box-shadow: none; } .review-report table { font-size: 10px; table-layout: fixed; width: 100%; } .review-report th, .review-report td { overflow-wrap: anywhere; } .review-report thead { display: table-header-group; } .review-report tr { break-inside: avoid; } .review-report h2, .review-report h3 { break-after: avoid; } }`}</style>
|
||||
<style>{`@media print { @page { size: A4 landscape; margin: 14mm; } .review-report { display: block; max-width: none; padding: 0; font-size: 11px; } .review-report > * + * { margin-top: 18px; } .review-report section { box-shadow: none; } .review-report #report-fulfilment { break-inside: avoid; } .review-report table { font-size: 10px; table-layout: fixed; width: 100%; } .review-report th, .review-report td { overflow-wrap: anywhere; } .review-report thead { display: table-header-group; } .review-report tr { break-inside: avoid; } .review-report h2, .review-report h3 { break-after: avoid; } }`}</style>
|
||||
<div className="review-report mx-auto flex max-w-7xl flex-col gap-6 p-5 lg:p-8">
|
||||
<header className="hidden border-b-2 border-[#ed1c24] pb-3 print:block">
|
||||
<p className="font-semibold">
|
||||
|
||||
@@ -94,7 +94,7 @@ export default function ProcurementReports({
|
||||
return (
|
||||
<>
|
||||
<Head title="Relatórios de compras" />
|
||||
<div className="mx-auto max-w-7xl space-y-6 px-5 py-8 lg:px-8">
|
||||
<div className="sgc-wide-report mx-auto max-w-7xl space-y-6 px-5 py-8 lg:px-8">
|
||||
<PageTitle
|
||||
eyebrow="Consulta e relatórios"
|
||||
title="Relatórios de compras"
|
||||
|
||||
@@ -98,7 +98,7 @@ export default function SupplierImprovementReport({
|
||||
return (
|
||||
<>
|
||||
<Head title="Medidas de melhoria de fornecedores" />
|
||||
<div className="mx-auto max-w-7xl space-y-6 px-5 py-8 lg:px-8">
|
||||
<div className="sgc-wide-report mx-auto max-w-7xl space-y-6 px-5 py-8 lg:px-8">
|
||||
<PageTitle
|
||||
eyebrow="Relatórios · Fornecedores"
|
||||
title="Medidas de melhoria"
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { Head, Link, router, useForm } from '@inertiajs/react';
|
||||
import { useEffect, useRef } from 'react';
|
||||
import { Head, Link, router, useForm } from "@inertiajs/react";
|
||||
import { useEffect, useRef } from "react";
|
||||
import {
|
||||
FormErrors,
|
||||
PageTitle,
|
||||
Panel,
|
||||
controlClass,
|
||||
} from '@/components/procurement';
|
||||
import { Button } from '@/components/ui/button';
|
||||
} from "@/components/procurement";
|
||||
import { Button } from "@/components/ui/button";
|
||||
|
||||
type Deadline = {
|
||||
state: string;
|
||||
@@ -27,6 +27,7 @@ type Props = {
|
||||
};
|
||||
deadline: Deadline;
|
||||
canExpire: boolean;
|
||||
canCheck: boolean;
|
||||
canEdit: boolean;
|
||||
actorId: number;
|
||||
tenantId: number;
|
||||
@@ -48,36 +49,40 @@ type Props = {
|
||||
};
|
||||
};
|
||||
const labels: Record<string, string> = {
|
||||
inactive: 'Sem etapa pendente',
|
||||
unconfigured: 'Sem prazo configurado',
|
||||
unverified: 'Datas por conferir',
|
||||
running: 'Em prazo',
|
||||
expired: 'Prazo terminado',
|
||||
inactive: "Sem etapa pendente",
|
||||
unconfigured: "Sem prazo configurado",
|
||||
unverified: "Datas por conferir",
|
||||
running: "Em prazo",
|
||||
expired: "Prazo terminado",
|
||||
};
|
||||
const time = (value?: string | null) =>
|
||||
value ? new Date(value).toLocaleString('pt-MZ') : 'Por indicar';
|
||||
value ? new Date(value).toLocaleString("pt-MZ") : "Por indicar";
|
||||
export default function Expiry(props: Props) {
|
||||
const r = props.requisition;
|
||||
const form = useForm(`expiry:${props.tenantId}:${props.actorId}:${r.id}`, {
|
||||
operation_key: '',
|
||||
const check = useForm({
|
||||
operation_key: "",
|
||||
process_version: r.process_version,
|
||||
basis_hash: props.deadline.basis_hash || '',
|
||||
comment: '',
|
||||
});
|
||||
const form = useForm(`expiry:${props.tenantId}:${props.actorId}:${r.id}`, {
|
||||
operation_key: "",
|
||||
process_version: r.process_version,
|
||||
basis_hash: props.deadline.basis_hash || "",
|
||||
comment: "",
|
||||
});
|
||||
const current =
|
||||
form.data.process_version === r.process_version &&
|
||||
form.data.basis_hash === (props.deadline.basis_hash || '');
|
||||
form.data.basis_hash === (props.deadline.basis_hash || "");
|
||||
const ref = useRef<HTMLFormElement>(null);
|
||||
useEffect(() => {
|
||||
const node = ref.current;
|
||||
window.dispatchEvent(
|
||||
new CustomEvent('sgc:context-dirty', {
|
||||
new CustomEvent("sgc:context-dirty", {
|
||||
detail: { form: node, dirty: form.isDirty },
|
||||
}),
|
||||
);
|
||||
return () => {
|
||||
window.dispatchEvent(
|
||||
new CustomEvent('sgc:context-dirty', {
|
||||
new CustomEvent("sgc:context-dirty", {
|
||||
detail: { form: node, dirty: false },
|
||||
}),
|
||||
);
|
||||
@@ -95,7 +100,7 @@ export default function Expiry(props: Props) {
|
||||
Voltar à requisição
|
||||
</Link>
|
||||
<Panel
|
||||
title={`${labels[props.deadline.state] || 'Por conferir'} · ciclo ${r.approval_cycle}`}
|
||||
title={`${labels[props.deadline.state] || "Por conferir"} · ciclo ${r.approval_cycle}`}
|
||||
>
|
||||
<dl className="grid gap-3 text-sm">
|
||||
<div>
|
||||
@@ -131,6 +136,37 @@ export default function Expiry(props: Props) {
|
||||
>
|
||||
Actualizar conferência do prazo
|
||||
</Button>
|
||||
{props.canCheck && (
|
||||
<form
|
||||
className="mt-3"
|
||||
onSubmit={(event) => {
|
||||
event.preventDefault();
|
||||
const operation =
|
||||
check.data.operation_key || crypto.randomUUID();
|
||||
check.setData("operation_key", operation);
|
||||
check.transform(() => ({
|
||||
operation_key: operation,
|
||||
process_version: r.process_version,
|
||||
}));
|
||||
check.post(
|
||||
`/requisicoes/${r.id}/prazos/verificar`,
|
||||
{
|
||||
preserveScroll: true,
|
||||
onSuccess: () => check.reset(),
|
||||
},
|
||||
);
|
||||
}}
|
||||
>
|
||||
<FormErrors errors={check.errors} />
|
||||
<Button variant="outline" disabled={check.processing}>
|
||||
Verificar e executar acções devidas
|
||||
</Button>
|
||||
<p className="mt-2 text-sm text-muted-foreground">
|
||||
Regista os lembretes e alertas configurados; se o
|
||||
prazo terminou, devolve o pedido ao requisitante.
|
||||
</p>
|
||||
</form>
|
||||
)}
|
||||
</Panel>
|
||||
{props.canExpire && (
|
||||
<Panel
|
||||
@@ -144,7 +180,7 @@ export default function Expiry(props: Props) {
|
||||
event.preventDefault();
|
||||
const operation =
|
||||
form.data.operation_key || crypto.randomUUID();
|
||||
form.setData('operation_key', operation);
|
||||
form.setData("operation_key", operation);
|
||||
form.transform((data) => ({
|
||||
...data,
|
||||
operation_key: operation,
|
||||
@@ -173,8 +209,8 @@ export default function Expiry(props: Props) {
|
||||
...data,
|
||||
process_version: r.process_version,
|
||||
basis_hash:
|
||||
props.deadline.basis_hash || '',
|
||||
operation_key: '',
|
||||
props.deadline.basis_hash || "",
|
||||
operation_key: "",
|
||||
}))
|
||||
}
|
||||
>
|
||||
@@ -189,7 +225,7 @@ export default function Expiry(props: Props) {
|
||||
maxLength={2000}
|
||||
value={form.data.comment}
|
||||
onChange={(event) =>
|
||||
form.setData('comment', event.target.value)
|
||||
form.setData("comment", event.target.value)
|
||||
}
|
||||
/>
|
||||
</label>
|
||||
@@ -223,17 +259,17 @@ export default function Expiry(props: Props) {
|
||||
className="space-y-2 border-b py-4 break-words"
|
||||
>
|
||||
<h3 className="font-semibold">
|
||||
Ciclo {row.data.cycle} · devolvido para o ciclo{' '}
|
||||
Ciclo {row.data.cycle} · devolvido para o ciclo{" "}
|
||||
{row.data.next_cycle}
|
||||
</h3>
|
||||
<p>{row.reason}</p>
|
||||
<ul>
|
||||
{row.steps.map((step) => (
|
||||
<li key={step.id}>
|
||||
Etapa {step.position}:{' '}
|
||||
{step.decision === 'approved'
|
||||
? 'Aprovação preservada'
|
||||
: 'Etapa pendente no momento da devolução'}
|
||||
Etapa {step.position}:{" "}
|
||||
{step.decision === "approved"
|
||||
? "Aprovação preservada"
|
||||
: "Etapa pendente no momento da devolução"}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Head, Link, router, useForm } from '@inertiajs/react';
|
||||
import { PageTitle, Panel, controlClass } from '@/components/procurement';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { roleLabels, statusLabels } from '@/types/procurement';
|
||||
import { Head, Link, router, useForm } from "@inertiajs/react";
|
||||
import { PageTitle, Panel, controlClass } from "@/components/procurement";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { roleLabels, statusLabels } from "@/types/procurement";
|
||||
|
||||
type Props = {
|
||||
ready: boolean;
|
||||
@@ -61,13 +61,13 @@ export default function Notices({
|
||||
</div>
|
||||
<Panel
|
||||
title={
|
||||
view === 'unread'
|
||||
? 'Por ler'
|
||||
: view === 'outcomes'
|
||||
? 'Resultados dos meus pedidos'
|
||||
: view === 'tasks'
|
||||
? 'Intervenções pendentes'
|
||||
: 'Avisos internos'
|
||||
view === "unread"
|
||||
? "Por ler"
|
||||
: view === "outcomes"
|
||||
? "Resultados dos meus pedidos"
|
||||
: view === "tasks"
|
||||
? "Intervenções pendentes"
|
||||
: "Avisos internos"
|
||||
}
|
||||
description="Intervenções concluídas deixam a fila pendente. Resultados registados mantêm-se visíveis ao requisitante com acesso actual. Não são criados avisos retroactivos para decisões antigas."
|
||||
>
|
||||
@@ -86,7 +86,7 @@ export default function Notices({
|
||||
...data,
|
||||
view,
|
||||
}));
|
||||
form.get('/requisicoes/avisos', {
|
||||
form.get("/requisicoes/avisos", {
|
||||
preserveState: true,
|
||||
});
|
||||
}}
|
||||
@@ -99,7 +99,7 @@ export default function Notices({
|
||||
value={form.data.search}
|
||||
onChange={(event) =>
|
||||
form.setData(
|
||||
'search',
|
||||
"search",
|
||||
event.target.value,
|
||||
)
|
||||
}
|
||||
@@ -118,7 +118,7 @@ export default function Notices({
|
||||
</form>
|
||||
</details>
|
||||
<p className="mb-3 text-sm text-muted-foreground">
|
||||
{notices.total} aviso(s) nesta consulta · Página{' '}
|
||||
{notices.total} aviso(s) nesta consulta · Página{" "}
|
||||
{notices.current_page}
|
||||
</p>
|
||||
{!ready ? (
|
||||
@@ -135,28 +135,40 @@ export default function Notices({
|
||||
className="font-medium underline"
|
||||
href={notice.href}
|
||||
>
|
||||
{notice.reference} ·{' '}
|
||||
{notice.reference} ·{" "}
|
||||
{notice.role_label ??
|
||||
roleLabels[notice.role] ??
|
||||
notice.role}
|
||||
</Link>
|
||||
{notice.kind === 'outcome' && (
|
||||
{notice.kind === "outcome" && (
|
||||
<p className="mt-2 text-sm">
|
||||
Resultado registado:{' '}
|
||||
{notice.outcome === 'approved'
|
||||
? 'requisição aprovada'
|
||||
: notice.outcome === 'expired'
|
||||
? 'pedido devolvido por expiração'
|
||||
: 'requisição rejeitada'}
|
||||
. Estado actual:{' '}
|
||||
Resultado registado:{" "}
|
||||
{notice.outcome === "approved"
|
||||
? "requisição aprovada"
|
||||
: notice.outcome === "expired"
|
||||
? "pedido devolvido por expiração"
|
||||
: "requisição rejeitada"}
|
||||
. Estado actual:{" "}
|
||||
{statusLabels[notice.current_status] ??
|
||||
notice.current_status}
|
||||
. Consulte o processo para conhecer o
|
||||
fundamento e os passos seguintes.
|
||||
</p>
|
||||
)}
|
||||
{notice.kind === "reminder" && (
|
||||
<p className="mt-2 text-sm">
|
||||
Lembrete da etapa de aprovação pendente.
|
||||
</p>
|
||||
)}
|
||||
{notice.kind === "escalation" && (
|
||||
<p className="mt-2 text-sm">
|
||||
Alerta de escalamento da etapa pendente.
|
||||
Consulte o processo e os responsáveis
|
||||
actuais.
|
||||
</p>
|
||||
)}
|
||||
<p className="mt-2 text-sm">
|
||||
{notice.read_at ? 'Lido' : 'Por ler'} ·
|
||||
{notice.read_at ? "Lido" : "Por ler"} ·
|
||||
Criado em {notice.created_at}
|
||||
</p>
|
||||
{!notice.read_at && (
|
||||
|
||||
Reference in New Issue
Block a user