Commit 63e47e3a authored by Open Source Developer's avatar Open Source Developer

trans

parent 0b7b740d
...@@ -148,3 +148,14 @@ epal.ministry.general_report: ...@@ -148,3 +148,14 @@ epal.ministry.general_report:
_controller: '\Drupal\epal\Controller\Distribution::makegGeneralReport' _controller: '\Drupal\epal\Controller\Distribution::makegGeneralReport'
requirements: requirements:
_user_is_logged_in: 'TRUE' _user_is_logged_in: 'TRUE'
regionview:
path: '/epal/ScoolperPerf/{perfectureId}'
options:
_auth: [ 'basic_auth' ]
defaults:
_controller: '\Drupal\epal\Controller\DirectorView::getSchoolsPerPerfetcure'
requirements:
_user_is_logged_in: 'TRUE'
...@@ -402,6 +402,51 @@ public function SaveCapacity(Request $request,$taxi,$tomeas,$specialit,$schoolid ...@@ -402,6 +402,51 @@ public function SaveCapacity(Request $request,$taxi,$tomeas,$specialit,$schoolid
public function getSchoolsPerPerfetcure(Request $request, $perfectureId)
{
$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('region_edu_admin_id'=> $perfectureId ));
if ($schools)
{
$list = array();
foreach ($schools as $object) {
$list[] = array(
'id' =>$object -> id(),
'name' => $object -> name ->value,
);
$i++;
}
return $this->respondWithStatus(
$list
, Response::HTTP_OK);
}
else
{
return $this->respondWithStatus([
'message' => t("Perfecture not found!"),
], Response::HTTP_FORBIDDEN);
}
}
else
{
return $this->respondWithStatus([
'message' => t("User not found!"),
], Response::HTTP_FORBIDDEN);
}
}
private function respondWithStatus($arr, $s) { private function respondWithStatus($arr, $s) {
$res = new JsonResponse($arr); $res = new JsonResponse($arr);
$res->setStatusCode($s); $res->setStatusCode($s);
......
...@@ -24,8 +24,8 @@ import { ...@@ -24,8 +24,8 @@ import {
<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.changecolor]="calccolor(SchoolNames$.id)" [class.oddout]="isOdd" [class.evenout]="isEven" [class.selectedout]="regionActive === SchoolNames$.id ">
<h5>{{SchoolNames$.name}}</h5> <h5 [class.changecolor]="calccolor(SchoolNames$.id)"> {{SchoolNames$.name}}</h5>
</li> </li>
</div> </div>
</ul> </ul>
...@@ -44,6 +44,8 @@ import { ...@@ -44,6 +44,8 @@ import {
public formGroup: FormGroup; public formGroup: FormGroup;
private SchoolsPerPerf$: BehaviorSubject<any>; private SchoolsPerPerf$: BehaviorSubject<any>;
private SchoolPerPerfSub: Subscription; private SchoolPerPerfSub: Subscription;
private StudentsSize$: BehaviorSubject<any>;
private StudentsSizeSub: Subscription;
public perfecture = 1; public perfecture = 1;
private regionActive = <number>-1; private regionActive = <number>-1;
...@@ -53,6 +55,7 @@ import { ...@@ -53,6 +55,7 @@ import {
private _hds: HelperDataService, private _hds: HelperDataService,
) { ) {
this.SchoolsPerPerf$ = new BehaviorSubject([{}]); this.SchoolsPerPerf$ = new BehaviorSubject([{}]);
this.StudentsSize$ = new BehaviorSubject({});
this.formGroup = this.fb.group({ this.formGroup = this.fb.group({
}); });
...@@ -94,4 +97,20 @@ import { ...@@ -94,4 +97,20 @@ import {
} }
calccolor(id)
{
this.StudentsSizeSub = this._hds.getStudentPerSchool(id, '5', 2, 0, 0).subscribe(x => {
this.StudentsSize$.next(x);
console.log(id, x, "test");
});
if (id == 147)
return true;
if (id == 150)
return true;
}
} }
...@@ -176,6 +176,11 @@ ...@@ -176,6 +176,11 @@
background-color: #fd9665; background-color: #fd9665;
} }
.changecolor
{
background-color: cyan;
}
.roundedNumber{ .roundedNumber{
width: 2em; width: 2em;
background-color: coral; background-color: coral;
......
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