@dcrackel/hematournamentui 1.0.708 → 1.0.710
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.
- package/README.md +148 -106
- package/dist/HemaTournamentUI-lib.es.js +6678 -6196
- package/dist/HemaTournamentUI-lib.umd.js +27 -27
- package/dist/hematournamentui-tailwind.css +16 -6
- package/package.json +1 -1
- package/src/stories/Atoms/Input/BaseInput.test.js +97 -85
- package/src/stories/Atoms/Input/BaseInput.vue +149 -150
- package/src/stories/Organisms/ComplexInputs/ImageCropper/ImageCropper.stories.js +31 -20
- package/src/stories/Organisms/ComplexInputs/ImageCropper/ImageCropper.test.js +109 -0
- package/src/stories/Organisms/ComplexInputs/ImageCropper/ImageCropper.vue +192 -133
- package/src/stories/Organisms/Wizards/EditEventWizard/BasicEventInfo/BasicEventInfo.stories.js +48 -41
- package/src/stories/Organisms/Wizards/EditEventWizard/BasicEventInfo/BasicEventInfo.vue +227 -206
- package/src/stories/Organisms/Wizards/EditEventWizard/DirectElimination/DirectElimination.vue +226 -225
- package/src/stories/Organisms/Wizards/EditEventWizard/DirectEliminationPromotion/DirectEliminationPromotion.vue +204 -204
- package/src/stories/Organisms/Wizards/EditEventWizard/EditEventWizard.stories.js +133 -91
- package/src/stories/Organisms/Wizards/EditEventWizard/EditEventWizard.test.js +191 -0
- package/src/stories/Organisms/Wizards/EditEventWizard/EditEventWizard.vue +366 -309
- package/src/stories/Organisms/Wizards/EditEventWizard/EventCustomization/EventCustomization.vue +172 -171
- package/src/stories/Organisms/Wizards/EditEventWizard/PoolConfiguration/PoolConfiguration.vue +216 -215
- package/src/stories/Organisms/Wizards/EditEventWizard/PriceFields.test.js +79 -0
- package/src/stories/Templates/EventManagement/EditEventInfo/EditEventInfo.stories.js +93 -52
- package/src/stories/Templates/EventManagement/EditEventInfo/EditEventInfo.vue +91 -75
- package/src/stories/Templates/PersonManagement/Admin/Administration/Administration.stories.js +14 -0
- package/src/stories/Templates/PersonManagement/Admin/Administration/Administration.test.js +39 -0
- package/src/stories/Templates/PersonManagement/Admin/Administration/Administration.vue +13 -3
- package/src/stories/Templates/PersonManagement/Basic/BasicEdit.vue +170 -172
- package/src/stories/Templates/PersonManagement/PersonManagement.stories.js +156 -103
- package/src/stories/Templates/PersonManagement/PersonManagement.test.js +329 -0
- package/src/stories/Templates/PersonManagement/PersonManagement.vue +329 -213
- package/src/stories/Templates/PersonManagement/PersonManagementDraft.js +42 -0
- package/src/stories/Templates/TournamentManagement/TournamentManagement.stories.js +84 -83
- package/src/stories/Templates/TournamentManagement/TournamentManagement.test.js +89 -0
- package/src/stories/Templates/TournamentManagement/TournamentManagement.vue +363 -360
- package/src/stories/Templates/TournamentManagement/TournamentPageOne/TournamentPageOne.stories.js +116 -113
- package/src/stories/Templates/TournamentManagement/TournamentPageOne/TournamentPageOne.vue +292 -280
- package/src/stories/Util/Validations/PersonManagementValidations.js +45 -29
- package/src/stories/Util/Validations/PriceValidation.js +6 -0
- package/src/stories/Util/Validations/TournamentFieldsValidations.js +4 -0
package/src/stories/Organisms/Wizards/EditEventWizard/PoolConfiguration/PoolConfiguration.vue
CHANGED
|
@@ -1,215 +1,216 @@
|
|
|
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="'POOL CONFIGURATION'"
|
|
11
|
-
:weight="'normal'"
|
|
12
|
-
data-testid="text-add-tournament"
|
|
13
|
-
/>
|
|
14
|
-
</div>
|
|
15
|
-
<div class="w-full flex flex-col mb-3 ml-1 grow">
|
|
16
|
-
<BaseText
|
|
17
|
-
:color="'quinary'"
|
|
18
|
-
:size="'sm'"
|
|
19
|
-
:text="'Configure the pool stage settings for your event. These options determine the elements displayed on the director\'s screen and influence how fencers advance to the Direct Elimination (DE) stage. You can choose to use a Timer, Pass Counter, or both.'"
|
|
20
|
-
:weight="'normal'"
|
|
21
|
-
data-testid="text-registration"
|
|
22
|
-
/>
|
|
23
|
-
</div>
|
|
24
|
-
|
|
25
|
-
<div class="grow">
|
|
26
|
-
<div class="mb-4 mt-8">
|
|
27
|
-
<BaseText :color="'quaternary'" :size="'sm'" :text="'POOL SEEDING'" class="border-b mb-5" />
|
|
28
|
-
</div>
|
|
29
|
-
<div class="mb-4">
|
|
30
|
-
<BaseText
|
|
31
|
-
:color="'quinary'"
|
|
32
|
-
:invalid="validation.StartDate"
|
|
33
|
-
:size="'sm'"
|
|
34
|
-
:text="'Seed Pools Using Which Method?'"
|
|
35
|
-
:weight="'normal'"
|
|
36
|
-
class="mb-1"
|
|
37
|
-
data-testid="text-start-date"
|
|
38
|
-
/>
|
|
39
|
-
<DropDownMenu
|
|
40
|
-
:label="localEventConfig.seedWith || 'Select Method'"
|
|
41
|
-
:items="seedWithOptions"
|
|
42
|
-
:selected-item="localEventConfig.seedWith"
|
|
43
|
-
:alignEnd="false"
|
|
44
|
-
:width="'w-full'"
|
|
45
|
-
@update:selectedItem="handleSeedWithChange"
|
|
46
|
-
/>
|
|
47
|
-
</div>
|
|
48
|
-
</div>
|
|
49
|
-
|
|
50
|
-
<div class="grow">
|
|
51
|
-
<div class="mb-4 mt-8">
|
|
52
|
-
<BaseText :color="'quaternary'" :size="'sm'" :text="'POOL CONFIGURATION'" class="border-b mt-5" />
|
|
53
|
-
<BaseText
|
|
54
|
-
:color="'quaternary'"
|
|
55
|
-
:size="'sm'"
|
|
56
|
-
:text="'Timer duration is in seconds.'"
|
|
57
|
-
:weight="'normal'"
|
|
58
|
-
class="mt-1"
|
|
59
|
-
/>
|
|
60
|
-
</div>
|
|
61
|
-
<div class="mb-2 flex">
|
|
62
|
-
<div class="mt-1 h-10 w-52">
|
|
63
|
-
<Toggle
|
|
64
|
-
:checked="localEventConfig.poolTimer"
|
|
65
|
-
label="Using a Timer"
|
|
66
|
-
:labelLeft="false"
|
|
67
|
-
@update:checked="handlePoolTimerToggle"
|
|
68
|
-
/>
|
|
69
|
-
</div>
|
|
70
|
-
<TitledInput
|
|
71
|
-
v-if="localEventConfig.poolTimer"
|
|
72
|
-
:inputValue="localEventConfig.poolTime"
|
|
73
|
-
:invalid="validation.poolTime"
|
|
74
|
-
inputType="number"
|
|
75
|
-
placeholder="Enter Time in Seconds"
|
|
76
|
-
title=""
|
|
77
|
-
@update:value="handlePoolTimeChange"
|
|
78
|
-
/>
|
|
79
|
-
</div>
|
|
80
|
-
<div class="mb-2 flex">
|
|
81
|
-
<div class="mt-1 h-10 w-52">
|
|
82
|
-
<Toggle
|
|
83
|
-
:checked="localEventConfig.boutCounter"
|
|
84
|
-
label="Using Pass Counter"
|
|
85
|
-
:labelLeft="false"
|
|
86
|
-
inputType="number"
|
|
87
|
-
@update:checked="handleBoutCounterToggle"
|
|
88
|
-
/>
|
|
89
|
-
</div>
|
|
90
|
-
<TitledInput
|
|
91
|
-
v-if="localEventConfig.boutCounter"
|
|
92
|
-
:inputValue="localEventConfig.boutCount"
|
|
93
|
-
:invalid="validation.boutCount"
|
|
94
|
-
inputType="number"
|
|
95
|
-
placeholder="Enter Number of Passes"
|
|
96
|
-
title=""
|
|
97
|
-
@update:value="handleBoutCountChange"
|
|
98
|
-
/>
|
|
99
|
-
</div>
|
|
100
|
-
<div class="mb-2 flex">
|
|
101
|
-
<div class="mt-1 h-10 w-52">
|
|
102
|
-
<Toggle
|
|
103
|
-
:checked="localEventConfig.poolMax"
|
|
104
|
-
label="Max Points"
|
|
105
|
-
:labelLeft="false"
|
|
106
|
-
@update:checked="handlePoolMaxToggle"
|
|
107
|
-
/>
|
|
108
|
-
</div>
|
|
109
|
-
<TitledInput
|
|
110
|
-
v-if="localEventConfig.poolMax"
|
|
111
|
-
:inputValue="localEventConfig.poolMaxPoints"
|
|
112
|
-
:invalid="validation.poolMaxPoints"
|
|
113
|
-
inputType="number"
|
|
114
|
-
placeholder="Enter Pool Max Points"
|
|
115
|
-
title=""
|
|
116
|
-
@update:value="handlePoolMaxPointsChange"
|
|
117
|
-
/>
|
|
118
|
-
</div>
|
|
119
|
-
</div>
|
|
120
|
-
|
|
121
|
-
<div class="flex flex-row justify-center h-12 mt-10">
|
|
122
|
-
<BaseButton class="w-1/2 ml-1" color="neutral" label="Back" size="sm" type="primary" @buttonClick="handleBack" />
|
|
123
|
-
<BaseButton
|
|
124
|
-
class="w-1/2 mr-1 transition-all duration-300 ease-in-out h-12"
|
|
125
|
-
color="neutral"
|
|
126
|
-
label="
|
|
127
|
-
selected="selected"
|
|
128
|
-
size="sm"
|
|
129
|
-
type="primary"
|
|
130
|
-
@buttonClick="handleNext"
|
|
131
|
-
/>
|
|
132
|
-
</div>
|
|
133
|
-
</div>
|
|
134
|
-
</template>
|
|
135
|
-
|
|
136
|
-
<script>
|
|
137
|
-
import TitledInput from '../../../../Molecules/CombinationInputs/TitledInput/TitledInput.vue';
|
|
138
|
-
import BaseText from '../../../../Atoms/Text/BaseText.vue';
|
|
139
|
-
import DropDownMenu from '../../../ComplexInputs/DropDown/DropDownMenu.vue';
|
|
140
|
-
import Toggle from '../../../../Molecules/Inputs/Toggle/Toggle.vue';
|
|
141
|
-
import StepIndicator from '../../../../Molecules/StepIndicator/BaseStepIndicator/StepIndicator.vue';
|
|
142
|
-
import BaseButton from '../../../../Molecules/Buttons/BaseButton/BaseButton.vue';
|
|
143
|
-
|
|
144
|
-
export default {
|
|
145
|
-
name: 'PoolConfiguration',
|
|
146
|
-
emits: ['update', 'update:back', 'update:next'],
|
|
147
|
-
components: { BaseButton, StepIndicator, BaseText, DropDownMenu, TitledInput, Toggle },
|
|
148
|
-
props: {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
this
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
this
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
this
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
this
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
this
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
this
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
this
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
}
|
|
215
|
-
|
|
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="'POOL CONFIGURATION'"
|
|
11
|
+
:weight="'normal'"
|
|
12
|
+
data-testid="text-add-tournament"
|
|
13
|
+
/>
|
|
14
|
+
</div>
|
|
15
|
+
<div class="w-full flex flex-col mb-3 ml-1 grow">
|
|
16
|
+
<BaseText
|
|
17
|
+
:color="'quinary'"
|
|
18
|
+
:size="'sm'"
|
|
19
|
+
:text="'Configure the pool stage settings for your event. These options determine the elements displayed on the director\'s screen and influence how fencers advance to the Direct Elimination (DE) stage. You can choose to use a Timer, Pass Counter, or both.'"
|
|
20
|
+
:weight="'normal'"
|
|
21
|
+
data-testid="text-registration"
|
|
22
|
+
/>
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
<div class="grow">
|
|
26
|
+
<div class="mb-4 mt-8">
|
|
27
|
+
<BaseText :color="'quaternary'" :size="'sm'" :text="'POOL SEEDING'" class="border-b mb-5" />
|
|
28
|
+
</div>
|
|
29
|
+
<div class="mb-4">
|
|
30
|
+
<BaseText
|
|
31
|
+
:color="'quinary'"
|
|
32
|
+
:invalid="validation.StartDate"
|
|
33
|
+
:size="'sm'"
|
|
34
|
+
:text="'Seed Pools Using Which Method?'"
|
|
35
|
+
:weight="'normal'"
|
|
36
|
+
class="mb-1"
|
|
37
|
+
data-testid="text-start-date"
|
|
38
|
+
/>
|
|
39
|
+
<DropDownMenu
|
|
40
|
+
:label="localEventConfig.seedWith || 'Select Method'"
|
|
41
|
+
:items="seedWithOptions"
|
|
42
|
+
:selected-item="localEventConfig.seedWith"
|
|
43
|
+
:alignEnd="false"
|
|
44
|
+
:width="'w-full'"
|
|
45
|
+
@update:selectedItem="handleSeedWithChange"
|
|
46
|
+
/>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
|
|
50
|
+
<div class="grow">
|
|
51
|
+
<div class="mb-4 mt-8">
|
|
52
|
+
<BaseText :color="'quaternary'" :size="'sm'" :text="'POOL CONFIGURATION'" class="border-b mt-5" />
|
|
53
|
+
<BaseText
|
|
54
|
+
:color="'quaternary'"
|
|
55
|
+
:size="'sm'"
|
|
56
|
+
:text="'Timer duration is in seconds.'"
|
|
57
|
+
:weight="'normal'"
|
|
58
|
+
class="mt-1"
|
|
59
|
+
/>
|
|
60
|
+
</div>
|
|
61
|
+
<div class="mb-2 flex">
|
|
62
|
+
<div class="mt-1 h-10 w-52">
|
|
63
|
+
<Toggle
|
|
64
|
+
:checked="localEventConfig.poolTimer"
|
|
65
|
+
label="Using a Timer"
|
|
66
|
+
:labelLeft="false"
|
|
67
|
+
@update:checked="handlePoolTimerToggle"
|
|
68
|
+
/>
|
|
69
|
+
</div>
|
|
70
|
+
<TitledInput
|
|
71
|
+
v-if="localEventConfig.poolTimer"
|
|
72
|
+
:inputValue="localEventConfig.poolTime"
|
|
73
|
+
:invalid="validation.poolTime"
|
|
74
|
+
inputType="number"
|
|
75
|
+
placeholder="Enter Time in Seconds"
|
|
76
|
+
title=""
|
|
77
|
+
@update:value="handlePoolTimeChange"
|
|
78
|
+
/>
|
|
79
|
+
</div>
|
|
80
|
+
<div class="mb-2 flex">
|
|
81
|
+
<div class="mt-1 h-10 w-52">
|
|
82
|
+
<Toggle
|
|
83
|
+
:checked="localEventConfig.boutCounter"
|
|
84
|
+
label="Using Pass Counter"
|
|
85
|
+
:labelLeft="false"
|
|
86
|
+
inputType="number"
|
|
87
|
+
@update:checked="handleBoutCounterToggle"
|
|
88
|
+
/>
|
|
89
|
+
</div>
|
|
90
|
+
<TitledInput
|
|
91
|
+
v-if="localEventConfig.boutCounter"
|
|
92
|
+
:inputValue="localEventConfig.boutCount"
|
|
93
|
+
:invalid="validation.boutCount"
|
|
94
|
+
inputType="number"
|
|
95
|
+
placeholder="Enter Number of Passes"
|
|
96
|
+
title=""
|
|
97
|
+
@update:value="handleBoutCountChange"
|
|
98
|
+
/>
|
|
99
|
+
</div>
|
|
100
|
+
<div class="mb-2 flex">
|
|
101
|
+
<div class="mt-1 h-10 w-52">
|
|
102
|
+
<Toggle
|
|
103
|
+
:checked="localEventConfig.poolMax"
|
|
104
|
+
label="Max Points"
|
|
105
|
+
:labelLeft="false"
|
|
106
|
+
@update:checked="handlePoolMaxToggle"
|
|
107
|
+
/>
|
|
108
|
+
</div>
|
|
109
|
+
<TitledInput
|
|
110
|
+
v-if="localEventConfig.poolMax"
|
|
111
|
+
:inputValue="localEventConfig.poolMaxPoints"
|
|
112
|
+
:invalid="validation.poolMaxPoints"
|
|
113
|
+
inputType="number"
|
|
114
|
+
placeholder="Enter Pool Max Points"
|
|
115
|
+
title=""
|
|
116
|
+
@update:value="handlePoolMaxPointsChange"
|
|
117
|
+
/>
|
|
118
|
+
</div>
|
|
119
|
+
</div>
|
|
120
|
+
|
|
121
|
+
<div class="flex flex-row justify-center h-12 mt-10">
|
|
122
|
+
<BaseButton class="w-1/2 ml-1" color="neutral" label="Back" size="sm" type="primary" @buttonClick="handleBack" />
|
|
123
|
+
<BaseButton
|
|
124
|
+
class="w-1/2 mr-1 transition-all duration-300 ease-in-out h-12"
|
|
125
|
+
color="neutral"
|
|
126
|
+
:label="nextButtonLabel"
|
|
127
|
+
selected="selected"
|
|
128
|
+
size="sm"
|
|
129
|
+
type="primary"
|
|
130
|
+
@buttonClick="handleNext"
|
|
131
|
+
/>
|
|
132
|
+
</div>
|
|
133
|
+
</div>
|
|
134
|
+
</template>
|
|
135
|
+
|
|
136
|
+
<script>
|
|
137
|
+
import TitledInput from '../../../../Molecules/CombinationInputs/TitledInput/TitledInput.vue';
|
|
138
|
+
import BaseText from '../../../../Atoms/Text/BaseText.vue';
|
|
139
|
+
import DropDownMenu from '../../../ComplexInputs/DropDown/DropDownMenu.vue';
|
|
140
|
+
import Toggle from '../../../../Molecules/Inputs/Toggle/Toggle.vue';
|
|
141
|
+
import StepIndicator from '../../../../Molecules/StepIndicator/BaseStepIndicator/StepIndicator.vue';
|
|
142
|
+
import BaseButton from '../../../../Molecules/Buttons/BaseButton/BaseButton.vue';
|
|
143
|
+
|
|
144
|
+
export default {
|
|
145
|
+
name: 'PoolConfiguration',
|
|
146
|
+
emits: ['update', 'update:back', 'update:next'],
|
|
147
|
+
components: { BaseButton, StepIndicator, BaseText, DropDownMenu, TitledInput, Toggle },
|
|
148
|
+
props: {
|
|
149
|
+
nextButtonLabel: { type: String, default: 'Next' },
|
|
150
|
+
eventConfig: {
|
|
151
|
+
type: Object,
|
|
152
|
+
required: true
|
|
153
|
+
},
|
|
154
|
+
seedWithOptions: {
|
|
155
|
+
type: Array,
|
|
156
|
+
required: true
|
|
157
|
+
},
|
|
158
|
+
validation: Object,
|
|
159
|
+
currentStep: Number,
|
|
160
|
+
steps: Array
|
|
161
|
+
},
|
|
162
|
+
data() {
|
|
163
|
+
return {
|
|
164
|
+
localEventConfig: { ...this.eventConfig },
|
|
165
|
+
selectedItem: { text: 'M2 - MeyerSquared', link: 'M2' }
|
|
166
|
+
};
|
|
167
|
+
},
|
|
168
|
+
mounted() {
|
|
169
|
+
this.localEventConfig = { ...this.eventConfig };
|
|
170
|
+
},
|
|
171
|
+
watch: {
|
|
172
|
+
eventConfig: {
|
|
173
|
+
deep: true,
|
|
174
|
+
handler(newConfig) {
|
|
175
|
+
this.localEventConfig = { ...newConfig };
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
methods: {
|
|
180
|
+
handleSeedWithChange(value) {
|
|
181
|
+
this.localEventConfig.seedWith = value.text;
|
|
182
|
+
this.$emit('update', { seedWith: value.text });
|
|
183
|
+
},
|
|
184
|
+
handlePoolTimerToggle(value) {
|
|
185
|
+
this.localEventConfig.poolTimer = value;
|
|
186
|
+
this.$emit('update', { poolTimer: value });
|
|
187
|
+
},
|
|
188
|
+
handlePoolTimeChange(value) {
|
|
189
|
+
this.localEventConfig.poolTime = value;
|
|
190
|
+
this.$emit('update', { poolTime: value });
|
|
191
|
+
},
|
|
192
|
+
handleBoutCounterToggle(value) {
|
|
193
|
+
this.localEventConfig.boutCounter = value;
|
|
194
|
+
this.$emit('update', { boutCounter: value });
|
|
195
|
+
},
|
|
196
|
+
handleBoutCountChange(value) {
|
|
197
|
+
this.localEventConfig.boutCount = value;
|
|
198
|
+
this.$emit('update', { boutCount: value });
|
|
199
|
+
},
|
|
200
|
+
handlePoolMaxToggle(value) {
|
|
201
|
+
this.localEventConfig.poolMax = value;
|
|
202
|
+
this.$emit('update', { poolMax: value });
|
|
203
|
+
},
|
|
204
|
+
handlePoolMaxPointsChange(value) {
|
|
205
|
+
this.localEventConfig.poolMaxPoints = value;
|
|
206
|
+
this.$emit('update', { poolMaxPoints: value });
|
|
207
|
+
},
|
|
208
|
+
handleNext() {
|
|
209
|
+
this.$emit('update:next', this.localEventConfig);
|
|
210
|
+
},
|
|
211
|
+
handleBack() {
|
|
212
|
+
this.$emit('update:back');
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
};
|
|
216
|
+
</script>
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { afterEach, describe, expect, it } from 'vitest';
|
|
2
|
+
import { mount } from '@vue/test-utils';
|
|
3
|
+
import EditEventWizard from './EditEventWizard.vue';
|
|
4
|
+
import TitledInput from '../../../Molecules/CombinationInputs/TitledInput/TitledInput.vue';
|
|
5
|
+
|
|
6
|
+
const wrappers = [];
|
|
7
|
+
afterEach(() => wrappers.splice(0).forEach(wrapper => wrapper.unmount()));
|
|
8
|
+
|
|
9
|
+
function mountWizard(props = {}) {
|
|
10
|
+
const wrapper = mount(EditEventWizard, {
|
|
11
|
+
props: { event: { EventName: 'Test Event', EventPrice: 25.5 }, weapons: [], ...props },
|
|
12
|
+
global: { stubs: { DatePicker: true, DropDownMenu: true, StepIndicator: true } }
|
|
13
|
+
});
|
|
14
|
+
wrappers.push(wrapper);
|
|
15
|
+
return wrapper;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function priceField(wrapper) {
|
|
19
|
+
return wrapper.findAllComponents(TitledInput).find(field => field.props('title').startsWith('Event Price'));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function savedEvent(wrapper, editMode) {
|
|
23
|
+
if (editMode) return wrapper.emitted('save:step')[0][0].event;
|
|
24
|
+
return wrapper.emitted('update:submit')[0][0];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
describe('event price', () => {
|
|
28
|
+
it.each([false, true])('includes decimal prices in save payloads with editMode %s', async editMode => {
|
|
29
|
+
const event = { EventName: 'Test Event', EventPrice: 25.5 };
|
|
30
|
+
const wrapper = mountWizard({ event, editMode });
|
|
31
|
+
await wrapper.vm.$nextTick();
|
|
32
|
+
expect(priceField(wrapper).find('input').element.value).toBe('25.5');
|
|
33
|
+
await priceField(wrapper).find('input').setValue('30.');
|
|
34
|
+
expect(priceField(wrapper).find('input').element.value).toBe('30.');
|
|
35
|
+
await priceField(wrapper).find('input').setValue('30.75');
|
|
36
|
+
await wrapper
|
|
37
|
+
.findAll('button')
|
|
38
|
+
.find(button => button.text() === (editMode ? 'Save and Continue' : 'Next'))
|
|
39
|
+
.trigger('click');
|
|
40
|
+
if (!editMode) {
|
|
41
|
+
await wrapper.setProps({ step: 5 });
|
|
42
|
+
await wrapper
|
|
43
|
+
.findAll('button')
|
|
44
|
+
.find(button => button.text() === 'Submit')
|
|
45
|
+
.trigger('click');
|
|
46
|
+
}
|
|
47
|
+
const payload = savedEvent(wrapper, editMode);
|
|
48
|
+
expect(payload.EventPrice).toBe(30.75);
|
|
49
|
+
expect(payload.rules.some(rule => rule.RuleName === 'EventPrice')).toBe(false);
|
|
50
|
+
expect(event.EventPrice).toBe(25.5);
|
|
51
|
+
await wrapper.setProps({ event: { ...event, EventPrice: 0 }, step: 1 });
|
|
52
|
+
expect(priceField(wrapper).find('input').element.value).toBe('0');
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it.each([undefined, null, 0])('allows a free event with an initial price of %s', async value => {
|
|
56
|
+
const wrapper = mountWizard({ event: { EventName: 'Free Event', EventPrice: value } });
|
|
57
|
+
await wrapper.vm.$nextTick();
|
|
58
|
+
expect(priceField(wrapper).find('input').element.value).toBe(value == null ? '' : '0');
|
|
59
|
+
expect(priceField(wrapper).find('input').attributes('placeholder')).toBe('0.00');
|
|
60
|
+
await priceField(wrapper).find('input').setValue('');
|
|
61
|
+
wrapper.vm.handleSubmit();
|
|
62
|
+
expect(savedEvent(wrapper, false).EventPrice).toBe(0);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it.each(['-5', 'invalid', 'Infinity'])('blocks Next and save for invalid price %s', async value => {
|
|
66
|
+
const wrapper = mountWizard();
|
|
67
|
+
await wrapper.vm.$nextTick();
|
|
68
|
+
await priceField(wrapper).find('input').setValue(value);
|
|
69
|
+
wrapper.vm.handleUpdate();
|
|
70
|
+
wrapper.vm.handleSubmit();
|
|
71
|
+
await wrapper.vm.$nextTick();
|
|
72
|
+
expect(wrapper.vm.currentStep).toBe(1);
|
|
73
|
+
expect(wrapper.emitted('update:submit')).toBeUndefined();
|
|
74
|
+
expect(priceField(wrapper).props('invalid')).toBe(true);
|
|
75
|
+
await priceField(wrapper).find('input').setValue('0');
|
|
76
|
+
wrapper.vm.handleSubmit();
|
|
77
|
+
expect(savedEvent(wrapper, false).EventPrice).toBe(0);
|
|
78
|
+
});
|
|
79
|
+
});
|
|
@@ -1,52 +1,93 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
1
|
+
import { ref } from 'vue';
|
|
2
|
+
import editConfig from './EditEventInfo.vue';
|
|
3
|
+
import singleEventMock from '../../../../mocks/singleEventMock.js';
|
|
4
|
+
import eventRules from '../../../../mocks/eventRules.js';
|
|
5
|
+
import getAllWeapons from '../../../../mocks/getAllWeapons.js';
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: 'Templates/EventManagement/EditEventInfo',
|
|
9
|
+
component: editConfig,
|
|
10
|
+
tags: ['autodocs'],
|
|
11
|
+
args: {
|
|
12
|
+
event: singleEventMock,
|
|
13
|
+
weapons: getAllWeapons,
|
|
14
|
+
rules: eventRules,
|
|
15
|
+
userLevel: 'admin'
|
|
16
|
+
},
|
|
17
|
+
argTypes: {
|
|
18
|
+
editMode: { control: 'boolean' },
|
|
19
|
+
step: { control: { type: 'number', min: 1, max: 5 } },
|
|
20
|
+
saving: { control: 'boolean' },
|
|
21
|
+
saveError: { control: 'text' },
|
|
22
|
+
saveNotice: { control: 'text' },
|
|
23
|
+
event: { control: 'object' },
|
|
24
|
+
weapons: { control: 'object' },
|
|
25
|
+
rules: { control: 'object' },
|
|
26
|
+
userLevel: { control: 'text' }
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const Default = {
|
|
31
|
+
args: {
|
|
32
|
+
event: singleEventMock,
|
|
33
|
+
weapons: getAllWeapons,
|
|
34
|
+
rules: eventRules,
|
|
35
|
+
userLevel: 'admin'
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const NewEvent = {
|
|
40
|
+
args: {
|
|
41
|
+
event: {
|
|
42
|
+
Absent: 0,
|
|
43
|
+
Date: new Date().toISOString().split('T')[0],
|
|
44
|
+
EventName: '',
|
|
45
|
+
Flights: 1,
|
|
46
|
+
NumberOfPools: 2,
|
|
47
|
+
NumberOfRings: 2,
|
|
48
|
+
PoolSize: 0,
|
|
49
|
+
Present: 0,
|
|
50
|
+
StartTime: '12:00:00',
|
|
51
|
+
Status: 'planning',
|
|
52
|
+
TournamentId: 10
|
|
53
|
+
},
|
|
54
|
+
weapons: getAllWeapons,
|
|
55
|
+
rules: [],
|
|
56
|
+
userLevel: 'admin'
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export const EditWithStepSaves = {
|
|
61
|
+
args: { ...Default.args, editMode: true, step: 1 },
|
|
62
|
+
render: args => ({
|
|
63
|
+
components: { Editor: editConfig },
|
|
64
|
+
setup() {
|
|
65
|
+
const event = ref(JSON.parse(JSON.stringify(args.event)));
|
|
66
|
+
const step = ref(args.step);
|
|
67
|
+
const saving = ref(false);
|
|
68
|
+
const notice = ref('');
|
|
69
|
+
const saveStep = async request => {
|
|
70
|
+
saving.value = true;
|
|
71
|
+
await new Promise(resolve => setTimeout(resolve, 500));
|
|
72
|
+
event.value = request.event;
|
|
73
|
+
step.value = Math.min(request.step + 1, 5);
|
|
74
|
+
notice.value = 'Changes saved.';
|
|
75
|
+
saving.value = false;
|
|
76
|
+
};
|
|
77
|
+
const clearNotice = dirty => {
|
|
78
|
+
if (dirty) notice.value = '';
|
|
79
|
+
};
|
|
80
|
+
return { args, event, step, saving, notice, saveStep, clearNotice };
|
|
81
|
+
},
|
|
82
|
+
template:
|
|
83
|
+
'<Editor v-bind="args" :rules="args.rules" :weapons="args.weapons" :event="event" :step="step" :saving="saving" :saveNotice="notice" @save:step="saveStep" @navigate:step="step = $event" @update:dirty="clearNotice" />'
|
|
84
|
+
})
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export const SavingStep = {
|
|
88
|
+
args: { ...Default.args, editMode: true, step: 2, saving: true }
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export const StepSaveFailed = {
|
|
92
|
+
args: { ...Default.args, editMode: true, step: 2, saveError: 'Changes could not be saved. Please try again.' }
|
|
93
|
+
};
|