Commit 955e6df3 authored by Open Source Developer's avatar Open Source Developer
Browse files

interface changes

parent 1203a4fb
...@@ -14,3 +14,9 @@ epal_auth_test: ...@@ -14,3 +14,9 @@ epal_auth_test:
requirements: requirements:
_permission: 'access content' _permission: 'access content'
_user_is_logged_in: 'TRUE' _user_is_logged_in: 'TRUE'
current_user:
path: '/epal/curuser'
defaults:
_controller: '\Drupal\epal\Controller\CurrentUser::content'
requirements:
_access: 'TRUE'
<?php
/**
* @file
* Contains \Drupal\query_example\Controller\QueryExampleController.
*/
namespace Drupal\epal\Controller;
use Drupal\Core\Entity\Query\QueryFactory;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
use Drupal\Core\Controller\ControllerBase;
class CurrentUser extends ControllerBase {
public function content() {
// $name = \Drupal\user\Entity\User::load(\Drupal::currentUser()->id());
$name = "LALALA";
$authToken = "no authToken";
$accessKey = "no accessKey";
if (\Drupal::request()->headers->has('X-AUTH-TOKEN')) {
$authToken = \Drupal::request()->headers->get( 'X-AUTH-TOKEN' );
}
if (\Drupal::request()->headers->has('X-ACCESS-KEY')) {
$accessKey = \Drupal::request()->headers->get( 'X-ACCESS-KEY' );
}
$response = new JsonResponse([$name]);
$response->headers->set('X-AUTH-TOKEN', 'HELLOTOKEN');
return $response;
}
}
...@@ -130,3 +130,6 @@ public function helloWorld() { ...@@ -130,3 +130,6 @@ public function helloWorld() {
} }
} }
...@@ -13,6 +13,7 @@ export class RegionSchoolsActions { ...@@ -13,6 +13,7 @@ export class RegionSchoolsActions {
getRegionSchools = (classActive,courseActive, reload) => { getRegionSchools = (classActive,courseActive, reload) => {
const { regions } = this._ngRedux.getState(); const { regions } = this._ngRedux.getState();
if (reload === true || (reload === false && regions.size === 0)) { if (reload === true || (reload === false && regions.size === 0)) {
console.log("test1", classActive,courseActive, reload);
return this._hds.getRegionsWithSchools(classActive,courseActive).then(regions => { return this._hds.getRegionsWithSchools(classActive,courseActive).then(regions => {
return this._ngRedux.dispatch({ return this._ngRedux.dispatch({
type: REGIONSCHOOLS_RECEIVED, type: REGIONSCHOOLS_RECEIVED,
......
...@@ -29,6 +29,7 @@ import {HelperDataService} from './services/helper-data-service'; ...@@ -29,6 +29,7 @@ import {HelperDataService} from './services/helper-data-service';
//import {UserDataService} from './services/user-data-service'; //import {UserDataService} from './services/user-data-service';
import {AmkaCheckService} from './services/amkacheck-service'; import {AmkaCheckService} from './services/amkacheck-service';
import {LoaderService} from './services/Spinner.service';
//import {UserDataService} from './services/user-data-service'; //import {UserDataService} from './services/user-data-service';
...@@ -82,6 +83,7 @@ class MyLocalization extends NgLocalization { ...@@ -82,6 +83,7 @@ class MyLocalization extends NgLocalization {
HelperDataService, HelperDataService,
AmkaCheckService, AmkaCheckService,
LoaderService,
] ]
}) })
......
...@@ -19,9 +19,6 @@ ...@@ -19,9 +19,6 @@
<div class="col-sm-12 col-md-9"> <div class="col-sm-12 col-md-9">
<div class="main-content"> <div class="main-content">
<div class="panel panel-primary"> <div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">{{path || 'home' | camelcase }}</h3>
</div>
<div class="panel-body"> <div class="panel-body">
<router-outlet></router-outlet> <router-outlet></router-outlet>
</div> </div>
......
...@@ -9,6 +9,9 @@ ...@@ -9,6 +9,9 @@
</a> </a>
<div class="collapse navbar-collapse flex-row-reverse" id="navbarNav"> <div class="collapse navbar-collapse flex-row-reverse" id="navbarNav">
<ul class="navbar-nav"> <ul class="navbar-nav">
<b>Όνομα Χρήστη:</b> {{this.cuser}}
<!--
<li class="nav-item" [ngClass]="{active: path=='application-preview'}"> <li class="nav-item" [ngClass]="{active: path=='application-preview'}">
<a class="nav-link" [routerLink]="['/application-preview']" [routerLinkActive]="['active']">Προεπισκόπηση</a> <a class="nav-link" [routerLink]="['/application-preview']" [routerLinkActive]="['active']">Προεπισκόπηση</a>
</li> </li>
...@@ -30,6 +33,8 @@ ...@@ -30,6 +33,8 @@
<li class="nav-item" [ngClass]="{active: path=='student-application-form-main'}"> <li class="nav-item" [ngClass]="{active: path=='student-application-form-main'}">
<a class="nav-link" [routerLink]="['/student-application-form-main']" [routerLinkActive]="['active']">Αιτηση</a> <a class="nav-link" [routerLink]="['/student-application-form-main']" [routerLinkActive]="['active']">Αιτηση</a>
</li> </li>
-->
<!-- <!--
<li class="nav-item" [ngClass]="{active: path=='schools-order-select'}"> <li class="nav-item" [ngClass]="{active: path=='schools-order-select'}">
<a class="nav-link" [routerLink]="['/schools-order-select']" [routerLinkActive]="['active']">Σειρά επιλογής</a> <a class="nav-link" [routerLink]="['/schools-order-select']" [routerLinkActive]="['active']">Σειρά επιλογής</a>
......
import {Component} from '@angular/core'; import {Component, OnInit} from '@angular/core';
import { Injectable } from "@angular/core";
import { HelperDataService } from '../../services/helper-data-service';
@Component({ @Component({
selector: 'reg-navbar', selector: 'reg-navbar',
templateUrl: 'navbar.component.html', templateUrl: 'navbar.component.html',
}) })
export default class NavbarComponent {
@Injectable() export default class NavbarComponent implements OnInit{
public cuser :any;
constructor( private _hds: HelperDataService) {
};
ngOnInit() {
this._hds.getCurrentUser().then( cuser => this.cuser= cuser );
}
} }
...@@ -38,7 +38,7 @@ import {AppSettings} from '../../app.settings'; ...@@ -38,7 +38,7 @@ import {AppSettings} from '../../app.settings';
<div class="row"> <div class="row">
<div class="col-md-12 col-md-offset-5"> <div class="col-md-12 col-md-offset-5">
<button type="button" class="btn-primary btn-lg pull-right" (click)="saveSelected()"> <button type="button" class="btn-primary btn-lg pull-right" (click)="saveSelected()">
Συνέχεια </button> <i class="fa fa-forward"></i> </button>
</div> </div>
<div *ngIf="emptyselection==true"> <div *ngIf="emptyselection==true">
Παρακαλώ συμπληρώστε το ΑΜΚΑ του μαθητή Παρακαλώ συμπληρώστε το ΑΜΚΑ του μαθητή
......
...@@ -132,12 +132,12 @@ ...@@ -132,12 +132,12 @@
<div class="row"> <div class="row">
<div class="col-md-2 col-md-offset-4"> <div class="col-md-2 col-md-offset-4">
<button type="button" class="btn-primary btn-lg pull-center" (click)="saveSelected()"> <button type="button" class="btn-primary btn-lg pull-center" (click)="saveSelected()">
<span class="glyphicon glyphicon-menu-left"></span>Πίσω <i class="fa fa-backward"></i>
</button> </button>
</div> </div>
<div class="col-md-8"> <div class="col-md-8">
<button type="button" class="btn-primary btn-lg pull-right" (click)="submitSelected()" [disabled]="studentDataGroup.invalid"> <button type="button" class="btn-primary btn-lg pull-right" (click)="submitSelected()" [disabled]="studentDataGroup.invalid">
Συνέχεια<span class="glyphicon glyphicon-menu-right"></span> <i class="fa fa-forward"></i>
</button> </button>
</div> </div>
</div> </div>
......
...@@ -34,7 +34,7 @@ import {AppSettings} from '../../app.settings'; ...@@ -34,7 +34,7 @@ import {AppSettings} from '../../app.settings';
<div class="row"> <div class="row">
<div class="col-md-12 col-md-offset-5"> <div class="col-md-12 col-md-offset-5">
<button type="button" class="btn-primary btn-lg pull-right" (click)="saveSelected()"> <button type="button" class="btn-primary btn-lg pull-right" (click)="saveSelected()">
Συνέχεια<span class="glyphicon glyphicon-menu-right"></span> <i class="fa fa-forward"></i>
</button> </button>
</div> </div>
</div> </div>
......
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
import { Observable } from 'rxjs/Rx'; import { Observable } from 'rxjs/Rx';
import { Injectable } from "@angular/core"; import { Injectable } from "@angular/core";
import { EpalClassesActions } from '../../actions/epalclass.actions'; import { EpalClassesActions } from '../../actions/epalclass.actions';
import { NgRedux, select } from 'ng2-redux'; import { NgRedux, select } from 'ng2-redux';
import { IEpalClasses } from '../../store/epalclasses/epalclasses.types'; import { IEpalClasses } from '../../store/epalclasses/epalclasses.types';
import { SectorFieldsActions } from '../../actions/sectorfields.actions';
import { RegionSchoolsActions } from '../../actions/regionschools.actions';
import { SectorCoursesActions } from '../../actions/sectorcourses.actions';
import { IAppState } from '../../store/store'; import { IAppState } from '../../store/store';
import { import {
FormBuilder, FormBuilder,
...@@ -22,7 +25,7 @@ import {AppSettings} from '../../app.settings'; ...@@ -22,7 +25,7 @@ import {AppSettings} from '../../app.settings';
<div *ngFor="let epalclass$ of epalclasses$ | async;"> </div> <div *ngFor="let epalclass$ of epalclasses$ | async;"> </div>
<div class="form-group"> <div class="form-group">
<label for="name">Παρακαλώ επιλέξτε την τάξη εισαγωγής του μαθητή στην Επαγγελματική Εκπαίδευση</label><br/> <label for="name">Παρακαλώ επιλέξτε την τάξη εισαγωγής του μαθητή στην Επαγγελματική Εκπαίδευση</label><br/>
<select class="form-control" formControlName="name"> <select class="form-control" formControlName="name" (change)="initializestore()">
<option value="Α' Λυκείου">Α' Λυκείου</option> <option value="Α' Λυκείου">Α' Λυκείου</option>
<option value="Β' Λυκείου">Β' Λυκείου</option> <option value="Β' Λυκείου">Β' Λυκείου</option>
<option value="Γ' Λυκείου">Γ' Λυκείου</option> <option value="Γ' Λυκείου">Γ' Λυκείου</option>
...@@ -32,7 +35,7 @@ import {AppSettings} from '../../app.settings'; ...@@ -32,7 +35,7 @@ import {AppSettings} from '../../app.settings';
<div class="row"> <div class="row">
<div class="col-md-12 col-md-offset-5"> <div class="col-md-12 col-md-offset-5">
<button type="button" class="btn-primary btn-lg pull-right" (click)="saveSelected()"> <button type="button" class="btn-primary btn-lg pull-right" (click)="saveSelected()">
Συνέχεια<span class="glyphicon glyphicon-menu-right"></span> <i class="fa fa-forward"></i>
</button> </button>
</div> </div>
</div> </div>
...@@ -54,6 +57,9 @@ import {AppSettings} from '../../app.settings'; ...@@ -54,6 +57,9 @@ import {AppSettings} from '../../app.settings';
constructor(private fb: FormBuilder, constructor(private fb: FormBuilder,
private _cfa: EpalClassesActions, private _cfa: EpalClassesActions,
private _ngRedux: NgRedux<IAppState>, private _ngRedux: NgRedux<IAppState>,
private _csa: SectorCoursesActions,
private _sfa: SectorFieldsActions,
private _rsa: RegionSchoolsActions,
private router: Router) { private router: Router) {
this.formGroup = this.fb.group({ this.formGroup = this.fb.group({
name: [] name: []
...@@ -92,4 +98,15 @@ import {AppSettings} from '../../app.settings'; ...@@ -92,4 +98,15 @@ import {AppSettings} from '../../app.settings';
} }
} }
initializestore()
{
this._cfa.saveEpalClassesSelected(this.formGroup.value);
this._sfa.getSectorFields(true);
this._rsa.getRegionSchools(1,"-1", true);
this._csa.getSectorCourses(true);
}
} }
...@@ -5,11 +5,11 @@ import { Injectable } from "@angular/core"; ...@@ -5,11 +5,11 @@ import { Injectable } from "@angular/core";
import { RegionSchoolsActions } from '../../actions/regionschools.actions'; import { RegionSchoolsActions } from '../../actions/regionschools.actions';
import { NgRedux, select } from 'ng2-redux'; import { NgRedux, select } from 'ng2-redux';
import { IRegions } from '../../store/regionschools/regionschools.types'; import { IRegions } from '../../store/regionschools/regionschools.types';
import { SectorCoursesActions } from '../../actions/sectorcourses.actions'; import { SectorCoursesActions } from '../../actions/sectorcourses.actions';
import { ISectors } from '../../store/sectorcourses/sectorcourses.types'; import { ISectors } from '../../store/sectorcourses/sectorcourses.types';
import { IAppState } from '../../store/store'; import { IAppState } from '../../store/store';
import { LoaderService } from '../../services/Spinner.service';
import {RemoveSpaces} from '../../pipes/removespaces';
import { import {
...@@ -23,6 +23,8 @@ import {AppSettings} from '../../app.settings'; ...@@ -23,6 +23,8 @@ import {AppSettings} from '../../app.settings';
@Component({ @Component({
selector: 'course-fields-select', selector: 'course-fields-select',
template: ` template: `
<div class = "loading" *ngIf="objLoaderStatus">
</div>
<div class="row equal"> <div class="row equal">
<div class="col-md-12"> <div class="col-md-12">
<form [formGroup]="formGroup"> <form [formGroup]="formGroup">
...@@ -34,27 +36,28 @@ import {AppSettings} from '../../app.settings'; ...@@ -34,27 +36,28 @@ import {AppSettings} from '../../app.settings';
</li> </li>
<div *ngFor="let epal$ of region$.epals; let j=index;" [hidden]="i !== regionActive"> <div *ngFor="let epal$ of region$.epals; let j=index;" [hidden]="i !== regionActive">
<li class="list-group-item" >
<div class="row"> <div class="row">
<div class="col-md-2"> <div class="col-md-2 col-md-offset-1">
<input #cb type="checkbox" formControlName="{{ epal$.globalIndex }}" <input #cb type="checkbox" formControlName="{{ epal$.globalIndex }}"
(change)="saveSelected(cb,j)" (change)="saveSelected(cb,j)"
[hidden] = "numSelected === 3 && cb.checked === false" [hidden] = "numSelected === 3 && cb.checked === false"
> >
</div> </div>
<div class="col-md-10"> <div class="col-md-8 col-md-offset-1">
{{epal$.epal_name}} {{epal$.epal_name | removeSpaces}}
</div> </div>
</div> </div>
</li>
</div> </div>
</div> </div>
</ul> </ul>
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-12 col-md-offset-5"> <div class="col-md-12 col-md-offset-5">
<button type="button" class="btn-primary btn-lg pull-right" (click)="navigateToApplication()" [disabled] = "numSelected === 0" > <button [hidden] = "objLoaderStatus == true" type="button" class="btn-primary btn-lg pull-right" (click)="navigateToApplication()" [disabled] = "numSelected === 0" >
Συνέχεια<span class="glyphicon glyphicon-menu-right"></span> <i class="fa fa-forward"></i>
</button> </button>
</div> </div>
</div> </div>
...@@ -74,6 +77,8 @@ import {AppSettings} from '../../app.settings'; ...@@ -74,6 +77,8 @@ import {AppSettings} from '../../app.settings';
private regionActive = <number>-1; private regionActive = <number>-1;
private courseActive = -1; private courseActive = -1;
private numSelected = <number>0; private numSelected = <number>0;
objLoaderStatus: boolean;
//private schoolArray: Array<boolean> = new Array(); //private schoolArray: Array<boolean> = new Array();
...@@ -81,14 +86,30 @@ import {AppSettings} from '../../app.settings'; ...@@ -81,14 +86,30 @@ import {AppSettings} from '../../app.settings';
private _rsa: RegionSchoolsActions, private _rsa: RegionSchoolsActions,
private _rsb: SectorCoursesActions, private _rsb: SectorCoursesActions,
private _ngRedux: NgRedux<IAppState>, private _ngRedux: NgRedux<IAppState>,
private router: Router private router: Router,
private loaderService: LoaderService
) { ) {
this.formGroup = this.fb.group({ this.formGroup = this.fb.group({
formArray: this.rss formArray: this.rss
}); });
this.objLoaderStatus=false;
console.log (this.objLoaderStatus);
}; };
ngOnInit() { ngOnInit() {
this.loaderService.loaderStatus.subscribe((val: boolean) => {
this.objLoaderStatus = val;
});
this.loaderService.displayLoader(true); // enable spinner
// this.objLoaderStatus = true;
console.log (this.objLoaderStatus,"AAAAAAAAAAAAA");
this.classActive = this.classActive = this.getClassActive(); this.classActive = this.classActive = this.getClassActive();
let class_id = -1; let class_id = -1;
...@@ -106,7 +127,7 @@ import {AppSettings} from '../../app.settings'; ...@@ -106,7 +127,7 @@ import {AppSettings} from '../../app.settings';
} }
this._rsa.getRegionSchools(class_id,this.courseActive, false); this._rsa.getRegionSchools(class_id,this.courseActive, false);
console.log(this.courseActive,"aaaaaaaaaaaaaa");
this.regions$ = this._ngRedux.select(state => { this.regions$ = this._ngRedux.select(state => {
let numsel = 0; let numsel = 0;
state.regions.reduce((prevRegion, region) =>{ state.regions.reduce((prevRegion, region) =>{
...@@ -122,6 +143,9 @@ import {AppSettings} from '../../app.settings'; ...@@ -122,6 +143,9 @@ import {AppSettings} from '../../app.settings';
this.numSelected = numsel; this.numSelected = numsel;
return state.regions; return state.regions;
}); });
//this.objLoaderStatus = false;
this.loaderService.displayLoader(false); // enable spinner
console.log (this.objLoaderStatus,"BBBBBBBBBBBBB");
} }
......
...@@ -41,7 +41,7 @@ import {AppSettings} from '../../app.settings'; ...@@ -41,7 +41,7 @@ import {AppSettings} from '../../app.settings';
</li> </li>
</div> </div>
<div class="col-md-12"> <div class="col-md-12">
<button type="button" class="btn btn-primary btn-lg pull-right" (click)="navigateToStudentForm()" >Συνέχεια</button> <button type="button" class="btn btn-primary btn-lg pull-right" (click)="navigateToStudentForm()" ><i class="fa fa-forward"></i></button>
</div> </div>
</form> </form>
</div> </div>
......
...@@ -31,19 +31,17 @@ import {AppSettings} from '../../app.settings'; ...@@ -31,19 +31,17 @@ import {AppSettings} from '../../app.settings';
<h5>{{sector$.sector_name}}</h5> <h5>{{sector$.sector_name}}</h5>
</li> </li>
<div *ngFor="let course$ of sector$.courses; let j=index;" [hidden]="i !== sectorActive"> <div *ngFor="let course$ of sector$.courses; let j=index;" [hidden]="i !== sectorActive">
<li class="list-group-item" >
<div class="row"> <div class="row">
<div class="col-md-2"> <div class="col-md-2 col-md-offset-1">
<input #cb type="checkbox" formControlName="{{ course$.globalIndex }}" <input #cb type="checkbox" formControlName="{{ course$.globalIndex }}"
(change)="updateCheckedOptions(course$.globalIndex, cb)" (change)="updateCheckedOptions(course$.globalIndex, cb)"
[checked] = " course$.globalIndex === idx " [checked] = " course$.globalIndex === idx "
> >
</div> </div>
<div class="col-md-10"> <div class="col-md-8 col-md-offset-1">
{{course$.course_name | removeSpaces}} {{course$.course_name | removeSpaces}}
</div> </div>
</div> </div>
</li>
</div> </div>
</div> </div>
</ul> </ul>
...@@ -52,7 +50,7 @@ import {AppSettings} from '../../app.settings'; ...@@ -52,7 +50,7 @@ import {AppSettings} from '../../app.settings';
<div class="row"> <div class="row">
<div class="col-md-12 col-md-offset-5"> <div class="col-md-12 col-md-offset-5">
<button type="button" class="btn-primary btn-lg pull-right" (click)="navigateToSchools()" [disabled]="idx === -1" > <button type="button" class="btn-primary btn-lg pull-right" (click)="navigateToSchools()" [disabled]="idx === -1" >
Συνέχεια<span class="glyphicon glyphicon-menu-right"></span> <i class="fa fa-forward"></i>
</button> </button>
</div> </div>
</div> </div>
......
...@@ -54,7 +54,7 @@ import {AppSettings} from '../../app.settings'; ...@@ -54,7 +54,7 @@ import {AppSettings} from '../../app.settings';
<div class="row"> <div class="row">
<div class="col-md-12 col-md-offset-5"> <div class="col-md-12 col-md-offset-5">
<button type="button" class="btn-primary btn-lg pull-right" (click)="navigateToSchools()" [disabled]="sectorActive === -1" > <button type="button" class="btn-primary btn-lg pull-right" (click)="navigateToSchools()" [disabled]="sectorActive === -1" >
Συνέχεια<span class="glyphicon glyphicon-menu-right"></span> <i class="fa fa-forward"></i>
</button> </button>
</div> </div>
</div> </div>
......
...@@ -6,7 +6,7 @@ import {Pipe, PipeTransform} from '@angular/core'; ...@@ -6,7 +6,7 @@ import {Pipe, PipeTransform} from '@angular/core';
export class RemoveSpaces implements PipeTransform { export class RemoveSpaces implements PipeTransform {
transform(value: string) : any { transform(value: string) : any {
return value.replace(/[\s]/g, ''); return value.replace(/^[ ]+|[ ]+$/g,'');
} }
} }
......
import { Injectable } from '@angular/core';
import { BehaviorSubject } from 'rxjs/BehaviorSubject';
@Injectable()
export class LoaderService {
public loaderStatus: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
displayLoader(value: boolean) {
this.loaderStatus.next(value);
}