[EDIT] CAMBIOS PARA REGISTRO DE SALIDA

parent cc5b82e1
...@@ -30,9 +30,12 @@ ...@@ -30,9 +30,12 @@
<mat-form-field class="w-full md:w-1/4" appearance="outline" floatLabel="always"> <mat-form-field class="w-full md:w-1/4" appearance="outline" floatLabel="always">
<mat-label>Sede designada : </mat-label> <mat-label>Sede designada : </mat-label>
<mat-select formControlName="sedePersonal" placeholder="[Seleccionar sede]" required> <mat-select formControlName="sedePersonal" placeholder="[Seleccionar sede]" required>
<mat-option *ngFor="let option of this.sede_list" [value]="option?.codlocal"> <mat-option *ngFor="let option of this.sede_list" [value]="option?.value">
{{option?.deslocal}} {{option?.viewValue}}
</mat-option> </mat-option>
<!-- <mat-option *ngFor="let option of this.sede_list" [value]="option?.codlocal">
{{option?.deslocal}}
</mat-option> -->
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
...@@ -73,9 +76,12 @@ ...@@ -73,9 +76,12 @@
<ng-container *ngIf="element.isNew; else displayOrigen"> <ng-container *ngIf="element.isNew; else displayOrigen">
<mat-form-field [formGroup]="datos_lugarOrigen" appearance="outline"> <mat-form-field [formGroup]="datos_lugarOrigen" appearance="outline">
<mat-select formControlName="lugarOrigen{{element.index}}" placeholder="[Seleccionar de origen]" required> <mat-select formControlName="lugarOrigen{{element.index}}" placeholder="[Seleccionar de origen]" required>
<mat-option *ngFor="let option of this.sede_list" [value]="option?.codlocal"> <mat-option *ngFor="let option of this.sede_list" [value]="option?.value">
{{option?.deslocal}} {{option?.viewValue}}
</mat-option> </mat-option>
<!--<mat-option *ngFor="let option of this.sede_list" [value]="option?.codlocal">
{{option?.deslocal}}
</mat-option> -->
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
</ng-container> </ng-container>
...@@ -104,7 +110,7 @@ ...@@ -104,7 +110,7 @@
<td mat-cell *matCellDef="let element"> <td mat-cell *matCellDef="let element">
<ng-container *ngIf="element.isNew; else displayOrigen"> <ng-container *ngIf="element.isNew; else displayOrigen">
<mat-form-field [formGroup]="datos_pasajeAcumulado" appearance="outline"> <mat-form-field [formGroup]="datos_pasajeAcumulado" appearance="outline">
<input matInput formControlName="montoPasaje{{element.index}}" soloNumeros placeholder="[Monto]" value="" maxlength="6" (blur)="formatMontoPasaje(element.index)"> <input matInput formControlName="montoPasaje{{element.index}}" soloNumeros="decimal" placeholder="[Monto]" value="" maxlength="6" (blur)="formatMontoPasaje(this.datos_pasajeAcumulado,'montoPasaje'+element.index)">
</mat-form-field> </mat-form-field>
</ng-container> </ng-container>
<ng-template #displayOrigen> <ng-template #displayOrigen>
......
...@@ -24,7 +24,6 @@ import {MatCheckboxModule} from '@angular/material/checkbox'; ...@@ -24,7 +24,6 @@ import {MatCheckboxModule} from '@angular/material/checkbox';
import {ConformidadHelper} from "./helper/conformidad.helper"; import {ConformidadHelper} from "./helper/conformidad.helper";
import {NgClass, NgForOf, NgIf, DatePipe, AsyncPipe, NgStyle} from "@angular/common"; import {NgClass, NgForOf, NgIf, DatePipe, AsyncPipe, NgStyle} from "@angular/common";
import {MatCard, MatCardContent, MatCardFooter, MatCardHeader, MatCardTitle , MatCardModule} from '@angular/material/card'; import {MatCard, MatCardContent, MatCardFooter, MatCardHeader, MatCardTitle , MatCardModule} from '@angular/material/card';
import { debounceTime, distinctUntilChanged, switchMap } from 'rxjs/operators';
import {MatAutocompleteModule} from '@angular/material/autocomplete'; import {MatAutocompleteModule} from '@angular/material/autocomplete';
import {MatTooltipModule} from '@angular/material/tooltip'; import {MatTooltipModule} from '@angular/material/tooltip';
import {MatDialog, MatDialogModule} from '@angular/material/dialog'; import {MatDialog, MatDialogModule} from '@angular/material/dialog';
...@@ -47,6 +46,11 @@ interface tiposTrabajo { ...@@ -47,6 +46,11 @@ interface tiposTrabajo {
viewValue: string; viewValue: string;
} }
interface lugaresTrabajo {
value : string;
viewValue : string;
}
interface interRequerimientos { interface interRequerimientos {
id: number; id: number;
titulo: string; titulo: string;
...@@ -132,6 +136,203 @@ export class ConformidadComponent implements AfterViewInit { ...@@ -132,6 +136,203 @@ export class ConformidadComponent implements AfterViewInit {
// VIEWCHILD // VIEWCHILD
// INICIALIZACION DE SEDES
listadoSedesTrabajo : lugaresTrabajo[] = [
{
"value": '1',
"viewValue": "6 DE AGOSTO"
},
{
"value": '2',
"viewValue": "ADMINISTRACION - SAN ISIDRO"
},
{
"value": '3',
"viewValue": "ANIVERSARIO"
},
{
"value": '4',
"viewValue": "ARENALES"
},
{
"value": '5',
"viewValue": "AREQUIPA"
},
{
"value": '6',
"viewValue": "BARRANCO"
},
{
"value": '7',
"viewValue": "BELISARIO"
},
{
"value": '8',
"viewValue": "BELLAVISTA"
},
{
"value": '9',
"viewValue": "BELLIDO"
},
{
"value": '10',
"viewValue": "CALCA"
},
{
"value": '11',
"viewValue": "CANTA CALLAO"
},
{
"value": '12',
"viewValue": "CARABAYLLO"
},
{
"value": '13',
"viewValue": "CASONA"
},
{
"value": '14',
"viewValue": "CHACLACAYO"
},
{
"value": '15',
"viewValue": "CHORRILLOS"
},
{
"value": '16',
"viewValue": "CIPRESES"
},
{
"value": '17',
"viewValue": "CIPRESES ELIO"
},
{
"value": '18',
"viewValue": "OBRA"
},
{
"value": '19',
"viewValue": "CUBA"
},
{
"value": '20',
"viewValue": "EL AGUSTINO"
},
{
"value": '21',
"viewValue": "ATE - GRAFICA"
},
{
"value": '22',
"viewValue": "HUANCAYO"
},
{
"value": '23',
"viewValue": "HUARAL"
},
{
"value": '24',
"viewValue": "ICA"
},
{
"value": '25',
"viewValue": "INDEPENDENCIA - ACADEMIA"
},
{
"value": '26',
"viewValue": "INGENIEROS"
},
{
"value": '27',
"viewValue": "LA VICTORIA"
},
{
"value": '28',
"viewValue": "LINCE"
},
{
"value": '29',
"viewValue": "ATE - LOGISTICA"
},
{
"value": '30',
"viewValue": "TALLER"
},
{
"value": '31',
"viewValue": "COCALENOS"
},
{
"value": '32',
"viewValue": "MIGUEL IGLESIAS"
},
{
"value": '33',
"viewValue": "MONTERRICO"
},
{
"value": '34',
"viewValue": "MONTESSORI"
},
{
"value": '35',
"viewValue": "NARANJAL"
},
{
"value": '36',
"viewValue": "PUEBLO LIBRE"
},
{
"value": '37',
"viewValue": "QUILCA"
},
{
"value": '38',
"viewValue": "SALAMANCA"
},
{
"value": '39',
"viewValue": "SAN CARLOS"
},
{
"value": '40',
"viewValue": "SAN JUAN - ACADEMIA"
},
{
"value": '41',
"viewValue": "SAN LUIS GERONA"
},
{
"value": '42',
"viewValue": "SAN LUIS BADAJOZ"
},
{
"value": '43',
"viewValue": "SAN MIGUEL"
},
{
"value": '44',
"viewValue": "SANTA ANITA"
},
{
"value": '45',
"viewValue": "SANTA ANITA - ACADEMIA"
},
{
"value": '46',
"viewValue": "SORIA"
},
{
"value": '47',
"viewValue": "VILLA EL SALVADOR"
},
{
"value": '48',
"viewValue": "VILLA SOL"
}
];
//INICIALIZACION DE LISTADO DE TIPOS DE TRABAJO //INICIALIZACION DE LISTADO DE TIPOS DE TRABAJO
listTipoTrabajo: tiposTrabajo[] = [ listTipoTrabajo: tiposTrabajo[] = [
{value: '1', viewValue: 'Instalación-Revisión'}, {value: '1', viewValue: 'Instalación-Revisión'},
...@@ -247,7 +448,7 @@ export class ConformidadComponent implements AfterViewInit { ...@@ -247,7 +448,7 @@ export class ConformidadComponent implements AfterViewInit {
} }
formatoFechaRegistro(fecha: Date){ formatoFechaRegistro(fecha: Date){
return this.datePipe.transform(fecha, 'yyyy-mm-dd') || ''; return this.datePipe.transform(fecha, 'yyyy-MM-dd') || '';
} }
...@@ -258,7 +459,8 @@ export class ConformidadComponent implements AfterViewInit { ...@@ -258,7 +459,8 @@ export class ConformidadComponent implements AfterViewInit {
sede sede
] = await Promise.all([ ] = await Promise.all([
this.conformidadHelper.cargarPersonal(), this.conformidadHelper.cargarPersonal(),
this.conformidadHelper.listadoGeneralHorizon({accion: 1}), //this.conformidadHelper.listadoGeneralHorizon({accion: 1}),
this.listadoSedesTrabajo
]); ]);
this.personal_list = personal; this.personal_list = personal;
...@@ -288,15 +490,15 @@ export class ConformidadComponent implements AfterViewInit { ...@@ -288,15 +490,15 @@ export class ConformidadComponent implements AfterViewInit {
}); });
// Sincronizar el valor de 'sedePersonal' con los selects la tabla de pasaje // Sincronizar el valor de 'sedePersonal' con los selects la tabla de pasaje
//this.datos_personal.get('sedePersonal')?.valueChanges.subscribe((value) => {
this.obtenerFormControl(this.datos_personal,'sedePersonal')?.valueChanges.subscribe((value : any) => { this.obtenerFormControl(this.datos_personal,'sedePersonal')?.valueChanges.subscribe((value : any) => {
this.lugarDestinoPasaje = this.sede_list.find((item: any) => item.codlocal === value)?.deslocal || ''; //this.lugarDestinoPasaje = this.sede_list.find((item: any) => item.codlocal === value)?.deslocal || '';
this.lugarDestinoPasaje = this.listadoSedesTrabajo.find((item: any) => item.value === value)?.viewValue || '';
}); });
//Sincroniza todos los inputs de monto de pasaje con el total de pasajes //Sincroniza todos los inputs de monto de pasaje con el total de pasajes
this.datos_pasajeAcumulado.valueChanges.subscribe(values => { this.datos_pasajeAcumulado.valueChanges.subscribe(values => {
const inputControls = Object.keys(values).filter(key => key.includes('montoPasaje')); const inputControls = Object.keys(values).filter(key => key.includes('montoPasaje')); // OBTENIENDO TODAS LAS KEYS DE MONTOPASAJE
const sum : number = (inputControls.reduce((acc, key) => acc + (Number(values[key]) || 0), 0) ) || 0; const sum : number = (inputControls.reduce((acc, key) => Number(this.decimalPipe.transform( (acc + (Number( this.decimalPipe.transform(values[key], '1.2-2') ) || 0) ) , '1.2-2' ) ) , 0) ) || 0;
this.datos_personal.get('pasajeTotal')?.setValue(sum, { emitEvent: false }); this.datos_personal.get('pasajeTotal')?.setValue(sum, { emitEvent: false });
}); });
...@@ -342,7 +544,7 @@ export class ConformidadComponent implements AfterViewInit { ...@@ -342,7 +544,7 @@ export class ConformidadComponent implements AfterViewInit {
let fechaPasajeDate = new Date(fechaPasaje); let fechaPasajeDate = new Date(fechaPasaje);
if(fechaPasajeDate >= (this.minFechaLimite || new Date()) && fechaPasajeDate <= (this.maxFechaLimite|| new Date()) ){ if(fechaPasajeDate >= (this.minFechaLimite || new Date()) && fechaPasajeDate <= (this.maxFechaLimite|| new Date()) ){
this.datos_fechaPasaje.get(key)?.setErrors({'incorrect': false}); this.datos_fechaPasaje.get(key)?.setErrors({'incorrect': false});
}else{ } else{
this.datos_fechaPasaje.get(key)?.setErrors({'incorrect': true}); this.datos_fechaPasaje.get(key)?.setErrors({'incorrect': true});
this.datos_fechaPasaje.get(key)?.setValue(''); this.datos_fechaPasaje.get(key)?.setValue('');
} }
...@@ -443,8 +645,9 @@ export class ConformidadComponent implements AfterViewInit { ...@@ -443,8 +645,9 @@ export class ConformidadComponent implements AfterViewInit {
this.requerimientosFiltrados = mapeoResultado; this.requerimientosFiltrados = mapeoResultado;
} }
formatMontoPasaje(index : any) { formatMontoPasaje(formGroup: FormGroup, formControlName: string) {
const control = this.datos_pasajeAcumulado.get('montoPasaje'+index); //const control = this.datos_pasajeAcumulado.get('montoPasaje'+index);
const control = this.obtenerFormControl(formGroup,formControlName);
if (control && control.value != null) { if (control && control.value != null) {
const formattedValue = this.decimalPipe.transform(control.value, '1.2-2'); const formattedValue = this.decimalPipe.transform(control.value, '1.2-2');
control.setValue(formattedValue, { emitEvent: false }); control.setValue(formattedValue, { emitEvent: false });
...@@ -498,8 +701,10 @@ export class ConformidadComponent implements AfterViewInit { ...@@ -498,8 +701,10 @@ export class ConformidadComponent implements AfterViewInit {
const index = this.dataSource.findIndex((item) => item.index === elemento.index); const index = this.dataSource.findIndex((item) => item.index === elemento.index);
this.dataSource[index] = { this.dataSource[index] = {
index: elemento.index, index: elemento.index,
lugarOrigen: this.sede_list.find((item: any) => item.codlocal === lugarOrigen)?.deslocal || '' , //lugarOrigen: this.sede_list.find((item: any) => item.codlocal === lugarOrigen)?.deslocal || '' ,
lugarDestino: this.sede_list.find((item: any) => item.codlocal === lugarDestino)?.deslocal || '' , //lugarDestino: this.sede_list.find((item: any) => item.codlocal === lugarDestino)?.deslocal || '' ,
lugarOrigen : this.listadoSedesTrabajo.find((item: any) => item.value === lugarOrigen)?.viewValue || '',
lugarDestino : this.listadoSedesTrabajo.find((item: any) => item.value === lugarDestino)?.viewValue || '',
monto: pasaje, monto: pasaje,
fecha: fechaPasaje, fecha: fechaPasaje,
isNew: false, isNew: false,
...@@ -699,39 +904,6 @@ export class ConformidadComponent implements AfterViewInit { ...@@ -699,39 +904,6 @@ export class ConformidadComponent implements AfterViewInit {
Notiflix.Loading.pulse(); // Muestra un loading Notiflix.Loading.pulse(); // Muestra un loading
/*const codigoprueba = 50;
let statusEvidencias = true;
const registroCarpeta = await this.conformidadHelper.creacionCarpeta({codconformidad: codigoprueba});
if (registroCarpeta.status) {
const registroArchivos = archivosEvidencias.map((item) => {
return {
codconformidad: codigoprueba,
archivo: item.file,
idCarpeta: registroCarpeta.idCarpeta,
tipoEvidencia: item.tipoEvidencia,
nombreArchivo: (item.tipoEvidencia === 1) ? 'EVIDENCIA_PROBLEMA_' + codigoprueba + "_" + (contadorEP++) : 'EVIDENCIA_SOLUCION_' + codigoprueba + "_" + (contadorES++)
};
});
//console.log(registroEvidencia);
const filtroEvidenciasProblemas = registroArchivos.filter((item) => item.tipoEvidencia === 1);
const filtroEvidenciasSoluciones = registroArchivos.filter((item) => item.tipoEvidencia === 2);
const registroEvidencia = await Promise.all([this.conformidadHelper.subidaEvidencia2(filtroEvidenciasProblemas), this.conformidadHelper.subidaEvidencia2(filtroEvidenciasSoluciones)]);
console.log(registroEvidencia);
if (!(registroEvidencia[0].status && registroEvidencia[1].status)) {
statusEvidencias = false;
}
}
console.log(statusEvidencias);
Notiflix.Loading.remove();*/
if (!this.validarDatosPersonales(datosPersonal)) { if (!this.validarDatosPersonales(datosPersonal)) {
this.mostrarAlerta('VALIDAR DATOS PERSONALES'); this.mostrarAlerta('VALIDAR DATOS PERSONALES');
...@@ -786,7 +958,7 @@ export class ConformidadComponent implements AfterViewInit { ...@@ -786,7 +958,7 @@ export class ConformidadComponent implements AfterViewInit {
opcion: 2, opcion: 2,
codconformidad : codigoConformidad, codconformidad : codigoConformidad,
codlocal: this.datos_lugarOrigen.get('lugarOrigen'+item.index)?.value, codlocal: this.datos_lugarOrigen.get('lugarOrigen'+item.index)?.value,
pasaje: item.monto, pasaje: Number( this.decimalPipe.transform(item.monto, '1.2-2') ) || 0,
fechainicio: this.formatoFechaRegistro(item.fecha) fechainicio: this.formatoFechaRegistro(item.fecha)
}; };
}); });
...@@ -847,6 +1019,7 @@ export class ConformidadComponent implements AfterViewInit { ...@@ -847,6 +1019,7 @@ export class ConformidadComponent implements AfterViewInit {
const registroEvidencia = await Promise.all([this.conformidadHelper.subidaEvidencia2(filtroEvidenciasProblemas),this.conformidadHelper.subidaEvidencia2(filtroEvidenciasSoluciones)]); const registroEvidencia = await Promise.all([this.conformidadHelper.subidaEvidencia2(filtroEvidenciasProblemas),this.conformidadHelper.subidaEvidencia2(filtroEvidenciasSoluciones)]);
//console.log(registroEvidencia);
if(!(registroEvidencia[0].status && registroEvidencia[1].status)){ if(!(registroEvidencia[0].status && registroEvidencia[1].status)){
statusEvidencias = false; statusEvidencias = false;
} }
...@@ -867,8 +1040,6 @@ export class ConformidadComponent implements AfterViewInit { ...@@ -867,8 +1040,6 @@ export class ConformidadComponent implements AfterViewInit {
descripcion: datosMaterialSobrante descripcion: datosMaterialSobrante
}); });
//console.log(registroOrdenSalida);
const respuestaOrdenSalida: any = JSON.parse(registroOrdenSalida); const respuestaOrdenSalida: any = JSON.parse(registroOrdenSalida);
if (respuestaOrdenSalida.status) { if (respuestaOrdenSalida.status) {
...@@ -878,6 +1049,8 @@ export class ConformidadComponent implements AfterViewInit { ...@@ -878,6 +1049,8 @@ export class ConformidadComponent implements AfterViewInit {
accion: 2, accion: 2,
codOrdenSalida: respuestaOrdenSalida.data.codordensalida, codOrdenSalida: respuestaOrdenSalida.data.codordensalida,
codArticulo: item.codigoArticulo, codArticulo: item.codigoArticulo,
nombreArticulo : item.nombre,
unidad : item.unidad,
cantidad: item.cantidad, cantidad: item.cantidad,
estado: item.estado estado: item.estado
}; };
......
...@@ -27,9 +27,9 @@ import {MatTableModule} from "@angular/material/table"; ...@@ -27,9 +27,9 @@ import {MatTableModule} from "@angular/material/table";
], ],
standalone: true, standalone: true,
template: ` template: `
<h1 mat-dialog-title>Confirmar Eliminación</h1> <h1 mat-dialog-title>Confirmar eliminación pasaje</h1>
<div mat-dialog-content> <div mat-dialog-content>
<p>¿Estás seguro de que deseas eliminar este registro?</p> <p>¿Estás seguro de que deseas eliminar este pasaje?</p>
</div> </div>
<div mat-dialog-actions> <div mat-dialog-actions>
<button mat-button (click)="onCancelar()">Cancelar</button> <button mat-button (click)="onCancelar()">Cancelar</button>
......
...@@ -81,7 +81,6 @@ export class modalRequerimientoComponent implements OnInit{ ...@@ -81,7 +81,6 @@ export class modalRequerimientoComponent implements OnInit{
fechaRegistro : item.fechaRegistro fechaRegistro : item.fechaRegistro
} }
}) || []; }) || [];
console.log(datosPrincipales);
if(datosPrincipales[0]){ if(datosPrincipales[0]){
//Obtener los valores de descripcion, observacion, sede y empleado por separado y en un solo objeto //Obtener los valores de descripcion, observacion, sede y empleado por separado y en un solo objeto
...@@ -99,8 +98,6 @@ export class modalRequerimientoComponent implements OnInit{ ...@@ -99,8 +98,6 @@ export class modalRequerimientoComponent implements OnInit{
//this.detalleRequerimiento = data.requerimientoInfo //this.detalleRequerimiento = data.requerimientoInfo
//this.filasRequerimientos = //this.filasRequerimientos =
console.log(this.detalleRequerimiento);
} }
ngOnInit(): void { ngOnInit(): void {
......
...@@ -29,7 +29,8 @@ ...@@ -29,7 +29,8 @@
<ng-container matColumnDef="nombre"> <ng-container matColumnDef="nombre">
<th mat-header-cell *matHeaderCellDef> NOMBRE DE ARTÍCULO </th> <th mat-header-cell *matHeaderCellDef> NOMBRE DE ARTÍCULO </th>
<td mat-cell *matCellDef="let element"> <td mat-cell *matCellDef="let element">
<ng-container *ngIf="element.isNew; else displayOrigen"> <!-- DESBLOQUEAR DESPUES -->
<!-- <ng-container *ngIf="element.isNew; else displayOrigen">
<mat-form-field class="w-[25rem]"> <mat-form-field class="w-[25rem]">
<input type="text" placeholder="Buscar artículos" matInput formControlName="articulo{{element.index}}" [matAutocomplete]="auto" maxlength="9" <input type="text" placeholder="Buscar artículos" matInput formControlName="articulo{{element.index}}" [matAutocomplete]="auto" maxlength="9"
(input)="onBusquedaArticulo($event,element.index)"> (input)="onBusquedaArticulo($event,element.index)">
...@@ -39,6 +40,11 @@ ...@@ -39,6 +40,11 @@
</mat-option> </mat-option>
</mat-autocomplete> </mat-autocomplete>
</mat-form-field> </mat-form-field>
</ng-container> -->
<ng-container *ngIf="element.isNew; else displayOrigen">
<mat-form-field class="w-[25rem]">
<input type="text" placeholder="Buscar artículos" matInput formControlName="articulo{{element.index}}">
</mat-form-field>
</ng-container> </ng-container>
<ng-template #displayOrigen> <ng-template #displayOrigen>
{{ element.nombre }} {{ element.nombre }}
...@@ -50,8 +56,17 @@ ...@@ -50,8 +56,17 @@
<ng-container matColumnDef="unidad"> <ng-container matColumnDef="unidad">
<th mat-header-cell *matHeaderCellDef> UNIDAD </th> <th mat-header-cell *matHeaderCellDef> UNIDAD </th>
<td mat-cell *matCellDef="let element"> <td mat-cell *matCellDef="let element">
<ng-container *ngIf="element.isNew; else displayOrigen"> <!-- <ng-container *ngIf="element.isNew; else displayOrigen">
<mat-label>{{formGroupMS(2,'unidad'+element.index)?.value}}</mat-label> <mat-label>{{formGroupMS(2,'unidad'+element.index)?.value}}</mat-label>
</ng-container> -->
<ng-container *ngIf="element.isNew; else displayOrigen">
<mat-form-field appearance="outline">
<mat-select formControlName="unidad{{element.index}}" required>
<mat-option *ngFor="let option of this.listUnidades" [value]="option?.codigo">
{{option?.nombre}}
</mat-option>
</mat-select>
</mat-form-field>
</ng-container> </ng-container>
<ng-template #displayOrigen> <ng-template #displayOrigen>
{{ element.unidad }} {{ element.unidad }}
...@@ -65,7 +80,7 @@ ...@@ -65,7 +80,7 @@
<td mat-cell *matCellDef="let element"> <td mat-cell *matCellDef="let element">
<ng-container *ngIf="element.isNew; else displayOrigen"> <ng-container *ngIf="element.isNew; else displayOrigen">
<mat-form-field class="w-[10rem]" appearance="outline"> <mat-form-field class="w-[10rem]" appearance="outline">
<input matInput formControlName="cantidad{{element.index}}" soloNumeros maxlength="2"> <input matInput formControlName="cantidad{{element.index}}" soloNumeros="entero" maxlength="2">
</mat-form-field> </mat-form-field>
</ng-container> </ng-container>
<ng-template #displayOrigen> <ng-template #displayOrigen>
......
...@@ -41,11 +41,16 @@ interface interArticulo{ ...@@ -41,11 +41,16 @@ interface interArticulo{
acciones: boolean; acciones: boolean;
} }
interface estadosArticulo { interface interEstados {
valor: string; valor: string;
nombre: string; nombre: string;
} }
interface interUnidad {
codigo: string;
nombre: string;
}
@Component({ @Component({
selector: 'ordensalida-component', selector: 'ordensalida-component',
templateUrl: './ordensalida.componente.html', templateUrl: './ordensalida.componente.html',
...@@ -116,10 +121,11 @@ export class ordenSalidaComponent implements OnInit { ...@@ -116,10 +121,11 @@ export class ordenSalidaComponent implements OnInit {
// INICIALIZACION DATOS // INICIALIZACION DATOS
columnasArticulos: string[] = ['nombre', 'unidad', 'cantidad', 'estado', 'accion']; columnasArticulos: string[] = ['nombre', 'unidad', 'cantidad', 'estado', 'accion'];
articulosList: any[] = []; articulosList: any[] = [];
listUnidades : interUnidad[] = [];
activarNuevoArticulo: boolean = true; activarNuevoArticulo: boolean = true;
indexArticulo: number = 0; indexArticulo: number = 0;
public dataSource: interArticulo[] = []; public dataSource: interArticulo[] = [];
listEstadoArticulo: estadosArticulo[] = [{ valor: '1', nombre: 'BUENO'}, { valor: '2', nombre: 'OBSERVACIÓN' },{ valor: '3', nombre: 'MAL ESTADO' } ] listEstadoArticulo: interEstados[] = [{ valor: '1', nombre: 'BUENO'}, { valor: '2', nombre: 'OBSERVACIÓN' },{ valor: '3', nombre: 'MAL ESTADO' } ]
// INICIALIZACION DATOS // INICIALIZACION DATOS
// OBTENER DATOS DEL FORM GROUP // OBTENER DATOS DEL FORM GROUP
...@@ -143,11 +149,17 @@ export class ordenSalidaComponent implements OnInit { ...@@ -143,11 +149,17 @@ export class ordenSalidaComponent implements OnInit {
private datePipe: DatePipe, private datePipe: DatePipe,
) { ) {
this.articulosList = []; this.articulosList = [];
//this.codigoUnidad = '';
} }
ngOnInit(): void { async ngOnInit(): Promise<void> {
this.dataSource = []; this.dataSource = [];
const jsonParametrosArti = {
accion : 5
};
const unidadList = await this.conformidadHelper.listadoGeneralHorizon(jsonParametrosArti) ;
this.listUnidades = unidadList.map((item: any) => ({codigo: item.CODIGO , nombre: item.NOMBRE}));
} }
onAgregarArticulo(event : any){ onAgregarArticulo(event : any){
...@@ -208,7 +220,7 @@ export class ordenSalidaComponent implements OnInit { ...@@ -208,7 +220,7 @@ export class ordenSalidaComponent implements OnInit {
}; };
console.log(this.dataSource); //console.log(this.dataSource);
//console.log(lugarOrigen , lugarDestino, pasaje, fechaPasaje) //console.log(lugarOrigen , lugarDestino, pasaje, fechaPasaje)
this.dataSource.forEach((item) => { item.acciones = true; }); // VUELVE A ACTIVAR TODAS LAS ACCION this.dataSource.forEach((item) => { item.acciones = true; }); // VUELVE A ACTIVAR TODAS LAS ACCION
...@@ -249,6 +261,7 @@ export class ordenSalidaComponent implements OnInit { ...@@ -249,6 +261,7 @@ export class ordenSalidaComponent implements OnInit {
this.dataSource.forEach((item) => { item.acciones = true; }); // Que todas las filas vuelvan a tener las acciones this.dataSource.forEach((item) => { item.acciones = true; }); // Que todas las filas vuelvan a tener las acciones
if(this.dataSource[index].isEdit){ if(this.dataSource[index].isEdit){
this.dataSource[index].isEdit = false; this.dataSource[index].isEdit = false;
this.dataSource[index].isNew = false; this.dataSource[index].isNew = false;
this.dataSource = [...this.dataSource]; this.dataSource = [...this.dataSource];
...@@ -302,7 +315,7 @@ export class ordenSalidaComponent implements OnInit { ...@@ -302,7 +315,7 @@ export class ordenSalidaComponent implements OnInit {
}); });
} }
async onBusquedaArticulo(event: any , index : number) { async onBusquedaArticulo(event: any , index : number) { // OMITIR LA BUSQUEDA POR AHORA YA QUE NO CONOCEN LOS ARTICULOS
const busquedaArt = event.target.value; const busquedaArt = event.target.value;
...@@ -311,8 +324,6 @@ export class ordenSalidaComponent implements OnInit { ...@@ -311,8 +324,6 @@ export class ordenSalidaComponent implements OnInit {
nombreValor : busquedaArt, nombreValor : busquedaArt,
}; };
console.log(jsonParametrosArti);
const articulos_list = await this.conformidadHelper.listadoGeneralHorizon(jsonParametrosArti) ; const articulos_list = await this.conformidadHelper.listadoGeneralHorizon(jsonParametrosArti) ;
const mapeoResultado = articulos_list.map((item: any) => ({ const mapeoResultado = articulos_list.map((item: any) => ({
codigo: item.codigoProducto, codigo: item.codigoProducto,
...@@ -321,10 +332,9 @@ export class ordenSalidaComponent implements OnInit { ...@@ -321,10 +332,9 @@ export class ordenSalidaComponent implements OnInit {
})); }));
this.articulosList = mapeoResultado; this.articulosList = mapeoResultado;
console.log(this.articulosList);
} }
onSeleccionArticulo(event: MatAutocompleteSelectedEvent,index : number) { onSeleccionArticulo(event: MatAutocompleteSelectedEvent,index : number) { // OMITIR LA BUSQUEDA POR AHORA YA QUE NO CONOCEN LOS ARTICULOS
//AL SELECCIONAR , SE OPTIENE EL VALUE //AL SELECCIONAR , SE OPTIENE EL VALUE
const selectedOption = event.option.value; const selectedOption = event.option.value;
...@@ -332,7 +342,7 @@ export class ordenSalidaComponent implements OnInit { ...@@ -332,7 +342,7 @@ export class ordenSalidaComponent implements OnInit {
//SE BUSCA EL VALUE DENTRO DEL LISTADO DE ARTICULOS //SE BUSCA EL VALUE DENTRO DEL LISTADO DE ARTICULOS
const articulo = this.articulosList.find((item) => item.codigo === selectedOption); const articulo = this.articulosList.find((item) => item.codigo === selectedOption);
console.log(articulo); //console.log(articulo);
//SE OPTIENE EL NOMBRE PARA PONERLO EN EL INPUT //SE OPTIENE EL NOMBRE PARA PONERLO EN EL INPUT
this.formGroupMS(2,'articulo'+index)?.setValue(articulo.nombre); this.formGroupMS(2,'articulo'+index)?.setValue(articulo.nombre);
this.formGroupMS(2,'codigoArticulo'+index)?.setValue(articulo.codigo); this.formGroupMS(2,'codigoArticulo'+index)?.setValue(articulo.codigo);
...@@ -342,28 +352,6 @@ export class ordenSalidaComponent implements OnInit { ...@@ -342,28 +352,6 @@ export class ordenSalidaComponent implements OnInit {
//SE VUELVE A LIMPIAR EL LISTADO DE ARTICULOS PARA DEJAR PASO A OTRA FUTURA BUSQUEDA. //SE VUELVE A LIMPIAR EL LISTADO DE ARTICULOS PARA DEJAR PASO A OTRA FUTURA BUSQUEDA.
this.articulosList = []; this.articulosList = [];
/*const valor = event.option.value;
if(this.listRequerimientos.find((item) => item.codigo === valor)){
this.labelText = 'Ya existe el requerimiento ' + valor + ' en el listado'; // Cambia el texto
this.isFading = false; // Resetea el estado de opacidad para mostrar el texto
// Después de 2 segundos, comienza a desvanecer el texto
setTimeout(() => {
this.isFading = true;
}, 2000); // 2000 ms = 2 segundos
}else{
this.listRequerimientos.push({ titulo: `RQ N°${valor}`, id: this.idBotones++ , codigo: valor });
this.labelText = '';
}
this.datos_servicio.get('busquedaReq')?.setValue('');
this.inputBusqueda.nativeElement.blur();
this.detectorChange.detectChanges();
this.requerimientosFiltrados = [];
}*/
} }
formatoEstado(estado: any) { formatoEstado(estado: any) {
......
...@@ -76,7 +76,7 @@ export class ConformidadService { ...@@ -76,7 +76,7 @@ export class ConformidadService {
try { try {
const respuesta = await axios.post(this.t_facturacion_electronica_link + '/api/v1/conformidad/registrarConformidad', Parametros); const respuesta = await axios.post(this.t_facturacion_electronica_link + '/api/v1/conformidad/registrarConformidad', Parametros);
console.log(respuesta); //console.log(respuesta);
return respuesta.data; return respuesta.data;
} catch (e) { } catch (e) {
return e; return e;
...@@ -227,9 +227,6 @@ export class ConformidadService { ...@@ -227,9 +227,6 @@ export class ConformidadService {
nombreDocumento: datos.nombreArchivo || '' nombreDocumento: datos.nombreArchivo || ''
}); });
console.log(registroEvidencia);
if (responseBody?.status) { if (responseBody?.status) {
respuesta = {status: true, message: "Imagenes subidas"}; respuesta = {status: true, message: "Imagenes subidas"};
} else { } else {
...@@ -285,6 +282,8 @@ export class ConformidadService { ...@@ -285,6 +282,8 @@ export class ConformidadService {
descripcion: json.descripcion || '', descripcion: json.descripcion || '',
fechaRegistro : json.fechaRegistro || '', fechaRegistro : json.fechaRegistro || '',
codArticulo : json.codArticulo || '', codArticulo : json.codArticulo || '',
nombreArticulo : json.nombreArticulo || '',
unidad : json.unidad || '-',
cantidad : json.cantidad || 0, cantidad : json.cantidad || 0,
estado : json.estado || 0, estado : json.estado || 0,
...@@ -298,31 +297,4 @@ export class ConformidadService { ...@@ -298,31 +297,4 @@ export class ConformidadService {
} }
} }
/*async listadoRequerimientos(json: any) {
const parametros =[
json.accion || 0,
json.nombreValor || '',
json.sede || '',
]
try {
const respuesta = await axios.post(this.t_horizon_rest_link + '/api/procedure/Procedimiento',
{
database: "sqlserver",
procedure :"USP_GENERAL_FORMULARIO",
params : parametros
},
{
headers: {
'Content-Type': 'application/json'
}
});
return respuesta.data;
} catch (e) {
return e;
}
}*/
} }
import { Directive ,HostListener } from '@angular/core'; import { Directive ,HostListener , Input } from '@angular/core';
@Directive({ @Directive({
selector: '[soloNumeros]', selector: '[soloNumeros]',
...@@ -7,14 +7,28 @@ import { Directive ,HostListener } from '@angular/core'; ...@@ -7,14 +7,28 @@ import { Directive ,HostListener } from '@angular/core';
export class SoloNumerosDirective { export class SoloNumerosDirective {
@Input() soloNumeros?: 'decimal' | 'entero';
//constructor() { } //constructor() { }
@HostListener('keypress', ['$event']) @HostListener('keypress', ['$event'])
onKeyPress(event: KeyboardEvent) { onKeyPress(event: KeyboardEvent) {
const charCode = event.key; const charCode = event.key;
// Permitir solo números (0-9)
if (!/^[0-9.]*$/.test(charCode)) { if (this.soloNumeros === 'entero') {
event.preventDefault(); // Permitir solo números enteros (0-9)
if (!/^[0-9]*$/.test(charCode)) {
event.preventDefault();
}
} else if (this.soloNumeros === 'decimal') {
if (!/^[0-9.]*$/.test(charCode)) {
event.preventDefault();
}
} else {
if (!/^[0-9]*$/.test(charCode)) {
event.preventDefault();
}
} }
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment