|
|
@ -1,7 +1,7 @@ |
|
|
import { Component, Input, OnChanges } from '@angular/core'; |
|
|
import { Component, Input, OnChanges } from '@angular/core'; |
|
|
|
|
|
|
|
|
import { MatToolbarModule } from '@angular/material/toolbar'; |
|
|
import { MatToolbarModule } from '@angular/material/toolbar'; |
|
|
import { MatSelectModule } from '@angular/material/select'; |
|
|
import { MatSelectChange, MatSelectModule } from '@angular/material/select'; |
|
|
import { MatFormFieldModule } from '@angular/material/form-field'; |
|
|
import { MatFormFieldModule } from '@angular/material/form-field'; |
|
|
import { MatMenuModule } from '@angular/material/menu'; |
|
|
import { MatMenuModule } from '@angular/material/menu'; |
|
|
import { MatButtonModule } from '@angular/material/button'; |
|
|
import { MatButtonModule } from '@angular/material/button'; |
|
|
@ -10,6 +10,8 @@ import { MatIconModule } from '@angular/material/icon'; |
|
|
|
|
|
|
|
|
import { SetInfo } from '../../models/setInfo.model'; |
|
|
import { SetInfo } from '../../models/setInfo.model'; |
|
|
import { FilterService } from '../../services/filter.service'; |
|
|
import { FilterService } from '../../services/filter.service'; |
|
|
|
|
|
import { CardService } from '../../services/card.service'; |
|
|
|
|
|
import { googleSheetService } from '../../services/googleSheets.service'; |
|
|
|
|
|
|
|
|
@Component({ |
|
|
@Component({ |
|
|
selector: 'app-top-bar', |
|
|
selector: 'app-top-bar', |
|
|
@ -27,11 +29,13 @@ import { FilterService } from '../../services/filter.service'; |
|
|
styleUrl: './top-bar.component.scss' |
|
|
styleUrl: './top-bar.component.scss' |
|
|
}) |
|
|
}) |
|
|
export class TopBarComponent { |
|
|
export class TopBarComponent { |
|
|
selected!: SetInfo; |
|
|
@Input() selected!: SetInfo; |
|
|
@Input() sets!: Array<SetInfo>; |
|
|
@Input() sets!: Array<SetInfo>; |
|
|
|
|
|
|
|
|
constructor( |
|
|
constructor( |
|
|
private filterService: FilterService, |
|
|
private filterService: FilterService, |
|
|
|
|
|
private sheets: googleSheetService, |
|
|
|
|
|
private cardService: CardService, |
|
|
) |
|
|
) |
|
|
{} |
|
|
{} |
|
|
|
|
|
|
|
|
@ -39,8 +43,7 @@ export class TopBarComponent { |
|
|
{ |
|
|
{ |
|
|
if(this.sets) |
|
|
if(this.sets) |
|
|
{ |
|
|
{ |
|
|
this.selected = this.sets[0] |
|
|
this.selected = Object.assign(this.sets[0]); |
|
|
console.log("onInit") |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -63,4 +66,15 @@ export class TopBarComponent { |
|
|
{ |
|
|
{ |
|
|
this.filterService.setFilter(true, false, false, false); |
|
|
this.filterService.setFilter(true, false, false, false); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
onSetSelectionChanged(data: MatSelectChange) |
|
|
|
|
|
{ |
|
|
|
|
|
this.selected = data.value; |
|
|
|
|
|
this.sheets.getSet(this.selected).subscribe( values => { |
|
|
|
|
|
let bob = values as any; |
|
|
|
|
|
this.selected.total = bob.values.length; |
|
|
|
|
|
this.cardService.convertToCardInfo(this.selected, bob.values as Array<Object>) |
|
|
|
|
|
}) |
|
|
|
|
|
console.log(data) |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|