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