director-view.ts 21.3 KB
Newer Older
Open Source Developer's avatar
Open Source Developer committed
1
import { Component, OnInit, OnDestroy, ElementRef, ViewChild} from "@angular/core";
Open Source Developer's avatar
Open Source Developer committed
2
3
4
import { Injectable } from "@angular/core";
import { AppSettings } from '../../app.settings';
import { HelperDataService } from '../../services/helper-data-service';
Open Source Developer's avatar
Open Source Developer committed
5
6
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
import { IAppState } from '../../store/store';
Open Source Developer's avatar
Open Source Developer committed
9
import {Router, ActivatedRoute, Params} from '@angular/router';
Open Source Developer's avatar
Open Source Developer committed
10
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
Open Source Developer committed
12
13
14
15
import { VALID_CAPACITY_PATTERN} from '../../constants';
import {maxValue} from '../../constants';
import {minValue} from '../../constants';

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

Open Source Developer's avatar
trans    
Open Source Developer committed
17
18
19
20
21
22
23
import {
    FormBuilder,
    FormGroup,
    FormControl,
    FormArray,
    Validators,
} from '@angular/forms';
Open Source Developer's avatar
Open Source Developer committed
24
@Component({
Open Source Developer's avatar
Open Source Developer committed
25
    selector: 'director-classcapacity',
Open Source Developer's avatar
Open Source Developer committed
26
    template: `
Open Source Developer's avatar
Open Source Developer committed
27
    <div class = "loading" *ngIf="(showLoader | async) === true"></div>
28
    <div style="min-height: 500px;">
Open Source Developer's avatar
Open Source Developer committed
29
30
31
32
33
34
35
36
37
38
39
40
41
42
    <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 CoursesPerSchools$  of CoursesPerSchool$ | async; let i=index; let isOdd=odd; let isEven=even" >
                <li class="list-group-item isclickable" (click)="setActive(i)" 
                (click)="findstudent(CoursesPerSchools$.class, CoursesPerSchools$.newsector, CoursesPerSchools$.newspecialit)" 
                [class.changelistcolor]= "CoursesPerSchools$.size < CoursesPerSchools$.limitdown" 
                [class.oddout]="isOdd" [class.evenout]="isEven"  [class.selectedout]="courseActive === i" >
                    <h5 >{{CoursesPerSchools$.taxi}}&nbsp; <b></b></h5>
                </li>
43

Open Source Developer's avatar
Open Source Developer committed
44
45
46
47
48
49
50
51
52
53
               <div [hidden]="courseActive !== i" *ngIf="(retrievedStudent | async)">
                 <div *ngFor="let StudentDetails$  of StudentInfo$ | async; let j=index; let isOdd=odd; let isEven=even" class="row list-group-item isclickable"  
                 [class.selectedappout]="StudentActive === j" 
                 [class.confirmed]="StudentDetails$.checkstatus === '1'"
                 [class.notconfirmed]="StudentDetails$.checkstatus === '0'" 
                 [class.notchecked]="(StudentDetails$.checkstatus !== '1') && (StudentDetails$.checkstatus !== '0')"
                 [class.oddout]="isOdd" [class.evenout]="isEven" style="margin: 0px 2px 0px 2px;">
                    <div class="col-md-4" style="font-size: 0.8em; font-weight: bold;" (click) ="setActiveStudent(j)" >{{StudentDetails$.studentsurname}}</div>
                    <div class="col-md-4" style="font-size: 0.8em; font-weight: bold;" (click) ="setActiveStudent(j)">{{StudentDetails$.name}}</div>
                    <div [hidden]="StudentActive !== j" class="col-md-2" style="color: black;"  *ngIf = "opened == true"> <span aria-hidden="true"><i class="fa fa-close"  (click) ="setActiveStudentnew(j)"></i></span>  </div>
Open Source Developer's avatar
paging    
Open Source Developer committed
54

Open Source Developer's avatar
Open Source Developer committed
55
56
                    <div style="width: 100%; color: #000000;">
                    <div [hidden]="StudentActive !== j"  style="margin: 20px 10px 10px 10px;">
57
58
59
60
61

                     <p style="margin-top: 20px; line-height: 2em;"> Παρακαλούμε, αφού γίνει ο έλεγχος των στοιχείων του μαθητή επιβεβαιώστε τη δυνατότητα εγγραφής του.</p>

                     <div class="row" style="margin-bottom: 20px;">
                     <div class="col-md-6">
Open Source Developer's avatar
trans    
Open Source Developer committed
62
                      <strong><label>Επιβεβαίωση Εγγραφής:</label> </strong>
Open Source Developer's avatar
Open Source Developer committed
63
                      <select #cb name="{{StudentDetails$.id}}" >
64
65
66
                          <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
67
                      </select>
68
69
                      </div>
                      <div class="col-md-6">
Open Source Developer's avatar
Open Source Developer committed
70
                      <button type="button" class="btn-primary btn-sm pull-right" (click)="confirmStudent(StudentDetails$.id, cb, j)">
Open Source Developer's avatar
trans    
Open Source Developer committed
71
72
                           Επιβεβαίωση Εγγραφής
                       </button>
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
                     </div>
                     </div>


                       <div class="row evenin" style="margin: 0px 2px 0px 2px; line-height: 2em;">
                           <div class="col-md-12" style="font-size: 1em; font-weight: bold; text-align: center;">Στοιχεία αιτούμενου</div>
                       </div>
                       <div class="row oddin" style="margin: 0px 2px 0px 2px; line-height: 2em;">
                           <div class="col-md-3" style="font-size: 0.8em;">Όνομα</div>
                           <div class="col-md-3" style="font-size: 0.8em; font-weight: bold">{{StudentDetails$.guardian_name}}</div>
                           <div class="col-md-3" style="font-size: 0.8em;">Επώνυμο</div>
                           <div class="col-md-3" style="font-size: 0.8em; font-weight: bold">{{StudentDetails$.guardian_surname}}</div>
                       </div>
                       <div class="row oddin" style="margin: 0px 2px 0px 2px; line-height: 2em;">
                           <div class="col-md-3" style="font-size: 0.8em;">Όνομα πατέρα</div>
                           <div class="col-md-3" style="font-size: 0.8em; font-weight: bold">{{ StudentDetails$.guardian_fathername }}</div>
                           <div class="col-md-3" style="font-size: 0.8em;">Όνομα μητέρας</div>
                           <div class="col-md-3" style="font-size: 0.8em; font-weight: bold">{{ StudentDetails$.guardian_mothername }}</div>
                       </div>
                       <div class="row oddin" style="margin: 0px 2px 0px 2px; line-height: 2em;">
                           <div class="col-md-3" style="font-size: 0.8em;">Διεύθυνση</div>
                           <div class="col-md-3" style="font-size: 0.8em; font-weight: bold">{{StudentDetails$.regionaddress}}</div>
                           <div class="col-md-3" style="font-size: 0.8em;">ΤΚ - Πόλη</div>
                           <div class="col-md-3" style="font-size: 0.8em; font-weight: bold">{{StudentDetails$.regiontk}} - {{StudentDetails$.regionarea}}</div>
                       </div>
98
99
100
101

                       <div class="row evenin" style="margin: 0px 2px 0px 2px; line-height: 2em;">
                           <div class="col-md-12" style="font-size: 1em; font-weight: bold; text-align: center;">Στοιχεία μαθητή</div>
                       </div>
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
                       <div class="row oddin" style="margin: 0px 2px 0px 2px; line-height: 2em;">
                           <div class="col-md-3" style="font-size: 0.8em;">Όνομα μαθητή</div>
                           <div class="col-md-3" style="font-size: 0.8em; font-weight: bold">{{StudentDetails$.name}}</div>
                           <div class="col-md-3" style="font-size: 0.8em;">Επώνυμο μαθητή</div>
                           <div class="col-md-3" style="font-size: 0.8em; font-weight: bold">{{StudentDetails$.studentsurname}}</div>
                       </div>
                       <div class="row oddin" style="margin: 0px 2px 0px 2px; line-height: 2em;">
                           <div class="col-md-3" style="font-size: 0.8em;">Όνομα Πατέρα</div>
                           <div class="col-md-3" style="font-size: 0.8em; font-weight: bold">{{StudentDetails$.fatherfirstname}}</div>
                           <div class="col-md-3" style="font-size: 0.8em;">Όνομα Μητέρας</div>
                           <div class="col-md-3" style="font-size: 0.8em; font-weight: bold">{{StudentDetails$.motherfirstname}}</div>
                       </div>
                       <div class="row oddin" style="margin: 0px 2px 0px 2px; line-height: 2em;">
                           <div class="col-md-3" style="font-size: 0.8em;">Ημερομηνία Γέννησης</div>
                           <div class="col-md-3" style="font-size: 0.8em; font-weight: bold">{{StudentDetails$.birthdate}}</div>
                           <div class="col-md-3" style="font-size: 0.8em;">Τύπος απολυτηρίου</div>
                           <div class="col-md-3" style="font-size: 0.8em; font-weight: bold">{{StudentDetails$.certificatetype}}</div>
                       </div>

                       <div class="row oddin" style="margin: 0px 2px 0px 2px; line-height: 2em;">
                           <div class="col-md-3" style="font-size: 0.8em;">Έτος κτήσης απολυτηρίου</div>
                           <div class="col-md-3" style="font-size: 0.8em; font-weight: bold">{{StudentDetails$.graduation_year}}</div>
                           <div class="col-md-3" style="font-size: 0.8em;">Σχολείο τελευταίας φοίτησης</div>
                           <div class="col-md-3" style="font-size: 0.8em; font-weight: bold">{{StudentDetails$.lastschool_schoolname}}</div>
                       </div>

128
                       <div class="row oddin" style="margin: 0px 2px 0px 2px; line-height: 2em;">
129
130
131
                           <div class="col-md-3" style="font-size: 0.8em;">Σχολικό έτος τελευταίας φοίτησης</div>
                           <div class="col-md-3" style="font-size: 0.8em; font-weight: bold">{{StudentDetails$.lastschool_schoolyear}}</div>
                           <div class="col-md-3" style="font-size: 0.8em;">Τάξη τελευταίας φοίτησης</div>
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
                           <div *ngIf="StudentDetails$.lastschool_class === '1'" class="col-md-3" style="font-size: 0.8em; font-weight: bold">Α</div>
                           <div *ngIf="StudentDetails$.lastschool_class === '2'" class="col-md-3" style="font-size: 0.8em; font-weight: bold">Β</div>
                           <div *ngIf="StudentDetails$.lastschool_class === '3'" class="col-md-3" style="font-size: 0.8em; font-weight: bold">Γ</div>
                           <div *ngIf="StudentDetails$.lastschool_class === '4'" class="col-md-3" style="font-size: 0.8em; font-weight: bold">Δ</div>
                       </div>

                       <div class="row oddin" style="margin: 0px 2px 0px 2px; line-height: 2em;">
                           <div class="col-md-6" style="font-size: 0.8em;">Τάξη φοίτησης για το νέο σχολικό έτος</div>
                           <div *ngIf="StudentDetails$.currentclass === '1'" class="col-md-6" style="font-size: 0.8em; font-weight: bold">Α</div>
                           <div *ngIf="StudentDetails$.currentclass === '2'" class="col-md-6" style="font-size: 0.8em; font-weight: bold">Β</div>
                           <div *ngIf="StudentDetails$.currentclass === '3'" class="col-md-6" style="font-size: 0.8em; font-weight: bold">Γ</div>
                           <div *ngIf="StudentDetails$.currentclass === '4'" class="col-md-6" style="font-size: 0.8em; font-weight: bold">Δ</div>
                       </div>
                       <div *ngIf="StudentDetails$.currentclass === '2'" class="row oddin" style="margin: 0px 2px 0px 2px; line-height: 2em;">
                           <div class="col-md-6" style="font-size: 0.8em;">Τομέας φοίτησης για το νέο σχολικό έτος</div>
                           <div class="col-md-6" style="font-size: 0.8em; font-weight: bold">{{StudentDetails$.currentsector}}</div>
                       </div>
                       <div *ngIf="StudentDetails$.currentclass === '3' || StudentDetails$.currentclass === '4'" class="row oddin" style="margin: 0px 2px 0px 2px; line-height: 2em;">
                           <div class="col-md-6" style="font-size: 0.8em;">Ειδικότητα φοίτησης για το νέο σχολικό έτος</div>
                           <div class="col-md-6" style="font-size: 0.8em; font-weight: bold">{{StudentDetails$.currentcourse}}</div>
152
                       </div>
Open Source Developer's avatar
trans    
Open Source Developer committed
153

Open Source Developer's avatar
trans    
Open Source Developer committed
154
                 </div>
155
                 </div>
156

157

Open Source Developer's avatar
Open Source Developer committed
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
                 </div>
               </div>
       </div>
      </form>
      </div>


  <div id="checksaved" (onHidden)="onHidden('#checksaved')"
    class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
      <div class="modal-dialog modal-lg">
        <div class="modal-content">
          <div class="modal-header modal-header-warning">
            <h3 class="modal-title pull-left"><i class="fa fa-check-square-o"></i>&nbsp;&nbsp;Η επιλογή σας έχει αποθηκευτεί</h3>
            <button type="button" class="close pull-right" aria-label="Close" (click)="hideModal('#checksaved')">
              <span aria-hidden="true"><i class="fa fa-times"></i></span>
            </button>
          </div>
          <div class="modal-body">
            <p>Η επιλογή σας έχει αποθηκευτεί</p>
          </div>
          <div class="modal-footer">
            <button type="button" class="btn btn-default pull-left" data-dismiss="modal">Κλείσιμο</button>
          </div>
        </div>
      </div>
    </div>


<div id="dangermodal" (onHidden)="onHidden('#dangermodal')"
    class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
      <div class="modal-dialog modal-lg">
        <div class="modal-content">
          <div class="modal-header modal-header-danger">
            <h3 class="modal-title pull-left"><i class="fa fa-check-square-o"></i>&nbsp;&nbsp;Η επιλογή σας δεν έχει αποθηκευτεί</h3>
            <button type="button" class="close pull-right" aria-label="Close" (click)="hideModal('#dangermodal')">
              <span aria-hidden="true"><i class="fa fa-times"></i></span>
            </button>
          </div>
          <div class="modal-body">
            <p>Παρακαλώ προσπαθήστε ξανα!</p>
          </div>
          <div class="modal-footer">
            <button type="button" class="btn btn-default pull-left" data-dismiss="modal">Κλείσιμο</button>
          </div>
        </div>
      </div>
    </div>


    <div id="emptyselection" (onHidden)="onHidden('#emptyselection')"
    class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
      <div class="modal-dialog modal-lg">
        <div class="modal-content">
          <div class="modal-header modal-header-danger">
            <h3 class="modal-title pull-left"><i class="fa fa-check-square-o"></i>&nbsp;&nbsp;Δεν υπάρχουν μαθητές</h3>
            <button type="button" class="close pull-right" aria-label="Close" (click)="hideModal('#emptyselection')">
              <span aria-hidden="true"><i class="fa fa-times"></i></span>
            </button>
          </div>
          <div class="modal-body">
            <p>Δεν υπάρχουν μαθητές με δήλωση προτίμησης το συγκεκριμένο τμήμα του σχολείου σας!</p>
          </div>
          <div class="modal-footer">
            <button type="button" class="btn btn-default pull-left" data-dismiss="modal">Κλείσιμο</button>
          </div>
        </div>
      </div>
    </div>
226

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

Open Source Developer's avatar
Open Source Developer committed
228
229
230
   `
})

Open Source Developer's avatar
Open Source Developer committed
231
@Injectable() export default class DirectorClassCapacity implements OnInit, OnDestroy {
Open Source Developer's avatar
Open Source Developer committed
232

Open Source Developer's avatar
trans    
Open Source Developer committed
233
    public formGroup: FormGroup;
Open Source Developer's avatar
Open Source Developer committed
234
235
236

    private CoursesPerSchool$: BehaviorSubject<any>;
    private CoursesPerSchoolSub: Subscription;
Open Source Developer's avatar
trans    
Open Source Developer committed
237
238
    private StudentInfo$: BehaviorSubject<any>;
    private StudentInfoSub: Subscription;
Open Source Developer's avatar
Open Source Developer committed
239
    private retrievedStudent: BehaviorSubject<boolean>;
Open Source Developer's avatar
Open Source Developer committed
240
241
    private SavedStudentsSub: Subscription;
    private SavedStudents$: BehaviorSubject<any>;
Open Source Developer's avatar
Open Source Developer committed
242
243
244
245
246
    private courseActive = <number>-1;
    private StudentActive = <number>-1;
    private showLoader: BehaviorSubject<boolean>;
    private School$: BehaviorSubject<any>;
    private SchoolSub: Subscription;
Open Source Developer's avatar
Open Source Developer committed
247
    private selectiontype: BehaviorSubject<boolean>;
248
    private SchoolId;
Open Source Developer's avatar
Open Source Developer committed
249
250
    private opened;
    
251

Open Source Developer's avatar
Open Source Developer committed
252

253
254
255
    constructor(private fb: FormBuilder,
        private _hds: HelperDataService,
        private activatedRoute: ActivatedRoute,
Open Source Developer's avatar
Open Source Developer committed
256
257
258
259
        private router: Router) {

        this.CoursesPerSchool$ = new BehaviorSubject([{}]);
        this.showLoader = new BehaviorSubject(false);
Open Source Developer's avatar
trans    
Open Source Developer committed
260
        this.School$ = new BehaviorSubject([{}]);
Open Source Developer's avatar
Open Source Developer committed
261
        this.selectiontype = new BehaviorSubject(true);
Open Source Developer's avatar
Open Source Developer committed
262
263
264
265
        this.StudentInfo$ = new BehaviorSubject([{}]);
        this.retrievedStudent = new BehaviorSubject(false);
        this.SavedStudents$ = new BehaviorSubject({});
        this.opened = false;
266
        this.formGroup = this.fb.group({
Open Source Developer's avatar
Open Source Developer committed
267

Open Source Developer's avatar
Open Source Developer committed
268
             });
269

Open Source Developer's avatar
Open Source Developer committed
270
    }
271

272

Open Source Developer's avatar
Open Source Developer committed
273

Open Source Developer's avatar
Open Source Developer committed
274
275
276
277
278
   public showModal(popupMsgId):void {
        console.log("about to show modal");
      
        (<any>$(popupMsgId)).modal('show');
    }
Open Source Developer's avatar
trans    
Open Source Developer committed
279

Open Source Developer's avatar
Open Source Developer committed
280
281
282
283
    public hideModal(popupMsgId):void {
       
        (<any>$(popupMsgId)).modal('hide');
    }
Open Source Developer's avatar
Open Source Developer committed
284

Open Source Developer's avatar
Open Source Developer committed
285
    public onHidden(popupMsgId):void {
286

287
    }
Open Source Developer's avatar
trans    
Open Source Developer committed
288

Open Source Developer's avatar
Open Source Developer committed
289

Open Source Developer's avatar
Open Source Developer committed
290
    ngOnDestroy() {
Open Source Developer's avatar
trans    
Open Source Developer committed
291

Open Source Developer's avatar
Open Source Developer committed
292
    }
293

Open Source Developer's avatar
Open Source Developer committed
294
295
296
297
298
299
300
301
302
303
304
305
    ngOnInit() {
                 (<any>$('#checksaved')).appendTo("body");
                  (<any>$('#dangermodal')).appendTo("body");
                  (<any>$('#emptyselection')).appendTo("body");
                  
                  this.SchoolSub = this._hds.gettypeofschool().subscribe(x => {
                  this.School$.next(x);
                  console.log(x[0].type, "schoolid!");
                   this.SchoolId = x[0].type;
                   if (this.SchoolId == 'ΗΜΕΡΗΣΙΟ'){
                       this.selectiontype.next(false);
                   }
306

Open Source Developer's avatar
Open Source Developer committed
307
308
309
310
311
312
                  },
                  error => {
                      this.School$.next([{}]);
                      console.log("Error Getting School");
                  },
                  () => console.log("Getting School "));
Open Source Developer's avatar
trans    
Open Source Developer committed
313

Open Source Developer's avatar
Open Source Developer committed
314

Open Source Developer's avatar
Open Source Developer committed
315
316
317
318
                  this.showLoader.next(true);
                  this.CoursesPerSchoolSub = this._hds.FindCapacityPerSchool().subscribe(x => {
                  this.CoursesPerSchool$.next(x);
                  this.showLoader.next(false);
319

Open Source Developer's avatar
Open Source Developer committed
320
321
322
323
324
325
326
                  },
                  error => {
                      this.CoursesPerSchool$.next([{}]);
                      console.log("Error Getting courses perSchool");
                      this.showLoader.next(false);
                  },
                  () => console.log("Getting School "));
Open Source Developer's avatar
trans    
Open Source Developer committed
327

328

329

330
331


Open Source Developer's avatar
Open Source Developer committed
332
    }
333
334


Open Source Developer's avatar
Open Source Developer committed
335
336
337
338
339
340
341
342
   findstudent(taxi,sector,special) {
     this.showLoader.next(true);
       this.retrievedStudent.next(false);
      this.StudentInfoSub = this._hds.getStudentPerSchool(taxi,sector,special)
      .subscribe(data => {
            this.StudentInfo$.next(data);
            this.retrievedStudent.next(true);
            this.showLoader.next(false);
343
                },
Open Source Developer's avatar
Open Source Developer committed
344
345
346
347
348
            error => {
               this.StudentInfo$.next([{}]);
               console.log("Error Getting Students");
               this.showLoader.next(false);
               this.showModal("#emptyselection");
349
                    },
Open Source Developer's avatar
Open Source Developer committed
350
              () => console.log("Getting Students"));
351

Open Source Developer's avatar
trans    
Open Source Developer committed
352
353
    }

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

Open Source Developer's avatar
Open Source Developer committed
355
356
357
358
359
360
361
362
363
  setActive(ind) {
      this.StudentActive = -1;
      if (this.courseActive == ind)
      {
        ind = -1;
      }
      this.courseActive = ind;
      console.log(this.courseActive, ind, "ind");
    }
364

Open Source Developer's avatar
Open Source Developer committed
365
366
367
368
369
370
371
372
373
374
setActiveStudent(ind)
{
      this.opened = true;
      if (this.StudentActive == ind)
      {
        ind = -1;
      }
      this.StudentActive = ind;
      console.log(this.courseActive, ind, "ind");
}
375

Open Source Developer's avatar
Open Source Developer committed
376
377
378
379
380
381
382
383
384
385
setActiveStudentnew(ind)
{
      this.opened = false;
      if (this.StudentActive == ind)
      {
        ind = -1;
      }
      this.StudentActive = ind;
      console.log(this.courseActive, ind, "ind");
}
386

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

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

Open Source Developer's avatar
Open Source Developer committed
389
390
391
392
393
394
395
396
397
398
399
  confirmStudent(student, cb, ind) {
      var rtype;
        if (cb.value == 1)
          rtype = '1';
        if (cb.value == 2)
          rtype = '0';
        if (cb.value == 3)
          rtype = null;
        var type = cb.value;
        console.log(type, "aaa");
        this.showLoader.next(true);
Open Source Developer's avatar
trans    
Open Source Developer committed
400

Open Source Developer's avatar
Open Source Developer committed
401
402
          let std = this.StudentInfo$.getValue();
          std[ind].checkstatus = rtype;
Open Source Developer's avatar
Open Source Developer committed
403

Open Source Developer's avatar
Open Source Developer committed
404
        this.SavedStudentsSub = this._hds.saveConfirmStudents(student, type).subscribe(data => {
Open Source Developer's avatar
Open Source Developer committed
405
            this.SavedStudents$.next(data);
Open Source Developer's avatar
Open Source Developer committed
406
407
            this.StudentInfo$.next(std);
            this.showLoader.next(false);
408

Open Source Developer's avatar
Open Source Developer committed
409
410
411
412
        },
            error => {
                this.SavedStudents$.next([{}]);
                console.log("Error saving Students");
Open Source Developer's avatar
Open Source Developer committed
413
414
                this.showLoader.next(false);
                this.showModal("#dangermodal");
Open Source Developer's avatar
Open Source Developer committed
415
416
            },
            () => {
417
                console.log("saved Students");
Open Source Developer's avatar
Open Source Developer committed
418
419
                this.showModal("#checksaved");
               });
Open Source Developer's avatar
trans    
Open Source Developer committed
420

Open Source Developer's avatar
paging    
Open Source Developer committed
421
422
423


    }
Open Source Developer's avatar
Open Source Developer committed
424
 
425
}