Commit 4d0e3dd0 authored by Χάρης Παπαδόπουλος's avatar Χάρης Παπαδόπουλος
Browse files

Merge branch 'stylesandmenus' into 'develop'

Stylesandmenus

See merge request !81
parents 9bdb5bcb db4168b3
......@@ -188,3 +188,19 @@ coursesperschools:
_controller: '\Drupal\epal\Controller\DirectorView::getCoursesPerSchool'
requirements:
_user_is_logged_in: 'TRUE'
critirioschosen:
path: '/epal/critiriachosen/{studentId}/{type}'
options:
_auth: [ 'basic_auth' ]
defaults:
_controller: '\Drupal\epal\Controller\SubmitedApplications::getCritiria'
requirements:
_user_is_logged_in: 'TRUE'
findcapacity:
path: '/epal/findCapacity/{taxi}/{tomeas}/{specialit}/{schoolid}'
options:
_auth: [ 'basic_auth' ]
defaults:
_controller: '\Drupal\epal\Controller\DirectorView::findCapacity'
requirements:
_user_is_logged_in: 'TRUE'
\ No newline at end of file
......@@ -209,9 +209,13 @@ public function getStudentPerSchool(Request $request, $epalId , $selectId, $clas
$epalStudent = reset($epalStudents);
if ($epalStudents) {
$studentIdNew = $epalStudent -> id();
$checkstatus = $this->entityTypeManager->getStorage('epal_student_class')->loadByProperties(array( 'student_id'=> $studentIdNew));
$checkstudentstatus = reset($checkstatus);
if ($i >= $limitdown && $i < $limitup)
{
$newstatus = $checkstudentstatus -> directorconfirm-> getValue();
$list[] = array(
'i' => $i,
'id' => $epalStudent -> id(),
......@@ -221,7 +225,17 @@ public function getStudentPerSchool(Request $request, $epalId , $selectId, $clas
'fathersurname' =>$epalStudent -> fathersurname ->value,
'motherfirstname' => $epalStudent -> motherfirstname ->value,
'mothersurname' =>$epalStudent -> mothersurname ->value,
'guardianfirstname' =>$epalUser -> name ->value,
'guardiansurname' =>$epalUser -> surname ->value,
'regionaddress' =>$epalStudent -> regionaddress ->value,
'regiontk' =>$epalStudent -> regiontk ->value,
'regionarea' =>$epalStudent -> regionarea ->value,
'certificatetype' =>$epalStudent -> certificatetype ->value,
'telnum' =>$epalStudent -> telnum ->value,
'relationtostudent' =>$epalStudent -> relationtostudent ->value,
'birthdate' =>$epalStudent -> birthdate ->value,
'checkstatus' =>$newstatus[0][value],
);
}
$i++;
......@@ -282,13 +296,19 @@ public function getStudentPerSchool(Request $request, $epalId , $selectId, $clas
{
$postData = json_decode($content);
$arr = $postData->students;
$type = $postData ->type;
foreach ($arr as $value) {
$valnew = intval($value);
$studentForConfirm = $this->entityTypeManager->getStorage('epal_student_class')->loadByProperties(array('id' => $valnew ));
$studentConfirm = reset($studentForConfirm);
if ($studentConfirm) {
if ($type == 1)
$studentConfirm->set('directorconfirm', true);
if ($type == 2)
$studentConfirm->set('directorconfirm', false);
if ($type == 3)
unset($studentConfirm->{directorconfirm});
$studentConfirm->save();
}
}
......@@ -318,6 +338,8 @@ public function getStudentPerSchool(Request $request, $epalId , $selectId, $clas
public function SaveCapacity(Request $request,$taxi,$tomeas,$specialit,$schoolid)
{
if (!$request->isMethod('POST')) {
return $this->respondWithStatus([
"message" => t("Method Not Allowed")
......@@ -575,6 +597,96 @@ public function returnstatus($id)
}
public function findCapacity(Request $request,$taxi,$tomeas,$specialit,$schoolid)
{
$tomeasnew = intval($tomeas);
$specialitnew = intval($specialitnew) ;
$authToken = $request->headers->get('PHP_AUTH_USER');
$users = $this->entityTypeManager->getStorage('user')->loadByProperties(array('name' => $authToken));
$user = reset($users);
if ($user) {
$schools = $this->entityTypeManager->getStorage('eepal_school')->loadByProperties(array('registry_no' => $this->testSchoolId));
$school = reset($schools);
if (!$school) {
$this->logger->warning("no access to this school=" . $user->id());
$response = new Response();
$response->setContent('No access to this school');
$response->setStatusCode(Response::HTTP_FORBIDDEN);
$response->headers->set('Content-Type', 'application/json');
return $response;
}
$list = array();
if (($tomeasnew == 0) && ($specialitnew == 0))
{
$CapacityPerClass = $this->entityTypeManager->getStorage('eepal_school')->loadByProperties(array('id' => $schoolid ));
$classcapacity = reset($CapacityPerClass);
if ($classcapacity) {
$list[] = array(
'taxi' => $taxi,
'capacity' => $classcapacity -> capacity_class_a -> value ,
);
}
}
if (($tomeasnew != 0) && ($specialitnew == 0))
{
$CapacityPerClass = $this->entityTypeManager->getStorage('eepal_sectors_in_epal')->loadByProperties(array('epal_id' => $schoolid, 'sector_id' => $tomeasnew ));
$classcapacity = reset($CapacityPerClass);
if ($classcapacity) {
$list[] = array(
'taxi' => $taxi,
'tomeas' => $tomeasnew,
'special' =>$specialitnew,
'capacity' => $classcapacity -> capacity_class_sector -> value ,
);
}
}
if (($tomeasnew != 0) && ($specialitnew != 0))
{
$CapacityPerClass = $this->entityTypeManager->getStorage('eepal_specialties_in_epal')->loadByProperties(array('epal_id' => $schoolid, 'specialty_id' => $specialitnew));
$classcapacity = reset($CapacityPerClass);
if ($classcapacity) {
$list[] = array(
'taxi' =>$taxi,
'tomeas' => $tomeasnew,
'special' =>$specialitnew,
'tomeas' => $classcapacity -> specialty_id -> value,
'capacity' => $classcapacity -> capacity_class_specialty -> value ,
);
}
}
return $this->respondWithStatus(
$list
, Response::HTTP_OK);
} else {
return $this->respondWithStatus([
'message' => t("EPAL user not found"),
], Response::HTTP_FORBIDDEN);
}
}
private function respondWithStatus($arr, $s) {
$res = new JsonResponse($arr);
$res->setStatusCode($s);
......
......@@ -95,8 +95,16 @@ class SubmitedApplications extends ControllerBase
'fathersurname' =>$object -> fathersurname ->value,
'motherfirstname' => $object -> motherfirstname ->value,
'mothersurname' =>$object -> mothersurname ->value,
'guardianfirstname' =>$epalUser -> name ->value,
'guardiansurname' =>$epalUser -> surname ->value,
'regionaddress' =>$object -> regionaddress ->value,
'regiontk' =>$object -> regiontk ->value,
'regionarea' =>$object -> regionarea ->value,
'certificatetype' =>$object -> certificatetype ->value,
'telnum' =>$object -> telnum ->value,
'relationtostudent' =>$object -> relationtostudent ->value,
'birthdate' =>$object -> birthdate ->value,
);
);
$i++;
}
......@@ -115,7 +123,7 @@ class SubmitedApplications extends ControllerBase
} else {
return $this->respondWithStatus([
'message' => t("User not found"),
'message' => t("User not found!!!!"),
], Response::HTTP_FORBIDDEN);
}
......@@ -166,6 +174,67 @@ public function getEpalChosen(Request $request, $studentId)
}
public function getCritiria(Request $request, $studentId, $type)
{
$authToken = $request->headers->get('PHP_AUTH_USER');
$epalUsers = $this->entityTypeManager->getStorage('epal_users')->loadByProperties(array('authtoken' => $authToken));
$epalUser = reset($epalUsers);
if ($epalUser) {
$userid = $epalUser -> user_id -> entity -> id();
$studentIdNew = intval($studentId) ;
$critiriaChosen = $this->entityTypeManager->getStorage('epal_student_moria')->loadByProperties(array( 'user_id'=>$userid,'student_id'=> $studentIdNew));
$i = 0;
if ($critiriaChosen) {
$list = array();
foreach ($critiriaChosen as $object) {
$critirio_id = $object -> criterio_id ->entity -> id();
$critiriatype = $this->entityTypeManager->getStorage('epal_criteria')->loadByProperties(array( 'id'=>$critirio_id ));
$typeofcritiria = reset($critiriatype);
$typecrit = $typeofcritiria -> category -> value;
if ($typecrit == "Κοινωνικό" && $type == 1){
$list[] = array(
'critirio' => $object -> criterio_id ->entity->get('name')->value ,
'critirio_id' => $critirio_id ,
);
$i++;
}
if ($typecrit == "Εισοδηματικό" && $type == 2){
$list[] = array(
'critirio' => $object -> criterio_id ->entity->get('name')->value ,
'critirio_id' => $critirio_id ,
);
$i++;
}
}
return $this->respondWithStatus(
$list
, Response::HTTP_OK);
}
else {
return $this->respondWithStatus([
'message' => t("EPAL chosen not found!!!"),
], Response::HTTP_FORBIDDEN);
}
} else {
return $this->respondWithStatus([
'message' => t("User not found"),
], Response::HTTP_FORBIDDEN);
}
}
......
......@@ -36,16 +36,30 @@ import {
</select>
</div>
<div class="form-group">
<select #spop class="form-control" *ngIf="(selectionCClass | async)" formControlName="specialit">
<select #spop class="form-control" *ngIf="(selectionCClass | async)" (change)="checkcclass(tmop,txoption,spop)" formControlName="specialit">
<option *ngFor="let SpecialSelection$ of StudentSelectedSpecial$ | async; let i=index" [value] = "SpecialSelection$.id"> {{SpecialSelection$.specialty_id}} </option>
</select>
</div>
<div *ngIf="(retrievedStudent | async) && (modify === false)">
<strong>Δυναμική σε τμήματα:</strong>
<div *ngFor="let classCapac$ of classCapacity$ | async;" >
<div><label for="capc">Τρέχουσα Δυναμική:</label> <p class="form-control" id = "capc" style="border:1px solid #eceeef;"> {{classCapac$.capacity}} </p></div>
</div>
<p style="margin-top: 20px; line-height: 2em;"> Αν θέλετε να αλλάξετε τη δυναμική σε τμήματα για τη συγκεκριμένή επιλογή συνέχεια επιλέξτε <i>Τροποποίηση</i>.</p>
<button type="button" class="btn-primary btn-sm pull-right" (click) ="modifyCapacity()">
Τροποποίηση
</button>
</div>
<div *ngIf="(modify === true)">
<input type="number" formControlName="capacity" min="1" max="10">
<button type="button" class="btn-primary btn-sm pull-right" (click) ="saveCapacity()">
Αποθήκευση
</button>
</div>
`
})
......@@ -60,6 +74,10 @@ import {
private selectionCClass: BehaviorSubject<boolean>;
private SchoolId = 147 ;
private currentclass: Number;
private classCapacity$: BehaviorSubject<any>;
private classCapacitySub: Subscription;
private retrievedStudent: BehaviorSubject<boolean>;
private modify = false;
......@@ -70,8 +88,10 @@ import {
{
this.StudentSelected$ = new BehaviorSubject([{}]);
this.StudentSelectedSpecial$ = new BehaviorSubject([{}]);
this.classCapacity$ = new BehaviorSubject([{}]);
this.selectionBClass = new BehaviorSubject(false);
this.selectionCClass = new BehaviorSubject(false);
this.retrievedStudent = new BehaviorSubject(false);
this.formGroup = this.fb.group({
tomeas: ['', []],
taxi: ['', []],
......@@ -91,17 +111,21 @@ import {
this.selectionBClass.unsubscribe();
if (this.selectionCClass)
this.selectionCClass.unsubscribe();
if (this.classCapacitySub)
this.classCapacitySub.unsubscribe();
if (this.retrievedStudent)
this.retrievedStudent.unsubscribe();
}
ngOnInit() {
this.retrievedStudent.next(false);
}
verifyclass(txop)
{
this.modify = false;
console.log(this.formGroup.value.specialit, "speciality");
if (txop.value === "1")
{
this.selectionBClass.next(false);
......@@ -110,6 +134,15 @@ import {
tomeas: '',
specialit: '',
});
console.log("a class");
this.classCapacitySub = this._hds.getCapacityPerSchool(this.formGroup.value.taxi,0,0,this.SchoolId ).subscribe(data => {
this.classCapacity$.next(data);
this.retrievedStudent.next(true); },
error => {
this.classCapacity$.next([{}]);
console.log("Error Getting Capacity");
},
() => console.log("Getting Capacity"));
}
else if (txop.value === "2")
......@@ -136,20 +169,61 @@ import {
this.selectionCClass.next(true);
this.StudentSelected$ = new BehaviorSubject([{}]);
this.StudentSelectedSub = this._hds.getSectorPerSchool(this.SchoolId).subscribe(this.StudentSelected$);
}
}
}
checkbclass(tmop,txop)
{
this.modify = false;
var sectorint = +this.formGroup.value.tomeas;
console.log(sectorint,"tomeas");
if (txop.value === "2")
{
console.log("b class");
this.classCapacitySub = this._hds.getCapacityPerSchool(this.formGroup.value.taxi,sectorint,0,this.SchoolId ).subscribe(data => {
this.classCapacity$.next(data);
this.retrievedStudent.next(true); },
error => {
this.classCapacity$.next([{}]);
console.log("Error Getting Capacity");
},
() => console.log("Getting Capacity"));
}
if (txop.value === "3")
{
this.StudentSelectedSpecial$ = new BehaviorSubject([{}]);
this.StudentSelectedSpecialSub = this._hds.getSpecialityPerSchool(this.SchoolId, sectorint).subscribe(this.StudentSelectedSpecial$);
}
}
checkcclass(tmop,txop,spop)
{
this.modify = false;
var sectorint = +this.formGroup.value.tomeas;
var specialint = +this.formGroup.value.specialit;
if (txop.value === "3")
{
console.log("c class");
this.classCapacitySub = this._hds.getCapacityPerSchool(this.formGroup.value.taxi,sectorint,specialint,this.SchoolId ).subscribe(data => {
this.classCapacity$.next(data);
this.retrievedStudent.next(true); },
error => {
this.classCapacity$.next([{}]);
console.log("Error Getting Capacity");
},
() => console.log("Getting Capacity"));
}
}
......@@ -165,4 +239,9 @@ saveCapacity()
}
modifyCapacity(){
this.modify = true;
}
}
\ No newline at end of file
......@@ -41,24 +41,77 @@ import {
<option *ngFor="let SpecialSelection$ of StudentSelectedSpecial$ | async; let i=index" [value] = "SpecialSelection$.id"> {{SpecialSelection$.specialty_id}} </option>
</select>
</div>
<button type="button" class="btn-primary btn-sm pull-right" (click)="findstudent(txoption,1)">
<button type="button" class="btn-primary btn-sm pull-right" (click)="findstudent(txoption,1)">
Αναζήτηση
</button>
<div *ngIf="(retrievedStudent | async)">
<div *ngFor="let StudentDetails$ of StudentInfo$ | async; let i=index">
<br>
<br>
Όνομα: {{StudentDetails$.name}} <br>
Επώνυμο: {{StudentDetails$.studentsurname}}<br>
Όνομα Πατέρα: {{StudentDetails$.fatherfirstname}}<br>
Επώνυμο Πατέρα:{{StudentDetails$.fathersurname}}<br>
Όνομα Μητέρας: {{StudentDetails$.motherfirstname}}<br>
Επώνυμο Μητέρας:{{StudentDetails$.mothersurname}}<br>
Ημερομηνία Γέννησης: {{StudentDetails$.birthdate}}<br>
<strong>Επιβεβαίωση Εγγραφής: </strong>
<input #cb class="pull-right" type="checkbox" name="{{ StudentDetails$.id }}" (change)="updateCheckedOptions(StudentDetails$.id, $event)" >
<br>
<br>
<ul class="list-group main-view">
<div *ngIf="(retrievedStudent | async)">
<div *ngFor="let StudentDetails$ of StudentInfo$ | async; let i=index; let isOdd=odd; let isEven=even" >
<li class="list-group-item isclickable" [class.oddout]="isOdd" [class.evenout]="isEven" (click)="setActiveUser(StudentDetails$.i)"
[class.selectedout]="userActive === StudentDetails$.i" [class.confirmed]="StudentDetails$.checkstatus === '1'"
[class.notconfirmed]="StudentDetails$.checkstatus === '0'" [class.notchecked]="(StudentDetails$.checkstatus !== '1') && (StudentDetails$.checkstatus !== '0')">
<h5> {{StudentDetails$.name}}&nbsp;{{StudentDetails$.name}} </h5>
</li>
<div [hidden]="userActive !== StudentDetails$.i" >
<p style="margin-top: 20px; line-height: 2em;"> Παρακαλώ αφού γίνει ο έλεγχος των στοιχείων του μαθητή επιβεβαιώστε τη δυνατότητα εγγραφής του.</p>
<strong><label>Επιβεβαίωση Εγγραφής:</label> </strong>
<select #cb name="{{StudentDetails$.id}}" (change)="updateCheckedOptions(StudentDetails$.id, cb)" >
<option value=1>Ναι</option>
<option value=2>Όχι</option>
<option value=3 selected></option>
</select>
<button type="button" class="btn-primary btn-sm pull-right" (click)="confirmStudent()">
Επιβεβαίωση Εγγραφής
</button>
<table>
<tr><td>
<div class="form-group" *ngIf="StudentDetails$.relationtostudent === 'Μαθητής' ">
<label for="guardianfirstname">Όνομα κηδεμόνα</label><p class="form-control" id="guardianfirstname" style="border:1px solid #eceeef;">{{StudentDetails$.guardianfirstname}} </p>
</div>
</td>
<td>
<div class="form-group" *ngIf="StudentDetails$.relationtostudent === 'Μαθητής' ">
<label for="guardiansurname">Επώνυμο κηδεμόνα</label><p class="form-control" id="guardiansurname" style="border:1px solid #eceeef;">{{StudentDetails$.guardiansurname}} </p>
</div>
</td></tr>
</table>
<div class="form-group"><label for="name">Όνομα μαθητή</label> <p class="form-control" id="name" style="border:1px solid #eceeef;"> {{StudentDetails$.name}} </p> </div>
<div><label for="studentsurname">Επώνυμο μαθητή</label> <p class="form-control" id = "studentsurname" style="border:1px solid #eceeef;"> {{StudentDetails$.studentsurname}} </p></div>
<div><label for="fatherfirstname">Όνομα Πατέρα</label> <p class="form-control" id = "fatherfirstname" style="border:1px solid #eceeef;"> {{StudentDetails$.fatherfirstname}} </p></div>
<div><label for="fathersurname">Επώνυμο Πατέρα</label> <p class="form-control" id = "fathersurname" style="border:1px solid #eceeef;"> {{StudentDetails$.fathersurname}} </p></div>
<div><label for="motherfirstname">Όνομα Μητέρας</label> <p class="form-control" id = "motherfirstname" style="border:1px solid #eceeef;"> {{StudentDetails$.motherfirstname}} </p></div>
<div><label for="mothersurname">Επώνυμο Μητέρας</label> <p class="form-control" id = "mothersurname" style="border:1px solid #eceeef;"> {{StudentDetails$.mothersurname}} </p></div>
<div><label for="birthdate">Ημερομηνία Γέννησης</label> <p class="form-control" id = "birthdate" style="border:1px solid #eceeef;"> {{StudentDetails$.birthdate}} </p></div>
<table>
<tr>
<td>
<div class="form-group">
<label for="regionaddress">Διεύθυνση κατοικίας</label><p class="form-control" id = "regionaddress" style="border:1px solid #eceeef;"> {{StudentDetails$.regionaddress}} </p>
</div>
</td>
<td>
<div class="form-group">
<label for="regiontk">TK </label><p class="form-control" id = "regiontk" style="border:1px solid #eceeef;"> {{StudentDetails$.regiontk}} </p>
</div>
</td>
<td>
<div class="form-group">
<label for="regionarea">Πόλη/Περιοχή</label><p class="form-control" id = "regionarea" style="border:1px solid #eceeef;"> {{StudentDetails$.regionarea}} </p>
</div>
</td>
</tr>
</table>
<div><label for="certificatetype">Τύπος απολυτηρίου</label> <p class="form-control" id = "certificatetype" style="border:1px solid #eceeef;"> {{StudentDetails$.certificatetype}} </p></div>
<div><label for="telnum">Τηλέφωνο επικοινωνίας</label> <p class="form-control" id = "telnum" style="border:1px solid #eceeef;"> {{StudentDetails$.telnum}} </p></div>
<div><label for="relationtostudent">Η αίτηση γίνεται από</label> <p class="form-control" id = "relationtostudent" style="border:1px solid #eceeef;"> {{StudentDetails$.relationtostudent}} </p></div>
</div>
<!-- </div> -->
</div>
......@@ -74,10 +127,7 @@ import {
<input #maxpage type="text" class="form-control" placeholder=".col-1" formControlName="maxpage">
</div>
</div>
<button type="button" class="btn-primary btn-sm pull-right" (click)="confirmStudent()">
Επιβεβαίωση Εγγραφής
</button>
<br>
<nav aria-label="pagination">
<ul class="pagination justify-content-center">
......@@ -107,6 +157,8 @@ import {
private StudentsSizeSub: Subscription;
private StudentSelectedSpecial$: BehaviorSubject<any>;
private StudentSelectedSpecialSub: Subscription;
private SubmitedDetails$: BehaviorSubject<any>;
private SubmitedDetailsSub: Subscription;
private retrievedStudent: BehaviorSubject<boolean>;
private selectionBClass: BehaviorSubject<boolean>;
private selectionCClass: BehaviorSubject<boolean>;
......@@ -114,9 +166,10 @@ import {
private currentclass: Number;
private saved: Array<number> = new Array();
private limitdown = 0;
private limitup= 5;
private limitup= 25;
private pageno = 1;
//private maxpage:Number;
private userActive = <number>-1;
private type: Number;
constructor(private fb: FormBuilder,
......@@ -127,6 +180,7 @@ import {
this.StudentSelectedSpecial$ = new BehaviorSubject([{}]);
this.StudentInfo$ = new BehaviorSubject([{}]);
this.StudentsSize$ = new BehaviorSubject({});
this.SubmitedDetails$ = new BehaviorSubject([{}]);
this.retrievedStudent = new BehaviorSubject(false);
this.selectionBClass = new BehaviorSubject(false);
this.selectionCClass = new BehaviorSubject(false);
......@@ -151,6 +205,9 @@ import {
this.selectionCClass.unsubscribe();
if (this.retrievedStudent)
this.retrievedStudent.unsubscribe();
if (this.SubmitedDetailsSub)
this.SubmitedDetailsSub.unsubscribe();
}
ngOnInit() {
......@@ -271,27 +328,37 @@ import {
}
updateCheckedOptions(id, event) {
updateCheckedOptions(id, cbvalue) {
let i = this.saved.length;
console.log(cbvalue.value,"aaaaa");
if (event.target.checked === false) {
var count = this.saved.length;