Skip to content

Commit

Permalink
Updates to timetable component.
Browse files Browse the repository at this point in the history
  • Loading branch information
RbkGh committed Mar 19, 2017
1 parent 6bb8417 commit b8ff677
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 33 deletions.
Original file line number Diff line number Diff line change
@@ -1,40 +1,46 @@
<div class="row">
<div class="col-sm-4 col-sm-offset-4">
<div class="col-sm-12">
<div class="box-shadow panel-body">

<div *ngIf="isGenerateButtonWandVisible">
<button class="btn btn-rounded btn-xl btn-primary waves-effect waves-light"
(click)="openGenerateTimeTableSubjectModal()">
Generate TimeTable
<i class="fa fa-magic"></i>
</button>
<div class="row">
<div class="col-sm-4 col-sm-offset-4">
<div class="box-shadow panel-body">
<div *ngIf="isGenerateButtonWandVisible">
<button class="btn btn-rounded btn-xl btn-primary waves-effect waves-light"
(click)="openGenerateTimeTableSubjectModal()">
Generate TimeTable
<i class="fa fa-magic"></i>
</button>
</div>
</div>
</div>
</div>

<div *ngIf="!isGenerateButtonWandVisible" class="panel panel-default">
<div class="pull-right">
<div class="form-group m-t-10 m-b-40">

<div class="panel-title text-capitalize text-blue">
Select Type of TimeTable to View : Classes or Tutors TimeTable.
</div>
<ng-select [multiple]="false"
[allowClear]="false"
[items]="getTimeTableTypesItems()"
(data)="refreshValueMultiple($event)"
<h3>Select Type of TimeTable: Class/Tutor TimeTable.</h3>
<ng-select [allowClear]="false"
[items]="timeTableTypeItems"
(data)="refreshTimeTableTypeData($event)"
(selected)="selectedTimeTableType($event)"

(removed)="removedYearGroup($event)"
(typed)="typedChar($event)"
placeholder="No TimeTable Type Selected"
>
</ng-select>
</div>

</div>
</div>

<div *ngIf="isTutorsTimeTablesVisible" >
<div *ngFor="let tutorPersonalTimeTableEntity of tutorPersonalTimeTableDocsList;">
<div class="pull-in panel panel-heading panel-info">
Tutor Name : {{tutorPersonalTimeTableEntity.tutorDoc.firstName + ' '+tutorPersonalTimeTableEntity.tutorDoc.surName}}
<div *ngIf="isTutorsTimeTablesVisible">
<div *ngFor="let tutorPersonalTimeTableEntity of tutorPersonalTimeTableDocsList;">
<div class="pull-in panel panel-blue m-t-10">
<div class="panel panel-info">
<div class="panel-heading">
Tutor Name : {{tutorPersonalTimeTableEntity.tutorDoc.firstName + ' '+tutorPersonalTimeTableEntity.tutorDoc.surName}}
</div>
</div>
</div>

<div>
Expand Down Expand Up @@ -105,7 +111,6 @@
</table>
</div>
</div>
</div>
</div>
</div>

Expand Down
35 changes: 24 additions & 11 deletions src/app/components/main-content/time-table/time-table.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ export class TimeTableComponent implements OnInit {
programmeGroupPersonalTimeTableDocsList: Array<ProgrammeGroupPersonalTimeTableEntity>;
tutorPersonalTimeTableDocsList: Array<TutorPersonalTimeTableEntity>;

timeTableTypeItems: Array<any>;

constructor(private timeTableGenerationService: TimeTableGenerationService,
private formBuilder: FormBuilder) {
}
Expand All @@ -57,6 +59,8 @@ export class TimeTableComponent implements OnInit {

this.successfullyGeneratedTimeTableMainEntity = this.generateFakeDataForTesting();
this.isTutorsTimeTablesVisible = true;
this.timeTableTypeItems = this.getTimeTableTypesItems();
this.modalGenerateTimeTableDialog.dismiss();

// this.timeTableGenerationService.generateTimeTable(timeTableGenerationRequest).subscribe(
// (response: TimeTableMainEntityResponsePayload) => {
Expand Down Expand Up @@ -95,15 +99,14 @@ export class TimeTableComponent implements OnInit {
public getTimeTableTypesItems(): Array<any> {
let timeTableTypes: Array<any> = [];

let timeTableType1: any = {
timeTableTypes.push({
id: this.TIMETABLE_TYPE_PROGRAMMEGROUP,
text: 'Classes/ProgrammeGroups TimeTable'
};
let timeTableType2: any = {
}, {
id: this.TIMETABLE_TYPE_TUTOR,
text: 'Tutors TimeTable'
};
timeTableTypes.push([timeTableType1, timeTableType2]);
});


console.info('TimeTable Type Objects to be populated in dropdown: ', timeTableTypes);
return timeTableTypes;
Expand Down Expand Up @@ -168,8 +171,9 @@ export class TimeTableComponent implements OnInit {
public selectedTimeTableType(value: any): void {
console.log('Selected value is: ', value);
console.log('value id=', value.id);
let valueToSwitch: number = value.id;

switch (value.id) {
switch (valueToSwitch) {
case this.TIMETABLE_TYPE_PROGRAMMEGROUP :
//DO IMPLEMENTATION TO SHOW ALL TIMETABLE FOR ALL PROGRAMMEGROUPS RETURNED FROM SERVICE
this.getProgrammeGroupsTimeTables(this.successfullyGeneratedTimeTableMainEntity.programmeGroupPersonalTimeTableDocs);
Expand Down Expand Up @@ -199,6 +203,15 @@ export class TimeTableComponent implements OnInit {
this.isTutorsTimeTablesVisible = true;
}

refreshTimeTableTypeData(value: any): void {
//this.value = value;
console.log('Data1 =', value);
}

public typedChar(value: any): void {
console.log('New search input1: ', value);
}

/**
* Dummy object to test table view of timetable
* @returns {TimeTableMainEntity}
Expand All @@ -209,19 +222,19 @@ export class TimeTableComponent implements OnInit {
let programmeDays: Array<ProgrammeDay> = [];
for (let i: number = 0; i < 5; i++) {

let periods:Array<PeriodOrLecture> = [];
let periods: Array<PeriodOrLecture> = [];
for (let iPeriods: number = 1; iPeriods <= 10; iPeriods++) {
let period : PeriodOrLecture = new PeriodOrLecture("Period"+iPeriods,iPeriods,"",true,"subjectUniqueId","SubjectFullName","","Ace Rbk Chief Keef");
let period: PeriodOrLecture = new PeriodOrLecture("Period" + iPeriods, iPeriods, "", true, "subjectUniqueId", "SubjectFullName", "", "Ace Rbk Chief Keef");
periods.push(period);
}
let programmeDay:ProgrammeDay = new ProgrammeDay("Monday",periods);
let programmeDay: ProgrammeDay = new ProgrammeDay("Monday", periods);
programmeDays.push(programmeDay);
}
let tutorPersonalTimeTable: TutorPersonalTimeTableEntity = new TutorPersonalTimeTableEntity("", tutor,programmeDays);
let tutorPersonalTimeTable: TutorPersonalTimeTableEntity = new TutorPersonalTimeTableEntity("", tutor, programmeDays);

tutorPersonalTimeTableEntities.push(tutorPersonalTimeTable);

let timeTableMainEntity : TimeTableMainEntity = new TimeTableMainEntity(2017,"Term1",tutorPersonalTimeTableEntities,[]);
let timeTableMainEntity: TimeTableMainEntity = new TimeTableMainEntity(2017, "Term1", tutorPersonalTimeTableEntities, []);

return timeTableMainEntity;
}
Expand Down

0 comments on commit b8ff677

Please sign in to comment.