Commit ef77a939 authored by Open Source Developer's avatar Open Source Developer

trans

parent ebfb4503
...@@ -175,3 +175,5 @@ coursesperschools: ...@@ -175,3 +175,5 @@ coursesperschools:
\ No newline at end of file
...@@ -456,35 +456,42 @@ public function SaveCapacity(Request $request,$taxi,$tomeas,$specialit,$schoolid ...@@ -456,35 +456,42 @@ public function SaveCapacity(Request $request,$taxi,$tomeas,$specialit,$schoolid
{ {
$list= array(); $list= array();
$SchoolCats = $this->entityTypeManager->getStorage('eepal_school')->loadByProperties(array('id'=> $schoolid ));
$SchoolCat = reset($SchoolCats);
$CourseA = $this->entityTypeManager->getStorage('eepal_school')->loadByProperties(array('id'=> $schoolid )); if ($SchoolCat){
$categ = $SchoolCat-> metathesis_region -> value;
}
$CourseA = $this->entityTypeManager->getStorage('epal_student')->loadByProperties(array('id'=> $schoolid ));
if ($CourseA) if ($CourseA)
{ {
$studentPerSchool = $this->entityTypeManager->getStorage('epal_student_class')->loadByProperties(array('epal_id'=> $schoolid, 'specialization_id' => -1, 'currentclass' => 1 ));
$studentPerSchool = $this->entityTypeManager->getStorage('epal_student_class')->loadByProperties(array('currentepal'=> $schoolid, 'specialization_id' => -1, 'currentclass' => 1 ));
$list = array(); $list = array();
foreach ($CourseA as $object) { foreach ($CourseA as $object) {
$list[] = array( $list[] = array(
'id' => '1',
'name' => 'Α Λυκείου', 'name' => 'Α Λυκείου',
'id' => sizeof($studentPerSchool), 'size' => sizeof($studentPerSchool),
'categ' => $categ,
'classes' => 1
); );
} } } }
$CourseB = $this->entityTypeManager->getStorage('eepal_sectors_in_epal')->loadByProperties(array('epal_id' => $schoolid )); $CourseB = $this->entityTypeManager->getStorage('eepal_sectors_in_epal')->loadByProperties(array('epal_id' => $schoolid ));
if ($CourseB) if ($CourseB)
{ {
foreach ($CourseB as $object) { foreach ($CourseB as $object) {
$studentPerSchool = $this->entityTypeManager->getStorage('epal_student_class')->loadByProperties(array('epal_id'=> $schoolid, 'specialization_id' => 9, 'currentclass' => 2 )); $sectorid = $object -> sector_id -> entity -> id();
$studentPerSchool = $this->entityTypeManager->getStorage('epal_student_class')->loadByProperties(array('currentepal'=> $schoolid, 'specialization_id' => $sectorid, 'currentclass' => 2 ));
$list[] = array( $list[] = array(
'id' => $object -> sector_id -> entity -> id(),
'name' => 'Β Λυκείου '.$object -> sector_id -> entity-> get('name')->value, 'name' => 'Β Λυκείου '.$object -> sector_id -> entity-> get('name')->value,
'id' => sizeof($studentPerSchool), 'size' => sizeof($studentPerSchool),
'categ' => $categ,
'classes' => 2
); );
} }
...@@ -493,13 +500,21 @@ public function SaveCapacity(Request $request,$taxi,$tomeas,$specialit,$schoolid ...@@ -493,13 +500,21 @@ public function SaveCapacity(Request $request,$taxi,$tomeas,$specialit,$schoolid
if ($CourseC) if ($CourseC)
{ {
foreach ($CourseC as $object) { foreach ($CourseC as $object) {
$specialityid = $object -> specialty_id -> entity -> id() ;
$studentPerSchool = $this->entityTypeManager->getStorage('epal_student_class')->loadByProperties(array('currentepal'=> $schoolid, 'specialization_id' => $specialityid, 'currentclass' => 3 ));
$list[] = array( $list[] = array(
'id'=> $object -> specialty_id -> entity -> id(),
'name' => 'Γ Λυκείου '.$object -> specialty_id -> entity-> get('name')->value, 'name' => 'Γ Λυκείου '.$object -> specialty_id -> entity-> get('name')->value,
'size' => sizeof($studentPerSchool),
'categ' => $categ,
'classes' => 3
); );
} }
} }
if ($CourseA || $CourseB || $CourseC){ if ($CourseA || $CourseB || $CourseC)
{
return $this->respondWithStatus( return $this->respondWithStatus(
$list $list
...@@ -522,6 +537,10 @@ public function SaveCapacity(Request $request,$taxi,$tomeas,$specialit,$schoolid ...@@ -522,6 +537,10 @@ public function SaveCapacity(Request $request,$taxi,$tomeas,$specialit,$schoolid
} }
} }
private function respondWithStatus($arr, $s) { private function respondWithStatus($arr, $s) {
$res = new JsonResponse($arr); $res = new JsonResponse($arr);
$res->setStatusCode($s); $res->setStatusCode($s);
......
...@@ -20,22 +20,28 @@ import { ...@@ -20,22 +20,28 @@ import {
@Component({ @Component({
selector: 'perfecture-view', selector: 'perfecture-view',
template: ` template: `
<ul class="list-group main-view"> <ul class="list-group main-view">
<div *ngFor="let SchoolNames$ of SchoolsPerPerf$ | async; let i=index; let isOdd=odd; let isEven=even" > <div *ngFor="let SchoolNames$ of SchoolsPerPerf$ | async; let i=index; let isOdd=odd; let isEven=even" >
<li class="list-group-item isclickable" (click)="setActiveRegion(SchoolNames$.id)" [class.oddout]="isOdd" [class.evenout]="isEven" [class.selectedout]="regionActive === SchoolNames$.id "> <li class="list-group-item isclickable" (click)="setActiveRegion(SchoolNames$.id)" [class.oddout]="isOdd" [class.evenout]="isEven" [class.selectedout]="regionActive === SchoolNames$.id ">
<h5> {{SchoolNames$.name}}</h5> <h5> {{SchoolNames$.name}}</h5>
</li> </li>
</div>
</ul> <div *ngFor="let CoursesNames$ of CoursesPerPerf$ | async; let j=index; let isOdd2=odd; let isEven2=even" [class.oddin]="isOdd2" [class.evenin]="isEven2" [class.changecolor]="calccolor(CoursesNames$.id,CoursesNames$.categ,CoursesNames$.classes)" [hidden]="SchoolNames$.id !== regionActive" >
<div> {{CoursesNames$.name}} </div>
</div>
</div>
</ul>
<div class="col-md-6"> <div class="col-md-6">
<button type="button" class="btn-primary btn-lg pull-right" (click)="navigateToApplication()" > <button type="button" class="btn-primary btn-lg pull-right" (click)="navigateToApplication()" >
<i class="fa fa-forward"></i> <i class="fa fa-forward"></i>
</button> </button>
</div> </div>
` `
}) })
...@@ -44,6 +50,10 @@ import { ...@@ -44,6 +50,10 @@ import {
public formGroup: FormGroup; public formGroup: FormGroup;
private SchoolsPerPerf$: BehaviorSubject<any>; private SchoolsPerPerf$: BehaviorSubject<any>;
private SchoolPerPerfSub: Subscription; private SchoolPerPerfSub: Subscription;
private LimitPerCategSub: BehaviorSubject<any>;
private LimitPerCateg$: Subscription;
private CoursesPerPerf$: BehaviorSubject<any>;
private CoursesPerPerfSub: Subscription;
private StudentsSize$: BehaviorSubject<any>; private StudentsSize$: BehaviorSubject<any>;
private StudentsSizeSub: Subscription; private StudentsSizeSub: Subscription;
public perfecture = 1; public perfecture = 1;
...@@ -55,6 +65,8 @@ import { ...@@ -55,6 +65,8 @@ import {
private _hds: HelperDataService, private _hds: HelperDataService,
) { ) {
this.SchoolsPerPerf$ = new BehaviorSubject([{}]); this.SchoolsPerPerf$ = new BehaviorSubject([{}]);
this.LimitPerCateg$ = new BehaviorSubject([{}]);
this.CoursesPerPerf$ = new BehaviorSubject([{}]);
this.StudentsSize$ = new BehaviorSubject({}); this.StudentsSize$ = new BehaviorSubject({});
this.formGroup = this.fb.group({ this.formGroup = this.fb.group({
}); });
...@@ -67,7 +79,7 @@ import { ...@@ -67,7 +79,7 @@ import {
ngOnInit() { ngOnInit() {
this.SchoolPerPerfSub = this._hds.getSchoolPerPerfecture(147).subscribe(data => { this.SchoolPerPerfSub = this._hds.getSchoolPerPerfecture(this.perfecture).subscribe(data => {
this.SchoolsPerPerf$.next(data); this.SchoolsPerPerf$.next(data);
}, },
error => { error => {
...@@ -85,7 +97,19 @@ import { ...@@ -85,7 +97,19 @@ import {
console.log(ind,"ind"); console.log(ind,"ind");
if (ind === this.regionActive) if (ind === this.regionActive)
ind = -1; ind = -1;
console.log(this.regionActive,"RA");
this.regionActive = ind; this.regionActive = ind;
this.CoursesPerPerfSub = this._hds.getCoursePerPerfecture(this.regionActive).subscribe(data => {
this.CoursesPerPerf$.next(data);
},
error => {
this.CoursesPerPerf$.next([{}]);
console.log("Error Getting Courses");
},
() => console.log("Getting Courses Per Perf"));
} }
...@@ -98,15 +122,23 @@ import { ...@@ -98,15 +122,23 @@ import {
} }
calccolor(id) calccolor(id, categ, classes)
{ {
var newid = +id;
// this.StudentsSizeSub = this._hds.getStudentPerSchool(147, 1, 2, 0, 0).subscribe(this.StudentsSize$);
if (id == 147) this.LimitPerCategSub = this._hds.getLimitPerCateg(categ, classes).subscribe(data => {
return true; this.LimitPerCateg$.next(data);
if (id == 150) },
error => {
this.LimitPerCateg$.next([{}]);
console.log("Error Getting Limits");
},
() => console.log("Getting Limits"));
var newid = +id;
if (newid <= 5)
return true; return true;
else
return false;
} }
......
...@@ -698,10 +698,52 @@ export class HelperDataService implements OnInit, OnDestroy { ...@@ -698,10 +698,52 @@ export class HelperDataService implements OnInit, OnDestroy {
}); });
this.createAuthorizationHeader(headers); this.createAuthorizationHeader(headers);
let options = new RequestOptions({ headers: headers }); let options = new RequestOptions({ headers: headers });
return this.http.get(`${AppSettings.API_ENDPOINT}/epal/CoursesperSch/` + PerfectureIdNew , options) return this.http.get(`${AppSettings.API_ENDPOINT}/epal/ScoolperPerf/` + PerfectureIdNew , options)
.map(response => response.json()); .map(response => response.json());
} }
getCoursePerPerfecture(PerfectureId){
console.log(PerfectureId,"a");
let PerfectureIdNew = PerfectureId.toString();
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",
});
this.createAuthorizationHeader(headers);
let options = new RequestOptions({ headers: headers });
return this.http.get(`${AppSettings.API_ENDPOINT}/epal/CoursesperSch/` + PerfectureIdNew , options)
.map(response => response.json());
}
getLimitPerCateg(categ, classes){
let classesNew = classes.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/LimitPerCateg/` + categ + classesNew , 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