import { Component, OnInit, ViewChild, Input } from '@angular/core';
import { ActivatedRoute, RouterOutlet, Router } from '@angular/router';
import { CompTableListComponent } from '../../../app/comp-table/comp-table-list/comp-table-list.component';
import { EduTextbook } from '../../../schemas/EduTextbook';
import { NzPageHeaderModule } from 'ng-zorro-antd/page-header';
import { NzBreadCrumbModule } from 'ng-zorro-antd/breadcrumb';
import * as Parse from 'parse';
import { CommonModule } from '@angular/common';
import { textbookServer } from '../../../services/textbook';
import { TextbookComponent } from '../../../app/textbook/textbook.component';
@Component({
  selector: 'app-page-textbook',
  templateUrl: './page-textbook.component.html',
  styleUrls: ['./page-textbook.component.scss'],
  imports: [
    CommonModule,
    RouterOutlet,
    TextbookComponent,
    CompTableListComponent,
    NzPageHeaderModule,
    NzBreadCrumbModule,
  ],
  standalone: true,
})
export class PageTextbookComponent implements OnInit {
  @ViewChild(CompTableListComponent) list: CompTableListComponent | undefined;
  @Input('discard') discard: boolean = false;
  @Input('render') render: boolean = false;

  EduTextbook = EduTextbook;
  user: Parse.User | undefined;
  className: string | undefined;
  queryParams: any | undefined;
  fieldsArray: Array<any> | undefined;

  constructor(
    public tbookSer: textbookServer,
    private router: Router,
    private activeRoute: ActivatedRoute // private translate:TranslateService,
  ) {
    this.user = Parse.User.current();
    this.className = this.EduTextbook.className;
    this.fieldsArray = this.EduTextbook.fieldsArray;
    this.queryParams = {
      where: {
        isDeleted: { $ne: true },
        render: true,
        discard: { $ne: true },
        department: this.tbookSer.profile.user.department?.objectId,
      },
    };
  }

  ngOnInit(): void {}
}
