Browse Source

fix

master
drfelfel 1 year ago
parent
commit
758959d3a7
2 changed files with 19 additions and 5 deletions
  1. +7
    -0
      src/routes/panel/dashboard/app/app.component.html
  2. +12
    -5
      src/routes/panel/dashboard/app/app.component.ts

+ 7
- 0
src/routes/panel/dashboard/app/app.component.html View File

@ -56,6 +56,13 @@
</mat-select>
</mat-form-field>
<mat-form-field appearance="outline" *ngIf="majorList.length > 0">
<mat-label>رشته</mat-label>
<mat-select [(ngModel)]="majors" (selectionChange)="subscribe()" multiple>
<mat-option *ngFor="let item of majorList" [value]="item._id"> {{item._id}} </mat-option>
</mat-select>
</mat-form-field>
<div class="flex-space"></div>
</mat-expansion-panel>

+ 12
- 5
src/routes/panel/dashboard/app/app.component.ts View File

@ -30,6 +30,8 @@ export class AppComponent implements OnInit {
grade = ["کاردانی"]
shift = ["روزانه"]
entry = ["مهر"]
majors = []
majorList = []
univeristygroups: UniversityGroup[] = [
@ -78,9 +80,13 @@ export class AppComponent implements OnInit {
res['data']['entry'] = res['data']['entry'].sort(function (a, b) { return b.count - a.count });
res['data']['steps'] = res['data']['steps'].sort(function (a, b) { return b.count - a.count });
res['data']['shift'] = res['data']['shift'].sort(function (a, b) { return b.count - a.count });
res['data']['grade'] = res['data']['grade'].sort(function (a, b) { return b.count - a.count });
console.log(res['data'])
this.majorList = res['data']['majors']
let cachedMajorColor = this.RandomColor(res['data']['majors'].length, 'majors');
let cachedMajorLabel = res['data']['majors'].map((major) => {
return major._id
@ -91,7 +97,7 @@ export class AppComponent implements OnInit {
this.buildMajorsStats(res['data']['majors'], res['data']['waiting'],res['data']['entry'], res['data']['steps'],res['data']['grade'],res['data']['shift'], cachedMajorColor, cachedMajorLabel)
this.buildMajorsStats(res['data']['majors'], res['data']['waiting'], res['data']['entry'], res['data']['steps'], res['data']['grade'], res['data']['shift'], cachedMajorColor, cachedMajorLabel)
@ -111,9 +117,10 @@ export class AppComponent implements OnInit {
method: 'SUB',
data: {
grade:this.grade,
shift:this.shift,
entry:this.entry
grade: this.grade,
shift: this.shift,
entry: this.entry,
major: this.majors
}
}
}).then(res => {
@ -136,7 +143,7 @@ export class AppComponent implements OnInit {
return colors
}
buildMajorsStats(majors, waiting, entry,steps,grades,shift, colors, labels) {
buildMajorsStats(majors, waiting, entry, steps, grades, shift, colors, labels) {
this.data[0] = {

Loading…
Cancel
Save