Commit 2cc27bf9 authored by Open Source Developer's avatar Open Source Developer
Browse files

Student Amka

parent ccf76590
...@@ -20,13 +20,18 @@ ...@@ -20,13 +20,18 @@
"babel-preset-env": "^1.1.4", "babel-preset-env": "^1.1.4",
"babel-preset-es2015": "^6.18.0", "babel-preset-es2015": "^6.18.0",
"babel-preset-stage-1": "^6.16.0", "babel-preset-stage-1": "^6.16.0",
"node-sass": "^4.0.0", "bootstrap-loader": "^2.0.0-beta.20",
"sass-loader": "^4.0.2", "css-loader": "^0.25.0",
"node-sass": "^4.5.0",
"redux-logger": "^2.7.4",
"resolve-url-loader": "^1.6.1",
"sass-loader": "^4.1.1",
"style-loader": "^0.13.1",
"to-string-loader": "^1.1.5", "to-string-loader": "^1.1.5",
"tslint": "^3.15.1", "tslint": "^3.15.1",
"tslint-loader": "^2.1.5", "tslint-loader": "^2.1.5",
"typescript": "^2.0.10", "typescript": "^2.0.10",
"redux-logger" : "^2.7.4", "url-loader": "^0.5.7",
"webpack": "^1.14.0", "webpack": "^1.14.0",
"webpack-dashboard": "^0.2.0", "webpack-dashboard": "^0.2.0",
"webpack-dev-server": "^1.16.2" "webpack-dev-server": "^1.16.2"
...@@ -41,7 +46,8 @@ ...@@ -41,7 +46,8 @@
"@angular/platform-browser-dynamic": "^2.0.0", "@angular/platform-browser-dynamic": "^2.0.0",
"@angular/router": "^3.2.0", "@angular/router": "^3.2.0",
"@types/node": "^6.0.60", "@types/node": "^6.0.60",
"babel-polyfill" : "^6.20.0", "babel-polyfill": "^6.20.0",
"bootstrap": "^4.0.0-alpha.6",
"core-js": "^2.4.1", "core-js": "^2.4.1",
"css-loader": "^0.25.0", "css-loader": "^0.25.0",
"d3": "^3.5.16", "d3": "^3.5.16",
...@@ -50,6 +56,7 @@ ...@@ -50,6 +56,7 @@
"file-loader": "^0.9.0", "file-loader": "^0.9.0",
"html-webpack-plugin": "^2.24.1", "html-webpack-plugin": "^2.24.1",
"immutable": "^3.8.1", "immutable": "^3.8.1",
"jquery": "^3.1.1",
"ng2-redux": "^5.1.0", "ng2-redux": "^5.1.0",
"ng2-smart-table": "^0.4.0-5", "ng2-smart-table": "^0.4.0-5",
"raw-loader": "^0.5.1", "raw-loader": "^0.5.1",
......
import { AMKAFILL_SAVE } from '../constants';
import { Injectable } from '@angular/core';
import { NgRedux } from 'ng2-redux';
import { IAppState } from '../store';
@Injectable()
export class AmkaFillsActions {
constructor(
private _ngRedux: NgRedux<IAppState>) {}
saveAmkaFills = (amkaFills) => {
return this._ngRedux.dispatch({
type: AMKAFILL_SAVE,
payload: {
amkaFills
}
});
};
}
\ No newline at end of file
...@@ -4,7 +4,8 @@ import { RegionSchoolsActions } from './regionschools.actions'; ...@@ -4,7 +4,8 @@ import { RegionSchoolsActions } from './regionschools.actions';
import { SectorCoursesActions } from './sectorcourses.actions'; import { SectorCoursesActions } from './sectorcourses.actions';
import { StudentDataFieldsActions } from './studentdatafields.actions'; import { StudentDataFieldsActions } from './studentdatafields.actions';
import { EpalClassesActions } from './epalclass.actions'; import { EpalClassesActions } from './epalclass.actions';
const ACTION_PROVIDERS = [ CourseFieldsActions, SectorFieldsActions, RegionSchoolsActions, SectorCoursesActions, StudentDataFieldsActions, EpalClassesActions ]; import { AmkaFillsActions} from './amkafill.actions';
const ACTION_PROVIDERS = [ CourseFieldsActions, SectorFieldsActions, RegionSchoolsActions, SectorCoursesActions, StudentDataFieldsActions, EpalClassesActions, AmkaFillsActions ];
export { export {
CourseFieldsActions, CourseFieldsActions,
...@@ -13,5 +14,6 @@ export { ...@@ -13,5 +14,6 @@ export {
SectorCoursesActions, SectorCoursesActions,
StudentDataFieldsActions, StudentDataFieldsActions,
EpalClassesActions, EpalClassesActions,
AmkaFillsActions,
ACTION_PROVIDERS, ACTION_PROVIDERS,
}; };
...@@ -27,6 +27,8 @@ import { APP_ROUTER_PROVIDERS, APP_DECLARATIONS } from './app.routes'; ...@@ -27,6 +27,8 @@ import { APP_ROUTER_PROVIDERS, APP_DECLARATIONS } from './app.routes';
/* Here we import services */ /* Here we import services */
import {HelperDataService} from './services/helper-data-service'; 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 { ACTION_PROVIDERS } from './actions'; import { ACTION_PROVIDERS } from './actions';
import Home from './components/home'; import Home from './components/home';
...@@ -75,6 +77,7 @@ class MyLocalization extends NgLocalization { ...@@ -75,6 +77,7 @@ class MyLocalization extends NgLocalization {
// Service1, again services here // Service1, again services here
HelperDataService, HelperDataService,
UserDataService, UserDataService,
AmkaCheckService,
] ]
}) })
class AppModule {} class AppModule {}
......
...@@ -12,11 +12,13 @@ ...@@ -12,11 +12,13 @@
<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>
<li class="nav-item" [ngClass]="{active: path=='epal-class-select'}">
<li class="nav-item" [ngClass]="{active: path=='pal-class-select'}">
<a class="nav-link" [routerLink]="['/epal-class-select']" [routerLinkActive]="['active']">Τάξη</a> <a class="nav-link" [routerLink]="['/epal-class-select']" [routerLinkActive]="['active']">Τάξη</a>
</li> </li>
<li class="nav-item" [ngClass]="{active: path=='amka-fill'}">
<a class="nav-link" [routerLink]="['/amka-fill']" [routerLinkActive]="['active']">ΑΜΚΑ ΜΑΘΗΤΗ</a>
</li>
<li class="nav-item" [ngClass]="{active: path=='sector-fields-select'}"> <li class="nav-item" [ngClass]="{active: path=='sector-fields-select'}">
<a class="nav-link" [routerLink]="['/sector-fields-select']" [routerLinkActive]="['active']">Τομεας</a> <a class="nav-link" [routerLink]="['/sector-fields-select']" [routerLinkActive]="['active']">Τομεας</a>
......
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { Observable } from 'rxjs/Rx';
import { Injectable } from "@angular/core";
import { AmkaFillsActions } from '../../actions/amkafill.actions';
import { NgRedux, select } from 'ng2-redux';
import { IAmkaFills } from '../../store/amkafill/amkafills.types';
import { IAppState } from '../../store/store';
import { AmkaCheckService} from '../../services/amkacheck-service';
import {
FormBuilder,
FormGroup,
FormControl,
FormArray
} from '@angular/forms';
import {AppSettings} from '../../app.settings';
@Component({
selector: 'amka-fill',
template: `
<form [formGroup]="formGroup">
<div *ngFor="let amkafill$ of amkafills$ | async;"> </div>
<div class="form-group">
<label for="studentAmka">ΑΜΚΑ μαθητή</label><input class="form-control" type="text" formControlName="name">
</div>
<div class="row">
<div class="col-md-2 col-md-offset-5">
<button type="button" class="btn-primary btn-lg pull-center" (click)="saveSelected()">
Συνέχεια<span class="glyphicon glyphicon-menu-right"></span>
</button>
</div>
</div>
</form>
`
})
@Injectable() export default class AmkaFill implements OnInit {
private amkafills$: Observable<IAmkaFills>;
public formGroup: FormGroup;
private respond: any;
constructor(private fb: FormBuilder,
private _cas: AmkaCheckService,
private _cfa: AmkaFillsActions,
private _ngRedux: NgRedux<IAppState>,
private router: Router) {
this.formGroup = this.fb.group({
name: []
});
};
ngOnInit() {
// this._cfa.getEpalClasses()
console.log(this.formGroup.value);
this.amkafills$ = this._ngRedux.select(state => {
if (state.amkafills.size > 0) {
state.amkafills.reduce(({}, amkafill) => {
this.formGroup.setValue(amkafill);
return amkafill;
}, {});
}
return state.amkafills;
});
}
saveSelected() {
this._cas.checkstudentamka(this.formGroup.value)
.subscribe(res =>this.respond = res);
console.log(this.respond);
this._cfa.saveAmkaFills(this.formGroup.value);
this.router.navigate(['/epal-class-select']);
}
}
\ No newline at end of file
...@@ -14,6 +14,7 @@ import SectorFieldsSelect from '../components/student-application-form/sector.fi ...@@ -14,6 +14,7 @@ import SectorFieldsSelect from '../components/student-application-form/sector.fi
import RegionSchoolsSelect from '../components/student-application-form/region.schools.select'; import RegionSchoolsSelect from '../components/student-application-form/region.schools.select';
import SectorCoursesSelect from '../components/student-application-form/sector.courses.select'; import SectorCoursesSelect from '../components/student-application-form/sector.courses.select';
import ApplicationPreview from '../components/student-application-form/application.preview'; import ApplicationPreview from '../components/student-application-form/application.preview';
import AmkaFill from '../components/student-application-form/amka-fill';
export const MainRoutes: Routes = [ export const MainRoutes: Routes = [
{ path: '', component: Home }, { path: '', component: Home },
...@@ -25,7 +26,8 @@ export const MainRoutes: Routes = [ ...@@ -25,7 +26,8 @@ export const MainRoutes: Routes = [
{ path: 'sector-fields-select', component: SectorFieldsSelect }, { path: 'sector-fields-select', component: SectorFieldsSelect },
{ path: 'region-schools-select', component: RegionSchoolsSelect }, { path: 'region-schools-select', component: RegionSchoolsSelect },
{ path: 'sectorcourses-fields-select', component: SectorCoursesSelect }, { path: 'sectorcourses-fields-select', component: SectorCoursesSelect },
{ path: 'application-preview', component: ApplicationPreview } { path: 'application-preview', component: ApplicationPreview },
{ path: 'amka-fill', component: AmkaFill }
]; ];
export const MainDeclarations = [ export const MainDeclarations = [
...@@ -39,5 +41,6 @@ export const MainDeclarations = [ ...@@ -39,5 +41,6 @@ export const MainDeclarations = [
RegionSchoolsSelect, RegionSchoolsSelect,
SectorCoursesSelect, SectorCoursesSelect,
StudentApplicationMain, StudentApplicationMain,
ApplicationPreview ApplicationPreview,
AmkaFill
]; ];
import {Http,Response, RequestOptions, Headers} from '@angular/http';
import {Injectable} from '@angular/core';
import {Observable} from "rxjs/Observable";
import 'rxjs/add/operator/map';
@Injectable()
export class AmkaCheckService {
private _url = "https://wso2.minedu.gov.gr/amka/v1.1/" ;
constructor(private _http: Http) {
};
checkstudentamka(amka: any) {
let authToken = '7bed3fc5-f9f5-3613-abcd-3b08bab0f625';
let headers = new Headers({ 'Accept': 'application/json' });
headers.append('Authorization', `Bearer ${authToken}`);
let options = new RequestOptions({headers : headers});
let parameter1 = 'ksdhkshf' ;
return this._http.get(this._url+ amka.name +'/'+ parameter1 ,options)
.map(response => response.json() );
}
}
\ No newline at end of file
import { List } from 'immutable';
import { IAmkaFill} from './amkafills.types';
export const INITIAL_STATE = List<IAmkaFill>();
import { IAmkaFills, IAmkaFill } from './amkafills.types';
import { INITIAL_STATE } from './amkafills.initial-state';
import { Seq } from 'immutable';
import { AMKAFILL_SAVE} from '../../constants';
export function amkafillReducer(state: IAmkaFills = INITIAL_STATE, action): IAmkaFills {
switch (action.type) {
case AMKAFILL_SAVE:
let selectedAmkaFills = Array<IAmkaFill>();
selectedAmkaFills.push(<IAmkaFill>{ name: action.payload.amkaFills.name});
return Seq(selectedAmkaFills).map(n => n).toList();
default: return state;
}
};
import { IAmkaFills, IAmkaFill } from './amkafills.types';
export function deimmutifyAmkaFills(state: IAmkaFills): IAmkaFill[] {
let fetchedAmkaFills = new Array();
state.forEach(amkafill => {
fetchedAmkaFills.push(<IAmkaFill>{name: amkafill.name});
});
return fetchedAmkaFills;
};
import { List } from 'immutable';
export interface IAmkaFill {
// id: number;
name: number;
}
export type IAmkaFills = List<IAmkaFill>;
"use strict";
const classfields_reducer_1 = require("./classfields.reducer");
exports.classFieldsReducer = classfields_reducer_1.classFieldsReducer;
const classfields_transformers_1 = require("./classfields.transformers");
exports.deimmutifyClassFields = classfields_transformers_1.deimmutifyClassFields;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQ0EsK0RBQTJEO0FBTXpELHNFQUFrQjtBQUxwQix5RUFBbUU7QUFNakUsaUZBQXFCIn0=
\ No newline at end of file
import { IAmkaFill, IAmkaFills } from './amkafills.types';
import { amkafillReducer } from './amkafills.reducer';
import { deimmutifyAmkaFills } from './amkafills.transformers';
export {
IAmkaFill,
IAmkaFills,
amkafillReducer,
deimmutifyAmkaFills,
};
...@@ -5,6 +5,7 @@ import * as regions from './regionschools'; ...@@ -5,6 +5,7 @@ import * as regions from './regionschools';
import * as sectors from './sectorcourses'; import * as sectors from './sectorcourses';
import * as studentDataFields from './studentdatafields'; import * as studentDataFields from './studentdatafields';
import * as epalclasses from './epalclasses'; import * as epalclasses from './epalclasses';
import * as amkafills from './amkafill';
/* /*
* This is where we 'assemble' the full store out of its modules. * This is where we 'assemble' the full store out of its modules.
...@@ -17,6 +18,7 @@ export interface IAppState { ...@@ -17,6 +18,7 @@ export interface IAppState {
sectors?: sectors.ISectors; sectors?: sectors.ISectors;
studentDataFields?: studentDataFields.IStudentDataFields; studentDataFields?: studentDataFields.IStudentDataFields;
epalclasses?: epalclasses.IEpalClasses; epalclasses?: epalclasses.IEpalClasses;
amkafills?: amkafills.IAmkaFills;
}; };
export const rootReducer = combineReducers<IAppState>({ export const rootReducer = combineReducers<IAppState>({
...@@ -26,6 +28,7 @@ export const rootReducer = combineReducers<IAppState>({ ...@@ -26,6 +28,7 @@ export const rootReducer = combineReducers<IAppState>({
sectors: sectors.sectorCoursesReducer, sectors: sectors.sectorCoursesReducer,
studentDataFields: studentDataFields.studentDataFieldsReducer, studentDataFields: studentDataFields.studentDataFieldsReducer,
epalclasses: epalclasses.epalclassesReducer, epalclasses: epalclasses.epalclassesReducer,
amkafills: amkafills.amkafillReducer,
}); });
export function deimmutify(state: IAppState): Object { export function deimmutify(state: IAppState): Object {
...@@ -36,5 +39,6 @@ export function deimmutify(state: IAppState): Object { ...@@ -36,5 +39,6 @@ export function deimmutify(state: IAppState): Object {
sectors: sectors.deimmutifySectorCourses(state.sectors), sectors: sectors.deimmutifySectorCourses(state.sectors),
studentdataFields: studentDataFields.deimmutifyStudentDataFields(state.studentDataFields), studentdataFields: studentDataFields.deimmutifyStudentDataFields(state.studentDataFields),
epalclasses: epalclasses.deimmutifyEpalClasses(state.epalclasses), epalclasses: epalclasses.deimmutifyEpalClasses(state.epalclasses),
amkafills: amkafills.deimmutifyAmkaFills(state.amkafills),
}; };
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment