schools-order-select bug fixes. Removed redundant code

parent 7711ae37
// export const API_ENDPOINT = 'http://eduslim2.minedu.gov.gr/drupal';
export const API_ENDPOINT = 'http://eduslim2.minedu.gov.gr/angular/eepal-front/drupal';
export const API_ENDPOINT = 'http://eduslim2.minedu.gov.gr/drupal';
// export const API_ENDPOINT = 'http://eduslim2.minedu.gov.gr/angular/eepal-front/drupal';
export class AppSettings {
public static get API_ENDPOINT(): string {
// return 'http://eduslim2.minedu.gov.gr/drupal';
return 'http://eduslim2.minedu.gov.gr/angular/eepal-front/drupal';
return 'http://eduslim2.minedu.gov.gr/drupal';
// return 'http://eduslim2.minedu.gov.gr/angular/eepal-front/drupal';
}
}
......@@ -44,7 +44,6 @@ import { LOGININFO_INITIAL_STATE } from '../../store/logininfo/logininfo.initial
this.authToken = loginInfoToken.auth_token;
this.authRole = loginInfoToken.auth_role;
this.cuName = loginInfoToken.cu_name;
console.log(loginInfoToken.cu_name);
return loginInfoToken;
}, {})
}
......@@ -62,13 +61,10 @@ import { LOGININFO_INITIAL_STATE } from '../../store/logininfo/logininfo.initial
oauthSignOut() {
this._hds.signOut().then(data => {
this._ata.initLoginInfo();
console.log(this.authRole);
if (this.authRole === 'director') {
console.log("director");
this.router.navigate(['/school']);
}
else if (this.authRole === 'student') {
console.log("applicant");
this.router.navigate(['']);
}
this.authToken = '';
......
......@@ -233,10 +233,10 @@ import { STUDENT_DATA_FIELDS_INITIAL_STATE } from '../../store/studentdatafields
}
showValues() {
console.log(this.epalclasses$);
/* console.log(this.epalclasses$);
console.log(this.studentDataFields$);
console.log(this.regions$);
console.log(this.sectors$);
console.log(this.sectors$); */
}
}
......@@ -122,7 +122,6 @@ import {AppSettings} from '../../app.settings';
}
ngOnDestroy() {
console.log("on destroy");
if (this.epalclassesSub) {
this.epalclassesSub.unsubscribe();
}
......@@ -172,8 +171,6 @@ import {AppSettings} from '../../app.settings';
}
this.regionActiveId = Number(region.region_id);
this.regionActive = numreg - 1;
//console.log("HERE1: ");
//console.log(this.regionActive);
}
if (Number(region.region_id) === this.regionActiveId) {
if (region.epals.length < this.regionSizeLimit)
......@@ -203,7 +200,6 @@ import {AppSettings} from '../../app.settings';
state.sectorFields.reduce(({}, sectorField) =>{
if (sectorField.selected === true) {
this.courseActive = sectorField.id;
console.log(epalClass);
this._rsa.getRegionSchools(2,this.courseActive, false);
}
return sectorField;
......@@ -218,7 +214,6 @@ import {AppSettings} from '../../app.settings';
sector.courses.reduce((prevCourse, course) =>{
if (course.selected === true) {
this.courseActive = parseInt(course.course_id);
console.log(epalClass);
this._rsa.getRegionSchools(3,this.courseActive, false);
}
return course;
......
......@@ -7,12 +7,6 @@ import { RegionSchoolsActions } from '../../actions/regionschools.actions';
import { IRegions } from '../../store/regionschools/regionschools.types';
import { REGION_SCHOOLS_INITIAL_STATE } from '../../store/regionschools/regionschools.initial-state';
import { IAppState } from '../../store/store';
import {
FormBuilder,
FormGroup,
FormControl
} from '@angular/forms';
import {AppSettings} from '../../app.settings';
@Component({
......@@ -26,12 +20,11 @@ import {AppSettings} from '../../app.settings';
Καθορίστε εδώ την επιθυμητή σειρά προτίμησης των σχολείων πατώντας τα αντίστοιχα βέλη δεξιά από τα ονόματα των σχολείων.
Αν συμφωνείτε με την υπάρχουσα σειρά προτίμησης, πατήστε <i>Συνέχεια</i>.</p>
<form [formGroup]="formGroup">
<ul class="list-group main-view">
<div *ngFor="let schoolField$ of schoolNames$ | async; let i=index; let isOdd=odd; let isEven=even">
<li class="list-group-item" [class.oddout]="isOdd" [class.evenout]="isEven">
Προτίμηση {{i+1}}: {{schoolField$}}
<div (click)="changeOrder(i,'up')" *ngIf = "i !== 0" class="fa fa-arrow-circle-up isclickable pull-right" style="font-size: 2em;"></div>
<i (click)="changeOrder(i,'up')" *ngIf = "i !== 0" class="fa fa-arrow-circle-up isclickable pull-right" style="font-size: 2em;"></i>
</li>
</div>
</ul>
......@@ -47,13 +40,11 @@ import {AppSettings} from '../../app.settings';
</button>
</div>
</div>
</form>
`
})
@Injectable() export default class SchoolsOrderSelect implements OnInit, OnDestroy {
public formGroup: FormGroup;
// public formGroup: FormGroup;
private numSelected$: BehaviorSubject<number> = new BehaviorSubject(0);
private schoolNames$: BehaviorSubject<Array<string>> = new BehaviorSubject(Array());
private schoolSelectedIds$: BehaviorSubject<Array<number>> = new BehaviorSubject(Array());
......@@ -61,41 +52,43 @@ import {AppSettings} from '../../app.settings';
private regions$: BehaviorSubject<IRegions>;
private regionsSub: Subscription;
constructor(private fb: FormBuilder,
private _cfa: RegionSchoolsActions,
constructor(private _cfa: RegionSchoolsActions,
private _ngRedux: NgRedux<IAppState>,
private router: Router) {
this.formGroup = this.fb.group({
});
this.regions$ = new BehaviorSubject(REGION_SCHOOLS_INITIAL_STATE);
};
ngOnInit() {
this.regionsSub = this._ngRedux.select(state => {
let numSelected = 0;
let idx = -1;
let nm = 1;
let nm = 0;
let schoolNames = new Array();
let schoolSelectedIds = new Array();
let schoolArrayOrders = new Array();
let maxOrderId = 3;
state.regions.reduce((prevRegion, region) =>{
region.epals.reduce((prevEpal, epal) =>{
++idx;
if (epal.selected === true) {
numSelected++;
schoolArrayOrders[idx] = nm;
nm++;
if (epal.order_id === 0) {
schoolNames[idx] = epal.epal_name;
schoolSelectedIds[idx] = idx;
schoolArrayOrders[idx] = maxOrderId;
maxOrderId--;
schoolNames[nm] = epal.epal_name;
schoolSelectedIds[nm] = idx;
}
else {
schoolArrayOrders[nm] = epal.order_id;
schoolNames[epal.order_id - 1] = epal.epal_name;
schoolSelectedIds[epal.order_id - 1] = idx;
}
nm++;
} else {
schoolArrayOrders[idx] = 0;
......@@ -113,12 +106,9 @@ import {AppSettings} from '../../app.settings';
return state.regions;
}).subscribe(this.regions$);
}
ngOnDestroy() {
console.log("on destroy");
if (this.regionsSub) {
this.regionsSub.unsubscribe();
}
......@@ -152,7 +142,5 @@ import {AppSettings} from '../../app.settings';
navigateBack() {
this.router.navigate(['/region-schools-select']);
}
}
......@@ -74,8 +74,6 @@ export class HelperDataService implements OnInit, OnDestroy {
this.authToken = loginInfoToken.auth_token;
this.authRole = loginInfoToken.auth_role;
});
console.log("authToken=" + this.authToken);
console.log("authRole=" + this.authRole);
let headers = new Headers({
"Content-Type": "application/json",
// "Accept": "*/*",
......@@ -103,8 +101,6 @@ export class HelperDataService implements OnInit, OnDestroy {
this.authToken = loginInfoToken.auth_token;
this.authRole = loginInfoToken.auth_role;
});
console.log("authToken=" + this.authToken);
console.log("authRole=" + this.authRole);
let headers = new Headers({
"Content-Type": "application/json",
// "Accept": "*/*",
......@@ -114,7 +110,6 @@ export class HelperDataService implements OnInit, OnDestroy {
// let options = new RequestOptions({ headers: headers, withCredentials: true });
let options = new RequestOptions({ headers: headers });
return new Promise((resolve, reject) => {
console.log("verificationCode=" + verificationCode);
this.http.post(`${AppSettings.API_ENDPOINT}/epal/user/verifyvercode`, { verificationCode: verificationCode }, options)
.map(response => response.json())
.subscribe(data => {
......@@ -133,8 +128,6 @@ export class HelperDataService implements OnInit, OnDestroy {
this.authToken = loginInfoToken.auth_token;
this.authRole = loginInfoToken.auth_role;
});
console.log("authToken=" + this.authToken);
console.log("authRole=" + this.authRole);
let headers = new Headers({
"Content-Type": "application/json",
});
......@@ -160,8 +153,6 @@ export class HelperDataService implements OnInit, OnDestroy {
this.authToken = loginInfoToken.auth_token;
this.authRole = loginInfoToken.auth_role;
});
console.log("authToken=" + this.authToken);
console.log("authRole=" + this.authRole);
let headers = new Headers({
//"Authorization": "Basic cmVzdHVzZXI6czNjckV0MFAwdWwwJA==", // encoded user:pass
// "Authorization": "Basic bmthdHNhb3Vub3M6emVtcmFpbWU=",
......@@ -195,8 +186,6 @@ export class HelperDataService implements OnInit, OnDestroy {
this.authToken = loginInfoToken.auth_token;
this.authRole = loginInfoToken.auth_role;
});
console.log("authToken=" + this.authToken);
console.log("authRole=" + this.authRole);
let headers = new Headers({
//"Authorization": "Basic cmVzdHVzZXI6czNjckV0MFAwdWwwJA==", // encoded user:pass
// "Authorization": "Basic bmthdHNhb3Vub3M6emVtcmFpbWU=",
......@@ -229,8 +218,6 @@ export class HelperDataService implements OnInit, OnDestroy {
this.authToken = loginInfoToken.auth_token;
this.authRole = loginInfoToken.auth_role;
});
console.log("authToken=" + this.authToken);
console.log("authRole=" + this.authRole);
let headers = new Headers({
//"Authorization": "Basic cmVzdHVzZXI6czNjckV0MFAwdWwwJA==", // encoded user:pass
// "Authorization": "Basic bmthdHNhb3Vub3M6emVtcmFpbWU=",
......@@ -273,8 +260,6 @@ export class HelperDataService implements OnInit, OnDestroy {
this.authToken = loginInfoToken.auth_token;
this.authRole = loginInfoToken.auth_role;
});
console.log("authToken=" + this.authToken);
console.log("authRole=" + this.authRole);
let headers = new Headers({
//"Authorization": "Basic cmVzdHVzZXI6czNjckV0MFAwdWwwJA==", // encoded user:pass
// "Authorization": "Basic bmthdHNhb3Vub3M6emVtcmFpbWU=",
......@@ -350,8 +335,6 @@ export class HelperDataService implements OnInit, OnDestroy {
this.authToken = loginInfoToken.auth_token;
this.authRole = loginInfoToken.auth_role;
});
console.log("authToken=" + this.authToken);
console.log("authRole=" + this.authRole);
let headers = new Headers({
"Content-Type": "application/json",
"X-CSRF-Token": "LU92FaWYfImfZxfldkF5eVnssdHoV7Aa9fg8K1bWYUc",
......@@ -418,8 +401,6 @@ export class HelperDataService implements OnInit, OnDestroy {
this.authToken = loginInfoToken.auth_token;
this.authRole = loginInfoToken.auth_role;
});
console.log("authToken=" + this.authToken);
console.log("authRole=" + this.authRole);
let headers = new Headers({
//"Authorization": "Basic cmVzdHVzZXI6czNjckV0MFAwdWwwJA==", // encoded user:pass
// "Authorization": "Basic bmthdHNhb3Vub3M6emVtcmFpbWU=",
......@@ -439,7 +420,6 @@ export class HelperDataService implements OnInit, OnDestroy {
this.createAuthorizationHeader(headers);
let options = new RequestOptions({ headers: headers, withCredentials: true });
let logoutRoute = '/oauth/logout';
console.log(this.authRole);
if (this.authRole === 'director')
logoutRoute = '/cas/logout';
......@@ -467,8 +447,6 @@ export class HelperDataService implements OnInit, OnDestroy {
this.authToken = loginInfoToken.auth_token;
this.authRole = loginInfoToken.auth_role;
});
console.log("authToken=" + this.authToken);
console.log("authRole=" + this.authRole);
let headers = new Headers({
"Content-Type": "application/json",
"id": ""
......@@ -486,8 +464,6 @@ export class HelperDataService implements OnInit, OnDestroy {
this.authToken = loginInfoToken.auth_token;
this.authRole = loginInfoToken.auth_role;
});
console.log("authToken=" + this.authToken);
console.log("authRole=" + this.authRole);
let headers = new Headers({
"Content-Type": "application/json",
});
......@@ -504,8 +480,6 @@ export class HelperDataService implements OnInit, OnDestroy {
this.authToken = loginInfoToken.auth_token;
this.authRole = loginInfoToken.auth_role;
});
console.log("authToken=" + this.authToken);
console.log("authRole=" + this.authRole);
let headers = new Headers({
"Content-Type": "application/json",
});
......@@ -522,8 +496,6 @@ export class HelperDataService implements OnInit, OnDestroy {
this.authToken = loginInfoToken.auth_token;
this.authRole = loginInfoToken.auth_role;
});
console.log("authToken=" + this.authToken);
console.log("authRole=" + this.authRole);
let headers = new Headers({
"Content-Type": "application/json",
});
......@@ -540,8 +512,6 @@ export class HelperDataService implements OnInit, OnDestroy {
this.authToken = loginInfoToken.auth_token;
this.authRole = loginInfoToken.auth_role;
});
console.log("authToken=" + this.authToken);
console.log("authRole=" + this.authRole);
let headers = new Headers({
"Content-Type": "application/json",
});
......@@ -562,9 +532,6 @@ export class HelperDataService implements OnInit, OnDestroy {
this.authToken = loginInfoToken.auth_token;
this.authRole = loginInfoToken.auth_role;
});
console.log("authToken=" + this.authToken);
console.log("authRole=" + this.authRole);
let headers = new Headers({
"Content-Type": "application/json",
......@@ -578,13 +545,10 @@ export class HelperDataService implements OnInit, OnDestroy {
saveConfirmStudents(students) {
console.log(students, "hds");
this.loginInfo$.getValue().forEach(loginInfoToken => {
this.authToken = loginInfoToken.auth_token;
this.authRole = loginInfoToken.auth_role;
});
console.log("authToken=" + this.authToken);
console.log("authRole=" + this.authRole);
let headers = new Headers({
"Content-Type": "application/json",
});
......@@ -609,13 +573,10 @@ export class HelperDataService implements OnInit, OnDestroy {
saveCapacity(taxi, tomeas, specialit, capacity, schoolid) {
console.log(taxi, capacity, "hds");
this.loginInfo$.getValue().forEach(loginInfoToken => {
this.authToken = loginInfoToken.auth_token;
this.authRole = loginInfoToken.auth_role;
});
console.log("authToken=" + this.authToken);
console.log("authRole=" + this.authRole);
let headers = new Headers({
"Content-Type": "application/json",
});
......@@ -654,7 +615,6 @@ export class HelperDataService implements OnInit, OnDestroy {
resolve(data);
},
error => {
//console.log("Error Sending Ministry Credentials");
reject("Error Sending Ministry Credentials");
},
() => console.log(""));
......
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