1
0
mirror of https://github.com/allerta-vvf/allerta-vvf synced 2025-06-06 00:49:21 +02:00

Add schedule modal placeholder

This commit is contained in:
2021-12-27 20:50:10 +01:00
parent 3c33e02b4f
commit 96d5aa322f
5 changed files with 50 additions and 7 deletions

View File

@@ -4,9 +4,21 @@
<button (click)="changeAvailibility(1)" id="activate-btn" class="btn btn-lg btn-success me-1">Attiva</button>
<button (click)="changeAvailibility(0)" id="deactivate-btn" class="btn btn-lg btn-danger">Disattiva</button>
</div>
<button type="button" class="btn btn-lg">
<button type="button" class="btn btn-lg" (click)="openScheduleModal(scheduleModal)">
Modifica orari disponibilità
</button>
</div>
<owner-image></owner-image>
<app-table [sourceType]="'list'" (changeAvailability)="changeAvailibility($event.newState, $event.user)" #table></app-table>
<app-table [sourceType]="'list'" (changeAvailability)="changeAvailibility($event.newState, $event.user)" #table></app-table>
<ng-template #scheduleModal>
<div class="modal-header">
<h4 class="modal-title pull-left">Modal</h4>
<button type="button" class="btn-close close pull-right" aria-label="Close" (click)="scheduleModalRef?.hide()">
<span aria-hidden="true" class="visually-hidden">&times;</span>
</button>
</div>
<div class="modal-body">
This is a modal.
</div>
</ng-template>

View File

@@ -1,5 +1,7 @@
import { Component, OnInit, ViewChild, ElementRef } from '@angular/core';
import { Component, OnInit, ViewChild, TemplateRef } from '@angular/core';
import { TableComponent } from '../table/table.component';
import { ApiClientService } from 'src/app/_services/api-client.service';
import { BsModalService, BsModalRef } from 'ngx-bootstrap/modal';
@Component({
selector: 'app-list',
@@ -7,11 +9,10 @@ import { ApiClientService } from 'src/app/_services/api-client.service';
styleUrls: ['./list.component.scss']
})
export class ListComponent implements OnInit {
scheduleModalRef?: BsModalRef;
@ViewChild('table') table!: TableComponent;
@ViewChild('table') table!: any;
constructor(private api: ApiClientService) {}
constructor(private api: ApiClientService, private modalService: BsModalService) {}
changeAvailibility(available: 0|1, id?: number|undefined) {
this.api.post("availability", {
@@ -22,6 +23,10 @@ export class ListComponent implements OnInit {
});
}
openScheduleModal(template: TemplateRef<any>) {
this.scheduleModalRef = this.modalService.show(template);
}
ngOnInit(): void {
}