Pages/shows: add functionality to edit button

This commit is contained in:
Toast 2025-02-06 10:46:27 +01:00
parent e35564735f
commit 312fedec7b
2 changed files with 12 additions and 1 deletions

View file

@ -9,7 +9,7 @@
<button type="button" class="btn btn-outline-danger" (click)="deleteShow(show)"> <button type="button" class="btn btn-outline-danger" (click)="deleteShow(show)">
<i class="bi bi-trash"></i> <i class="bi bi-trash"></i>
</button> </button>
<button type="button" class="btn btn-outline-warning"> <button type="button" class="btn btn-outline-warning" (click)="editShow(show, $index)">
<i class="bi bi-pencil"></i> <i class="bi bi-pencil"></i>
</button> </button>
</div> </div>

View file

@ -82,4 +82,15 @@ export class ShowsComponent {
} }
) )
} }
editShow(show: Show, index: number) {
const modal: NgbModalRef = this.modalService.open(CreateEditModalComponent)
modal.componentInstance.editMode = true
modal.componentInstance.show = show
modal.componentInstance.initForm()
modal.result.then(
(closeResult: Show) => {this.shows[index] = closeResult},
(dissmissResult) => {}
)
}
} }