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

pde view

parent 1debb50b
......@@ -17,34 +17,39 @@ import {
Validators,
} from '@angular/forms';
@Component({
selector: 'perfecture-view',
selector: 'eduadmin-view',
template: `
<h3> Αριθμός Μαθητών ανα τμήμα σχολείου </h3>
<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.changelistcolor]= "SchoolNames$.status === false" [class.oddout]="isOdd" [class.evenout]="isEven" [class.selectedout]="regionActive === SchoolNames$.id" >
<h5> {{SchoolNames$.name}}</h5>
</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 class = "loading" *ngIf="(showLoader | async) === true"></div>
<div style="min-height: 500px;">
<form [formGroup]="formGroup">
<p style="margin-top: 20px; line-height: 2em;">Στην παρακάτω λίστα βλέπετε τα σχολεία ευθύνης σας.
</p>
<div class="row" style="margin-top: 20px; line-height: 2em;" > <b> Τα τμήματα. </b>
</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;
private SchoolsPerPerf$: BehaviorSubject<any>;
......@@ -55,6 +60,7 @@ import {
private CoursesPerPerfSub: Subscription;
private StudentsSize$: BehaviorSubject<any>;
private StudentsSizeSub: Subscription;
private showLoader: BehaviorSubject<boolean>;
public perfecture;
private regionActive = <number>-1;
private School$: BehaviorSubject<any>;
......@@ -71,6 +77,7 @@ import {
this.CoursesPerPerf$ = new BehaviorSubject([{}]);
this.StudentsSize$ = new BehaviorSubject({});
this.School$ = new BehaviorSubject([{}]);
this.showLoader = new BehaviorSubject(false);
this.formGroup = this.fb.group({
});
......@@ -81,8 +88,11 @@ import {
ngOnInit() {
this.showLoader.next(true);
this.SchoolPerPerfSub = this._hds.getSchools().subscribe(data => {
this.SchoolsPerPerf$.next(data);
this.showLoader.next(false);
},
error => {
this.SchoolsPerPerf$.next([{}]);
......@@ -91,36 +101,42 @@ import {
}
setActiveRegion(ind) {
if (ind === this.regionActive)
ind = -1;
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");
});
calccolor(size, limit) {
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