Commit 2961a7b3 authored by Open Source Developer's avatar Open Source Developer

conflict

parents ed2b052e 0e8caf80
dist/*
source/app.settings.ts
node_modules/*
!drupal/
drupal/*
......
.main-wrapper {
background: #FFF none repeat-y 0 0;
background: #FFF none repeat-y 0 0;
min-height: calc(100vh - 220px);
#content {
zoom: 1;
......@@ -39,7 +39,7 @@
}
.left-choices {
h4{
h4{
font-weight: bold;
font-size: 1rem;
......@@ -51,9 +51,9 @@
border: none!important;
width: 200px;
padding:5px 10px;
}
}
......@@ -75,13 +75,13 @@
li.list-group-item{
color: black;
background-color: white;
// background-color: white;
border: none!important;
padding: 0.3rem 0.3rem!important;
h5{
font-size: 1rem;
}
}
......@@ -92,11 +92,11 @@
@include media-breakpoint-up(md) {
@include media-breakpoint-up(md) {
.main-wrapper {
#content {
padding: 0 10px 10px;
box-shadow: 0 0 20px #888888;
}
}
}
\ No newline at end of file
}
import { LOGININFO_SAVE } from '../constants';
import { LOGININFO_SAVE, LOGININFO_INIT } from '../constants';
import { Injectable } from '@angular/core';
import { NgRedux } from 'ng2-redux';
import { IAppState } from '../store';
......@@ -19,4 +19,12 @@ export class LoginInfoActions {
});
};
initLoginInfo = () => {
return this._ngRedux.dispatch({
type: LOGININFO_INIT,
payload: {
}
});
};
}
import { REGIONSCHOOLS_RECEIVED, REGIONSCHOOLS_SELECTED_SAVE, REGIONSCHOOLS_ORDER_SAVE } from '../constants';
import { REGIONSCHOOLS_RECEIVED, REGIONSCHOOLS_SELECTED_SAVE, REGIONSCHOOLS_ORDER_SAVE, REGIONSCHOOLS_INIT } from '../constants';
import { Injectable } from '@angular/core';
import { NgRedux } from 'ng2-redux';
import { IAppState } from '../store';
......@@ -25,6 +25,14 @@ export class RegionSchoolsActions {
}
};
initRegionSchools = () => {
return this._ngRedux.dispatch({
type: REGIONSCHOOLS_INIT,
payload: {
}
});
};
/*
getRegionSchools_Reload = (courseActive) => {
const { regions } = this._ngRedux.getState();
......
import { SECTORCOURSES_RECEIVED, SECTORCOURSES_SELECTED_SAVE } from '../constants';
import { SECTORCOURSES_RECEIVED, SECTORCOURSES_SELECTED_SAVE, SECTORCOURSES_INIT } from '../constants';
import { Injectable } from '@angular/core';
import { NgRedux } from 'ng2-redux';
import { IAppState } from '../store';
......@@ -25,6 +25,14 @@ export class SectorCoursesActions {
}
};
initSectorCourses = () => {
return this._ngRedux.dispatch({
type: SECTORCOURSES_INIT,
payload: {
}
});
};
/*
getSectorCourses_Reload = () => {
const { sectors } = this._ngRedux.getState();
......
import { SECTORFIELDS_RECEIVED, SECTORFIELDS_SELECTED_SAVE } from '../constants';
import { SECTORFIELDS_RECEIVED, SECTORFIELDS_SELECTED_SAVE, SECTORFIELDS_INIT } from '../constants';
import { Injectable } from '@angular/core';
import { NgRedux } from 'ng2-redux';
import { IAppState } from '../store';
......@@ -6,32 +6,41 @@ import { HelperDataService } from '../services/helper-data-service';
@Injectable()
export class SectorFieldsActions {
constructor(
private _ngRedux: NgRedux<IAppState>,
private _hds: HelperDataService) {}
constructor(
private _ngRedux: NgRedux<IAppState>,
private _hds: HelperDataService) { }
getSectorFields = (reload) => {
const { sectorFields } = this._ngRedux.getState();
//if (sectorFields.size === 0) {
if (reload === true || (reload === false && sectorFields.size === 0)) {
return this._hds.getSectorFields().then(sectorFields => {
return this._ngRedux.dispatch({
type: SECTORFIELDS_RECEIVED,
payload: {
sectorFields
}
getSectorFields = (reload) => {
const { sectorFields } = this._ngRedux.getState();
//if (sectorFields.size === 0) {
if (reload === true || (reload === false && sectorFields.size === 0)) {
return this._hds.getSectorFields().then(sectorFields => {
return this._ngRedux.dispatch({
type: SECTORFIELDS_RECEIVED,
payload: {
sectorFields
}
});
});
}
};
initSectorFields = () => {
return this._ngRedux.dispatch({
type: SECTORFIELDS_INIT,
payload: {
}
});
}
};
};
saveSectorFieldsSelected = (sectorFieldsSelected) => {
return this._ngRedux.dispatch({
type: SECTORFIELDS_SELECTED_SAVE,
payload: {
sectorFieldsSelected
}
});
};
saveSectorFieldsSelected = (sectorFieldsSelected) => {
return this._ngRedux.dispatch({
type: SECTORFIELDS_SELECTED_SAVE,
payload: {
sectorFieldsSelected
}
});
};
}
export const API_ENDPOINT = '';
export class AppSettings {
public static get API_ENDPOINT(): string {
return '';
}
}
export const API_ENDPOINT = 'http://eepal.dev/drupal';
export class AppSettings {
public static get API_ENDPOINT(): string {
// return 'http://localhost/drupal-8.2.5';
// return 'http://localhost/angular/eepal-front/drupal';
......
......@@ -11,15 +11,16 @@ import {
FormControl,
FormArray
} from '@angular/forms';
import { AppSettings } from '../app.settings';
import { API_ENDPOINT } from '../app.settings';
@Component({
selector: 'home',
template: `
<div>
<form [formGroup]="formGroup" method = "POST" action="http://localhost/angular/eepal-front/drupal/oauth/login" #form>
<!-- <input type="hidden" name="X-oauth-enabled" value="true"> -->
<div *ngFor="let loginInfoToken$ of loginInfo$ | async; let i=index">
<div class="row">
<input type="hidden" name="X-oauth-enabled" value="true"> -->
<div *ngFor="let loginInfoToken$ of loginInfo$ | async; let i=index"></div>
<div class="row">
<div class="col-md-6">
{{loginInfoToken$.auth_token}}
</div>
......@@ -27,15 +28,16 @@ import { AppSettings } from '../app.settings';
{{loginInfoToken$.auth_role}}
</div>
</div>
</div>
<div class="row">
</div> -->
<div class="row" style="min-height: 300px; margin-top: 100px;">
<div *ngIf="!authToken" class="col-md-7 col-md-offset-5">
<button type="submit" class="btn-primary btn-lg pull-center" (click)="form.submit()">
<div *ngIf="!authToken" class="col-md-8 offset-md-4">
<button type="submit" class="btn-primary btn-lg" (click)="form.submit()">
Είσοδος μέσω TaxisNet<span class="glyphicon glyphicon-menu-right"></span>
</button>
</div>
</div>
<!--
<div class="row">
<div *ngIf="authToken" class="col-md-7 col-md-offset-5">
<h3>Καλώς ήρθατε</h3>
......@@ -49,6 +51,7 @@ import { AppSettings } from '../app.settings';
</button>
</div>
</div>
-->
</form>
</div>
`
......@@ -58,16 +61,19 @@ export default class Home implements OnInit {
private authToken: string;
private authRole: string;
private loginInfo$: Observable<ILoginInfo>;
private apiEndPoint = API_ENDPOINT;
constructor(private fb: FormBuilder,
private _ata: LoginInfoActions,
private _ngRedux: NgRedux<IAppState>,
private activatedRoute: ActivatedRoute
private activatedRoute: ActivatedRoute,
private router: Router
) {
this.authToken = '';
this.authRole = '';
this.formGroup = this.fb.group({
Username: [],
Paswd: []
// Username: [],
// Paswd: []
});
};
......@@ -77,16 +83,21 @@ export default class Home implements OnInit {
state.loginInfo.reduce(({}, loginInfoToken) => {
this.authToken = loginInfoToken.auth_token;
this.authRole = loginInfoToken.auth_role;
if (this.authToken && this.authToken.length > 0)
this.router.navigate(['/epal-class-select']);
return loginInfoToken;
}, {});
}
return state.loginInfo;
});
// subscribe to router event
this.activatedRoute.queryParams.subscribe((params: Params) => {
this.authToken = params['auth_token'];
this.authRole = params['auth_role'];
if (params) {
this.authToken = params['auth_token'];
this.authRole = params['auth_role'];
}
if (this.authToken && this.authRole)
this._ata.saveLoginInfo({ auth_token: this.authToken, auth_role: this.authRole });
// console.log(this.authToken);
......
......@@ -8,8 +8,15 @@
<img src="../myschool/assets/images/myschool_logo.png" alt="Αρχική" />
</a>
<div class="collapse navbar-collapse flex-row-reverse" id="navbarNav">
<div *ngFor="let loginInfoToken$ of loginInfo$ | async; let i=index"></div>
<ul class="navbar-nav">
<b>Όνομα Χρήστη:</b> {{this.cuser}}
&nbsp;&nbsp;
<div *ngIf="authToken">
<button type="button" class="btn-primary btn-sm pull-right" (click)="oauthSignOut()">
<i class="fa fa-sign-out"></i>
</button>
</div>
<!--
<li class="nav-item" [ngClass]="{active: path=='application-preview'}">
......
import {Component, OnInit} from '@angular/core';
import {Router} from '@angular/router';
import { Injectable } from "@angular/core";
import { HelperDataService } from '../../services/helper-data-service';
import { Observable } from 'rxjs/Rx';
import { LoginInfoActions } from '../../actions/logininfo.actions';
import { ILoginInfo } from '../../store/logininfo/logininfo.types';
import { NgRedux, select } from 'ng2-redux';
import { IAppState } from '../../store/store';
@Component({
selector: 'reg-navbar',
......@@ -8,22 +14,46 @@ import { HelperDataService } from '../../services/helper-data-service';
})
@Injectable() export default class NavbarComponent implements OnInit{
private authToken: string;
private authRole: string;
private loginInfo$: Observable<ILoginInfo>;
public cuser :any;
public cuser :any;
constructor( private _ata: LoginInfoActions,
private _hds: HelperDataService,
private _ngRedux: NgRedux<IAppState>,
private router: Router
) {
this.authToken = '';
this.authRole = '';
constructor( private _hds: HelperDataService) {
};
ngOnInit() {
this.loginInfo$ = this._ngRedux.select(state => {
if (state.loginInfo.size > 0) {
state.loginInfo.reduce(({}, loginInfoToken) => {
this.authToken = loginInfoToken.auth_token;
this.authRole = loginInfoToken.auth_role;
return loginInfoToken;
}, {});
}
return state.loginInfo;
});
this._hds.getCurrentUser().then( cuser => this.cuser= cuser );
}
oauthSignOut() {
this._hds.signOut().then(data => {
this._ata.initLoginInfo();
this.authToken = '';
this.authRole = '';
this.router.navigate(['/']);
});
}
......
......@@ -169,13 +169,13 @@
</form>
<div class="row">
<div class="col-md-2 col-md-offset-4">
<button type="button" class="btn-primary btn-lg pull-center" (click)="saveSelected()">
<div class="row" style="margin-top: 20px;">
<div class="col-md-6">
<button type="button" class="btn-primary btn-lg pull-left" (click)="navigateBack()">
<i class="fa fa-backward"></i>
</button>
</div>
<div class="col-md-8">
<div class="col-md-6">
<button type="button" class="btn-primary btn-lg pull-right" (click)="submitSelected()" [disabled]="studentDataGroup.invalid">
<i class="fa fa-forward"></i>
</button>
......
......@@ -92,6 +92,23 @@ import {
}
navigateBack() {
/* this._ngRedux.select(state => {
state.epalclasses.reduce(({}, epalclass) =>{
if (epalclass.name === "Α' Λυκείου")
this.router.navigate(['/region-schools-select']);
else if (epalclass.name === "Β' Λυκείου")
this.router.navigate(['/region-schools-select']);
else if (epalclass.name === "Γ' Λυκείου")
this.router.navigate(['/region-schools-select']);
return epalclass;
}, {});
return state.epalclasses;
}); */
this.router.navigate(['/schools-order-select']);
}
submitSelected() {
this._sdfa.saveStudentDataFields([this.studentDataGroup.value]);
......
......@@ -23,7 +23,7 @@ import {AppSettings} from '../../app.settings';
<form [formGroup]="formGroup">
<div *ngFor="let epalclass$ of epalclasses$ | async;"> </div>
<div class="form-group">
<div class="form-group" style= "margin-top: 50px; margin-bottom: 100px;">
<label for="name">Παρακαλώ επιλέξτε την τάξη εισαγωγής του μαθητή στην Επαγγελματική Εκπαίδευση</label><br/>
<select class="form-control" formControlName="name" (change)="initializestore()">
<option value="Α' Λυκείου">Α' Λυκείου</option>
......@@ -103,9 +103,12 @@ import {AppSettings} from '../../app.settings';
initializestore()
{
this._cfa.saveEpalClassesSelected(this.formGroup.value);
this._sfa.getSectorFields(true);
this._sfa.initSectorFields();
this._rsa.initRegionSchools();
this._csa.initSectorCourses();
/* this._sfa.getSectorFields(true);
this._rsa.getRegionSchools(1,"-1", true);
this._csa.getSectorCourses(true);
this._csa.getSectorCourses(true); */
}
......
......@@ -8,7 +8,6 @@ import { IRegions } from '../../store/regionschools/regionschools.types';
import { SectorCoursesActions } from '../../actions/sectorcourses.actions';
import { ISectors } from '../../store/sectorcourses/sectorcourses.types';
import { IAppState } from '../../store/store';
import { LoaderService } from '../../services/Spinner.service';
import {RemoveSpaces} from '../../pipes/removespaces';
......@@ -23,39 +22,44 @@ import {AppSettings} from '../../app.settings';
@Component({
selector: 'course-fields-select',
template: `
<div class = "loading" *ngIf="objLoaderStatus">
<div class = "loading" *ngIf="showLoader$ | async">
</div>
<div class="row equal">
<div class="col-md-12">
<!-- <div class="row equal">
<div class="col-md-12"> -->
<form [formGroup]="formGroup">
<div formArrayName="formArray">
<ul class="list-group">
<div *ngFor="let region$ of regions$ | async; let i=index">
<li class="list-group-item" (click)="setActiveRegion(i)" [style.background-color]="toggleBackgroundColor(i)">
<ul class="list-group main-view">
<div *ngFor="let region$ of regions$ | async; let i=index; let isOdd=odd; let isEven=even" >
<li class="list-group-item isclickable" (click)="setActiveRegion(i)" [class.oddout]="isOdd" [class.evenout]="isEven" [class.selectedout]="regionActive === i">
<h5>{{region$.region_name}}</h5>
</li>
<div *ngFor="let epal$ of region$.epals; let j=index;" [hidden]="i !== regionActive">
<div *ngFor="let epal$ of region$.epals; let j=index; let isOdd2=odd; let isEven2=even" [class.oddin]="isOdd2" [class.evenin]="isEven2" [hidden]="i !== regionActive">
<div class="row">
<div class="col-md-2 col-md-offset-1">
<div class="col-md-2 col-md-offset-1">
<input #cb type="checkbox" formControlName="{{ epal$.globalIndex }}"
(change)="saveSelected(cb,j)"
[hidden] = "numSelected === 3 && cb.checked === false"
>
</div>
<div class="col-md-8 col-md-offset-1">
</div>
<div class="col-md-8 col-md-offset-1 isclickable">
{{epal$.epal_name | removeSpaces}}
</div>
</div>
</div>
</div>
</ul>
</div>
<div class="row">
<div class="col-md-12 col-md-offset-5">
<div class="row" style="margin-top: 20px;" *ngIf="!(showLoader$ | async)">
<div class="col-md-6">
<button [hidden] = "objLoaderStatus == true" type="button" class="btn-primary btn-lg pull-left" (click)="navigateBack()" >
<i class="fa fa-backward"></i>
</button>
</div>
<div class="col-md-6">
<button [hidden] = "objLoaderStatus == true" type="button" class="btn-primary btn-lg pull-right" (click)="navigateToApplication()" [disabled] = "numSelected === 0" >
<i class="fa fa-forward"></i>
</button>
......@@ -63,14 +67,15 @@ import {AppSettings} from '../../app.settings';
</div>
</form>
</div>
<!-- </div>
</div>
</div> -->
`
})
@Injectable() export default class RegionSchoolsSelect implements OnInit {
private regions$: Observable<IRegions>;
private sectors$: Observable<ISectors>;
private showLoader$: Observable<boolean>;
private formGroup: FormGroup;
private rss = new FormArray([]);
private classActive = "-1";
......@@ -78,7 +83,6 @@ import {AppSettings} from '../../app.settings';
private courseActive = -1;
private numSelected = <number>0;
objLoaderStatus: boolean;
//private schoolArray: Array<boolean> = new Array();
......@@ -86,29 +90,17 @@ import {AppSettings} from '../../app.settings';
private _rsa: RegionSchoolsActions,
private _rsb: SectorCoursesActions,
private _ngRedux: NgRedux<IAppState>,
private router: Router,
private loaderService: LoaderService
private router: Router
) {
this.formGroup = this.fb.group({
formArray: this.rss
});
this.objLoaderStatus=false;
console.log (this.objLoaderStatus);
};
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();
......@@ -127,7 +119,6 @@ import {AppSettings} from '../../app.settings';
}
this._rsa.getRegionSchools(class_id,this.courseActive, false);
console.log(this.courseActive,"aaaaaaaaaaaaaa");
this.regions$ = this._ngRedux.select(state => {
let numsel = 0;
state.regions.reduce((prevRegion, region) =>{
......@@ -143,10 +134,20 @@ import {AppSettings} from '../../app.settings';
this.numSelected = numsel;
return state.regions;
});
//this.objLoaderStatus = false;
this.loaderService.displayLoader(false); // enable spinner
console.log (this.objLoaderStatus,"BBBBBBBBBBBBB");
this.showLoader$ = this.regions$.map(regions => regions.size === 0);
}
navigateBack() {
// this.router.navigate(['/epal-class-select']);
if (this.classActive === "Α' Λυκείου") {
this.router.navigate(['/epal-class-select']);
}
else if (this.classActive === "Β' Λυκείου") {
this.router.navigate(['/sector-fields-select']);
}
else if (this.classActive === "Γ' Λυκείου") {
this.router.navigate(['/sectorcourses-fields-select']);
}
}
setActiveRegion(ind) {
......@@ -155,17 +156,8 @@ import {AppSettings} from '../../app.settings';
this.regionActive = ind;
}
toggleBackgroundColor(ind) {
return ((this.regionActive === ind) ? "#fd9665" : "white");
}
saveSelected(cb,j) {
this._rsa.saveRegionSchoolsSelected(this.formGroup.value.formArray);
//σε κάθε νέο check, αρχικοποίησε τη σειρά προτιμήσεων (σειρά προτίμησης:0)
let schoolArrayOrders: Array<number> = new Array();
for (let i=0; i < this.formGroup.value.formArray.length; i++)
schoolArrayOrders.push(0);
this._rsa.saveRegionSchoolsOrder(schoolArrayOrders);
}
navigateToApplication() {
......
......@@ -23,10 +23,10 @@ import {AppSettings} from '../../app.settings';
Καθορίστε εδώ την επιθυμητή σειρά προτίμησης των σχολείων πατώντας τα αντίστοιχα κουμπάκια δίπλα στα ονόματα των σχολείων.
Αν συμφωνείτε με την υπάρχουσα σειρά προτίμησης, πατήστε <i>Συνέχεια</i>.</p>
<div class="row equal">
<div class="col-md-12">
<!-- <div class="row equal">
<div class="col-md-12"> -->
<form [formGroup]="formGroup">
<div *ngFor="let schoolField$ of schoolNames; let i=index">
<div *ngFor="let schoolField$ of schoolNames; let i=index; let isOdd=odd; let isEven=even" [class.odd]="isOdd" [class.even]="isEven">
<button type="button" class="btn btn-info btn-sm pull-right" style="width:120px;margin-bottom:4px;white-space: normal;word-wrap:break-word;"
(click)="changeOrder(i,'up')" *ngIf = "i !== 0">Ανέβασέ με</button>
<!--
......@@ -40,13 +40,22 @@ import {AppSettings} from '../../app.settings';
Προτίμηση {{i+1}}: {{schoolField$}}
</li>
</div>
<div class="col-md-12">
<button type="button" class="btn btn-primary btn-lg pull-right" (click)="navigateToStudentForm()" ><i class="fa fa-forward"></i></button>
<div class="row" style="margin-top: 20px;">
<div class="col-md-6">
<button [hidden] = "objLoaderStatus == true" type="button" class="btn-primary btn-lg pull-left" (click)="navigateBack();" >
<i class="fa fa-backward"></i>
</button>
</div>
<div class="col-md-6">
<button [hidden] = "objLoaderStatus == true" type="button" class="btn-primary btn-lg pull-right" (click)="navigateToStudentForm()" [disabled] = "numSelected === 0" >
<i class="fa fa-forward"></i>
</button>
</div>
</div>
</form>
</div>
<!-- </div>
</div>
</div> -->
`
})
......@@ -119,4 +128,21 @@ import {AppSettings} from '../../app.settings';
this.router.navigate(['/student-application-form-main']);
}
navigateBack() {
/* this._ngRedux.select(state => {
state.epalclasses.reduce(({}, epalclass) =>{
if (epalclass.name === "Α' Λυκείου")
this.router.navigate(['/region-schools-select']);
else if (epalclass.name === "Β' Λυκείου")
this.router.navigate(['/region-schools-select']);
else if (epalclass.name === "Γ' Λυκείου")
this.router.navigate(['/region-schools-select']);
return epalclass;
}, {});
return state.epalclasses;
}); */
this.router.navigate(['/region-schools-select']);
}
}
......@@ -21,24 +21,24 @@ import {AppSettings} from '../../app.settings';
@Component({
selector: 'sectorcourses-fields-select',
template: `
<div class="row equal">
<div class="col-md-12">
<div class = "loading" *ngIf="(showLoader$ | async) && (showLoader2$ | async)">
</div>
<form [formGroup]="formGroup">
<div formArrayName="formArray">
<ul class="list-group">
<div *ngFor="let sector$ of sectors$ | async; let i=index">
<li class="list-group-item" (click)="setActiveSector(i)" [style.background-color]="toggleBackgroundColor(i)">
<div *ngFor="let sector$ of sectors$ | async; let i=index; let isOdd=odd; let isEven=even">
<li class="list-group-item isclickable" (click)="setActiveSector(i)" [class.oddout]="isOdd" [class.evenout]="isEven" [class.selectedout]="sectorActive === i">
<h5>{{sector$.sector_name}}</h5>
</li>
<div *ngFor="let course$ of sector$.courses; let j=index;" [hidden]="i !== sectorActive">