Commit 5eeee17c authored by Open Source Developer's avatar Open Source Developer

pde view

parent 1debb50b
...@@ -17,34 +17,39 @@ import { ...@@ -17,34 +17,39 @@ import {
Validators, Validators,
} from '@angular/forms'; } from '@angular/forms';
@Component({ @Component({
selector: 'perfecture-view', selector: 'eduadmin-view',
template: ` template: `
<h3> Αριθμός Μαθητών ανα τμήμα σχολείου </h3> <div class = "loading" *ngIf="(showLoader | async) === true"></div>
<div style="min-height: 500px;">
<ul class="list-group main-view"> <form [formGroup]="formGroup">
<div *ngFor="let SchoolNames$ of SchoolsPerPerf$ | async; let i=index; let isOdd=odd; let isEven=even" > <p style="margin-top: 20px; line-height: 2em;">Στην παρακάτω λίστα βλέπετε τα σχολεία ευθύνης σας.
<li class="list-group-item isclickable" (click)="setActiveRegion(SchoolNames$.id)" [class.changelistcolor]= "SchoolNames$.status === false" [class.oddout]="isOdd" [class.evenout]="isEven" [class.selectedout]="regionActive === SchoolNames$.id" > </p>
<h5> {{SchoolNames$.name}}</h5> <div class="row" style="margin-top: 20px; line-height: 2em;" > <b> Τα τμήματα. </b>
</li>
<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$.size,CoursesNames$.limitdown)" [hidden]="SchoolNames$.id !== regionActive" >
<div> {{CoursesNames$.name}}</div> <div class= "aastyle"><strong>Αριθμός Μαθητών:</strong>{{CoursesNames$.size}} </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> </div>
<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.changelistcolor]= "SchoolNames$.status === false" [class.oddout]="isOdd"
[class.evenout]="isEven" [class.selectedout]="regionActive === SchoolNames$.id" >
<div class="col-md-12" style="font-size: 0.8em; font-weight: bold;" >{{SchoolNames$.name}}</div>
</li>
<div class = "row" *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$.size,CoursesNames$.limitdown)"
[class.selectedappout]="regionActive === j"
[hidden]="SchoolNames$.id !== regionActive" style="margin: 0px 2px 0px 2px;">
<div class="col-md-6" style="font-size: 0.8em; font-weight: bold;" >{{CoursesNames$.name}}</div>
<div class="col-md-6" style="font-size: 0.8em; font-weight: bold;" >{{CoursesNames$.size}}</div>
</div>
</div>
</form>
</div>
` `
}) })
@Injectable() export default class PerfectureView implements OnInit, OnDestroy { @Injectable() export default class EduadminView implements OnInit, OnDestroy {
public formGroup: FormGroup; public formGroup: FormGroup;
private SchoolsPerPerf$: BehaviorSubject<any>; private SchoolsPerPerf$: BehaviorSubject<any>;
...@@ -55,6 +60,7 @@ import { ...@@ -55,6 +60,7 @@ import {
private CoursesPerPerfSub: Subscription; private CoursesPerPerfSub: Subscription;
private StudentsSize$: BehaviorSubject<any>; private StudentsSize$: BehaviorSubject<any>;
private StudentsSizeSub: Subscription; private StudentsSizeSub: Subscription;
private showLoader: BehaviorSubject<boolean>;
public perfecture; public perfecture;
private regionActive = <number>-1; private regionActive = <number>-1;
private School$: BehaviorSubject<any>; private School$: BehaviorSubject<any>;
...@@ -71,6 +77,7 @@ import { ...@@ -71,6 +77,7 @@ import {
this.CoursesPerPerf$ = new BehaviorSubject([{}]); this.CoursesPerPerf$ = new BehaviorSubject([{}]);
this.StudentsSize$ = new BehaviorSubject({}); this.StudentsSize$ = new BehaviorSubject({});
this.School$ = new BehaviorSubject([{}]); this.School$ = new BehaviorSubject([{}]);
this.showLoader = new BehaviorSubject(false);
this.formGroup = this.fb.group({ this.formGroup = this.fb.group({
}); });
...@@ -81,8 +88,11 @@ import { ...@@ -81,8 +88,11 @@ import {
ngOnInit() { ngOnInit() {
this.showLoader.next(true);
this.SchoolPerPerfSub = this._hds.getSchools().subscribe(data => { this.SchoolPerPerfSub = this._hds.getSchools().subscribe(data => {
this.SchoolsPerPerf$.next(data); this.SchoolsPerPerf$.next(data);
this.showLoader.next(false);
}, },
error => { error => {
this.SchoolsPerPerf$.next([{}]); this.SchoolsPerPerf$.next([{}]);
...@@ -91,36 +101,42 @@ import { ...@@ -91,36 +101,42 @@ import {
} }
setActiveRegion(ind) {
if (ind === this.regionActive)
ind = -1;
this.regionActive = ind; calccolor(size, limit) {
this.CoursesPerPerfSub = this._hds.getCoursePerPerfecture(this.regionActive).subscribe(data => {
this.CoursesPerPerf$.next(data);
},
error => {
this.CoursesPerPerf$.next([{}]);
console.log("Error Getting Courses");
});
if (size < limit)
return true;
else
return false;
} }
navigateToApplication() {
var id: string = String(this.regionActive);
this.router.navigate(['', { ids: id }]);
} setActiveRegion(ind) {
if (ind === this.regionActive) {
ind = -1;
this.regionActive = ind;
}
else {
this.regionActive = ind;
this.showLoader.next(true);
this.CoursesPerPerfSub = this._hds.getCoursePerPerfecture(this.regionActive).subscribe(data => {
this.CoursesPerPerf$.next(data);
this.showLoader.next(false);
},
error => {
this.CoursesPerPerf$.next([{}]);
console.log("Error Getting Courses");
this.showLoader.next(false);
});
}
this.regionActive = ind;
calccolor(size, limit) {
if (size < limit)
return true;
else
return false;
} }
} }
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