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

trans

parent ebfb4503
......@@ -175,3 +175,5 @@ coursesperschools:
\ No newline at end of file
......@@ -456,35 +456,42 @@ public function SaveCapacity(Request $request,$taxi,$tomeas,$specialit,$schoolid
{
$list= array();
$CourseA = $this->entityTypeManager->getStorage('eepal_school')->loadByProperties(array('id'=> $schoolid ));
$SchoolCats = $this->entityTypeManager->getStorage('eepal_school')->loadByProperties(array('id'=> $schoolid ));
$SchoolCat = reset($SchoolCats);
if ($SchoolCat){
$categ = $SchoolCat-> metathesis_region -> value;
}
$CourseA = $this->entityTypeManager->getStorage('epal_student')->loadByProperties(array('id'=> $schoolid ));
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();
foreach ($CourseA as $object) {
$list[] = array(
'id' => '1',
'name' => 'Α Λυκείου',
'id' => sizeof($studentPerSchool),
'size' => sizeof($studentPerSchool),
'categ' => $categ,
'classes' => 1
);
} }
$CourseB = $this->entityTypeManager->getStorage('eepal_sectors_in_epal')->loadByProperties(array('epal_id' => $schoolid ));
if ($CourseB)
{
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(
'id' => $object -> sector_id -> entity -> id(),
'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
if ($CourseC)
{
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(
'id'=> $object -> specialty_id -> entity -> id(),
'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(
$list
......@@ -522,6 +537,10 @@ public function SaveCapacity(Request $request,$taxi,$tomeas,$specialit,$schoolid
}
}
private function respondWithStatus($arr, $s) {
$res = new JsonResponse($arr);
$res->setStatusCode($s);
......
......@@ -20,22 +20,28 @@ import {
@Component({
selector: 'perfecture-view',
template: `
<ul class="list-group main-view">
<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 ">
<h5> {{SchoolNames$.name}}</h5>
</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">
<button type="button" class="btn-primary btn-lg pull-right" (click)="navigateToApplication()" >
<i class="fa fa-forward"></i>
</button>
</div>
`
})
......@@ -44,6 +50,10 @@ import {
public formGroup: FormGroup;
private SchoolsPerPerf$: BehaviorSubject<any>;
private SchoolPerPerfSub: Subscription;
private LimitPerCategSub: BehaviorSubject<any>;
private LimitPerCateg$: Subscription;
private CoursesPerPerf$: BehaviorSubject<any>;
private CoursesPerPerfSub: Subscription;
private StudentsSize$: BehaviorSubject<any>;
private StudentsSizeSub: Subscription;
public perfecture = 1;
......@@ -55,6 +65,8 @@ import {
private _hds: HelperDataService,
) {
this.SchoolsPerPerf$ = new BehaviorSubject([{}]);
this.LimitPerCateg$ = new BehaviorSubject([{}]);
this.CoursesPerPerf$ = new BehaviorSubject([{}]);
this.StudentsSize$ = new BehaviorSubject({});
this.formGroup = this.fb.group({
});
......@@ -67,7 +79,7 @@ import {
ngOnInit() {
this.SchoolPerPerfSub = this._hds.getSchoolPerPerfecture(147).subscribe(data => {
this.SchoolPerPerfSub = this._hds.getSchoolPerPerfecture(this.perfecture).subscribe(data => {
this.SchoolsPerPerf$.next(data);
},
error => {
......@@ -85,7 +97,19 @@ import {
console.log(ind,"ind");
if (ind === this.regionActive)
ind = -1;
console.log(this.regionActive,"RA");
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 {
}
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)
return true;
if (id == 150)
this.LimitPerCategSub = this._hds.getLimitPerCateg(categ, classes).subscribe(data => {
this.LimitPerCateg$.next(data);
},
error => {
this.LimitPerCateg$.next([{}]);
console.log("Error Getting Limits");
},
() => console.log("Getting Limits"));
var newid = +id;
if (newid <= 5)
return true;
else
return false;
}
......
......@@ -698,10 +698,52 @@ export class HelperDataService implements OnInit, OnDestroy {
});
this.createAuthorizationHeader(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());
}
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