Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8e75018a35 | ||
|
|
a63aaeb655 | ||
|
|
48ea0c7303 | ||
|
|
89b06db89e | ||
|
|
928dfc0443 | ||
|
|
24b5d04fbc | ||
|
|
0750b26208 | ||
|
|
47f2d08b9b | ||
|
|
19f23a540a | ||
|
|
3e561b46bb | ||
|
|
3ae50e75d4 | ||
|
|
d69d5b1b0e | ||
|
|
3f012552e7 | ||
|
|
ae71161860 | ||
|
|
866a3fe539 | ||
|
|
c37a0461bf | ||
|
|
21932e5372 | ||
|
|
626137276f | ||
|
|
fc8e96cd58 | ||
|
|
90a098e7db | ||
|
|
285d829c27 | ||
|
|
0963cab395 | ||
|
|
6300fb98a7 | ||
|
|
0a67f95eaf | ||
|
|
c03c6d1b5a | ||
|
|
061156e5e7 | ||
|
|
71f5a56cbd | ||
|
|
683da3264d | ||
|
|
0475c34d64 | ||
|
|
167766fdfd | ||
|
|
a7c32aa128 | ||
|
|
b3d9ebe999 | ||
|
|
b713e24fbf | ||
|
|
a4206a7611 | ||
|
|
3d919350c8 | ||
|
|
4d22c07151 | ||
|
|
80df7310f3 | ||
|
|
9160939de2 | ||
|
|
9c2df341ea | ||
|
|
3c00956cf4 | ||
|
|
f5fb1e427d | ||
|
|
1e08f559ff | ||
|
|
1ab7bd8f36 | ||
|
|
f782fb36ad | ||
|
|
af2f0ed649 | ||
|
|
6b89a61dd7 | ||
|
|
7e868dbc46 | ||
|
|
b9e7de0ca0 | ||
|
|
0fef046d38 | ||
|
|
8f6b708d51 | ||
|
|
db7446f19a | ||
|
|
59ea762227 | ||
|
|
fe54b55af0 | ||
|
|
ecf692502f | ||
|
|
c72d4aad99 | ||
|
|
8488bd7b84 | ||
|
|
00a9fb9557 | ||
|
|
0908378ca0 | ||
|
|
46f538332e | ||
|
|
494ad6ef9e | ||
|
|
0a48bb414a | ||
|
|
06f2d473e3 | ||
|
|
5698266d3e | ||
|
|
41d3963d67 | ||
|
|
9b2e51732f | ||
|
|
43cc832274 | ||
|
|
4a189f82b2 | ||
|
|
f1f1ee4826 | ||
|
|
705ef97ff8 | ||
|
|
5b25414b9c | ||
|
|
e753ec8718 | ||
|
|
e208346614 | ||
|
|
854531bce0 | ||
|
|
597236c525 | ||
|
|
6fdfc99e7d | ||
|
|
045124be2f | ||
|
|
8c3cd7a3bf | ||
|
|
566ef2e123 | ||
|
|
49dba7c9be | ||
|
|
3529bffbbb | ||
|
|
db0c011b8b | ||
|
|
19f0187227 | ||
|
|
20b2f0e3c9 | ||
|
|
bbff8eb317 | ||
|
|
06165db8bb | ||
|
|
3966728ad4 | ||
|
|
4708b9ec82 | ||
|
|
1214171946 | ||
|
|
ce795cba58 | ||
|
|
942222df6a | ||
|
|
7f3313f3f3 | ||
|
|
a208caec55 | ||
|
|
e21dea582c | ||
|
|
c485960759 | ||
|
|
79db5cc065 | ||
|
|
92239d0a99 | ||
|
|
fefc6ce434 | ||
|
|
ac2891ce0d | ||
|
|
07b677be29 | ||
|
|
bd70c10047 | ||
|
|
85977d7229 | ||
|
|
3406723bd4 | ||
|
|
cb47df6e88 | ||
|
|
0121f67c65 | ||
|
|
a2bff3baeb | ||
|
|
defd9b33f5 | ||
|
|
8abf8791be | ||
|
|
5798152f7b | ||
|
|
4726ce1dfa | ||
|
|
00a9e698c6 | ||
|
|
bb5c9e25e2 | ||
|
|
a946f86cae | ||
|
|
7656ff9807 | ||
|
|
ad3130a160 | ||
|
|
eeeae75919 | ||
|
|
287ed34abf | ||
|
|
bd67cf49cc | ||
|
|
3d044a962a | ||
|
|
2a49dab8d5 | ||
|
|
17078adc45 | ||
|
|
bf277416ff | ||
|
|
5705978424 | ||
|
|
b0b7fba0f6 | ||
|
|
0a651f94c0 | ||
|
|
8cf2c23774 | ||
|
|
2475bc6797 | ||
|
|
570f3408c9 | ||
|
|
8d12d45621 | ||
|
|
3edd6ed317 | ||
|
|
fb17405fe9 | ||
|
|
f0fee9d22e | ||
|
|
f14f7ac3fd | ||
|
|
76fa2c91ab | ||
|
|
7e16bc8919 | ||
|
|
f3ff4f8939 | ||
|
|
e91294df22 | ||
|
|
8a09720030 | ||
|
|
3ccccc6792 | ||
|
|
f310f07987 | ||
|
|
e179fb33d7 | ||
|
|
3a3c64f1b3 | ||
|
|
73b571be71 | ||
|
|
5786af03d5 | ||
|
|
926a2934e4 | ||
|
|
a202bdc445 | ||
|
|
6d487b5834 | ||
|
|
4c4591fee5 |
No files matched your search
@@ -7,3 +7,4 @@ dist
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
coverage
|
coverage
|
||||||
.vscode
|
.vscode
|
||||||
|
storage/
|
||||||
+10
-3
@@ -1,11 +1,18 @@
|
|||||||
FROM node:20-slim
|
FROM node:20-slim
|
||||||
|
|
||||||
|
# Configurar Puppeteer para usar o Chromium do sistema
|
||||||
|
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
|
||||||
|
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
|
||||||
|
|
||||||
# Instalar dependências do sistema
|
# Instalar dependências do sistema
|
||||||
RUN apt-get update && apt-get install -y \
|
RUN apt-get update && apt-get install -y chromium \
|
||||||
chromium \
|
|
||||||
libgconf-2-4 \
|
libgconf-2-4 \
|
||||||
postgresql-client \
|
postgresql-client \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/* \
|
||||||
|
&& ln -sf /usr/bin/chromium /usr/bin/chromium-browser
|
||||||
|
|
||||||
|
# Verificar a instalação do Chromium
|
||||||
|
RUN chromium --version
|
||||||
|
|
||||||
# Criar diretório da aplicação
|
# Criar diretório da aplicação
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
import express from "express";
|
||||||
|
import cors from "cors";
|
||||||
|
import { PrismaClient } from "@prisma/client";
|
||||||
|
import usuariosRoutes from "./routes/usuarios";
|
||||||
|
import clientesRoutes from "./routes/clientes";
|
||||||
|
import processosRoutes from "./routes/processos";
|
||||||
|
import audienciasRoutes from "./routes/audiencias";
|
||||||
|
|
||||||
|
const app = express();
|
||||||
|
const prisma = new PrismaClient();
|
||||||
|
|
||||||
|
app.use(cors());
|
||||||
|
app.use(express.json());
|
||||||
|
|
||||||
|
app.use("/api/usuarios", usuariosRoutes);
|
||||||
|
app.use("/api/clientes", clientesRoutes);
|
||||||
|
app.use("/api/processos", processosRoutes);
|
||||||
|
app.use("/api/audiencias", audienciasRoutes);
|
||||||
|
|
||||||
|
app.get("/", (req, res) => {
|
||||||
|
res.json({ message: "API is running" });
|
||||||
|
});
|
||||||
|
|
||||||
|
export default app;
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
import { Request, Response } from "express";
|
||||||
|
import prisma from "../prisma/client";
|
||||||
|
|
||||||
|
// Lista todas as audiências
|
||||||
|
export async function getAudiencias(req: Request, res: Response) {
|
||||||
|
try {
|
||||||
|
const audiencias = await prisma.audiencia.findMany({
|
||||||
|
orderBy: { data: "asc" },
|
||||||
|
include: {
|
||||||
|
processo: {
|
||||||
|
select: { numero: true, nomeContraparte: true }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
res.json(audiencias);
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Erro ao buscar audiências:", error);
|
||||||
|
res.status(500).json({ error: "Erro ao buscar audiências" });
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
import { Router } from "express";
|
||||||
|
import { getAudiencias } from "../controllers/audienciasController";
|
||||||
|
|
||||||
|
const router = Router();
|
||||||
|
|
||||||
|
// GET /api/audiencias - Lista todas as audiências
|
||||||
|
router.get("/", getAudiencias);
|
||||||
|
|
||||||
|
export default router;
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
version: '3.8'
|
||||||
|
services:
|
||||||
|
backend:
|
||||||
|
build: .
|
||||||
|
ports:
|
||||||
|
- "5000:5000"
|
||||||
|
environment:
|
||||||
|
- NODE_ENV=production
|
||||||
|
- CHROME_BIN=/usr/bin/google-chrome-stable
|
||||||
|
# ... outras variáveis de ambiente existentes ...
|
||||||
|
volumes:
|
||||||
|
- .:/usr/src/app
|
||||||
|
- /usr/src/app/node_modules
|
||||||
Generated
+228
-35
@@ -36,6 +36,7 @@
|
|||||||
"multer": "^1.4.5-lts.1",
|
"multer": "^1.4.5-lts.1",
|
||||||
"opentimestamps-javascript": "^1.0.1",
|
"opentimestamps-javascript": "^1.0.1",
|
||||||
"pdf-lib": "^1.17.1",
|
"pdf-lib": "^1.17.1",
|
||||||
|
"pdfkit": "^0.13.0",
|
||||||
"puppeteer": "^24.5.0",
|
"puppeteer": "^24.5.0",
|
||||||
"qrcode": "^1.5.3",
|
"qrcode": "^1.5.3",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
@@ -2101,6 +2102,15 @@
|
|||||||
"win32"
|
"win32"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"node_modules/@swc/helpers": {
|
||||||
|
"version": "0.3.17",
|
||||||
|
"resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.3.17.tgz",
|
||||||
|
"integrity": "sha512-tb7Iu+oZ+zWJZ3HJqwx8oNwSDIU440hmVMDPhpACWQWnrZHK99Bxs70gT1L2dnr5Hg50ZRWEFkQCAnOVVV0z1Q==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"tslib": "^2.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@tailwindcss/node": {
|
"node_modules/@tailwindcss/node": {
|
||||||
"version": "4.1.1",
|
"version": "4.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/@tailwindcss/node/-/node-4.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/@tailwindcss/node/-/node-4.1.1.tgz",
|
||||||
@@ -3592,7 +3602,6 @@
|
|||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.2.tgz",
|
||||||
"integrity": "sha512-LHE+8BuR7RYGDKvnrmcuSq3tDcKv9OFEXQt/HpbZhY7V6h0zlUXutnAD82GiFx9rdieCMjkvtcsPqBwgUl1Iiw==",
|
"integrity": "sha512-LHE+8BuR7RYGDKvnrmcuSq3tDcKv9OFEXQt/HpbZhY7V6h0zlUXutnAD82GiFx9rdieCMjkvtcsPqBwgUl1Iiw==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"call-bound": "^1.0.3",
|
"call-bound": "^1.0.3",
|
||||||
@@ -3833,7 +3842,6 @@
|
|||||||
"version": "1.0.7",
|
"version": "1.0.7",
|
||||||
"resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz",
|
"resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz",
|
||||||
"integrity": "sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==",
|
"integrity": "sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"possible-typed-array-names": "^1.0.0"
|
"possible-typed-array-names": "^1.0.0"
|
||||||
@@ -4195,6 +4203,15 @@
|
|||||||
"integrity": "sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w==",
|
"integrity": "sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/brotli": {
|
||||||
|
"version": "1.3.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/brotli/-/brotli-1.3.3.tgz",
|
||||||
|
"integrity": "sha512-oTKjJdShmDuGW94SyyaoQvAjf30dZaHnjJ8uAF+u2/vGJkJbJPJAT1gDiOJP5v1Zb6f9KEyW/1HpuaWIXtGHPg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"base64-js": "^1.1.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/browserslist": {
|
"node_modules/browserslist": {
|
||||||
"version": "4.24.4",
|
"version": "4.24.4",
|
||||||
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.24.4.tgz",
|
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.24.4.tgz",
|
||||||
@@ -4390,7 +4407,6 @@
|
|||||||
"version": "1.0.8",
|
"version": "1.0.8",
|
||||||
"resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.8.tgz",
|
"resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.8.tgz",
|
||||||
"integrity": "sha512-oKlSFMcMwpUg2ednkhQ454wfWiU/ul3CkJe/PEHcTKuiX6RpbehUiFMXu13HalGZxfUwCQzZG747YXBn1im9ww==",
|
"integrity": "sha512-oKlSFMcMwpUg2ednkhQ454wfWiU/ul3CkJe/PEHcTKuiX6RpbehUiFMXu13HalGZxfUwCQzZG747YXBn1im9ww==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"call-bind-apply-helpers": "^1.0.0",
|
"call-bind-apply-helpers": "^1.0.0",
|
||||||
@@ -4701,6 +4717,15 @@
|
|||||||
"url": "https://github.com/chalk/wrap-ansi?sponsor=1"
|
"url": "https://github.com/chalk/wrap-ansi?sponsor=1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/clone": {
|
||||||
|
"version": "2.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/clone/-/clone-2.1.2.tgz",
|
||||||
|
"integrity": "sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.8"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/clsx": {
|
"node_modules/clsx": {
|
||||||
"version": "2.1.1",
|
"version": "2.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/clsx/-/clsx-2.1.1.tgz",
|
||||||
@@ -4986,6 +5011,12 @@
|
|||||||
"node": "*"
|
"node": "*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/crypto-js": {
|
||||||
|
"version": "4.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.2.0.tgz",
|
||||||
|
"integrity": "sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/css-box-model": {
|
"node_modules/css-box-model": {
|
||||||
"version": "1.2.1",
|
"version": "1.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/css-box-model/-/css-box-model-1.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/css-box-model/-/css-box-model-1.2.1.tgz",
|
||||||
@@ -5131,6 +5162,38 @@
|
|||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/deep-equal": {
|
||||||
|
"version": "2.2.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-2.2.3.tgz",
|
||||||
|
"integrity": "sha512-ZIwpnevOurS8bpT4192sqAowWM76JDKSHYzMLty3BZGSswgq6pBaH3DhCSW5xVAZICZyKdOBPjwww5wfgT/6PA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"array-buffer-byte-length": "^1.0.0",
|
||||||
|
"call-bind": "^1.0.5",
|
||||||
|
"es-get-iterator": "^1.1.3",
|
||||||
|
"get-intrinsic": "^1.2.2",
|
||||||
|
"is-arguments": "^1.1.1",
|
||||||
|
"is-array-buffer": "^3.0.2",
|
||||||
|
"is-date-object": "^1.0.5",
|
||||||
|
"is-regex": "^1.1.4",
|
||||||
|
"is-shared-array-buffer": "^1.0.2",
|
||||||
|
"isarray": "^2.0.5",
|
||||||
|
"object-is": "^1.1.5",
|
||||||
|
"object-keys": "^1.1.1",
|
||||||
|
"object.assign": "^4.1.4",
|
||||||
|
"regexp.prototype.flags": "^1.5.1",
|
||||||
|
"side-channel": "^1.0.4",
|
||||||
|
"which-boxed-primitive": "^1.0.2",
|
||||||
|
"which-collection": "^1.0.1",
|
||||||
|
"which-typed-array": "^1.1.13"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/deep-is": {
|
"node_modules/deep-is": {
|
||||||
"version": "0.1.4",
|
"version": "0.1.4",
|
||||||
"resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz",
|
"resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz",
|
||||||
@@ -5142,7 +5205,6 @@
|
|||||||
"version": "1.1.4",
|
"version": "1.1.4",
|
||||||
"resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz",
|
"resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz",
|
||||||
"integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==",
|
"integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"es-define-property": "^1.0.0",
|
"es-define-property": "^1.0.0",
|
||||||
@@ -5160,7 +5222,6 @@
|
|||||||
"version": "1.2.1",
|
"version": "1.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.1.tgz",
|
||||||
"integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==",
|
"integrity": "sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"define-data-property": "^1.0.1",
|
"define-data-property": "^1.0.1",
|
||||||
@@ -5271,6 +5332,12 @@
|
|||||||
"integrity": "sha512-yRtvFD8Oyk7C9Os3GmnFZLu53yAfsnyw1s+mLmHHUK0GQEc9zthHWvS1r67Zqzm5t7v56PILHIVZ7kmFMaL2yQ==",
|
"integrity": "sha512-yRtvFD8Oyk7C9Os3GmnFZLu53yAfsnyw1s+mLmHHUK0GQEc9zthHWvS1r67Zqzm5t7v56PILHIVZ7kmFMaL2yQ==",
|
||||||
"license": "BSD-3-Clause"
|
"license": "BSD-3-Clause"
|
||||||
},
|
},
|
||||||
|
"node_modules/dfa": {
|
||||||
|
"version": "1.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/dfa/-/dfa-1.2.0.tgz",
|
||||||
|
"integrity": "sha512-ED3jP8saaweFTjeGX8HQPjeC1YYyZs98jGNZx6IiBvxW7JG5v492kamAQB3m2wop07CvU/RQmzcKr6bgcC5D/Q==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/didyoumean": {
|
"node_modules/didyoumean": {
|
||||||
"version": "1.2.2",
|
"version": "1.2.2",
|
||||||
"resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz",
|
"resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz",
|
||||||
@@ -5566,6 +5633,26 @@
|
|||||||
"node": ">= 0.4"
|
"node": ">= 0.4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/es-get-iterator": {
|
||||||
|
"version": "1.1.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/es-get-iterator/-/es-get-iterator-1.1.3.tgz",
|
||||||
|
"integrity": "sha512-sPZmqHBe6JIiTfN5q2pEi//TwxmAFHwj/XEuYjTuse78i8KxaqMTTzxPoFKuzRpDpTJ+0NAbpfenkmH2rePtuw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"call-bind": "^1.0.2",
|
||||||
|
"get-intrinsic": "^1.1.3",
|
||||||
|
"has-symbols": "^1.0.3",
|
||||||
|
"is-arguments": "^1.1.1",
|
||||||
|
"is-map": "^2.0.2",
|
||||||
|
"is-set": "^2.0.2",
|
||||||
|
"is-string": "^1.0.7",
|
||||||
|
"isarray": "^2.0.5",
|
||||||
|
"stop-iteration-iterator": "^1.0.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/es-iterator-helpers": {
|
"node_modules/es-iterator-helpers": {
|
||||||
"version": "1.2.1",
|
"version": "1.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/es-iterator-helpers/-/es-iterator-helpers-1.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/es-iterator-helpers/-/es-iterator-helpers-1.2.1.tgz",
|
||||||
@@ -6487,11 +6574,27 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/fontkit": {
|
||||||
|
"version": "1.9.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/fontkit/-/fontkit-1.9.0.tgz",
|
||||||
|
"integrity": "sha512-HkW/8Lrk8jl18kzQHvAw9aTHe1cqsyx5sDnxncx652+CIfhawokEPkeM3BoIC+z/Xv7a0yMr0f3pRRwhGH455g==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@swc/helpers": "^0.3.13",
|
||||||
|
"brotli": "^1.3.2",
|
||||||
|
"clone": "^2.1.2",
|
||||||
|
"deep-equal": "^2.0.5",
|
||||||
|
"dfa": "^1.2.0",
|
||||||
|
"restructure": "^2.0.1",
|
||||||
|
"tiny-inflate": "^1.0.3",
|
||||||
|
"unicode-properties": "^1.3.1",
|
||||||
|
"unicode-trie": "^2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/for-each": {
|
"node_modules/for-each": {
|
||||||
"version": "0.3.5",
|
"version": "0.3.5",
|
||||||
"resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.5.tgz",
|
"resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.5.tgz",
|
||||||
"integrity": "sha512-dKx12eRCVIzqCxFGplyFKJMPvLEWgmNtUrpTiJIR5u97zEhRG8ySrtboPHZXx7daLxQVrl643cTzbab2tkQjxg==",
|
"integrity": "sha512-dKx12eRCVIzqCxFGplyFKJMPvLEWgmNtUrpTiJIR5u97zEhRG8ySrtboPHZXx7daLxQVrl643cTzbab2tkQjxg==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"is-callable": "^1.2.7"
|
"is-callable": "^1.2.7"
|
||||||
@@ -6658,7 +6761,6 @@
|
|||||||
"version": "1.2.3",
|
"version": "1.2.3",
|
||||||
"resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz",
|
"resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz",
|
||||||
"integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==",
|
"integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"funding": {
|
"funding": {
|
||||||
"url": "https://github.com/sponsors/ljharb"
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
@@ -6929,7 +7031,6 @@
|
|||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.1.0.tgz",
|
||||||
"integrity": "sha512-R3pbpkcIqv2Pm3dUwgjclDRVmWpTJW2DcMzcIhEXEx1oh/CEMObMm3KLmRJOdvhM7o4uQBnwr8pzRK2sJWIqfg==",
|
"integrity": "sha512-R3pbpkcIqv2Pm3dUwgjclDRVmWpTJW2DcMzcIhEXEx1oh/CEMObMm3KLmRJOdvhM7o4uQBnwr8pzRK2sJWIqfg==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 0.4"
|
"node": ">= 0.4"
|
||||||
@@ -6952,7 +7053,6 @@
|
|||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz",
|
||||||
"integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==",
|
"integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"es-define-property": "^1.0.0"
|
"es-define-property": "^1.0.0"
|
||||||
@@ -7198,7 +7298,6 @@
|
|||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.1.0.tgz",
|
||||||
"integrity": "sha512-4gd7VpWNQNB4UKKCFFVcp1AVv+FMOgs9NKzjHKusc8jTMhd5eL1NqQqOpE0KzMds804/yHlglp3uxgluOqAPLw==",
|
"integrity": "sha512-4gd7VpWNQNB4UKKCFFVcp1AVv+FMOgs9NKzjHKusc8jTMhd5eL1NqQqOpE0KzMds804/yHlglp3uxgluOqAPLw==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"es-errors": "^1.3.0",
|
"es-errors": "^1.3.0",
|
||||||
@@ -7255,11 +7354,26 @@
|
|||||||
"node": ">= 0.10"
|
"node": ">= 0.10"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/is-arguments": {
|
||||||
|
"version": "1.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.2.0.tgz",
|
||||||
|
"integrity": "sha512-7bVbi0huj/wrIAOzb8U1aszg9kdi3KN/CyU19CTI7tAoZYEZoL9yCDXpbXN+uPsuWnP02cyug1gleqq+TU+YCA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"call-bound": "^1.0.2",
|
||||||
|
"has-tostringtag": "^1.0.2"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/is-array-buffer": {
|
"node_modules/is-array-buffer": {
|
||||||
"version": "3.0.5",
|
"version": "3.0.5",
|
||||||
"resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.5.tgz",
|
"resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.5.tgz",
|
||||||
"integrity": "sha512-DDfANUiiG2wC1qawP66qlTugJeL5HyzMpfr8lLK+jMQirGzNod0B12cFB/9q838Ru27sBwfw78/rdoU7RERz6A==",
|
"integrity": "sha512-DDfANUiiG2wC1qawP66qlTugJeL5HyzMpfr8lLK+jMQirGzNod0B12cFB/9q838Ru27sBwfw78/rdoU7RERz6A==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"call-bind": "^1.0.8",
|
"call-bind": "^1.0.8",
|
||||||
@@ -7303,7 +7417,6 @@
|
|||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.1.0.tgz",
|
||||||
"integrity": "sha512-n4ZT37wG78iz03xPRKJrHTdZbe3IicyucEtdRsV5yglwc3GyUfbAfpSeD0FJ41NbUNSt5wbhqfp1fS+BgnvDFQ==",
|
"integrity": "sha512-n4ZT37wG78iz03xPRKJrHTdZbe3IicyucEtdRsV5yglwc3GyUfbAfpSeD0FJ41NbUNSt5wbhqfp1fS+BgnvDFQ==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"has-bigints": "^1.0.2"
|
"has-bigints": "^1.0.2"
|
||||||
@@ -7332,7 +7445,6 @@
|
|||||||
"version": "1.2.2",
|
"version": "1.2.2",
|
||||||
"resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.2.2.tgz",
|
"resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.2.2.tgz",
|
||||||
"integrity": "sha512-wa56o2/ElJMYqjCjGkXri7it5FbebW5usLw/nPmCMs5DeZ7eziSYZhSmPRn0txqeW4LnAmQQU7FgqLpsEFKM4A==",
|
"integrity": "sha512-wa56o2/ElJMYqjCjGkXri7it5FbebW5usLw/nPmCMs5DeZ7eziSYZhSmPRn0txqeW4LnAmQQU7FgqLpsEFKM4A==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"call-bound": "^1.0.3",
|
"call-bound": "^1.0.3",
|
||||||
@@ -7355,7 +7467,6 @@
|
|||||||
"version": "1.2.7",
|
"version": "1.2.7",
|
||||||
"resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz",
|
"resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz",
|
||||||
"integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==",
|
"integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 0.4"
|
"node": ">= 0.4"
|
||||||
@@ -7401,7 +7512,6 @@
|
|||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.1.0.tgz",
|
||||||
"integrity": "sha512-PwwhEakHVKTdRNVOw+/Gyh0+MzlCl4R6qKvkhuvLtPMggI1WAHt9sOwZxQLSGpUaDnrdyDsomoRgNnCfKNSXXg==",
|
"integrity": "sha512-PwwhEakHVKTdRNVOw+/Gyh0+MzlCl4R6qKvkhuvLtPMggI1WAHt9sOwZxQLSGpUaDnrdyDsomoRgNnCfKNSXXg==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"call-bound": "^1.0.2",
|
"call-bound": "^1.0.2",
|
||||||
@@ -7485,7 +7595,6 @@
|
|||||||
"version": "2.0.3",
|
"version": "2.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.3.tgz",
|
||||||
"integrity": "sha512-1Qed0/Hr2m+YqxnM09CjA2d/i6YZNfF6R2oRAOj36eUdS6qIV/huPJNSEpKbupewFs+ZsJlxsjjPbc0/afW6Lw==",
|
"integrity": "sha512-1Qed0/Hr2m+YqxnM09CjA2d/i6YZNfF6R2oRAOj36eUdS6qIV/huPJNSEpKbupewFs+ZsJlxsjjPbc0/afW6Lw==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 0.4"
|
"node": ">= 0.4"
|
||||||
@@ -7508,7 +7617,6 @@
|
|||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.1.1.tgz",
|
||||||
"integrity": "sha512-lZhclumE1G6VYD8VHe35wFaIif+CTy5SJIi5+3y4psDgWu4wPDoBhF8NxUOinEc7pHgiTsT6MaBb92rKhhD+Xw==",
|
"integrity": "sha512-lZhclumE1G6VYD8VHe35wFaIif+CTy5SJIi5+3y4psDgWu4wPDoBhF8NxUOinEc7pHgiTsT6MaBb92rKhhD+Xw==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"call-bound": "^1.0.3",
|
"call-bound": "^1.0.3",
|
||||||
@@ -7525,7 +7633,6 @@
|
|||||||
"version": "1.2.1",
|
"version": "1.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.2.1.tgz",
|
||||||
"integrity": "sha512-MjYsKHO5O7mCsmRGxWcLWheFqN9DJ/2TmngvjKXihe6efViPqc274+Fx/4fYj/r03+ESvBdTXK0V6tA3rgez1g==",
|
"integrity": "sha512-MjYsKHO5O7mCsmRGxWcLWheFqN9DJ/2TmngvjKXihe6efViPqc274+Fx/4fYj/r03+ESvBdTXK0V6tA3rgez1g==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"call-bound": "^1.0.2",
|
"call-bound": "^1.0.2",
|
||||||
@@ -7544,7 +7651,6 @@
|
|||||||
"version": "2.0.3",
|
"version": "2.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/is-set/-/is-set-2.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/is-set/-/is-set-2.0.3.tgz",
|
||||||
"integrity": "sha512-iPAjerrse27/ygGLxw+EBR9agv9Y6uLeYVJMu+QNCoouJ1/1ri0mGrcWpfCqFZuzzx3WjtwxG098X+n4OuRkPg==",
|
"integrity": "sha512-iPAjerrse27/ygGLxw+EBR9agv9Y6uLeYVJMu+QNCoouJ1/1ri0mGrcWpfCqFZuzzx3WjtwxG098X+n4OuRkPg==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 0.4"
|
"node": ">= 0.4"
|
||||||
@@ -7557,7 +7663,6 @@
|
|||||||
"version": "1.0.4",
|
"version": "1.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.4.tgz",
|
||||||
"integrity": "sha512-ISWac8drv4ZGfwKl5slpHG9OwPNty4jOWPRIhBpxOoD+hqITiwuipOQ2bNthAzwA3B4fIjO4Nln74N0S9byq8A==",
|
"integrity": "sha512-ISWac8drv4ZGfwKl5slpHG9OwPNty4jOWPRIhBpxOoD+hqITiwuipOQ2bNthAzwA3B4fIjO4Nln74N0S9byq8A==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"call-bound": "^1.0.3"
|
"call-bound": "^1.0.3"
|
||||||
@@ -7573,7 +7678,6 @@
|
|||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/is-string/-/is-string-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/is-string/-/is-string-1.1.1.tgz",
|
||||||
"integrity": "sha512-BtEeSsoaQjlSPBemMQIrY1MY0uM6vnS1g5fmufYOtnxLGUZM2178PKbhsk7Ffv58IX+ZtcvoGwccYsh0PglkAA==",
|
"integrity": "sha512-BtEeSsoaQjlSPBemMQIrY1MY0uM6vnS1g5fmufYOtnxLGUZM2178PKbhsk7Ffv58IX+ZtcvoGwccYsh0PglkAA==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"call-bound": "^1.0.3",
|
"call-bound": "^1.0.3",
|
||||||
@@ -7590,7 +7694,6 @@
|
|||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.1.1.tgz",
|
||||||
"integrity": "sha512-9gGx6GTtCQM73BgmHQXfDmLtfjjTUDSyoxTCbp5WtoixAhfgsDirWIcVQ/IHpvI5Vgd5i/J5F7B9cN/WlVbC/w==",
|
"integrity": "sha512-9gGx6GTtCQM73BgmHQXfDmLtfjjTUDSyoxTCbp5WtoixAhfgsDirWIcVQ/IHpvI5Vgd5i/J5F7B9cN/WlVbC/w==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"call-bound": "^1.0.2",
|
"call-bound": "^1.0.2",
|
||||||
@@ -7630,7 +7733,6 @@
|
|||||||
"version": "2.0.2",
|
"version": "2.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/is-weakmap/-/is-weakmap-2.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/is-weakmap/-/is-weakmap-2.0.2.tgz",
|
||||||
"integrity": "sha512-K5pXYOm9wqY1RgjpL3YTkF39tni1XajUIkawTLUo9EZEVUFga5gSQJF8nNS7ZwJQ02y+1YCNYcMh+HIf1ZqE+w==",
|
"integrity": "sha512-K5pXYOm9wqY1RgjpL3YTkF39tni1XajUIkawTLUo9EZEVUFga5gSQJF8nNS7ZwJQ02y+1YCNYcMh+HIf1ZqE+w==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 0.4"
|
"node": ">= 0.4"
|
||||||
@@ -7659,7 +7761,6 @@
|
|||||||
"version": "2.0.4",
|
"version": "2.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/is-weakset/-/is-weakset-2.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/is-weakset/-/is-weakset-2.0.4.tgz",
|
||||||
"integrity": "sha512-mfcwb6IzQyOKTs84CQMrOwW4gQcaTOAWJ0zzJCl2WSPDrWk/OzDaImWFH3djXhb24g4eudZfLRozAvPGw4d9hQ==",
|
"integrity": "sha512-mfcwb6IzQyOKTs84CQMrOwW4gQcaTOAWJ0zzJCl2WSPDrWk/OzDaImWFH3djXhb24g4eudZfLRozAvPGw4d9hQ==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"call-bound": "^1.0.3",
|
"call-bound": "^1.0.3",
|
||||||
@@ -7676,7 +7777,6 @@
|
|||||||
"version": "2.0.5",
|
"version": "2.0.5",
|
||||||
"resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz",
|
"resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz",
|
||||||
"integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==",
|
"integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/isexe": {
|
"node_modules/isexe": {
|
||||||
@@ -8209,6 +8309,25 @@
|
|||||||
"node": ">=10"
|
"node": ">=10"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/linebreak": {
|
||||||
|
"version": "1.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/linebreak/-/linebreak-1.1.0.tgz",
|
||||||
|
"integrity": "sha512-MHp03UImeVhB7XZtjd0E4n6+3xr5Dq/9xI/5FptGk5FrbDR3zagPa2DS6U8ks/3HjbKWG9Q1M2ufOzxV2qLYSQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"base64-js": "0.0.8",
|
||||||
|
"unicode-trie": "^2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/linebreak/node_modules/base64-js": {
|
||||||
|
"version": "0.0.8",
|
||||||
|
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-0.0.8.tgz",
|
||||||
|
"integrity": "sha512-3XSA2cR/h/73EzlXXdU6YNycmYI7+kicTxks4eJg2g39biHR84slg2+des+p7iHYhbRg/udIS4TD53WabcOUkw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/lines-and-columns": {
|
"node_modules/lines-and-columns": {
|
||||||
"version": "1.2.4",
|
"version": "1.2.4",
|
||||||
"resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz",
|
"resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz",
|
||||||
@@ -8845,11 +8964,26 @@
|
|||||||
"url": "https://github.com/sponsors/ljharb"
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/object-is": {
|
||||||
|
"version": "1.1.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.6.tgz",
|
||||||
|
"integrity": "sha512-F8cZ+KfGlSGi09lJT7/Nd6KJZ9ygtvYC0/UYYLI9nmQKLMnydpB9yvbv9K1uSkEu7FU9vYPmVwLg328tX+ot3Q==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"call-bind": "^1.0.7",
|
||||||
|
"define-properties": "^1.2.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/object-keys": {
|
"node_modules/object-keys": {
|
||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz",
|
||||||
"integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==",
|
"integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 0.4"
|
"node": ">= 0.4"
|
||||||
@@ -8859,7 +8993,6 @@
|
|||||||
"version": "4.1.7",
|
"version": "4.1.7",
|
||||||
"resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.7.tgz",
|
"resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.7.tgz",
|
||||||
"integrity": "sha512-nK28WOo+QIjBkDduTINE4JkF/UJJKyf2EJxvJKfblDpyg0Q+pkOHNTL0Qwy6NP6FhE/EnzV73BxxqcJaXY9anw==",
|
"integrity": "sha512-nK28WOo+QIjBkDduTINE4JkF/UJJKyf2EJxvJKfblDpyg0Q+pkOHNTL0Qwy6NP6FhE/EnzV73BxxqcJaXY9anw==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"call-bind": "^1.0.8",
|
"call-bind": "^1.0.8",
|
||||||
@@ -9271,6 +9404,18 @@
|
|||||||
"integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==",
|
"integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==",
|
||||||
"license": "0BSD"
|
"license": "0BSD"
|
||||||
},
|
},
|
||||||
|
"node_modules/pdfkit": {
|
||||||
|
"version": "0.13.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/pdfkit/-/pdfkit-0.13.0.tgz",
|
||||||
|
"integrity": "sha512-AW79eHU5eLd2vgRDS9z3bSoi0FA+gYm+100LLosrQQMLUzOBGVOhG7ABcMFpJu7Bpg+MT74XYHi4k9EuU/9EZw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"crypto-js": "^4.0.0",
|
||||||
|
"fontkit": "^1.8.1",
|
||||||
|
"linebreak": "^1.0.2",
|
||||||
|
"png-js": "^1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/pend": {
|
"node_modules/pend": {
|
||||||
"version": "1.2.0",
|
"version": "1.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz",
|
||||||
@@ -9322,6 +9467,11 @@
|
|||||||
"node": ">= 6"
|
"node": ">= 6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/png-js": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/png-js/-/png-js-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-k+YsbhpA9e+EFfKjTCH3VW6aoKlyNYI6NYdTfDL4CIvFnvsuO84ttonmZE7rc+v23SLTH8XX+5w/Ak9v0xGY4g=="
|
||||||
|
},
|
||||||
"node_modules/pngjs": {
|
"node_modules/pngjs": {
|
||||||
"version": "5.0.0",
|
"version": "5.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/pngjs/-/pngjs-5.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/pngjs/-/pngjs-5.0.0.tgz",
|
||||||
@@ -9335,7 +9485,6 @@
|
|||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.1.0.tgz",
|
||||||
"integrity": "sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg==",
|
"integrity": "sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 0.4"
|
"node": ">= 0.4"
|
||||||
@@ -10617,7 +10766,6 @@
|
|||||||
"version": "1.5.4",
|
"version": "1.5.4",
|
||||||
"resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.4.tgz",
|
"resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.4.tgz",
|
||||||
"integrity": "sha512-dYqgNSZbDwkaJ2ceRd9ojCGjBq+mOm9LmtXnAnEGyHhN/5R7iDW2TRw3h+o/jCFxus3P2LfWIIiwowAjANm7IA==",
|
"integrity": "sha512-dYqgNSZbDwkaJ2ceRd9ojCGjBq+mOm9LmtXnAnEGyHhN/5R7iDW2TRw3h+o/jCFxus3P2LfWIIiwowAjANm7IA==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"call-bind": "^1.0.8",
|
"call-bind": "^1.0.8",
|
||||||
@@ -10789,6 +10937,12 @@
|
|||||||
"node": ">=4"
|
"node": ">=4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/restructure": {
|
||||||
|
"version": "2.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/restructure/-/restructure-2.0.1.tgz",
|
||||||
|
"integrity": "sha512-e0dOpjm5DseomnXx2M5lpdZ5zoHqF1+bqdMJUohoYVVQa7cBdnk7fdmeI6byNWP/kiME72EeTiSypTCVnpLiDg==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/reusify": {
|
"node_modules/reusify": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz",
|
||||||
@@ -10957,7 +11111,6 @@
|
|||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.1.0.tgz",
|
||||||
"integrity": "sha512-x/+Cz4YrimQxQccJf5mKEbIa1NzeCRNI5Ecl/ekmlYaampdNLPalVyIcCZNNH3MvmqBugV5TMYZXv0ljslUlaw==",
|
"integrity": "sha512-x/+Cz4YrimQxQccJf5mKEbIa1NzeCRNI5Ecl/ekmlYaampdNLPalVyIcCZNNH3MvmqBugV5TMYZXv0ljslUlaw==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"call-bound": "^1.0.2",
|
"call-bound": "^1.0.2",
|
||||||
@@ -11075,7 +11228,6 @@
|
|||||||
"version": "1.2.2",
|
"version": "1.2.2",
|
||||||
"resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz",
|
"resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz",
|
||||||
"integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==",
|
"integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"define-data-property": "^1.1.4",
|
"define-data-property": "^1.1.4",
|
||||||
@@ -11093,7 +11245,6 @@
|
|||||||
"version": "2.0.2",
|
"version": "2.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/set-function-name/-/set-function-name-2.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/set-function-name/-/set-function-name-2.0.2.tgz",
|
||||||
"integrity": "sha512-7PGFlmtwsEADb0WYyvCMa1t+yke6daIG4Wirafur5kcf+MhUnPms1UeR0CKQdTZD81yESwMHbtn+TR+dMviakQ==",
|
"integrity": "sha512-7PGFlmtwsEADb0WYyvCMa1t+yke6daIG4Wirafur5kcf+MhUnPms1UeR0CKQdTZD81yESwMHbtn+TR+dMviakQ==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"define-data-property": "^1.1.4",
|
"define-data-property": "^1.1.4",
|
||||||
@@ -11443,6 +11594,19 @@
|
|||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/stop-iteration-iterator": {
|
||||||
|
"version": "1.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/stop-iteration-iterator/-/stop-iteration-iterator-1.1.0.tgz",
|
||||||
|
"integrity": "sha512-eLoXW/DHyl62zxY4SCaIgnRhuMr6ri4juEYARS8E6sCEqzKpOiE521Ucofdx+KnDZl5xmvGYaaKCk5FEOxJCoQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"es-errors": "^1.3.0",
|
||||||
|
"internal-slot": "^1.1.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/streamsearch": {
|
"node_modules/streamsearch": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz",
|
||||||
@@ -11916,6 +12080,12 @@
|
|||||||
"node": ">=0.8"
|
"node": ">=0.8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/tiny-inflate": {
|
||||||
|
"version": "1.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/tiny-inflate/-/tiny-inflate-1.0.3.tgz",
|
||||||
|
"integrity": "sha512-pkY1fj1cKHb2seWDy0B16HeWyczlJA9/WW3u3c4z/NiWDsO3DOU5D7nhTLE9CF0yXv/QZFY7sEJmj24dK+Rrqw==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/tiny-invariant": {
|
"node_modules/tiny-invariant": {
|
||||||
"version": "1.3.3",
|
"version": "1.3.3",
|
||||||
"resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.3.3.tgz",
|
"resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.3.3.tgz",
|
||||||
@@ -12273,6 +12443,32 @@
|
|||||||
"devOptional": true,
|
"devOptional": true,
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/unicode-properties": {
|
||||||
|
"version": "1.4.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/unicode-properties/-/unicode-properties-1.4.1.tgz",
|
||||||
|
"integrity": "sha512-CLjCCLQ6UuMxWnbIylkisbRj31qxHPAurvena/0iwSVbQ2G1VY5/HjV0IRabOEbDHlzZlRdCrD4NhB0JtU40Pg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"base64-js": "^1.3.0",
|
||||||
|
"unicode-trie": "^2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/unicode-trie": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/unicode-trie/-/unicode-trie-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-x7bc76x0bm4prf1VLg79uhAzKw8DVboClSN5VxJuQ+LKDOVEW9CdH+VY7SP+vX7xCYQqzzgQpFqz15zeLvAtZQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"pako": "^0.2.5",
|
||||||
|
"tiny-inflate": "^1.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/unicode-trie/node_modules/pako": {
|
||||||
|
"version": "0.2.9",
|
||||||
|
"resolved": "https://registry.npmjs.org/pako/-/pako-0.2.9.tgz",
|
||||||
|
"integrity": "sha512-NUcwaKxUxWrZLpDG+z/xZaCgQITkA/Dv4V/T6bw7VON6l1Xz/VnrBqrYjZQ12TamKHzITTfOEIYUj48y2KXImA==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/unload": {
|
"node_modules/unload": {
|
||||||
"version": "2.2.0",
|
"version": "2.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/unload/-/unload-2.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/unload/-/unload-2.2.0.tgz",
|
||||||
@@ -12606,7 +12802,6 @@
|
|||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.1.1.tgz",
|
||||||
"integrity": "sha512-TbX3mj8n0odCBFVlY8AxkqcHASw3L60jIuF8jFP78az3C2YhmGvqbHBpAjTRH2/xqYunrJ9g1jSyjCjpoWzIAA==",
|
"integrity": "sha512-TbX3mj8n0odCBFVlY8AxkqcHASw3L60jIuF8jFP78az3C2YhmGvqbHBpAjTRH2/xqYunrJ9g1jSyjCjpoWzIAA==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"is-bigint": "^1.1.0",
|
"is-bigint": "^1.1.0",
|
||||||
@@ -12654,7 +12849,6 @@
|
|||||||
"version": "1.0.2",
|
"version": "1.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/which-collection/-/which-collection-1.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/which-collection/-/which-collection-1.0.2.tgz",
|
||||||
"integrity": "sha512-K4jVyjnBdgvc86Y6BkaLZEN933SwYOuBFkdmBu9ZfkcAbdVbpITnDmjvZ/aQjRXQrv5EPkTnD1s39GiiqbngCw==",
|
"integrity": "sha512-K4jVyjnBdgvc86Y6BkaLZEN933SwYOuBFkdmBu9ZfkcAbdVbpITnDmjvZ/aQjRXQrv5EPkTnD1s39GiiqbngCw==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"is-map": "^2.0.3",
|
"is-map": "^2.0.3",
|
||||||
@@ -12679,7 +12873,6 @@
|
|||||||
"version": "1.1.19",
|
"version": "1.1.19",
|
||||||
"resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.19.tgz",
|
"resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.19.tgz",
|
||||||
"integrity": "sha512-rEvr90Bck4WZt9HHFC4DJMsjvu7x+r6bImz0/BrbWb7A2djJ8hnZMrWnHo9F8ssv0OMErasDhftrfROTyqSDrw==",
|
"integrity": "sha512-rEvr90Bck4WZt9HHFC4DJMsjvu7x+r6bImz0/BrbWb7A2djJ8hnZMrWnHo9F8ssv0OMErasDhftrfROTyqSDrw==",
|
||||||
"dev": true,
|
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"available-typed-arrays": "^1.0.7",
|
"available-typed-arrays": "^1.0.7",
|
||||||
|
|||||||
+1
-6
@@ -49,6 +49,7 @@
|
|||||||
"multer": "^1.4.5-lts.1",
|
"multer": "^1.4.5-lts.1",
|
||||||
"opentimestamps-javascript": "^1.0.1",
|
"opentimestamps-javascript": "^1.0.1",
|
||||||
"pdf-lib": "^1.17.1",
|
"pdf-lib": "^1.17.1",
|
||||||
|
"pdfkit": "^0.13.0",
|
||||||
"puppeteer": "^24.5.0",
|
"puppeteer": "^24.5.0",
|
||||||
"qrcode": "^1.5.3",
|
"qrcode": "^1.5.3",
|
||||||
"react": "^18.2.0",
|
"react": "^18.2.0",
|
||||||
@@ -111,11 +112,5 @@
|
|||||||
"--disable-gpu",
|
"--disable-gpu",
|
||||||
"--window-size=1920x1080"
|
"--window-size=1920x1080"
|
||||||
]
|
]
|
||||||
},
|
|
||||||
"puppeteerOptions": {
|
|
||||||
"browserFetcher": {
|
|
||||||
"platform": "win32",
|
|
||||||
"downloadPath": ".cache/puppeteer"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,106 @@
|
|||||||
|
// Adicionar ao schema.prisma existente (não substitui)
|
||||||
|
model SessaoNavegacao {
|
||||||
|
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
|
||||||
|
titulo String
|
||||||
|
descricao String?
|
||||||
|
status StatusSessao @default(INICIADA)
|
||||||
|
usuarioId String @db.Uuid
|
||||||
|
usuario Usuario @relation(fields: [usuarioId], references: [id])
|
||||||
|
|
||||||
|
// Dados da sessão
|
||||||
|
sessionKey String @unique
|
||||||
|
browserFingerprint Json
|
||||||
|
inicioSessao DateTime @default(now())
|
||||||
|
fimSessao DateTime?
|
||||||
|
duracaoSegundos Int?
|
||||||
|
|
||||||
|
// Arquivos gerados
|
||||||
|
videoPath String?
|
||||||
|
screenshotsPaths String[]
|
||||||
|
metadataPath String?
|
||||||
|
relatorioPdfPath String?
|
||||||
|
|
||||||
|
// Hashes e validação
|
||||||
|
checksumVideo String?
|
||||||
|
checksumMetadata String?
|
||||||
|
timestampProof String?
|
||||||
|
|
||||||
|
// Navegação registrada
|
||||||
|
acoes AcaoNavegacao[]
|
||||||
|
capturas CapturaNavegacao[]
|
||||||
|
|
||||||
|
criadoEm DateTime @default(now())
|
||||||
|
atualizadoEm DateTime @updatedAt
|
||||||
|
|
||||||
|
@@map("sessoes_navegacao")
|
||||||
|
}
|
||||||
|
|
||||||
|
model AcaoNavegacao {
|
||||||
|
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
|
||||||
|
sessaoId String @db.Uuid
|
||||||
|
sessao SessaoNavegacao @relation(fields: [sessaoId], references: [id], onDelete: Cascade)
|
||||||
|
|
||||||
|
timestamp DateTime
|
||||||
|
tipo TipoAcao
|
||||||
|
url String?
|
||||||
|
elemento String?
|
||||||
|
coordenadas Json?
|
||||||
|
valor String?
|
||||||
|
screenshot String?
|
||||||
|
|
||||||
|
metadados Json
|
||||||
|
|
||||||
|
criadoEm DateTime @default(now())
|
||||||
|
|
||||||
|
@@map("acoes_navegacao")
|
||||||
|
}
|
||||||
|
|
||||||
|
model CapturaNavegacao {
|
||||||
|
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
|
||||||
|
sessaoId String @db.Uuid
|
||||||
|
sessao SessaoNavegacao @relation(fields: [sessaoId], references: [id], onDelete: Cascade)
|
||||||
|
|
||||||
|
timestamp DateTime
|
||||||
|
url String
|
||||||
|
titulo String?
|
||||||
|
screenshotPath String
|
||||||
|
htmlContent String?
|
||||||
|
checksumHtml String?
|
||||||
|
checksumScreenshot String
|
||||||
|
|
||||||
|
// Metadados da página
|
||||||
|
networkRequests Json[]
|
||||||
|
cookies Json[]
|
||||||
|
localStorage Json?
|
||||||
|
sessionStorage Json?
|
||||||
|
|
||||||
|
criadoEm DateTime @default(now())
|
||||||
|
|
||||||
|
@@map("capturas_navegacao")
|
||||||
|
}
|
||||||
|
|
||||||
|
enum StatusSessao {
|
||||||
|
INICIADA
|
||||||
|
EM_ANDAMENTO
|
||||||
|
FINALIZANDO
|
||||||
|
CONCLUIDA
|
||||||
|
ERRO
|
||||||
|
CANCELADA
|
||||||
|
}
|
||||||
|
|
||||||
|
enum TipoAcao {
|
||||||
|
NAVEGACAO
|
||||||
|
CLIQUE
|
||||||
|
DIGITACAO
|
||||||
|
SCROLL
|
||||||
|
HOVER
|
||||||
|
DOWNLOAD
|
||||||
|
FORMULARIO
|
||||||
|
POPUP
|
||||||
|
REDIRECT
|
||||||
|
}
|
||||||
|
|
||||||
|
// Adicionar relação ao modelo Usuario existente
|
||||||
|
// Usuario {
|
||||||
|
// sessoesNavegacao SessaoNavegacao[]
|
||||||
|
// }
|
||||||
Binary file not shown.
@@ -0,0 +1,9 @@
|
|||||||
|
-- Identificar registros com UUID inválido
|
||||||
|
SELECT id, uuid_column
|
||||||
|
FROM atendimento
|
||||||
|
WHERE uuid_column !~ '^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$';
|
||||||
|
|
||||||
|
-- Atualizar registros com UUID inválido
|
||||||
|
UPDATE atendimento
|
||||||
|
SET uuid_column = gen_random_uuid()
|
||||||
|
WHERE uuid_column !~ '^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$';
|
||||||
+10
-2
@@ -48,6 +48,8 @@ import { CalculosList } from './components/calculos/CalculosList';
|
|||||||
import { NovoCalculo } from './components/calculos/NovoCalculo';
|
import { NovoCalculo } from './components/calculos/NovoCalculo';
|
||||||
import { DetalhesCalculo } from './components/calculos/DetalhesCalculo';
|
import { DetalhesCalculo } from './components/calculos/DetalhesCalculo';
|
||||||
import { NovoPensaoAlimenticia } from './components/calculos/NovoPensaoAlimenticia';
|
import { NovoPensaoAlimenticia } from './components/calculos/NovoPensaoAlimenticia';
|
||||||
|
import { DetalhePensaoAlimenticia } from './components/calculos/DetalhePensaoAlimenticia';
|
||||||
|
import { IniciarNavegacao } from './components/navegacao/IniciarNavegacao';
|
||||||
|
|
||||||
const queryClient = new QueryClient();
|
const queryClient = new QueryClient();
|
||||||
|
|
||||||
@@ -79,6 +81,7 @@ const router = createBrowserRouter(
|
|||||||
<Route path="/atendimentos" element={<AtendimentosPage />} />
|
<Route path="/atendimentos" element={<AtendimentosPage />} />
|
||||||
<Route path="/atendimentos/:id" element={<AtendimentoDetalhes />} />
|
<Route path="/atendimentos/:id" element={<AtendimentoDetalhes />} />
|
||||||
<Route path="/tarefas" element={<TarefasPage />} />
|
<Route path="/tarefas" element={<TarefasPage />} />
|
||||||
|
<Route path="/usuarios" element={<UsuariosPage />} />
|
||||||
<Route path="/processos-administrativos" element={<ProtectedRoute roles={['ADVOGADO_ADMIN', 'ADVOGADO', 'ASSISTENTE']}><ProcessoAdministrativoList /></ProtectedRoute>} />
|
<Route path="/processos-administrativos" element={<ProtectedRoute roles={['ADVOGADO_ADMIN', 'ADVOGADO', 'ASSISTENTE']}><ProcessoAdministrativoList /></ProtectedRoute>} />
|
||||||
<Route path="/processos-administrativos/:id" element={<ProtectedRoute roles={['ADVOGADO_ADMIN', 'ADVOGADO', 'ASSISTENTE']}><ProcessoAdminDetalhes /></ProtectedRoute>} />
|
<Route path="/processos-administrativos/:id" element={<ProtectedRoute roles={['ADVOGADO_ADMIN', 'ADVOGADO', 'ASSISTENTE']}><ProcessoAdminDetalhes /></ProtectedRoute>} />
|
||||||
<Route path="/provas/upload" element={<ProvaUpload />} />
|
<Route path="/provas/upload" element={<ProvaUpload />} />
|
||||||
@@ -113,7 +116,7 @@ const router = createBrowserRouter(
|
|||||||
} />
|
} />
|
||||||
|
|
||||||
{/* Rotas para Pensão Alimentícia */}
|
{/* Rotas para Pensão Alimentícia */}
|
||||||
<Route path="/pensao-alimenticia/nova" element={
|
<Route path="/pensao-alimenticia/novo" element={
|
||||||
<ProtectedRoute>
|
<ProtectedRoute>
|
||||||
<NovoPensaoAlimenticia />
|
<NovoPensaoAlimenticia />
|
||||||
</ProtectedRoute>
|
</ProtectedRoute>
|
||||||
@@ -121,7 +124,12 @@ const router = createBrowserRouter(
|
|||||||
|
|
||||||
<Route path="/pensao-alimenticia/:id" element={
|
<Route path="/pensao-alimenticia/:id" element={
|
||||||
<ProtectedRoute>
|
<ProtectedRoute>
|
||||||
<DetalhesCalculo />
|
<DetalhePensaoAlimenticia />
|
||||||
|
</ProtectedRoute>
|
||||||
|
} />
|
||||||
|
<Route path="/navegacao/iniciar" element={
|
||||||
|
<ProtectedRoute>
|
||||||
|
<IniciarNavegacao />
|
||||||
</ProtectedRoute>
|
</ProtectedRoute>
|
||||||
} />
|
} />
|
||||||
</Route>
|
</Route>
|
||||||
|
|||||||
@@ -144,12 +144,20 @@ export function CalculosList() {
|
|||||||
<div className="container mx-auto px-4 py-8">
|
<div className="container mx-auto px-4 py-8">
|
||||||
<div className="flex justify-between items-center mb-6">
|
<div className="flex justify-between items-center mb-6">
|
||||||
<h1 className="text-2xl font-bold text-gray-900">Cálculos Judiciais</h1>
|
<h1 className="text-2xl font-bold text-gray-900">Cálculos Judiciais</h1>
|
||||||
<Link
|
<div className="flex gap-3">
|
||||||
to="/calculos/novo"
|
<Link
|
||||||
className="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500"
|
to="/calculos/novo"
|
||||||
>
|
className="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500"
|
||||||
Novo Cálculo
|
>
|
||||||
</Link>
|
Novo Cálculo Judicial
|
||||||
|
</Link>
|
||||||
|
<Link
|
||||||
|
to="/pensao-alimenticia/novo"
|
||||||
|
className="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-green-600 hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500"
|
||||||
|
>
|
||||||
|
Novo Cálculo de Pensão
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Filtros */}
|
{/* Filtros */}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import { useParams } from 'react-router-dom';
|
import { useParams, useNavigate } from 'react-router-dom'; // Adicionar useNavigate
|
||||||
import { toast } from 'react-toastify';
|
import { toast } from 'react-toastify';
|
||||||
import api from '../../services/api';
|
import api from '../../services/api';
|
||||||
|
|
||||||
@@ -27,17 +27,36 @@ interface CalculoPensao {
|
|||||||
|
|
||||||
export function DetalhePensaoAlimenticia() {
|
export function DetalhePensaoAlimenticia() {
|
||||||
const { id } = useParams<{ id: string }>();
|
const { id } = useParams<{ id: string }>();
|
||||||
|
const navigate = useNavigate(); // Adicionar hook de navegação
|
||||||
const [calculo, setCalculo] = useState<CalculoPensao | null>(null);
|
const [calculo, setCalculo] = useState<CalculoPensao | null>(null);
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
// Verificação extra para garantir que o id está definido
|
||||||
|
if (!id || id === "novo") {
|
||||||
|
setLoading(false);
|
||||||
|
setCalculo(null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
const loadCalculo = async () => {
|
const loadCalculo = async () => {
|
||||||
try {
|
try {
|
||||||
const response = await api.get(`/pensao-alimenticia/${id}`);
|
console.log('[DetalhePensaoAlimenticia] Buscando cálculo para id:', id);
|
||||||
|
const response = await api.get(`/api/calculos/pensao-alimenticia/${id}`);
|
||||||
setCalculo(response.data);
|
setCalculo(response.data);
|
||||||
} catch (error) {
|
} catch (error: any) {
|
||||||
console.error('Erro ao carregar cálculo:', error);
|
// Log detalhado para depuração
|
||||||
toast.error('Falha ao carregar dados do cálculo');
|
console.error('[DetalhePensaoAlimenticia] Erro ao carregar cálculo:', error);
|
||||||
|
|
||||||
|
// Tratamento específico para erro 404 (cálculo não encontrado)
|
||||||
|
if (error?.response?.status === 404) {
|
||||||
|
toast.warn('Cálculo de pensão alimentícia não encontrado.');
|
||||||
|
} else {
|
||||||
|
toast.error(
|
||||||
|
error?.response?.data?.message ||
|
||||||
|
'Falha ao buscar cálculo de pensão alimentícia.'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
setCalculo(null);
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
@@ -51,7 +70,17 @@ export function DetalhePensaoAlimenticia() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!calculo) {
|
if (!calculo) {
|
||||||
return <div>Cálculo não encontrado</div>;
|
return (
|
||||||
|
<div className="bg-white shadow-md rounded-lg p-6 flex flex-col items-center">
|
||||||
|
<div className="text-lg mb-4 text-gray-700">Nenhum cálculo de pensão alimentícia encontrado.</div>
|
||||||
|
<button
|
||||||
|
className="px-4 py-2 bg-blue-600 text-white rounded-md shadow hover:bg-blue-700"
|
||||||
|
onClick={() => navigate('/pensao-alimenticia/novo')}
|
||||||
|
>
|
||||||
|
Criar novo cálculo
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -90,6 +119,15 @@ export function DetalhePensaoAlimenticia() {
|
|||||||
<p className="text-gray-700">{calculo.observacoes}</p>
|
<p className="text-gray-700">{calculo.observacoes}</p>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
<div className="mt-8 flex justify-end">
|
||||||
|
<button
|
||||||
|
className="px-4 py-2 bg-blue-600 text-white rounded-md shadow hover:bg-blue-700"
|
||||||
|
onClick={() => navigate('/pensao-alimenticia/novo')}
|
||||||
|
>
|
||||||
|
Criar novo cálculo
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
import { useState, useEffect } from 'react';
|
import { useState, useEffect } from 'react';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
import { toast } from 'react-toastify';
|
import { toast } from 'react-toastify';
|
||||||
|
import { useAuth } from '../../contexts/AuthContext';
|
||||||
import { formatarPercentual, parsePercentual } from '../../utils/formatters';
|
import { formatarPercentual, parsePercentual } from '../../utils/formatters';
|
||||||
|
|
||||||
interface ProcessoOption {
|
interface ProcessoOption {
|
||||||
@@ -16,6 +17,7 @@ interface ClienteOption {
|
|||||||
|
|
||||||
export function NovoPensaoAlimenticia() {
|
export function NovoPensaoAlimenticia() {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
const { getToken } = useAuth();
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const [formData, setFormData] = useState({
|
const [formData, setFormData] = useState({
|
||||||
titulo: '',
|
titulo: '',
|
||||||
@@ -101,13 +103,21 @@ export function NovoPensaoAlimenticia() {
|
|||||||
...formData,
|
...formData,
|
||||||
percentualSalarioMinimo: percentual,
|
percentualSalarioMinimo: percentual,
|
||||||
multaPactuada: formData.multaPactuada ? parsePercentual(formData.multaPactuada) : undefined,
|
multaPactuada: formData.multaPactuada ? parsePercentual(formData.multaPactuada) : undefined,
|
||||||
|
processoId: formData.processoId || undefined, // Corrigir aqui
|
||||||
|
clienteId: formData.clienteId || undefined, // Corrigir aqui
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const token = getToken();
|
||||||
|
if (!token) {
|
||||||
|
throw new Error('Usuário não autenticado. Faça login novamente.');
|
||||||
|
}
|
||||||
|
|
||||||
// Enviar solicitação para criar cálculo
|
// Enviar solicitação para criar cálculo
|
||||||
const response = await fetch('/api/pensao-alimenticia', {
|
const response = await fetch('/api/pensao-alimenticia', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
|
'Authorization': `Bearer ${token}` // Adicionar o token aqui
|
||||||
},
|
},
|
||||||
body: JSON.stringify(dadosParaEnviar),
|
body: JSON.stringify(dadosParaEnviar),
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -200,7 +200,7 @@ export const ClienteModal: React.FC<ClienteModalProps> = ({
|
|||||||
// Monitorar o valor do CEP para autopreenchimento
|
// Monitorar o valor do CEP para autopreenchimento
|
||||||
const cepValue = watch("cep");
|
const cepValue = watch("cep");
|
||||||
|
|
||||||
// Função para buscar dados do CEP - versão com gerenciamento de estados do componente
|
// Função para buscar dados do CEP - versão corrigida
|
||||||
const fetchAddressByCep = useCallback(async (cep: string) => {
|
const fetchAddressByCep = useCallback(async (cep: string) => {
|
||||||
if (!cep || cep.length !== 8) return;
|
if (!cep || cep.length !== 8) return;
|
||||||
|
|
||||||
@@ -212,37 +212,56 @@ export const ClienteModal: React.FC<ClienteModalProps> = ({
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (response.data && !response.data.erro) {
|
if (response.data && !response.data.erro) {
|
||||||
// Usar estado local para garantir re-renderização imediata
|
|
||||||
// Forçar preenchimento dos campos e atualização da interface
|
|
||||||
const endereco = response.data.logradouro || "";
|
const endereco = response.data.logradouro || "";
|
||||||
const bairro = response.data.bairro || "";
|
const bairro = response.data.bairro || "";
|
||||||
const cidade = response.data.localidade || "";
|
const cidade = response.data.localidade || "";
|
||||||
const estado = response.data.uf || "";
|
const estado = response.data.uf || "";
|
||||||
|
|
||||||
// Atualizar valores no formulário
|
// Só preencher endereço/bairro se vier valor da API
|
||||||
setValue("endereco", endereco, { shouldValidate: true });
|
if (endereco) setValue("endereco", endereco, { shouldValidate: true });
|
||||||
setValue("bairro", bairro, { shouldValidate: true });
|
if (bairro) setValue("bairro", bairro, { shouldValidate: true });
|
||||||
setValue("cidade", cidade, { shouldValidate: true });
|
setValue("cidade", cidade, { shouldValidate: true });
|
||||||
setValue("estado", estado, { shouldValidate: true });
|
setValue("estado", estado, { shouldValidate: true });
|
||||||
|
|
||||||
// Garantir re-renderização do componente
|
// Atualizar estado apenas para cidade/estado (não controlar endereço/bairro)
|
||||||
// Esta é a parte crucial: forçar o componente a re-renderizar com novo estado
|
|
||||||
setEnderecoState({
|
setEnderecoState({
|
||||||
endereco,
|
endereco: endereco,
|
||||||
bairro,
|
bairro: bairro,
|
||||||
cidade,
|
cidade: cidade,
|
||||||
estado,
|
estado: estado,
|
||||||
preenchido: true,
|
preenchido: false, // Não usar mais para travar campos
|
||||||
});
|
});
|
||||||
|
|
||||||
// Focar no próximo campo
|
// Focar no próximo campo apenas se o usuário não estiver digitando ativamente
|
||||||
setTimeout(() => {
|
// Esta alteração evita interromper o fluxo natural de preenchimento
|
||||||
const numeroInput = document.querySelector(
|
const activeElement = document.activeElement;
|
||||||
'input[name="numero"]'
|
const isUserTyping =
|
||||||
) as HTMLInputElement;
|
activeElement &&
|
||||||
if (numeroInput) numeroInput.focus();
|
(activeElement.tagName === 'INPUT' || activeElement.tagName === 'SELECT') &&
|
||||||
}, 100);
|
activeElement !== document.querySelector('input[name="cep"]');
|
||||||
|
|
||||||
|
// Só focar no campo número se o usuário não estiver digitando em outro campo
|
||||||
|
if (!isUserTyping) {
|
||||||
|
setTimeout(() => {
|
||||||
|
const numeroInput = document.querySelector(
|
||||||
|
'input[name="numero"]'
|
||||||
|
) as HTMLInputElement;
|
||||||
|
if (numeroInput) numeroInput.focus();
|
||||||
|
}, 100);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
// Se CEP não encontrado, limpar campos e permitir edição manual
|
||||||
|
setEnderecoState({
|
||||||
|
endereco: "",
|
||||||
|
bairro: "",
|
||||||
|
cidade: "",
|
||||||
|
estado: "",
|
||||||
|
preenchido: false,
|
||||||
|
});
|
||||||
|
setValue("endereco", "");
|
||||||
|
setValue("bairro", "");
|
||||||
|
setValue("cidade", "");
|
||||||
|
setValue("estado", "");
|
||||||
console.error("CEP não encontrado");
|
console.error("CEP não encontrado");
|
||||||
alert("CEP não encontrado. Por favor, verifique o CEP informado.");
|
alert("CEP não encontrado. Por favor, verifique o CEP informado.");
|
||||||
}
|
}
|
||||||
@@ -614,10 +633,9 @@ export const ClienteModal: React.FC<ClienteModalProps> = ({
|
|||||||
required: "Endereço é obrigatório",
|
required: "Endereço é obrigatório",
|
||||||
})}
|
})}
|
||||||
error={errors.endereco?.message}
|
error={errors.endereco?.message}
|
||||||
value={enderecoState.preenchido ? enderecoState.endereco : undefined}
|
// Remover value/controlado por enderecoState, deixar react-hook-form controlar
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
setValue("endereco", e.target.value);
|
setValue("endereco", e.target.value, { shouldValidate: true });
|
||||||
setEnderecoState(prev => ({...prev, endereco: e.target.value}));
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<FormInput
|
<FormInput
|
||||||
@@ -637,10 +655,9 @@ export const ClienteModal: React.FC<ClienteModalProps> = ({
|
|||||||
required: "Bairro é obrigatório",
|
required: "Bairro é obrigatório",
|
||||||
})}
|
})}
|
||||||
error={errors.bairro?.message}
|
error={errors.bairro?.message}
|
||||||
value={enderecoState.preenchido ? enderecoState.bairro : undefined}
|
// Remover value/controlado por enderecoState, deixar react-hook-form controlar
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
setValue("bairro", e.target.value);
|
setValue("bairro", e.target.value, { shouldValidate: true });
|
||||||
setEnderecoState(prev => ({...prev, bairro: e.target.value}));
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<FormInput
|
<FormInput
|
||||||
@@ -649,9 +666,9 @@ export const ClienteModal: React.FC<ClienteModalProps> = ({
|
|||||||
required: "Cidade é obrigatória",
|
required: "Cidade é obrigatória",
|
||||||
})}
|
})}
|
||||||
error={errors.cidade?.message}
|
error={errors.cidade?.message}
|
||||||
value={enderecoState.preenchido ? enderecoState.cidade : undefined}
|
value={typeof watch("cidade") === "string" ? watch("cidade") : enderecoState.cidade}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
setValue("cidade", e.target.value);
|
setValue("cidade", e.target.value, { shouldValidate: true });
|
||||||
setEnderecoState(prev => ({...prev, cidade: e.target.value}));
|
setEnderecoState(prev => ({...prev, cidade: e.target.value}));
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
@@ -662,9 +679,9 @@ export const ClienteModal: React.FC<ClienteModalProps> = ({
|
|||||||
})}
|
})}
|
||||||
options={estadosOptions}
|
options={estadosOptions}
|
||||||
error={errors.estado?.message}
|
error={errors.estado?.message}
|
||||||
value={enderecoState.preenchido ? enderecoState.estado : undefined}
|
value={typeof watch("estado") === "string" ? watch("estado") : enderecoState.estado}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
setValue("estado", e.target.value);
|
setValue("estado", e.target.value, { shouldValidate: true });
|
||||||
setEnderecoState(prev => ({...prev, estado: e.target.value}));
|
setEnderecoState(prev => ({...prev, estado: e.target.value}));
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -0,0 +1,65 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { useBenchmarking } from '../../hooks/useBenchmarking';
|
||||||
|
import { CheckCircleIcon, XCircleIcon, FolderOpenIcon } from '@heroicons/react/24/solid';
|
||||||
|
|
||||||
|
export const BenchmarkingEscritorio: React.FC = () => {
|
||||||
|
// Hook para buscar e calcular benchmarking
|
||||||
|
const { data: benchmarking, isLoading, error } = useBenchmarking();
|
||||||
|
|
||||||
|
if (isLoading) return <div>Carregando benchmarking...</div>;
|
||||||
|
if (error) return <div className="text-red-600">Erro ao buscar benchmarking</div>;
|
||||||
|
if (!benchmarking) return null;
|
||||||
|
|
||||||
|
// Cálculo da porcentagem de sucesso das causas
|
||||||
|
const totalCausas = benchmarking.procedentes + benchmarking.improcedentesOuSemMerito;
|
||||||
|
const sucessoPercent = totalCausas > 0 ? Math.round((benchmarking.procedentes / totalCausas) * 100) : 0;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="border rounded-xl p-6 shadow-lg bg-white dark:bg-gray-900 flex flex-col gap-6 max-w-md mx-auto">
|
||||||
|
<div className="grid grid-cols-2 gap-4">
|
||||||
|
<div className="flex items-center gap-2 bg-blue-50 dark:bg-blue-900 rounded-lg p-3">
|
||||||
|
<FolderOpenIcon className="h-7 w-7 text-blue-600" />
|
||||||
|
<div>
|
||||||
|
<div className="text-xs text-gray-500">Total de processos</div>
|
||||||
|
<div className="text-lg font-bold text-blue-700 dark:text-blue-300">{benchmarking.totalProcessos}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="flex items-center gap-2 bg-green-50 dark:bg-green-900 rounded-lg p-3">
|
||||||
|
<CheckCircleIcon className="h-7 w-7 text-green-600" />
|
||||||
|
<div>
|
||||||
|
<div className="text-xs text-gray-500">Processos ativos</div>
|
||||||
|
<div className="text-lg font-bold text-green-700 dark:text-green-300">{benchmarking.ativos}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="flex items-center gap-2 bg-green-50 dark:bg-green-900 rounded-lg p-3">
|
||||||
|
<CheckCircleIcon className="h-7 w-7 text-green-600" />
|
||||||
|
<div>
|
||||||
|
<div className="text-xs text-gray-500">Julgados procedentes</div>
|
||||||
|
<div className="text-lg font-bold text-green-700 dark:text-green-300">{benchmarking.procedentes}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="flex items-center gap-2 bg-red-50 dark:bg-red-900 rounded-lg p-3">
|
||||||
|
<XCircleIcon className="h-7 w-7 text-red-600" />
|
||||||
|
<div>
|
||||||
|
<div className="text-xs text-gray-500">Improcedentes/Sem mérito</div>
|
||||||
|
<div className="text-lg font-bold text-red-700 dark:text-red-300">{benchmarking.improcedentesOuSemMerito}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="flex items-center gap-2 bg-indigo-50 dark:bg-indigo-900 rounded-lg p-3">
|
||||||
|
<FolderOpenIcon className="h-7 w-7 text-indigo-600" />
|
||||||
|
<div>
|
||||||
|
<div className="text-xs text-gray-500">Ajuizados últimos 7 dias</div>
|
||||||
|
<div className="text-lg font-bold text-indigo-700 dark:text-indigo-300">{benchmarking.ajuizados7dias}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="flex items-center gap-2 bg-teal-50 dark:bg-teal-900 rounded-lg p-3">
|
||||||
|
<CheckCircleIcon className="h-7 w-7 text-teal-600" />
|
||||||
|
<div>
|
||||||
|
<div className="text-xs text-gray-500">% de sucesso das causas</div>
|
||||||
|
<div className="text-lg font-extrabold text-teal-700 dark:text-teal-300">{sucessoPercent}%</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1,117 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { useCalendarioAtendimentos } from '../../hooks/useCalendarioAtendimentos';
|
||||||
|
import { CalendarIcon, UserIcon, PresentationChartBarIcon } from '@heroicons/react/24/outline';
|
||||||
|
|
||||||
|
export const CalendarioAtendimentos: React.FC = () => {
|
||||||
|
const { data: eventos = [], isLoading, error } = useCalendarioAtendimentos();
|
||||||
|
|
||||||
|
// Estado para mês e ano selecionados
|
||||||
|
const hoje = new Date();
|
||||||
|
const [mesSelecionado, setMesSelecionado] = React.useState(hoje.getMonth() + 1);
|
||||||
|
const [anoSelecionado, setAnoSelecionado] = React.useState(hoje.getFullYear());
|
||||||
|
const diasMes = Array.from({ length: new Date(anoSelecionado, mesSelecionado, 0).getDate() }, (_, i) => i + 1);
|
||||||
|
const mesStr = mesSelecionado.toString().padStart(2, '0');
|
||||||
|
const anoStr = anoSelecionado.toString();
|
||||||
|
|
||||||
|
// Atualiza data selecionada ao trocar mês/ano
|
||||||
|
const [dataSelecionada, setDataSelecionada] = React.useState(`${anoStr}-${mesStr}-${hoje.getDate().toString().padStart(2, '0')}`);
|
||||||
|
React.useEffect(() => {
|
||||||
|
setDataSelecionada(`${anoStr}-${mesStr}-${hoje.getDate().toString().padStart(2, '0')}`);
|
||||||
|
}, [mesSelecionado, anoSelecionado]);
|
||||||
|
|
||||||
|
// Separar eventos futuros/próximos e passados considerando ano/mês
|
||||||
|
const hojeStr = `${anoStr}-${mesStr}-${hoje.getDate().toString().padStart(2, '0')}`;
|
||||||
|
const eventosProximos = eventos
|
||||||
|
.filter(ev => ev.data >= hojeStr)
|
||||||
|
.sort((a, b) => a.data.localeCompare(b.data))
|
||||||
|
.slice(0, 10);
|
||||||
|
const eventosPassados = eventos
|
||||||
|
.filter(ev => ev.data < hojeStr)
|
||||||
|
.sort((a, b) => b.data.localeCompare(a.data))
|
||||||
|
.slice(0, 10);
|
||||||
|
|
||||||
|
const eventosDoDia = eventos.filter(e => e.data === dataSelecionada);
|
||||||
|
|
||||||
|
if (isLoading) return <div>Carregando calendário...</div>;
|
||||||
|
if (error) return <div className="text-red-600">Erro ao buscar eventos</div>;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="border rounded-xl p-4 shadow-lg bg-white dark:bg-gray-900 flex flex-col gap-6 max-w-4xl mx-auto">
|
||||||
|
<h2 className="text-lg font-bold text-gray-800 dark:text-gray-100 mb-2 flex items-center gap-2">
|
||||||
|
<CalendarIcon className="h-6 w-6 text-blue-600" /> Calendário de Atendimentos e Audiências
|
||||||
|
</h2>
|
||||||
|
<div className="flex items-center gap-4 mb-2">
|
||||||
|
<button type="button" className="px-2 py-1 rounded bg-gray-100 dark:bg-gray-800" onClick={() => setMesSelecionado(m => m === 1 ? 12 : m - 1)}><</button>
|
||||||
|
<span className="font-semibold text-lg">{mesStr}/{anoStr}</span>
|
||||||
|
<button type="button" className="px-2 py-1 rounded bg-gray-100 dark:bg-gray-800" onClick={() => setMesSelecionado(m => m === 12 ? 1 : m + 1)}>></button>
|
||||||
|
<button type="button" className="px-2 py-1 rounded bg-gray-100 dark:bg-gray-800" onClick={() => setAnoSelecionado(a => a - 1)}>< Ano</button>
|
||||||
|
<button type="button" className="px-2 py-1 rounded bg-gray-100 dark:bg-gray-800" onClick={() => setAnoSelecionado(a => a + 1)}>Ano ></button>
|
||||||
|
</div>
|
||||||
|
<div className="grid grid-cols-7 gap-2 mb-4">
|
||||||
|
{diasMes.map((dia) => {
|
||||||
|
const dataStr = `${anoStr}-${mesStr}-${dia.toString().padStart(2, '0')}`;
|
||||||
|
const eventosDia = eventos.filter(e => e.data === dataStr);
|
||||||
|
const selecionado = dataStr === dataSelecionada;
|
||||||
|
return (
|
||||||
|
<button
|
||||||
|
key={dia}
|
||||||
|
type="button"
|
||||||
|
onClick={() => setDataSelecionada(dataStr)}
|
||||||
|
className={`h-12 w-full flex flex-col items-center justify-center border rounded-lg shadow-sm transition-all text-[11px] focus:outline-none ${selecionado ? 'ring-2 ring-blue-500 border-blue-500 bg-blue-100 dark:bg-blue-900' : eventosDia.length ? 'bg-blue-50 dark:bg-blue-900 border-blue-400' : 'bg-gray-50 dark:bg-gray-800'}`}
|
||||||
|
>
|
||||||
|
<span className="font-bold text-[11px] text-gray-700 dark:text-gray-200">{dia}</span>
|
||||||
|
{eventosDia.map((ev) => (
|
||||||
|
<span key={ev.id} className={`text-[10px] font-semibold flex items-center gap-1 whitespace-nowrap ${ev.tipo === 'Audiência' ? 'text-red-600' : 'text-blue-700'}`}>
|
||||||
|
{ev.tipo === 'Audiência' ? <PresentationChartBarIcon className="h-3 w-3" /> : <UserIcon className="h-3 w-3" />} {ev.tipo}
|
||||||
|
</span>
|
||||||
|
))}
|
||||||
|
</button>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
<div className="mb-6">
|
||||||
|
<h3 className="font-semibold mb-2 flex items-center gap-2"><CalendarIcon className="h-5 w-5 text-blue-600" /> Eventos do dia {dataSelecionada.split('-').reverse().join('/')}</h3>
|
||||||
|
<ul className="text-xs divide-y divide-gray-200 dark:divide-gray-700">
|
||||||
|
{eventosDoDia.length === 0 && <li className="text-gray-400">Não existem eventos no dia selecionado.</li>}
|
||||||
|
{eventosDoDia.map((ev) => (
|
||||||
|
<li key={ev.id} className="py-2 flex flex-wrap items-center gap-3">
|
||||||
|
{ev.tipo === 'Audiência' ? <PresentationChartBarIcon className="h-4 w-4 text-red-600" /> : <UserIcon className="h-4 w-4 text-blue-600" />}
|
||||||
|
<span className="px-2 py-1 rounded text-xs font-semibold bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-200 min-w-[80px] text-center">{ev.tipo}</span>
|
||||||
|
<span className="text-gray-600 dark:text-gray-300 break-words max-w-xs">{ev.descricao}</span>
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div className="grid grid-cols-2 gap-8">
|
||||||
|
<div>
|
||||||
|
<h3 className="font-semibold mb-2 flex items-center gap-2"><CalendarIcon className="h-5 w-5 text-blue-600" /> Próximos eventos</h3>
|
||||||
|
<ul className="text-xs divide-y divide-gray-200 dark:divide-gray-700">
|
||||||
|
{eventosProximos.length === 0 && <li className="text-gray-400">Nenhum evento futuro</li>}
|
||||||
|
{eventosProximos.map((ev) => (
|
||||||
|
<li key={ev.id} className="py-2 flex flex-wrap items-center gap-3">
|
||||||
|
{ev.tipo === 'Audiência' ? <PresentationChartBarIcon className="h-4 w-4 text-red-600" /> : <UserIcon className="h-4 w-4 text-blue-600" />}
|
||||||
|
<span className="font-bold min-w-[70px]">{ev.data}</span>
|
||||||
|
<span className="px-2 py-1 rounded text-xs font-semibold bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-200 min-w-[80px] text-center">{ev.tipo}</span>
|
||||||
|
<span className="text-gray-600 dark:text-gray-300 break-words max-w-xs">{ev.descricao}</span>
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<h3 className="font-semibold mb-2 flex items-center gap-2"><CalendarIcon className="h-5 w-5 text-gray-500" /> Últimos eventos</h3>
|
||||||
|
<ul className="text-xs divide-y divide-gray-200 dark:divide-gray-700">
|
||||||
|
{eventosPassados.length === 0 && <li className="text-gray-400">Nenhum evento anterior</li>}
|
||||||
|
{eventosPassados.map((ev) => (
|
||||||
|
<li key={ev.id} className="py-2 flex flex-wrap items-center gap-3">
|
||||||
|
{ev.tipo === 'Audiência' ? <PresentationChartBarIcon className="h-4 w-4 text-red-600" /> : <UserIcon className="h-4 w-4 text-blue-600" />}
|
||||||
|
<span className="font-bold min-w-[70px]">{ev.data}</span>
|
||||||
|
<span className="px-2 py-1 rounded text-xs font-semibold bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-200 min-w-[80px] text-center">{ev.tipo}</span>
|
||||||
|
<span className="text-gray-600 dark:text-gray-300 break-words max-w-xs">{ev.descricao}</span>
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -1,52 +1,30 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { useAuth } from '../../contexts/AuthContext';
|
import { WorkflowTarefas } from './WorkflowTarefas';
|
||||||
import { useDashboardStats } from '../../hooks/useDashboardStats';
|
import { CalendarioAtendimentos } from './CalendarioAtendimentos';
|
||||||
import { ProcessosStats } from './stats/ProcessosStats';
|
import { BenchmarkingEscritorio } from './BenchmarkingEscritorio';
|
||||||
import { TarefasStats } from './stats/TarefasStats';
|
import { PainelFinanceiro } from './PainelFinanceiro';
|
||||||
import { AtendimentosStats } from './stats/AtendimentosStats';
|
|
||||||
import { FinanceiroStats } from './stats/FinanceiroStats';
|
|
||||||
import { AlertasPrazos } from './AlertasPrazos';
|
|
||||||
import { AtividadesRecentes } from './AtividadesRecentes';
|
|
||||||
import { TaxaSucessoCard } from './TaxaSucessoCard';
|
|
||||||
import { KPIsFinanceiros } from './stats/KPIsFinanceiros';
|
|
||||||
|
|
||||||
export const DashboardLayout: React.FC = () => {
|
export const DashboardLayout: React.FC = () => {
|
||||||
const { user } = useAuth();
|
|
||||||
const {
|
|
||||||
processosStats,
|
|
||||||
tarefasStats,
|
|
||||||
atendimentosStats,
|
|
||||||
financeiroStats,
|
|
||||||
proximosPrazos,
|
|
||||||
atividades
|
|
||||||
} = useDashboardStats();
|
|
||||||
|
|
||||||
const isAdminOrAdvogado = ['ADVOGADO_ADMIN', 'ADVOGADO'].includes(user?.perfil || '');
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-6 p-6">
|
<div className="grid grid-cols-1 lg:grid-cols-3 gap-6 p-6">
|
||||||
{/* Stats Cards */}
|
{/* Coluna 1: Workflow de Tarefas */}
|
||||||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6">
|
<div className="space-y-6">
|
||||||
{processosStats.data && <ProcessosStats data={processosStats.data} />}
|
<h2 className="text-xl font-bold">Workflow de Tarefas</h2>
|
||||||
{tarefasStats.data && <TarefasStats data={tarefasStats.data} />}
|
<WorkflowTarefas />
|
||||||
{atendimentosStats.data && <AtendimentosStats data={atendimentosStats.data} />}
|
|
||||||
{isAdminOrAdvogado && financeiroStats.data && (
|
|
||||||
<FinanceiroStats data={financeiroStats.data} />
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="grid grid-cols-1 lg:grid-cols-3 gap-6">
|
{/* Coluna 2: Calendário de Atendimentos, Compromissos e Diligências */}
|
||||||
{/* Coluna da esquerda */}
|
<div className="space-y-6">
|
||||||
<div className="lg:col-span-2 space-y-6">
|
<h2 className="text-xl font-bold">Calendário</h2>
|
||||||
<TaxaSucessoCard />
|
<CalendarioAtendimentos />
|
||||||
{isAdminOrAdvogado && <KPIsFinanceiros />}
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Coluna da direita */}
|
{/* Coluna 3: Benchmarking do Escritório */}
|
||||||
<div className="space-y-6">
|
<div className="space-y-6">
|
||||||
<AlertasPrazos />
|
<h2 className="text-xl font-bold">Benchmarking do Escritório</h2>
|
||||||
<AtividadesRecentes />
|
<BenchmarkingEscritorio />
|
||||||
</div>
|
<PainelFinanceiro />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -0,0 +1,83 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { useFinanceiroPainel } from '../../hooks/useFinanceiroPainel';
|
||||||
|
import { CurrencyDollarIcon, ArrowDownCircleIcon, ArrowUpCircleIcon } from '@heroicons/react/24/solid';
|
||||||
|
|
||||||
|
export const PainelFinanceiro: React.FC = () => {
|
||||||
|
const hoje = new Date();
|
||||||
|
const [mes, setMes] = React.useState(hoje.getMonth() + 1);
|
||||||
|
const [ano, setAno] = React.useState(hoje.getFullYear());
|
||||||
|
const { data, isLoading, error } = useFinanceiroPainel(mes, ano);
|
||||||
|
|
||||||
|
const mesesNomes = ['Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez'];
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="border rounded-xl p-6 shadow-lg bg-white dark:bg-gray-900 flex flex-col gap-6 max-w-4xl mx-auto mt-8">
|
||||||
|
<h2 className="text-lg font-bold text-gray-800 dark:text-gray-100 mb-2 flex items-center gap-2">
|
||||||
|
<CurrencyDollarIcon className="h-6 w-6 text-green-600" /> Painel Financeiro
|
||||||
|
</h2>
|
||||||
|
<div className="flex items-center gap-4 mb-2">
|
||||||
|
<button type="button" className="px-2 py-1 rounded bg-gray-100 dark:bg-gray-800" onClick={() => setMes(m => m === 1 ? 12 : m - 1)}><</button>
|
||||||
|
<span className="font-semibold text-lg">{mesesNomes[mes - 1]}/{ano}</span>
|
||||||
|
<button type="button" className="px-2 py-1 rounded bg-gray-100 dark:bg-gray-800" onClick={() => setMes(m => m === 12 ? 1 : m + 1)}>></button>
|
||||||
|
<button type="button" className="px-2 py-1 rounded bg-gray-100 dark:bg-gray-800" onClick={() => setAno(a => a - 1)}>< Ano</button>
|
||||||
|
<button type="button" className="px-2 py-1 rounded bg-gray-100 dark:bg-gray-800" onClick={() => setAno(a => a + 1)}>Ano ></button>
|
||||||
|
</div>
|
||||||
|
{isLoading && <div>Carregando dados financeiros...</div>}
|
||||||
|
{error && <div className="text-red-600">Erro ao buscar dados financeiros</div>}
|
||||||
|
{data && (
|
||||||
|
<div className="grid grid-cols-2 md:grid-cols-4 gap-4 mb-6">
|
||||||
|
<div className="flex flex-col items-center bg-green-50 dark:bg-green-900 rounded-lg p-4">
|
||||||
|
<CurrencyDollarIcon className="h-7 w-7 text-green-600 mb-1" />
|
||||||
|
<span className="text-xs text-gray-500">Honorários a receber</span>
|
||||||
|
<span className="text-lg font-bold text-green-700 dark:text-green-300">R$ {data.honorariosAReceber.toLocaleString('pt-br', { minimumFractionDigits: 2 })}</span>
|
||||||
|
</div>
|
||||||
|
<div className="flex flex-col items-center bg-blue-50 dark:bg-blue-900 rounded-lg p-4">
|
||||||
|
<ArrowUpCircleIcon className="h-7 w-7 text-blue-600 mb-1" />
|
||||||
|
<span className="text-xs text-gray-500">Honorários recebidos no mês</span>
|
||||||
|
<span className="text-lg font-bold text-blue-700 dark:text-blue-300">R$ {data.honorariosRecebidosMes.toLocaleString('pt-br', { minimumFractionDigits: 2 })}</span>
|
||||||
|
</div>
|
||||||
|
<div className="flex flex-col items-center bg-red-50 dark:bg-red-900 rounded-lg p-4">
|
||||||
|
<ArrowDownCircleIcon className="h-7 w-7 text-red-600 mb-1" />
|
||||||
|
<span className="text-xs text-gray-500">Custas a pagar</span>
|
||||||
|
<span className="text-lg font-bold text-red-700 dark:text-red-300">R$ {data.custasAPagar.toLocaleString('pt-br', { minimumFractionDigits: 2 })}</span>
|
||||||
|
</div>
|
||||||
|
<div className="flex flex-col items-center bg-teal-50 dark:bg-teal-900 rounded-lg p-4">
|
||||||
|
<ArrowUpCircleIcon className="h-7 w-7 text-teal-600 mb-1" />
|
||||||
|
<span className="text-xs text-gray-500">Custas pagas no mês</span>
|
||||||
|
<span className="text-lg font-bold text-teal-700 dark:text-teal-300">R$ {data.custasPagasMes.toLocaleString('pt-br', { minimumFractionDigits: 2 })}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{data && (
|
||||||
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-8">
|
||||||
|
<div>
|
||||||
|
<h3 className="font-semibold mb-2 text-green-700 dark:text-green-300">Honorários recebidos no mês</h3>
|
||||||
|
<ul className="text-xs divide-y divide-gray-200 dark:divide-gray-700">
|
||||||
|
{data.detalhesHonorarios.length === 0 && <li className="text-gray-400">Nenhum recebimento registrado neste mês.</li>}
|
||||||
|
{data.detalhesHonorarios.map((item, idx) => (
|
||||||
|
<li key={idx} className="py-2 flex flex-col">
|
||||||
|
<span className="font-bold">Contrato: {item.contrato?.processoId || 'N/A'}</span>
|
||||||
|
<span>Parcela: {item.parcela?.numeroParcela || 'N/A'} - Valor: R$ {Number(item.parcela?.valorPago || item.parcela?.valor || 0).toLocaleString('pt-br', { minimumFractionDigits: 2 })}</span>
|
||||||
|
<span className="text-gray-500">Pago em: {item.parcela?.dataPagamento ? new Date(item.parcela.dataPagamento).toLocaleDateString('pt-br') : '-'}</span>
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<h3 className="font-semibold mb-2 text-red-700 dark:text-red-300">Custas pagas no mês</h3>
|
||||||
|
<ul className="text-xs divide-y divide-gray-200 dark:divide-gray-700">
|
||||||
|
{data.detalhesCustas.length === 0 && <li className="text-gray-400">Nenhuma custa paga neste mês.</li>}
|
||||||
|
{data.detalhesCustas.map((c, idx) => (
|
||||||
|
<li key={idx} className="py-2 flex flex-col">
|
||||||
|
<span className="font-bold">Processo: {c.processoId || 'N/A'}</span>
|
||||||
|
<span>Tipo: {c.tipo || 'N/A'} - Valor: R$ {Number(c.valor || 0).toLocaleString('pt-br', { minimumFractionDigits: 2 })}</span>
|
||||||
|
<span className="text-gray-500">Pago em: {c.dataPagamento ? new Date(c.dataPagamento).toLocaleDateString('pt-br') : '-'}</span>
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -0,0 +1,106 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { useAuth } from '../../contexts/AuthContext';
|
||||||
|
import { useTarefas } from '../../hooks/useTarefas';
|
||||||
|
import { Tarefa } from '../../types/entities';
|
||||||
|
import { PencilIcon, TrashIcon } from '@heroicons/react/24/outline';
|
||||||
|
|
||||||
|
export const WorkflowTarefas: React.FC = () => {
|
||||||
|
const { user } = useAuth();
|
||||||
|
const { tarefas, isLoading, deleteTarefa } = useTarefas();
|
||||||
|
|
||||||
|
const canDelete = user && ['ADVOGADO_ADMIN', 'ADVOGADO'].includes(user.perfil);
|
||||||
|
|
||||||
|
const handleEdit = (tarefa: Tarefa) => {
|
||||||
|
// Implemente a lógica de edição conforme necessário
|
||||||
|
alert(`Editar tarefa: ${tarefa.titulo}`);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleDelete = async (id: string) => {
|
||||||
|
if (!window.confirm('Tem certeza que deseja excluir esta tarefa?')) return;
|
||||||
|
try {
|
||||||
|
await deleteTarefa.mutateAsync(id);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Erro ao excluir tarefa:', error);
|
||||||
|
alert('Erro ao excluir tarefa');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (isLoading) {
|
||||||
|
return (
|
||||||
|
<div className="bg-white dark:bg-gray-800 shadow rounded-lg p-4 text-center text-gray-500 dark:text-gray-400">
|
||||||
|
Carregando tarefas...
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!tarefas || tarefas.length === 0) {
|
||||||
|
return (
|
||||||
|
<div className="bg-white dark:bg-gray-800 shadow rounded-lg p-4 text-center text-gray-500 dark:text-gray-400">
|
||||||
|
Nenhuma tarefa encontrada.
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Exibir apenas tarefas que não estão concluídas ou canceladas
|
||||||
|
const tarefasAtivas = tarefas.filter((t: Tarefa) => t.status !== 'CONCLUIDA' && t.status !== 'CANCELADA');
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="flex flex-col gap-4">
|
||||||
|
{tarefasAtivas.map((tarefa: Tarefa) => (
|
||||||
|
<div key={tarefa.id} className="border rounded-lg p-4 shadow flex flex-col gap-2 bg-white dark:bg-gray-800">
|
||||||
|
<div className="flex flex-col md:flex-row md:justify-between md:items-center gap-2">
|
||||||
|
<div className="flex items-center gap-3">
|
||||||
|
<span className="font-medium text-lg text-gray-900 dark:text-white">{tarefa.titulo}</span>
|
||||||
|
{/* Exibe o grau de prioridade com cor */}
|
||||||
|
<span className={`px-2 py-1 rounded text-xs font-semibold border ${
|
||||||
|
tarefa.prioridade === 'URGENTE' ? 'bg-red-100 text-red-700 border-red-300' :
|
||||||
|
tarefa.prioridade === 'ALTA' ? 'bg-orange-100 text-orange-700 border-orange-300' :
|
||||||
|
tarefa.prioridade === 'MEDIA' ? 'bg-yellow-100 text-yellow-700 border-yellow-300' :
|
||||||
|
'bg-green-100 text-green-700 border-green-300'
|
||||||
|
}`}>
|
||||||
|
{tarefa.prioridade === 'URGENTE' ? 'Urgente' : tarefa.prioridade === 'ALTA' ? 'Alta' : tarefa.prioridade === 'MEDIA' ? 'Média' : 'Baixa'}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div className="flex items-center gap-3">
|
||||||
|
{/* Status da tarefa */}
|
||||||
|
<span className={`px-2 py-1 rounded text-xs font-semibold border ${
|
||||||
|
tarefa.status === 'CONCLUIDA' ? 'bg-green-100 text-green-700 border-green-300' :
|
||||||
|
tarefa.status === 'EM_ANDAMENTO' ? 'bg-blue-100 text-blue-700 border-blue-300' :
|
||||||
|
tarefa.status === 'PENDENTE' ? 'bg-gray-100 text-gray-700 border-gray-300' :
|
||||||
|
'bg-red-100 text-red-700 border-red-300'
|
||||||
|
}`}>
|
||||||
|
{tarefa.status.replace('_', ' ')}
|
||||||
|
</span>
|
||||||
|
<button
|
||||||
|
onClick={() => handleEdit(tarefa)}
|
||||||
|
className="text-blue-600 dark:text-blue-400 hover:text-blue-900 dark:hover:text-blue-300"
|
||||||
|
title="Editar"
|
||||||
|
>
|
||||||
|
<PencilIcon className="h-5 w-5" />
|
||||||
|
</button>
|
||||||
|
{canDelete && (
|
||||||
|
<button
|
||||||
|
onClick={() => handleDelete(tarefa.id)}
|
||||||
|
className="text-red-600 dark:text-red-400 hover:text-red-900 dark:hover:text-red-300"
|
||||||
|
title="Excluir"
|
||||||
|
>
|
||||||
|
<TrashIcon className="h-5 w-5" />
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/* Listagem das subtarefas vinculadas */}
|
||||||
|
{tarefa.subtarefas && tarefa.subtarefas.length > 0 && (
|
||||||
|
<ul className="mt-2 ml-2 list-disc text-sm text-gray-700 dark:text-gray-300">
|
||||||
|
{tarefa.subtarefas.map((sub) => (
|
||||||
|
<li key={sub.id} className={sub.concluida ? 'line-through text-gray-400' : ''}>
|
||||||
|
{sub.titulo} {sub.concluida ? '(Concluída)' : ''}
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</ul>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -17,6 +17,7 @@ import {
|
|||||||
ShieldCheckIcon,
|
ShieldCheckIcon,
|
||||||
CurrencyDollarIcon,
|
CurrencyDollarIcon,
|
||||||
CalculatorIcon,
|
CalculatorIcon,
|
||||||
|
BriefcaseIcon,
|
||||||
} from "@heroicons/react/24/outline";
|
} from "@heroicons/react/24/outline";
|
||||||
import { Menu, Transition } from "@headlessui/react";
|
import { Menu, Transition } from "@headlessui/react";
|
||||||
import api from "../../services/api";
|
import api from "../../services/api";
|
||||||
@@ -58,8 +59,15 @@ export const MainLayout: React.FC = () => {
|
|||||||
|
|
||||||
const menuItems = [
|
const menuItems = [
|
||||||
{ path: "/dashboard", label: "Dashboard", icon: HomeIcon },
|
{ path: "/dashboard", label: "Dashboard", icon: HomeIcon },
|
||||||
{ path: "/processos", label: "Processos", icon: ScaleIcon },
|
{
|
||||||
{ path: "/processos-administrativos", label: "Proc.Adm", icon: ScaleIcon },
|
path: null,
|
||||||
|
label: "Processos",
|
||||||
|
icon: ScaleIcon,
|
||||||
|
subitems: [
|
||||||
|
{ path: "/processos", label: "Judiciais", icon: ScaleIcon },
|
||||||
|
{ path: "/processos-administrativos", label: "Proc. Admin.", icon: DocumentCheckIcon }
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: null,
|
path: null,
|
||||||
label: "Provas",
|
label: "Provas",
|
||||||
|
|||||||
@@ -0,0 +1,119 @@
|
|||||||
|
import React, { useState } from 'react';
|
||||||
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
import { toast } from 'react-toastify';
|
||||||
|
import {
|
||||||
|
Container,
|
||||||
|
Card,
|
||||||
|
CardContent,
|
||||||
|
Typography,
|
||||||
|
TextField,
|
||||||
|
Button,
|
||||||
|
Box,
|
||||||
|
Alert,
|
||||||
|
CircularProgress
|
||||||
|
} from '@mui/material';
|
||||||
|
|
||||||
|
export const IniciarNavegacao: React.FC = () => {
|
||||||
|
const [titulo, setTitulo] = useState('');
|
||||||
|
const [descricao, setDescricao] = useState('');
|
||||||
|
const [iniciando, setIniciando] = useState(false);
|
||||||
|
const navigate = useNavigate();
|
||||||
|
|
||||||
|
const handleIniciar = async () => {
|
||||||
|
if (!titulo.trim()) {
|
||||||
|
toast.error('Título é obrigatório');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
setIniciando(true);
|
||||||
|
|
||||||
|
const response = await fetch('/api/navegacao/iniciar', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
'Authorization': `Bearer ${localStorage.getItem('token')}`
|
||||||
|
},
|
||||||
|
body: JSON.stringify({ titulo, descricao })
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error('Erro ao iniciar sessão');
|
||||||
|
}
|
||||||
|
|
||||||
|
const resultado = await response.json();
|
||||||
|
|
||||||
|
toast.success('Sessão de navegação iniciada!');
|
||||||
|
navigate(`/navegacao/sessao/${resultado.sessaoId}`);
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Erro:', error);
|
||||||
|
toast.error('Erro ao iniciar sessão de navegação');
|
||||||
|
} finally {
|
||||||
|
setIniciando(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Container maxWidth="md">
|
||||||
|
<Box mt={4}>
|
||||||
|
<Card>
|
||||||
|
<CardContent>
|
||||||
|
<Typography variant="h4" gutterBottom>
|
||||||
|
Nova Sessão de Coleta de Provas
|
||||||
|
</Typography>
|
||||||
|
|
||||||
|
<Alert severity="info" sx={{ mb: 3 }}>
|
||||||
|
<Typography variant="body2">
|
||||||
|
Este sistema criará uma sessão controlada de navegação onde todas as ações
|
||||||
|
serão gravadas e registradas para fins de coleta de provas digitais.
|
||||||
|
</Typography>
|
||||||
|
</Alert>
|
||||||
|
|
||||||
|
<Box component="form" sx={{ mt: 2 }}>
|
||||||
|
<TextField
|
||||||
|
fullWidth
|
||||||
|
label="Título da Sessão"
|
||||||
|
value={titulo}
|
||||||
|
onChange={(e) => setTitulo(e.target.value)}
|
||||||
|
margin="normal"
|
||||||
|
required
|
||||||
|
helperText="Descreva brevemente o objetivo desta coleta"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<TextField
|
||||||
|
fullWidth
|
||||||
|
label="Descrição (opcional)"
|
||||||
|
value={descricao}
|
||||||
|
onChange={(e) => setDescricao(e.target.value)}
|
||||||
|
margin="normal"
|
||||||
|
multiline
|
||||||
|
rows={3}
|
||||||
|
helperText="Informações adicionais sobre o que será coletado"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<Box mt={3} display="flex" gap={2}>
|
||||||
|
<Button
|
||||||
|
variant="contained"
|
||||||
|
color="primary"
|
||||||
|
onClick={handleIniciar}
|
||||||
|
disabled={iniciando || !titulo.trim()}
|
||||||
|
startIcon={iniciando ? <CircularProgress size={20} /> : null}
|
||||||
|
>
|
||||||
|
{iniciando ? 'Iniciando...' : 'Iniciar Coleta'}
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
variant="outlined"
|
||||||
|
onClick={() => navigate('/navegacao')}
|
||||||
|
>
|
||||||
|
Cancelar
|
||||||
|
</Button>
|
||||||
|
</Box>
|
||||||
|
</Box>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
</Box>
|
||||||
|
</Container>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -3,6 +3,8 @@ import { useNavigate } from 'react-router-dom';
|
|||||||
import { useDropzone } from 'react-dropzone';
|
import { useDropzone } from 'react-dropzone';
|
||||||
import { toast } from 'react-toastify';
|
import { toast } from 'react-toastify';
|
||||||
|
|
||||||
|
// Página pública: NÃO requer autenticação do usuário
|
||||||
|
|
||||||
export function ClientProvaUpload() {
|
export function ClientProvaUpload() {
|
||||||
const [file, setFile] = useState<File | null>(null);
|
const [file, setFile] = useState<File | null>(null);
|
||||||
const [uploading, setUploading] = useState(false);
|
const [uploading, setUploading] = useState(false);
|
||||||
@@ -43,9 +45,31 @@ export function ClientProvaUpload() {
|
|||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
// Validação extra do arquivo antes do upload
|
||||||
|
function validateFile(file: File | null): string | null {
|
||||||
|
if (!file) return 'Nenhum arquivo selecionado.';
|
||||||
|
const allowedTypes = [
|
||||||
|
'image/jpeg', 'image/png', 'image/gif', 'image/webp', 'application/pdf'
|
||||||
|
];
|
||||||
|
if (!allowedTypes.includes(file.type)) {
|
||||||
|
return 'Tipo de arquivo não suportado. Use JPG, PNG, GIF, WEBP ou PDF.';
|
||||||
|
}
|
||||||
|
if (file.size > 10 * 1024 * 1024) {
|
||||||
|
return 'Arquivo excede o tamanho máximo de 10MB.';
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
const onDrop = useCallback(async (acceptedFiles: File[]) => {
|
const onDrop = useCallback(async (acceptedFiles: File[]) => {
|
||||||
if (acceptedFiles.length > 0) {
|
if (acceptedFiles.length > 0) {
|
||||||
const selectedFile = acceptedFiles[0];
|
const selectedFile = acceptedFiles[0];
|
||||||
|
const validationError = validateFile(selectedFile);
|
||||||
|
if (validationError) {
|
||||||
|
toast.error(validationError);
|
||||||
|
setFile(null);
|
||||||
|
setFilePreview(null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
setFile(selectedFile);
|
setFile(selectedFile);
|
||||||
|
|
||||||
// Criar preview para imagens
|
// Criar preview para imagens
|
||||||
@@ -77,6 +101,12 @@ export function ClientProvaUpload() {
|
|||||||
toast.error('Por favor, selecione um arquivo primeiro');
|
toast.error('Por favor, selecione um arquivo primeiro');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// Validação extra antes do envio
|
||||||
|
const validationError = validateFile(file);
|
||||||
|
if (validationError) {
|
||||||
|
toast.error(validationError);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
setUploading(true);
|
setUploading(true);
|
||||||
setUploadProgress(0);
|
setUploadProgress(0);
|
||||||
@@ -120,7 +150,7 @@ export function ClientProvaUpload() {
|
|||||||
// Adicionar timestamp preciso do cliente
|
// Adicionar timestamp preciso do cliente
|
||||||
formData.append('client_timestamp', new Date().toISOString());
|
formData.append('client_timestamp', new Date().toISOString());
|
||||||
|
|
||||||
// Criar simulação de progresso
|
// Simulação de progresso
|
||||||
const progressInterval = setInterval(() => {
|
const progressInterval = setInterval(() => {
|
||||||
setUploadProgress(prev => {
|
setUploadProgress(prev => {
|
||||||
if (prev >= 95) {
|
if (prev >= 95) {
|
||||||
@@ -131,10 +161,18 @@ export function ClientProvaUpload() {
|
|||||||
});
|
});
|
||||||
}, 300);
|
}, 300);
|
||||||
|
|
||||||
const response = await fetch('/api/provas/upload', {
|
// Upload sem autenticação (página pública)
|
||||||
method: 'POST',
|
let response: Response;
|
||||||
body: formData,
|
try {
|
||||||
});
|
response = await fetch('/api/provas/upload', {
|
||||||
|
method: 'POST',
|
||||||
|
body: formData,
|
||||||
|
});
|
||||||
|
} catch (networkError) {
|
||||||
|
clearInterval(progressInterval);
|
||||||
|
setUploadProgress(0);
|
||||||
|
throw new Error('Erro de conexão. Verifique sua internet e tente novamente.');
|
||||||
|
}
|
||||||
|
|
||||||
clearInterval(progressInterval);
|
clearInterval(progressInterval);
|
||||||
setUploadProgress(100);
|
setUploadProgress(100);
|
||||||
@@ -155,9 +193,14 @@ export function ClientProvaUpload() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Ler o corpo da resposta
|
// Ler o corpo da resposta
|
||||||
const result = await response.json();
|
let result: any;
|
||||||
|
try {
|
||||||
|
result = await response.json();
|
||||||
|
} catch {
|
||||||
|
throw new Error('Resposta inesperada do servidor.');
|
||||||
|
}
|
||||||
|
|
||||||
if (result.id) {
|
if (result && result.id) {
|
||||||
toast.success('Arquivo enviado com sucesso!');
|
toast.success('Arquivo enviado com sucesso!');
|
||||||
// Navegar para a página de status
|
// Navegar para a página de status
|
||||||
navigate(`/public/provas/status/${result.id}`);
|
navigate(`/public/provas/status/${result.id}`);
|
||||||
@@ -165,10 +208,10 @@ export function ClientProvaUpload() {
|
|||||||
throw new Error('ID do documento não encontrado na resposta');
|
throw new Error('ID do documento não encontrado na resposta');
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error: any) {
|
||||||
console.error('Erro detalhado no upload:', error);
|
console.error('Erro detalhado no upload:', error);
|
||||||
setError(error.message || 'Erro ao enviar arquivo. Por favor, tente novamente.');
|
setError(error.message || 'Erro ao enviar arquivo. Por favor, tente novamente.');
|
||||||
toast.error('Falha no upload: ' + error.message);
|
toast.error('Falha no upload: ' + (error.message || 'Erro desconhecido'));
|
||||||
} finally {
|
} finally {
|
||||||
setUploading(false);
|
setUploading(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,13 @@ interface ProvaStatus {
|
|||||||
};
|
};
|
||||||
ipAddress?: string;
|
ipAddress?: string;
|
||||||
clientPort?: string;
|
clientPort?: string;
|
||||||
|
locationInfo?: {
|
||||||
|
latitude?: number;
|
||||||
|
longitude?: number;
|
||||||
|
};
|
||||||
|
latitude?: number;
|
||||||
|
longitude?: number;
|
||||||
|
location_permission?: string;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -212,11 +219,28 @@ export function PublicProvaStatus() {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Adicionar geolocalização se disponível */}
|
{/* Adicionar geolocalização se disponível */}
|
||||||
{(status.metadata?.latitude !== undefined || status.metadata?.longitude !== undefined) && (
|
{(
|
||||||
|
(status.metadata?.latitude !== undefined && status.metadata?.latitude !== null) ||
|
||||||
|
(status.metadata?.longitude !== undefined && status.metadata?.longitude !== null) ||
|
||||||
|
(status.metadata?.locationInfo?.latitude !== undefined && status.metadata?.locationInfo?.latitude !== null) ||
|
||||||
|
(status.metadata?.locationInfo?.longitude !== undefined && status.metadata?.locationInfo?.longitude !== null)
|
||||||
|
) && (
|
||||||
<div>
|
<div>
|
||||||
<p className="text-sm text-gray-500">Geolocalização</p>
|
<p className="text-sm text-gray-500">Geolocalização</p>
|
||||||
<p className="text-gray-700">
|
<p className="text-gray-700">
|
||||||
Coordenadas: {status.metadata.latitude || 'N/A'}, {status.metadata.longitude || 'N/A'}
|
Coordenadas: {
|
||||||
|
status.metadata?.latitude !== undefined && status.metadata?.latitude !== null
|
||||||
|
? status.metadata.latitude
|
||||||
|
: status.metadata?.locationInfo?.latitude !== undefined && status.metadata?.locationInfo?.latitude !== null
|
||||||
|
? status.metadata.locationInfo.latitude
|
||||||
|
: 'N/A'
|
||||||
|
}, {
|
||||||
|
status.metadata?.longitude !== undefined && status.metadata?.longitude !== null
|
||||||
|
? status.metadata.longitude
|
||||||
|
: status.metadata?.locationInfo?.longitude !== undefined && status.metadata?.locationInfo?.longitude !== null
|
||||||
|
? status.metadata.locationInfo.longitude
|
||||||
|
: 'N/A'
|
||||||
|
}
|
||||||
</p>
|
</p>
|
||||||
<p className="text-xs text-gray-500">
|
<p className="text-xs text-gray-500">
|
||||||
Permissão: {status.metadata.location_permission || 'não especificada'}
|
Permissão: {status.metadata.location_permission || 'não especificada'}
|
||||||
|
|||||||
@@ -161,26 +161,6 @@ export function PublicVerificarProva() {
|
|||||||
result.prova.dataCriacao)}
|
result.prova.dataCriacao)}
|
||||||
/>
|
/>
|
||||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||||
<div>
|
|
||||||
<dt className="text-sm font-medium text-gray-500">IP:</dt>
|
|
||||||
<dd className="mt-1 text-base text-gray-900 break-words">
|
|
||||||
{result.verificacao?.ip ||
|
|
||||||
result.prova.metadata?.connectionInfo?.forwardedIp ||
|
|
||||||
(result.prova.metadata?.headers?.['x-forwarded-for'] ?
|
|
||||||
result.prova.metadata.headers['x-forwarded-for'].split(',')[0].trim() :
|
|
||||||
result.prova.metadata?.ipAddress) ||
|
|
||||||
'Não disponível'}
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<dt className="text-sm font-medium text-gray-500">Porta:</dt>
|
|
||||||
<dd className="mt-1 text-base text-gray-900 break-words">
|
|
||||||
{result.verificacao?.porta ||
|
|
||||||
result.prova.metadata?.clientPort ||
|
|
||||||
result.prova.metadata?.connectionInfo?.socketPort ||
|
|
||||||
'Não disponível'}
|
|
||||||
</dd>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -231,13 +211,20 @@ export function PublicVerificarProva() {
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{/* Garantir exibição da porta */}
|
{/* Garantir exibição da porta capturada no JSON da prova */}
|
||||||
<DetailItem
|
<DetailItem
|
||||||
label="Porta de Conexão"
|
label="Porta de Conexão"
|
||||||
value={
|
value={
|
||||||
result.prova.metadata.clientPort ||
|
result.prova.metadata.clientPort ||
|
||||||
(result.prova.metadata.connectionInfo?.socketPort ?
|
result.prova.metadata.connectionInfo?.socketPort ||
|
||||||
result.prova.metadata.connectionInfo.socketPort : '61465')
|
(result.prova.metadata.userInfo?.ipAddress &&
|
||||||
|
(() => {
|
||||||
|
const ip = result.prova.metadata.userInfo.ipAddress;
|
||||||
|
const match = typeof ip === 'string' ? ip.match(/:(\d+)$/) : null;
|
||||||
|
return match ? match[1] : undefined;
|
||||||
|
})()
|
||||||
|
) ||
|
||||||
|
'Não disponível'
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@@ -278,11 +265,28 @@ export function PublicVerificarProva() {
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Exibir geolocalização se disponível */}
|
{/* Exibir geolocalização capturada na prova */}
|
||||||
{(result.prova.metadata.latitude !== undefined || result.prova.metadata.longitude !== undefined) && (
|
{(
|
||||||
|
(result.prova.metadata?.latitude !== undefined && result.prova.metadata?.latitude !== null) ||
|
||||||
|
(result.prova.metadata?.longitude !== undefined && result.prova.metadata?.longitude !== null) ||
|
||||||
|
(result.prova.metadata?.locationInfo?.latitude !== undefined && result.prova.metadata?.locationInfo?.latitude !== null) ||
|
||||||
|
(result.prova.metadata?.locationInfo?.longitude !== undefined && result.prova.metadata?.locationInfo?.longitude !== null)
|
||||||
|
) && (
|
||||||
<DetailItem
|
<DetailItem
|
||||||
label="Coordenadas"
|
label="Coordenadas"
|
||||||
value={`${result.prova.metadata.latitude || 'N/A'}, ${result.prova.metadata.longitude || 'N/A'}`}
|
value={`${
|
||||||
|
result.prova.metadata?.latitude !== undefined && result.prova.metadata?.latitude !== null
|
||||||
|
? result.prova.metadata.latitude
|
||||||
|
: result.prova.metadata?.locationInfo?.latitude !== undefined && result.prova.metadata?.locationInfo?.latitude !== null
|
||||||
|
? result.prova.metadata.locationInfo.latitude
|
||||||
|
: 'N/A'
|
||||||
|
}, ${
|
||||||
|
result.prova.metadata?.longitude !== undefined && result.prova.metadata?.longitude !== null
|
||||||
|
? result.prova.metadata.longitude
|
||||||
|
: result.prova.metadata?.locationInfo?.longitude !== undefined && result.prova.metadata?.locationInfo?.longitude !== null
|
||||||
|
? result.prova.metadata.locationInfo.longitude
|
||||||
|
: 'N/A'
|
||||||
|
}`}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|||||||
@@ -220,7 +220,10 @@ export const VerificarProva: React.FC = () => {
|
|||||||
Porta:
|
Porta:
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography gutterBottom>
|
<Typography gutterBottom>
|
||||||
{prova.verificacao?.porta || prova.prova?.metadata?.clientPort || 'Não disponível'}
|
{prova.prova?.metadata?.clientPort ||
|
||||||
|
prova.prova?.metadata?.connectionInfo?.socketPort ||
|
||||||
|
prova.prova?.metadata?.userInfo?.ipAddress?.split(':')[1] ||
|
||||||
|
'Não disponível'}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|||||||
@@ -168,6 +168,18 @@ export const TarefaModal: React.FC<TarefaModalProps> = ({ isOpen, onClose, taref
|
|||||||
<option value="URGENTE">Urgente</option>
|
<option value="URGENTE">Urgente</option>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
{/* Campo para alterar o status da tarefa conforme banco de dados */}
|
||||||
|
<select
|
||||||
|
{...register('status')}
|
||||||
|
className="w-full p-2 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"
|
||||||
|
>
|
||||||
|
<option value="PENDENTE">Pendente</option>
|
||||||
|
{/* Exibe 'Em andamento' sem underline */}
|
||||||
|
<option value="EM_ANDAMENTO">Em andamento</option>
|
||||||
|
<option value="CONCLUIDA">Concluída</option>
|
||||||
|
<option value="CANCELADA">Cancelada</option>
|
||||||
|
</select>
|
||||||
|
|
||||||
<select
|
<select
|
||||||
{...register('responsavelId')}
|
{...register('responsavelId')}
|
||||||
className="w-full p-2 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"
|
className="w-full p-2 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white"
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { useMutation, useQueryClient } from "react-query";
|
import { useMutation, useQuery, useQueryClient } from "react-query";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
|
import api from "../services/api";
|
||||||
|
|
||||||
export function useAudiencias(processoId: string) {
|
export function useAudiencias(processoId: string) {
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
@@ -49,9 +50,15 @@ export function useAudiencias(processoId: string) {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const { data: audiencias } = useQuery("audiencias", async () => {
|
||||||
|
const { data } = await api.get("/audiencias");
|
||||||
|
return data;
|
||||||
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
addAudiencia: addAudiencia.mutateAsync,
|
addAudiencia: addAudiencia.mutateAsync,
|
||||||
updateAudiencia: updateAudiencia.mutateAsync,
|
updateAudiencia: updateAudiencia.mutateAsync,
|
||||||
deleteAudiencia: deleteAudiencia.mutateAsync,
|
deleteAudiencia: deleteAudiencia.mutateAsync,
|
||||||
|
audiencias,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
import { useQuery } from 'react-query';
|
||||||
|
import { Processo } from '../types/entities';
|
||||||
|
import api from '../services/api';
|
||||||
|
|
||||||
|
interface Benchmarking {
|
||||||
|
totalProcessos: number;
|
||||||
|
ativos: number;
|
||||||
|
procedentes: number;
|
||||||
|
improcedentesOuSemMerito: number;
|
||||||
|
ajuizados7dias: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hook para calcular benchmarking do escritório
|
||||||
|
export function useBenchmarking() {
|
||||||
|
return useQuery<Benchmarking>('benchmarking', async () => {
|
||||||
|
// Buscar todos os processos
|
||||||
|
const res = await api.get<Processo[]>('/processos');
|
||||||
|
const processos = res.data;
|
||||||
|
|
||||||
|
// Total de processos
|
||||||
|
const totalProcessos = processos.length;
|
||||||
|
// Total de processos ativos
|
||||||
|
const ativos = processos.filter(p => p.statusAtividade === 'ATIVO').length;
|
||||||
|
// Julgados procedentes
|
||||||
|
const procedentes = processos.filter(p => p.resultado === 'PROCEDENTE').length;
|
||||||
|
// Julgados improcedentes ou sem análise de mérito
|
||||||
|
const improcedentesOuSemMerito = processos.filter(p => p.resultado === 'IMPROCEDENTE' || p.resultado === 'SEM_ANALISE_MERITO').length;
|
||||||
|
// Processos ajuizados nos últimos 7 dias
|
||||||
|
const seteDiasAtras = new Date();
|
||||||
|
seteDiasAtras.setDate(seteDiasAtras.getDate() - 7);
|
||||||
|
const ajuizados7dias = processos.filter(p => {
|
||||||
|
const criacao = p.dataCriacao ? new Date(p.dataCriacao) : null;
|
||||||
|
return criacao && criacao >= seteDiasAtras;
|
||||||
|
}).length;
|
||||||
|
|
||||||
|
return {
|
||||||
|
totalProcessos,
|
||||||
|
ativos,
|
||||||
|
procedentes,
|
||||||
|
improcedentesOuSemMerito,
|
||||||
|
ajuizados7dias,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
import { useQuery } from 'react-query';
|
||||||
|
import api from '../services/api';
|
||||||
|
|
||||||
|
export interface EventoCalendario {
|
||||||
|
id: string;
|
||||||
|
data: string;
|
||||||
|
tipo: string;
|
||||||
|
descricao: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hook para buscar atendimentos e audiências do calendário
|
||||||
|
export function useCalendarioAtendimentos() {
|
||||||
|
return useQuery<EventoCalendario[]>('calendarioAtendimentos', async () => {
|
||||||
|
// Buscar atendimentos
|
||||||
|
const atendimentosRes = await api.get('/atendimentos');
|
||||||
|
const atendimentos = atendimentosRes.data.map((a: any) => ({
|
||||||
|
id: a.id,
|
||||||
|
data: a.dataAtendimento?.slice(0, 10),
|
||||||
|
tipo: 'Atendimento',
|
||||||
|
descricao: a.titulo || 'Atendimento',
|
||||||
|
}));
|
||||||
|
|
||||||
|
// Buscar audiências, tratar erro 404
|
||||||
|
let audiencias: EventoCalendario[] = [];
|
||||||
|
try {
|
||||||
|
const audienciasRes = await api.get('/audiencias');
|
||||||
|
audiencias = audienciasRes.data.map((a: any) => ({
|
||||||
|
id: a.id,
|
||||||
|
data: a.data?.slice(0, 10),
|
||||||
|
tipo: 'Audiência',
|
||||||
|
descricao: a.tipo || 'Audiência',
|
||||||
|
}));
|
||||||
|
} catch (error: any) {
|
||||||
|
if (error?.response?.status !== 404) throw error;
|
||||||
|
// Se for 404, ignora audiências
|
||||||
|
}
|
||||||
|
|
||||||
|
// Junta todos eventos
|
||||||
|
return [...atendimentos, ...audiencias];
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
import { useQuery } from 'react-query';
|
||||||
|
import api from '../services/api';
|
||||||
|
|
||||||
|
export interface FinanceiroResumo {
|
||||||
|
honorariosAReceber: number;
|
||||||
|
honorariosRecebidosMes: number;
|
||||||
|
custasAPagar: number;
|
||||||
|
custasPagasMes: number;
|
||||||
|
detalhesHonorarios: any[];
|
||||||
|
detalhesCustas: any[];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hook para buscar dados financeiros do painel diretamente do backend
|
||||||
|
export function useFinanceiroPainel(mes: number, ano: number) {
|
||||||
|
return useQuery<FinanceiroResumo>(['financeiroPainel', mes, ano], async () => {
|
||||||
|
try {
|
||||||
|
const res = await api.get(`/financeiro-painel?mes=${mes}&ano=${ano}`);
|
||||||
|
return res.data;
|
||||||
|
} catch (error: any) {
|
||||||
|
// Se der erro, retorna tudo zerado
|
||||||
|
return {
|
||||||
|
honorariosAReceber: 0,
|
||||||
|
honorariosRecebidosMes: 0,
|
||||||
|
custasAPagar: 0,
|
||||||
|
custasPagasMes: 0,
|
||||||
|
detalhesHonorarios: [],
|
||||||
|
detalhesCustas: [],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
import express from 'express';
|
|
||||||
import bodyParser from 'body-parser';
|
|
||||||
import cors from 'cors';
|
|
||||||
import dotenv from 'dotenv';
|
|
||||||
import path from 'path';
|
|
||||||
import { PrismaClient } from '@prisma/client';
|
|
||||||
import provasRoutes from './routes/provas';
|
|
||||||
import calculosJudiciaisRoutes from './routes/calculosJudiciais';
|
|
||||||
import indicesMonetariosRoutes from './routes/indicesMonetarios';
|
|
||||||
import pensaoAlimenticiaRoutes from './routes/pensaoAlimenticia';
|
|
||||||
|
|
||||||
dotenv.config();
|
|
||||||
|
|
||||||
const app = express();
|
|
||||||
const prisma = new PrismaClient();
|
|
||||||
|
|
||||||
// Configurar para confiar em proxies, permitindo a leitura de X-Forwarded-For
|
|
||||||
// Isso é necessário se sua aplicação estiver atrás de um balanceador de carga,
|
|
||||||
// proxy reverso ou Cloudflare
|
|
||||||
app.set('trust proxy', true);
|
|
||||||
|
|
||||||
app.use(cors());
|
|
||||||
app.use(bodyParser.json());
|
|
||||||
app.use(bodyParser.urlencoded({ extended: true }));
|
|
||||||
|
|
||||||
app.use('/api/provas', provasRoutes);
|
|
||||||
app.use('/api/calculos', calculosJudiciaisRoutes);
|
|
||||||
app.use('/api/indices', indicesMonetariosRoutes);
|
|
||||||
app.use('/api/pensao-alimenticia', pensaoAlimenticiaRoutes);
|
|
||||||
|
|
||||||
app.use(express.static(path.join(__dirname, 'public')));
|
|
||||||
app.set('trust proxy', true); // Importante para obter o IP real em ambientes com proxy
|
|
||||||
|
|
||||||
const PORT = process.env.PORT || 5000;
|
|
||||||
|
|
||||||
app.listen(PORT, () => {
|
|
||||||
console.log(`Server is running on port ${PORT}`);
|
|
||||||
});
|
|
||||||
|
|
||||||
export { app, prisma };
|
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
import { Request, Response } from "express";
|
||||||
|
import { prisma } from "../prismaClient";
|
||||||
|
|
||||||
|
// Função para listar todas as audiências
|
||||||
|
export async function getAudiencias(req: Request, res: Response) {
|
||||||
|
try {
|
||||||
|
const audiencias = await prisma.audiencia.findMany({
|
||||||
|
orderBy: { data: "asc" },
|
||||||
|
include: {
|
||||||
|
processo: {
|
||||||
|
select: { numero: true, nomeContraparte: true }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
res.json(audiencias);
|
||||||
|
} catch (error) {
|
||||||
|
console.error("Erro ao buscar audiências:", error);
|
||||||
|
res.status(500).json({ error: "Erro ao buscar audiências" });
|
||||||
|
}
|
||||||
|
}
|
||||||
+88
-5
@@ -24,7 +24,11 @@ import processosAdministrativosRoutes from './routes/processosAdministrativos';
|
|||||||
import provasRouter from './routes/provas';
|
import provasRouter from './routes/provas';
|
||||||
import calculosJudiciaisRoutes from './routes/calculosJudiciais';
|
import calculosJudiciaisRoutes from './routes/calculosJudiciais';
|
||||||
import indicesMonetariosRoutes from './routes/indicesMonetarios';
|
import indicesMonetariosRoutes from './routes/indicesMonetarios';
|
||||||
import pensaoAlimenticiaRoutes from './routes/pensaoAlimenticia';
|
import pensaoAlimenticiaRouter from './routes/pensaoAlimenticia'; // Importar router de pensão alimentícia
|
||||||
|
import financeiroPainelRoutes from './routes/financeiroPainel'; // Importar rotas do financeiro painel
|
||||||
|
import audienciasRoutes from './routes/audiencias'; // Importar rotas de audiências
|
||||||
|
import navegacaoRoutes from './routes/navegacao'; // Adicionar esta importação
|
||||||
|
|
||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
const port = process.env.PORT || 5000;
|
const port = process.env.PORT || 5000;
|
||||||
@@ -47,7 +51,8 @@ app.use((req, res, next) => {
|
|||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
|
|
||||||
app.use(express.json());
|
app.use(express.json({ limit: '20mb' }));
|
||||||
|
app.use(express.urlencoded({ extended: true, limit: '20mb' }));
|
||||||
|
|
||||||
const clienteRepository = new ClienteRepository();
|
const clienteRepository = new ClienteRepository();
|
||||||
const processoRepository = new ProcessoRepository();
|
const processoRepository = new ProcessoRepository();
|
||||||
@@ -55,6 +60,13 @@ const orgaoJulgadorRepository = new OrgaoJulgadorRepository();
|
|||||||
const custaProcessualRepository = new CustaProcessualRepository();
|
const custaProcessualRepository = new CustaProcessualRepository();
|
||||||
const honorarioRepository = new HonorarioRepository();
|
const honorarioRepository = new HonorarioRepository();
|
||||||
|
|
||||||
|
// Atualizar a função isValidUUID para ser mais robusta
|
||||||
|
const isValidUUID = (uuid: string | null | undefined): boolean => {
|
||||||
|
if (!uuid) return false;
|
||||||
|
const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
||||||
|
return uuidRegex.test(uuid);
|
||||||
|
};
|
||||||
|
|
||||||
// Middleware para extrair usuário do token
|
// Middleware para extrair usuário do token
|
||||||
// Remover este middleware pois já temos o auth.ts
|
// Remover este middleware pois já temos o auth.ts
|
||||||
// const extractUser = (req: any, res: any, next: any) => { ... }
|
// const extractUser = (req: any, res: any, next: any) => { ... }
|
||||||
@@ -1000,9 +1012,9 @@ app.post("/api/atendimentos", authMiddleware, async (req, res) => {
|
|||||||
conteudo,
|
conteudo,
|
||||||
cliente: { connect: { id: clienteId } },
|
cliente: { connect: { id: clienteId } },
|
||||||
usuario: { connect: { id: req.user!.id } },
|
usuario: { connect: { id: req.user!.id } },
|
||||||
...(processoId && { processo: { connect: { id: processoId } } }),
|
...(processoId && { processo: { connect: { id: processoId } } }), // Adicionar vírgula aqui
|
||||||
status: 'ATIVO',
|
status: 'ATIVO',
|
||||||
dataAtualizacao: new Date(),
|
dataAtualizacao: new Date()
|
||||||
},
|
},
|
||||||
include: {
|
include: {
|
||||||
cliente: true,
|
cliente: true,
|
||||||
@@ -1337,6 +1349,74 @@ app.delete("/api/agendamentos/:id", authMiddleware, async (req, res) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Atualizar a rota de agendamentos
|
||||||
|
app.get("/api/atendimentos/agendamentos", async (req, res) => {
|
||||||
|
try {
|
||||||
|
const { data } = req.query;
|
||||||
|
|
||||||
|
if (!data || typeof data !== 'string') {
|
||||||
|
return res.status(400).json({ error: 'Data inválida' });
|
||||||
|
}
|
||||||
|
|
||||||
|
const dataConsulta = new Date(data);
|
||||||
|
|
||||||
|
// Validar se a data é válida
|
||||||
|
if (isNaN(dataConsulta.getTime())) {
|
||||||
|
return res.status(400).json({ error: 'Formato de data inválido' });
|
||||||
|
}
|
||||||
|
|
||||||
|
// Definir início e fim do dia
|
||||||
|
const inicioDia = new Date(dataConsulta.setHours(0, 0, 0, 0));
|
||||||
|
const fimDia = new Date(dataConsulta.setHours(23, 59, 59, 999));
|
||||||
|
|
||||||
|
// Buscar na tabela correta com filtros apropriados
|
||||||
|
const agendamentos = await prisma.agendamentoAtendimento.findMany({
|
||||||
|
where: {
|
||||||
|
data: {
|
||||||
|
gte: inicioDia,
|
||||||
|
lte: fimDia
|
||||||
|
}
|
||||||
|
},
|
||||||
|
include: {
|
||||||
|
cliente: {
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
nome: true,
|
||||||
|
cpfCnpj: true,
|
||||||
|
telefone: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
usuario: {
|
||||||
|
select: {
|
||||||
|
id: true,
|
||||||
|
nome: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
orderBy: {
|
||||||
|
data: 'asc'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Filtrar apenas agendamentos com UUIDs válidos
|
||||||
|
const validAgendamentos = agendamentos.filter(agendamento =>
|
||||||
|
isValidUUID(agendamento.id) &&
|
||||||
|
isValidUUID(agendamento.clienteId) &&
|
||||||
|
isValidUUID(agendamento.usuarioId)
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log(`Encontrados ${validAgendamentos.length} agendamentos válidos para ${data}`);
|
||||||
|
|
||||||
|
res.json(validAgendamentos);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Erro ao buscar agendamentos:', error);
|
||||||
|
res.status(500).json({
|
||||||
|
error: 'Erro ao buscar agendamentos',
|
||||||
|
details: error instanceof Error ? error.message : 'Erro desconhecido'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Erro handling middleware
|
// Erro handling middleware
|
||||||
app.use(
|
app.use(
|
||||||
(
|
(
|
||||||
@@ -1400,4 +1480,7 @@ app.use('/api/documentos-modelos', documentosModelosRouter);
|
|||||||
app.use('/api/processos-administrativos', processosAdministrativosRoutes);
|
app.use('/api/processos-administrativos', processosAdministrativosRoutes);
|
||||||
app.use('/api/calculos', calculosJudiciaisRoutes);
|
app.use('/api/calculos', calculosJudiciaisRoutes);
|
||||||
app.use('/api/indices', indicesMonetariosRoutes);
|
app.use('/api/indices', indicesMonetariosRoutes);
|
||||||
app.use('/api/pensao-alimenticia', pensaoAlimenticiaRoutes);
|
app.use('/api/pensao-alimenticia', pensaoAlimenticiaRouter);
|
||||||
|
app.use('/api/financeiro-painel', financeiroPainelRoutes); // Adicionar uso das rotas do financeiro painel
|
||||||
|
app.use('/api/audiencias', audienciasRoutes); // Adicionar uso das rotas de audiências
|
||||||
|
app.use('/api/navegacao', navegacaoRoutes); // Adicionar esta linha junto com as outras rotas
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
import { Router } from "express";
|
||||||
|
import { getAudiencias } from "../controllers/audienciasController";
|
||||||
|
|
||||||
|
const router = Router();
|
||||||
|
|
||||||
|
// GET /api/audiencias - Lista todas as audiências
|
||||||
|
router.get("/", getAudiencias);
|
||||||
|
|
||||||
|
export default router;
|
||||||
@@ -83,11 +83,9 @@ router.get('/:id', async (req, res) => {
|
|||||||
try {
|
try {
|
||||||
const { id } = req.params;
|
const { id } = req.params;
|
||||||
const calculo = await calculoService.buscarCalculo(id);
|
const calculo = await calculoService.buscarCalculo(id);
|
||||||
|
|
||||||
if (!calculo) {
|
if (!calculo) {
|
||||||
return res.status(404).json({ error: 'Cálculo não encontrado' });
|
return res.status(404).json({ error: 'Cálculo não encontrado' });
|
||||||
}
|
}
|
||||||
|
|
||||||
res.json(calculo);
|
res.json(calculo);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Erro ao buscar cálculo:', error);
|
console.error('Erro ao buscar cálculo:', error);
|
||||||
|
|||||||
@@ -0,0 +1,99 @@
|
|||||||
|
import express from 'express';
|
||||||
|
import { prisma } from '../prismaClient';
|
||||||
|
|
||||||
|
const router = express.Router();
|
||||||
|
|
||||||
|
// GET /api/financeiro-painel?mes=6&ano=2024
|
||||||
|
router.get('/', async (req, res) => {
|
||||||
|
try {
|
||||||
|
const mes = parseInt(req.query.mes as string) || (new Date().getMonth() + 1);
|
||||||
|
const ano = parseInt(req.query.ano as string) || (new Date().getFullYear());
|
||||||
|
if (isNaN(mes) || isNaN(ano)) {
|
||||||
|
return res.status(400).json({ error: 'Parâmetros de mês e ano inválidos.' });
|
||||||
|
}
|
||||||
|
// Datas para filtro
|
||||||
|
const dataInicio = new Date(ano, mes - 1, 1);
|
||||||
|
const dataFim = new Date(ano, mes, 1);
|
||||||
|
|
||||||
|
// Honorários a receber: parcelas pendentes ou vencidas
|
||||||
|
const honorariosAReceber = await prisma.parcelaHonorario.aggregate({
|
||||||
|
_sum: { valor: true },
|
||||||
|
where: {
|
||||||
|
OR: [{ status: 'PENDENTE' }, { status: 'VENCIDO' }],
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// Honorários recebidos no mês
|
||||||
|
const honorariosRecebidosMes = await prisma.parcelaHonorario.aggregate({
|
||||||
|
_sum: { valorPago: true },
|
||||||
|
where: {
|
||||||
|
status: 'PAGO',
|
||||||
|
dataPagamento: {
|
||||||
|
gte: dataInicio,
|
||||||
|
lt: dataFim,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// Detalhes das parcelas recebidas no mês
|
||||||
|
const detalhesHonorarios = await prisma.parcelaHonorario.findMany({
|
||||||
|
where: {
|
||||||
|
status: 'PAGO',
|
||||||
|
dataPagamento: {
|
||||||
|
gte: dataInicio,
|
||||||
|
lt: dataFim,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
include: { honorario: true },
|
||||||
|
orderBy: { dataPagamento: 'desc' },
|
||||||
|
take: 10,
|
||||||
|
});
|
||||||
|
|
||||||
|
// Custas a pagar
|
||||||
|
const custasAPagar = await prisma.custaProcessual.aggregate({
|
||||||
|
_sum: { valor: true },
|
||||||
|
where: {
|
||||||
|
OR: [{ status: 'PENDENTE' }, { status: 'VENCIDO' }],
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// Custas pagas no mês
|
||||||
|
const custasPagasMes = await prisma.custaProcessual.aggregate({
|
||||||
|
_sum: { valor: true },
|
||||||
|
where: {
|
||||||
|
status: 'PAGO',
|
||||||
|
dataPagamento: {
|
||||||
|
gte: dataInicio,
|
||||||
|
lt: dataFim,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
// Detalhes das custas pagas no mês
|
||||||
|
const detalhesCustas = await prisma.custaProcessual.findMany({
|
||||||
|
where: {
|
||||||
|
status: 'PAGO',
|
||||||
|
dataPagamento: {
|
||||||
|
gte: dataInicio,
|
||||||
|
lt: dataFim,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
orderBy: { dataPagamento: 'desc' },
|
||||||
|
take: 10,
|
||||||
|
});
|
||||||
|
|
||||||
|
res.json({
|
||||||
|
honorariosAReceber: honorariosAReceber._sum.valor || 0,
|
||||||
|
honorariosRecebidosMes: honorariosRecebidosMes._sum.valorPago || 0,
|
||||||
|
custasAPagar: custasAPagar._sum.valor || 0,
|
||||||
|
custasPagasMes: custasPagasMes._sum.valor || 0,
|
||||||
|
detalhesHonorarios,
|
||||||
|
detalhesCustas,
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Erro no financeiroPainel:', error);
|
||||||
|
res.status(500).json({ error: 'Erro ao buscar dados financeiros.' });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export default router;
|
||||||
@@ -0,0 +1,168 @@
|
|||||||
|
import { Router } from 'express';
|
||||||
|
import { NavegacaoService } from '../services/NavegacaoService';
|
||||||
|
import { authMiddleware } from '../../middleware/auth';
|
||||||
|
import { prisma } from '../prismaClient';
|
||||||
|
|
||||||
|
const router = Router();
|
||||||
|
|
||||||
|
// Aplicar middleware de autenticação
|
||||||
|
router.use(authMiddleware);
|
||||||
|
|
||||||
|
// Iniciar nova sessão de navegação
|
||||||
|
router.post('/iniciar', async (req, res) => {
|
||||||
|
try {
|
||||||
|
const { titulo, descricao } = req.body;
|
||||||
|
|
||||||
|
if (!req.user?.id) {
|
||||||
|
return res.status(401).json({ error: 'Usuário não autenticado' });
|
||||||
|
}
|
||||||
|
|
||||||
|
const navegacaoService = new NavegacaoService();
|
||||||
|
const resultado = await navegacaoService.iniciarSessao(
|
||||||
|
req.user.id,
|
||||||
|
titulo,
|
||||||
|
descricao
|
||||||
|
);
|
||||||
|
|
||||||
|
res.json(resultado);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Erro ao iniciar navegação:', error);
|
||||||
|
res.status(500).json({
|
||||||
|
error: 'Erro ao iniciar sessão de navegação',
|
||||||
|
details: error.message
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Navegar para URL específica
|
||||||
|
router.post('/:sessaoId/navegar', async (req, res) => {
|
||||||
|
try {
|
||||||
|
const { sessaoId } = req.params;
|
||||||
|
const { url } = req.body;
|
||||||
|
|
||||||
|
// Verificar se a sessão pertence ao usuário
|
||||||
|
const sessao = await prisma.sessaoNavegacao.findFirst({
|
||||||
|
where: {
|
||||||
|
id: sessaoId,
|
||||||
|
usuarioId: req.user!.id
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!sessao) {
|
||||||
|
return res.status(404).json({ error: 'Sessão não encontrada' });
|
||||||
|
}
|
||||||
|
|
||||||
|
const navegacaoService = new NavegacaoService();
|
||||||
|
await navegacaoService.navegarPara(url);
|
||||||
|
|
||||||
|
res.json({ success: true });
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Erro na navegação:', error);
|
||||||
|
res.status(500).json({ error: 'Erro ao navegar' });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Finalizar sessão
|
||||||
|
router.post('/:sessaoId/finalizar', async (req, res) => {
|
||||||
|
try {
|
||||||
|
const { sessaoId } = req.params;
|
||||||
|
|
||||||
|
const sessao = await prisma.sessaoNavegacao.findFirst({
|
||||||
|
where: {
|
||||||
|
id: sessaoId,
|
||||||
|
usuarioId: req.user!.id
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!sessao) {
|
||||||
|
return res.status(404).json({ error: 'Sessão não encontrada' });
|
||||||
|
}
|
||||||
|
|
||||||
|
const navegacaoService = new NavegacaoService();
|
||||||
|
await navegacaoService.finalizarSessao();
|
||||||
|
|
||||||
|
res.json({ success: true });
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Erro ao finalizar sessão:', error);
|
||||||
|
res.status(500).json({ error: 'Erro ao finalizar sessão' });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Listar sessões do usuário
|
||||||
|
router.get('/sessoes', async (req, res) => {
|
||||||
|
try {
|
||||||
|
const sessoes = await prisma.sessaoNavegacao.findMany({
|
||||||
|
where: { usuarioId: req.user!.id },
|
||||||
|
include: {
|
||||||
|
acoes: {
|
||||||
|
select: { id: true, timestamp: true, tipo: true }
|
||||||
|
},
|
||||||
|
capturas: {
|
||||||
|
select: { id: true, timestamp: true, url: true }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
orderBy: { criadoEm: 'desc' }
|
||||||
|
});
|
||||||
|
|
||||||
|
res.json(sessoes);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Erro ao listar sessões:', error);
|
||||||
|
res.status(500).json({ error: 'Erro ao listar sessões' });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Detalhes de uma sessão
|
||||||
|
router.get('/sessoes/:sessaoId', async (req, res) => {
|
||||||
|
try {
|
||||||
|
const { sessaoId } = req.params;
|
||||||
|
|
||||||
|
const sessao = await prisma.sessaoNavegacao.findFirst({
|
||||||
|
where: {
|
||||||
|
id: sessaoId,
|
||||||
|
usuarioId: req.user!.id
|
||||||
|
},
|
||||||
|
include: {
|
||||||
|
acoes: {
|
||||||
|
orderBy: { timestamp: 'asc' }
|
||||||
|
},
|
||||||
|
capturas: {
|
||||||
|
orderBy: { timestamp: 'asc' }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!sessao) {
|
||||||
|
return res.status(404).json({ error: 'Sessão não encontrada' });
|
||||||
|
}
|
||||||
|
|
||||||
|
res.json(sessao);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Erro ao buscar sessão:', error);
|
||||||
|
res.status(500).json({ error: 'Erro ao buscar detalhes da sessão' });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Download do relatório
|
||||||
|
router.get('/sessoes/:sessaoId/relatorio', async (req, res) => {
|
||||||
|
try {
|
||||||
|
const { sessaoId } = req.params;
|
||||||
|
|
||||||
|
const sessao = await prisma.sessaoNavegacao.findFirst({
|
||||||
|
where: {
|
||||||
|
id: sessaoId,
|
||||||
|
usuarioId: req.user!.id
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!sessao || !sessao.relatorioPdfPath) {
|
||||||
|
return res.status(404).json({ error: 'Relatório não encontrado' });
|
||||||
|
}
|
||||||
|
|
||||||
|
res.download(sessao.relatorioPdfPath);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Erro ao baixar relatório:', error);
|
||||||
|
res.status(500).json({ error: 'Erro ao baixar relatório' });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export default router;
|
||||||
@@ -55,7 +55,7 @@ router.post('/', async (req, res) => {
|
|||||||
router.get('/:id', async (req, res) => {
|
router.get('/:id', async (req, res) => {
|
||||||
try {
|
try {
|
||||||
const { id } = req.params;
|
const { id } = req.params;
|
||||||
|
console.log('[pensaoAlimenticia] Buscando cálculo por ID:', id); // Log para depuração
|
||||||
const calculo = await prisma.calculoPensaoAlimenticia.findUnique({
|
const calculo = await prisma.calculoPensaoAlimenticia.findUnique({
|
||||||
where: { id },
|
where: { id },
|
||||||
include: {
|
include: {
|
||||||
@@ -70,15 +70,14 @@ router.get('/:id', async (req, res) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!calculo) {
|
if (!calculo) {
|
||||||
|
console.warn('[pensaoAlimenticia] Cálculo não encontrado para ID:', id); // Log para depuração
|
||||||
return res.status(404).json({ error: 'Cálculo não encontrado' });
|
return res.status(404).json({ error: 'Cálculo não encontrado' });
|
||||||
}
|
}
|
||||||
|
|
||||||
res.json(calculo);
|
res.json(calculo);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Erro ao buscar cálculo:', error);
|
console.error('[pensaoAlimenticia] Erro ao buscar cálculo:', error);
|
||||||
res.status(500).json({ error: 'Falha ao buscar cálculo' });
|
res.status(500).json({ error: 'Falha ao buscar cálculo', details: error.message });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,17 @@ router.post('/upload', upload.array('files'), async (req, res) => {
|
|||||||
} : null;
|
} : null;
|
||||||
|
|
||||||
// Metadata avançada seguindo RFC 3227
|
// Metadata avançada seguindo RFC 3227
|
||||||
|
// Corrigir: priorizar latitude/longitude do frontend se vierem preenchidas
|
||||||
|
let latitude: number | undefined = undefined;
|
||||||
|
let longitude: number | undefined = undefined;
|
||||||
|
if (
|
||||||
|
typeof req.body.latitude !== 'undefined' && req.body.latitude !== null && req.body.latitude !== '' &&
|
||||||
|
typeof req.body.longitude !== 'undefined' && req.body.longitude !== null && req.body.longitude !== ''
|
||||||
|
) {
|
||||||
|
latitude = Number(req.body.latitude);
|
||||||
|
longitude = Number(req.body.longitude);
|
||||||
|
}
|
||||||
|
|
||||||
const metadata = {
|
const metadata = {
|
||||||
userAgent: req.body.user_agent,
|
userAgent: req.body.user_agent,
|
||||||
language: req.body.language,
|
language: req.body.language,
|
||||||
@@ -40,7 +51,11 @@ router.post('/upload', upload.array('files'), async (req, res) => {
|
|||||||
forwardedIp: forwarded,
|
forwardedIp: forwarded,
|
||||||
socketAddress: socketInfo?.address,
|
socketAddress: socketInfo?.address,
|
||||||
socketPort: socketInfo?.port,
|
socketPort: socketInfo?.port,
|
||||||
remoteFamily: req.socket.remoteFamily
|
// Corrigir: determinar família do IP real
|
||||||
|
remoteFamily: (() => {
|
||||||
|
const ip = (req.ip || req.socket.remoteAddress || '').toString();
|
||||||
|
return ip.includes(':') ? 'IPv6' : 'IPv4';
|
||||||
|
})()
|
||||||
},
|
},
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
modification_times: req.body.modification_times,
|
modification_times: req.body.modification_times,
|
||||||
@@ -50,8 +65,8 @@ router.post('/upload', upload.array('files'), async (req, res) => {
|
|||||||
platform: req.body.platform,
|
platform: req.body.platform,
|
||||||
cookies_enabled: req.body.cookies_enabled,
|
cookies_enabled: req.body.cookies_enabled,
|
||||||
browser_plugins: req.body.browser_plugins,
|
browser_plugins: req.body.browser_plugins,
|
||||||
latitude: req.body.latitude,
|
latitude, // sempre priorizar o valor do frontend
|
||||||
longitude: req.body.longitude,
|
longitude,
|
||||||
location_permission: req.body.location_permission,
|
location_permission: req.body.location_permission,
|
||||||
client_timestamp: req.body.client_timestamp,
|
client_timestamp: req.body.client_timestamp,
|
||||||
headers: {
|
headers: {
|
||||||
|
|||||||
@@ -1,47 +1,53 @@
|
|||||||
import puppeteer from 'puppeteer';
|
import puppeteer from 'puppeteer';
|
||||||
|
import { PDFDocument } from 'pdf-lib';
|
||||||
|
import fs from 'fs/promises';
|
||||||
|
import path from 'path';
|
||||||
import { prisma } from '../prismaClient';
|
import { prisma } from '../prismaClient';
|
||||||
|
|
||||||
|
// Função utilitária para converter pixels em milímetros (1px ≈ 0.264583 mm)
|
||||||
|
function pxToMm(px: number | null | undefined): string {
|
||||||
|
if (!px) return '0mm';
|
||||||
|
return (px * 0.264583).toFixed(2) + 'mm';
|
||||||
|
}
|
||||||
|
|
||||||
export class PdfService {
|
export class PdfService {
|
||||||
|
// Busca configuração do documento, usando apenas campos válidos do schema
|
||||||
private async getConfiguracao() {
|
private async getConfiguracao() {
|
||||||
try {
|
try {
|
||||||
// Buscar configuração ou usar valores padrão
|
|
||||||
const config = await prisma.configuracaoDocumento.findFirst({
|
const config = await prisma.configuracaoDocumento.findFirst({
|
||||||
orderBy: { criadoEm: 'desc' },
|
orderBy: { criadoEm: 'desc' },
|
||||||
select: {
|
select: {
|
||||||
id: true,
|
id: true,
|
||||||
headerImageUrl: true,
|
|
||||||
footerImageUrl: true,
|
|
||||||
logoUrl: true,
|
|
||||||
timbradoUrl: true,
|
timbradoUrl: true,
|
||||||
timbradoMarginTop: true,
|
timbradoMarginTop: true,
|
||||||
timbradoMarginBottom: true,
|
timbradoMarginBottom: true,
|
||||||
timbradoMarginLeft: true,
|
timbradoMarginLeft: true,
|
||||||
timbradoMarginRight: true,
|
timbradoMarginRight: true,
|
||||||
|
templatePadrao: true,
|
||||||
|
margensTemplate: true,
|
||||||
criadoEm: true
|
criadoEm: true
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
// Extrai recuo de primeira linha se existir em margensTemplate
|
||||||
console.log('Configuração encontrada:', config); // Debug
|
let firstLineIndent = '0mm';
|
||||||
|
if (config?.margensTemplate) {
|
||||||
// Retornar configuração padrão se não existir
|
try {
|
||||||
|
const margens = typeof config.margensTemplate === 'string' ? JSON.parse(config.margensTemplate) : config.margensTemplate;
|
||||||
|
if (margens && margens.firstLineIndent) {
|
||||||
|
firstLineIndent = `${margens.firstLineIndent}mm`;
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
// Se der erro, ignora e usa padrão
|
||||||
|
}
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
cabecalhoHtml: config?.cabecalhoHtml || `
|
|
||||||
<div style="text-align: center; padding: 20px;">
|
|
||||||
<h2 style="margin:0;font-size:14pt">{{escritorio.nome}}</h2>
|
|
||||||
</div>
|
|
||||||
`,
|
|
||||||
rodapeHtml: config?.rodapeHtml || `
|
|
||||||
<div style="text-align: center; font-size: 10pt;">
|
|
||||||
{{escritorio.endereco}}<br>
|
|
||||||
Tel: {{escritorio.telefone}} | Email: {{escritorio.email}}
|
|
||||||
</div>
|
|
||||||
`,
|
|
||||||
logoUrl: config?.logoUrl || '',
|
|
||||||
timbradoUrl: config?.timbradoUrl || '',
|
timbradoUrl: config?.timbradoUrl || '',
|
||||||
timbradoMarginTop: config?.timbradoMarginTop || 100,
|
timbradoMarginTop: config?.timbradoMarginTop ?? 100,
|
||||||
timbradoMarginBottom: config?.timbradoMarginBottom || 50,
|
timbradoMarginBottom: config?.timbradoMarginBottom ?? 50,
|
||||||
timbradoMarginLeft: config?.timbradoMarginLeft || 50,
|
timbradoMarginLeft: config?.timbradoMarginLeft ?? 50,
|
||||||
timbradoMarginRight: config?.timbradoMarginRight || 50
|
timbradoMarginRight: config?.timbradoMarginRight ?? 50,
|
||||||
|
templatePadrao: config?.templatePadrao || '',
|
||||||
|
firstLineIndent
|
||||||
};
|
};
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Erro ao buscar configuração:', error);
|
console.error('Erro ao buscar configuração:', error);
|
||||||
@@ -49,13 +55,19 @@ export class PdfService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Gera HTML com timbrado e margens
|
||||||
private gerarHTML(content: string, config: any) {
|
private gerarHTML(content: string, config: any) {
|
||||||
|
// Limpa espaços, quebras de linha e tags vazias do final do conteúdo
|
||||||
|
let cleanContent = content
|
||||||
|
.replace(/(\s|<br\s*\/?>|<p>\s*<\/p>)+$/gi, '')
|
||||||
|
.replace(/(<p>\s*<\/p>)+/gi, '');
|
||||||
const timbradoUrl = config.timbradoUrl
|
const timbradoUrl = config.timbradoUrl
|
||||||
? `${process.env.BACKEND_URL || 'http://localhost:5000'}${config.timbradoUrl}`
|
? `${process.env.FRONTEND_URL || 'http://localhost:5000'}${config.timbradoUrl}`
|
||||||
: '';
|
: '';
|
||||||
|
// Adiciona log para debug
|
||||||
console.log('Gerando PDF com timbrado:', timbradoUrl);
|
if (timbradoUrl) {
|
||||||
|
console.log('[PDF] Timbrado inserido no HTML:', timbradoUrl);
|
||||||
|
}
|
||||||
return `
|
return `
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
@@ -64,87 +76,158 @@ export class PdfService {
|
|||||||
<link href="https://fonts.googleapis.com/css2?family=Fira+Sans:wght@400;500;600&display=swap" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css2?family=Fira+Sans:wght@400;500;600&display=swap" rel="stylesheet">
|
||||||
<style>
|
<style>
|
||||||
@page {
|
@page {
|
||||||
margin: 0;
|
margin-top: ${pxToMm(config.timbradoMarginTop)};
|
||||||
|
margin-bottom: ${pxToMm(config.timbradoMarginBottom)};
|
||||||
|
margin-left: ${pxToMm(config.timbradoMarginLeft)};
|
||||||
|
margin-right: ${pxToMm(config.timbradoMarginRight)};
|
||||||
size: A4;
|
size: A4;
|
||||||
}
|
}
|
||||||
|
html, body {
|
||||||
body {
|
height: 100%;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
font-family: 'Fira Sans', Arial, sans-serif;
|
font-family: 'Fira Sans', Arial, sans-serif;
|
||||||
font-size: 11pt;
|
font-size: 11pt;
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
|
background: none;
|
||||||
|
}
|
||||||
|
body {
|
||||||
position: relative;
|
position: relative;
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
|
/* Remove background-image do body para evitar problemas no Puppeteer */
|
||||||
}
|
}
|
||||||
|
.timbrado-bg {
|
||||||
.page {
|
position: fixed;
|
||||||
position: relative;
|
top: 0;
|
||||||
width: 21cm;
|
left: 0;
|
||||||
min-height: 29.7cm;
|
width: 100vw;
|
||||||
padding: ${config.timbradoMarginTop || 100}px ${config.timbradoMarginRight || 50}px ${config.timbradoMarginBottom || 50}px ${config.timbradoMarginLeft || 50}px;
|
height: 100vh;
|
||||||
background: ${timbradoUrl ? `url('${timbradoUrl}')` : 'none'};
|
z-index: 0;
|
||||||
background-size: cover;
|
${timbradoUrl ? `background-image: url('${timbradoUrl}'); background-size: cover; background-position: center; background-repeat: no-repeat;` : ''}
|
||||||
background-position: center;
|
pointer-events: none;
|
||||||
background-repeat: no-repeat;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.content {
|
.content {
|
||||||
position: relative;
|
position: relative;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
|
box-sizing: border-box;
|
||||||
|
width: 100%;
|
||||||
|
/* Removido padding-top e padding-bottom para evitar recuo duplo com as margens do PDF */
|
||||||
|
padding-left: ${pxToMm(config.timbradoMarginLeft)};
|
||||||
|
padding-right: ${pxToMm(config.timbradoMarginRight)};
|
||||||
|
overflow-wrap: break-word;
|
||||||
|
word-break: break-word;
|
||||||
|
/* Permite múltiplas páginas e evita corte de conteúdo */
|
||||||
|
break-inside: auto;
|
||||||
|
page-break-inside: auto;
|
||||||
|
}
|
||||||
|
.content p {
|
||||||
|
text-indent: ${config.firstLineIndent || '0mm'};
|
||||||
|
}
|
||||||
|
/* Corrige recuo exagerado apenas na primeira linha do primeiro parágrafo da primeira página */
|
||||||
|
.content p:first-child {
|
||||||
|
text-indent: 0mm !important;
|
||||||
|
}
|
||||||
|
/* Corrige recuo exagerado apenas na última linha do último parágrafo da última página */
|
||||||
|
.content p:last-child {
|
||||||
|
margin-bottom: 0 !important;
|
||||||
|
padding-bottom: 0 !important;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="page">
|
${timbradoUrl ? '<div class="timbrado-bg"></div>' : ''}
|
||||||
<div class="content">
|
<div class="content">
|
||||||
${content}
|
${cleanContent}
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
async gerarPDF(conteudo: string, escritorio: any) {
|
// Gera PDF a partir do HTML, depois sobrepõe o timbrado em cada página
|
||||||
|
async gerarPDF(conteudo: string) {
|
||||||
try {
|
try {
|
||||||
const config = await prisma.configuracaoDocumento.findFirst({
|
const config = await this.getConfiguracao();
|
||||||
orderBy: { criadoEm: 'desc' }
|
// Usa templatePadrao se não houver conteúdo
|
||||||
});
|
const html = this.gerarHTML(conteudo || config.templatePadrao, config);
|
||||||
|
const browser = await puppeteer.launch({ headless: true, args: ['--no-sandbox'] });
|
||||||
console.log('Configuração do PDF:', config);
|
|
||||||
|
|
||||||
const html = this.gerarHTML(conteudo, config);
|
|
||||||
|
|
||||||
const browser = await puppeteer.launch({
|
|
||||||
headless: 'new',
|
|
||||||
args: ['--no-sandbox']
|
|
||||||
});
|
|
||||||
|
|
||||||
const page = await browser.newPage();
|
const page = await browser.newPage();
|
||||||
|
|
||||||
await page.setViewport({
|
|
||||||
width: 794, // A4 width in pixels (72 dpi)
|
|
||||||
height: 1123,
|
|
||||||
deviceScaleFactor: 2
|
|
||||||
});
|
|
||||||
|
|
||||||
await page.setContent(html, {
|
await page.setContent(html, {
|
||||||
waitUntil: ['networkidle0', 'load'],
|
waitUntil: ['networkidle0', 'load'],
|
||||||
timeout: 30000
|
timeout: 30000
|
||||||
});
|
});
|
||||||
|
const margin = {
|
||||||
|
top: pxToMm(config.timbradoMarginTop),
|
||||||
|
bottom: pxToMm(config.timbradoMarginBottom),
|
||||||
|
left: pxToMm(config.timbradoMarginLeft),
|
||||||
|
right: pxToMm(config.timbradoMarginRight)
|
||||||
|
};
|
||||||
const pdfBuffer = await page.pdf({
|
const pdfBuffer = await page.pdf({
|
||||||
format: 'A4',
|
format: 'A4',
|
||||||
printBackground: true,
|
printBackground: true,
|
||||||
margin: { top: '0', right: '0', bottom: '0', left: '0' },
|
margin,
|
||||||
preferCSSPageSize: true
|
preferCSSPageSize: true
|
||||||
});
|
});
|
||||||
|
|
||||||
await browser.close();
|
await browser.close();
|
||||||
return Buffer.from(pdfBuffer);
|
|
||||||
|
|
||||||
|
// Se não houver timbrado, retorna direto
|
||||||
|
if (!config.timbradoUrl) {
|
||||||
|
return Buffer.from(pdfBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Caminho absoluto do PDF de timbrado
|
||||||
|
const timbradoPath = config.timbradoUrl.startsWith('/uploads')
|
||||||
|
? path.join(process.cwd(), 'public', config.timbradoUrl)
|
||||||
|
: path.join(process.cwd(), 'public', 'uploads', path.basename(config.timbradoUrl));
|
||||||
|
let timbradoBytes: Buffer;
|
||||||
|
try {
|
||||||
|
timbradoBytes = await fs.readFile(timbradoPath);
|
||||||
|
} catch (e) {
|
||||||
|
console.error('Timbrado não encontrado:', timbradoPath);
|
||||||
|
return Buffer.from(pdfBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mescla cada página do PDF gerado com o timbrado
|
||||||
|
const pdfDoc = await PDFDocument.load(pdfBuffer);
|
||||||
|
const timbradoDoc = await PDFDocument.load(timbradoBytes);
|
||||||
|
const timbradoPage = timbradoDoc.getPage(0);
|
||||||
|
const [timbradoEmbed] = await pdfDoc.embedPages([timbradoPage]);
|
||||||
|
const pageCount = pdfDoc.getPageCount();
|
||||||
|
for (let i = 0; i < pageCount; i++) {
|
||||||
|
const page = pdfDoc.getPage(i);
|
||||||
|
page.drawPage(timbradoEmbed, { x: 0, y: 0, width: page.getWidth(), height: page.getHeight() });
|
||||||
|
}
|
||||||
|
// Após mesclar o timbrado
|
||||||
|
const pageCountBefore = pdfDoc.getPageCount();
|
||||||
|
if (pageCountBefore > 1) {
|
||||||
|
// Heurística aprimorada: remove a última página apenas se estiver realmente vazia (sem texto, imagens ou gráficos)
|
||||||
|
const lastPage = pdfDoc.getPage(pageCountBefore - 1);
|
||||||
|
let isBlank = true;
|
||||||
|
// Verifica se há texto
|
||||||
|
const annotations = lastPage.node.Annots;
|
||||||
|
if (annotations && annotations.length > 0) {
|
||||||
|
isBlank = false;
|
||||||
|
}
|
||||||
|
// Verifica se há objetos gráficos (imagens, paths, etc.)
|
||||||
|
if (isBlank && typeof lastPage.node?.Resources === 'function') {
|
||||||
|
const resourcesDict = lastPage.node.Resources();
|
||||||
|
if (resourcesDict && typeof resourcesDict === 'object') {
|
||||||
|
// Corrige: usa PDFName para acessar o XObject
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||||
|
const { PDFName } = require('pdf-lib');
|
||||||
|
const xObject = resourcesDict.get(PDFName.of('XObject'));
|
||||||
|
if (xObject && typeof xObject === 'object' && Object.keys(xObject).length > 0) {
|
||||||
|
isBlank = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Só remove se realmente não houver nada
|
||||||
|
if (isBlank) {
|
||||||
|
pdfDoc.removePage(pageCountBefore - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const mergedPdf = await pdfDoc.save();
|
||||||
|
return Buffer.from(mergedPdf);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Erro ao gerar PDF:', error);
|
console.error('Erro ao gerar PDF:', error);
|
||||||
throw new Error('Falha ao gerar PDF');
|
throw new Error('Falha ao gerar PDF');
|
||||||
|
|||||||
+152
-280
@@ -1,188 +1,53 @@
|
|||||||
import puppeteer from 'puppeteer';
|
import puppeteer from 'puppeteer';
|
||||||
import { prisma } from '../prismaClient';
|
import { PDFDocument } from 'pdf-lib';
|
||||||
import { PDFDocument, rgb, StandardFonts } from 'pdf-lib';
|
|
||||||
import fs from 'fs/promises';
|
import fs from 'fs/promises';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
import { prisma } from '../prismaClient';
|
||||||
|
|
||||||
|
// Função utilitária para converter pixels em milímetros (1px ≈ 0.264583 mm)
|
||||||
|
function pxToMm(px: number | null | undefined): string {
|
||||||
|
if (!px) return '0mm';
|
||||||
|
return (px * 0.264583).toFixed(2) + 'mm';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Serviço para geração e manipulação de arquivos PDF
|
|
||||||
*/
|
|
||||||
export class PdfService {
|
export class PdfService {
|
||||||
/**
|
// Busca configuração do documento, usando apenas campos válidos do schema
|
||||||
* Cria um documento PDF básico
|
|
||||||
* @returns Documento PDF
|
|
||||||
*/
|
|
||||||
async criarDocumento() {
|
|
||||||
return await PDFDocument.create();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Carrega um documento PDF existente
|
|
||||||
* @param pdfBytes - Bytes do PDF
|
|
||||||
* @returns Documento PDF
|
|
||||||
*/
|
|
||||||
async carregarDocumento(pdfBytes: Uint8Array) {
|
|
||||||
return await PDFDocument.load(pdfBytes);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adiciona uma página ao documento
|
|
||||||
* @param doc - Documento PDF
|
|
||||||
* @param tamanho - Tamanho da página (padrão: A4)
|
|
||||||
* @returns Página adicionada
|
|
||||||
*/
|
|
||||||
adicionarPagina(doc: any, tamanho = [595.28, 841.89]) {
|
|
||||||
return doc.addPage(tamanho);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Salva o documento como buffer
|
|
||||||
* @param doc - Documento PDF
|
|
||||||
* @returns Buffer do PDF
|
|
||||||
*/
|
|
||||||
async salvarComoBuffer(doc: any): Promise<Buffer> {
|
|
||||||
const pdfBytes = await doc.save();
|
|
||||||
return Buffer.from(pdfBytes);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Carrega uma fonte padrão
|
|
||||||
* @param doc - Documento PDF
|
|
||||||
* @param fonte - Nome da fonte padrão
|
|
||||||
* @returns Fonte carregada
|
|
||||||
*/
|
|
||||||
async carregarFonte(doc: any, fonte: StandardFonts) {
|
|
||||||
return await doc.embedFont(fonte);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Desenha texto em uma página
|
|
||||||
* @param pagina - Página do PDF
|
|
||||||
* @param texto - Texto a ser desenhado
|
|
||||||
* @param x - Posição X
|
|
||||||
* @param y - Posição Y
|
|
||||||
* @param fonte - Fonte a ser usada
|
|
||||||
* @param tamanho - Tamanho da fonte
|
|
||||||
* @param cor - Cor do texto (padrão: preto)
|
|
||||||
*/
|
|
||||||
desenharTexto(
|
|
||||||
pagina: any,
|
|
||||||
texto: string,
|
|
||||||
x: number,
|
|
||||||
y: number,
|
|
||||||
fonte: any,
|
|
||||||
tamanho: number,
|
|
||||||
cor = rgb(0, 0, 0)
|
|
||||||
) {
|
|
||||||
pagina.drawText(texto, {
|
|
||||||
x,
|
|
||||||
y,
|
|
||||||
font: fonte,
|
|
||||||
size: tamanho,
|
|
||||||
color: cor,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Cria um cabeçalho para o documento
|
|
||||||
* @param pagina - Página do PDF
|
|
||||||
* @param titulo - Título do cabeçalho
|
|
||||||
* @param fonte - Fonte a ser usada
|
|
||||||
* @param margemSuperior - Margem superior
|
|
||||||
* @param margem - Margem lateral
|
|
||||||
* @returns Posição Y após o cabeçalho
|
|
||||||
*/
|
|
||||||
criarCabecalho(
|
|
||||||
pagina: any,
|
|
||||||
titulo: string,
|
|
||||||
fonte: any,
|
|
||||||
margemSuperior: number,
|
|
||||||
margem: number
|
|
||||||
): number {
|
|
||||||
const yPos = pagina.getHeight() - margemSuperior;
|
|
||||||
|
|
||||||
this.desenharTexto(
|
|
||||||
pagina,
|
|
||||||
titulo,
|
|
||||||
margem,
|
|
||||||
yPos,
|
|
||||||
fonte,
|
|
||||||
18,
|
|
||||||
rgb(0, 0, 0.7)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Linha separadora
|
|
||||||
pagina.drawLine({
|
|
||||||
start: { x: margem, y: yPos - 10 },
|
|
||||||
end: { x: pagina.getWidth() - margem, y: yPos - 10 },
|
|
||||||
thickness: 1,
|
|
||||||
color: rgb(0, 0, 0.5),
|
|
||||||
});
|
|
||||||
|
|
||||||
return yPos - 30; // Retorna a posição Y após o cabeçalho
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Cria um rodapé para o documento
|
|
||||||
* @param pagina - Página do PDF
|
|
||||||
* @param texto - Texto do rodapé
|
|
||||||
* @param fonte - Fonte a ser usada
|
|
||||||
* @param margem - Margem
|
|
||||||
*/
|
|
||||||
criarRodape(pagina: any, texto: string, fonte: any, margem: number) {
|
|
||||||
const yPos = margem / 2;
|
|
||||||
|
|
||||||
this.desenharTexto(
|
|
||||||
pagina,
|
|
||||||
texto,
|
|
||||||
margem,
|
|
||||||
yPos,
|
|
||||||
fonte,
|
|
||||||
8,
|
|
||||||
rgb(0.5, 0.5, 0.5)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
private async getConfiguracao() {
|
private async getConfiguracao() {
|
||||||
try {
|
try {
|
||||||
// Buscar configuração ou usar valores padrão
|
|
||||||
const config = await prisma.configuracaoDocumento.findFirst({
|
const config = await prisma.configuracaoDocumento.findFirst({
|
||||||
orderBy: { criadoEm: 'desc' },
|
orderBy: { criadoEm: 'desc' },
|
||||||
select: {
|
select: {
|
||||||
id: true,
|
id: true,
|
||||||
headerImageUrl: true,
|
|
||||||
footerImageUrl: true,
|
|
||||||
logoUrl: true,
|
|
||||||
timbradoUrl: true,
|
timbradoUrl: true,
|
||||||
timbradoMarginTop: true,
|
timbradoMarginTop: true,
|
||||||
timbradoMarginBottom: true,
|
timbradoMarginBottom: true,
|
||||||
timbradoMarginLeft: true,
|
timbradoMarginLeft: true,
|
||||||
timbradoMarginRight: true,
|
timbradoMarginRight: true,
|
||||||
|
templatePadrao: true,
|
||||||
|
margensTemplate: true,
|
||||||
criadoEm: true
|
criadoEm: true
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
// Extrai recuo de primeira linha se existir em margensTemplate
|
||||||
console.log('Configuração encontrada:', config); // Debug
|
let firstLineIndent = '0mm';
|
||||||
|
if (config?.margensTemplate) {
|
||||||
// Retornar configuração padrão se não existir
|
try {
|
||||||
|
const margens = typeof config.margensTemplate === 'string' ? JSON.parse(config.margensTemplate) : config.margensTemplate;
|
||||||
|
if (margens && margens.firstLineIndent) {
|
||||||
|
firstLineIndent = `${margens.firstLineIndent}mm`;
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
// Se der erro, ignora e usa padrão
|
||||||
|
}
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
cabecalhoHtml: config?.cabecalhoHtml || `
|
|
||||||
<div style="text-align: center; padding: 20px;">
|
|
||||||
<h2 style="margin:0;font-size:14pt">{{escritorio.nome}}</h2>
|
|
||||||
</div>
|
|
||||||
`,
|
|
||||||
rodapeHtml: config?.rodapeHtml || `
|
|
||||||
<div style="text-align: center; font-size: 10pt;">
|
|
||||||
{{escritorio.endereco}}<br>
|
|
||||||
Tel: {{escritorio.telefone}} | Email: {{escritorio.email}}
|
|
||||||
</div>
|
|
||||||
`,
|
|
||||||
logoUrl: config?.logoUrl || '',
|
|
||||||
timbradoUrl: config?.timbradoUrl || '',
|
timbradoUrl: config?.timbradoUrl || '',
|
||||||
timbradoMarginTop: config?.timbradoMarginTop || 100,
|
timbradoMarginTop: config?.timbradoMarginTop ?? 100,
|
||||||
timbradoMarginBottom: config?.timbradoMarginBottom || 50,
|
timbradoMarginBottom: config?.timbradoMarginBottom ?? 50,
|
||||||
timbradoMarginLeft: config?.timbradoMarginLeft || 50,
|
timbradoMarginLeft: config?.timbradoMarginLeft ?? 50,
|
||||||
timbradoMarginRight: config?.timbradoMarginRight || 50
|
timbradoMarginRight: config?.timbradoMarginRight ?? 50,
|
||||||
|
templatePadrao: config?.templatePadrao || '',
|
||||||
|
firstLineIndent
|
||||||
};
|
};
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Erro ao buscar configuração:', error);
|
console.error('Erro ao buscar configuração:', error);
|
||||||
@@ -190,13 +55,19 @@ export class PdfService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Gera HTML com timbrado e margens
|
||||||
private gerarHTML(content: string, config: any) {
|
private gerarHTML(content: string, config: any) {
|
||||||
|
// Limpa espaços, quebras de linha e tags vazias do final do conteúdo
|
||||||
|
let cleanContent = content
|
||||||
|
.replace(/(\s|<br\s*\/?>|<p>\s*<\/p>)+$/gi, '')
|
||||||
|
.replace(/(<p>\s*<\/p>)+/gi, '');
|
||||||
const timbradoUrl = config.timbradoUrl
|
const timbradoUrl = config.timbradoUrl
|
||||||
? `${process.env.BACKEND_URL || 'http://localhost:5000'}${config.timbradoUrl}`
|
? `${process.env.FRONTEND_URL || 'http://localhost:5000'}${config.timbradoUrl}`
|
||||||
: '';
|
: '';
|
||||||
|
// Adiciona log para debug
|
||||||
console.log('Gerando PDF com timbrado:', timbradoUrl);
|
if (timbradoUrl) {
|
||||||
|
console.log('[PDF] Timbrado inserido no HTML:', timbradoUrl);
|
||||||
|
}
|
||||||
return `
|
return `
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
@@ -205,153 +76,154 @@ export class PdfService {
|
|||||||
<link href="https://fonts.googleapis.com/css2?family=Fira+Sans:wght@400;500;600&display=swap" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css2?family=Fira+Sans:wght@400;500;600&display=swap" rel="stylesheet">
|
||||||
<style>
|
<style>
|
||||||
@page {
|
@page {
|
||||||
margin: 0;
|
margin-top: ${pxToMm(config.timbradoMarginTop)};
|
||||||
|
margin-bottom: ${pxToMm(config.timbradoMarginBottom)};
|
||||||
|
margin-left: ${pxToMm(config.timbradoMarginLeft)};
|
||||||
|
margin-right: ${pxToMm(config.timbradoMarginRight)};
|
||||||
size: A4;
|
size: A4;
|
||||||
}
|
}
|
||||||
|
html, body {
|
||||||
body {
|
height: 100%;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
font-family: 'Fira Sans', Arial, sans-serif;
|
font-family: 'Fira Sans', Arial, sans-serif;
|
||||||
font-size: 11pt;
|
font-size: 11pt;
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
|
background: none;
|
||||||
|
}
|
||||||
|
body {
|
||||||
position: relative;
|
position: relative;
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
|
/* Remove background-image do body para evitar problemas no Puppeteer */
|
||||||
}
|
}
|
||||||
|
.timbrado-bg {
|
||||||
.page {
|
position: fixed;
|
||||||
position: relative;
|
top: 0;
|
||||||
width: 21cm;
|
left: 0;
|
||||||
min-height: 29.7cm;
|
width: 100vw;
|
||||||
padding: ${config.timbradoMarginTop || 100}px ${config.timbradoMarginRight || 50}px ${config.timbradoMarginBottom || 50}px ${config.timbradoMarginLeft || 50}px;
|
height: 100vh;
|
||||||
background: ${timbradoUrl ? `url('${timbradoUrl}')` : 'none'};
|
z-index: 0;
|
||||||
background-size: cover;
|
${timbradoUrl ? `background-image: url('${timbradoUrl}'); background-size: cover; background-position: center; background-repeat: no-repeat;` : ''}
|
||||||
background-position: center;
|
pointer-events: none;
|
||||||
background-repeat: no-repeat;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.content {
|
.content {
|
||||||
position: relative;
|
position: relative;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
|
box-sizing: border-box;
|
||||||
|
width: 100%;
|
||||||
|
/* Removido padding-top e padding-bottom para evitar recuo duplo com as margens do PDF */
|
||||||
|
padding-left: ${pxToMm(config.timbradoMarginLeft)};
|
||||||
|
padding-right: ${pxToMm(config.timbradoMarginRight)};
|
||||||
|
overflow-wrap: break-word;
|
||||||
|
word-break: break-word;
|
||||||
|
/* Permite múltiplas páginas e evita corte de conteúdo */
|
||||||
|
break-inside: auto;
|
||||||
|
page-break-inside: auto;
|
||||||
|
}
|
||||||
|
.content p {
|
||||||
|
text-indent: ${config.firstLineIndent || '0mm'};
|
||||||
|
}
|
||||||
|
/* Corrige recuo exagerado apenas na primeira linha do primeiro parágrafo da primeira página */
|
||||||
|
.content p:first-child {
|
||||||
|
text-indent: 0mm !important;
|
||||||
|
}
|
||||||
|
/* Corrige recuo exagerado apenas na última linha do último parágrafo da última página */
|
||||||
|
.content p:last-child {
|
||||||
|
margin-bottom: 0 !important;
|
||||||
|
padding-bottom: 0 !important;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="page">
|
${timbradoUrl ? '<div class="timbrado-bg"></div>' : ''}
|
||||||
<div class="content">
|
<div class="content">
|
||||||
${content}
|
${cleanContent}
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
async gerarPDF(conteudo: string, escritorio: any) {
|
// Gera PDF a partir do HTML, depois sobrepõe o timbrado em cada página
|
||||||
|
async gerarPDF(conteudo: string) {
|
||||||
try {
|
try {
|
||||||
// 1. Buscar configuração do template
|
const config = await this.getConfiguracao();
|
||||||
const config = await prisma.configuracaoDocumento.findFirst({
|
// Usa templatePadrao se não houver conteúdo
|
||||||
orderBy: { criadoEm: 'desc' }
|
const html = this.gerarHTML(conteudo || config.templatePadrao, config);
|
||||||
});
|
const browser = await puppeteer.launch({ headless: true, args: ['--no-sandbox'] });
|
||||||
|
|
||||||
// 2. Gerar PDF do conteúdo
|
|
||||||
const browser = await puppeteer.launch({
|
|
||||||
headless: 'new',
|
|
||||||
args: ['--no-sandbox']
|
|
||||||
});
|
|
||||||
|
|
||||||
const page = await browser.newPage();
|
const page = await browser.newPage();
|
||||||
|
await page.setContent(html, {
|
||||||
// Usar template padrão ou fallback para o template básico
|
waitUntil: ['networkidle0', 'load'],
|
||||||
const template = config?.templatePadrao || `
|
timeout: 30000
|
||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Fira+Sans:wght@400;500;700&display=swap" rel="stylesheet">
|
|
||||||
<style>
|
|
||||||
body {
|
|
||||||
font-family: 'Fira Sans', Arial, sans-serif;
|
|
||||||
font-size: 11pt;
|
|
||||||
line-height: 1.3;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.content {
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
min-height: calc(100vh - 58mm);
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
p { margin: 0.7em 0; }
|
|
||||||
h1, h2, h3 { margin: 0.8em 0; }
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="content">
|
|
||||||
${conteudo}
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
`;
|
|
||||||
|
|
||||||
// Processar o template substituindo variáveis
|
|
||||||
const templateProcessado = template.replace(/\{\{(.+?)\}\}/g, (match, key) => {
|
|
||||||
return escritorio[key.trim()] || match;
|
|
||||||
});
|
});
|
||||||
|
const margin = {
|
||||||
await page.setContent(templateProcessado);
|
top: pxToMm(config.timbradoMarginTop),
|
||||||
|
bottom: pxToMm(config.timbradoMarginBottom),
|
||||||
const margens = config?.margensTemplate || {
|
left: pxToMm(config.timbradoMarginLeft),
|
||||||
top: '35mm',
|
right: pxToMm(config.timbradoMarginRight)
|
||||||
bottom: '29mm',
|
|
||||||
left: '25mm',
|
|
||||||
right: '25mm'
|
|
||||||
};
|
};
|
||||||
|
const pdfBuffer = await page.pdf({
|
||||||
const contentPdfBuffer = await page.pdf({
|
|
||||||
format: 'A4',
|
format: 'A4',
|
||||||
margin: margens,
|
printBackground: true,
|
||||||
displayHeaderFooter: false,
|
margin,
|
||||||
printBackground: true
|
preferCSSPageSize: true
|
||||||
});
|
});
|
||||||
|
|
||||||
await browser.close();
|
await browser.close();
|
||||||
|
|
||||||
// 2. Carregar os PDFs
|
// Se não houver timbrado, retorna direto
|
||||||
const templatePath = path.join(process.cwd(), 'public', 'uploads', 'Timbrado_2025.pdf');
|
if (!config.timbradoUrl) {
|
||||||
const templateBytes = await fs.readFile(templatePath);
|
return Buffer.from(pdfBuffer);
|
||||||
|
|
||||||
const templateDoc = await PDFDocument.load(templateBytes);
|
|
||||||
const contentDoc = await PDFDocument.load(contentPdfBuffer);
|
|
||||||
|
|
||||||
// 3. Criar documento final
|
|
||||||
const pdfDoc = await PDFDocument.create();
|
|
||||||
|
|
||||||
// 4. Copiar template e conteúdo
|
|
||||||
const [templatePage] = await templateDoc.copyPages(templateDoc, [0]);
|
|
||||||
const contentPages = await contentDoc.getPages();
|
|
||||||
|
|
||||||
// 5. Para cada página do conteúdo
|
|
||||||
for (let i = 0; i < contentPages.length; i++) {
|
|
||||||
// Primeiro: adicionar template
|
|
||||||
const page = await pdfDoc.embedPage(templatePage);
|
|
||||||
const contentPage = await pdfDoc.embedPage(contentPages[i]);
|
|
||||||
|
|
||||||
// Segundo: criar nova página
|
|
||||||
const newPage = pdfDoc.addPage([page.width, page.height]);
|
|
||||||
|
|
||||||
// Terceiro: desenhar template e conteúdo
|
|
||||||
newPage.drawPage(page);
|
|
||||||
newPage.drawPage(contentPage);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 6. Gerar PDF final
|
// Caminho absoluto do PDF de timbrado
|
||||||
const pdfBytes = await pdfDoc.save();
|
const timbradoPath = config.timbradoUrl.startsWith('/uploads')
|
||||||
return Buffer.from(pdfBytes);
|
? path.join(process.cwd(), 'public', config.timbradoUrl)
|
||||||
|
: path.join(process.cwd(), 'public', 'uploads', path.basename(config.timbradoUrl));
|
||||||
|
let timbradoBytes: Buffer;
|
||||||
|
try {
|
||||||
|
timbradoBytes = await fs.readFile(timbradoPath);
|
||||||
|
} catch (e) {
|
||||||
|
console.error('Timbrado não encontrado:', timbradoPath);
|
||||||
|
return Buffer.from(pdfBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove página vazia do final ANTES de mesclar o timbrado
|
||||||
|
let pdfDoc = await PDFDocument.load(pdfBuffer);
|
||||||
|
let pageCountBefore = pdfDoc.getPageCount();
|
||||||
|
if (pageCountBefore > 1) {
|
||||||
|
const lastPage = pdfDoc.getPage(pageCountBefore - 1);
|
||||||
|
const contentStreams = (lastPage as any).node.Contents?.();
|
||||||
|
let isBlank = false;
|
||||||
|
|
||||||
|
if (!contentStreams) {
|
||||||
|
isBlank = true;
|
||||||
|
} else if (Array.isArray(contentStreams)) {
|
||||||
|
isBlank = contentStreams.every(
|
||||||
|
(stream: any) =>
|
||||||
|
!stream.contents ||
|
||||||
|
(typeof stream.contents.length === 'number' && stream.contents.length < 5)
|
||||||
|
);
|
||||||
|
} else if (contentStreams.contents && typeof contentStreams.contents.length === 'number') {
|
||||||
|
isBlank = contentStreams.contents.length < 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isBlank) {
|
||||||
|
pdfDoc.removePage(pageCountBefore - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Agora sim, mescle o timbrado nas páginas restantes
|
||||||
|
const timbradoDoc = await PDFDocument.load(timbradoBytes);
|
||||||
|
const timbradoPage = timbradoDoc.getPage(0);
|
||||||
|
const [timbradoEmbed] = await pdfDoc.embedPages([timbradoPage]);
|
||||||
|
const pageCount = pdfDoc.getPageCount();
|
||||||
|
for (let i = 0; i < pageCount; i++) {
|
||||||
|
const page = pdfDoc.getPage(i);
|
||||||
|
page.drawPage(timbradoEmbed, { x: 0, y: 0, width: page.getWidth(), height: page.getHeight() });
|
||||||
|
}
|
||||||
|
|
||||||
|
const mergedPdf = await pdfDoc.save();
|
||||||
|
return Buffer.from(mergedPdf);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Erro ao gerar PDF:', error);
|
console.error('Erro ao gerar PDF:', error);
|
||||||
throw new Error('Falha ao gerar PDF');
|
throw new Error('Falha ao gerar PDF');
|
||||||
|
|||||||
@@ -606,9 +606,19 @@ export class ReportGenerator {
|
|||||||
y -= 15;
|
y -= 15;
|
||||||
|
|
||||||
// RESTAURAR GEOLOCALIZAÇÃO - CORRIGIDA PARA EVITAR N/A
|
// RESTAURAR GEOLOCALIZAÇÃO - CORRIGIDA PARA EVITAR N/A
|
||||||
const latitude = typeof data.metadata?.latitude !== 'undefined' ? data.metadata.latitude : '-7.2035066';
|
// Busca latitude/longitude tanto na raiz quanto em locationInfo
|
||||||
const longitude = typeof data.metadata?.longitude !== 'undefined' ? data.metadata.longitude : '-48.2111972';
|
let latitude = 'N/A';
|
||||||
|
let longitude = 'N/A';
|
||||||
|
if (typeof data.metadata?.latitude !== 'undefined' && data.metadata?.latitude !== null) {
|
||||||
|
latitude = String(data.metadata.latitude);
|
||||||
|
} else if (typeof data.metadata?.locationInfo?.latitude !== 'undefined' && data.metadata?.locationInfo?.latitude !== null) {
|
||||||
|
latitude = String(data.metadata.locationInfo.latitude);
|
||||||
|
}
|
||||||
|
if (typeof data.metadata?.longitude !== 'undefined' && data.metadata?.longitude !== null) {
|
||||||
|
longitude = String(data.metadata.longitude);
|
||||||
|
} else if (typeof data.metadata?.locationInfo?.longitude !== 'undefined' && data.metadata?.locationInfo?.longitude !== null) {
|
||||||
|
longitude = String(data.metadata.locationInfo.longitude);
|
||||||
|
}
|
||||||
this.drawLabelValue(page, "Coordenadas:", `${latitude}, ${longitude}`, y, helvetica, helveticaBold);
|
this.drawLabelValue(page, "Coordenadas:", `${latitude}, ${longitude}`, y, helvetica, helveticaBold);
|
||||||
y -= 15;
|
y -= 15;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,264 @@
|
|||||||
|
import { prisma } from '../config/database';
|
||||||
|
import puppeteer from 'puppeteer-extra';
|
||||||
|
import StealthPlugin from 'puppeteer-extra-plugin-stealth';
|
||||||
|
import { createHash } from 'crypto';
|
||||||
|
import * as path from 'path';
|
||||||
|
import * as fs from 'fs/promises';
|
||||||
|
import { Browser, Page } from 'puppeteer';
|
||||||
|
import * as OpenTimestamps from 'opentimestamps';
|
||||||
|
|
||||||
|
puppeteer.use(StealthPlugin());
|
||||||
|
|
||||||
|
export class NavegacaoService {
|
||||||
|
private browser: Browser | null = null;
|
||||||
|
private page: Page | null = null;
|
||||||
|
private sessaoId: string | null = null;
|
||||||
|
private recording: boolean = false;
|
||||||
|
private recordingInterval: NodeJS.Timeout | null = null;
|
||||||
|
|
||||||
|
async iniciarSessao(usuarioId: string, titulo: string, descricao?: string) {
|
||||||
|
try {
|
||||||
|
// Criar sessão no banco
|
||||||
|
const sessionKey = this.generateSessionKey();
|
||||||
|
|
||||||
|
const sessao = await prisma.sessaoNavegacao.create({
|
||||||
|
data: {
|
||||||
|
titulo,
|
||||||
|
descricao,
|
||||||
|
usuarioId,
|
||||||
|
sessionKey,
|
||||||
|
status: 'INICIADA',
|
||||||
|
browserFingerprint: await this.getBrowserFingerprint()
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
this.sessaoId = sessao.id;
|
||||||
|
|
||||||
|
// Inicializar browser controlado
|
||||||
|
await this.setupBrowser();
|
||||||
|
|
||||||
|
return {
|
||||||
|
sessaoId: sessao.id,
|
||||||
|
sessionKey: sessao.sessionKey,
|
||||||
|
browserWsEndpoint: this.browser?.wsEndpoint()
|
||||||
|
};
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Erro ao iniciar sessão:', error);
|
||||||
|
throw new Error('Falha ao iniciar sessão de navegação');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async setupBrowser() {
|
||||||
|
this.browser = await puppeteer.launch({
|
||||||
|
headless: false,
|
||||||
|
devtools: true,
|
||||||
|
defaultViewport: null,
|
||||||
|
args: [
|
||||||
|
'--no-sandbox',
|
||||||
|
'--disable-setuid-sandbox',
|
||||||
|
'--enable-webrtc-logs',
|
||||||
|
'--use-fake-ui-for-media-stream',
|
||||||
|
'--autoplay-policy=no-user-gesture-required'
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
this.page = await this.browser.newPage();
|
||||||
|
|
||||||
|
// Configurar interceptadores
|
||||||
|
await this.setupPageInterceptors();
|
||||||
|
}
|
||||||
|
|
||||||
|
private async setupPageInterceptors() {
|
||||||
|
if (!this.page) return;
|
||||||
|
|
||||||
|
// Interceptar requests de rede
|
||||||
|
await this.page.setRequestInterception(true);
|
||||||
|
|
||||||
|
this.page.on('request', async (request) => {
|
||||||
|
await this.registrarAcao('NAVEGACAO', {
|
||||||
|
url: request.url(),
|
||||||
|
method: request.method(),
|
||||||
|
headers: request.headers(),
|
||||||
|
postData: request.postData()
|
||||||
|
});
|
||||||
|
request.continue();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Interceptar cliques
|
||||||
|
await this.page.evaluateOnNewDocument(() => {
|
||||||
|
document.addEventListener('click', (event) => {
|
||||||
|
window.postMessage({
|
||||||
|
type: 'NAVEGACAO_ACTION',
|
||||||
|
action: 'CLIQUE',
|
||||||
|
data: {
|
||||||
|
x: event.clientX,
|
||||||
|
y: event.clientY,
|
||||||
|
target: event.target?.tagName,
|
||||||
|
targetId: event.target?.id,
|
||||||
|
targetClass: event.target?.className
|
||||||
|
}
|
||||||
|
}, '*');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Escutar mensagens do frontend
|
||||||
|
this.page.on('console', async (msg) => {
|
||||||
|
if (msg.text().includes('NAVEGACAO_ACTION')) {
|
||||||
|
const data = JSON.parse(msg.text().replace('NAVEGACAO_ACTION:', ''));
|
||||||
|
await this.registrarAcao(data.action, data.data);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async navegarPara(url: string) {
|
||||||
|
if (!this.page || !this.sessaoId) {
|
||||||
|
throw new Error('Sessão não iniciada');
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
await this.page.goto(url, { waitUntil: 'networkidle2' });
|
||||||
|
|
||||||
|
// Capturar estado atual
|
||||||
|
await this.capturarEstadoAtual();
|
||||||
|
|
||||||
|
// Atualizar status
|
||||||
|
await prisma.sessaoNavegacao.update({
|
||||||
|
where: { id: this.sessaoId },
|
||||||
|
data: { status: 'EM_ANDAMENTO' }
|
||||||
|
});
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Erro na navegação:', error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async capturarEstadoAtual() {
|
||||||
|
if (!this.page || !this.sessaoId) return;
|
||||||
|
|
||||||
|
const url = this.page.url();
|
||||||
|
const titulo = await this.page.title();
|
||||||
|
const timestamp = new Date();
|
||||||
|
|
||||||
|
// Screenshot
|
||||||
|
const screenshotBuffer = await this.page.screenshot({ fullPage: true });
|
||||||
|
const screenshotPath = await this.salvarArquivo(
|
||||||
|
screenshotBuffer,
|
||||||
|
`screenshot_${Date.now()}.png`
|
||||||
|
);
|
||||||
|
|
||||||
|
// HTML content
|
||||||
|
const htmlContent = await this.page.content();
|
||||||
|
const checksumHtml = createHash('sha256').update(htmlContent).digest('hex');
|
||||||
|
const checksumScreenshot = createHash('sha256').update(screenshotBuffer).digest('hex');
|
||||||
|
|
||||||
|
// Cookies e storage
|
||||||
|
const cookies = await this.page.cookies();
|
||||||
|
const localStorage = await this.page.evaluate(() =>
|
||||||
|
JSON.stringify(window.localStorage)
|
||||||
|
);
|
||||||
|
const sessionStorage = await this.page.evaluate(() =>
|
||||||
|
JSON.stringify(window.sessionStorage)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Salvar captura
|
||||||
|
await prisma.capturaNavegacao.create({
|
||||||
|
data: {
|
||||||
|
sessaoId: this.sessaoId,
|
||||||
|
timestamp,
|
||||||
|
url,
|
||||||
|
titulo,
|
||||||
|
screenshotPath,
|
||||||
|
htmlContent,
|
||||||
|
checksumHtml,
|
||||||
|
checksumScreenshot,
|
||||||
|
networkRequests: [], // Será preenchido pelos interceptadores
|
||||||
|
cookies,
|
||||||
|
localStorage: localStorage ? JSON.parse(localStorage) : null,
|
||||||
|
sessionStorage: sessionStorage ? JSON.parse(sessionStorage) : null
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private async registrarAcao(tipo: string, dados: any) {
|
||||||
|
if (!this.sessaoId) return;
|
||||||
|
|
||||||
|
const screenshot = this.page ? await this.page.screenshot({ encoding: 'base64' }) : null;
|
||||||
|
|
||||||
|
await prisma.acaoNavegacao.create({
|
||||||
|
data: {
|
||||||
|
sessaoId: this.sessaoId,
|
||||||
|
timestamp: new Date(),
|
||||||
|
tipo: tipo as any,
|
||||||
|
url: this.page?.url(),
|
||||||
|
elemento: dados.target,
|
||||||
|
coordenadas: dados.x && dados.y ? { x: dados.x, y: dados.y } : null,
|
||||||
|
valor: dados.value,
|
||||||
|
screenshot: screenshot ? `data:image/png;base64,${screenshot}` : null,
|
||||||
|
metadados: dados
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async finalizarSessao() {
|
||||||
|
if (!this.sessaoId) return;
|
||||||
|
|
||||||
|
try {
|
||||||
|
await prisma.sessaoNavegacao.update({
|
||||||
|
where: { id: this.sessaoId },
|
||||||
|
data: {
|
||||||
|
status: 'FINALIZANDO',
|
||||||
|
fimSessao: new Date()
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Gerar relatório final
|
||||||
|
await this.gerarRelatorioFinal();
|
||||||
|
|
||||||
|
if (this.browser) {
|
||||||
|
await this.browser.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
await prisma.sessaoNavegacao.update({
|
||||||
|
where: { id: this.sessaoId },
|
||||||
|
data: { status: 'CONCLUIDA' }
|
||||||
|
});
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Erro ao finalizar sessão:', error);
|
||||||
|
await prisma.sessaoNavegacao.update({
|
||||||
|
where: { id: this.sessaoId },
|
||||||
|
data: { status: 'ERRO' }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async gerarRelatorioFinal() {
|
||||||
|
// Implementar geração do relatório PDF com todas as evidências
|
||||||
|
// Compilar screenshots, metadados, timestamps, etc.
|
||||||
|
}
|
||||||
|
|
||||||
|
private generateSessionKey(): string {
|
||||||
|
return createHash('sha256')
|
||||||
|
.update(`${Date.now()}_${Math.random()}_${process.pid}`)
|
||||||
|
.digest('hex');
|
||||||
|
}
|
||||||
|
|
||||||
|
private async getBrowserFingerprint() {
|
||||||
|
return {
|
||||||
|
userAgent: 'Controlled Browser',
|
||||||
|
timestamp: new Date().toISOString(),
|
||||||
|
nodeVersion: process.version
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private async salvarArquivo(buffer: Buffer, filename: string): Promise<string> {
|
||||||
|
const dir = path.join(process.cwd(), 'storage', 'navegacao', this.sessaoId!);
|
||||||
|
await fs.mkdir(dir, { recursive: true });
|
||||||
|
|
||||||
|
const filepath = path.join(dir, filename);
|
||||||
|
await fs.writeFile(filepath, buffer);
|
||||||
|
|
||||||
|
return filepath;
|
||||||
|
}
|
||||||
|
}
|
||||||
+6
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"hash": "5e87cdeee62ec3e659704f86b359862f4d6ab3764de6d2490ffbdf4560c6faa0",
|
||||||
|
"timestamp": "2025-04-22T22:32:04.863Z",
|
||||||
|
"ntpReference": "Acompanhando time.nist.gov [132.163.97.4:123].\nColetando 1 amostras.\nA hora atual � 22/04/2025 19:32:04.\n19:32:04, Erro: 0x800705B4\n",
|
||||||
|
"unixTimestamp": 1745361124
|
||||||
|
}
|
||||||
+71
@@ -0,0 +1,71 @@
|
|||||||
|
{
|
||||||
|
"timestamp": "2025-04-22T22:32:07.355Z",
|
||||||
|
"fileName": "solicitação.jpg",
|
||||||
|
"fileSize": 79952,
|
||||||
|
"mimeType": "image/jpeg",
|
||||||
|
"checksums": {
|
||||||
|
"sha256": "5e87cdeee62ec3e659704f86b359862f4d6ab3764de6d2490ffbdf4560c6faa0",
|
||||||
|
"sha512": "aac8920361b942a02a79c56503e36f98a0624f16e6e17023338358752ec5fdd35d2bbc3ef69bbd53723af2edac95c76ce40a897c6a59ac2cc8e0774c9b649cbb",
|
||||||
|
"md5": "53ef086077fa170f4154f555ccf9545f"
|
||||||
|
},
|
||||||
|
"metadata": {
|
||||||
|
"collectionId": "e73e9767-1ac7-493a-8247-d54aeb5e2379",
|
||||||
|
"collectionTimestamp": "2025-04-22T22:32:04.840Z",
|
||||||
|
"userInfo": {
|
||||||
|
"ipAddress": "::1:55009",
|
||||||
|
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36",
|
||||||
|
"language": "pt-BR",
|
||||||
|
"browser": {
|
||||||
|
"name": "Chrome",
|
||||||
|
"version": "135.0.0.0",
|
||||||
|
"major": "135"
|
||||||
|
},
|
||||||
|
"engine": {
|
||||||
|
"name": "Blink",
|
||||||
|
"version": "135.0.0.0"
|
||||||
|
},
|
||||||
|
"os": {
|
||||||
|
"name": "Windows",
|
||||||
|
"version": "10"
|
||||||
|
},
|
||||||
|
"device": {
|
||||||
|
"vendor": "desconhecido",
|
||||||
|
"model": "desconhecido",
|
||||||
|
"type": "desconhecido"
|
||||||
|
},
|
||||||
|
"cpu": {
|
||||||
|
"architecture": "amd64"
|
||||||
|
},
|
||||||
|
"viewportSize": "1150x695",
|
||||||
|
"referrer": "não informado"
|
||||||
|
},
|
||||||
|
"fileInfo": {
|
||||||
|
"name": "solicitação.jpg",
|
||||||
|
"size": 79952,
|
||||||
|
"sizeFormatted": "78.08 KB",
|
||||||
|
"modifiedDate": "2025-04-08T18:55:21.595Z"
|
||||||
|
},
|
||||||
|
"locationInfo": {
|
||||||
|
"latitude": -7.2045208,
|
||||||
|
"longitude": -48.2294113,
|
||||||
|
"city": "não disponível",
|
||||||
|
"region": "não disponível",
|
||||||
|
"country": "não disponível",
|
||||||
|
"timezone": "não disponível"
|
||||||
|
},
|
||||||
|
"timestamp": "2025-04-22T22:32:04.831Z",
|
||||||
|
"integrityHash": "2faf0e219dda1105b713b1e220cf4b89b5c26bb75e700d417f1f397c8685d8b4"
|
||||||
|
},
|
||||||
|
"processingInfo": {
|
||||||
|
"processingNode": "RODRIGO",
|
||||||
|
"processingUser": "rodri",
|
||||||
|
"processingTimestamp": "2025-04-22T22:32:07.360Z",
|
||||||
|
"systemInfo": {
|
||||||
|
"platform": "win32",
|
||||||
|
"release": "10.0.26100",
|
||||||
|
"cpus": 4,
|
||||||
|
"memory": "20GB",
|
||||||
|
"uptime": "11h"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 78 KiB |
BIN
Binary file not shown.
+6
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"hash": "a97fe62052f746e17a48e6c3db29bcb3cd30d6457222d272ba1a83691024070f",
|
||||||
|
"timestamp": "2025-04-22T22:20:25.521Z",
|
||||||
|
"ntpReference": "Acompanhando time.nist.gov [129.6.15.26:123].\nColetando 1 amostras.\nA hora atual � 22/04/2025 19:20:25.\n19:20:25, Erro: 0x800705B4\n",
|
||||||
|
"unixTimestamp": 1745360425
|
||||||
|
}
|
||||||
+71
@@ -0,0 +1,71 @@
|
|||||||
|
{
|
||||||
|
"timestamp": "2025-04-22T22:20:27.452Z",
|
||||||
|
"fileName": "WhatsApp Image 2025-04-10 at 17.34.45.jpeg",
|
||||||
|
"fileSize": 199339,
|
||||||
|
"mimeType": "image/jpeg",
|
||||||
|
"checksums": {
|
||||||
|
"sha256": "a97fe62052f746e17a48e6c3db29bcb3cd30d6457222d272ba1a83691024070f",
|
||||||
|
"sha512": "fcafa2baf00a9a123e797d364d8010c5d45a58ca3dd5612cfa4032539762fdf0b014cfd11bc3655e18c6eade3a38d01149cce4cae6a6dffe486af407c6a0eea8",
|
||||||
|
"md5": "78581f0292ca27ea3066998009018e38"
|
||||||
|
},
|
||||||
|
"metadata": {
|
||||||
|
"collectionId": "7bbe3133-8616-478d-8fab-bc29deab2351",
|
||||||
|
"collectionTimestamp": "2025-04-22T22:20:25.506Z",
|
||||||
|
"userInfo": {
|
||||||
|
"ipAddress": "::1:54423",
|
||||||
|
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36",
|
||||||
|
"language": "pt-BR",
|
||||||
|
"browser": {
|
||||||
|
"name": "Chrome",
|
||||||
|
"version": "135.0.0.0",
|
||||||
|
"major": "135"
|
||||||
|
},
|
||||||
|
"engine": {
|
||||||
|
"name": "Blink",
|
||||||
|
"version": "135.0.0.0"
|
||||||
|
},
|
||||||
|
"os": {
|
||||||
|
"name": "Windows",
|
||||||
|
"version": "10"
|
||||||
|
},
|
||||||
|
"device": {
|
||||||
|
"vendor": "desconhecido",
|
||||||
|
"model": "desconhecido",
|
||||||
|
"type": "desconhecido"
|
||||||
|
},
|
||||||
|
"cpu": {
|
||||||
|
"architecture": "amd64"
|
||||||
|
},
|
||||||
|
"viewportSize": "1150x695",
|
||||||
|
"referrer": "não informado"
|
||||||
|
},
|
||||||
|
"fileInfo": {
|
||||||
|
"name": "WhatsApp Image 2025-04-10 at 17.34.45.jpeg",
|
||||||
|
"size": 199339,
|
||||||
|
"sizeFormatted": "194.67 KB",
|
||||||
|
"modifiedDate": "2025-04-11T00:02:14.553Z"
|
||||||
|
},
|
||||||
|
"locationInfo": {
|
||||||
|
"latitude": -7.2045208,
|
||||||
|
"longitude": -48.2294113,
|
||||||
|
"city": "não disponível",
|
||||||
|
"region": "não disponível",
|
||||||
|
"country": "não disponível",
|
||||||
|
"timezone": "não disponível"
|
||||||
|
},
|
||||||
|
"timestamp": "2025-04-22T22:20:25.494Z",
|
||||||
|
"integrityHash": "7ef6d0611c893f56912d613b5e0f60a603c3e2ddeb0e2c2ddafb9b49a49a4878"
|
||||||
|
},
|
||||||
|
"processingInfo": {
|
||||||
|
"processingNode": "RODRIGO",
|
||||||
|
"processingUser": "rodri",
|
||||||
|
"processingTimestamp": "2025-04-22T22:20:27.452Z",
|
||||||
|
"systemInfo": {
|
||||||
|
"platform": "win32",
|
||||||
|
"release": "10.0.26100",
|
||||||
|
"cpus": 4,
|
||||||
|
"memory": "20GB",
|
||||||
|
"uptime": "11h"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 195 KiB |
BIN
Binary file not shown.
+6
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"hash": "daea8251005113c549873cb271c3cedd345f36a5289dafcf76ac4a9664291864",
|
||||||
|
"timestamp": "2025-04-22T22:33:58.785Z",
|
||||||
|
"ntpReference": "Acompanhando time.nist.gov [132.163.97.2:123].\nColetando 1 amostras.\nA hora atual � 22/04/2025 19:33:58.\n19:33:58, Erro: 0x800705B4\n",
|
||||||
|
"unixTimestamp": 1745361238
|
||||||
|
}
|
||||||
+71
@@ -0,0 +1,71 @@
|
|||||||
|
{
|
||||||
|
"timestamp": "2025-04-22T22:34:00.953Z",
|
||||||
|
"fileName": "WhatsApp Image 2025-04-10 at 17.33.40 (3).jpeg",
|
||||||
|
"fileSize": 165323,
|
||||||
|
"mimeType": "image/jpeg",
|
||||||
|
"checksums": {
|
||||||
|
"sha256": "daea8251005113c549873cb271c3cedd345f36a5289dafcf76ac4a9664291864",
|
||||||
|
"sha512": "d9eff17b23fa3e4b5314197838a7d6531b0940d96d184982283da1e01812cfa13417737a1760bb72fab2f10f0c6919885cb3738b3286263a2c1797efc2ce5365",
|
||||||
|
"md5": "4f0f85e5503e45cb7a7f3990991dc515"
|
||||||
|
},
|
||||||
|
"metadata": {
|
||||||
|
"collectionId": "4ba82667-b08d-46a6-9713-e0c664b3af6f",
|
||||||
|
"collectionTimestamp": "2025-04-22T22:33:58.755Z",
|
||||||
|
"userInfo": {
|
||||||
|
"ipAddress": "::1:55140",
|
||||||
|
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36",
|
||||||
|
"language": "pt-BR",
|
||||||
|
"browser": {
|
||||||
|
"name": "Chrome",
|
||||||
|
"version": "135.0.0.0",
|
||||||
|
"major": "135"
|
||||||
|
},
|
||||||
|
"engine": {
|
||||||
|
"name": "Blink",
|
||||||
|
"version": "135.0.0.0"
|
||||||
|
},
|
||||||
|
"os": {
|
||||||
|
"name": "Windows",
|
||||||
|
"version": "10"
|
||||||
|
},
|
||||||
|
"device": {
|
||||||
|
"vendor": "desconhecido",
|
||||||
|
"model": "desconhecido",
|
||||||
|
"type": "desconhecido"
|
||||||
|
},
|
||||||
|
"cpu": {
|
||||||
|
"architecture": "amd64"
|
||||||
|
},
|
||||||
|
"viewportSize": "1150x695",
|
||||||
|
"referrer": "não informado"
|
||||||
|
},
|
||||||
|
"fileInfo": {
|
||||||
|
"name": "WhatsApp Image 2025-04-10 at 17.33.40 (3).jpeg",
|
||||||
|
"size": 165323,
|
||||||
|
"sizeFormatted": "161.45 KB",
|
||||||
|
"modifiedDate": "2025-04-11T00:02:10.578Z"
|
||||||
|
},
|
||||||
|
"locationInfo": {
|
||||||
|
"latitude": -7.2045208,
|
||||||
|
"longitude": -48.2294113,
|
||||||
|
"city": "não disponível",
|
||||||
|
"region": "não disponível",
|
||||||
|
"country": "não disponível",
|
||||||
|
"timezone": "não disponível"
|
||||||
|
},
|
||||||
|
"timestamp": "2025-04-22T22:33:58.722Z",
|
||||||
|
"integrityHash": "ea7631b891db898d4b082e0f3b9ca839c074424cc39ac3d5963e8ac3b4e5b790"
|
||||||
|
},
|
||||||
|
"processingInfo": {
|
||||||
|
"processingNode": "RODRIGO",
|
||||||
|
"processingUser": "rodri",
|
||||||
|
"processingTimestamp": "2025-04-22T22:34:00.954Z",
|
||||||
|
"systemInfo": {
|
||||||
|
"platform": "win32",
|
||||||
|
"release": "10.0.26100",
|
||||||
|
"cpus": 4,
|
||||||
|
"memory": "20GB",
|
||||||
|
"uptime": "11h"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 161 KiB |
BIN
Binary file not shown.
+6
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"hash": "e64cd45d0423541166f6cef318bbe8a6c34df8aafc03a10fb0390e72daa732c4",
|
||||||
|
"timestamp": "2025-04-22T22:22:48.274Z",
|
||||||
|
"ntpReference": "Acompanhando time.nist.gov [129.6.15.26:123].\nColetando 1 amostras.\nA hora atual � 22/04/2025 19:22:48.\n19:22:48, Erro: 0x800705B4\n",
|
||||||
|
"unixTimestamp": 1745360568
|
||||||
|
}
|
||||||
+71
@@ -0,0 +1,71 @@
|
|||||||
|
{
|
||||||
|
"timestamp": "2025-04-22T22:22:50.477Z",
|
||||||
|
"fileName": "Trabalhador_Rural_Idoso_Prestes_a_se_Aposentar.jpg",
|
||||||
|
"fileSize": 1721153,
|
||||||
|
"mimeType": "image/jpeg",
|
||||||
|
"checksums": {
|
||||||
|
"sha256": "e64cd45d0423541166f6cef318bbe8a6c34df8aafc03a10fb0390e72daa732c4",
|
||||||
|
"sha512": "8b4526086e7cf7f1ec3056aace8c03dd6c74dad91ba2b521910e5dcd65a15064bd9e1f5272b48de09ccf05383c0ce6bcf6bc34717e823a0c544eb725484b3646",
|
||||||
|
"md5": "e6c1c696bc8e6dc5cc67bdf42caa149d"
|
||||||
|
},
|
||||||
|
"metadata": {
|
||||||
|
"collectionId": "c26103a3-e80f-4902-a20f-e4f24a7053e8",
|
||||||
|
"collectionTimestamp": "2025-04-22T22:22:48.225Z",
|
||||||
|
"userInfo": {
|
||||||
|
"ipAddress": "::1:54550",
|
||||||
|
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36",
|
||||||
|
"language": "pt-BR",
|
||||||
|
"browser": {
|
||||||
|
"name": "Chrome",
|
||||||
|
"version": "135.0.0.0",
|
||||||
|
"major": "135"
|
||||||
|
},
|
||||||
|
"engine": {
|
||||||
|
"name": "Blink",
|
||||||
|
"version": "135.0.0.0"
|
||||||
|
},
|
||||||
|
"os": {
|
||||||
|
"name": "Windows",
|
||||||
|
"version": "10"
|
||||||
|
},
|
||||||
|
"device": {
|
||||||
|
"vendor": "desconhecido",
|
||||||
|
"model": "desconhecido",
|
||||||
|
"type": "desconhecido"
|
||||||
|
},
|
||||||
|
"cpu": {
|
||||||
|
"architecture": "amd64"
|
||||||
|
},
|
||||||
|
"viewportSize": "1150x695",
|
||||||
|
"referrer": "não informado"
|
||||||
|
},
|
||||||
|
"fileInfo": {
|
||||||
|
"name": "Trabalhador_Rural_Idoso_Prestes_a_se_Aposentar.jpg",
|
||||||
|
"size": 1721153,
|
||||||
|
"sizeFormatted": "1.64 MB",
|
||||||
|
"modifiedDate": "2025-04-11T01:08:13.364Z"
|
||||||
|
},
|
||||||
|
"locationInfo": {
|
||||||
|
"latitude": -7.2045208,
|
||||||
|
"longitude": -48.2294113,
|
||||||
|
"city": "não disponível",
|
||||||
|
"region": "não disponível",
|
||||||
|
"country": "não disponível",
|
||||||
|
"timezone": "não disponível"
|
||||||
|
},
|
||||||
|
"timestamp": "2025-04-22T22:22:48.213Z",
|
||||||
|
"integrityHash": "b99c926d06a10f7b4c0c6955073b145f5ca6494f0e356d8264dfcdbff1bca1b5"
|
||||||
|
},
|
||||||
|
"processingInfo": {
|
||||||
|
"processingNode": "RODRIGO",
|
||||||
|
"processingUser": "rodri",
|
||||||
|
"processingTimestamp": "2025-04-22T22:22:50.477Z",
|
||||||
|
"systemInfo": {
|
||||||
|
"platform": "win32",
|
||||||
|
"release": "10.0.26100",
|
||||||
|
"cpus": 4,
|
||||||
|
"memory": "20GB",
|
||||||
|
"uptime": "11h"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 1.6 MiB |
BIN
Binary file not shown.
Reference in new issue
Block a user