-
${input.group.name}
diff --git a/src/pages/tournaments-admin/components/tournaments-admin/components/generate-tournament-tab/components/group-selector/group-selector.component.js b/src/pages/tournaments-admin/components/tournaments-admin/components/generate-tournament-tab/components/group-selector/group-selector.component.js
new file mode 100644
index 0000000..9900715
--- /dev/null
+++ b/src/pages/tournaments-admin/components/tournaments-admin/components/generate-tournament-tab/components/group-selector/group-selector.component.js
@@ -0,0 +1,14 @@
+module.exports = {
+ onAddPlayer(player) {
+ this.emit('add-player', player);
+ },
+ onRemovePlayer(player) {
+ this.emit('remove-player', player);
+ },
+ onVenueChange(event, selected) {
+ this.emit('venue-change', parseInt(event.target.value));
+ },
+ onRemoveGroup(event) {
+ this.emit('remove-group');
+ }
+}
\ No newline at end of file
diff --git a/src/pages/tournaments-admin/components/tournaments-admin/components/generate-tournament-tab/components/group-selector/group-selector.marko b/src/pages/tournaments-admin/components/tournaments-admin/components/generate-tournament-tab/components/group-selector/group-selector.marko
new file mode 100644
index 0000000..4f92f9e
--- /dev/null
+++ b/src/pages/tournaments-admin/components/tournaments-admin/components/generate-tournament-tab/components/group-selector/group-selector.marko
@@ -0,0 +1,14 @@
+
+
${input.group.name}
+
Venue
+
+
+
+
\ No newline at end of file
diff --git a/src/pages/tournaments-admin/components/tournaments-admin/components/generate-tournament-tab/generate-tournament-tab.component.js b/src/pages/tournaments-admin/components/tournaments-admin/components/generate-tournament-tab/generate-tournament-tab.component.js
index 2ae1a8c..cc01741 100644
--- a/src/pages/tournaments-admin/components/tournaments-admin/components/generate-tournament-tab/generate-tournament-tab.component.js
+++ b/src/pages/tournaments-admin/components/tournaments-admin/components/generate-tournament-tab/generate-tournament-tab.component.js
@@ -65,6 +65,9 @@ module.exports = {
this.state.playersAvailable = _.sortBy(this.state.playersAvailable, "name");
this.setStateDirty('playersAvailable');
},
+ onVenueChange(group, venue) {
+ this.state.selected[group].venueId = venue;
+ },
onAddGroup() {
const numGroups = Object.keys(this.state.selected).length;
if (numGroups >= 4) {
@@ -91,8 +94,16 @@ module.exports = {
this.state.office = parseInt(event.target.value);
this.state.playersAvailable = _.reject(this.input.players, (player) => player.office_id !== this.state.office );
this.setStateDirty('playersAvailable');
+
+ this.state.venues = _.reject(this.input.venues, (venue) => venue.office_id != this.state.office );
+ this.setStateDirty("venues");
},
generateTournament() {
+ // Validate that group1 contains at least 2 players
+ if (this.state.selected.group1.players.length < 2) {
+ alert("Group 1 must contain at least 2 players");
+ return;
+ }
// Validate that each group contains either no players, or at least 2 players
for (let group in this.state.selected) {
let players = this.state.selected[group].players;
diff --git a/src/pages/tournaments-admin/components/tournaments-admin/components/generate-tournament-tab/generate-tournament-tab.marko b/src/pages/tournaments-admin/components/tournaments-admin/components/generate-tournament-tab/generate-tournament-tab.marko
index 0790d03..4f83838 100644
--- a/src/pages/tournaments-admin/components/tournaments-admin/components/generate-tournament-tab/generate-tournament-tab.marko
+++ b/src/pages/tournaments-admin/components/tournaments-admin/components/generate-tournament-tab/generate-tournament-tab.marko
@@ -43,28 +43,39 @@
-
+ on-remove-player("onRemovePlayer", "group1") />
-
+ on-remove-player("onRemovePlayer", "group2") />
2)>
-
+ on-remove-player("onRemovePlayer", "group3") />
3)>
-
+ on-remove-player("onRemovePlayer", "group4") />
diff --git a/src/pages/tournaments-admin/components/tournaments-admin/tournaments-admin.marko b/src/pages/tournaments-admin/components/tournaments-admin/tournaments-admin.marko
index e13e888..6d08d17 100644
--- a/src/pages/tournaments-admin/components/tournaments-admin/tournaments-admin.marko
+++ b/src/pages/tournaments-admin/components/tournaments-admin/tournaments-admin.marko
@@ -11,7 +11,7 @@