Project

General

Profile

1
import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
2
import { ErrorHandlingService } from 'src/app/shared/services/error-handling/error-handling.service';
3
import {ConfiguratorParameter} from '../../../shared/models/configurator-parameter.interface';
4
import {ConfiguratorService} from "../../../shared/services/administration/configurator.service";
5

    
6
@Component({
7
  selector: 'app-configurator',
8
  templateUrl: './configurator.component.html',
9
  styleUrls: ['./configurator.component.scss']
10
})
11
export class ConfiguratorComponent implements OnInit {
12

    
13
  // @Input() parametersListInput: [ConfiguratorParameter];
14
  // @Input() editParameterRequestInput: ConfiguratorParameter;
15
  // @Output() editEventRequest = new EventEmitter<ConfiguratorParameter>();
16

    
17
  parametersList: ConfiguratorParameter[];
18
  editEventRequest: ConfiguratorParameter;
19
  loading = true;
20

    
21
  constructor(private configuratorService: ConfiguratorService, private errorHandlingService: ErrorHandlingService) { }
22

    
23
  ngOnInit(): void {
24

    
25
    this.initData();
26
    console.log('this.parametersList: ' + JSON.stringify(this.parametersList));
27
  }
28

    
29
  initData() {
30
    this.loading = true;
31
    this.configuratorService.getConfiguratorParameters().subscribe(values => {
32
      this.parametersList = values;
33
        this.loading = false;
34
        console.log('IN this.parametersList: ' + JSON.stringify(this.parametersList));
35
    },
36
      err => {
37
        this.errorHandlingService.showHttpResponseError(err);
38
        this.loading = false;
39
      });
40
  }
41

    
42
  editEvent(request) {
43
    this.editEventRequest = request;
44
  }
45

    
46
  passNewConfigurator(newConfigurator: ConfiguratorParameter){
47
    this.initData();
48

    
49
  }
50

    
51
}
(4-4/4)