Commit 10958fb2 authored by Νίκος Κατσαούνος's avatar Νίκος Κατσαούνος

updated HelperServices

parents 27f8d1cd df04a646
......@@ -79,7 +79,7 @@ epal.allocation:
requirements:
_user_is_logged_in: 'TRUE'
sectorperschool:
path: '/epal/sectorperSchool/{epalId}'
path: '/epal/sectorperSchool'
options:
_auth: [ 'basic_auth' ]
defaults:
......@@ -87,7 +87,7 @@ sectorperschool:
requirements:
_user_is_logged_in: 'TRUE'
specialityperschool:
path: '/epal/specialityperSchool/{epalId}/{sectorId}'
path: '/epal/specialityperSchool/{sectorId}'
options:
_auth: [ 'basic_auth' ]
defaults:
......@@ -103,7 +103,7 @@ confirmstudents:
requirements:
_user_is_logged_in: 'TRUE'
studentperschool:
path: '/epal/studentperSchool/{epalId}/{selectId}/{classId}/{limitdown}/{limitup}'
path: '/epal/studentperSchool/{selectId}/{classId}/{limitdown}/{limitup}'
options:
_auth: [ 'basic_auth' ]
defaults:
......@@ -111,7 +111,7 @@ studentperschool:
requirements:
_user_is_logged_in: 'TRUE'
savecapacity:
path: '/epal/savecapacity/{taxi}/{tomeas}/{specialit}/{schoolid}'
path: '/epal/savecapacity/{taxi}/{tomeas}/{specialit}'
options:
_auth: [ 'basic_auth' ]
defaults:
......@@ -223,7 +223,7 @@ critirioschosen:
requirements:
_user_is_logged_in: 'TRUE'
findcapacity:
path: '/epal/findCapacity/{taxi}/{tomeas}/{specialit}/{schoolid}'
path: '/epal/findCapacity/{taxi}/{tomeas}/{specialit}'
options:
_auth: [ 'basic_auth' ]
defaults:
......@@ -238,3 +238,13 @@ findschoolid:
_controller: '\Drupal\epal\Controller\DirectorView::getSchoolID'
requirements:
_user_is_logged_in: 'TRUE'
gettypeofschool:
path: '/epal/gettypeofschool'
options:
_auth: [ 'basic_auth' ]
defaults:
_controller: '\Drupal\epal\Controller\DirectorView::gettypeofschool'
requirements:
_user_is_logged_in: 'TRUE'
......@@ -83,6 +83,12 @@ class ApplicationSubmit extends ControllerBase {
'certificatetype' => $applicationForm[0][certificatetype],
//'lastam' => $applicationForm[0][lastam],
'currentclass' => $applicationForm[0][currentclass],
'guardian_name' => $applicationForm[0][cu_name],
'guardian_surname' => $applicationForm[0][cu_surname],
'guardian_fathername' => $applicationForm[0][cu_fathername],
'guardian_mothername' => $applicationForm[0][cu_mothername],
'agreement' => $applicationForm[0][disclaimer_checked],
//'currentepal' => $applicationForm[0][currentepal],
//'currentsector' => $applicationForm[0][currentsector],
'points' => $applicationForm[0][points],
......
......@@ -50,12 +50,30 @@ class CurrentUser extends ControllerBase
], Response::HTTP_FORBIDDEN);
}
$epalConfigs = $this->entityTypeManager->getStorage('epal_config')->loadByProperties(array('name' => 'epal_config'));
$epalConfig = reset($epalConfigs);
if (!$epalConfig) {
return $this->respondWithStatus([
'message' => t("Configuration not found"),
], Response::HTTP_FORBIDDEN);
}
$userRoles = $user->getRoles();
foreach ($userRoles as $userRole) {
if (($userRole === 'epal') || ($userRole === 'regioneduadmin') || ($userRole === 'eduadmin')) {
return $this->respondWithStatus([
'name' => $user->mail->value,
'title' => $user->init->value,
'cu_name' => $user->mail->value,
'cu_surname' => '',
'cu_fathername' => '',
'cu_mothername' => '',
'cu_email' => '',
'minedu_username' => '',
'minedu_userpassword' => '',
'lock_capacity' => $epalConfig->lock_school_capacity->value,
'lock_students' => $epalConfig->lock_school_students_view->value,
'lock_application' => $epalConfig->lock_application->value,
'disclaimer_checked' => "0",
'title' => $user->init->value
], Response::HTTP_OK);
} else if ($userRole === 'applicant') {
break;
......@@ -66,8 +84,24 @@ class CurrentUser extends ControllerBase
$epalUsers = $this->entityTypeManager->getStorage('epal_users')->loadByProperties(array('authtoken' => $authToken));
$epalUser = reset($epalUsers);
if ($epalUser) {
$userName = $epalUser->name->value;
$userSurname = $epalUser->surname->value;
$userFathername = $epalUser->fathername->value;
$userMothername = $epalUser->mothername->value;
$userEmail = $user->mail->value;
return $this->respondWithStatus([
'name' => $epalUser->name->value,
'cu_name' => mb_substr($epalUser->name->value,0,4,'UTF-8') !== "####" ? $epalUser->name->value : '',
'cu_surname' => mb_substr($epalUser->surname->value,0,4,'UTF-8') !== "####" ? $epalUser->surname->value : '',
'cu_fathername' => mb_substr($epalUser->fathername->value,0,4,'UTF-8') !== "####" ? $epalUser->fathername->value : '',
'cu_mothername' => mb_substr($epalUser->mothername->value,0,4,'UTF-8') !== "####" ? $epalUser->mothername->value : '',
'cu_email' => mb_substr($user->mail->value,0,4,'UTF-8') !== "####" ? $user->mail->value : '',
'minedu_username' => '',
'minedu_userpassword' => '',
'lock_capacity' => $epalConfig->lock_school_capacity->value,
'lock_students' => $epalConfig->lock_school_students_view->value,
'lock_application' => $epalConfig->lock_application->value,
'disclaimer_checked' => "0",
'verificationCodeVerified' => $epalUser->verificationcodeverified->value,
], Response::HTTP_OK);
} else {
return $this->respondWithStatus([
......
......@@ -206,7 +206,7 @@ class EpalConfig extends ContentEntityBase implements EpalConfigInterface {
->setSettings(array(
'text_processing' => 0,
))
->setRequired(TRUE)
->setRequired(FALSE)
->setDefaultValue(FALSE)
->setDisplayOptions('view', array(
'label' => 'above',
......@@ -226,7 +226,7 @@ class EpalConfig extends ContentEntityBase implements EpalConfigInterface {
->setSettings(array(
'text_processing' => 0,
))
->setRequired(TRUE)
->setRequired(FALSE)
->setDefaultValue(FALSE)
->setDisplayOptions('view', array(
'label' => 'above',
......@@ -246,7 +246,7 @@ class EpalConfig extends ContentEntityBase implements EpalConfigInterface {
->setSettings(array(
'text_processing' => 0,
))
->setRequired(TRUE)
->setRequired(FALSE)
->setDefaultValue(FALSE)
->setDisplayOptions('view', array(
'label' => 'above',
......
......@@ -505,7 +505,7 @@ class EpalStudent extends ContentEntityBase implements EpalStudentInterface {
->setLabel(t('Ημερομηνία γέννησης μαθητή'))
->setDescription(t('Δώσε την Ημερομηνία γέννησης μαθητή.'))
->setSetting('datetime_type', 'date')
->setRequired(false)
->setRequired(true)
->setDisplayOptions('view', array(
'label' => 'above',
'type' => 'string',
......@@ -543,7 +543,7 @@ class EpalStudent extends ContentEntityBase implements EpalStudentInterface {
'max_length' => 50,
'text_processing' => 0,
))
->setRequired(false)
->setRequired(true)
->setDefaultValue('')
->setDisplayOptions('view', array(
'label' => 'above',
......@@ -564,7 +564,7 @@ class EpalStudent extends ContentEntityBase implements EpalStudentInterface {
'max_length' => 50,
'text_processing' => 0,
))
->setRequired(false)
->setRequired(true)
->setDefaultValue('')
->setDisplayOptions('view', array(
'label' => 'above',
......@@ -585,7 +585,7 @@ class EpalStudent extends ContentEntityBase implements EpalStudentInterface {
'max_length' => 50,
'text_processing' => 0,
))
->setRequired(false)
->setRequired(true)
->setDefaultValue('')
->setDisplayOptions('view', array(
'label' => 'above',
......@@ -606,7 +606,7 @@ class EpalStudent extends ContentEntityBase implements EpalStudentInterface {
'max_length' => 50,
'text_processing' => 0,
))
->setRequired(false)
->setRequired(true)
->setDefaultValue('')
->setDisplayOptions('view', array(
'label' => 'above',
......@@ -627,6 +627,7 @@ class EpalStudent extends ContentEntityBase implements EpalStudentInterface {
'max_length' => 20,
'text_processing' => 0,
))
->setRequired(false)
->setDefaultValue('')
->setDisplayOptions('view', array(
'label' => 'above',
......@@ -647,6 +648,7 @@ class EpalStudent extends ContentEntityBase implements EpalStudentInterface {
'max_length' => 100,
'text_processing' => 0,
))
->setRequired(true)
->setDefaultValue('')
->setDisplayOptions('view', array(
'label' => 'above',
......@@ -667,27 +669,7 @@ class EpalStudent extends ContentEntityBase implements EpalStudentInterface {
'max_length' => 10,
'text_processing' => 0,
))
->setDefaultValue('')
->setDisplayOptions('view', array(
'label' => 'above',
'type' => 'string',
'weight' => -4,
))
->setDisplayOptions('form', array(
'type' => 'string_textfield',
'weight' => -4,
))
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);
$fields['regionarea'] = BaseFieldDefinition::create('string')
->setLabel(t('Πόλη-Κοινότητα'))
->setDescription(t('Δώσε την πόλη ή κοινότητα που διαμένεις.'))
->setSettings(array(
'max_length' => 100,
'text_processing' => 0,
))
->setDefaultValue('')
->setRequired(true)
->setDisplayOptions('view', array(
'label' => 'above',
'type' => 'string',
......@@ -707,6 +689,7 @@ class EpalStudent extends ContentEntityBase implements EpalStudentInterface {
'max_length' => 100,
'text_processing' => 0,
))
->setRequired(true)
->setDefaultValue('')
->setDisplayOptions('view', array(
'label' => 'above',
......@@ -727,6 +710,7 @@ class EpalStudent extends ContentEntityBase implements EpalStudentInterface {
'max_length' => 50,
'text_processing' => 0,
))
->setRequired(true)
->setDefaultValue('')
->setDisplayOptions('view', array(
'label' => 'above',
......@@ -747,6 +731,7 @@ class EpalStudent extends ContentEntityBase implements EpalStudentInterface {
'max_length' => 10,
'text_processing' => 0,
))
->setRequired(false)
->setDefaultValue('')
->setDisplayOptions('view', array(
'label' => 'above',
......@@ -912,6 +897,7 @@ class EpalStudent extends ContentEntityBase implements EpalStudentInterface {
'max_length' => 50,
'text_processing' => 0,
))
->setRequired(true)
->setDefaultValue('')
->setDisplayOptions('view', array(
'label' => 'above',
......@@ -932,6 +918,7 @@ class EpalStudent extends ContentEntityBase implements EpalStudentInterface {
'max_length' => 50,
'text_processing' => 0,
))
->setRequired(true)
->setDefaultValue('')
->setDisplayOptions('view', array(
'label' => 'above',
......@@ -969,7 +956,7 @@ class EpalStudent extends ContentEntityBase implements EpalStudentInterface {
->setSettings(array(
'text_processing' => 0,
))
->setRequired(false)
->setRequired(true)
->setDisplayOptions('view', array(
'label' => 'above',
'type' => 'boolean',
......@@ -982,6 +969,90 @@ class EpalStudent extends ContentEntityBase implements EpalStudentInterface {
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);
$fields['guardian_name'] = BaseFieldDefinition::create('string')
->setLabel(t('Όνομα κηδεμόνα'))
->setDescription(t('Δώσε το όνομα κηδεμόνα.'))
->setSettings(array(
'max_length' => 50,
'text_processing' => 0,
))
->setRequired(true)
->setDefaultValue('')
->setDisplayOptions('view', array(
'label' => 'above',
'type' => 'string',
'weight' => -4,
))
->setDisplayOptions('form', array(
'type' => 'string_textfield',
'weight' => -4,
))
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);
$fields['guardian_surname'] = BaseFieldDefinition::create('string')
->setLabel(t('Επώνυμο κηδεμόνα'))
->setDescription(t('Δώσε το επώνυμο κηδεμόνα.'))
->setSettings(array(
'max_length' => 50,
'text_processing' => 0,
))
->setRequired(true)
->setDefaultValue('')
->setDisplayOptions('view', array(
'label' => 'above',
'type' => 'string',
'weight' => -4,
))
->setDisplayOptions('form', array(
'type' => 'string_textfield',
'weight' => -4,
))
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);
$fields['guardian_fathername'] = BaseFieldDefinition::create('string')
->setLabel(t('Όνομα πατέρα κηδεμόνα'))
->setDescription(t('Δώσε το όνομα πατέρα του κηδεμόνα.'))
->setSettings(array(
'max_length' => 50,
'text_processing' => 0,
))
->setRequired(true)
->setDefaultValue('')
->setDisplayOptions('view', array(
'label' => 'above',
'type' => 'string',
'weight' => -4,
))
->setDisplayOptions('form', array(
'type' => 'string_textfield',
'weight' => -4,
))
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);
$fields['guardian_mothername'] = BaseFieldDefinition::create('string')
->setLabel(t('Όνομα μητέρας κηδεμόνα'))
->setDescription(t('Δώσε το όνομα μητέρας του κηδεμόνα.'))
->setSettings(array(
'max_length' => 50,
'text_processing' => 0,
))
->setRequired(true)
->setDefaultValue('')
->setDisplayOptions('view', array(
'label' => 'above',
'type' => 'string',
'weight' => -4,
))
->setDisplayOptions('form', array(
'type' => 'string_textfield',
'weight' => -4,
))
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', TRUE);
$fields['status'] = BaseFieldDefinition::create('boolean')
->setLabel(t('Publishing status'))
->setDescription(t('A boolean indicating whether the EPAL Student is published.'))
......
import { LOGININFO_SAVE, LOGININFO_RECEIVED } from '../constants';
import { LOGININFO_SAVE, PROFILE_SAVE, LOGININFO_RECEIVED } from '../constants';
import { LOGININFO_INIT } from '../constants';
import { Injectable } from '@angular/core';
import { NgRedux } from 'ng2-redux';
......@@ -32,6 +32,15 @@ export class LoginInfoActions {
});
};
saveProfile = (profile) => {
return this._ngRedux.dispatch({
type: PROFILE_SAVE,
payload: {
profile
}
});
};
initLoginInfo = () => {
return this._ngRedux.dispatch({
......
......@@ -6,6 +6,7 @@ import { NgModule } from '@angular/core';
import { NgReduxModule, DevToolsExtension, NgRedux } from 'ng2-redux';
import {BrowserModule} from '@angular/platform-browser';
import { CookieModule } from 'ngx-cookie';
import { MyDatePickerModule } from 'mydatepicker';
import {
FormsModule,
ReactiveFormsModule,
......@@ -32,6 +33,8 @@ import {AuthService} from './services/auth.service';
import SchoolAuthGuard from './guards/school.auth.guard';
import StudentAuthGuard from './guards/student.auth.guard';
import RegionEduAuthGuard from './guards/regionedu.auth.guard';
import EduAdminAuthGuard from './guards/eduadmin.auth.guard';
import MinistryAuthGuard from './guards/ministry.auth.guard';
import { ACTION_PROVIDERS } from './actions';
import Home from './components/home';
......@@ -55,6 +58,7 @@ class MyLocalization extends NgLocalization {
@NgModule({
imports: [
BrowserModule,
MyDatePickerModule,
FormsModule,
RouterModule,
ReactiveFormsModule,
......@@ -81,7 +85,9 @@ class MyLocalization extends NgLocalization {
AuthService,
SchoolAuthGuard,
StudentAuthGuard,
RegionEduAuthGuard
RegionEduAuthGuard,
EduAdminAuthGuard,
MinistryAuthGuard
]
})
......
......@@ -30,6 +30,7 @@ import {
<option value="1" >Α' Λυκείου</option>
<option value="2" >Β' Λυκείου</option>
<option value="3" >Γ' Λυκείου</option>
<option *ngIf="(selectiontype | async)" value="4" >Δ' Λυκείου</option>
</select>
</div>
<div class="form-group">
......@@ -65,7 +66,7 @@ import {
<option value=2>Όχι</option>
<option value=3 selected></option>
</select>
<button type="button" class="btn-primary btn-sm pull-right" (click)="confirmStudent()">
<button type="button" class="btn-primary btn-sm pull-right" (click)="confirmStudent(txoption)">
Επιβεβαίωση Εγγραφής
</button>
......@@ -120,6 +121,7 @@ import {
<br>
<br>
<div *ngIf="(retrievedStudent | async)">
<div class="form-group" class="row">
Βρίσκεστε στη σελίδα:
<div class="col-1">
......@@ -143,6 +145,7 @@ import {
</ul>
</nav>
</div>
</form>
</div>
......@@ -168,12 +171,13 @@ import {
private SubmitedDetailsSub: Subscription;
private retrievedStudent: BehaviorSubject<boolean>;
private selectionBClass: BehaviorSubject<boolean>;
private selectiontype: BehaviorSubject<boolean>;
private selectionCClass: BehaviorSubject<boolean>;
private SchoolId ;
private currentclass: Number;
private saved: Array<number> = new Array();
private limitdown = 0;
private limitup = 25;
private limitup = 5;
private pageno = 1;
private userActive = <number>-1;
private type: Number;
......@@ -195,6 +199,7 @@ import {
this.selectionBClass = new BehaviorSubject(false);
this.selectionCClass = new BehaviorSubject(false);
this.School$ = new BehaviorSubject([{}]);
this.selectiontype = new BehaviorSubject(true);
this.formGroup = this.fb.group({
......@@ -225,11 +230,14 @@ import {
ngOnInit() {
this.SchoolSub = this._hds.getSchoolId().subscribe(x => {
this.SchoolSub = this._hds.gettypeofschool().subscribe(x => {
this.School$.next(x);
console.log(x[0].id, "schoolid!");
this.SchoolId = x[0].id;
console.log(x[0].type, "schoolid!");
this.SchoolId = x[0].type;
if (this.SchoolId == 'ΗΜΕΡΗΣΙΟ'){
this.selectiontype.next(false);
}
},
error => {
......@@ -237,6 +245,7 @@ import {
console.log("Error Getting School");
},
() => console.log("Getting School "));
}
......@@ -251,7 +260,7 @@ import {
}
else if (txop.value === "2") {
this.StudentSelectedSub = this._hds.getSectorPerSchool(this.SchoolId).subscribe(data => {
this.StudentSelectedSub = this._hds.getSectorPerSchool().subscribe(data => {
this.selectionBClass.next(true);
this.selectionCClass.next(false);
this.StudentSelected$.next(data);
......@@ -263,13 +272,12 @@ import {
},
() => console.log("Getting StudentSelectedSpecial"));
}
else if (txop.value === "3") {
else if (txop.value === "3" || txop.value === "4") {
var sectorint = +this.formGroup.value.tomeas;
console.log(sectorint, "test");
if (this.formGroup.value.tomeas != '') {
if (this.formGroup.value.tomeas != '') {
var sectorint = +this.formGroup.value.tomeas;
this.StudentSelectedSpecialSub = this._hds.getSpecialityPerSchool(this.SchoolId, sectorint).subscribe(data => {
this.StudentSelectedSpecialSub = this._hds.getSpecialityPerSchool(sectorint).subscribe(data => {
this.StudentSelectedSpecial$.next(data);
},
error => {
......@@ -279,7 +287,7 @@ import {
() => console.log("Getting StudentSelectedSpecial"));
}
this.StudentSelectedSub = this._hds.getSectorPerSchool(this.SchoolId).subscribe(data => {
this.StudentSelectedSub = this._hds.getSectorPerSchool().subscribe(data => {
this.StudentSelected$.next(data);
this.selectionBClass.next(true);
this.selectionCClass.next(true);
......@@ -299,9 +307,9 @@ import {
this.retrievedStudent.next(false);
var sectorint = +this.formGroup.value.tomeas;
console.log(sectorint, "tomeas");
if (txop.value === "3") {
if (txop.value === "3" || txop.value === "4") {
// this.StudentSelectedSpecial$ = new BehaviorSubject([{}]);
this.StudentSelectedSpecialSub = this._hds.getSpecialityPerSchool(this.SchoolId, sectorint).subscribe(data => {
this.StudentSelectedSpecialSub = this._hds.getSpecialityPerSchool(sectorint).subscribe(data => {
this.StudentSelectedSpecial$.next(data);
},
......@@ -315,7 +323,7 @@ import {
findstudent(txop, pageno) {
var tot_pages: Number;
var tot_pages: number;
var sectorint = +this.formGroup.value.tomeas;
if (txop.value === "1") {
this.currentclass = 1;
......@@ -327,23 +335,39 @@ import {
this.currentclass = 3;
}
else if (txop.value === "4") {
this.currentclass = 4;
}
this.formGroup.get('pageno').setValue(this.pageno);
if (this.pageno == 1) {
console.log(this.SchoolId, sectorint, this.currentclass, "test");
this.StudentsSizeSub = this._hds.getStudentPerSchool(this.SchoolId, sectorint, this.currentclass, 0, 0).subscribe(x => {
console.log(this.SchoolId, sectorint, this.currentclass, "testaaaaaa");
this.StudentsSizeSub = this._hds.getStudentPerSchool(sectorint, this.currentclass, 0, 0).subscribe(x => {
this.StudentsSize$.next(x);
tot_pages = x.id / 5;
if (x.id % 5 > 0) {
tot_pages = (x.id - (x.id % 5)) / 5 + 1;
}
console.log(tot_pages,"totpages")
if (isNaN(tot_pages)){
this.retrievedStudent.next(false);
tot_pages = 0;
}
this.formGroup.get('maxpage').setValue(tot_pages);
});
}
this.StudentInfoSub = this._hds.getStudentPerSchool(this.SchoolId, sectorint, this.currentclass, this.limitdown, this.limitup).subscribe(data => {
this.StudentInfoSub = this._hds.getStudentPerSchool(sectorint, this.currentclass, this.limitdown, this.limitup).subscribe(data => {
this.StudentInfo$.next(data);
this.retrievedStudent.next(true);
if (tot_pages === 0){