@@ -1,5 +1,5 @@
|
||||
import { Link, router } from "@inertiajs/react";
|
||||
import { Frame, card, button } from "./shared";
|
||||
import { Link, router } from '@inertiajs/react';
|
||||
import { Frame, card, button } from './shared';
|
||||
export default function Notifications({
|
||||
unread,
|
||||
notifications,
|
||||
@@ -19,10 +19,10 @@ export default function Notifications({
|
||||
};
|
||||
}) {
|
||||
const states: Record<string, string> = {
|
||||
received: "Recebido",
|
||||
in_review: "Em análise",
|
||||
contacted: "Contactado",
|
||||
closed: "Encerrado",
|
||||
received: 'Recebido',
|
||||
in_review: 'Em análise',
|
||||
contacted: 'Contactado',
|
||||
closed: 'Encerrado',
|
||||
};
|
||||
return (
|
||||
<Frame title="Notificações e acompanhamento">
|
||||
@@ -31,24 +31,28 @@ export default function Notifications({
|
||||
</Link>
|
||||
<p role="status">{unread} notificações por ler</p>
|
||||
{notifications.data.map((n) => (
|
||||
<article key={n.id} className={card + " space-y-3"}>
|
||||
<article key={n.id} className={card + ' space-y-3'}>
|
||||
<h2 className="text-xl font-bold">
|
||||
{n.kind === "received"
|
||||
? "Manifestação recebida"
|
||||
: n.kind === "status"
|
||||
? "Estado actualizado"
|
||||
: "Nova mensagem na conversa"}
|
||||
{n.kind === 'received'
|
||||
? 'Manifestação recebida'
|
||||
: n.kind === 'status'
|
||||
? 'Estado actualizado'
|
||||
: 'Nova mensagem na conversa'}
|
||||
</h2>
|
||||
<p>
|
||||
{n.payload.reference ??
|
||||
(n.payload.status
|
||||
? (states[n.payload.status] ?? n.payload.status)
|
||||
: "Consulte o pedido para ler a mensagem.")}
|
||||
: 'Consulte o pedido para ler a mensagem.')}
|
||||
</p>
|
||||
<p className="text-sm">
|
||||
{new Date(n.created_at).toLocaleString('pt-MZ')}
|
||||
</p>
|
||||
<p className="text-sm">{new Date(n.created_at).toLocaleString("pt-MZ")}</p>
|
||||
<div className="flex flex-wrap gap-4">
|
||||
<Link
|
||||
href={"/investidor/manifestacoes/" + n.submission_id}
|
||||
href={
|
||||
'/investidor/manifestacoes/' + n.submission_id
|
||||
}
|
||||
className="underline"
|
||||
>
|
||||
Abrir manifestação
|
||||
@@ -58,7 +62,9 @@ export default function Notifications({
|
||||
className={button}
|
||||
onClick={() =>
|
||||
router.post(
|
||||
"/investidor/notifications/" + n.id + "/read",
|
||||
'/investidor/notifications/' +
|
||||
n.id +
|
||||
'/read',
|
||||
{},
|
||||
{ preserveScroll: true },
|
||||
)
|
||||
@@ -70,7 +76,9 @@ export default function Notifications({
|
||||
</div>
|
||||
</article>
|
||||
))}
|
||||
{!notifications.data.length && <p>Ainda não existem notificações.</p>}
|
||||
{!notifications.data.length && (
|
||||
<p>Ainda não existem notificações.</p>
|
||||
)}
|
||||
<nav aria-label="Paginação" className="flex gap-4">
|
||||
{notifications.prev_page_url && (
|
||||
<Link href={notifications.prev_page_url}>Anterior</Link>
|
||||
|
||||
Reference in New Issue
Block a user