import { Component, Inject } from '@angular/core';
import { MAT_DIALOG_DATA } from '@angular/material/dialog';
import { HistoryOrder } from '../../../../../interfaces/acquisition-management/order.interface';

@Component({
    selector: 'app-details-state-order',
    templateUrl: './details-state-order.component.html',
    styleUrl: './details-state-order.component.css',
    standalone: false
})
export class DetailsStateOrderComponent {
  public isLoadingForm: boolean;
  public imgItem: number;
  
  constructor(
    @Inject(MAT_DIALOG_DATA) public dataElement: HistoryOrder,
  ) {
    this.isLoadingForm = false;
    this.imgItem = 0;
  }

  public changeImage(type: 'izq' | 'der') {
    
    if (this.dataElement.EVIDENCIA !== null)
    if (type === 'izq') {
      if (this.imgItem === 0) {
        let cantImg: number = this.dataElement.EVIDENCIA.length;
        this.imgItem = cantImg - 1;
      } else {
        this.imgItem--;
      }
    } else if (type === 'der') {
      let cantImg: number = this.dataElement.EVIDENCIA.length;

      if (this.imgItem === cantImg - 1) {
        this.imgItem = 0
      } else {
        this.imgItem++;
      }
    } else {

    }
  }
}
