softdinlibreriajs 12.0.34 → 12.0.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "softdinlibreriajs",
3
- "version": "12.0.34",
3
+ "version": "12.0.36",
4
4
  "description": "Libreria Softdin",
5
5
  "main": "src/",
6
6
  "scripts": {
@@ -0,0 +1,49 @@
1
+ class EnumNivelRiesgo {
2
+ static RIESGO_I = 1;
3
+ static RIESGO_II = 2;
4
+ static RIESGO_III = 3;
5
+ static RIESGO_IV = 4;
6
+ static RIESGO_V = 5;
7
+
8
+ static descriptions = [
9
+ {
10
+ id: EnumNivelRiesgo.RIESGO_I,
11
+ code: 0.522,
12
+ description: "Riesgo I",
13
+ },
14
+ {
15
+ id: EnumNivelRiesgo.RIESGO_II,
16
+ code: 1.044,
17
+ description: "Riesgo II",
18
+ },
19
+ {
20
+ id: EnumNivelRiesgo.RIESGO_III,
21
+ code: 2.436,
22
+ description: "Riesgo III",
23
+ },
24
+ {
25
+ id: EnumNivelRiesgo.RIESGO_IV,
26
+ code: 4.35,
27
+ description: "Riesgo IV",
28
+ },
29
+ { id: EnumNivelRiesgo.RIESGO_V, code: 6.960, description: "Riesgo V" },
30
+ ];
31
+
32
+ static getById(id) {
33
+ return EnumNivelRiesgo.descriptions.find((item) => item.id === id) || null;
34
+ }
35
+
36
+ static getAll() {
37
+ return EnumNivelRiesgo.descriptions;
38
+ }
39
+
40
+ static getByDescription(description) {
41
+ return (
42
+ EnumNivelRiesgo.descriptions.find(
43
+ (item) => item.description === description
44
+ ) || null
45
+ );
46
+ }
47
+ }
48
+
49
+ module.exports = EnumNivelRiesgo;
package/src/EnumSexo.js CHANGED
@@ -1,10 +1,14 @@
1
1
  class EnumSexo {
2
2
  static M = 1;
3
3
  static F = 2;
4
+ static ND = 3;
5
+ static NDR = 4;
4
6
 
5
7
  static descriptions = [
6
8
  { id: EnumSexo.M, code: 'M', description: 'Masculino' },
7
9
  { id: EnumSexo.F, code: 'F', description: 'Femenino' },
10
+ { id: EnumSexo.ND, code: 'ND', description: 'No definido' },
11
+ { id: EnumSexo.NDR, code: 'NDR', description: 'No deseo responder' }
8
12
  ];
9
13
 
10
14
  static getById(id) {
package/src/GenerarPDF.js DELETED
@@ -1,93 +0,0 @@
1
- import { jsPDF } from "jspdf";
2
-
3
- // Función para generar el PDF
4
- export const generarCertificadoLaboral = (form, logoBase64) => {
5
- console.log("Generando certificado laboral...");
6
- // Validaciones de entrada
7
- if (
8
- !form ||
9
- !form.report_header ||
10
- !form.description ||
11
- !form.signature ||
12
- !form.report_footer
13
- ) {
14
- console.error("Faltan datos en el formulario.");
15
- return;
16
- }
17
-
18
- const doc = new jsPDF({
19
- orientation: "portrait", // Orientación vertical
20
- unit: "mm", // Unidades en milímetros
21
- format: "letter", // Tamaño carta
22
- putOnlyUsedFonts: true,
23
- precision: 16, // Precisión flotante
24
- });
25
-
26
- // Encabezado: agregar logo si está habilitado
27
- const imgData = logoBase64.value;
28
- if (form.show_logo && imgData) {
29
- doc.addImage(imgData, "JPEG", 15, 10, 30, 30); // (imagen, tipo, x, y, ancho, alto)
30
- }
31
-
32
- // Agregar encabezado del reporte
33
- doc.setFontSize(16);
34
- const maxWidthHeader = form.show_logo ? 150 : 200;
35
- const linesHeader = doc.splitTextToSize(form.report_header, maxWidthHeader);
36
- let yPosition = 20; // Posición Y inicial
37
- linesHeader.forEach((line) => {
38
- doc.text(line, form.show_logo ? 120 : 100, yPosition, { align: "center" });
39
- yPosition += 8;
40
- });
41
-
42
- yPosition += 20; // Incrementar posición Y para el siguiente bloque
43
-
44
- // Información del certificado
45
- doc.setFontSize(20);
46
- doc.setFont("helvetica", "bold");
47
- const certText = "CERTIFICA";
48
- const certTextWidth = doc.getTextWidth(certText);
49
- const certX = (doc.getPageWidth() - certTextWidth) / 2; // Centrar el texto
50
- doc.text(certText, certX, yPosition);
51
-
52
- // Descripción del certificado
53
- doc.setFontSize(12);
54
- doc.setFont("helvetica", "normal");
55
- const linesDescription = doc.splitTextToSize(form.description, 180);
56
- yPosition += 20;
57
- linesDescription.forEach((line) => {
58
- doc.text(line, 20, yPosition);
59
- yPosition += 10;
60
- });
61
-
62
- // Firma
63
- const firmaLinea = "__________________________________";
64
- const firmaTextWidth = doc.getTextWidth(firmaLinea);
65
- const firmaX = (doc.getPageWidth() - firmaTextWidth) / 2;
66
- doc.text(firmaLinea, firmaX, 230);
67
-
68
- doc.setFont("helvetica", "bold");
69
- const linesSignature = doc.splitTextToSize(form.signature, 180);
70
- yPosition = 235;
71
- linesSignature.forEach((line) => {
72
- const textWidth = doc.getTextWidth(line);
73
- const textX = (doc.getPageWidth() - textWidth) / 2;
74
- doc.text(line, textX, yPosition);
75
- yPosition += 4;
76
- });
77
-
78
- // Pie de informe
79
- doc.setFont("helvetica", "normal");
80
- doc.setFontSize(8);
81
- const linesFooter = doc.splitTextToSize(form.report_footer, 180);
82
- yPosition = 255;
83
- linesFooter.forEach((line) => {
84
- const textWidth = doc.getTextWidth(line);
85
- const textX = (doc.getPageWidth() - textWidth) / 2;
86
- doc.text(line, textX, yPosition);
87
- yPosition += 4;
88
- });
89
-
90
- // Generar salida como URL blob
91
- const pdfOutput = doc.output("bloburl");
92
- return pdfOutput; // Devolver la URL del PDF generado
93
- };