import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'ngx-customers-add-edit-three',
  templateUrl: './customers-add-edit-three.component.html',
  styleUrls: ['./customers-add-edit-three.component.scss']
})
export class CustomersAddEditThreeComponent implements OnInit {

  constructor() { }
  numOfBranshs : number;
  numOfEmployees: number;

  company_branches = [
    {
       branch_name : '',        
       branch_users : [
          {
             name : '',
             email : '',
             type : '',
             password : '',
             password_confirmation : ''
          }     
       ]

    }]

  ngOnInit() {
    this.numOfBranshs = this.company_branches.length;
    this.numOfEmployees = this.company_branches[1].branch_users.length;
  }
  plusEmployee(i){
    this.company_branches[i].branch_users.push(
      {
        name : '',
        email : '',
        type : '',
        password : '',
        password_confirmation : ''
     }    
    )
  }
  plusBransh(){
    this.company_branches.push(
      {
        branch_name : '',        
        branch_users : [
           {
              name : '',
              email : '',
              type : '',
              password : '',
              password_confirmation : ''
           }     
        ]
 
     }
    )
  }
  onDeleteEployee(i,j){
    this.company_branches[i].branch_users.slice(j, 1);
  }
  onDeleteBransh(i){
    this.company_branches.slice(i , 1);
  }
onSubmit(){

}

}
