wip: player modal

This commit is contained in:
eneller
2026-01-30 22:51:09 +01:00
parent 51414f5a99
commit 3b8e5145c3
12 changed files with 238 additions and 3 deletions

View File

@@ -0,0 +1,38 @@
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { Player } from '../model';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { ModalRotationsComponent } from '../modal-rotations/modal-rotations.component';
@Component({
selector: 'app-screen-rotations',
imports: [FormsModule],
templateUrl: './screen-rotations.component.html',
styleUrl: './screen-rotations.component.less'
})
export class ScreenRotationsComponent {
players: Player[] = [];
newItem: string = "";
constructor(private modalService: NgbModal) {}
addItem() {
if (this.newItem.trim()) {
this.players.push( new Player(this.newItem));
this.newItem = "";
}
}
openPlayerDialog(player: Player) {
const modalRef = this.modalService.open(ModalRotationsComponent);
modalRef.componentInstance.player = player;
modalRef.result.then((updatedPlayer) => {
// Handle the updated player data if needed
console.log('Player updated:', updatedPlayer);
}).catch((error) => {
console.log('Modal dismissed');
});
}
}