diff --git a/frontend/src/certGenerator/certs/CARGADOR_FRONTAL.ts b/frontend/src/certGenerator/certs/CARGADOR_FRONTAL.ts index 9829873..256721e 100644 --- a/frontend/src/certGenerator/certs/CARGADOR_FRONTAL.ts +++ b/frontend/src/certGenerator/certs/CARGADOR_FRONTAL.ts @@ -138,7 +138,7 @@ export async function cargadorFrontal(props: CertData): Promise const tContentPart1 = new Paragraph({ frame: { position: { - x: cmText(2.5), + x: cmText(2.3), y: cmText(7.6), }, width: cmText(20.92), diff --git a/frontend/src/certGenerator/certs/EXCAVADORA_HIDRAULICA.ts b/frontend/src/certGenerator/certs/EXCAVADORA_HIDRAULICA.ts index cb4c4f0..5bfa21a 100644 --- a/frontend/src/certGenerator/certs/EXCAVADORA_HIDRAULICA.ts +++ b/frontend/src/certGenerator/certs/EXCAVADORA_HIDRAULICA.ts @@ -160,7 +160,7 @@ export async function excavadoraHidraulica(props: CertData): Promise): Promise { + const hasCustomLabel = (props.certCustomLabel?.length ?? 0) > 0; + const customLabelYOffset = 0.8; + + // OPERADOR PROFESIONAL DE RETROEXCAVADORA + const tCourse = createSimpleText({ + xPosition: 2.2, + yPosition: 8.4, + width: 20, + height: 1.5, + text: `OPERADOR PROFESIONAL DE RETROEXCAVADORA ${props.certCustomLabel}`, + size: 40, + bold: true, + }); + + const imgQR = await getQR({ + iid: props.certIId, + dni: props.personDni, + height: 2.04, + width: 2.04, + horizontalOffset: 26.85, + verticalOffset: 14.71, + }); + + // FERNANDO ARAOZ + const tName = createSimpleText({ + xPosition: 1, + yPosition: 6.2, + 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(2.3), + y: cmText(7.6), + }, + 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, + }); + + /* + * These fields may have an offset based on whether the certificate has a custom label or not + */ + // En temas de... + const tTopics = createSimpleText({ + xPosition: 2.3, + // If this cert has a custom label, 0.9cm is added to the Y position + yPosition: 9.5 + (hasCustomLabel ? customLabelYOffset : 0), + width: 20.92, + height: 1.5, + text: "En temas de: Manejo defensivo, Seguridad vial, llenado de herramientas de gestión de seguridad, Peligros y Riesgos en la operación, Excavación y Relleno de zanjas, Nivelación de Talud con cuchara de retroexcavadora, Batido de carga, Nivelación de piso, Carguío a Volquetes; equivalente a 60 horas lectivas.", + size: 22, + font: "Times New Roman", + alignment: AlignmentType.LEFT, + }); + + // Se expide certificado... + const tFinishLabel = createSimpleText({ + xPosition: 5.95, + // If this cert has a custom label, 0.9cm is added to the Y position + yPosition: 11.2 + (hasCustomLabel ? customLabelYOffset : 0), + width: 12.38, + 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, + }); + + // Fecha de Emision: ... + const certificateDate = new Paragraph({ + frame: { + position: { + x: cmText(13), + y: cmText(17.3), + }, + width: cmText(7.5), + height: cmText(0.5), + anchor: { + horizontal: FrameAnchorType.MARGIN, + vertical: FrameAnchorType.MARGIN, + }, + }, + children: [ + new TextRun({ + text: `Fecha de Emisión:\t${props.certDay} / ${props.certMonth} / ${props.certYear}`, + font: "Times New Roman", + size: 20, + }), + ], + alignment: AlignmentType.LEFT, + }); + + // N° XXXX-20XX-EEG + const tCertCode = createSimpleText({ + xPosition: -2.15, + yPosition: 12.45, + 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, + new Paragraph({ + children: [ + imgFondoDoc, + imgQR, + imgCIP, + imgCEE, + imgMTC, + ], + }), + ], + }, + ], + }); + + // Return document as a buffer + return doc; +} diff --git a/frontend/src/certGenerator/index.ts b/frontend/src/certGenerator/index.ts index cccb850..4c4adfc 100644 --- a/frontend/src/certGenerator/index.ts +++ b/frontend/src/certGenerator/index.ts @@ -11,6 +11,7 @@ import { supervisorEscolta } from "./certs/SUPERVISOR_ESCOLTA"; import { ipercCert } from "./certs/IPERC"; import { excavadoraHidraulica } from "./certs/EXCAVADORA_HIDRAULICA"; import { cargadorFrontal } from "./certs/CARGADOR_FRONTAL"; +import { retroexcavadora } from "./certs/RETROEXCAVADORA"; declare global { interface Window { @@ -75,6 +76,7 @@ export const certGenerator: CertGenObj = Object.freeze({ "IPERC": certGeneratorGenerator(ipercCert), "Excavadora": certGeneratorGenerator(excavadoraHidraulica), "Cargador Frontal": certGeneratorGenerator(cargadorFrontal), + "Retroexcavadora": certGeneratorGenerator(retroexcavadora), });