director-view.ts 21.4 KB
Newer Older
Open Source Developer's avatar
Open Source Developer committed
1
import { Component, OnInit, OnDestroy, ElementRef, ViewChild, Renderer} from "@angular/core";
Open Source Developer's avatar
Open Source Developer committed
2 3 4 5 6
import { Injectable } from "@angular/core";
import { AppSettings } from '../../app.settings';
import { HelperDataService } from '../../services/helper-data-service';
import {Observable} from "rxjs/Observable";
import {Http, Headers, RequestOptions} from '@angular/http';
Open Source Developer's avatar
tran  
Open Source Developer committed
7
import { NgRedux, select } from 'ng2-redux';
Open Source Developer's avatar
Open Source Developer committed
8 9 10
import { IAppState } from '../../store/store';
import {Router, ActivatedRoute, Params} from '@angular/router';
import { BehaviorSubject, Subscription } from 'rxjs/Rx';
Open Source Developer's avatar
transf  
Open Source Developer committed
11
import { ILoginInfo } from '../../store/logininfo/logininfo.types';
Open Source Developer's avatar
trans  
Open Source Developer committed
12

Open Source Developer's avatar
trans  
Open Source Developer committed
13 14 15 16 17 18 19
import {
    FormBuilder,
    FormGroup,
    FormControl,
    FormArray,
    Validators,
} from '@angular/forms';
Open Source Developer's avatar
Open Source Developer committed
20 21 22
@Component({
    selector: 'director-view',
    template: `
23
    <div style="min-height: 500px;">
Open Source Developer's avatar
trans  
Open Source Developer committed
24
  <form [formGroup]="formGroup">
25

Open Source Developer's avatar
paging  
Open Source Developer committed
26

Open Source Developer's avatar
trans  
Open Source Developer committed
27 28 29 30 31 32
      <label for="taxi">Τάξη</label><br/>
      <div class="form-group">
            <select #txoption  class="form-control" (change)="verifyclass(txoption)" formControlName="taxi">
              <option value="1" >Α' Λυκείου</option>
              <option value="2" >Β' Λυκείου</option>
              <option value="3" >Γ' Λυκείου</option>
Open Source Developer's avatar
Open Source Developer committed
33
              <option *ngIf="(selectiontype | async)" value="4" >Δ' Λυκείου</option>
Open Source Developer's avatar
trans  
Open Source Developer committed
34
            </select>
35
      </div>
Open Source Developer's avatar
trans  
Open Source Developer committed
36
      <div class="form-group">
Open Source Developer's avatar
trans  
Open Source Developer committed
37
            <select #tmop class="form-control" *ngIf="(selectionBClass | async)" (change)="checkbclass(tmop,txoption)" formControlName="tomeas">
Open Source Developer's avatar
trans  
Open Source Developer committed
38
              <option *ngFor="let SectorSelection$  of StudentSelected$ | async; let i=index" [value] = "SectorSelection$.id"> {{SectorSelection$.sector_id}} </option>
Open Source Developer's avatar
trans  
Open Source Developer committed
39 40 41
            </select>
      </div>
      <div class="form-group">
Open Source Developer's avatar
trans  
Open Source Developer committed
42 43
            <select #spop class="form-control" *ngIf="(selectionCClass | async)" (change) ="checkcclass()" formControlName="specialit">
              <option *ngFor="let SpecialSelection$  of StudentSelectedSpecial$ | async; let i=index" [value] = "SpecialSelection$.id"> {{SpecialSelection$.specialty_id}} </option>
Open Source Developer's avatar
trans  
Open Source Developer committed
44 45
            </select>
      </div>
Open Source Developer's avatar
trans  
Open Source Developer committed
46
             <button type="button" class="btn-primary btn-sm pull-right" (click)="findstudent(txoption,1)">
Open Source Developer's avatar
trans  
Open Source Developer committed
47 48
                Αναζήτηση
             </button>
Open Source Developer's avatar
trans  
Open Source Developer committed
49 50
             <br>
             <br>
Open Source Developer's avatar
trans  
Open Source Developer committed
51 52 53 54
              <ul class="list-group main-view">
              <div *ngIf="(retrievedStudent | async)">

               <div *ngFor="let StudentDetails$  of StudentInfo$ | async; let i=index; let isOdd=odd; let isEven=even"  >
Open Source Developer's avatar
trans  
Open Source Developer committed
55 56 57
                 <li class="list-group-item isclickable" [class.oddout]="isOdd" [class.evenout]="isEven" (click)="setActiveUser(StudentDetails$.i)"
                  [class.selectedout]="userActive === StudentDetails$.i" [class.confirmed]="StudentDetails$.checkstatus === '1'"
                  [class.notconfirmed]="StudentDetails$.checkstatus === '0'" [class.notchecked]="(StudentDetails$.checkstatus !== '1') && (StudentDetails$.checkstatus !== '0')">
Open Source Developer's avatar
trans  
Open Source Developer committed
58 59
                  <h5> {{StudentDetails$.name}}&nbsp;{{StudentDetails$.name}} </h5>
                </li>
60

Open Source Developer's avatar
trans  
Open Source Developer committed
61 62 63 64
                    <div [hidden]="userActive !== StudentDetails$.i" >
                     <p style="margin-top: 20px; line-height: 2em;"> Παρακαλώ αφού γίνει ο έλεγχος των στοιχείων του μαθητή επιβεβαιώστε τη δυνατότητα εγγραφής του.</p>
                      <strong><label>Επιβεβαίωση Εγγραφής:</label> </strong>
                      <select #cb name="{{StudentDetails$.id}}" (change)="updateCheckedOptions(StudentDetails$.id, cb)" >
Open Source Developer's avatar
Open Source Developer committed
65 66 67
                          <option value=1 [selected]="StudentDetails$.checkstatus === '1' ">Ναι</option>
                          <option value=2 [selected]="StudentDetails$.checkstatus === '0' ">Όχι</option>
                          <option value=3 [selected]="StudentDetails$.checkstatus != '0' && StudentDetails$.checkstatus != '1'"></option>
Open Source Developer's avatar
trans  
Open Source Developer committed
68
                      </select>
Open Source Developer's avatar
Open Source Developer committed
69
                      <button type="button" class="btn-primary btn-sm pull-right" (click)="confirmStudent(txoption)">
Open Source Developer's avatar
trans  
Open Source Developer committed
70 71 72
                           Επιβεβαίωση Εγγραφής
                       </button>

Open Source Developer's avatar
trans  
Open Source Developer committed
73 74 75
                      <table>
                        <tr><td>
                          <div class="form-group" *ngIf="StudentDetails$.relationtostudent === 'Μαθητής' ">
76
                            <label for="guardianfirstname">Όνομα κηδεμόνα</label><p class="form-control" id="guardianfirstname" style="border:1px solid #eceeef;">{{StudentDetails$.guardianfirstname}} </p>
Open Source Developer's avatar
trans  
Open Source Developer committed
77 78 79 80
                          </div>
                        </td>
                        <td>
                         <div class="form-group" *ngIf="StudentDetails$.relationtostudent === 'Μαθητής' ">
81
                            <label for="guardiansurname">Επώνυμο κηδεμόνα</label><p class="form-control" id="guardiansurname" style="border:1px solid #eceeef;">{{StudentDetails$.guardiansurname}} </p>
Open Source Developer's avatar
trans  
Open Source Developer committed
82 83 84 85 86 87 88 89
                          </div>
                        </td></tr>
                      </table>
                      <div class="form-group"><label for="name">Όνομα μαθητή</label> <p class="form-control" id="name" style="border:1px solid #eceeef;">    {{StudentDetails$.name}} </p> </div>
                      <div><label for="studentsurname">Επώνυμο μαθητή</label> <p class="form-control" id = "studentsurname" style="border:1px solid #eceeef;"> {{StudentDetails$.studentsurname}} </p></div>
                      <div><label for="fatherfirstname">Όνομα Πατέρα</label> <p class="form-control" id = "fatherfirstname" style="border:1px solid #eceeef;"> {{StudentDetails$.fatherfirstname}} </p></div>
                      <div><label for="fathersurname">Επώνυμο Πατέρα</label> <p class="form-control" id = "fathersurname" style="border:1px solid #eceeef;"> {{StudentDetails$.fathersurname}} </p></div>
                      <div><label for="motherfirstname">Όνομα Μητέρας</label> <p class="form-control" id = "motherfirstname" style="border:1px solid #eceeef;"> {{StudentDetails$.motherfirstname}} </p></div>
90 91
                      <div><label for="mothersurname">Επώνυμο Μητέρας</label> <p class="form-control" id = "mothersurname" style="border:1px solid #eceeef;"> {{StudentDetails$.mothersurname}} </p></div>
                      <div><label for="birthdate">Ημερομηνία Γέννησης</label> <p class="form-control" id = "birthdate" style="border:1px solid #eceeef;"> {{StudentDetails$.birthdate}} </p></div>
Open Source Developer's avatar
trans  
Open Source Developer committed
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112


                      <table>
                              <tr>
                                  <td>
                                      <div class="form-group">
                                          <label for="regionaddress">Διεύθυνση κατοικίας</label><p class="form-control" id = "regionaddress" style="border:1px solid #eceeef;"> {{StudentDetails$.regionaddress}} </p>
                                      </div>
                                  </td>
                                  <td>
                                      <div class="form-group">
                                          <label for="regiontk">TK </label><p class="form-control" id = "regiontk" style="border:1px solid #eceeef;"> {{StudentDetails$.regiontk}} </p>
                                      </div>
                                  </td>
                                  <td>
                                      <div class="form-group">
                                          <label for="regionarea">Πόλη/Περιοχή</label><p class="form-control" id = "regionarea" style="border:1px solid #eceeef;"> {{StudentDetails$.regionarea}} </p>
                                      </div>
                                  </td>
                             </tr>
                      </table>
113 114 115
                      <div><label for="certificatetype">Τύπος απολυτηρίου</label> <p class="form-control" id = "certificatetype" style="border:1px solid #eceeef;"> {{StudentDetails$.certificatetype}} </p></div>
                      <div><label for="telnum">Τηλέφωνο επικοινωνίας</label> <p class="form-control" id = "telnum" style="border:1px solid #eceeef;"> {{StudentDetails$.telnum}} </p></div>
                      <div><label for="relationtostudent">Η αίτηση γίνεται από</label> <p class="form-control" id = "relationtostudent" style="border:1px solid #eceeef;"> {{StudentDetails$.relationtostudent}} </p></div>
Open Source Developer's avatar
trans  
Open Source Developer committed
116
                 </div>
117
<!--             </div>  -->
Open Source Developer's avatar
trans  
Open Source Developer committed
118
             </div>
119 120
             </div>
             </ul>
Open Source Developer's avatar
paging  
Open Source Developer committed
121 122 123

          <br>
          <br>
Open Source Developer's avatar
Open Source Developer committed
124
          <div *ngIf="(retrievedStudent | async)">
Open Source Developer's avatar
paging  
Open Source Developer committed
125 126 127 128
         <div class="form-group" class="row">
          Βρίσκεστε στη σελίδα:
          <div class="col-1">
           <input #pageno type="text" class="form-control" placeholder=".col-1" formControlName="pageno">
129 130
          </div>
           απο
Open Source Developer's avatar
paging  
Open Source Developer committed
131 132
           <div class="col-1">
           <input #maxpage type="text" class="form-control" placeholder=".col-1" formControlName="maxpage">
133
           </div>
Open Source Developer's avatar
paging  
Open Source Developer committed
134
         </div>
Open Source Developer's avatar
trans  
Open Source Developer committed
135

Open Source Developer's avatar
paging  
Open Source Developer committed
136 137 138 139 140 141 142 143 144 145
             <br>
             <nav aria-label="pagination">
              <ul class="pagination justify-content-center">
                <li class="page-item " >
                  <button class="page-link" (click)="prevpage(txoption)">Προηγούμενη</button>
                </li>
                <li class="page-item">
                  <button class="page-link" (click) ="nextpage(txoption,maxpage) ">Επόμενη</button>
                </li>
              </ul>
146

Open Source Developer's avatar
paging  
Open Source Developer committed
147
            </nav>
Open Source Developer's avatar
Open Source Developer committed
148
            </div>
149

150 151 152
            </form>
            </div>

Open Source Developer's avatar
paging  
Open Source Developer committed
153

Open Source Developer's avatar
Open Source Developer committed
154 155 156
   `
})

Open Source Developer's avatar
Open Source Developer committed
157

158
@Injectable() export default class DirectorView implements OnInit, OnDestroy {
Open Source Developer's avatar
Open Source Developer committed
159

Open Source Developer's avatar
trans  
Open Source Developer committed
160
    public formGroup: FormGroup;
Open Source Developer's avatar
Open Source Developer committed
161 162
    private StudentSelected$: BehaviorSubject<any>;
    private StudentSelectedSub: Subscription;
Open Source Developer's avatar
trans  
Open Source Developer committed
163 164
    private School$: BehaviorSubject<any>;
    private SchoolSub: Subscription;
Open Source Developer's avatar
trans  
Open Source Developer committed
165 166
    private StudentInfo$: BehaviorSubject<any>;
    private StudentInfoSub: Subscription;
Open Source Developer's avatar
paging  
Open Source Developer committed
167
    private StudentsSize$: BehaviorSubject<any>;
Open Source Developer's avatar
Open Source Developer committed
168 169
    private SavedStudentsSub: Subscription;
    private SavedStudents$: BehaviorSubject<any>;
Open Source Developer's avatar
paging  
Open Source Developer committed
170
    private StudentsSizeSub: Subscription;
Open Source Developer's avatar
trans  
Open Source Developer committed
171 172
    private StudentSelectedSpecial$: BehaviorSubject<any>;
    private StudentSelectedSpecialSub: Subscription;
Open Source Developer's avatar
trans  
Open Source Developer committed
173 174
    private SubmitedDetails$: BehaviorSubject<any>;
    private SubmitedDetailsSub: Subscription;
Open Source Developer's avatar
trans  
Open Source Developer committed
175
    private retrievedStudent: BehaviorSubject<boolean>;
Open Source Developer's avatar
trans  
Open Source Developer committed
176
    private selectionBClass: BehaviorSubject<boolean>;
Open Source Developer's avatar
Open Source Developer committed
177
    private selectiontype: BehaviorSubject<boolean>;
Open Source Developer's avatar
trans  
Open Source Developer committed
178
    private selectionCClass: BehaviorSubject<boolean>;
179 180
    private limitsSub: Subscription;
    private limits$: BehaviorSubject<any>;
Open Source Developer's avatar
trans  
Open Source Developer committed
181
    private SchoolId ;
Open Source Developer's avatar
trans  
Open Source Developer committed
182
    private currentclass: Number;
183
    private saved: Array<number> = new Array();
184
    private limitdown = 0;
Open Source Developer's avatar
Open Source Developer committed
185
    private limitup = 5;
Open Source Developer's avatar
paging  
Open Source Developer committed
186
    private pageno = 1;
187
    public totallimit;
Open Source Developer's avatar
trans  
Open Source Developer committed
188
    private userActive = <number>-1;
Open Source Developer's avatar
trans  
Open Source Developer committed
189
    private type: Number;
190
    public tot_pages: number;
191 192


193
    @ViewChild('fileInput') fileInput: ElementRef;
Open Source Developer's avatar
Open Source Developer committed
194

195 196 197
    constructor(private fb: FormBuilder,
        private _hds: HelperDataService,
        private activatedRoute: ActivatedRoute,
Open Source Developer's avatar
Open Source Developer committed
198
        private router: Router,
199
        private renderer: Renderer) {
200 201 202
        this.StudentSelected$ = new BehaviorSubject([{}]);
        this.StudentSelectedSpecial$ = new BehaviorSubject([{}]);
        this.StudentInfo$ = new BehaviorSubject([{}]);
Open Source Developer's avatar
paging  
Open Source Developer committed
203
        this.StudentsSize$ = new BehaviorSubject({});
Open Source Developer's avatar
Open Source Developer committed
204
        this.SavedStudents$ = new BehaviorSubject({});
Open Source Developer's avatar
trans  
Open Source Developer committed
205
        this.SubmitedDetails$ = new BehaviorSubject([{}]);
206
        this.limits$ = new BehaviorSubject([{}]);
207 208 209
        this.retrievedStudent = new BehaviorSubject(false);
        this.selectionBClass = new BehaviorSubject(false);
        this.selectionCClass = new BehaviorSubject(false);
210
        //this.outoflimits = new BehaviorSubject(false);
Open Source Developer's avatar
trans  
Open Source Developer committed
211
        this.School$ = new BehaviorSubject([{}]);
Open Source Developer's avatar
Open Source Developer committed
212
        this.selectiontype = new BehaviorSubject(true);
Open Source Developer's avatar
trans  
Open Source Developer committed
213 214


215 216 217 218
        this.formGroup = this.fb.group({
            tomeas: ['', []],
            taxi: ['', []],
            specialit: ['', []],
219 220
            maxpage: [{ value: '', disabled: true }, []],
            pageno: [{ value: '', disabled: true }, []],
221
        });
222

Open Source Developer's avatar
Open Source Developer committed
223 224
    }

225

226
    ngOnDestroy() {
Open Source Developer's avatar
Open Source Developer committed
227 228
        if (this.StudentSelectedSub)
            this.StudentSelectedSub.unsubscribe();
Open Source Developer's avatar
trans  
Open Source Developer committed
229 230
        if (this.StudentSelectedSpecialSub)
            this.StudentSelectedSpecialSub.unsubscribe();
Open Source Developer's avatar
trans  
Open Source Developer committed
231 232 233
        if (this.selectionBClass)
            this.selectionBClass.unsubscribe();
        if (this.selectionCClass)
234
            this.selectionCClass.unsubscribe();
235
        if (this.retrievedStudent)
Open Source Developer's avatar
Open Source Developer committed
236
            this.retrievedStudent.unsubscribe();
Open Source Developer's avatar
trans  
Open Source Developer committed
237 238
        if (this.SubmitedDetailsSub)
            this.SubmitedDetailsSub.unsubscribe();
239

Open Source Developer's avatar
Open Source Developer committed
240
    }
241

242

Open Source Developer's avatar
Open Source Developer committed
243 244
    ngOnInit() {

Open Source Developer's avatar
Open Source Developer committed
245 246

    this.SchoolSub = this._hds.gettypeofschool().subscribe(x => {
Open Source Developer's avatar
trans  
Open Source Developer committed
247
                  this.School$.next(x);                 
Open Source Developer's avatar
Open Source Developer committed
248 249 250 251 252
                  console.log(x[0].type, "schoolid!");
                   this.SchoolId = x[0].type;
                   if (this.SchoolId == 'ΗΜΕΡΗΣΙΟ'){
                       this.selectiontype.next(false);
                   }
Open Source Developer's avatar
trans  
Open Source Developer committed
253 254 255 256 257 258 259

                  },
                  error => {
                      this.School$.next([{}]);
                      console.log("Error Getting School");
                  },
                  () => console.log("Getting School "));
Open Source Developer's avatar
Open Source Developer committed
260

Open Source Developer's avatar
trans  
Open Source Developer committed
261 262 263
                  
        }        

Open Source Developer's avatar
Open Source Developer committed
264

265
    verifyclass(txop) {
Open Source Developer's avatar
Open Source Developer committed
266 267
      this.limitdown = 0;
      this.limitup = 5;
Open Source Developer's avatar
preview  
Open Source Developer committed
268
      console.log(this.SchoolId,"schoolida");
Open Source Developer's avatar
paging  
Open Source Developer committed
269
        this.pageno = 1;
270 271 272 273
        this.retrievedStudent.next(false);
        if (txop.value === "1") {
            this.selectionBClass.next(false);
            this.selectionCClass.next(false);
Open Source Developer's avatar
trans  
Open Source Developer committed
274

275 276
        }
        else if (txop.value === "2") {
Open Source Developer's avatar
Open Source Developer committed
277
            this.StudentSelectedSub = this._hds.getSectorPerSchool().subscribe(data => {
Open Source Developer's avatar
trans  
Open Source Developer committed
278
                this.selectionBClass.next(true);
Open Source Developer's avatar
trans  
Open Source Developer committed
279
                this.selectionCClass.next(false);
280 281 282 283 284 285 286 287 288
                this.StudentSelected$.next(data);

            },
                error => {
                    this.StudentSelected$.next([{}]);
                    console.log("Error Getting StudentSelectedSpecial");
                },
                () => console.log("Getting StudentSelectedSpecial"));
        }
Open Source Developer's avatar
Open Source Developer committed
289
        else if (txop.value === "3" || txop.value === "4") {
290
            var sectorint = +this.formGroup.value.tomeas;
Open Source Developer's avatar
Open Source Developer committed
291
           if (this.formGroup.value.tomeas != '') {
292 293
                var sectorint = +this.formGroup.value.tomeas;

Open Source Developer's avatar
Open Source Developer committed
294
                this.StudentSelectedSpecialSub = this._hds.getSpecialityPerSchool(sectorint).subscribe(data => {
295 296 297 298 299 300 301
                    this.StudentSelectedSpecial$.next(data);
                },
                    error => {
                        this.StudentSelectedSpecial$.next([{}]);
                        console.log("Error Getting StudentSelectedSpecial");
                    },
                    () => console.log("Getting StudentSelectedSpecial"));
302
            }
303

Open Source Developer's avatar
Open Source Developer committed
304
            this.StudentSelectedSub = this._hds.getSectorPerSchool().subscribe(data => {
305 306 307 308 309 310 311 312 313 314
                this.StudentSelected$.next(data);
                this.selectionBClass.next(true);
                this.selectionCClass.next(true);
            },
                error => {
                    this.StudentSelected$.next([{}]);
                    console.log("Error Getting StudentSelected");
                },
                () => console.log("Getting StudentSelected"));
        }
Open Source Developer's avatar
trans  
Open Source Developer committed
315 316
    }

Open Source Developer's avatar
Open Source Developer committed
317

318
    checkbclass(tmop, txop) {
Open Source Developer's avatar
preview  
Open Source Developer committed
319
      console.log(this.SchoolId,"schoolidn");
Open Source Developer's avatar
paging  
Open Source Developer committed
320
        this.pageno = 1;
Open Source Developer's avatar
trans  
Open Source Developer committed
321 322
        this.retrievedStudent.next(false);
        var sectorint = +this.formGroup.value.tomeas;
323
        console.log(sectorint, "tomeas");
Open Source Developer's avatar
Open Source Developer committed
324
        if (txop.value === "3" || txop.value === "4") {
325
            //            this.StudentSelectedSpecial$ = new BehaviorSubject([{}]);
Open Source Developer's avatar
Open Source Developer committed
326
            this.StudentSelectedSpecialSub = this._hds.getSpecialityPerSchool(sectorint).subscribe(data => {
327 328 329 330 331 332 333 334
                this.StudentSelectedSpecial$.next(data);

            },
                error => {
                    this.StudentSelectedSpecial$.next([{}]);
                    console.log("Error Getting StudentSelectedSpecial");
                },
                () => console.log("Getting StudentSelectedSpecial"));
Open Source Developer's avatar
trans  
Open Source Developer committed
335 336 337
        }
    }

Open Source Developer's avatar
paging  
Open Source Developer committed
338
    findstudent(txop, pageno) {
339

340
       
341
        var sectorint = +this.formGroup.value.tomeas;
342 343
        this.currentclass = +txop.value;
        
344 345
        this.formGroup.get('pageno').setValue(this.pageno);
        if (this.pageno == 1) {
346 347

            console.log("mphkepage = 1");
Open Source Developer's avatar
Open Source Developer committed
348
            this.StudentsSizeSub = this._hds.getStudentPerSchool(sectorint, this.currentclass, 0, 0).subscribe(x => {
Open Source Developer's avatar
paging  
Open Source Developer committed
349
                this.StudentsSize$.next(x);
350 351 352 353 354 355
                this.totallimit = x.id;

            this.limitsSub = this._hds.getlimitsofcourse(this.currentclass).subscribe(data => {
            this.limits$.next(data);
            console.log(this.totallimit, data[0].limitdown, "oria");
             this.tot_pages = x.id / 5;
356
                if (x.id % 5 > 0) {
357
                    this.tot_pages = (x.id - (x.id % 5)) / 5 + 1;
358
                }
359 360
                console.log(this.tot_pages,"totpages")
                if (isNaN(this.tot_pages)){
Open Source Developer's avatar
Open Source Developer committed
361
                  this.retrievedStudent.next(false);
362
                  this.tot_pages = 0;
Open Source Developer's avatar
Open Source Developer committed
363
                }
364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401
            if ( (x.id < data[0].limitdown) || (isNaN(this.tot_pages)))
            {
              console.log("mphkeprwto!")
                  this.retrievedStudent.next(false);
                  this.tot_pages = 0;
                  this.formGroup.get('maxpage').setValue(this.tot_pages);
                  //this.outoflimits.next(true);
            }
            else
            {
               // this.outoflimits.next(false);
                
                this.formGroup.get('maxpage').setValue(this.tot_pages);
                console.log(this.tot_pages,"mazeuw mathites");
                this.StudentInfoSub = this._hds.getStudentPerSchool(sectorint, this.currentclass, this.limitdown, this.limitup).subscribe(data => {
                this.StudentInfo$.next(data);
            
                console.log("tot.pages", this.formGroup.value.maxpage, "max1", this.tot_pages);
                this.retrievedStudent.next(true);
              
            },
            error => {
                this.StudentInfo$.next([{}]);
                console.log("Error Getting Students");
            },
            () => console.log("Getting Students"));



            }
            
              },
            error => {
                this.limits$.next([{}]);
                console.log("Error Getting limits");
            },
            () => console.log("Getting limits"));
               
402 403 404
            });

        }
405 406 407 408 409 410
        else{
              console.log("eisai edw", this.tot_pages);
     
       
              if (this.tot_pages == 0 ){
                  console.log("mphke1", this.formGroup.value.maxpage, this.tot_pages);
Open Source Developer's avatar
Open Source Developer committed
411 412 413 414
                  this.retrievedStudent.next(false);
                }
             else
              {
415 416 417 418 419
                console.log(this.tot_pages,"mazeuw mathites");
                this.StudentInfoSub = this._hds.getStudentPerSchool(sectorint, this.currentclass, this.limitdown, this.limitup).subscribe(data => {
                this.StudentInfo$.next(data);
            
                console.log("tot.pages", this.formGroup.value.maxpage, "max1", this.tot_pages);
Open Source Developer's avatar
Open Source Developer committed
420
                this.retrievedStudent.next(true);
421 422
              
            },
423 424 425 426 427
            error => {
                this.StudentInfo$.next([{}]);
                console.log("Error Getting Students");
            },
            () => console.log("Getting Students"));
428 429
          }
        }
430

Open Source Developer's avatar
trans  
Open Source Developer committed
431 432
    }

Open Source Developer's avatar
trans  
Open Source Developer committed
433
    updateCheckedOptions(id, cbvalue) {
Open Source Developer's avatar
Open Source Developer committed
434
        let i = 0;
Open Source Developer's avatar
trans  
Open Source Developer committed
435

Open Source Developer's avatar
trans  
Open Source Developer committed
436
        if (cbvalue.value === '1') {
437 438 439
            this.saved[i] = id;
            this.type = 1;

440
        }
Open Source Developer's avatar
trans  
Open Source Developer committed
441
        else if (cbvalue.value === '2') {
442
            this.saved[i] = id;
Open Source Developer's avatar
trans  
Open Source Developer committed
443
            this.type = 2;
Open Source Developer's avatar
Open Source Developer committed
444
            
445
            console.log("not confirmed")
Open Source Developer's avatar
trans  
Open Source Developer committed
446 447
        }
        else if (cbvalue.value === '3') {
448

Open Source Developer's avatar
trans  
Open Source Developer committed
449
        }
450
    }
Open Source Developer's avatar
trans  
Open Source Developer committed
451

Open Source Developer's avatar
trans  
Open Source Developer committed
452 453


Open Source Developer's avatar
Open Source Developer committed
454
    confirmStudent(txop) {
Open Source Developer's avatar
Open Source Developer committed
455 456 457 458 459 460 461 462 463 464 465 466 467 468 469

      this.SavedStudentsSub = this._hds.saveConfirmStudents(this.saved, this.type).subscribe(data => {
            this.SavedStudents$.next(data);
        
        },
            error => {
                this.SavedStudents$.next([{}]);
                console.log("Error saving Students");
            },
            () => {
              console.log("saved Students");
            this.findstudent(txop, this.pageno);
          });
       
        
Open Source Developer's avatar
Open Source Developer committed
470
       
471
    }
Open Source Developer's avatar
trans  
Open Source Developer committed
472

473
    checkcclass() {
Open Source Developer's avatar
paging  
Open Source Developer committed
474
        this.pageno = 1;
475 476
        this.retrievedStudent.next(false);
    }
Open Source Developer's avatar
trans  
Open Source Developer committed
477

478 479 480 481 482 483 484 485
    nextpage(txop, maxpage) {
        console.log(maxpage.value);
        if (this.pageno < maxpage.value) {
            this.pageno = this.pageno + 1;
            this.limitdown = (this.pageno - 1) * 5;
            this.limitup = this.pageno * 5;
            this.findstudent(txop, this.pageno)
        }
Open Source Developer's avatar
paging  
Open Source Developer committed
486 487
    }

488 489 490 491 492 493 494 495
    prevpage(txop) {
        console.log(this.pageno, "pageno");
        if (this.pageno > 1) {
            this.pageno = this.pageno - 1;
            this.limitdown = (this.pageno - 1) * 5;
            this.limitup = this.pageno * 5;
            this.findstudent(txop, this.pageno)
        }
Open Source Developer's avatar
paging  
Open Source Developer committed
496 497 498 499

    }


Open Source Developer's avatar
trans  
Open Source Developer committed
500

501 502 503 504 505 506 507 508 509
    setActiveUser(ind) {
        ind = +ind;
        console.log(this.userActive, "RA", ind);
        if (ind === this.userActive) {
            ind = -1;
        }
        ind--;
        this.userActive = ind + 1;

Open Source Developer's avatar
trans  
Open Source Developer committed
510

511
    }
Open Source Developer's avatar
trans  
Open Source Developer committed
512 513


514
}