@dcrackel/hematournamentui 1.0.709 → 1.0.711
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 +16 -0
- package/dist/HemaTournamentUI-lib.es.js +4343 -4086
- package/dist/HemaTournamentUI-lib.umd.js +27 -27
- package/dist/hematournamentui-tailwind.css +3 -0
- package/package.json +1 -1
- 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/TournamentManagement/TournamentManagement.stories.js +84 -83
- package/src/stories/Templates/TournamentManagement/TournamentManagement.test.js +114 -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 +307 -280
- package/src/stories/Util/Validations/PriceValidation.js +6 -0
- package/src/stories/Util/Validations/TournamentFieldsValidations.js +4 -0
|
@@ -1,280 +1,307 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<section class="w-full">
|
|
3
|
-
<div v-if="isNewTournament" class="w-full flex flex-row justify-center">
|
|
4
|
-
<BaseText
|
|
5
|
-
:color="'quaternary'"
|
|
6
|
-
:size="'sm'"
|
|
7
|
-
:text="'Step 1 out of 2'"
|
|
8
|
-
:weight="'normal'"
|
|
9
|
-
data-testid="text-step"
|
|
10
|
-
/>
|
|
11
|
-
</div>
|
|
12
|
-
<div class="w-full flex flex-row justify-center my-4">
|
|
13
|
-
<BaseText
|
|
14
|
-
v-if="isNewTournament"
|
|
15
|
-
:color="'primaryHighlight'"
|
|
16
|
-
:size="'2xl'"
|
|
17
|
-
:text="'Add New Tournament'"
|
|
18
|
-
:weight="'normal'"
|
|
19
|
-
data-testid="text-add-tournament"
|
|
20
|
-
/>
|
|
21
|
-
<BaseText
|
|
22
|
-
v-if="!isNewTournament"
|
|
23
|
-
:color="'primaryHighlight'"
|
|
24
|
-
:size="'2xl'"
|
|
25
|
-
:text="'Basic Tournament Information'"
|
|
26
|
-
:weight="'normal'"
|
|
27
|
-
data-testid="text-add-tournament"
|
|
28
|
-
/>
|
|
29
|
-
</div>
|
|
30
|
-
<div class="w-full flex flex-row justify-center my-4">
|
|
31
|
-
<ImageCropper
|
|
32
|
-
:urlToImage="tournamentImage"
|
|
33
|
-
:uploadImageName="uploadImageName"
|
|
34
|
-
:uploadServer="uploadServer"
|
|
35
|
-
:imageServer="imageServer"
|
|
36
|
-
@update:url="handleNewImageUrl"
|
|
37
|
-
/>
|
|
38
|
-
</div>
|
|
39
|
-
|
|
40
|
-
<TitledInput
|
|
41
|
-
:inputValue="tournamentName"
|
|
42
|
-
:invalid="isFieldInvalid('Name')"
|
|
43
|
-
:title="getValidationLabel('Name', 'Tournament Name')"
|
|
44
|
-
placeholder="Enter Tournament Name"
|
|
45
|
-
@update:value="emitUpdate('Name', $event)"
|
|
46
|
-
class="mb-4"
|
|
47
|
-
/>
|
|
48
|
-
|
|
49
|
-
<
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
:
|
|
62
|
-
:
|
|
63
|
-
:
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
/>
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
:
|
|
85
|
-
:
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
:
|
|
94
|
-
:
|
|
95
|
-
:
|
|
96
|
-
@update:
|
|
97
|
-
/>
|
|
98
|
-
</div>
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
:
|
|
114
|
-
:
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
:invalid="isFieldInvalid('
|
|
123
|
-
:
|
|
124
|
-
:
|
|
125
|
-
:
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
:
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
:
|
|
141
|
-
:
|
|
142
|
-
:
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
:
|
|
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
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
const
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<section class="w-full">
|
|
3
|
+
<div v-if="isNewTournament" class="w-full flex flex-row justify-center">
|
|
4
|
+
<BaseText
|
|
5
|
+
:color="'quaternary'"
|
|
6
|
+
:size="'sm'"
|
|
7
|
+
:text="'Step 1 out of 2'"
|
|
8
|
+
:weight="'normal'"
|
|
9
|
+
data-testid="text-step"
|
|
10
|
+
/>
|
|
11
|
+
</div>
|
|
12
|
+
<div class="w-full flex flex-row justify-center my-4">
|
|
13
|
+
<BaseText
|
|
14
|
+
v-if="isNewTournament"
|
|
15
|
+
:color="'primaryHighlight'"
|
|
16
|
+
:size="'2xl'"
|
|
17
|
+
:text="'Add New Tournament'"
|
|
18
|
+
:weight="'normal'"
|
|
19
|
+
data-testid="text-add-tournament"
|
|
20
|
+
/>
|
|
21
|
+
<BaseText
|
|
22
|
+
v-if="!isNewTournament"
|
|
23
|
+
:color="'primaryHighlight'"
|
|
24
|
+
:size="'2xl'"
|
|
25
|
+
:text="'Basic Tournament Information'"
|
|
26
|
+
:weight="'normal'"
|
|
27
|
+
data-testid="text-add-tournament"
|
|
28
|
+
/>
|
|
29
|
+
</div>
|
|
30
|
+
<div class="w-full flex flex-row justify-center my-4">
|
|
31
|
+
<ImageCropper
|
|
32
|
+
:urlToImage="tournamentImage"
|
|
33
|
+
:uploadImageName="uploadImageName"
|
|
34
|
+
:uploadServer="uploadServer"
|
|
35
|
+
:imageServer="imageServer"
|
|
36
|
+
@update:url="handleNewImageUrl"
|
|
37
|
+
/>
|
|
38
|
+
</div>
|
|
39
|
+
|
|
40
|
+
<TitledInput
|
|
41
|
+
:inputValue="tournamentName"
|
|
42
|
+
:invalid="isFieldInvalid('Name')"
|
|
43
|
+
:title="getValidationLabel('Name', 'Tournament Name')"
|
|
44
|
+
placeholder="Enter Tournament Name"
|
|
45
|
+
@update:value="emitUpdate('Name', $event)"
|
|
46
|
+
class="mb-4"
|
|
47
|
+
/>
|
|
48
|
+
|
|
49
|
+
<TitledInput
|
|
50
|
+
:inputValue="basePrice"
|
|
51
|
+
:invalid="isFieldInvalid('BasePrice')"
|
|
52
|
+
:title="getValidationLabel('BasePrice', 'Base Price')"
|
|
53
|
+
placeholder="0.00"
|
|
54
|
+
@update:value="handleBasePriceUpdate"
|
|
55
|
+
@focusout="handleBasePriceBlur"
|
|
56
|
+
class="mb-4"
|
|
57
|
+
/>
|
|
58
|
+
|
|
59
|
+
<div class="flex flex-col mb-4">
|
|
60
|
+
<BaseText
|
|
61
|
+
:color="'primaryHighlight'"
|
|
62
|
+
:invalid="isFieldInvalid('Address')"
|
|
63
|
+
:text="getValidationLabel('Address', 'Location')"
|
|
64
|
+
:size="'sm'"
|
|
65
|
+
:weight="'normal'"
|
|
66
|
+
class="mb-1"
|
|
67
|
+
data-testid="text-address"
|
|
68
|
+
/>
|
|
69
|
+
<FindLocation
|
|
70
|
+
:placeholder="addressName"
|
|
71
|
+
:addBorder="true"
|
|
72
|
+
:locations="locations"
|
|
73
|
+
:invalid="isFieldInvalid('Address')"
|
|
74
|
+
addNewText="Add New"
|
|
75
|
+
@update:location="handleAddressUpdate"
|
|
76
|
+
@submit:location="handleAddressUpdate"
|
|
77
|
+
@submit:addNewAddress="handleAddNewAddress"
|
|
78
|
+
/>
|
|
79
|
+
</div>
|
|
80
|
+
|
|
81
|
+
<div class="flex flex-row mb-4">
|
|
82
|
+
<div class="w-3/4 mr-1">
|
|
83
|
+
<BaseText
|
|
84
|
+
:color="'primaryHighlight'"
|
|
85
|
+
:invalid="isFieldInvalid('StartDate')"
|
|
86
|
+
:size="'sm'"
|
|
87
|
+
:text="getValidationLabel('StartDate', 'Start Date')"
|
|
88
|
+
:weight="'normal'"
|
|
89
|
+
class="mb-1"
|
|
90
|
+
data-testid="text-start-date"
|
|
91
|
+
/>
|
|
92
|
+
<DatePicker
|
|
93
|
+
:invalid="isFieldInvalid('StartDate')"
|
|
94
|
+
:setDate="startDate"
|
|
95
|
+
:userLevel="userLevel"
|
|
96
|
+
@update:selectedDate="emitUpdate('StartDate', $event)"
|
|
97
|
+
/>
|
|
98
|
+
</div>
|
|
99
|
+
<div>
|
|
100
|
+
<TitledInput
|
|
101
|
+
:inputValue="totalDays"
|
|
102
|
+
:invalid="isFieldInvalid('TotalDays')"
|
|
103
|
+
:placeholder="'Number of Days'"
|
|
104
|
+
:inputType="'number'"
|
|
105
|
+
:title="getValidationLabel('TotalDays', 'Number of Days')"
|
|
106
|
+
@update:value="emitUpdate('TotalDays', $event)"
|
|
107
|
+
/>
|
|
108
|
+
</div>
|
|
109
|
+
</div>
|
|
110
|
+
|
|
111
|
+
<div class="w-full mr-1 mb-4">
|
|
112
|
+
<BaseText
|
|
113
|
+
:color="'primaryHighlight'"
|
|
114
|
+
:invalid="isFieldInvalid('RegistrationCutOff')"
|
|
115
|
+
:size="'sm'"
|
|
116
|
+
:text="getValidationLabel('RegistrationCutOff', 'Registration Cut Off')"
|
|
117
|
+
:weight="'normal'"
|
|
118
|
+
class="mb-1"
|
|
119
|
+
data-testid="text-start-date"
|
|
120
|
+
/>
|
|
121
|
+
<DatePicker
|
|
122
|
+
:invalid="isFieldInvalid('RegistrationCutOff')"
|
|
123
|
+
:setDate="registrationCutOff"
|
|
124
|
+
:userLevel="userLevel"
|
|
125
|
+
@update:selectedDate="emitUpdate('RegistrationCutOff', $event)"
|
|
126
|
+
/>
|
|
127
|
+
</div>
|
|
128
|
+
|
|
129
|
+
<div class="flex flex-col mb-4">
|
|
130
|
+
<BaseText
|
|
131
|
+
:color="'primaryHighlight'"
|
|
132
|
+
:invalid="isFieldInvalid('Description')"
|
|
133
|
+
:size="'sm'"
|
|
134
|
+
:text="getValidationLabel('Description', 'Description')"
|
|
135
|
+
:weight="'normal'"
|
|
136
|
+
class="mb-1"
|
|
137
|
+
data-testid="text-description"
|
|
138
|
+
/>
|
|
139
|
+
<TextBoxEditor
|
|
140
|
+
:invalid="isFieldInvalid('Description')"
|
|
141
|
+
:initialContent="description"
|
|
142
|
+
@update:editorContent="emitUpdate('Description', $event)"
|
|
143
|
+
/>
|
|
144
|
+
</div>
|
|
145
|
+
|
|
146
|
+
<div class="flex flex-col pb-4 mr-4">
|
|
147
|
+
<BaseText
|
|
148
|
+
:color="'primaryHighlight'"
|
|
149
|
+
:invalid="false"
|
|
150
|
+
:size="'sm'"
|
|
151
|
+
:text="'Primary Contact'"
|
|
152
|
+
:weight="'normal'"
|
|
153
|
+
class="mb-1"
|
|
154
|
+
data-testid="text-primary-contact"
|
|
155
|
+
/>
|
|
156
|
+
<FindPerson
|
|
157
|
+
:addBorder="true"
|
|
158
|
+
:persons="persons"
|
|
159
|
+
:defaultValue="getDefaultPerson"
|
|
160
|
+
addNewText="Add New Person"
|
|
161
|
+
@add-new-person="handleAddNewPerson"
|
|
162
|
+
@person-selected="handlePrimaryContactUpdate"
|
|
163
|
+
/>
|
|
164
|
+
</div>
|
|
165
|
+
</section>
|
|
166
|
+
</template>
|
|
167
|
+
|
|
168
|
+
<script>
|
|
169
|
+
import TitledInput from '../../../Molecules/CombinationInputs/TitledInput/TitledInput.vue';
|
|
170
|
+
import FindLocation from '../../../Organisms/ComplexInputs/FindLocation/FindLocation.vue';
|
|
171
|
+
import DatePicker from '../../../Organisms/ComplexInputs/DatePicker/DatePicker.vue';
|
|
172
|
+
import BaseText from '../../../Atoms/Text/BaseText.vue';
|
|
173
|
+
import TextBoxEditor from '../../../Organisms/ComplexInputs/TextBoxEditor/TextBoxEditor.vue';
|
|
174
|
+
import ImageCropper from '../../../Organisms/ComplexInputs/ImageCropper/ImageCropper.vue';
|
|
175
|
+
import FindPerson from '../../../Organisms/ComplexInputs/FindPerson/FindPerson.vue';
|
|
176
|
+
|
|
177
|
+
export default {
|
|
178
|
+
name: 'TournamentPageOne',
|
|
179
|
+
emits: ['update:tournament', 'update:image', 'update:address', 'add:newAddress', 'add:newPerson'],
|
|
180
|
+
props: {
|
|
181
|
+
tournament: {
|
|
182
|
+
type: Object,
|
|
183
|
+
required: true
|
|
184
|
+
},
|
|
185
|
+
locations: {
|
|
186
|
+
type: Array,
|
|
187
|
+
required: true
|
|
188
|
+
},
|
|
189
|
+
persons: {
|
|
190
|
+
type: Array,
|
|
191
|
+
required: true
|
|
192
|
+
},
|
|
193
|
+
validation: {
|
|
194
|
+
type: Object,
|
|
195
|
+
required: true
|
|
196
|
+
},
|
|
197
|
+
uploadImageName: {
|
|
198
|
+
type: String,
|
|
199
|
+
default: 't-default-image'
|
|
200
|
+
},
|
|
201
|
+
uploadServer: {
|
|
202
|
+
type: String,
|
|
203
|
+
default: ''
|
|
204
|
+
},
|
|
205
|
+
imageServer: {
|
|
206
|
+
type: String,
|
|
207
|
+
default: ''
|
|
208
|
+
},
|
|
209
|
+
isNewTournament: {
|
|
210
|
+
type: Boolean,
|
|
211
|
+
default: true
|
|
212
|
+
},
|
|
213
|
+
userLevel: {
|
|
214
|
+
type: String,
|
|
215
|
+
default: 'Club'
|
|
216
|
+
}
|
|
217
|
+
},
|
|
218
|
+
components: {
|
|
219
|
+
FindPerson,
|
|
220
|
+
ImageCropper,
|
|
221
|
+
BaseText,
|
|
222
|
+
DatePicker,
|
|
223
|
+
FindLocation,
|
|
224
|
+
TitledInput,
|
|
225
|
+
TextBoxEditor
|
|
226
|
+
},
|
|
227
|
+
data() {
|
|
228
|
+
return { basePriceDraft: null };
|
|
229
|
+
},
|
|
230
|
+
computed: {
|
|
231
|
+
tournamentImage() {
|
|
232
|
+
if (this.tournament.Images && this.tournament.Images.length > 0) {
|
|
233
|
+
return this.tournament.Images[0].URL;
|
|
234
|
+
}
|
|
235
|
+
return '';
|
|
236
|
+
},
|
|
237
|
+
tournamentName() {
|
|
238
|
+
return this.tournament?.Name || '';
|
|
239
|
+
},
|
|
240
|
+
basePrice() {
|
|
241
|
+
const price = this.tournament?.BasePrice ?? '';
|
|
242
|
+
if (price === '' || price === this.basePriceDraft) return price;
|
|
243
|
+
const amount = Number(price);
|
|
244
|
+
if (!Number.isFinite(amount)) return price;
|
|
245
|
+
return amount.toFixed(2);
|
|
246
|
+
},
|
|
247
|
+
addressName() {
|
|
248
|
+
return this.tournament?.Address?.Name || '';
|
|
249
|
+
},
|
|
250
|
+
startDate() {
|
|
251
|
+
return this.tournament?.StartDate || new Date();
|
|
252
|
+
},
|
|
253
|
+
totalDays() {
|
|
254
|
+
return this.tournament?.TotalDays || 1;
|
|
255
|
+
},
|
|
256
|
+
registrationCutOff() {
|
|
257
|
+
return this.tournament?.RegistrationCutOff || new Date();
|
|
258
|
+
},
|
|
259
|
+
description() {
|
|
260
|
+
return this.tournament?.Description || '';
|
|
261
|
+
},
|
|
262
|
+
getDefaultPerson: function () {
|
|
263
|
+
const person = this.persons.find(p => p.PersonId === this.tournament?.PrimaryContactId);
|
|
264
|
+
return person ? person.DisplayName : '';
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
methods: {
|
|
268
|
+
handleBasePriceUpdate(value) {
|
|
269
|
+
this.basePriceDraft = value;
|
|
270
|
+
this.emitUpdate('BasePrice', value);
|
|
271
|
+
},
|
|
272
|
+
handleBasePriceBlur() {
|
|
273
|
+
this.basePriceDraft = null;
|
|
274
|
+
},
|
|
275
|
+
handleNewImageUrl(url) {
|
|
276
|
+
this.$emit('update:image', { ImageLink: url });
|
|
277
|
+
},
|
|
278
|
+
handleAddNewAddress(newAddress) {
|
|
279
|
+
this.$emit('add:newAddress', newAddress);
|
|
280
|
+
},
|
|
281
|
+
handleAddressUpdate(updatedAddress) {
|
|
282
|
+
this.$emit('update:address', updatedAddress);
|
|
283
|
+
},
|
|
284
|
+
handleAddNewPerson(personName) {
|
|
285
|
+
this.$emit('add:newPerson', personName);
|
|
286
|
+
},
|
|
287
|
+
handlePrimaryContactUpdate(person) {
|
|
288
|
+
if (!person) return;
|
|
289
|
+
this.$emit('update:tournament', { PrimaryContactId: person.PersonId });
|
|
290
|
+
},
|
|
291
|
+
emitUpdate(field, value) {
|
|
292
|
+
this.$emit('update:tournament', { [field]: value });
|
|
293
|
+
},
|
|
294
|
+
getFieldValidation(field) {
|
|
295
|
+
return this.validation?.[field] || { invalid: false, message: '' };
|
|
296
|
+
},
|
|
297
|
+
isFieldInvalid(field) {
|
|
298
|
+
return this.getFieldValidation(field).invalid;
|
|
299
|
+
},
|
|
300
|
+
getValidationLabel(field, label) {
|
|
301
|
+
const fieldValidation = this.getFieldValidation(field);
|
|
302
|
+
if (!fieldValidation.invalid) return label;
|
|
303
|
+
return `${label} - ${fieldValidation.message}`;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
};
|
|
307
|
+
</script>
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
import { validatePrice } from './PriceValidation.js';
|
|
2
|
+
|
|
1
3
|
export function validateField(field, value) {
|
|
4
|
+
if (field === 'BasePrice') return validatePrice(value);
|
|
5
|
+
|
|
2
6
|
const rules = {
|
|
3
7
|
Name: [
|
|
4
8
|
{ check: v => !v || v.trim().length === 0, message: 'Must have a name.' },
|