fix+add: seats + seat-chooser

This commit is contained in:
Didier Slof 2023-01-01 20:13:11 +01:00
parent 2c6745e812
commit b0cc5b5278
Signed by: didier
GPG key ID: 01E71F18AA4398E5
31 changed files with 808 additions and 115 deletions

View file

@ -25,14 +25,20 @@ class SeatChooser extends Component
}
public function matrixGenerate() {
$matrix = [];
for ($row = 1; $row <= $this->room->room_rows; $row++) {
$matrix[$row] = [];
for ($column = 1; $column <= $this->room->room_columns; $column++) {
$matrix[$row][$column] = 0;
// returns a matrix of seats
$m = [];
// first make empty matrix
for ($i = 0; $i < $this->room->room_rows-1; $i++) {
$m[$i] = [];
for ($j = 0; $j < $this->room->room_columns-1; $j++) {
$m[$i][$j] = null;
}
}
return $matrix;
$seats = $this->room->seats;
foreach ($seats as $seat) {
$m[$seat->seat_row][$seat->seat_column] = $seat;
}
return $m;
}
/**