import {Component, OnInit, ChangeDetectionStrategy, ChangeDetectorRef} from '@angular/core';
import {Router} from '@angular/router';
import {TestingInformationService} from '../../../../../core/service/testing-information/testing-information.service';
import {SweetalertService} from '../../../../../core/service/sweetalert/sweetalert';
import {MatDialog} from '@angular/material/dialog';
import {Observable} from 'rxjs';

@Component({
  selector: 'app-extend-information-room',
  templateUrl: './extend-information-room.container.html',
  styleUrls: ['./extend-information-room.container.scss'],
  changeDetection: ChangeDetectionStrategy.OnPush
})
export class ExtendInformationRoomContainer implements OnInit {
  subjectList$ = new Observable();

  constructor(
    private router: Router,
    private TestinforSV: TestingInformationService,
    private cdr: ChangeDetectorRef,
    private swSV: SweetalertService,
    private dialog: MatDialog,
  ) { }

  ngOnInit(): void {
    this.subjectList$ = this.TestinforSV.getAll();
  }

  search(query){
    if(query) return this.subjectList$ = this.TestinforSV.search(`?${query}`);
    if(!query) return this.subjectList$ = this.TestinforSV.getAll();
  }

  edit(id){
    this.router.navigate(['extend-information-room/edit', id]);
  }

}
