341d29f6698fa11ad16f3280a36487222aabc564
[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             if (this.pakcageStore.istemplateExist()) {
30                 this.sharedService.enableEdit();
31             }
32         } else {
33             console.log('Create mode');
34             this.pakcageStore.clear();
35             this.sharedService.disableEdit();
36         }
37     }
38     openCreationView() {
39         console.log('open creation view');
40         this.creationView = false;
41         this.listView = true;
42     }
43
44     openListView() {
45         console.log('open list view');
46         this.creationView = true;
47         this.listView = false;
48
49     }
50
51 }