Browse Source

modulo completado

FREDY 3 months ago
parent
commit
4ea3a6bac0

+ 12 - 1
Back/backendP-Educativa/app/Http/Controllers/FormController.php

@@ -83,9 +83,10 @@ public function getAll(): JsonResponse
         ], 500);
     }
 }
+
+
 public function getFormById($id): JsonResponse
 {
-    // Buscar el formulario por ID con Query Builder
     $form = DB::table('forms')->where('id', $id)->first();
 
     if (!$form) {
@@ -109,6 +110,9 @@ public function getFormById($id): JsonResponse
     ]);
 
 }
+
+
+
 public function update(Request $request, $id): JsonResponse
 {
     try {
@@ -162,6 +166,9 @@ public function update(Request $request, $id): JsonResponse
 }
 
 
+
+
+
 public function destroy($id)
 {
     try {
@@ -195,6 +202,8 @@ public function destroy($id)
     }
 }
 
+
+
     public function publish($id)
 {
     try {
@@ -232,6 +241,8 @@ public function destroy($id)
     }
 }
 
+
+
 public function unpublish($id)
 {
     try {

+ 4 - 0
Back/backendP-Educativa/app/Http/Controllers/RespuestasController.php

@@ -68,6 +68,8 @@ public function tieneRespuesta(Request $request)
     ]);
 }
 
+
+
  public function generarPDF($id_usuario, $form_id)
 {
     try {
@@ -115,6 +117,8 @@ public function tieneRespuesta(Request $request)
 }
 
 
+
+
 public function obtenerRespuesta(Request $request)
 {
     $request->validate([

+ 26 - 17
Front/src/app/modules/Administrador/pages/personalizar/personalizar.component.html

@@ -56,6 +56,7 @@
 
      <div class="fila-form mt-20">
   <div class="text">Logotipo del colegio</div>
+
   <div class="fila-form mb-20">
     <div class="flex-col">
       <!-- Botón según condición -->
@@ -77,10 +78,10 @@
       </div>
 
       <!-- Errores -->
-      <div class="flex-col mt-5">
-        <span class="mr-10 text-error">{{errorPx}}</span>
-        <span class="mr-10 text-error">{{errorSize}}</span>
-        <span class="mr-10 text-error">{{errorType}}</span>
+      <div class="flex-col mt-5" style="color: red;">
+        <span  *ngIf="errorType" class="mr-10 text-error">{{errorType}}</span>
+        <span *ngIf="errorSize" class="mr-10 text-error">{{errorSize}}</span>
+        <span *ngIf="errorDimension" class="error">{{ errorDimension }}</span>
       </div>
     </div>
 
@@ -225,7 +226,15 @@
 </mat-tab>
 <mat-tab label="Documentación">
   <form class="form-personalizar" *ngIf="!isLoading;" (ngSubmit)="personalizar()" [formGroup]="form">
-    <p style="font-size: 30px; color: #888;">Personalizar documentación    <mat-icon style="color: #f19696; margin-left: 5px;">help</mat-icon> </p>
+<div style="justify-content: center; text-align: center;">
+  <p style="font-size: 30px; color: #888;">
+    Personalizar documentación
+    <mat-icon
+      style="color: #f19696; width: 24px; height: 24px; cursor: pointer; margin-bottom: 10px;"
+      (click)="abrirImagenModal()">help</mat-icon>
+  </p>
+</div>
+
 <div class="fila-form">
       <div class="text">Mensaje de Bienvenida: </div>
       <div class="">
@@ -269,7 +278,7 @@
     </div>
 
     <div class="fila-form mt-20">
-  <div class="text">Logo PDF <p style="color: #888;">(derecho):</p> </div>
+  <div class="text">Logotipo 1:</div>
   <div class="fila-form mb-20">
     <div class="flex-col">
       <!-- Botón según condición -->
@@ -291,10 +300,10 @@
       </div>
 
       <!-- Errores -->
-      <div class="flex-col mt-5">
-        <span class="mr-10 text-error">{{errorPx}}</span>
-        <span class="mr-10 text-error">{{errorSize}}</span>
-        <span class="mr-10 text-error">{{errorType}}</span>
+      <div class="flex-col mt-5" style="color: red;">
+        <span  *ngIf="errorType" class="mr-10 text-error">{{errorType}}</span>
+        <span *ngIf="errorSize" class="mr-10 text-error">{{errorSize}}</span>
+        <span *ngIf="errorDimension" class="error">{{ errorDimension }}</span>
       </div>
     </div>
 
@@ -307,7 +316,7 @@
 
   <!-- Logo izquierdo -->
 <div class="fila-form mt-20">
-  <div class="text">Logo PDF <p style="color: #888;">(izquierdo):</p></div>
+  <div class="text">Logotipo 2:</div>
   <div class="fila-form mb-20">
     <div class="flex-col">
       <!-- Botón según condición -->
@@ -317,6 +326,7 @@
           <mat-icon>upload</mat-icon>
         </label>
 
+
         <label class="custom-file-change" *ngIf="!imagenGuardada1 && url1">
           <input type="file" accept="image/*" (change)="onFileChange($event, 'imagen1')">Cambiar Archivo
           <mat-icon>upload</mat-icon>
@@ -328,13 +338,12 @@
 </button>
 
       </div>
-
-      <!-- Errores -->
-      <div class="flex-col mt-5">
-        <span class="mr-10 text-error">{{errorPx}}</span>
-        <span class="mr-10 text-error">{{errorSize}}</span>
-        <span class="mr-10 text-error">{{errorType}}</span>
+           <div class="flex-col mt-5" style="color: red;">
+        <span  *ngIf="errorType" class="mr-10 text-error">{{errorType}}</span>
+        <span *ngIf="errorSize" class="mr-10 text-error">{{errorSize}}</span>
+        <span *ngIf="errorDimension" class="error">{{ errorDimension }}</span>
       </div>
+
     </div>
 
     <!-- Preview -->

+ 24 - 2
Front/src/app/modules/Administrador/pages/personalizar/personalizar.component.ts

@@ -14,7 +14,7 @@ export class PersonalizarComponent implements OnInit {
 public imagenNueva: boolean = false;
 public imagenNueva1: boolean = false;
 public imagenNueva2: boolean = false;
-
+  public mostrarAyuda = false;
   public url: string = '';
   public msg = "";
   public data!: Personalizar;
@@ -27,6 +27,7 @@ public imagenGuardada1: string = '';
 public imagenGuardada2: string = '';
 public url1: string = '';
 public url2: string = '';
+errorDimension: string | null = null;
 
   public color4: string = '';
   public color5: string = '';
@@ -116,6 +117,17 @@ public url2: string = '';
 
   constructor(private _personalizarService: PersonalizarService, private _enviarInfo: EnviarInfoService) {
   }
+   abrirImagenModal() {
+    Swal.fire({
+      title: 'Imagen de ayuda',
+      imageUrl: 'assets/img/Bases.jpg',
+      imageAlt: 'Imagen de ayuda',
+      imageWidth: 600,
+      confirmButtonText: 'Cerrar',
+       confirmButtonColor: '#4074b0'
+
+    });
+  }
 
 ngOnInit(): void {
   this._enviarInfo.currentColor.subscribe(color => {
@@ -237,7 +249,7 @@ console.log('Ruta relativa enviada al backend:', rutaRelativa);
 
 
   // preview de la imagen en input type file y convertirla a base64
-onFileChange(event: any, field: 'imagen'|'imagen1' | 'imagen2') {
+onFileChange(event: any, field: 'imagen' | 'imagen1' | 'imagen2') {
   const file = event.target.files[0];
   if (!file) return;
 
@@ -262,7 +274,16 @@ onFileChange(event: any, field: 'imagen'|'imagen1' | 'imagen2') {
     if (typeof result === 'string') {
       const img = new Image();
       img.onload = () => {
+        const maxWidth = 216;
+        const maxHeight = 70;
+
+        if (img.width > maxWidth || img.height > maxHeight) {
+          this.errorDimension = `Máximo ${maxWidth}px de ancho y ${maxHeight}px de alto. Imagen seleccionada: ${img.width}x${img.height}px.`;
+          return;
+        }
+
         this.form.get(field)?.setValue(result);
+
         if (field === 'imagen') {
           this.url = result;
           this.imagenNueva = true;
@@ -284,6 +305,7 @@ clearErrors() {
   this.errorType = '';
   this.errorSize = '';
   this.errorPx = '';
+  this.errorDimension='';
 }
 
 

+ 139 - 5
Front/src/app/modules/Padres/pages/registroAlumno/registroAlumno.component.ts

@@ -422,7 +422,33 @@ const logoHeight = 30;
 
     // Añadir nueva página para firmas y leyendas
     doc.addPage();
-    doc.addImage("assets/img/Encabezado-PDF.jpg", "JPEG", 6, 10, pageWidth - 8, 27);
+    if (imgLeft) {
+    doc.addImage(imgLeft, 'PNG', 15, 10, 30, 30);
+  }
+  if (imgRight) {
+    doc.addImage(imgRight, 'PNG', pageWidth - 45, 10, 30, 30);
+  }
+
+
+
+// 1. Título (Nombre del colegio)
+doc.setFontSize(14);
+doc.setFont('helvetica', 'bold');
+doc.text(this.nombreColegio, pageWidth / 2, 20, { align: 'center' });
+
+// 2. Línea horizontal
+doc.setLineWidth(0.5);
+doc.line(10, 24, pageWidth - 10, 24);
+
+// 3. Eslogan
+doc.setFontSize(12);
+doc.setFont('helvetica', 'italic');
+doc.text(this.eslogan, pageWidth / 2, 30, { align: 'center' });
+
+// 4. Mensaje de bienvenida
+doc.setFontSize(12);
+doc.setFont('helvetica', 'normal');
+doc.text(this.mensajeBienvenida, pageWidth / 2, 38, { align: 'center' });
 
     // Posiciones iniciales para la nueva página
     const startY = 50;
@@ -462,7 +488,34 @@ const logoHeight = 30;
       // -----------------------------------------------------------------------------------------------------------------------------------------------------------
       //segunda página
       doc.addPage();
-      doc.addImage("assets/img/Encabezado-PDF.jpg", "JPEG", 6, 10, pageWidth - 8, 27);
+        if (imgLeft) {
+    doc.addImage(imgLeft, 'PNG', 15, 10, 30, 30);
+  }
+  if (imgRight) {
+    doc.addImage(imgRight, 'PNG', pageWidth - 45, 10, 30, 30);
+  }
+
+
+
+// 1. Título (Nombre del colegio)
+doc.setFontSize(14);
+doc.setFont('helvetica', 'bold');
+doc.text(this.nombreColegio, pageWidth / 2, 20, { align: 'center' });
+
+// 2. Línea horizontal
+doc.setLineWidth(0.5);
+doc.line(10, 24, pageWidth - 10, 24);
+
+// 3. Eslogan
+doc.setFontSize(12);
+doc.setFont('helvetica', 'italic');
+doc.text(this.eslogan, pageWidth / 2, 30, { align: 'center' });
+
+// 4. Mensaje de bienvenida
+doc.setFontSize(12);
+doc.setFont('helvetica', 'normal');
+doc.text(this.mensajeBienvenida, pageWidth / 2, 38, { align: 'center' });
+
       //TITULO NORMAL BOLD
       doc.setFont("helvetica", "bold");
       doc.setFontSize(10);
@@ -599,7 +652,34 @@ const logoHeight = 30;
       // -----------------------------------------------------------------------------------------------------------------------------------------------------------
       //tercera página
       doc.addPage();
-      doc.addImage("assets/img/Encabezado-PDF.jpg", "JPEG", 6, 10, pageWidth - 8, 27);
+        if (imgLeft) {
+    doc.addImage(imgLeft, 'PNG', 15, 10, 30, 30);
+  }
+  if (imgRight) {
+    doc.addImage(imgRight, 'PNG', pageWidth - 45, 10, 30, 30);
+  }
+
+
+
+// 1. Título (Nombre del colegio)
+doc.setFontSize(14);
+doc.setFont('helvetica', 'bold');
+doc.text(this.nombreColegio, pageWidth / 2, 20, { align: 'center' });
+
+// 2. Línea horizontal
+doc.setLineWidth(0.5);
+doc.line(10, 24, pageWidth - 10, 24);
+
+// 3. Eslogan
+doc.setFontSize(12);
+doc.setFont('helvetica', 'italic');
+doc.text(this.eslogan, pageWidth / 2, 30, { align: 'center' });
+
+// 4. Mensaje de bienvenida
+doc.setFontSize(12);
+doc.setFont('helvetica', 'normal');
+doc.text(this.mensajeBienvenida, pageWidth / 2, 38, { align: 'center' });
+
       //TITULO NORMAL BOLD
       doc.setFont("helvetica", "bold");
       doc.setFontSize(10);
@@ -657,7 +737,34 @@ const logoHeight = 30;
       // -----------------------------------------------------------------------------------------------------------------------------------------------------------
       //cuarta página
       doc.addPage();
-      doc.addImage("assets/img/Encabezado-PDF.jpg", "JPEG", 6, 10, pageWidth - 8, 27);
+      if (imgLeft) {
+    doc.addImage(imgLeft, 'PNG', 15, 10, 30, 30);
+  }
+  if (imgRight) {
+    doc.addImage(imgRight, 'PNG', pageWidth - 45, 10, 30, 30);
+  }
+
+
+
+// 1. Título (Nombre del colegio)
+doc.setFontSize(14);
+doc.setFont('helvetica', 'bold');
+doc.text(this.nombreColegio, pageWidth / 2, 20, { align: 'center' });
+
+// 2. Línea horizontal
+doc.setLineWidth(0.5);
+doc.line(10, 24, pageWidth - 10, 24);
+
+// 3. Eslogan
+doc.setFontSize(12);
+doc.setFont('helvetica', 'italic');
+doc.text(this.eslogan, pageWidth / 2, 30, { align: 'center' });
+
+// 4. Mensaje de bienvenida
+doc.setFontSize(12);
+doc.setFont('helvetica', 'normal');
+doc.text(this.mensajeBienvenida, pageWidth / 2, 38, { align: 'center' });
+
       //TITULO NORMAL BOLD
       doc.setFont("helvetica", "bold");
       doc.setFontSize(10);
@@ -740,7 +847,34 @@ const logoHeight = 30;
       // -----------------------------------------------------------------------------------------------------------------------------------------------------------
       //quinta página
       doc.addPage();
-      doc.addImage("assets/img/Encabezado-PDF.jpg", "JPEG", 6, 10, pageWidth - 8, 27);
+  if (imgLeft) {
+    doc.addImage(imgLeft, 'PNG', 15, 10, 30, 30);
+  }
+  if (imgRight) {
+    doc.addImage(imgRight, 'PNG', pageWidth - 45, 10, 30, 30);
+  }
+
+
+
+// 1. Título (Nombre del colegio)
+doc.setFontSize(14);
+doc.setFont('helvetica', 'bold');
+doc.text(this.nombreColegio, pageWidth / 2, 20, { align: 'center' });
+
+// 2. Línea horizontal
+doc.setLineWidth(0.5);
+doc.line(10, 24, pageWidth - 10, 24);
+
+// 3. Eslogan
+doc.setFontSize(12);
+doc.setFont('helvetica', 'italic');
+doc.text(this.eslogan, pageWidth / 2, 30, { align: 'center' });
+
+// 4. Mensaje de bienvenida
+doc.setFontSize(12);
+doc.setFont('helvetica', 'normal');
+doc.text(this.mensajeBienvenida, pageWidth / 2, 38, { align: 'center' });
+
       doc.setFont("helvetica", "bold");
       doc.setFontSize(10);
       doc.text(`AVISO DE PRIVACIDAD SIMPLIFICADO`, pageWidth / 2, 43, { align: 'center' });

BIN
Front/src/assets/img/Bases.jpg