@dcrackel/hematournamentui 1.0.711 → 1.0.713

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/.prettierignore +7 -7
  2. package/.storybook/main.js +3 -1
  3. package/README.md +182 -148
  4. package/dist/HemaTournamentUI-lib.es.js +4150 -4039
  5. package/dist/HemaTournamentUI-lib.umd.js +27 -27
  6. package/dist/hematournamentui-tailwind.css +11 -0
  7. package/package.json +96 -96
  8. package/prettier.config.js +16 -16
  9. package/src/main.js +1 -1
  10. package/src/mocks/getDEBouts-TableOf128.js +37 -37
  11. package/src/mocks/getDEBouts-TableOf64.js +35 -35
  12. package/src/stories/Atoms/Input/BaseInput.test.js +97 -97
  13. package/src/stories/Atoms/Input/BaseInput.vue +149 -149
  14. package/src/stories/Molecules/Indicators/MissingHemaRatingsId/MissingHemaRatingsId.stories.js +23 -23
  15. package/src/stories/Molecules/Indicators/MissingHemaRatingsId/MissingHemaRatingsId.vue +35 -35
  16. package/src/stories/Molecules/Indicators/RegistrationStatus/RegistrationStatus.vue +30 -0
  17. package/src/stories/Molecules/Menus/HoverActions/HoverActions.test.js +138 -0
  18. package/src/stories/Molecules/Menus/HoverActions/HoverActions.vue +212 -0
  19. package/src/stories/Molecules/Modals/DirectorModal/DirectorModal.stories.js +6 -0
  20. package/src/stories/Molecules/Modals/DirectorModal/DirectorModal.test.js +18 -18
  21. package/src/stories/Molecules/Modals/DirectorModal/DirectorModal.vue +1 -1
  22. package/src/stories/Organisms/Cards/BoutCard/BoutCard.vue +5 -1
  23. package/src/stories/Organisms/Cards/BoutCard/Variants/BoutCardActive/BoutCardActive.vue +19 -10
  24. package/src/stories/Organisms/Cards/BoutCard/Variants/BoutCardInactive/BoutCardInactive.vue +11 -7
  25. package/src/stories/Organisms/Cards/BracketDirectorAssignmentCard/BracketDirectorAssignmentCard.stories.js +33 -33
  26. package/src/stories/Organisms/Cards/BracketDirectorAssignmentCard/BracketDirectorAssignmentCard.test.js +45 -45
  27. package/src/stories/Organisms/Cards/BracketDirectorAssignmentCard/BracketDirectorAssignmentCard.vue +103 -103
  28. package/src/stories/Organisms/Cards/Director/DirectorCard.test.js +82 -0
  29. package/src/stories/Organisms/Cards/Director/DirectorCard.vue +32 -51
  30. package/src/stories/Organisms/Cards/EditBout/EditBout.test.js +51 -51
  31. package/src/stories/Organisms/Cards/EventCard/EventCard.stories.js +41 -1
  32. package/src/stories/Organisms/Cards/EventCard/EventCard.test.js +106 -0
  33. package/src/stories/Organisms/Cards/EventCard/EventCard.vue +62 -30
  34. package/src/stories/Organisms/Cards/FencerCard/FencerCard.vue +298 -298
  35. package/src/stories/Organisms/Cards/TableauBoutCard/TableauBoutCard.stories.js +77 -60
  36. package/src/stories/Organisms/Cards/TableauBoutCard/TableauBoutCard.test.js +144 -143
  37. package/src/stories/Organisms/Cards/TableauBoutCard/TableauBoutCard.vue +289 -256
  38. package/src/stories/Organisms/Cards/TableauFencerCard/TableauFencerCard.stories.js +69 -69
  39. package/src/stories/Organisms/Cards/TableauFencerCard/TableauFencerCard.vue +80 -80
  40. package/src/stories/Organisms/Cards/WaitlistFencerCard/WaitlistFencerCard.vue +153 -153
  41. package/src/stories/Organisms/ComplexInputs/DropDown/DropDownMenu.vue +4 -0
  42. package/src/stories/Organisms/ComplexInputs/ImageCropper/ImageCropper.stories.js +31 -31
  43. package/src/stories/Organisms/ComplexInputs/ImageCropper/ImageCropper.test.js +109 -109
  44. package/src/stories/Organisms/ComplexInputs/ImageCropper/ImageCropper.vue +192 -192
  45. package/src/stories/Organisms/Containers/Tableau/Tableau.stories.js +1 -0
  46. package/src/stories/Organisms/Containers/Tableau/Tableau.test.js +247 -204
  47. package/src/stories/Organisms/Containers/Tableau/Tableau.vue +89 -15
  48. package/src/stories/Organisms/Containers/Tableau/components/BracketDirectorAssignmentPanel.test.js +29 -29
  49. package/src/stories/Organisms/Containers/Tableau/components/BracketDirectorAssignmentPanel.vue +46 -46
  50. package/src/stories/Organisms/Containers/Tableau/components/TableauSvgOverlay.test.js +21 -21
  51. package/src/stories/Organisms/Containers/Tableau/components/TableauSvgOverlay.vue +39 -39
  52. package/src/stories/Organisms/Containers/Tableau/layout/TableauLayoutEngine.js +145 -145
  53. package/src/stories/Organisms/Containers/Tableau/layout/TableauLayoutEngine.test.js +64 -64
  54. package/src/stories/Organisms/Containers/Tableau/plannedAssignments.js +36 -57
  55. package/src/stories/Organisms/Containers/Tableau/plannedAssignments.test.js +101 -65
  56. package/src/stories/Organisms/Containers/TableauColumn/TableauColumn.vue +14 -1
  57. package/src/stories/Organisms/Headers/AttendanceSummary/AttendanceSummary.vue +12 -5
  58. package/src/stories/Organisms/Wizards/EditEventWizard/BasicEventInfo/BasicEventInfo.stories.js +52 -48
  59. package/src/stories/Organisms/Wizards/EditEventWizard/BasicEventInfo/BasicEventInfo.vue +256 -227
  60. package/src/stories/Organisms/Wizards/EditEventWizard/DirectElimination/DirectElimination.vue +226 -226
  61. package/src/stories/Organisms/Wizards/EditEventWizard/DirectEliminationPromotion/DirectEliminationPromotion.vue +204 -204
  62. package/src/stories/Organisms/Wizards/EditEventWizard/EditEventWizard.stories.js +137 -133
  63. package/src/stories/Organisms/Wizards/EditEventWizard/EditEventWizard.test.js +221 -191
  64. package/src/stories/Organisms/Wizards/EditEventWizard/EditEventWizard.vue +372 -366
  65. package/src/stories/Organisms/Wizards/EditEventWizard/EventCustomization/EventCustomization.vue +172 -172
  66. package/src/stories/Organisms/Wizards/EditEventWizard/PoolConfiguration/PoolConfiguration.vue +216 -216
  67. package/src/stories/Organisms/Wizards/EditEventWizard/PriceFields.test.js +79 -79
  68. package/src/stories/Organisms/Wizards/EditEventWizard/RuleSerialization.test.js +29 -0
  69. package/src/stories/Organisms/Wizards/EditEventWizard/WeaponSelection.test.js +138 -0
  70. package/src/stories/Templates/EventManagement/Bracket/Bracket.stories.js +123 -12
  71. package/src/stories/Templates/EventManagement/Bracket/Bracket.test.js +178 -166
  72. package/src/stories/Templates/EventManagement/Bracket/Bracket.vue +35 -7
  73. package/src/stories/Templates/EventManagement/Bracket/BracketDirectorAssignment.test.js +242 -0
  74. package/src/stories/Templates/EventManagement/Bracket/BracketMobile.test.js +131 -0
  75. package/src/stories/Templates/EventManagement/Bracket/BracketPlannedSuggestions.js +42 -39
  76. package/src/stories/Templates/EventManagement/Bracket/BracketStories.test.js +80 -0
  77. package/src/stories/Templates/EventManagement/Bracket/BracketStoryAssignments.js +93 -0
  78. package/src/stories/Templates/EventManagement/Bracket/BracketStoryAssignments.test.js +152 -0
  79. package/src/stories/Templates/EventManagement/Bracket/BracketStoryHarness.js +39 -39
  80. package/src/stories/Templates/EventManagement/Bracket/BracketStoryHarness.test.js +79 -79
  81. package/src/stories/Templates/EventManagement/EditEventInfo/EditEventInfo.stories.js +93 -93
  82. package/src/stories/Templates/EventManagement/EditEventInfo/EditEventInfo.vue +91 -91
  83. package/src/stories/Templates/EventManagement/EventAttendance/EventAttendance.stories.js +31 -1
  84. package/src/stories/Templates/EventManagement/PoolLive/PoolLive.test.js +121 -121
  85. package/src/stories/Templates/Menus/EditEventsTopMenu/EditEventsTopMenu.stories.js +9 -2
  86. package/src/stories/Templates/Menus/EditEventsTopMenu/EditEventsTopMenu.vue +5 -4
  87. package/src/stories/Templates/PersonManagement/Admin/Administration/Administration.stories.js +81 -81
  88. package/src/stories/Templates/PersonManagement/Admin/Administration/Administration.test.js +39 -39
  89. package/src/stories/Templates/PersonManagement/Admin/Administration/Administration.vue +101 -101
  90. package/src/stories/Templates/PersonManagement/Admin/FencerAdmin/FencerAdmin.stories.js +71 -71
  91. package/src/stories/Templates/PersonManagement/Admin/FencerAdmin/FencerAdmin.vue +86 -86
  92. package/src/stories/Templates/PersonManagement/Admin/MergeAccounts/MergeAccounts.stories.js +86 -86
  93. package/src/stories/Templates/PersonManagement/Admin/MergeAccounts/MergeAccounts.vue +247 -247
  94. package/src/stories/Templates/PersonManagement/Basic/BasicEdit.vue +170 -170
  95. package/src/stories/Templates/PersonManagement/PersonManagement.stories.js +156 -156
  96. package/src/stories/Templates/PersonManagement/PersonManagement.test.js +329 -329
  97. package/src/stories/Templates/PersonManagement/PersonManagement.vue +329 -329
  98. package/src/stories/Templates/PersonManagement/PersonManagementDraft.js +42 -42
  99. package/src/stories/Templates/TournamentManagement/ListEvents/ListEvents.stories.js +58 -45
  100. package/src/stories/Templates/TournamentManagement/TournamentManagement.stories.js +84 -84
  101. package/src/stories/Templates/TournamentManagement/TournamentManagement.test.js +114 -114
  102. package/src/stories/Templates/TournamentManagement/TournamentManagement.vue +363 -363
  103. package/src/stories/Templates/TournamentManagement/TournamentPageOne/TournamentPageOne.stories.js +116 -116
  104. package/src/stories/Templates/TournamentManagement/TournamentPageOne/TournamentPageOne.vue +307 -307
  105. package/src/stories/Util/Validations/PersonManagementValidations.js +45 -45
  106. package/src/stories/Util/Validations/PriceValidation.js +6 -6
  107. package/src/stories/Util/boutDirectorAssignment.js +46 -0
  108. package/src/stories/Util/registrationStatus.js +11 -0
  109. package/src/stories/Util/tabs.js +19 -47
@@ -1,204 +1,204 @@
1
- <template>
2
- <div class="flex flex-col h-full pb-4">
3
- <div class="w-full flex justify-center grow">
4
- <StepIndicator :steps="steps" :selected="currentStep" />
5
- </div>
6
- <div class="w-full flex flex-row justify-center my-4 grow">
7
- <BaseText
8
- :color="'primaryHighlight'"
9
- :size="'2xl'"
10
- text="DIRECT ELIMINATION PROMOTION"
11
- :weight="'normal'"
12
- data-testid="text-add-tournament"
13
- />
14
- </div>
15
-
16
- <div class="w-full flex mb-3 ml-1 grow">
17
- <BaseText
18
- :color="'quinary'"
19
- :size="'sm'"
20
- :text="'Define the criteria for promoting fencers to the Direct Elimination (DE) stage. These options specify how fencers advance based on their performance metrics. Ensure the correct order of criteria to reflect their importance in the promotion process.'"
21
- :weight="'normal'"
22
- data-testid="text-registration"
23
- />
24
- </div>
25
-
26
- <div class="grow">
27
- <div class="mt-8">
28
- <BaseText
29
- :color="'quaternary'"
30
- :size="'sm'"
31
- :text="'DIRECT ELIMINATION PROMOTION CRITERIA'"
32
- class="border-b mt-5"
33
- />
34
- </div>
35
-
36
- <div class="mt-1 mb-4 grow">
37
- <BaseText
38
- :color="'quinary'"
39
- :size="'sm'"
40
- text="Choose how people are promoted from pools into the elimination bracket."
41
- :weight="'normal'"
42
- data-testid="text-registration"
43
- class="mb-5"
44
- />
45
-
46
- {{ eventConfig.DEPromoteBy }}
47
- <DropDownMenu
48
- label=""
49
- :items="DEPromotionTypes"
50
- :selectedItem="selectedItem"
51
- :alignEnd="false"
52
- :width="'w-full'"
53
- @update:selectedItem="handleDEPromotionTypeChange"
54
- />
55
- </div>
56
-
57
- <div class="mb-2 flex flex-col">
58
- <BaseText
59
- :color="'quinary'"
60
- :size="'sm'"
61
- :text="DEPromotionDescription"
62
- :weight="'normal'"
63
- data-testid="text-registration"
64
- class="mb-4"
65
- />
66
- <TitledInput
67
- :inputValue="eventConfig.DEPromotionAmount"
68
- :invalid="validation.DEPromotionAmount"
69
- :allowPercent="true"
70
- placeholder="Enter Number or Percent.."
71
- title=""
72
- @update:value="handleDEPromotionAmountChange"
73
- />
74
- </div>
75
- </div>
76
-
77
- <div class="grow">
78
- <div class="mt-8">
79
- <BaseText
80
- :color="'quaternary'"
81
- :size="'sm'"
82
- :text="'ORDER OF STATS TO DECIDE PROMOTION'"
83
- class="border-b mt-5"
84
- />
85
- </div>
86
- <div class="pb-4 -mt-3">
87
- <MultiSelect
88
- label="Select and arrange the statistical criteria that will be used to promote participants to the Direct Elimination (DE) stage. The order of these criteria is crucial as it determines the priority for promotion. Choose up to three stats from the available options."
89
- :initialSelectedTags="eventConfig.DEPromotionOrder"
90
- :availableTags="['Win Percent', 'Win Count', 'Indicator', 'Points Scored']"
91
- @update:selectedTags="handleMultiSelect"
92
- />
93
- </div>
94
- </div>
95
- <div class="flex flex-row justify-center h-12 mt-4">
96
- <BaseButton class="w-1/2 ml-1" color="neutral" label="Back" size="sm" type="primary" @buttonClick="handleBack" />
97
- <BaseButton
98
- class="w-1/2 mr-1 transition-all duration-300 ease-in-out h-12"
99
- color="neutral"
100
- :label="nextButtonLabel"
101
- selected="selected"
102
- size="sm"
103
- type="primary"
104
- @buttonClick="handleNext"
105
- />
106
- </div>
107
- </div>
108
- </template>
109
-
110
- <script>
111
- import TitledInput from '../../../../Molecules/CombinationInputs/TitledInput/TitledInput.vue';
112
- import MultiSelect from '../../../../Molecules/Inputs/MultiSelect/MultiSelect.vue';
113
- import BaseText from '../../../../Atoms/Text/BaseText.vue';
114
- import BaseButton from '../../../../Molecules/Buttons/BaseButton/BaseButton.vue';
115
- import StepIndicator from '../../../../Molecules/StepIndicator/BaseStepIndicator/StepIndicator.vue';
116
- import DropDownMenu from '../../../ComplexInputs/DropDown/DropDownMenu.vue';
117
- import Toggle from '../../../../Molecules/Inputs/Toggle/Toggle.vue';
118
-
119
- const promotionTypeDefaults = {
120
- 'Top Percent': { typeCode: 'Percent', defaultAmount: '100%' },
121
- 'Top Count': { typeCode: 'Count', defaultAmount: '16' },
122
- 'Top Count of Each Pool': { typeCode: 'Top', defaultAmount: '2' }
123
- };
124
-
125
- const defaultPromotionType = { typeCode: 'Percent', defaultAmount: '100%' };
126
-
127
- export default {
128
- name: 'DirectEliminationPromotion',
129
- emits: ['update', 'update:back', 'update:DEPromotionType', 'update:next'],
130
- components: { Toggle, DropDownMenu, StepIndicator, BaseButton, BaseText, TitledInput, MultiSelect },
131
- props: {
132
- nextButtonLabel: { type: String, default: 'Next' },
133
- eventConfig: Object,
134
- validation: Object,
135
- currentStep: Number,
136
- steps: Array
137
- },
138
- data() {
139
- return {
140
- selectedItem: null
141
- };
142
- },
143
- watch: {
144
- 'eventConfig.DEPromoteBy': {
145
- immediate: true,
146
- handler(value) {
147
- const map = {
148
- Percent: 'Top Percent',
149
- Count: 'Top Count',
150
- Top: 'Top Count of Each Pool'
151
- };
152
- const display = map[value] || 'Top Percent';
153
- this.selectedItem = this.DEPromotionTypes.find(item => item.text === display);
154
- }
155
- }
156
- },
157
- computed: {
158
- selectedFormat() {
159
- return this.selectedFormat.Name;
160
- },
161
- DEPromotionTypes() {
162
- return [
163
- { text: 'Top Percent', link: 'Top Percent' },
164
- { text: 'Top Count', link: 'Top Count' },
165
- { text: 'Top Count of Each Pool', link: 'Top Count of Each Pool' }
166
- ];
167
- },
168
- DEPromotionDescription() {
169
- if (this.selectedItem.text === 'Top Percent') {
170
- return 'Use this option to promote a percentage of participants to the Direct Elimination (DE) stage. Enter a percentage value (e.g., 100% to promote all participants or 50% to promote the top half).';
171
- }
172
- if (this.selectedItem.text === 'Top Count') {
173
- return 'Use this option to promote a specific number of participants to the Direct Elimination (DE) stage. Enter a whole number (e.g., 16 to promote the top 16 participants).';
174
- }
175
- if (this.selectedItem.text === 'Top Count of Each Pool') {
176
- return 'Use this option to promote a set number of participants from each pool to the Direct Elimination (DE) stage. Enter a whole number (e.g., 2 to promote the top 2 participants from each pool).';
177
- }
178
- }
179
- },
180
- methods: {
181
- handleDEPromotionAmountChange(value) {
182
- this.$emit('update', { DEPromotionAmount: value });
183
- },
184
- handleMultiSelect(value) {
185
- this.$emit('update', { DEPromotionOrder: value });
186
- },
187
- handleBack() {
188
- this.$emit('update:back');
189
- },
190
- handleNext() {
191
- this.$emit('update:next', this.eventConfig);
192
- },
193
- handleDEPromotionTypeChange(item) {
194
- this.selectedItem = item;
195
-
196
- const { typeCode, defaultAmount } = promotionTypeDefaults[item.text] || defaultPromotionType;
197
-
198
- this.$emit('update', { DEPromoteBy: typeCode, DEPromotionAmount: defaultAmount });
199
-
200
- this.$emit('update:DEPromotionType', typeCode);
201
- }
202
- }
203
- };
204
- </script>
1
+ <template>
2
+ <div class="flex flex-col h-full pb-4">
3
+ <div class="w-full flex justify-center grow">
4
+ <StepIndicator :steps="steps" :selected="currentStep" />
5
+ </div>
6
+ <div class="w-full flex flex-row justify-center my-4 grow">
7
+ <BaseText
8
+ :color="'primaryHighlight'"
9
+ :size="'2xl'"
10
+ text="DIRECT ELIMINATION PROMOTION"
11
+ :weight="'normal'"
12
+ data-testid="text-add-tournament"
13
+ />
14
+ </div>
15
+
16
+ <div class="w-full flex mb-3 ml-1 grow">
17
+ <BaseText
18
+ :color="'quinary'"
19
+ :size="'sm'"
20
+ :text="'Define the criteria for promoting fencers to the Direct Elimination (DE) stage. These options specify how fencers advance based on their performance metrics. Ensure the correct order of criteria to reflect their importance in the promotion process.'"
21
+ :weight="'normal'"
22
+ data-testid="text-registration"
23
+ />
24
+ </div>
25
+
26
+ <div class="grow">
27
+ <div class="mt-8">
28
+ <BaseText
29
+ :color="'quaternary'"
30
+ :size="'sm'"
31
+ :text="'DIRECT ELIMINATION PROMOTION CRITERIA'"
32
+ class="border-b mt-5"
33
+ />
34
+ </div>
35
+
36
+ <div class="mt-1 mb-4 grow">
37
+ <BaseText
38
+ :color="'quinary'"
39
+ :size="'sm'"
40
+ text="Choose how people are promoted from pools into the elimination bracket."
41
+ :weight="'normal'"
42
+ data-testid="text-registration"
43
+ class="mb-5"
44
+ />
45
+
46
+ {{ eventConfig.DEPromoteBy }}
47
+ <DropDownMenu
48
+ label=""
49
+ :items="DEPromotionTypes"
50
+ :selectedItem="selectedItem"
51
+ :alignEnd="false"
52
+ :width="'w-full'"
53
+ @update:selectedItem="handleDEPromotionTypeChange"
54
+ />
55
+ </div>
56
+
57
+ <div class="mb-2 flex flex-col">
58
+ <BaseText
59
+ :color="'quinary'"
60
+ :size="'sm'"
61
+ :text="DEPromotionDescription"
62
+ :weight="'normal'"
63
+ data-testid="text-registration"
64
+ class="mb-4"
65
+ />
66
+ <TitledInput
67
+ :inputValue="eventConfig.DEPromotionAmount"
68
+ :invalid="validation.DEPromotionAmount"
69
+ :allowPercent="true"
70
+ placeholder="Enter Number or Percent.."
71
+ title=""
72
+ @update:value="handleDEPromotionAmountChange"
73
+ />
74
+ </div>
75
+ </div>
76
+
77
+ <div class="grow">
78
+ <div class="mt-8">
79
+ <BaseText
80
+ :color="'quaternary'"
81
+ :size="'sm'"
82
+ :text="'ORDER OF STATS TO DECIDE PROMOTION'"
83
+ class="border-b mt-5"
84
+ />
85
+ </div>
86
+ <div class="pb-4 -mt-3">
87
+ <MultiSelect
88
+ label="Select and arrange the statistical criteria that will be used to promote participants to the Direct Elimination (DE) stage. The order of these criteria is crucial as it determines the priority for promotion. Choose up to three stats from the available options."
89
+ :initialSelectedTags="eventConfig.DEPromotionOrder"
90
+ :availableTags="['Win Percent', 'Win Count', 'Indicator', 'Points Scored']"
91
+ @update:selectedTags="handleMultiSelect"
92
+ />
93
+ </div>
94
+ </div>
95
+ <div class="flex flex-row justify-center h-12 mt-4">
96
+ <BaseButton class="w-1/2 ml-1" color="neutral" label="Back" size="sm" type="primary" @buttonClick="handleBack" />
97
+ <BaseButton
98
+ class="w-1/2 mr-1 transition-all duration-300 ease-in-out h-12"
99
+ color="neutral"
100
+ :label="nextButtonLabel"
101
+ selected="selected"
102
+ size="sm"
103
+ type="primary"
104
+ @buttonClick="handleNext"
105
+ />
106
+ </div>
107
+ </div>
108
+ </template>
109
+
110
+ <script>
111
+ import TitledInput from '../../../../Molecules/CombinationInputs/TitledInput/TitledInput.vue';
112
+ import MultiSelect from '../../../../Molecules/Inputs/MultiSelect/MultiSelect.vue';
113
+ import BaseText from '../../../../Atoms/Text/BaseText.vue';
114
+ import BaseButton from '../../../../Molecules/Buttons/BaseButton/BaseButton.vue';
115
+ import StepIndicator from '../../../../Molecules/StepIndicator/BaseStepIndicator/StepIndicator.vue';
116
+ import DropDownMenu from '../../../ComplexInputs/DropDown/DropDownMenu.vue';
117
+ import Toggle from '../../../../Molecules/Inputs/Toggle/Toggle.vue';
118
+
119
+ const promotionTypeDefaults = {
120
+ 'Top Percent': { typeCode: 'Percent', defaultAmount: '100%' },
121
+ 'Top Count': { typeCode: 'Count', defaultAmount: '16' },
122
+ 'Top Count of Each Pool': { typeCode: 'Top', defaultAmount: '2' }
123
+ };
124
+
125
+ const defaultPromotionType = { typeCode: 'Percent', defaultAmount: '100%' };
126
+
127
+ export default {
128
+ name: 'DirectEliminationPromotion',
129
+ emits: ['update', 'update:back', 'update:DEPromotionType', 'update:next'],
130
+ components: { Toggle, DropDownMenu, StepIndicator, BaseButton, BaseText, TitledInput, MultiSelect },
131
+ props: {
132
+ nextButtonLabel: { type: String, default: 'Next' },
133
+ eventConfig: Object,
134
+ validation: Object,
135
+ currentStep: Number,
136
+ steps: Array
137
+ },
138
+ data() {
139
+ return {
140
+ selectedItem: null
141
+ };
142
+ },
143
+ watch: {
144
+ 'eventConfig.DEPromoteBy': {
145
+ immediate: true,
146
+ handler(value) {
147
+ const map = {
148
+ Percent: 'Top Percent',
149
+ Count: 'Top Count',
150
+ Top: 'Top Count of Each Pool'
151
+ };
152
+ const display = map[value] || 'Top Percent';
153
+ this.selectedItem = this.DEPromotionTypes.find(item => item.text === display);
154
+ }
155
+ }
156
+ },
157
+ computed: {
158
+ selectedFormat() {
159
+ return this.selectedFormat.Name;
160
+ },
161
+ DEPromotionTypes() {
162
+ return [
163
+ { text: 'Top Percent', link: 'Top Percent' },
164
+ { text: 'Top Count', link: 'Top Count' },
165
+ { text: 'Top Count of Each Pool', link: 'Top Count of Each Pool' }
166
+ ];
167
+ },
168
+ DEPromotionDescription() {
169
+ if (this.selectedItem.text === 'Top Percent') {
170
+ return 'Use this option to promote a percentage of participants to the Direct Elimination (DE) stage. Enter a percentage value (e.g., 100% to promote all participants or 50% to promote the top half).';
171
+ }
172
+ if (this.selectedItem.text === 'Top Count') {
173
+ return 'Use this option to promote a specific number of participants to the Direct Elimination (DE) stage. Enter a whole number (e.g., 16 to promote the top 16 participants).';
174
+ }
175
+ if (this.selectedItem.text === 'Top Count of Each Pool') {
176
+ return 'Use this option to promote a set number of participants from each pool to the Direct Elimination (DE) stage. Enter a whole number (e.g., 2 to promote the top 2 participants from each pool).';
177
+ }
178
+ }
179
+ },
180
+ methods: {
181
+ handleDEPromotionAmountChange(value) {
182
+ this.$emit('update', { DEPromotionAmount: value });
183
+ },
184
+ handleMultiSelect(value) {
185
+ this.$emit('update', { DEPromotionOrder: value });
186
+ },
187
+ handleBack() {
188
+ this.$emit('update:back');
189
+ },
190
+ handleNext() {
191
+ this.$emit('update:next', this.eventConfig);
192
+ },
193
+ handleDEPromotionTypeChange(item) {
194
+ this.selectedItem = item;
195
+
196
+ const { typeCode, defaultAmount } = promotionTypeDefaults[item.text] || defaultPromotionType;
197
+
198
+ this.$emit('update', { DEPromoteBy: typeCode, DEPromotionAmount: defaultAmount });
199
+
200
+ this.$emit('update:DEPromotionType', typeCode);
201
+ }
202
+ }
203
+ };
204
+ </script>