Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 25 additions & 4 deletions src/app/componentes/subir-archivo/subir-archivo.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ import { CommonModule } from '@angular/common'
import { DocumentosService } from '../../servicios/encargado/documentos.service';
import { MatSnackBar } from '@angular/material/snack-bar';
import { ArchivosService } from '../../servicios/archivos/archivos.service';
import { ActivatedRoute, Router} from '@angular/router';
import { ActivatedRoute, Router } from '@angular/router';
import { environment } from 'src/environments/environment';
import { NotificacionesService } from 'src/app/servicios/notificaciones/notificaciones.service';

export interface DialogData {
nombre_solicitud: string;
Expand All @@ -33,8 +34,13 @@ export class SubirArchivoComponent {
@Input() tipo_archivo: string[] = [];
@Input() id_usuario: number = 0;

constructor(public dialog: MatDialog, private _snackBar: MatSnackBar, private archivo_service: ArchivosService, private router: Router,
private activated_route: ActivatedRoute) {}
@Input() id_estudiante_usuario: number = -1
@Input() id_encargado_usuario: number = -1;
@Input() correo_encargado: string = "";
@Input() estado_config: string = "";

constructor(public dialog: MatDialog, private _snackBar: MatSnackBar, private archivo_service: ArchivosService, private router: Router,
private activated_route: ActivatedRoute, private service_noti: NotificacionesService) { }

subir_archivos() {
let id_solicitud = this.id_solicitud;
Expand Down Expand Up @@ -66,7 +72,7 @@ export class SubirArchivoComponent {
}

let _data: any = {};

this.archivo_service.subirDocumento(file, id_solicitud, id_practica).subscribe({
next: data => {
_data = { ..._data, ...data }
Expand All @@ -75,6 +81,21 @@ export class SubirArchivoComponent {
let upload_string = "";
if (_data.status == 200) {
upload_string = "?upload_success=success";
let respuesta: any = [];
let enlace = environment.url_front + "/practicas/" + this.id_estudiante_usuario;

this.service_noti.postnotificacion(this.id_encargado_usuario, "El alumno ha subido el archivo extra solicitado", this.correo_encargado, this.estado_config, enlace).subscribe({
next: (data: any) => {
respuesta = { ...respuesta, ...data };
},
error: (error: any) => {
console.log(error);
return;
},
complete: () => {
console.log("Notificacion enviada con exito");
}
});
} else if (_data.status == 415) {
upload_string = "?upload_success=format";
} else {
Expand Down
57 changes: 40 additions & 17 deletions src/app/vistas/alumno/alumno.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,8 @@ <h4 class="m-0 font-weight-bold text-primary">
<div>
<div class="card-body overflow-auto">
<div>
<div class="table-responsive" *ngIf="practica[1].modalidad?.config_practica?.frecuencia_informes!='diario'; else informesDiarios">
<div class="table-responsive"
*ngIf="practica[1].modalidad?.config_practica?.frecuencia_informes!='diario'; else informesDiarios">
<table
class="table table-bordered hoverTable"
id="dataTable" width="100%"
Expand All @@ -194,19 +195,29 @@ <h4 class="m-0 font-weight-bold text-primary">
</tr>
</thead>
<tbody>
<tr *ngFor="let informe of practica[1].informes;">
<td>{{ informe?.config_informe?.tipo_informe }}</td>
<tr
*ngFor="let informe of practica[1].informes;">
<td>{{
informe?.config_informe?.tipo_informe
}}</td>
<!--<td>{{ informe?.horas_trabajadas }}</td>-->
<td>{{ informe?.fecha | date: 'dd/MM/yyyy' }}</td>
<td>{{ informe?.fecha |
date: 'dd/MM/yyyy'
}}</td>
<!--<td><button class="btn btn-primary btn-sm btn-block" (click)="mostrar_informe(practica[1].informes,informe.id)">Ver
Informe</button></td>-->
<td><button *ngIf="!informe.key || isEmptyObject(informe.key); else elseBlock"
class="btn btn-primary btn-sm btn-block" (click)="redirigir_a_ingreso_informe(informe.id)">Responder</button>
<ng-template #elseBlock>
<td><button
*ngIf="!informe.key || isEmptyObject(informe.key); else elseBlock"
class="btn btn-primary btn-sm btn-block"
(click)="redirigir_a_ingreso_informe(informe.id)">Responder</button>
<ng-template
#elseBlock>
<a class="nostyle"
href="/estudiante-ver-informe/{{practica[1].id}}/{{informe.id}}">
<button class="btn btn-primary btn-sm btn-block">
Ver Informe
<button
class="btn btn-primary btn-sm btn-block">
Ver
Informe
</button>
</a>
</ng-template>
Expand All @@ -215,23 +226,30 @@ <h4 class="m-0 font-weight-bold text-primary">
</tbody>
</table>
</div>

<ng-template #informesDiarios>
<p class="text-gray-800">En verde se muestran los informes que ya has respondido, en amarillo los que aún no has respondido.</p>
<p class="text-gray-800">En verde se
muestran los informes que ya has
respondido, en amarillo los que
aún no has respondido.</p>

<table style="width:100%">
<tr>
<td style="width:32%"></td>
<td style="width:36%">
<mat-calendar class="calendario{{i}}" [selected]="selectedDate" [minDate]="minDate"
(selectedChange)="onFechaClick($event, practica[1].id)" [dateClass]="dateClass(i, practica[1].id)">
<mat-calendar
class="calendario{{i}}"
[selected]="selectedDate"
[minDate]="minDate"
(selectedChange)="onFechaClick($event, practica[1].id)"
[dateClass]="dateClass(i, practica[1].id)">
</mat-calendar>
</td>
<td style="width:32%"></td>
</tr>
</table>
</ng-template>

</div>
</div>
</div>
Expand Down Expand Up @@ -279,7 +297,12 @@ <h4 class="m-0 font-weight-bold text-primary">
[id_practica]=practica[1].id
[descripcion]="solicitud.descripcion"
[nombre_solicitud]="solicitud.nombre_solicitud"
[tipo_archivo]="solicitud.tipo_archivo">
[tipo_archivo]="solicitud.tipo_archivo"
[id_encargado_usuario]=" practica[1].encargado.id_usuario"
[correo_encargado]="practica[1].encargado.usuario.correo"
[estado_config]="estado_config"
[id_estudiante_usuario]="usuario.id">

</app-subir-archivo>
<button
*ngSwitchDefault
Expand Down Expand Up @@ -325,7 +348,8 @@ <h4 class="m-0 font-weight-bold text-primary">


<!--Tarjeta Aptitudes -->
<div class="row" style="max-width: 100%" *ngIf="hay_respuesta[i] == 1">
<div class="row" style="max-width: 100%"
*ngIf="hay_respuesta[i] == 1">
<!-- Tarjeta Archivos -->
<div class="col-xl-6">
<div class="card shadow mb-4">
Expand Down Expand Up @@ -466,7 +490,6 @@ <h2 class="m-0 font-weight-bold text-primary">{{ practica[0] }}</h2>
Inscribir Práctica</button>
<app-iniciar-practica *ngIf="flags_inscripcion_list[i]"
[id_estudiante]="estudiante.id" [nombre_practica]="practica[0]"

[estado_config]="estado_config">
</app-iniciar-practica>
</div>
Expand Down