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

@Pipe({
    name: 'checkinrange'
})
export class CheckinrangePipe implements PipeTransform {

    transform(AllSeat: any , StartSeatNo: any , EndSeatNo: any): any {
        const ArrayAllSeat = AllSeat.testing_seat_subjects;
        const StartNo = StartSeatNo;
        const EndNo = EndSeatNo;
        let isInRange = false;
        for (let i = 0; i < ArrayAllSeat.length; i++ ){
            if (StartNo != null && ArrayAllSeat[i].start_seat_no !== null && ArrayAllSeat[i].end_seat_no != null){
                if (StartNo > ArrayAllSeat[i].start_seat_no && StartNo <= ArrayAllSeat[i].end_seat_no || EndNo >= ArrayAllSeat[i].start_seat_no && EndNo < ArrayAllSeat[i].start_seat_no) {
                    isInRange = true;
                }
            }
        }
        return isInRange;
    }

}
