diff --git a/frontend/src/certGenerator/certs/EXTINTORES.ts b/frontend/src/certGenerator/certs/EXTINTORES.ts new file mode 100644 index 0000000..60e2be9 --- /dev/null +++ b/frontend/src/certGenerator/certs/EXTINTORES.ts @@ -0,0 +1,279 @@ +import { cmText, createSimpleText, createSimpleTextP, getImage, getQR } from "./utils"; +import { CertData } from "./CertData"; + +const { + Document, Paragraph, PageOrientation, + FrameAnchorType, + TextRun, + AlignmentType, + BorderStyle, +} = window.docx; + + + +const imgFondoDoc = getImage({ + name: "fondo_certificado_manejo_defensivo.png", + height: 21.23, + width: 29.8, + horizontalOffset: 0, + verticalOffset: -0.05, + behindDocument: true, +}); + +const imgCIP = getImage({ + name: "colegio_ingenieros_logo.png", + height: 2.15, + width: 2.15, + horizontalOffset: 26.52, + verticalOffset: 15.24, +}); + +const imgMTC = getImage({ + name: "mtc_2_logo.png", + height: 0.94, + width: 5.14, + horizontalOffset: 1, + verticalOffset: 19.21, +}); + + +// MTC: R.D.N° ... +const tMTCLabel = createSimpleText({ + xPosition: -1.51, + yPosition: 18, + width: 6, + height: 0.75, + text: "R.D.N° 092-2021-MTC/17.03", + size: 24, + font: "Calibri", + alignment: AlignmentType.LEFT, + color: "FFFFFF", + bold: true, +}); + +// CERTIFICADO +const tCertificate = createSimpleTextP({ + xPosition: 0.17, + yPosition: 5.9, + width: 11.05, + height: 1.72, + text: "CERTIFICADO", + size: 72, + font: "Times New Roman", + bold: true, +}); + +// Otorgado a +const tExpediteText = createSimpleText({ + xPosition: -1.08, + yPosition: 5.4, + width: 3, + height: 0.7, + text: "Otorgado a:", + size: 22, +}); + +// IPERC +const tCourse = createSimpleText({ + xPosition: -0.44, + yPosition: 8, + width: 20.92, + height: 1.5, + text: "USO Y MANEJO DE EXTINTORES ", + size: 44, + bold: true, +}); + +// En temas de... +const tTopics = createSimpleTextP({ + xPosition: 2, + yPosition: 11.5, + width: 20.92, + height: 1.5, + text: "En temas de: Concepto Básico, Combustión, Distintas Clases de Combustión, Clases de Fuego, Propagación de Calor, Formas de Transmisión, Uso de extintores, Amago de Incendios, equivalente a 12 horas lectivas.", + size: 22, + font: "Times New Roman", + alignment: AlignmentType.CENTER, +}); + +// Se expide certificado... +const tFinishLabel = createSimpleTextP({ + xPosition: 1.9, + yPosition: 12.6, + width: 20.92, + height: 0.75, + text: "Se expide el presente certificado para los fines que se estime conveniente", + size: 22, + font: "Times New Roman", + alignment: AlignmentType.CENTER, +}); + +// Recuadro de foto +const photoSection = new Paragraph({ + frame: { + position: { + x: cmText(23.35), + y: cmText(8.3), + }, + width: cmText(2.81), + height: cmText(3.57), + anchor: { + horizontal: FrameAnchorType.MARGIN, + vertical: FrameAnchorType.MARGIN, + }, + }, + children: [], + border: { + top: { + style: BorderStyle.DASHED, + }, + bottom: { + style: BorderStyle.DASHED, + }, + left: { + style: BorderStyle.DASHED, + }, + right: { + style: BorderStyle.DASHED, + }, + }, + alignment: AlignmentType.LEFT, +}); + +export async function extintores(props: CertData): Promise { + const imgQR = await getQR({ + iid: props.certIId, + dni: props.personDni, + height: 1.95, + width: 1.95, + horizontalOffset: 26.9, + verticalOffset: 17.65, + }); + + // FERNANDO ARAOZ + const tName = createSimpleText({ + xPosition: -2.5, + yPosition: 6, + width: 23.13, + height: 1.5, + text: props.personFullName, + size: 52, + bold: true, + underline: {}, + }); + + // Identificado con DNI... + const tContentPart1 = new Paragraph({ + frame: { + position: { + x: cmText(-0.4), + y: cmText(7.3), + }, + width: cmText(20.92), + height: cmText(1), + anchor: { + horizontal: FrameAnchorType.MARGIN, + vertical: FrameAnchorType.MARGIN, + }, + }, + children: [ + new TextRun({ + text: "Identificado con DNI N° ", + font: "Times New Roman", + size: 22, + }), + new TextRun({ + text: props.personDni, + font: "Times New Roman", + size: 24, + bold: true, + }), + new TextRun({ + text: ", al haber aprobado el curso de capacitación sobre:", + font: "Times New Roman", + size: 22, + }), + ], + alignment: AlignmentType.LEFT, + }); + + // Fecha de Emision: ... + const certificateDate = new Paragraph({ + frame: { + position: { + x: cmText(19.25), + y: cmText(15.5), + }, + width: cmText(9), + height: cmText(1.4), + anchor: { + horizontal: FrameAnchorType.MARGIN, + vertical: FrameAnchorType.MARGIN, + }, + }, + children: [ + new TextRun({ + text: `Fecha de Emisión: ${props.certDay} / ${props.certMonth} / ${props.certYear}`, + font: "Times New Roman", + size: 20, + }), + new TextRun({ + text: `Fecha de Expiración: ${props.certDay} / ${props.certMonth} / ${parseInt(props.certYear, 10) + 1}`, + font: "Times New Roman", + size: 20, + break: 1, + }), + ], + alignment: AlignmentType.LEFT, + }); + + // N° XXXX-20XX-EEG + const tCertCode = createSimpleText({ + xPosition: 23, + yPosition: 12, + width: 3.67, + height: 0.8, + text: `N° ${props.certCode}-${props.certYear}-EEG`, + size: 20, + alignment: AlignmentType.CENTER, + }); + + const doc = new Document({ + sections: [ + { + properties: { + page: { + size: { + orientation: PageOrientation.LANDSCAPE, + }, + }, + }, + children: [ + tCertificate, + tExpediteText, + tName, + tContentPart1, + tCourse, + tTopics, + tFinishLabel, + certificateDate, + photoSection, + tCertCode, + tMTCLabel, + new Paragraph({ + children: [ + imgFondoDoc, + imgQR, + imgCIP, + imgMTC, + ], + }), + ], + }, + ], + }); + + // Return document as a buffer + return doc; +} + diff --git a/frontend/src/certGenerator/certs/LUCHA_CONTRA_INCENDIOS.ts b/frontend/src/certGenerator/certs/LUCHA_CONTRA_INCENDIOS.ts index fff6ae6..78edbcc 100644 --- a/frontend/src/certGenerator/certs/LUCHA_CONTRA_INCENDIOS.ts +++ b/frontend/src/certGenerator/certs/LUCHA_CONTRA_INCENDIOS.ts @@ -59,7 +59,7 @@ const tCourse = createSimpleText({ yPosition: 8, width: 20.92, height: 1.5, - text: "LUCHA CONTRA INCENDIOS", + text: "USO Y MANEJO DE EXTINTORES ", size: 44, bold: true, }); @@ -70,7 +70,7 @@ const tTopics = createSimpleTextP({ yPosition: 11.5, width: 20.92, height: 1.5, - text: "En temas de: Concepto Básico, Combustión, Distintas Clases de Combustión, Clases de Fuego, Propagación de Calor, Formas de Transmisión, Uso de extintores, Amago de Incendios, equivalente a 24 horas lectivas.", + text: "En temas de: Concepto Básico, Combustión, Distintas Clases de Combustión, Clases de Fuego, Propagación de Calor, Formas de Transmisión, Uso de extintores, Amago de Incendios, equivalente a 12 horas lectivas.", size: 22, font: "Times New Roman", alignment: AlignmentType.CENTER, diff --git a/frontend/src/certGenerator/index.ts b/frontend/src/certGenerator/index.ts index 5085bfb..f10af45 100644 --- a/frontend/src/certGenerator/index.ts +++ b/frontend/src/certGenerator/index.ts @@ -17,6 +17,7 @@ import { primerosAuxiliosCert } from "./certs/PRIMEROS_AUXILIOS"; import { luchaContraIncendiosCert } from "./certs/LUCHA_CONTRA_INCENDIOS"; import { minicargador } from "./certs/MINICARGADOR"; import { tractorOruga } from "./certs/TRACTOR_ORUGA"; +import { extintores } from "./certs/EXTINTORES"; declare global { interface Window { @@ -87,6 +88,7 @@ export const certGenerator: CertGenObj = Object.freeze({ "Tractor Oruga": certGeneratorGenerator(tractorOruga), "Primeros Auxilios": certGeneratorGenerator(primerosAuxiliosCert), "Lucha contra Incendios": certGeneratorGenerator(luchaContraIncendiosCert), + "Uso y Manejo de Extintores": certGeneratorGenerator(extintores), });