From f3f98fa87c8332d4fe06005a68dbeba2919c1a89 Mon Sep 17 00:00:00 2001 From: Open Source Developer Date: Thu, 25 May 2017 12:56:59 +0300 Subject: [PATCH] paging bug --- source/components/director/director-view.ts | 39 ++++++++++++++++----- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/source/components/director/director-view.ts b/source/components/director/director-view.ts index ba940be..332a41c 100644 --- a/source/components/director/director-view.ts +++ b/source/components/director/director-view.ts @@ -30,7 +30,7 @@ import { - +
@@ -121,6 +121,7 @@ import {

+
Βρίσκεστε στη σελίδα:
@@ -144,6 +145,7 @@ import { +
@@ -169,6 +171,7 @@ import { private SubmitedDetailsSub: Subscription; private retrievedStudent: BehaviorSubject; private selectionBClass: BehaviorSubject; + private selectiontype: BehaviorSubject; private selectionCClass: BehaviorSubject; private SchoolId ; private currentclass: Number; @@ -196,6 +199,7 @@ import { this.selectionBClass = new BehaviorSubject(false); this.selectionCClass = new BehaviorSubject(false); this.School$ = new BehaviorSubject([{}]); + this.selectiontype = new BehaviorSubject(true); this.formGroup = this.fb.group({ @@ -226,11 +230,14 @@ import { ngOnInit() { - this.SchoolSub = this._hds.getSchoolId().subscribe(x => { + + this.SchoolSub = this._hds.gettypeofschool().subscribe(x => { this.School$.next(x); - console.log(x[0].id, "schoolid!"); - this.SchoolId = x[0].id; - + console.log(x[0].type, "schoolid!"); + this.SchoolId = x[0].type; + if (this.SchoolId == 'ΗΜΕΡΗΣΙΟ'){ + this.selectiontype.next(false); + } }, error => { @@ -238,6 +245,7 @@ import { console.log("Error Getting School"); }, () => console.log("Getting School ")); + } @@ -315,7 +323,7 @@ import { findstudent(txop, pageno) { - var tot_pages: Number; + var tot_pages: number; var sectorint = +this.formGroup.value.tomeas; if (txop.value === "1") { this.currentclass = 1; @@ -339,6 +347,11 @@ import { if (x.id % 5 > 0) { tot_pages = (x.id - (x.id % 5)) / 5 + 1; } + console.log(tot_pages,"totpages") + if (isNaN(tot_pages)){ + this.retrievedStudent.next(false); + tot_pages = 0; + } this.formGroup.get('maxpage').setValue(tot_pages); }); @@ -346,7 +359,15 @@ import { this.StudentInfoSub = this._hds.getStudentPerSchool(sectorint, this.currentclass, this.limitdown, this.limitup).subscribe(data => { this.StudentInfo$.next(data); - this.retrievedStudent.next(true); + if (tot_pages === 0){ + console.log("tot.pages", this.formGroup.value.maxpage); + this.retrievedStudent.next(false); + } + else + { + console.log("tot.pages", this.formGroup.value.maxpage, "max", tot_pages); + this.retrievedStudent.next(true); + } }, error => { this.StudentInfo$.next([{}]); @@ -379,8 +400,8 @@ import { confirmStudent(txop) { this._hds.saveConfirmStudents(this.saved, this.type); - this.findstudent(txop, this.pageno) - console.log(txop, this.pageno, "aaaaaaa"); + this.findstudent(txop, this.pageno); + } checkcclass() { -- GitLab