2021-12-27 20:50:10 +01:00
|
|
|
import { Component, OnInit, ViewChild, TemplateRef } from '@angular/core';
|
|
|
|
import { TableComponent } from '../table/table.component';
|
2021-12-24 15:21:22 +01:00
|
|
|
import { ApiClientService } from 'src/app/_services/api-client.service';
|
2021-12-27 20:50:10 +01:00
|
|
|
import { BsModalService, BsModalRef } from 'ngx-bootstrap/modal';
|
2021-12-04 21:36:11 +01:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'app-list',
|
|
|
|
templateUrl: './list.component.html',
|
|
|
|
styleUrls: ['./list.component.scss']
|
|
|
|
})
|
|
|
|
export class ListComponent implements OnInit {
|
2021-12-27 20:50:10 +01:00
|
|
|
scheduleModalRef?: BsModalRef;
|
|
|
|
@ViewChild('table') table!: TableComponent;
|
2021-12-04 21:36:11 +01:00
|
|
|
|
2021-12-27 20:50:10 +01:00
|
|
|
constructor(private api: ApiClientService, private modalService: BsModalService) {}
|
2021-12-24 15:21:22 +01:00
|
|
|
|
|
|
|
changeAvailibility(available: 0|1, id?: number|undefined) {
|
|
|
|
this.api.post("availability", {
|
|
|
|
id: id,
|
|
|
|
available: available
|
2021-12-26 21:32:54 +01:00
|
|
|
}).then((response) => {
|
|
|
|
this.table.loadTableData();
|
2021-12-24 15:21:22 +01:00
|
|
|
});
|
|
|
|
}
|
2021-12-04 21:36:11 +01:00
|
|
|
|
2021-12-27 20:50:10 +01:00
|
|
|
openScheduleModal(template: TemplateRef<any>) {
|
|
|
|
this.scheduleModalRef = this.modalService.show(template);
|
|
|
|
}
|
|
|
|
|
2021-12-04 21:36:11 +01:00
|
|
|
ngOnInit(): void {
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|