import {Component, Inject, Injectable} from '@angular/core';
import {FormBuilder, FormControl, FormGroup, Validators} from '@angular/forms';
import {Router} from '@angular/router';
import {User, UsersService} from '../../../../classes/resorcess/users.service';
import {MAT_DIALOG_DATA, MatDialogRef} from '@angular/material';
import {RolesService} from '../../../../classes/resorcess/roles.service';
import {Dialog} from '../../../../classes/base_components/dialog/dialog';
import {EditComponent} from '../../../../classes/base_components/edit/edit.component';
import {HttpClient, HttpEventType} from '@angular/common/http';


@Component({
  selector: 'app-edit-users',
  templateUrl: './edit-users.component.html',
  styleUrls: ['./edit-users.component.scss']
})

export class EditUsersComponent extends EditComponent {

  constructor(private fb: FormBuilder,
              private roleService: RolesService,
              private router: Router,
              private usersService: UsersService,
              protected  dialog: Dialog,
              private http: HttpClient,
              public  dialogRef: MatDialogRef<EditUsersComponent>,
              @Inject(MAT_DIALOG_DATA)  data,
  ) {
    super();
  }

  onSubmit() {
    // if (!this.form.valid) {
    //   this.loading = false;
    //   return;
    // }
    // this.user.save({},
    //   () => {
    //     this.close();
    //   },
    //   (error) => {
    //     console.log('error', error);
    //
    //     const JsonV = error.errors;
    //     setErrors(JsonV, this.form.controls, this.dialog);
    //   });
  }

  close() {
    this.dialogRef.close(true);
  }
}





