Prechádzať zdrojové kódy

feat: add BitacoraAlumComponent and integrate it into BitagoraComponent

EmilianoChavarria 1 mesiac pred
rodič
commit
b1a70875e4

+ 2 - 1
Front/src/app/modules/Alumno/alumno.module.ts

@@ -5,7 +5,7 @@ import { SharedModule } from '../../shared/shared.module';
 import { MaterialModule } from '../../material/material.module';
 import { AlumnoRoutingModule } from './alumno-routing.module';
 import { MainComponent } from './pages/main/main.component';
-import { BitagoraComponent } from './bitagora/bitagora.component';
+import { BitacoraAlumComponent, BitagoraComponent } from './bitagora/bitagora.component';
 import { FullCalendarModule } from '@fullcalendar/angular';
 import { CalendarComponent } from './calendar/calendar.component';
 import { TareasComponent } from './pages/tareas/tareas.component';
@@ -17,6 +17,7 @@ import { TareasComponent } from './pages/tareas/tareas.component';
     LayoutPageComponent,
     MainComponent,
     BitagoraComponent,
+    BitacoraAlumComponent,
     CalendarComponent,
     TareasComponent
   ],

+ 31 - 15
Front/src/app/modules/Alumno/bitagora/bitagora.component.ts

@@ -16,10 +16,10 @@ export class BitagoraComponent {
   private userData = JSON.parse(localStorage.getItem('userDataS') ? localStorage.getItem('userDataS') || '' : localStorage.getItem('userData') || '');
   public isLoading: boolean = true;
 
-public color: string = '#e89a20';
-public textColor: string = '#ffffff';
-public filtro: string = 'Activos';
-public inputValue: string = '';
+  public color: string = '#e89a20';
+  public textColor: string = '#ffffff';
+  public filtro: string = 'Activos';
+  public inputValue: string = '';
 
   public mensajeBienvenida: string = '';
   public currentDate = new Date();
@@ -70,10 +70,10 @@ public inputValue: string = '';
   obtenerBitacoras() {
     return this.bitacoraService.getByUser(this.userData[0]).subscribe((response: any) => {
       this.isLoading = false;
-      this.dataSourceBitacoras = new MatTableDataSource<any>(response.filter((filtro:any)=> filtro.estado=== 'Activo'));
-      this.dataSourceBitacoras.paginator= this.paginatorBit;
+      this.dataSourceBitacoras = new MatTableDataSource<any>(response.filter((filtro: any) => filtro.estado === 'Activo'));
+      this.dataSourceBitacoras.paginator = this.paginatorBit;
 
-  response.forEach((item: any) => {
+      response.forEach((item: any) => {
         if (typeof item.jsonAdjuntos === 'string') {
           item.jsonAdjuntos = JSON.parse(item.jsonAdjuntos);
         }
@@ -88,6 +88,7 @@ public inputValue: string = '';
 
 
   openDialog(bitacora: any) {
+    console.log(bitacora);
     this.dialog.open(BitacoraAlumComponent, {
       data: {
         materia: bitacora.idMateriaBitacora,
@@ -105,17 +106,32 @@ public inputValue: string = '';
     }
   }
   applyFilter(event: Event) {
-  const filterValue = (event.target as HTMLInputElement).value.trim().toLowerCase();
-  this.dataSourceBitacoras.filter = filterValue;
-}
+    const filterValue = (event.target as HTMLInputElement).value.trim().toLowerCase();
+    this.dataSourceBitacoras.filter = filterValue;
+  }
 
-// Método para filtrar por estado
-option(value: string) {
-  this.filtro = value;
-  this.obtenerBitacoras();
-}
+  // Método para filtrar por estado
+  option(value: string) {
+    this.filtro = value;
+    this.obtenerBitacoras();
+  }
 }
 
+@Component({
+  selector: 'app-bitacora-alum',
+  template: `
+    <h2 mat-dialog-title>Detalles de Bitácora</h2>
+    <mat-dialog-content>
+      <p><strong>Materia:</strong> {{ data.materia }}</p>
+      <p><strong>Tipo:</strong> {{ data.tipo }}</p>
+      <p><strong>Fecha:</strong> {{ data.fecha }}</p>
+      <div [innerHTML]="data.descripcion"></div>
+    </mat-dialog-content>
+    <mat-dialog-actions align="end">
+      <button mat-button mat-dialog-close>Cerrar</button>
+    </mat-dialog-actions>
+  `
+})
 export class BitacoraAlumComponent {
   constructor(@Inject(MAT_DIALOG_DATA) public data: any) { }
 }