main.ts 2.67 KB
Newer Older
1
2
3
4
5
6
7
8
import { Component, Inject, OnInit, OnDestroy }
 from '@angular/core';
import {
  Router,
  ActivatedRoute,
}
 from '@angular/router';
import './globalstyles.css';
9
10
11
12
13
import { DevToolsExtension, NgRedux, select } from 'ng2-redux';
import {
  IAppState,
  rootReducer,
  middleware,
14
//  enhancers,
15
} from '../store';
16
// import { reimmutify } from '../store';
17

18
19
20
21
22
23
24

@Component({
  selector: 'main',
  template: `
  <div class="row">
    <div class="col-md-3">
      <ul class="nav nav-pills nav-stacked">
25
26
27
28
29
30
      <li [ngClass]="{active: path=='application-preview'}">
        <a [routerLink]="['/application-preview']">Προεπισκόπηση</a>
      </li>
      <li [ngClass]="{active: path=='sector-fields-select'}">
        <a [routerLink]="['/sector-fields-select']">Επιλογή Τομέα</a>
      </li>
31
32
33
      <li [ngClass]="{active: path=='course-fields-select'}">
        <a [routerLink]="['/course-fields-select']">Επιλογή Ειδικότητας</a>
      </li>
34
35
36
      <li [ngClass]="{active: path=='sectorcourses-fields-select'}">
        <a [routerLink]="['/sectorcourses-fields-select']">Επιλογή Ειδικότητας με βάση τον τομέα</a>
      </li>
37
38
39
      <li [ngClass]="{active: path=='region-schools-select'}">
        <a [routerLink]="['/region-schools-select']">Επιλογή Σχολείου</a>
      </li>
40
41
      <li [ngClass]="{active: path=='student-application-form-main'}">
        <a [routerLink]="['/student-application-form-main']">Αίτηση μαθητή / Καταχώρηση προσωπικών στοιχείων</a>
42
43
44
45
      </li>
      <li [ngClass]="{active: path=='students-list'}">
        <a [routerLink]="['/students-list']">Μαθητές</a>
      </li>
46
47
48
      <li [ngClass]="{active: path=='form3'}">
        <a [routerLink]="['/form3']">Αίτηση</a>
      </li>
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
      </ul>
    </div>
    <div class="col-md-9">
      <div class="panel panel-primary">
        <div class="panel-heading">
          <h3 class="panel-title">{{path || 'home' | camelcase }}</h3>
        </div>
        <div class="panel-body">
          <router-outlet></router-outlet>
        </div>
      </div>
    </div>
  </div>
  `
})
export default class Main {
  public path: string = '';

  constructor(
    private router: Router,
69
70
71
    private activatedRoute: ActivatedRoute,
    private _ngRedux: NgRedux<IAppState>,
    private _devTools: DevToolsExtension
72
73
74
75
76
  ) {
    router.events.subscribe((data) => {
      this.path = data.url.substr(1);
    });

77
78

    const tools = _devTools.enhancer({
79
80
//      deserializeState: reimmutify,
  });
81
82
83
84
85
86
87
    _ngRedux.configureStore(
      rootReducer,
      {},
      middleware,
//      tools ? [ ...enhancers, tools ] : enhancers);
      tools);
  }
88
}