662d8d3f3272fad7f9b6a31d0fd8f9e30d121fdf
[ccsdk/cds.git] /
1 import { Component, OnInit } from '@angular/core';
2 import { ActivatedRoute } from '@angular/router';
3 import { PackageCreationStore } from '../package-creation.store';
4 import { SharedService } from './shared-service';
5
6 @Component({
7     selector: 'app-template-mapping',
8     templateUrl: './template-mapping.component.html',
9     styleUrls: ['./template-mapping.component.css']
10 })
11 export class TemplateMappingComponent implements OnInit {
12     creationView = false;
13     listView = true;
14
15     constructor(
16         private route: ActivatedRoute,
17         private pakcageStore: PackageCreationStore,
18         private sharedService: SharedService
19     ) {
20     }
21
22     ngOnInit() {
23
24         if (this.route.snapshot.paramMap.has('id')) {
25             console.log('Edit mode');
26             this.creationView = true;
27             this.listView = false;
28             console.log('URL contains Id');
29             this.sharedService.enableEdit();
30         } else {
31             console.log('Create mode');
32             this.pakcageStore.clear();
33             this.sharedService.disableEdit();
34         }
35     }
36     openCreationView() {
37         this.creationView = false;
38         this.listView = true;
39     }
40
41     openListView() {
42         this.listView = false;
43         this.creationView = false;
44     }
45
46     closeCreationView() {
47         this.creationView = true;
48         this.listView = false;
49     }
50
51 }