<div class="input-group-prepend">
<label class="input-group-text" for="resource-type-value" i18n>Resource type</label>
</div>
- <eg-resource-type-combobox domId="resource-type-value" (onChange)="filterByResourceType($event)" [startId]="resourceTypeId"></eg-resource-type-combobox>
+ <eg-resource-type-combobox domId="resource-type-value" (typeChanged)="filterByResourceType($event)" [startId]="resourceTypeId"></eg-resource-type-combobox>
<div class="input-group-button">
<button class="btn btn-warning" (click)="removeFilters()" i18n><span class="material-icons">delete</span> Remove filter</button>
</div>
filterByCurrentResourceBarcode: () => void;
filterByResourceType: (selected: ComboboxEntry) => void;
removeFilters: () => void;
- chooseAppropriateFilter: () => void;
setStickyFilter: ($event: NgbTabChangeEvent) => void;
constructor(
private store: ServerStoreService,
private toast: ToastService
) {
- // This is in the constructor, because we need it first thing in ngOnInit
- this.chooseAppropriateFilter = () => {
- if (this.resourceBarcode) {
- this.selectedFilter = 'resource';
- } else if (this.resourceTypeId) {
- this.selectedFilter = 'type';
- } else if (!(this.patronId)) {
- this.store.getItem('eg.booking.manage.filter').then(filter => {
- if (filter) { this.selectedFilter = filter; }
- });
- }
- };
-
}
ngOnInit() {
(err) => { console.log(err); }
);
} else if (this.resourceBarcode) {
+ this.selectedFilter = 'resource';
this.pcrud.search('brsrc',
{'barcode' : this.resourceBarcode}, {'limit': 1})
.pipe(single())
this.toast.danger('No resource found with this barcode');
});
} else if (this.resourceTypeId) {
+ this.selectedFilter = 'type';
this.reservationsGrid.reloadGrid();
}
- this.chooseAppropriateFilter();
+
+ if (!(this.patronId)) {
+ this.store.getItem('eg.booking.manage.filter').then(filter => {
+ if (filter) { this.selectedFilter = filter; }
+ });
+ }
});
[attr.id]="domId"
placeholder="Resource type" i18n-placeholder
[entries]="resourceTypes"
- (onChange)="onChange.emit($event)"
+ (onChange)="typeChanged.emit($event)"
[startId]="startId"></eg-combobox>`
})
export class ResourceTypeComboboxComponent implements OnInit {
@Input() domId = '';
@Input() startId: number;
- @Output() onChange: EventEmitter<ComboboxEntry>;
+ @Output() typeChanged: EventEmitter<ComboboxEntry>;
constructor(private pcrud: PcrudService) {
- this.onChange = new EventEmitter<ComboboxEntry>();
+ this.typeChanged = new EventEmitter<ComboboxEntry>();
}
ngOnInit() {