import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { Store } from '@ngxs/store';
import { AddBreadcrumb } from 'apps/sales/src/app/core/store/actions/breadcrumb.actions';
import { ChangeCurrentRoute } from 'apps/sales/src/app/core/store/actions/process.actions';
import { SetBranchProcessCurrentPath } from 'apps/sales/src/app/core/store/actions/branch-process.actions';

@Component({
  selector: 'app-branch-main',
  templateUrl: './branch-main.component.html',
  styleUrls: ['./branch-main.component.scss'],
})
export class BranchMainComponent implements OnInit {
  constructor(private router: Router, private store: Store) {}

  ngOnInit() {}

  navigateToGodsIn() {
    const path = '/goodsin/search';
    this.store.dispatch(
      new AddBreadcrumb(
        {
          name: 'Bestellpostensuche',
          path: path,
        },
        'goodsin'
      )
    );
    this.store.dispatch(new SetBranchProcessCurrentPath(path));
    this.router.navigate([path]);
  }
}
