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

trans

parents f0a03075 f9c55197
......@@ -188,3 +188,11 @@ 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'
......@@ -221,6 +221,14 @@ 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,
);
}
......@@ -282,13 +290,17 @@ 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 == 1)
$studentConfirm->set('directorconfirm', false);
$studentConfirm->save();
}
}
......
......@@ -104,11 +104,7 @@ class SubmitedApplications extends ControllerBase
'telnum' =>$object -> telnum ->value,
'relationtostudent' =>$object -> relationtostudent ->value,
'birthdate' =>$object -> birthdate ->value,
);
);
$i++;
}
......@@ -127,7 +123,7 @@ class SubmitedApplications extends ControllerBase
} else {
return $this->respondWithStatus([
'message' => t("User not found"),
'message' => t("User not found!!!!"),
], Response::HTTP_FORBIDDEN);
}
......@@ -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);
}
}
......
......@@ -44,21 +44,72 @@ import {
<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>
<ul class="list-group main-view">
<div *ngIf="(retrievedStudent | async)">
<strong>Επιβεβαίωση Εγγραφής: </strong>
<input #cb class="pull-right" type="checkbox" name="{{ StudentDetails$.id }}" (change)="updateCheckedOptions(StudentDetails$.id, $event)" >
<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" >
<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>
......@@ -75,9 +126,6 @@ import {
</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 +155,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>;
......@@ -116,7 +166,8 @@ import {
private limitdown = 0;
private limitup= 5;
private pageno = 1;
//private maxpage:Number;
private userActive = <number>-1;
private type: Number;
constructor(private fb: FormBuilder,
......@@ -127,6 +178,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 +203,9 @@ import {
this.selectionCClass.unsubscribe();
if (this.retrievedStudent)
this.retrievedStudent.unsubscribe();
if (this.SubmitedDetailsSub)
this.SubmitedDetailsSub.unsubscribe();
}
ngOnInit() {
......@@ -271,27 +326,36 @@ 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;
for (var j = 0; j < count; j++) {
if (this.saved[j] === id) {
this.saved.splice(j, 1);
}
}
if (cbvalue.value === '1') {
this.saved[i] = id;
this.type = 1;
console.log("ok")
}
else {
else if (cbvalue.value === '2') {
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() {
this._hds.saveConfirmStudents(this.saved);
this._hds.saveConfirmStudents(this.saved, this.type);
}
checkcclass() {
......@@ -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,7 +72,6 @@ import {AppSettings} from '../../app.settings';
this.studentDataFields$ = new BehaviorSubject(STUDENT_DATA_FIELDS_INITIAL_STATE);
this.criteria$ = new BehaviorSubject(CRITERIA_INITIAL_STATE);
this.loginInfo$ = new BehaviorSubject(LOGININFO_INITIAL_STATE);
};
ngOnInit() {
......
......@@ -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="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>
<br>
<h5>Επιλογές ΕΠΑΛ</h5>
<div *ngFor="let epalChoices$ of EpalChosen$ | async" [hidden]="UserData$.id !== userActive">
Σχολείο: {{epalChoices$.epal_id}}
Σειρά Προτίμισης:{{epalChoices$.choice_no}}
......@@ -105,6 +112,11 @@ import * as html2canvas from "html2canvas"
private EpalChosen$: BehaviorSubject<any>;
private EpalChosenSub: Subscription;
private incomeChosen$: BehaviorSubject<any>;
private incomeChosenSub: Subscription;
private CritirioChosen$: BehaviorSubject<any>;
private CritirioChosenSub: Subscription;
public StudentId;
private userActive = <number>-1;
......@@ -117,6 +129,8 @@ import * as html2canvas from "html2canvas"
this.SubmitedApplic$ = new BehaviorSubject([{}]);
this.SubmitedDetails$ = new BehaviorSubject([{}]);
this.EpalChosen$ = new BehaviorSubject([{}]);
this.CritirioChosen$ = new BehaviorSubject([{}]);
this.incomeChosen$ = new BehaviorSubject([{}]);
}
ngOnDestroy()
......@@ -127,6 +141,11 @@ import * as html2canvas from "html2canvas"
this.SubmitedDetailsSub.unsubscribe();
if (this.EpalChosenSub)
this.EpalChosenSub.unsubscribe();
if (this.CritirioChosenSub)
this.CritirioChosenSub.unsubscribe();
if (this.incomeChosenSub)
this.incomeChosenSub.unsubscribe();
this.SubmitedDetails$.unsubscribe();
this.EpalChosen$.unsubscribe();
this.SubmitedApplic$.unsubscribe();
......@@ -144,12 +163,6 @@ import * as html2canvas from "html2canvas"
},
() => console.log("Getting Schools"));
console.log(this.SubmitedApplic$);
}
......@@ -158,7 +171,6 @@ import * as html2canvas from "html2canvas"
setActiveUser(ind,i)
{
ind = +ind;
console.log(this.userActive,"RA",ind);
if (ind === this.userActive){
ind = -1;
......@@ -179,7 +191,20 @@ import * as html2canvas from "html2canvas"
console.log("Error 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"
doc.onload = function(){
console.log(img, doc, "lalalalalala");
doc.addImage(img, 'PNG',0, 0, 210, 297);
doc.save('applications.pdf');
}
});
}
createPdf()
{
var doc = new jsPDF();
......@@ -212,9 +242,8 @@ createPdf()
// Save the PDF
doc.save('Test.pdf');
}
}
}
}
......@@ -562,7 +562,7 @@ export class HelperDataService implements OnInit, OnDestroy {
saveConfirmStudents(students) {
saveConfirmStudents(students, type) {
this.loginInfo$.getValue().forEach(loginInfoToken => {
this.authToken = loginInfoToken.auth_token;
this.authRole = loginInfoToken.auth_role;
......@@ -573,7 +573,7 @@ export class HelperDataService implements OnInit, OnDestroy {
this.createAuthorizationHeader(headers);
let options = new RequestOptions({ headers: headers });
return new Promise((resolve, reject) => {
this.http.post(`${AppSettings.API_ENDPOINT}/epal/confirmstudent`, { students }, options)
this.http.post(`${AppSettings.API_ENDPOINT}/epal/confirmstudent`, { students, type}, options)
.map(response => response.json())
.subscribe(data => {
resolve(data);
......@@ -752,5 +752,20 @@ export class HelperDataService implements OnInit, OnDestroy {
getCritiria(headerid, type) {
let headerIdNew = headerid.toString();
this.loginInfo$.getValue().forEach(loginInfoToken => {
this.authToken = loginInfoToken.auth_token;
this.authRole = loginInfoToken.auth_role;
});
let headers = new Headers({
"Content-Type": "application/json",
});
this.createAuthorizationHeader(headers);
let options = new RequestOptions({ headers: headers });
return this.http.get(`${AppSettings.API_ENDPOINT}/epal/critiriachosen/` + headerIdNew + '/' + type, options)
.map(response => response.json());
}
}
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