浏览代码

cambios visuales

SalemRoman 2 月之前
父节点
当前提交
93b5fd2c49

+ 1 - 1
src/app/app.module.ts

@@ -898,4 +898,4 @@ import { StaffSelectionComponent } from './components/corrective-maintenance/ope
   ],
   bootstrap: [AppComponent]
 })
-export class AppModule { }
+export class AppModule { }

+ 5 - 0
src/app/components/acquisition-management/acquisition/purchase-line/form-purchase-line/form-purchase-line.component.css

@@ -0,0 +1,5 @@
+mat-error {
+    white-space: nowrap; 
+    overflow: hidden;
+    text-overflow: ellipsis;
+}

+ 74 - 1
src/app/components/acquisition-management/acquisition/purchase-line/form-purchase-line/form-purchase-line.component.html

@@ -1 +1,74 @@
-<p>form-purchase-line works!</p>
+@if (isLoadingForm) {
+  <mat-progress-bar mode="indeterminate"></mat-progress-bar>
+}
+<h2 mat-dialog-title>Registrar Orden de Compra</h2>
+<mat-dialog-content>
+
+  @if (!isLoading) {
+    <form [formGroup]="formGroup" class="override_content_flex mt-10">
+      <div class="col-flex-12">
+        <mat-form-field appearance="outline" class="w-100">
+          <mat-label>Propósito</mat-label>
+          <mat-select formControlName="PROPOSITO">
+            <mat-option value="" disabled style="display: none;"> <i>Seleccione una opción...</i> </mat-option>
+            <mat-option value="NA">--- No Aplica ---</mat-option>
+            <mat-option value="MANT-PREV">Mantenimiento Preventivo</mat-option>
+            <mat-option value="MANT-CORR">Mantenimiento Correctivo</mat-option>
+          </mat-select>
+          @if (formGroup.controls['PROPOSITO'].hasError('required')) {
+            <mat-error title="El campo Propósito es requerido">El campo <b>Propósito</b> es requerido</mat-error>
+          }
+        </mat-form-field>
+      </div>
+  
+      <div class="col-flex-12">
+        <mat-form-field appearance="outline" class="w-100">
+          <mat-label>Órdenes de Mantenimiento Preventivo</mat-label>
+          <mat-select formControlName="ID_MANT_PREV">
+            @for (preventivo of filteredPreventiveMaintenance | async; track preventivo) {
+              <mat-option [value]="preventivo">{{ preventivo }}</mat-option>
+            }
+          </mat-select>
+          @if (formGroup.controls['ID_MANT_PREV'].hasError('required')) {
+            <mat-error title="El campo Órdenes de Mantenimiento Preventivo es requerido"> El campo <b>Órdenes de Mantenimiento Preventivo</b> es requerido </mat-error>
+          }
+        </mat-form-field>
+      </div>
+
+      <div class="col-flex-12">
+        <mat-form-field appearance="outline" class="w-100">
+          <mat-label>Órdenes de Mantenimiento Correctivo</mat-label>
+          <mat-select formControlName="ID_MANT_CORR">
+            @for (correctivo of filteredCorrectiveMaintenance | async; track correctivo) {
+              <mat-option [value]="correctivo">{{ correctivo }}</mat-option>
+            }
+          </mat-select>
+          @if (formGroup.controls['ID_MANT_CORR'].hasError('required')) {
+            <mat-error title="El campo Órdenes de Mantenimiento Correctivo es requerido">El campo <b>Órdenes de Mantenimiento Correctivo</b> es requerido</mat-error>
+          }
+        </mat-form-field>
+      </div>
+  
+      <div class="col-flex-12">
+        <mat-form-field appearance="outline" class="w-100">
+          <mat-label>Despacho</mat-label>
+          <mat-select formControlName="DESPACHO">
+            @for (dispatch of arrDispatch; track dispatch) {
+              <mat-option [value]="dispatch.ID_DESPACHO">{{dispatch.NOMBRE}} ({{dispatch.ID_DESPACHO}})</mat-option>
+            }
+          </mat-select>
+          @if (formGroup.controls['DESPACHO'].hasError('required')) {
+            <mat-error title="El campo Despacho es requerido">El campo <b>Despacho</b> es requerido</mat-error>
+          }
+        </mat-form-field>
+      </div>
+    </form>
+  } @else {
+    <app-loading-card [isLoading]="isLoading" txtLoading="Cargando la información del formulario" />
+  }
+
+</mat-dialog-content>
+<mat-dialog-actions align="end">
+  <button mat-button cdkFocusInitial mat-dialog-close>Cancelar</button>
+  <button mat-button (click)="alert()" [disabled]="formGroup.invalid">Registrar Orden</button>
+</mat-dialog-actions>

+ 273 - 3
src/app/components/acquisition-management/acquisition/purchase-line/form-purchase-line/form-purchase-line.component.ts

@@ -1,4 +1,20 @@
-import { Component } from '@angular/core';
+import { Component, Inject, OnInit } from '@angular/core';
+import { PreventiveWorkOrdersActive, PreventiveWorkOrdersActiveResponse } from '../../../../../interfaces/preventive-work-orders-active.interface';
+import { CorrectiveWorkOrdersListItem, CorrectiveWorkOrdersListResponse } from '../../../../../interfaces/corrective-maintenance.interface';
+import { FormControl, FormGroup, Validators } from '@angular/forms';
+import { DispatchData, ResponseDataDispatch } from '../../../../../interfaces/acquisition-management/dispatch.interface';
+import { lastValueFrom, map, Observable, startWith } from 'rxjs';
+import { MAT_DIALOG_DATA, MatDialog, MatDialogRef } from '@angular/material/dialog';
+import { RequestLines, RequestOrder } from '../../../../../interfaces/acquisition-management/order.interface';
+import { ResourcesService, ResponseData } from '../../../../../services/resources.service';
+import { PreventiveMaintenanceService } from '../../../../../services/preventive-maintenance.service';
+import { CorrectiveMaintenanceService } from '../../../../../services/corrective-maintenance.service';
+import { EncService } from '../../../../../services/enc.service';
+import { Router } from '@angular/router';
+import { AcquisitionService } from '../../../../../services/acquisition-management/acquisition.service';
+import { DispatchService } from '../../../../../services/acquisition-management/dispatch.service';
+import { HttpErrorResponse } from '@angular/common/http';
+import { AlertComponent } from '../../../../resources/dialogs/alert/alert.component';
 
 @Component({
     selector: 'app-form-purchase-line',
@@ -6,6 +22,260 @@ import { Component } from '@angular/core';
     styleUrl: './form-purchase-line.component.css',
     standalone: false
 })
-export class FormPurchaseLineComponent {
+export class FormPurchaseLineComponent implements OnInit {
+  public arrPreventiveMaintenance: Array<PreventiveWorkOrdersActive>;
+  public preventiveMaintenanceStr: Array<string>;
+  public arrCorrectiveMaintenance: Array<CorrectiveWorkOrdersListItem>;
+  public correctiveMaintenanceStr: Array<string>;
+  public arrProject: Array<any>;
+  public formGroup: FormGroup;
+  public arrDispatch: Array<DispatchData>;
+  
+  public isLoading: boolean;
+  public isLoadingForm: boolean;
 
-}
+  public filteredPreventiveMaintenance!: Observable<Array<string>>;
+  public filteredCorrectiveMaintenance!: Observable<Array<string>>;
+
+  constructor(
+    @Inject(MAT_DIALOG_DATA) public requestLines: RequestLines,
+    public resourcesService: ResourcesService,
+    private _preventiveMaintenanceService: PreventiveMaintenanceService,
+    private _correctiveMaintenanceService: CorrectiveMaintenanceService,
+    private _dialogRef: MatDialogRef<boolean>,
+    private _encService: EncService,
+    private _router: Router,
+    private _dialog: MatDialog,
+    private _acquisitionService: AcquisitionService,
+    private _distpachService: DispatchService,
+  ) {
+    this.arrPreventiveMaintenance = [];
+    this.arrCorrectiveMaintenance = [];
+    this.preventiveMaintenanceStr = [];
+    this.correctiveMaintenanceStr = [];
+
+    this.arrProject = [];
+    this.arrDispatch = [];
+
+    this.formGroup = this.createFormGroup();
+    this.isLoading = false;
+    this.isLoadingForm = false;
+  }
+
+  private createFormGroup() {
+    return new FormGroup({
+      PROPOSITO: new FormControl( 'NA', Validators.required),
+      ID_MANT_PREV: new FormControl({ value: '', disabled: true }),
+      ID_MANT_CORR: new FormControl({ value: '', disabled: true }),
+      DESPACHO: new FormControl( '', Validators.required),
+    });
+  }
+
+  async ngOnInit() {
+    this.isLoading = true;
+    this.isLoadingForm = true;
+    await this.getPreventiveMaintenance();
+    await this.getCorrectiveMaintenance();
+    await this.getDispatchActive();
+    this.isLoading = false;
+    this.isLoadingForm = false;
+
+
+    this.formGroup.controls['PROPOSITO'].valueChanges.subscribe((proposito) => {
+      if (proposito === 'MANT-PREV') {
+        this.formGroup.controls['ID_MANT_PREV'].enable();
+        this.formGroup.controls['ID_MANT_PREV'].setValidators(Validators.required);
+        this.formGroup.controls['ID_MANT_CORR'].setValue('');
+        this.formGroup.controls['ID_MANT_CORR'].disable();
+        this.formGroup.controls['ID_MANT_CORR'].clearValidators();
+        this.formGroup.controls['ID_MANT_PREV'].updateValueAndValidity();
+        this.formGroup.controls['ID_MANT_CORR'].updateValueAndValidity();
+      } else if (proposito === 'MANT-CORR') {
+        this.formGroup.controls['ID_MANT_CORR'].enable();
+        this.formGroup.controls['ID_MANT_CORR'].setValidators(Validators.required);
+        this.formGroup.controls['ID_MANT_PREV'].disable();
+        this.formGroup.controls['ID_MANT_PREV'].setValue('');
+        this.formGroup.controls['ID_MANT_PREV'].clearValidators();
+        this.formGroup.controls['ID_MANT_PREV'].updateValueAndValidity();
+        this.formGroup.controls['ID_MANT_CORR'].updateValueAndValidity();
+      } else if (proposito === 'NA') {
+        this.formGroup.controls['ID_MANT_PREV'].disable();
+        this.formGroup.controls['ID_MANT_CORR'].disable();
+        this.formGroup.controls['ID_MANT_PREV'].setValue('');
+        this.formGroup.controls['ID_MANT_CORR'].setValue('');
+        this.formGroup.controls['ID_MANT_PREV'].clearValidators();
+        this.formGroup.controls['ID_MANT_CORR'].clearValidators();
+        this.formGroup.controls['ID_MANT_PREV'].updateValueAndValidity();
+        this.formGroup.controls['ID_MANT_CORR'].updateValueAndValidity();
+      }
+    });
+
+    this.filteredPreventiveMaintenance = this.formGroup.controls['ID_MANT_PREV'].valueChanges.pipe(
+      startWith(''),
+      map((value) => {
+        value = value === null || value === undefined ? '' : value;
+        const filterValue = value.toLowerCase();
+        return this.preventiveMaintenanceStr.filter((item) => item.toLowerCase().includes(filterValue));
+      })
+    )
+    this.filteredCorrectiveMaintenance = this.formGroup.controls['ID_MANT_CORR'].valueChanges.pipe(
+      startWith(''),
+      map((value) => {
+        value = value === null || value === undefined ? '' : value;
+        const filterValue = value.toLowerCase();
+        return this.correctiveMaintenanceStr.filter((item) => item.toLowerCase().includes(filterValue));
+      })
+    )
+  }
+
+  private async getPreventiveMaintenance() {
+    const idUser:string = this.resourcesService.getUser();
+    const line:number = this.resourcesService.getLineNumber();
+    await lastValueFrom(this._preventiveMaintenanceService.getActiveWorkOrders(idUser, line)).then(
+      (responseData: PreventiveWorkOrdersActiveResponse) => {
+        if ( !responseData.error ) {
+          this.arrPreventiveMaintenance = responseData.response;
+          this.preventiveMaintenanceStr = this.arrPreventiveMaintenance.map(
+            (preventiveWorkOrdersActive: PreventiveWorkOrdersActive) => `#${ preventiveWorkOrdersActive.IDORDEN }` )
+        } else {
+          this.resourcesService.openSnackBar(responseData.msg);
+        }
+      }, async (httpErrorResponse: HttpErrorResponse) => {
+        let response = this.resourcesService.checkErrors(httpErrorResponse)
+        if (response !== null && response.reload) {
+          await this.getPreventiveMaintenance();
+        }
+      }
+    );
+  }
+
+  private async getCorrectiveMaintenance() {
+    const idUser:string = this.resourcesService.getUser();
+    const line:number = this.resourcesService.getLineNumber();
+    await lastValueFrom(this._correctiveMaintenanceService.getWorkOrders(idUser, line)).then(
+      async (responseData: CorrectiveWorkOrdersListResponse) => {
+        if ( !responseData.error ) {
+          this.arrCorrectiveMaintenance = responseData.response;
+          this.correctiveMaintenanceStr = [];
+          await Promise.all(
+            this.arrCorrectiveMaintenance.map(async (correctiveWorkOrdersListItem: CorrectiveWorkOrdersListItem) => {
+              let decOrder = await this._encService.decrypt(correctiveWorkOrdersListItem.ID_ORDEN);
+              this.correctiveMaintenanceStr.push(`#${decOrder}`);
+            })
+          )
+        } else {
+          this.resourcesService.openSnackBar(responseData.msg);
+        }
+      }, async (httpErrorResponse: HttpErrorResponse) => {
+        let response = this.resourcesService.checkErrors(httpErrorResponse)
+        if (response !== null && response.reload) {
+          await this.getCorrectiveMaintenance();
+        }
+      }
+    );
+  }
+
+  private async getDispatchActive() {
+    const user: string = this.resourcesService.getUser();
+    const line: number = this.resourcesService.getLineNumber();
+    await lastValueFrom(this._distpachService.getDispatchActive(user, line)).then(
+      (responseData: ResponseDataDispatch) => {
+        if ( !responseData.error ) {
+          if (responseData.response.length === 0) {
+            this.resourcesService.openSnackBar('No hay despachos registrados en SAM');
+            this._dialogRef.close(false);
+          }
+          this.arrDispatch = responseData.response;
+          console.log(this.arrDispatch);
+          
+        } else {
+          this.resourcesService.openSnackBar(responseData.msg);
+        }
+      }, async (httpErrorResponse: HttpErrorResponse) => {
+        let response = this.resourcesService.checkErrors(httpErrorResponse)
+        if (response !== null && response.reload) {
+          await this.getDispatchActive();
+        }
+      }
+    );
+  }
+
+  public alert() {
+    this._dialog.open(AlertComponent, {
+      data: {
+        title: `Confirmación`,
+        description: `¿Está seguro de registrar la orden de compra?`,
+        icon: `warning`,
+      }
+    }).afterClosed().subscribe((result) => {
+      if (result) {
+        this.createOrder()
+      }
+    });
+  }
+
+  private async createOrder() {
+    this.isLoadingForm = true;
+    const objRequestOrder: RequestOrder | false = this.createRequestOrder();
+    if (objRequestOrder !== false) {
+      await lastValueFrom(this._acquisitionService.generateOrders(objRequestOrder)).then(
+        (responseData: ResponseData) => {
+          if (!responseData.error) {
+            this.resourcesService.openSnackBar(`¡Registro de Orden Exitosa!`);
+            this._router.navigate(['/sam/GEAD/ADQU/SEPE']);
+            this._dialogRef.close(true);
+          } else {
+            this.resourcesService.openSnackBar(`${responseData.error}`);
+          }
+        }, async (httpErrorResponse: HttpErrorResponse) => {
+          let response = this.resourcesService.checkErrors(httpErrorResponse)
+          if (response !== null && response.reload) {
+            await this.createOrder();
+          }
+        }
+      );
+    }
+    this.isLoadingForm = false;
+  }
+
+  private createRequestOrder(): RequestOrder | false {
+
+    let numeroSolicitud = this.requestLines.ID_LINEA_SOLICITUD.toString().trim();
+    
+    let despacho = this.formGroup.controls['DESPACHO'].value;
+    despacho = despacho.toString().trim();
+
+    let proposito = this.formGroup.controls['PROPOSITO'].value;
+
+    let idMantPrev = this.formGroup.controls['ID_MANT_PREV'].value;
+
+    let idMantCorr = this.formGroup.controls['ID_MANT_CORR'].value;
+
+    if (proposito === 'MANT-PREV' && idMantPrev !== null && idMantPrev !== '' && idMantPrev !== undefined) {
+      idMantPrev = idMantPrev.trim();
+      idMantPrev = idMantPrev.replace('#', '');
+      idMantCorr = null;
+    } else if (proposito === 'MANT-CORR' && idMantCorr !== null && idMantCorr !== '' && idMantCorr !== undefined) {
+      idMantCorr = idMantCorr.trim();
+      idMantCorr = idMantCorr.replace('#', '');
+      idMantPrev = null;
+    } else if (proposito === 'NA') {
+      idMantCorr = null;
+      idMantPrev = null;
+    } else {
+      this.resourcesService.openSnackBar(`Ocurrió un error al verificar el propósito.`)
+      return false;
+    }
+
+    let requestOrder:RequestOrder = {
+      NUMERO_SOLICITUD: numeroSolicitud,
+      DESPACHO: despacho,
+      PROPOSITO: proposito,
+      ID_MANT_PREV: idMantPrev,
+      ID_MANT_CORR: idMantCorr,
+      NUMERO_LINEA: this.resourcesService.getLineNumber(),
+      USUARIO: this.resourcesService.getUser(),
+    }
+    return requestOrder;
+  }
+}

+ 8 - 0
src/app/components/acquisition-management/acquisition/purchase-line/get-invoice-control/get-invoice-control.component.css

@@ -0,0 +1,8 @@
+input[type="file"] {
+    display: none;
+}
+
+textarea {
+    resize: none;
+    height: 72px !important;
+}

+ 41 - 1
src/app/components/acquisition-management/acquisition/purchase-line/get-invoice-control/get-invoice-control.component.html

@@ -1 +1,41 @@
-<p>get-invoice-control works!</p>
+<h2 mat-dialog-title>Subir Factura</h2>
+<mat-dialog-content>
+    <form class="override_content_flex mt-10" [formGroup]="formGroup">
+        <div class="col-flex-12">
+            <mat-form-field appearance="outline" class="w-100">
+                <mat-label>Tipo de Factura</mat-label>
+                <mat-select formControlName="typeInvoice">
+                    <mat-option value="Cotización">Cotización</mat-option>
+                    <mat-option value="Orden">Orden de Compra</mat-option>
+                </mat-select>
+            </mat-form-field>
+        </div>
+        <div class="col-flex-12">
+            <mat-form-field appearance="outline" class="w-100">
+                <mat-label> Descripción del Documento </mat-label>
+                <textarea matInput formControlName="description"></textarea>
+            </mat-form-field>
+        </div>
+        <div class="col-flex-12">
+            <div class='input-file mb-8 raised-button-background' onclick="getElementById('upfilePdf').click()">
+                <mat-icon matSuffix class="mr-5">file_upload </mat-icon>
+                <span> {{ nameButtonPdf }} </span>
+                <input id="upfilePdf" type="file" (change)="loadFile($event, 'PDF')" accept=".pdf"/>
+            </div>
+        </div>
+        <div class="col-flex-12">
+            <div class='input-file raised-button-background' onclick="getElementById('upfileXml').click()">
+                <mat-icon matSuffix class="mr-5">file_upload </mat-icon>
+                <span> {{ nameButtonXml }} </span>
+                <input id="upfileXml" type="file" (change)="loadFile($event, 'XML')" accept=".xml"/>
+            </div>
+        </div>
+    </form>
+    <!-- <div> <b>idArchivoPDF:</b> {{ formGroup.controls['idArchivoPDF'].value }} </div> -->
+    <!-- <div> <b>idArchivoXML:</b> {{ formGroup.controls['idArchivoXML'].value }} </div> -->
+    <!-- <div> <b>typeInvoice:</b> {{ formGroup.controls['typeInvoice'].value }} </div> -->
+</mat-dialog-content>
+<mat-dialog-actions align="end">
+    <button mat-button (click)="close()">Cerrar</button>
+    <button mat-button (click)="alert()" [disabled]="formGroup.invalid">Subir Factura</button>
+</mat-dialog-actions>

+ 190 - 2
src/app/components/acquisition-management/acquisition/purchase-line/get-invoice-control/get-invoice-control.component.ts

@@ -1,4 +1,15 @@
-import { Component } from '@angular/core';
+import { Component, Inject } from '@angular/core';
+import { FormControl, FormGroup, Validators } from '@angular/forms';
+import { ResourcesService, ResponseData } from '../../../../../services/resources.service';
+import { GdelService } from '../../../../../services/gdel.service';
+import { MAT_DIALOG_DATA, MatDialog, MatDialogRef } from '@angular/material/dialog';
+import { RequestLines } from '../../../../../interfaces/acquisition-management/order.interface';
+import { InvoiceService } from '../../../../../services/acquisition-management/invoice.service';
+import { lastValueFrom } from 'rxjs';
+import { ResponseDataUploadTempFile } from '../../../../../interfaces/gdel.interface';
+import { HttpErrorResponse } from '@angular/common/http';
+import { AlertComponent } from '../../../../resources/dialogs/alert/alert.component';
+import { RequestInvoice } from '../../../../../interfaces/acquisition-management/invoice.interface';
 
 @Component({
     selector: 'app-get-invoice-control',
@@ -7,5 +18,182 @@ import { Component } from '@angular/core';
     standalone: false
 })
 export class GetInvoiceControlComponent {
+  public isLoadingForm: boolean;
 
-}
+  // public idArchivoPDF: string;
+  // public idArchivoXML: string;
+  // public description:string;
+  // public typeInvoice:string;
+
+  public nameButtonPdf:string;
+  public nameButtonXml:string;
+
+
+  public formGroup: FormGroup;
+
+  constructor(
+    public resourcesService: ResourcesService,
+    private _gdelService: GdelService,
+    @Inject(MAT_DIALOG_DATA) public requestLines: RequestLines,
+    private invoiceService: InvoiceService,
+    private _dialog: MatDialog,
+    private _dialogRef: MatDialogRef<boolean>,
+  ) {
+    this.isLoadingForm = false;
+    // this.idArchivoPDF = '';
+    // this.idArchivoXML = '';
+    // this.typeInvoice = '';
+    // this.description = '';
+
+    this.formGroup = this.createFormGroup();
+
+    this.nameButtonPdf = 'Subir PDF';
+    this.nameButtonXml = 'Subir XML';
+  }
+
+  private createFormGroup () {
+    return new FormGroup({
+      idArchivoPDF: new FormControl('', Validators.required),
+      idArchivoXML: new FormControl('', Validators.required),
+      typeInvoice: new FormControl('', Validators.required),
+      description: new FormControl(''),
+    });
+  }
+
+  public async loadFile(event:any, typeDocument: string) {
+    let infoUpload: File = event.target.files[0];
+
+    if (typeDocument === 'PDF' && this.formGroup.controls['idArchivoPDF'].value !== '') {
+      await this.deleteTempFile(this.formGroup.controls['idArchivoPDF'].value);
+      this.formGroup.controls['idArchivoPDF'].setValue('');
+      this.nameButtonPdf = infoUpload.name;
+    } else if (typeDocument === 'PDF') {
+      this.nameButtonPdf = infoUpload.name;
+    }
+    if (typeDocument === 'XML' && this.formGroup.controls['idArchivoXML'].value !== '') {
+      await this.deleteTempFile(this.formGroup.controls['idArchivoPDF'].value);
+      this.formGroup.controls['idArchivoXML'].setValue('');
+      this.nameButtonXml = infoUpload.name;
+    } else if (typeDocument === 'XML') {
+      this.nameButtonXml = infoUpload.name;
+    }
+
+    await this.uploadTempFile(infoUpload, typeDocument);
+  }
+
+  private async deleteTempFile(idArchivo:string) {
+    this.isLoadingForm = true;
+    this.resourcesService.openSnackBar(`Eliminando Archivo Anterior ...`);
+    var myFormData = new FormData();
+    myFormData.append('id_file', idArchivo);
+    myFormData.append('id_user', this.resourcesService.getUser());
+    myFormData.append('linea', this.resourcesService.getLineNumber().toString());
+
+    await lastValueFrom(this._gdelService.deleteTempFile(myFormData)).then(
+      (responseData: ResponseDataUploadTempFile) => {
+        if (!responseData.error) {
+          this.resourcesService.openSnackBar(`¡Eliminación del archivo temporal exitosa!`);
+        } else {
+          this.resourcesService.openSnackBar(responseData.msg);
+        }
+      }, async (httpErrorResponse: HttpErrorResponse) => {
+        let response = this.resourcesService.checkErrors(httpErrorResponse)
+        if (response !== null && response.reload) {
+          await this.deleteTempFile(idArchivo);
+        }
+      }
+    );
+    this.isLoadingForm = false;
+  }
+
+  private async uploadTempFile(invoice: File, typeDocument: string) {
+    this.isLoadingForm = true;    
+    this.resourcesService.openSnackBar(`Subiendo Archivo ...`);
+    let myFormData = new FormData();
+    myFormData.append('file', invoice!);
+    myFormData.append('id_user', this.resourcesService.getUser());
+    myFormData.append('linea', this.resourcesService.getLineNumber().toString());
+
+    await lastValueFrom(this._gdelService.uploadTempFile(myFormData)).then(
+      (responseDataUploadTempFile: ResponseDataUploadTempFile) => {
+        if (!responseDataUploadTempFile.error) {
+          if (typeDocument === 'PDF') {
+            this.formGroup.controls['idArchivoPDF'].setValue(responseDataUploadTempFile.response.idArchivo);
+          } else {
+            this.formGroup.controls['idArchivoXML'].setValue(responseDataUploadTempFile.response.idArchivo);
+          }
+            
+          this.resourcesService.openSnackBar(`¡Archivo Subido!`);
+        } else {
+          this.resourcesService.openSnackBar(responseDataUploadTempFile.msg);
+        }
+      }, async (httpErrorResponse: HttpErrorResponse) => {
+        let response = this.resourcesService.checkErrors(httpErrorResponse)
+        if (response !== null && response.reload) {
+          await this.uploadTempFile(invoice, typeDocument);
+        }
+      }
+    );
+    this.isLoadingForm = false;
+  }
+
+  public async close() {
+    if (this.formGroup.controls['idArchivoPDF'].value !== '') {
+      await this.deleteTempFile(this.formGroup.controls['idArchivoPDF'].value);
+    }
+    
+    if (this.formGroup.controls['idArchivoXML'].value !== '') {
+      await this.deleteTempFile(this.formGroup.controls['idArchivoXML'].value);
+    }
+
+    this._dialogRef.close(false);
+  }
+
+  public alert() {
+    this._dialog.open(AlertComponent, {
+      disableClose: true,
+      data: {
+        icon: "warning",
+        title: "Confirmación",
+        description: `¿Está seguro de subir la información de la factura?`
+      },
+    }).afterClosed().subscribe((result) => {
+      if (result ) {
+        this.compareInvoice();
+      }
+    });
+  }
+
+  private async compareInvoice() {
+    this.isLoadingForm = true;
+
+    const requestInvoice:RequestInvoice = {
+      IDARCHIVOPDF: this.formGroup.controls['idArchivoPDF'].value,
+      IDARCHIVOXML: this.formGroup.controls['idArchivoXML'].value,
+      TYPE_INVOICE: this.formGroup.controls['typeInvoice'].value,
+      DESCRIPTION: this.formGroup.controls['description'].value,
+      ID_DOCUMENT: null,
+      USER: this.resourcesService.getUser(),
+      LINE_NUMBER: this.resourcesService.getLineNumber(),
+      REQUEST_LINE: this.requestLines.ID_LINEA_SOLICITUD.toString(),
+    }
+
+    await lastValueFrom(this.invoiceService.compareInvoice(requestInvoice)).then(
+      (responseData: ResponseData) => {
+        if (!responseData.error) {
+          this.resourcesService.openSnackBar(`¡La comparación de factura ha sido exitosa!`);
+          this._dialogRef.close(true);
+        } else {
+          this.resourcesService.openSnackBar(`${responseData.msg}`);
+        }
+      }, async (httpErrorResponse: HttpErrorResponse) => {
+        let response = this.resourcesService.checkErrors(httpErrorResponse)
+        if (response !== null && response.reload) {
+          await this.compareInvoice();
+        }
+      }
+    );
+
+    this.isLoadingForm = false;
+  }
+}

+ 1 - 1
src/app/components/acquisition-management/provider/artitle/artitle-description-form/artitle-description-form.component.html

@@ -87,7 +87,7 @@
             <ng-container matColumnDef="ACTIONS">
               <th mat-header-cell *matHeaderCellDef>Acciones</th>
               <td mat-cell *matCellDef="let element; let index = index;">
-                <button mat-mini-fab color="primary" [matMenuTriggerFor]="menu" #menuTrigger matTooltip="Desplegar opciones" class="override_no_shadow">
+                <button mat-mini-fab  [matMenuTriggerFor]="menu" #menuTrigger matTooltip="Desplegar opciones" class="override_no_shadow transparent_background gray_dark_font">
                   <mat-icon>more_vert</mat-icon>
                 </button>
                 <mat-menu #menu="matMenu">

+ 2 - 3
src/app/components/acquisition-management/provider/artitle/artitle-details/artitle-details.component.html

@@ -51,15 +51,14 @@
         <td mat-cell *matCellDef="let element; let index = index;" class="td_actions_2">
           <button 
             mat-mini-fab 
-            color="primary" 
             matTooltip="Editar" 
-            class="no_shadow ml-4" 
+            class="no_shadow ml-4 orange_primary_background white_font" 
             [disabled]="element.ESTADO === 'Eliminado'"
             (click)="openDialogForm('M', index)">
             <mat-icon>edit</mat-icon>
           </button>
           @if (element.ESTADO !== 'Eliminado') {
-            <button mat-mini-fab color="warn" matTooltip="Eliminar" class="no_shadow ml-4" (click)="updateState('E', index)">
+            <button mat-mini-fab color="warn" matTooltip="Eliminar" class="no_shadow ml-4 red_primary_background white_font" (click)="updateState('E', index)">
               <mat-icon>delete</mat-icon>
             </button>
           } @else {

+ 1 - 2
src/app/components/acquisition-management/provider/artitle/associated-provider/associated-provider.component.html

@@ -34,8 +34,7 @@
       <td mat-cell *matCellDef="let element">
         <button 
           mat-mini-fab 
-          color="primary" 
-          class="no_shadow" 
+          class="no_shadow transparent_background gray_dark_font" 
           matTooltip="Clic para desplegar" 
           [matMenuTriggerFor]="menu" 
           [disabled]="isLoading"

+ 1 - 1
src/app/components/acquisition-management/provider/providers/contact-provider/contact-provider.component.html

@@ -33,7 +33,7 @@
     <ng-container matColumnDef="ACCIONES">
       <th mat-header-cell *matHeaderCellDef mat-sort-header> Acciones </th>
       <td mat-cell *matCellDef="let element">
-        <button mat-mini-fab color="primary" class="override_no_shadow" matTooltip="Ver Información" (click)="openDialog(element)">
+        <button mat-mini-fab  class="override_no_shadow pink_primary_background white_font" matTooltip="Ver Información" (click)="openDialog(element)">
           <mat-icon>info</mat-icon>
         </button>
       </td>

+ 4 - 5
src/app/components/acquisition-management/provider/providers/provider-form/provider-form.component.html

@@ -539,8 +539,8 @@
                       <td mat-cell *matCellDef="let element" style="width: 120px;">
                         <button 
                           mat-mini-fab 
-                          class="override_no_shadow ml-4" 
-                          color="primary" 
+                          class="override_no_shadow ml-4 orange_primary_background white_font" 
+                          
                           (click)="openDialogContact('UPDATE', element)" 
                           [disabled]="element.ESTADO === 'Eliminado' || isLoading || isLoadingForm"
                           matTooltip="Editar">
@@ -548,12 +548,11 @@
                         </button>
                         <button 
                           mat-mini-fab 
-                          class="override_no_shadow ml-4" 
-                          color="warn" 
+                          class="override_no_shadow ml-4 white_font red_primary_background" 
                           (click)="deleteContact(element)" 
                           [disabled]="element.ESTADO === 'Eliminado' || isLoading || isLoadingForm"
                           matTooltip="Eliminar">
-                          <mat-icon>close</mat-icon>
+                          <mat-icon>delete</mat-icon>
                         </button>
                       </td>
                     </ng-container>