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 { TextbookComponent } from '../../../app/textbook/textbook.component';
@Component({
  selector: 'app-page-textbook',
  templateUrl: './page-textbook.component.html',
  styleUrls: ['./page-textbook.component.scss'],
  imports: [
    CommonModule,
    RouterOutlet,
    CompTableListComponent,
    NzPageHeaderModule,
    NzBreadCrumbModule,
    TextbookComponent,
  ],
  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;
  filterObj: any = {
    showMore: true, //显示更多字段
    isCheck: false,
    status: ['400'],
    btns: {review:true},
  };
  constructor(
    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 },
      },
    };
  }

  ngOnInit(): void {
    // this.queryParams.where = {
    //   isDeleted: { $ne: true },
    //   discard: this.discard ? { $eq: true } : { $ne: true },
    //   render: this.render ? { $eq: true } : { $ne: true },
    // };
  }
}
