|
|
@@ -39,9 +39,6 @@ import { MESMSVService } from 'src/app/services/mes/mesmsv/mesmsv.service';
|
|
|
export class MESMHSFORMDAYSComponent implements OnInit {
|
|
|
formGroup: FormGroup;
|
|
|
dias: number = 0;
|
|
|
-
|
|
|
- today = new Date();
|
|
|
-
|
|
|
dias_feriados: any[] = null!;
|
|
|
politica: string = null!;
|
|
|
|
|
|
@@ -92,6 +89,13 @@ export class MESMHSFORMDAYSComponent implements OnInit {
|
|
|
},
|
|
|
Validators.required
|
|
|
),
|
|
|
+ fecha_minima: new FormControl(
|
|
|
+ {
|
|
|
+ value: this.momentDate(this.dateFormat(this.data.item.FECHAFINAL)).add(1, 'day'),
|
|
|
+ disabled: false
|
|
|
+ },
|
|
|
+ Validators.required
|
|
|
+ ),
|
|
|
fecha_final_2: new FormControl(
|
|
|
{
|
|
|
value: '',
|
|
|
@@ -340,7 +344,7 @@ export class MESMHSFORMDAYSComponent implements OnInit {
|
|
|
if (event.value !== null) {
|
|
|
if (new Date(event.value).getTime() > this.getDateWithString(this.data.item.FECHAFINAL).getTime()) {
|
|
|
this.formGroup.patchValue({
|
|
|
- fecha_inicio_2: this.getDateWithString(this.data.item.FECHAFINAL),
|
|
|
+ fecha_inicio_2: this.getDateWithString(this.dateFormatInvert(this.data.item.FECHAFINAL)),
|
|
|
});
|
|
|
this.calcular_dias();
|
|
|
} else {
|
|
|
@@ -369,8 +373,8 @@ export class MESMHSFORMDAYSComponent implements OnInit {
|
|
|
|
|
|
private getDateWithString(fecha: string) {
|
|
|
let fechaAux = fecha.split('-');
|
|
|
-
|
|
|
- return new Date(parseInt(fechaAux[0]), parseInt(fechaAux[1]) - 1, parseInt(fechaAux[2]));
|
|
|
+
|
|
|
+ return new Date(parseInt(fechaAux[2]), parseInt(fechaAux[1]) - 1, parseInt(fechaAux[0]));
|
|
|
}
|
|
|
|
|
|
private dateFormat(fecha: string) {
|
|
|
@@ -379,6 +383,18 @@ export class MESMHSFORMDAYSComponent implements OnInit {
|
|
|
return `${fechaAux[2]}-${fechaAux[1]}-${fechaAux[0]}`;
|
|
|
}
|
|
|
|
|
|
+ private dateFormatInvert(fecha: string) {
|
|
|
+ let fechaAux = fecha.split('-');
|
|
|
+
|
|
|
+ return `${fechaAux[0]}-${fechaAux[1]}-${fechaAux[2]}`;
|
|
|
+ }
|
|
|
+
|
|
|
+ private addDayDate(fecha: Date) {
|
|
|
+ fecha.setDate(fecha.getDate() + 1)
|
|
|
+
|
|
|
+ return fecha;
|
|
|
+ }
|
|
|
+
|
|
|
private obtenerDiasFeriados() {
|
|
|
this._mcomdfService.obtener().subscribe(
|
|
|
(response) => {
|
|
|
@@ -435,6 +451,10 @@ export class MESMHSFORMDAYSComponent implements OnInit {
|
|
|
return this.formGroup.get('fecha_final_2');
|
|
|
}
|
|
|
|
|
|
+ get fecha_minima() {
|
|
|
+ return this.formGroup.get('fecha_minima');
|
|
|
+ }
|
|
|
+
|
|
|
get dias_vacacionales() {
|
|
|
return this.formGroup.get('dias_vacacionales');
|
|
|
}
|