@dcrackel/hematournamentui 1.0.712 → 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.
- package/.prettierignore +7 -7
- package/.storybook/main.js +3 -1
- package/README.md +30 -0
- package/package.json +96 -96
- package/prettier.config.js +16 -16
- package/src/main.js +1 -1
- package/src/mocks/getDEBouts-TableOf128.js +37 -37
- package/src/mocks/getDEBouts-TableOf64.js +35 -35
- package/src/stories/Atoms/Input/BaseInput.test.js +97 -97
- package/src/stories/Atoms/Input/BaseInput.vue +149 -149
- package/src/stories/Molecules/Indicators/MissingHemaRatingsId/MissingHemaRatingsId.stories.js +23 -23
- package/src/stories/Molecules/Indicators/MissingHemaRatingsId/MissingHemaRatingsId.vue +35 -35
- package/src/stories/Molecules/Indicators/RegistrationStatus/RegistrationStatus.vue +30 -30
- package/src/stories/Molecules/Menus/HoverActions/HoverActions.test.js +138 -0
- package/src/stories/Molecules/Menus/HoverActions/HoverActions.vue +212 -0
- package/src/stories/Molecules/Modals/DirectorModal/DirectorModal.stories.js +6 -0
- package/src/stories/Molecules/Modals/DirectorModal/DirectorModal.test.js +18 -18
- package/src/stories/Molecules/Modals/DirectorModal/DirectorModal.vue +1 -1
- package/src/stories/Organisms/Cards/BoutCard/BoutCard.vue +5 -1
- package/src/stories/Organisms/Cards/BoutCard/Variants/BoutCardActive/BoutCardActive.vue +19 -10
- package/src/stories/Organisms/Cards/BoutCard/Variants/BoutCardInactive/BoutCardInactive.vue +11 -7
- package/src/stories/Organisms/Cards/BracketDirectorAssignmentCard/BracketDirectorAssignmentCard.stories.js +33 -33
- package/src/stories/Organisms/Cards/BracketDirectorAssignmentCard/BracketDirectorAssignmentCard.test.js +45 -45
- package/src/stories/Organisms/Cards/BracketDirectorAssignmentCard/BracketDirectorAssignmentCard.vue +103 -103
- package/src/stories/Organisms/Cards/Director/DirectorCard.test.js +82 -0
- package/src/stories/Organisms/Cards/Director/DirectorCard.vue +32 -51
- package/src/stories/Organisms/Cards/EditBout/EditBout.test.js +51 -51
- package/src/stories/Organisms/Cards/EventCard/EventCard.test.js +106 -106
- package/src/stories/Organisms/Cards/FencerCard/FencerCard.vue +298 -298
- package/src/stories/Organisms/Cards/TableauBoutCard/TableauBoutCard.stories.js +77 -60
- package/src/stories/Organisms/Cards/TableauBoutCard/TableauBoutCard.test.js +144 -143
- package/src/stories/Organisms/Cards/TableauBoutCard/TableauBoutCard.vue +289 -256
- package/src/stories/Organisms/Cards/TableauFencerCard/TableauFencerCard.stories.js +69 -69
- package/src/stories/Organisms/Cards/TableauFencerCard/TableauFencerCard.vue +80 -80
- package/src/stories/Organisms/Cards/WaitlistFencerCard/WaitlistFencerCard.vue +153 -153
- package/src/stories/Organisms/ComplexInputs/DropDown/DropDownMenu.vue +4 -0
- package/src/stories/Organisms/ComplexInputs/ImageCropper/ImageCropper.stories.js +31 -31
- package/src/stories/Organisms/ComplexInputs/ImageCropper/ImageCropper.test.js +109 -109
- package/src/stories/Organisms/ComplexInputs/ImageCropper/ImageCropper.vue +192 -192
- package/src/stories/Organisms/Containers/Tableau/Tableau.stories.js +1 -0
- package/src/stories/Organisms/Containers/Tableau/Tableau.test.js +247 -204
- package/src/stories/Organisms/Containers/Tableau/Tableau.vue +89 -15
- package/src/stories/Organisms/Containers/Tableau/components/BracketDirectorAssignmentPanel.test.js +29 -29
- package/src/stories/Organisms/Containers/Tableau/components/BracketDirectorAssignmentPanel.vue +46 -46
- package/src/stories/Organisms/Containers/Tableau/components/TableauSvgOverlay.test.js +21 -21
- package/src/stories/Organisms/Containers/Tableau/components/TableauSvgOverlay.vue +39 -39
- package/src/stories/Organisms/Containers/Tableau/layout/TableauLayoutEngine.js +145 -145
- package/src/stories/Organisms/Containers/Tableau/layout/TableauLayoutEngine.test.js +64 -64
- package/src/stories/Organisms/Containers/Tableau/plannedAssignments.js +36 -57
- package/src/stories/Organisms/Containers/Tableau/plannedAssignments.test.js +101 -65
- package/src/stories/Organisms/Containers/TableauColumn/TableauColumn.vue +14 -1
- package/src/stories/Organisms/Wizards/EditEventWizard/BasicEventInfo/BasicEventInfo.stories.js +52 -52
- package/src/stories/Organisms/Wizards/EditEventWizard/BasicEventInfo/BasicEventInfo.vue +10 -3
- package/src/stories/Organisms/Wizards/EditEventWizard/DirectElimination/DirectElimination.vue +226 -226
- package/src/stories/Organisms/Wizards/EditEventWizard/DirectEliminationPromotion/DirectEliminationPromotion.vue +204 -204
- package/src/stories/Organisms/Wizards/EditEventWizard/EditEventWizard.stories.js +137 -137
- package/src/stories/Organisms/Wizards/EditEventWizard/EventCustomization/EventCustomization.vue +172 -172
- package/src/stories/Organisms/Wizards/EditEventWizard/PoolConfiguration/PoolConfiguration.vue +216 -216
- package/src/stories/Organisms/Wizards/EditEventWizard/PriceFields.test.js +79 -79
- package/src/stories/Organisms/Wizards/EditEventWizard/RuleSerialization.test.js +29 -29
- package/src/stories/Organisms/Wizards/EditEventWizard/WeaponSelection.test.js +138 -0
- package/src/stories/Templates/EventManagement/Bracket/Bracket.stories.js +123 -12
- package/src/stories/Templates/EventManagement/Bracket/Bracket.test.js +178 -166
- package/src/stories/Templates/EventManagement/Bracket/Bracket.vue +35 -7
- package/src/stories/Templates/EventManagement/Bracket/BracketDirectorAssignment.test.js +242 -0
- package/src/stories/Templates/EventManagement/Bracket/BracketMobile.test.js +131 -0
- package/src/stories/Templates/EventManagement/Bracket/BracketPlannedSuggestions.js +42 -39
- package/src/stories/Templates/EventManagement/Bracket/BracketStories.test.js +80 -0
- package/src/stories/Templates/EventManagement/Bracket/BracketStoryAssignments.js +93 -0
- package/src/stories/Templates/EventManagement/Bracket/BracketStoryAssignments.test.js +152 -0
- package/src/stories/Templates/EventManagement/Bracket/BracketStoryHarness.js +39 -39
- package/src/stories/Templates/EventManagement/Bracket/BracketStoryHarness.test.js +79 -79
- package/src/stories/Templates/EventManagement/EditEventInfo/EditEventInfo.stories.js +93 -93
- package/src/stories/Templates/EventManagement/EditEventInfo/EditEventInfo.vue +91 -91
- package/src/stories/Templates/EventManagement/PoolLive/PoolLive.test.js +121 -121
- package/src/stories/Templates/Menus/EditEventsTopMenu/EditEventsTopMenu.stories.js +9 -2
- package/src/stories/Templates/Menus/EditEventsTopMenu/EditEventsTopMenu.vue +5 -4
- package/src/stories/Templates/PersonManagement/Admin/Administration/Administration.stories.js +81 -81
- package/src/stories/Templates/PersonManagement/Admin/Administration/Administration.test.js +39 -39
- package/src/stories/Templates/PersonManagement/Admin/Administration/Administration.vue +101 -101
- package/src/stories/Templates/PersonManagement/Admin/FencerAdmin/FencerAdmin.stories.js +71 -71
- package/src/stories/Templates/PersonManagement/Admin/FencerAdmin/FencerAdmin.vue +86 -86
- package/src/stories/Templates/PersonManagement/Admin/MergeAccounts/MergeAccounts.stories.js +86 -86
- package/src/stories/Templates/PersonManagement/Admin/MergeAccounts/MergeAccounts.vue +247 -247
- package/src/stories/Templates/PersonManagement/Basic/BasicEdit.vue +170 -170
- package/src/stories/Templates/PersonManagement/PersonManagement.stories.js +156 -156
- package/src/stories/Templates/PersonManagement/PersonManagement.test.js +329 -329
- package/src/stories/Templates/PersonManagement/PersonManagement.vue +329 -329
- package/src/stories/Templates/PersonManagement/PersonManagementDraft.js +42 -42
- package/src/stories/Templates/TournamentManagement/TournamentManagement.stories.js +84 -84
- package/src/stories/Templates/TournamentManagement/TournamentManagement.test.js +114 -114
- package/src/stories/Templates/TournamentManagement/TournamentManagement.vue +363 -363
- package/src/stories/Templates/TournamentManagement/TournamentPageOne/TournamentPageOne.stories.js +116 -116
- package/src/stories/Templates/TournamentManagement/TournamentPageOne/TournamentPageOne.vue +307 -307
- package/src/stories/Util/Validations/PersonManagementValidations.js +45 -45
- package/src/stories/Util/Validations/PriceValidation.js +6 -6
- package/src/stories/Util/boutDirectorAssignment.js +46 -0
- package/src/stories/Util/registrationStatus.js +11 -11
- package/src/stories/Util/tabs.js +19 -47
|
@@ -1,307 +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
|
-
<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
|
+
<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>
|