import { Pipe, PipeTransform } from '@angular/core';
import {data} from "autoprefixer";

@Pipe({
    name: 'checkseat'
})
export class CheckseatPipe implements PipeTransform {

    transform(array: any): unknown {
        if(!array) return 'ข้อมูลไม่ถูกต้อง '
        let sumSeat:any = 0
        for (let i = 0; i < array.length; i++) {
            if(array[i].start_seat_no != null && array[i].end_seat_no != null && array[i].start_seat_no !== 0 && array[i].end_seat_no !== 0){
                sumSeat += array[i].end_seat_no - array[i].start_seat_no + 1;
            }
        }
        return sumSeat
    }

}
