Commit 0e06c09f authored by Open Source Developer's avatar Open Source Developer

trans

parents f0a03075 f9c55197
...@@ -188,3 +188,11 @@ coursesperschools: ...@@ -188,3 +188,11 @@ coursesperschools:
_controller: '\Drupal\epal\Controller\DirectorView::getCoursesPerSchool' _controller: '\Drupal\epal\Controller\DirectorView::getCoursesPerSchool'
requirements: requirements:
_user_is_logged_in: 'TRUE' _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'
...@@ -221,6 +221,14 @@ public function getStudentPerSchool(Request $request, $epalId , $selectId, $clas ...@@ -221,6 +221,14 @@ public function getStudentPerSchool(Request $request, $epalId , $selectId, $clas
'fathersurname' =>$epalStudent -> fathersurname ->value, 'fathersurname' =>$epalStudent -> fathersurname ->value,
'motherfirstname' => $epalStudent -> motherfirstname ->value, 'motherfirstname' => $epalStudent -> motherfirstname ->value,
'mothersurname' =>$epalStudent -> mothersurname ->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, 'birthdate' =>$epalStudent -> birthdate ->value,
); );
} }
...@@ -282,13 +290,17 @@ public function getStudentPerSchool(Request $request, $epalId , $selectId, $clas ...@@ -282,13 +290,17 @@ public function getStudentPerSchool(Request $request, $epalId , $selectId, $clas
{ {
$postData = json_decode($content); $postData = json_decode($content);
$arr = $postData->students; $arr = $postData->students;
$type = $postData ->type
foreach ($arr as $value) { foreach ($arr as $value) {
$valnew = intval($value); $valnew = intval($value);
$studentForConfirm = $this->entityTypeManager->getStorage('epal_student_class')->loadByProperties(array('id' => $valnew )); $studentForConfirm = $this->entityTypeManager->getStorage('epal_student_class')->loadByProperties(array('id' => $valnew ));
$studentConfirm = reset($studentForConfirm); $studentConfirm = reset($studentForConfirm);
if ($studentConfirm) { if ($studentConfirm) {
if ($type == 1)
$studentConfirm->set('directorconfirm', true); $studentConfirm->set('directorconfirm', true);
if ($type == 1)
$studentConfirm->set('directorconfirm', false);
$studentConfirm->save(); $studentConfirm->save();
} }
} }
......
...@@ -104,11 +104,7 @@ class SubmitedApplications extends ControllerBase ...@@ -104,11 +104,7 @@ class SubmitedApplications extends ControllerBase
'telnum' =>$object -> telnum ->value, 'telnum' =>$object -> telnum ->value,
'relationtostudent' =>$object -> relationtostudent ->value, 'relationtostudent' =>$object -> relationtostudent ->value,
'birthdate' =>$object -> birthdate ->value, 'birthdate' =>$object -> birthdate ->value,
);
);
$i++; $i++;
} }
...@@ -127,7 +123,7 @@ class SubmitedApplications extends ControllerBase ...@@ -127,7 +123,7 @@ class SubmitedApplications extends ControllerBase
} else { } else {
return $this->respondWithStatus([ return $this->respondWithStatus([
'message' => t("User not found"), 'message' => t("User not found!!!!"),
], Response::HTTP_FORBIDDEN); ], Response::HTTP_FORBIDDEN);
} }
...@@ -178,6 +174,67 @@ public function getEpalChosen(Request $request, $studentId) ...@@ -178,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);
}
}
......
...@@ -41,24 +41,75 @@ import { ...@@ -41,24 +41,75 @@ import {
<option *ngFor="let SpecialSelection$ of StudentSelectedSpecial$ | async; let i=index" [value] = "SpecialSelection$.id"> {{SpecialSelection$.specialty_id}} </option> <option *ngFor="let SpecialSelection$ of StudentSelectedSpecial$ | async; let i=index" [value] = "SpecialSelection$.id"> {{SpecialSelection$.specialty_id}} </option>
</select> </select>
</div> </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> </button>
<div *ngIf="(retrievedStudent | async)"> <br>
<div *ngFor="let StudentDetails$ of StudentInfo$ | async; let i=index"> <br>
<br> <ul class="list-group main-view">
<br> <div *ngIf="(retrievedStudent | async)">
Όνομα: {{StudentDetails$.name}} <br>
Επώνυμο: {{StudentDetails$.studentsurname}}<br> <div *ngFor="let StudentDetails$ of StudentInfo$ | async; let i=index; let isOdd=odd; let isEven=even" >
Όνομα Πατέρα: {{StudentDetails$.fatherfirstname}}<br> <li class="list-group-item isclickable" [class.oddout]="isOdd" [class.evenout]="isEven" (click)="setActiveUser(StudentDetails$.i)" [class.selectedout]="userActive === StudentDetails$.i" >
Επώνυμο Πατέρα:{{StudentDetails$.fathersurname}}<br> <h5> {{StudentDetails$.name}}&nbsp;{{StudentDetails$.name}} </h5>
Όνομα Μητέρας: {{StudentDetails$.motherfirstname}}<br> </li>
Επώνυμο Μητέρας:{{StudentDetails$.mothersurname}}<br>
Ημερομηνία Γέννησης: {{StudentDetails$.birthdate}}<br>
<strong>Επιβεβαίωση Εγγραφής: </strong>
<input #cb class="pull-right" type="checkbox" name="{{ StudentDetails$.id }}" (change)="updateCheckedOptions(StudentDetails$.id, $event)" >
<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> -->
</div> </div>
...@@ -74,10 +125,7 @@ import { ...@@ -74,10 +125,7 @@ import {
<input #maxpage type="text" class="form-control" placeholder=".col-1" formControlName="maxpage"> <input #maxpage type="text" class="form-control" placeholder=".col-1" formControlName="maxpage">
</div> </div>
</div> </div>
<button type="button" class="btn-primary btn-sm pull-right" (click)="confirmStudent()">
Επιβεβαίωση Εγγραφής
</button>
<br> <br>
<nav aria-label="pagination"> <nav aria-label="pagination">
<ul class="pagination justify-content-center"> <ul class="pagination justify-content-center">
...@@ -107,6 +155,8 @@ import { ...@@ -107,6 +155,8 @@ import {
private StudentsSizeSub: Subscription; private StudentsSizeSub: Subscription;
private StudentSelectedSpecial$: BehaviorSubject<any>; private StudentSelectedSpecial$: BehaviorSubject<any>;
private StudentSelectedSpecialSub: Subscription; private StudentSelectedSpecialSub: Subscription;
private SubmitedDetails$: BehaviorSubject<any>;
private SubmitedDetailsSub: Subscription;
private retrievedStudent: BehaviorSubject<boolean>; private retrievedStudent: BehaviorSubject<boolean>;
private selectionBClass: BehaviorSubject<boolean>; private selectionBClass: BehaviorSubject<boolean>;
private selectionCClass: BehaviorSubject<boolean>; private selectionCClass: BehaviorSubject<boolean>;
...@@ -116,7 +166,8 @@ import { ...@@ -116,7 +166,8 @@ import {
private limitdown = 0; private limitdown = 0;
private limitup= 5; private limitup= 5;
private pageno = 1; private pageno = 1;
//private maxpage:Number; private userActive = <number>-1;
private type: Number;
constructor(private fb: FormBuilder, constructor(private fb: FormBuilder,
...@@ -127,6 +178,7 @@ import { ...@@ -127,6 +178,7 @@ import {
this.StudentSelectedSpecial$ = new BehaviorSubject([{}]); this.StudentSelectedSpecial$ = new BehaviorSubject([{}]);
this.StudentInfo$ = new BehaviorSubject([{}]); this.StudentInfo$ = new BehaviorSubject([{}]);
this.StudentsSize$ = new BehaviorSubject({}); this.StudentsSize$ = new BehaviorSubject({});
this.SubmitedDetails$ = new BehaviorSubject([{}]);
this.retrievedStudent = new BehaviorSubject(false); this.retrievedStudent = new BehaviorSubject(false);
this.selectionBClass = new BehaviorSubject(false); this.selectionBClass = new BehaviorSubject(false);
this.selectionCClass = new BehaviorSubject(false); this.selectionCClass = new BehaviorSubject(false);
...@@ -151,6 +203,9 @@ import { ...@@ -151,6 +203,9 @@ import {
this.selectionCClass.unsubscribe(); this.selectionCClass.unsubscribe();
if (this.retrievedStudent) if (this.retrievedStudent)
this.retrievedStudent.unsubscribe(); this.retrievedStudent.unsubscribe();
if (this.SubmitedDetailsSub)
this.SubmitedDetailsSub.unsubscribe();
} }
ngOnInit() { ngOnInit() {
...@@ -271,27 +326,36 @@ import { ...@@ -271,27 +326,36 @@ import {
} }
updateCheckedOptions(id, event) { updateCheckedOptions(id, cbvalue) {
let i = this.saved.length; let i = this.saved.length;
console.log(cbvalue.value,"aaaaa");
if (cbvalue.value === '1') {
if (event.target.checked === false) { this.saved[i] = id;
var count = this.saved.length; this.type = 1;
for (var j = 0; j < count; j++) { console.log("ok")
if (this.saved[j] === id) {
this.saved.splice(j, 1);
}
}
} }
else { else if (cbvalue.value === '2') {
this.saved[i] = id; this.saved[i] = id;
this.type = 2;
//var count = this.saved.length;
//for (var j = 0; j < count; j++) {
// if (this.saved[j] === id) {
// this.saved.splice(j, 1);
// }
console.log("not confirmed")
}
else if (cbvalue.value === '3') {
} }
} }
confirmStudent() { confirmStudent() {
this._hds.saveConfirmStudents(this.saved); this._hds.saveConfirmStudents(this.saved, this.type);
} }
checkcclass() { checkcclass() {
...@@ -323,4 +387,19 @@ import { ...@@ -323,4 +387,19 @@ import {
} }
setActiveUser(ind)
{
ind = +ind;
console.log(this.userActive,"RA",ind);
if (ind === this.userActive){
ind = -1;
}
ind--;
this.userActive = ind+1 ;
}
} }
...@@ -72,8 +72,7 @@ import {AppSettings} from '../../app.settings'; ...@@ -72,8 +72,7 @@ import {AppSettings} from '../../app.settings';
this.studentDataFields$ = new BehaviorSubject(STUDENT_DATA_FIELDS_INITIAL_STATE); this.studentDataFields$ = new BehaviorSubject(STUDENT_DATA_FIELDS_INITIAL_STATE);
this.criteria$ = new BehaviorSubject(CRITERIA_INITIAL_STATE); this.criteria$ = new BehaviorSubject(CRITERIA_INITIAL_STATE);
this.loginInfo$ = new BehaviorSubject(LOGININFO_INITIAL_STATE); this.loginInfo$ = new BehaviorSubject(LOGININFO_INITIAL_STATE);
};
};
ngOnInit() { ngOnInit() {
this.loginInfoSub = this._ngRedux.select(state => { this.loginInfoSub = this._ngRedux.select(state => {
......
...@@ -76,10 +76,17 @@ import * as html2canvas from "html2canvas" ...@@ -76,10 +76,17 @@ import * as html2canvas from "html2canvas"
<div><label for="telnum">Τηλέφωνο επικοινωνίας</label> <p class="form-control" id = "telnum" style="border:1px solid #eceeef;"> {{StudentDetails$.telnum}} </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><label for="relationtostudent">Η αίτηση γίνεται από</label> <p class="form-control" id = "relationtostudent" style="border:1px solid #eceeef;"> {{StudentDetails$.relationtostudent}} </p></div>
<h5>Κοινωνικά Κριτίρια </h5>
<div *ngFor="let critiriaChoices$ of CritirioChosen$ | async" [hidden]="UserData$.id !== userActive">
{{critiriaChoices$.critirio}}
</div>
<h5>Εισοδηματικά Κριτίρια </h5>
<div *ngFor="let incomeChoices$ of incomeChosen$ | async" [hidden]="UserData$.id !== userActive">
{{incomeChoices$.critirio}}
</div>
<p><b>Επιλογές ΕΠΑΛ</b> </p> <h5>Επιλογές ΕΠΑΛ</h5>
<br>
<div *ngFor="let epalChoices$ of EpalChosen$ | async" [hidden]="UserData$.id !== userActive"> <div *ngFor="let epalChoices$ of EpalChosen$ | async" [hidden]="UserData$.id !== userActive">
Σχολείο: {{epalChoices$.epal_id}} Σχολείο: {{epalChoices$.epal_id}}
Σειρά Προτίμισης:{{epalChoices$.choice_no}} Σειρά Προτίμισης:{{epalChoices$.choice_no}}
...@@ -105,7 +112,12 @@ import * as html2canvas from "html2canvas" ...@@ -105,7 +112,12 @@ import * as html2canvas from "html2canvas"
private EpalChosen$: BehaviorSubject<any>; private EpalChosen$: BehaviorSubject<any>;
private EpalChosenSub: Subscription; private EpalChosenSub: Subscription;
private incomeChosen$: BehaviorSubject<any>;
private incomeChosenSub: Subscription;
private CritirioChosen$: BehaviorSubject<any>;
private CritirioChosenSub: Subscription;
public StudentId; public StudentId;
private userActive = <number>-1; private userActive = <number>-1;
...@@ -117,6 +129,8 @@ import * as html2canvas from "html2canvas" ...@@ -117,6 +129,8 @@ import * as html2canvas from "html2canvas"
this.SubmitedApplic$ = new BehaviorSubject([{}]); this.SubmitedApplic$ = new BehaviorSubject([{}]);
this.SubmitedDetails$ = new BehaviorSubject([{}]); this.SubmitedDetails$ = new BehaviorSubject([{}]);
this.EpalChosen$ = new BehaviorSubject([{}]); this.EpalChosen$ = new BehaviorSubject([{}]);
this.CritirioChosen$ = new BehaviorSubject([{}]);
this.incomeChosen$ = new BehaviorSubject([{}]);
} }
ngOnDestroy() ngOnDestroy()
...@@ -127,6 +141,11 @@ import * as html2canvas from "html2canvas" ...@@ -127,6 +141,11 @@ import * as html2canvas from "html2canvas"
this.SubmitedDetailsSub.unsubscribe(); this.SubmitedDetailsSub.unsubscribe();
if (this.EpalChosenSub) if (this.EpalChosenSub)
this.EpalChosenSub.unsubscribe(); this.EpalChosenSub.unsubscribe();
if (this.CritirioChosenSub)
this.CritirioChosenSub.unsubscribe();
if (this.incomeChosenSub)
this.incomeChosenSub.unsubscribe();
this.SubmitedDetails$.unsubscribe(); this.SubmitedDetails$.unsubscribe();
this.EpalChosen$.unsubscribe(); this.EpalChosen$.unsubscribe();
this.SubmitedApplic$.unsubscribe(); this.SubmitedApplic$.unsubscribe();
...@@ -144,12 +163,6 @@ import * as html2canvas from "html2canvas" ...@@ -144,12 +163,6 @@ import * as html2canvas from "html2canvas"
}, },
() => console.log("Getting Schools")); () => console.log("Getting Schools"));
console.log(this.SubmitedApplic$); console.log(this.SubmitedApplic$);
} }
...@@ -157,8 +170,7 @@ import * as html2canvas from "html2canvas" ...@@ -157,8 +170,7 @@ import * as html2canvas from "html2canvas"
setActiveUser(ind,i) setActiveUser(ind,i)
{ {
ind = +ind; ind = +ind;
console.log(this.userActive,"RA",ind); console.log(this.userActive,"RA",ind);
if (ind === this.userActive){ if (ind === this.userActive){
ind = -1; ind = -1;
...@@ -179,7 +191,20 @@ import * as html2canvas from "html2canvas" ...@@ -179,7 +191,20 @@ import * as html2canvas from "html2canvas"
console.log("Error Getting Schools"); console.log("Error Getting Schools");
}, },
() => console.log("Getting Schools")); () => console.log("Getting Schools"));
this.CritirioChosenSub = this._hds.getCritiria(this.userActive+1, 1).subscribe(data => {
this.CritirioChosen$.next(data)},
error => {
this.CritirioChosen$.next([{}]);
console.log("Error Getting Schools");
},
() => console.log("Getting Schools"));
this.incomeChosenSub = this._hds.getCritiria(this.userActive+1, 2).subscribe(data => {
this.incomeChosen$.next(data)},
error => {
this.incomeChosen$.next([{}]);
console.log("Error Getting Schools");
},
() => console.log("Getting Schools"));
} }
...@@ -194,13 +219,18 @@ import * as html2canvas from "html2canvas" ...@@ -194,13 +219,18 @@ import * as html2canvas from "html2canvas"
doc.onload = function(){ doc.onload = function(){
console.log(img, doc, "lalalalalala"); console.log(img, doc, "lalalalalala");
doc.addImage(img, 'PNG',0, 0, 210, 297); doc.addImage(img, 'PNG',0, 0, 210, 297);
doc.save('applications.pdf'); doc.save('applications.pdf');
} }
}); });
} }
createPdf() createPdf()
{ {
var doc = new jsPDF(); var doc = new jsPDF();
...@@ -212,9 +242,8 @@ createPdf() ...@@ -212,9 +242,8 @@ createPdf()
// Save the PDF // Save the PDF
doc.save('Test.pdf');