Skip to content

Commit

Permalink
MAT - Unificar cargar/editar baja de matrícula (#205)
Browse files Browse the repository at this point in the history
* feat(MAT-124) Modificar profesion

* style(MAT-123): Unificar cargar/editar baja de matrícula

---------

Co-authored-by: aldoEMatamala <[email protected]>
  • Loading branch information
aldoEMatamala and aldoEMatamala authored Sep 5, 2023
1 parent c4b7aca commit 8ae21ec
Show file tree
Hide file tree
Showing 5 changed files with 251 additions and 215 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import {
Input,
Output,
EventEmitter,
OnInit
OnInit,
ViewChild
} from '@angular/core';
// Plex
import {
Expand All @@ -19,6 +20,7 @@ import {
// Services
import { ProfesionalService } from './../../../services/profesional.service';
import { NumeracionMatriculasService } from './../../../services/numeracionMatriculas.service';
import { PlexPanelComponent } from '@andes/plex/src/lib/accordion/panel.component';

// Utils
import { PDFUtils } from './../../../utils/PDFUtils';
Expand All @@ -36,6 +38,8 @@ export class FormacionGradoDetalleComponent implements OnInit {
@Input() profesional: IProfesional;
@Output() matriculacion = new EventEmitter();
@Output() cerrarDetalle = new EventEmitter();
@ViewChild('panelGestion', { static: false }) accordionGestion: PlexPanelComponent;
@ViewChild('panelBaja', { static: false }) accordionBaja: PlexPanelComponent;
public esSupervisor;
public motivoBaja;
edit = false;
Expand All @@ -47,10 +51,17 @@ export class FormacionGradoDetalleComponent implements OnInit {
public indexBaja;
public tieneBajas = false;
public motivoRechazo;
public campoBaja = false;
public fechaTemporal = null;
public motivoTemporal = null;

constructor(
private _profesionalService: ProfesionalService,
private _numeracionesService: NumeracionMatriculasService,
private _pdfUtils: PDFUtils, private plex: Plex, public auth: Auth) { }
private _pdfUtils: PDFUtils,
private plex: Plex,
public auth: Auth) { }




Expand Down Expand Up @@ -190,24 +201,69 @@ export class FormacionGradoDetalleComponent implements OnInit {
}

editarMatriculacion(index) {
this.fechaTemporal = this.formacion.matriculacion[index].inicio;
if (this.campoBaja) {
this.campoBaja = false;
}
if (this.edicionBajas) {
this.edicionBajas = false;
}
this.edicionGestion = true;
this.indexGestion = index;
this.accordionGestion.active = false;
this.accordionBaja ? this.accordionBaja.active = false : null;


}

editarBaja(index) {
this.motivoTemporal = this.formacion.matriculacion[index].baja.motivo;
this.fechaTemporal = this.formacion.matriculacion[index].baja.fecha;
if (this.campoBaja) {
this.campoBaja = false;
}
if (this.edicionGestion) {
this.edicionGestion = false;
}
this.edicionBajas = true;
this.indexBaja = index;
this.accordionGestion.active = false;
this.accordionBaja.active = false;

}

mostrarBaja() {
this.motivoBaja = '';
if (this.edicionBajas) {
this.cancelarEdicionBaja();
}
if (this.edicionGestion) {
this.edicionGestion = false;
}
this.campoBaja = true;
this.accordionGestion.active = false;
this.accordionBaja ? this.accordionBaja.active = false : null;


}
cancelarBaja() {
this.campoBaja = false;


}

guardarBaja() {
this.actualizar();
this.edicionBajas = false;
this.plex.toast('success', 'La edición se registró con exito!', 'informacion', 1000);

}

guardarGestion() {
const vencimientoAnio = (new Date(this.formacion.matriculacion[this.indexGestion].inicio)).getUTCFullYear() + 5;
this.formacion.matriculacion[this.indexGestion].fin = new Date(new Date(this.profesional.fechaNacimiento).setFullYear(vencimientoAnio));
this.actualizar();
this.plex.toast('success', 'La edición se registró con exito!', 'informacion', 1000);
this.edicionGestion = false;
}
guardarRechazo() {
Expand All @@ -220,6 +276,8 @@ export class FormacionGradoDetalleComponent implements OnInit {
fecha: new Date(),
};
this.profesional.formacionGrado[this.index] = this.formacion;
this.profesional.formacionGrado[this.index].matriculado = false;

}
this.actualizar();
this.plex.toast('success', 'Se rechazo la renovacion de matricula!', 'informacion', 2000);
Expand All @@ -229,15 +287,18 @@ export class FormacionGradoDetalleComponent implements OnInit {
}

cancelarEdicionBaja() {
this.edicionBajas = false;
this.formacion.matriculacion[this.indexBaja].baja.motivo = this.motivoTemporal;
this.formacion.matriculacion[this.indexBaja].baja.fecha = this.fechaTemporal;
this.indexBaja = null;
this.edicionBajas = false;
}
cancelarEdicionRechazo() {
this.edicionRechazo = false;
this.actualizar();
}

cancelarEdicionGestion() {
this.formacion.matriculacion[this.indexGestion].inicio = this.fechaTemporal;
this.edicionGestion = false;
this.indexGestion = null;
}
Expand All @@ -249,12 +310,12 @@ export class FormacionGradoDetalleComponent implements OnInit {
this.profesional.formacionGrado[this.index].papelesVerificados = false;
this.profesional.formacionGrado[this.index].matriculacion[this.profesional.formacionGrado[this.index].matriculacion.length - 1].baja.motivo = this.motivoBaja;
this.profesional.formacionGrado[this.index].matriculacion[this.profesional.formacionGrado[this.index].matriculacion.length - 1].baja.fecha = new Date();
this.formacion = this.profesional.formacionGrado[this.index];
this.actualizar();
this.compruebaBajas();
}
});


this.campoBaja = false;
}

renovarAntesVencimiento() {
Expand Down
Loading

0 comments on commit 8ae21ec

Please sign in to comment.