
import {
  Component,
  ElementRef,
  OnDestroy,
  OnInit,
  ViewChild,
  ViewEncapsulation
} from '@angular/core';
import { fuseAnimations } from 'src/@fuse/animations';
import { BehaviorSubject, fromEvent, merge, Observable, Subject } from 'rxjs';
import { MatPaginator } from '@angular/material/paginator';
import { MatSort } from '@angular/material/sort';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';

@Component({
  selector: 'app-user-connect',
  templateUrl: './user-connect.component.html',
  styleUrls: ['./user-connect.component.scss'],
  animations: fuseAnimations,
  encapsulation: ViewEncapsulation.None
})
export class UserConnectComponent implements OnInit, OnDestroy {
  form: FormGroup;

  displayedColumns = [
    'id',
    'phone',
    'currentLocation',
    'registIp',
    'registTime',
    'holdMoney',
    'point',
    'fire',

  ];

  @ViewChild(MatPaginator, { static: true })
  paginator: MatPaginator;

  @ViewChild('filter', { static: true })
  filter: ElementRef;

  @ViewChild(MatSort, { static: true })
  sort: MatSort;

  // Private
  private _unsubscribeAll: Subject<any>;

  /**
   * Constructor
   */
  constructor(
    private _formBuilder: FormBuilder
  ) {
    // Set the private defaults
    this._unsubscribeAll = new Subject();
  }

  ngOnInit() {
    this.form = this._formBuilder.group({
      // company: [
      //   {
      //     value: 'Google',
      //     disabled: true
      //   }, Validators.required
      // ],
      firstName: ['', Validators.required],
      // lastName: ['', Validators.required],
      // address: ['', Validators.required],
      // address2: ['', Validators.required],
      // city: ['', Validators.required],
      // state: ['', Validators.required],
      // postalCode: ['', [Validators.required, Validators.maxLength(5)]],
      // country: ['', Validators.required]
    });
  }

  ngOnDestroy(): void {
    // Unsubscribe from all subscriptions
    this._unsubscribeAll.next();
    this._unsubscribeAll.complete();
  }
}
