]> git.localhorst.tv Git - alttp.git/commitdiff
tournament group_size settings form
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Fri, 2 Jan 2026 13:03:50 +0000 (14:03 +0100)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Fri, 2 Jan 2026 13:03:50 +0000 (14:03 +0100)
app/Http/Controllers/RoundController.php
app/Http/Controllers/TournamentController.php
resources/js/components/tournament/SettingsDialog.jsx
resources/js/i18n/de.js
resources/js/i18n/en.js

index 6814c45fea22128a79a32230ab267cba111d817b..a33785bd256845756dd021b8455e12e92c7d92a1 100644 (file)
@@ -187,7 +187,7 @@ class RoundController extends Controller
        }
 
        private static $GROUP_NAMES = [
-               'A', 'B', 'C', 'D', 'E',
+               'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
        ];
 
 }
index 9feb0534a02b60ccb31f9848027f476e278c9acf..b3561eee8c0d24d1c9989c9e47f5d875fadaa389 100644 (file)
@@ -114,15 +114,19 @@ class TournamentController extends Controller
        public function settings(Request $request, Tournament $tournament) {
                $this->authorize('update', $tournament);
                $validatedData = $request->validate([
+                       'group_size' => 'integer|nullable',
                        'result_reveal' => 'string|nullable|in:always,finishers,never,participants',
                        'show_numbers' => 'boolean|nullable',
                ]);
-               if (array_key_exists('show_numbers', $validatedData)) {
-                       $tournament->show_numbers = $validatedData['show_numbers'];
+               if (array_key_exists('group_size', $validatedData)) {
+                       $tournament->group_size = $validatedData['group_size'];
                }
                if (isset($validatedData['result_reveal'])) {
                        $tournament->result_reveal = $validatedData['result_reveal'];
                }
+               if (array_key_exists('show_numbers', $validatedData)) {
+                       $tournament->show_numbers = $validatedData['show_numbers'];
+               }
                $tournament->save();
                if ($tournament->wasChanged()) {
                        TournamentChanged::dispatch($tournament);
index ad2de5702042bb214a39ea3a7ab37f58776f43f3..a24f383c5c873b54aedd1a6a70dc3491a14fee30 100644 (file)
@@ -112,6 +112,24 @@ const SettingsDialog = ({
                                                value={tournament.show_numbers}
                                        />
                                </div>
+                               {Tournament.hasAssignedGroups(tournament) ? (
+                                       <div className="d-flex align-items-center justify-content-between mb-3">
+                                               <span>{i18n.t('tournaments.groupSize')}</span>
+                                               <Form.Control
+                                                       className="text-end w-50"
+                                                       max="8"
+                                                       min="1"
+                                                       onChange={({ target: { value } }) => {
+                                                               const num = parseInt(value, 10);
+                                                               if (value >= 1 && value <= 8) {
+                                                                       settings(tournament, { group_size: num });
+                                                               }
+                                                       }}
+                                                       type="number"
+                                                       value={tournament.group_size}
+                                               />
+                                       </div>
+                               ) : null}
                                <div className="d-flex align-items-center justify-content-between mb-3">
                                        <span title={i18n.t('tournaments.resultRevealDescription')}>
                                                {i18n.t('tournaments.resultReveal')}
@@ -177,6 +195,7 @@ SettingsDialog.propTypes = {
                accept_applications: PropTypes.bool,
                discord: PropTypes.string,
                locked: PropTypes.bool,
+               group_size: PropTypes.number,
                result_reveal: PropTypes.string,
                show_numbers: PropTypes.bool,
        }),
index a739183bd593d5bcac6c9b539d9d58db88b9cc37..ae56a373ad9a3519edf358e1f6215ddcefa66310 100644 (file)
@@ -924,6 +924,7 @@ export default {
                        discordSettingsError: 'Fehler beim Speichern der Discord Einstellungen',
                        discordSettingsSuccess: 'Discord Einstellungen gespeichert',
                        discordSuccess: 'Discord verknüpft',
+                       groupSize: 'Seeds pro Runde',
                        inviteBot: 'Bot einladen',
                        locked: 'Turnier sperren',
                        lockError: 'Fehler beim Sperren',
index a1c296d217f5aa60d7c91c770949c6dc4052405c..d633cae5e99334078093445bcfb63648e209bffa 100644 (file)
@@ -925,6 +925,7 @@ export default {
                        discordSettingsError: 'Error saving discord settings',
                        discordSettingsSuccess: 'Discord settings saved',
                        discordSuccess: 'Discord associated',
+                       groupSize: 'Seeds per Round',
                        inviteBot: 'Invite bot',
                        locked: 'Lock rounds',
                        lockError: 'Error locking tournament',