@dcrackel/hematournamentui 1.0.699 → 1.0.702

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 (72) hide show
  1. package/AGENTS.md +3 -0
  2. package/dist/HemaTournamentUI-lib.es.js +10913 -10269
  3. package/dist/HemaTournamentUI-lib.umd.js +27 -27
  4. package/dist/hematournamentui-tailwind.css +23 -0
  5. package/dist/hematournamentui.css +1 -1
  6. package/package.json +8 -8
  7. package/src/stories/Molecules/Boxes/BoutBoxes/TimerBox/TimerBox.vue +1 -1
  8. package/src/stories/Molecules/Buttons/BaseButton/BaseButton.vue +1 -1
  9. package/src/stories/Molecules/Buttons/ButtonBar/ButtonBar.vue +1 -1
  10. package/src/stories/Molecules/Modals/DirectorModal/DirectorModal.vue +2 -2
  11. package/src/stories/Organisms/Cards/BoutCard/Variants/BoutCardActive/BoutCardActive.vue +25 -22
  12. package/src/stories/Organisms/Cards/BoutCard/Variants/BoutCardInactive/BoutCardInactive.vue +31 -29
  13. package/src/stories/Organisms/Cards/BoutCard/Variants/BoutCardWaiting/BoutCardWaiting.vue +2 -4
  14. package/src/stories/Organisms/Cards/KioskCard/KioskCard.vue +54 -35
  15. package/src/stories/Organisms/Cards/PenaltyCard/PenaltyCard.stories.js +6 -6
  16. package/src/stories/Organisms/Cards/PenaltyCard/PenaltyCard.vue +64 -53
  17. package/src/stories/Organisms/Cards/PenaltyFencerCard/PenaltyFencerCard.stories.js +6 -7
  18. package/src/stories/Organisms/Cards/PenaltyFencerCard/PenaltyFencerCard.vue +18 -10
  19. package/src/stories/Organisms/Cards/StaffCard/StaffCard.vue +4 -4
  20. package/src/stories/Organisms/Cards/WaitlistFencerCard/WaitlistFencerCard.vue +129 -0
  21. package/src/stories/Organisms/ComplexInputs/DatePicker/DatePicker.vue +64 -45
  22. package/src/stories/Organisms/Containers/KioskContainer/KioskContainer.vue +13 -9
  23. package/src/stories/Organisms/Containers/Pool/Pool.vue +1 -1
  24. package/src/stories/Organisms/Containers/PoolResults/PoolResultsTable.vue +35 -20
  25. package/src/stories/Organisms/Headers/AttendanceSummary/AttendanceSummary.vue +45 -19
  26. package/src/stories/Templates/Assignment/Assignment.stories.js +17 -15
  27. package/src/stories/Templates/Assignment/Assignment.vue +71 -40
  28. package/src/stories/Templates/ClubManagement/ClubBasic/ClubBasic.stories.js +49 -30
  29. package/src/stories/Templates/ClubManagement/ClubBasic/ClubBasic.vue +29 -28
  30. package/src/stories/Templates/ClubManagement/{ClubMangement.stories.js → ClubManagement.stories.js} +74 -59
  31. package/src/stories/Templates/ClubManagement/ClubManagement.vue +104 -92
  32. package/src/stories/Templates/EventManagement/Bracket/Bracket.vue +92 -97
  33. package/src/stories/Templates/EventManagement/EditEventInfo/EditEventInfo.stories.js +37 -33
  34. package/src/stories/Templates/EventManagement/EditEventInfo/EditEventInfo.vue +11 -14
  35. package/src/stories/Templates/EventManagement/EventAttendance/EventAttendance.stories.js +49 -14
  36. package/src/stories/Templates/EventManagement/EventAttendance/EventAttendance.vue +156 -62
  37. package/src/stories/Templates/EventManagement/EventFinalResults/EventFinalResults.stories.js +11 -10
  38. package/src/stories/Templates/EventManagement/EventFinalResults/EventFinalResults.vue +8 -8
  39. package/src/stories/Templates/EventManagement/KioskDisplay/KioskDisplay.stories.js +13 -16
  40. package/src/stories/Templates/EventManagement/KioskDisplay/KioskDisplay.vue +25 -25
  41. package/src/stories/Templates/EventManagement/Penalties/PenaltyReport.stories.js +25 -24
  42. package/src/stories/Templates/EventManagement/Penalties/PenaltyReport.vue +28 -34
  43. package/src/stories/Templates/EventManagement/PoolLive/PoolLive.stories.js +54 -19
  44. package/src/stories/Templates/EventManagement/PoolLive/PoolLive.vue +75 -68
  45. package/src/stories/Templates/EventManagement/PoolManagement/PoolManagement.stories.js +55 -45
  46. package/src/stories/Templates/EventManagement/PoolManagement/PoolManagement.vue +47 -55
  47. package/src/stories/Templates/EventManagement/PoolResults/PoolResults.stories.js +56 -55
  48. package/src/stories/Templates/EventManagement/PoolResults/PoolResults.vue +71 -73
  49. package/src/stories/Templates/EventManagement/StaffList/StaffList.stories.js +18 -16
  50. package/src/stories/Templates/EventManagement/StaffList/StaffList.vue +9 -6
  51. package/src/stories/Templates/Menus/Admin/AdminLeftMenu.stories.js +22 -19
  52. package/src/stories/Templates/Menus/Admin/AdminLeftMenu.vue +44 -36
  53. package/src/stories/Templates/Menus/EditEventsTopMenu/EditEventsTopMenu.stories.js +30 -23
  54. package/src/stories/Templates/Menus/EditEventsTopMenu/EditEventsTopMenu.vue +55 -58
  55. package/src/stories/Templates/PersonManagement/Admin/Administration/Administration.stories.js +67 -0
  56. package/src/stories/Templates/PersonManagement/Admin/{Administration.vue → Administration/Administration.vue} +94 -87
  57. package/src/stories/Templates/PersonManagement/Admin/FencerAdmin/FencerAdmin.stories.js +71 -0
  58. package/src/stories/Templates/PersonManagement/Admin/{FencerAdmin.vue → FencerAdmin/FencerAdmin.vue} +90 -77
  59. package/src/stories/Templates/PersonManagement/Admin/MergeAccounts/MergeAccounts.stories.js +86 -0
  60. package/src/stories/Templates/PersonManagement/Admin/{MergeAccounts.vue → MergeAccounts/MergeAccounts.vue} +258 -242
  61. package/src/stories/Templates/PersonManagement/Attendance/Attendance.vue +28 -28
  62. package/src/stories/Templates/PersonManagement/PersonManagement.vue +1 -1
  63. package/src/stories/Templates/TournamentManagement/ListEvents/ListEvents.stories.js +45 -28
  64. package/src/stories/Templates/TournamentManagement/ListEvents/ListEvents.vue +22 -16
  65. package/src/stories/Templates/TournamentManagement/{TournamentMangement.stories.js → TournamentManagement.stories.js} +68 -39
  66. package/src/stories/Templates/TournamentManagement/TournamentManagement.vue +199 -153
  67. package/src/stories/Templates/TournamentManagement/TournamentPageOne/TournamentPageOne.stories.js +113 -0
  68. package/src/stories/Templates/TournamentManagement/TournamentPageOne/TournamentPageOne.vue +123 -106
  69. package/src/stories/Templates/TournamentManagement/TournamentPageTwo/TournamentPageTwo.stories.js +76 -31
  70. package/src/stories/Templates/TournamentManagement/TournamentPageTwo/{TouranmentPageTwo.vue → TournamentPageTwo.vue} +63 -44
  71. package/src/stories/Templates/PersonManagement/Admin/FencerAdmin.stories.js +0 -48
  72. package/src/stories/Templates/TournamentManagement/TournamentPageOne/TouranmentPageOne.stories.js +0 -63
@@ -11,10 +11,11 @@
11
11
  :uploadServer="uploadServer"
12
12
  :isNewTournament="isNewTournament"
13
13
  :userLevel="userLevel"
14
- @add:newAddress="handleAddNewAddress"
15
- @update:address="handleAddressUpdate"
16
- @update:image="handleNewImageUrl"
17
- @update:tournament="updateTournament"
14
+ @add:newAddress="handleAddNewAddress"
15
+ @add:newPerson="handleAddNewPerson"
16
+ @update:address="handleAddressUpdate"
17
+ @update:image="handleNewImageUrl"
18
+ @update:tournament="updateTournament"
18
19
  />
19
20
 
20
21
  <TournamentPageTwo v-if="currentTab === 'Hosting'"
@@ -30,43 +31,37 @@
30
31
  <BaseButton v-if="currentTab === 'Hosting'" class="w-1/2 ml-1 h-12" color="neutral" label="Back" size="sm"
31
32
  type="primary" @buttonClick="handleBack"/>
32
33
 
33
- <BaseButton v-if="currentTab === 'Basic'" class="w-1/2 mr-1 transition-all duration-300 ease-in-out h-12"
34
- color="neutral" label="Next" selected=selected size="sm" type="primary" @buttonClick="handleNext"/>
35
- <BaseButton v-if="currentTab === 'Hosting'" class="w-1/2 mr-1 transition-all duration-300 ease-in-out h-12"
36
- color="neutral" :label="saveButtonLabel" selected=selected size="sm" type="primary"
37
- @buttonClick="handleSubmit"/>
38
- </div>
39
-
40
- <div v-if="!isNewTournament" class="flex flex-row justify-center h-12 mt-4">
41
- <BaseButton class="w-1/2 mr-1 transition-all duration-300 ease-in-out h-12" color="neutral"
42
- :label="saveButtonLabel" selected=selected size="sm" type="primary" @buttonClick="handleSubmit"/>
43
- </div>
34
+ <BaseButton v-if="currentTab === 'Basic'" class="w-1/2 mr-1 transition-all duration-300 ease-in-out h-12"
35
+ color="neutral" label="Next" :selected="true" size="sm" type="primary" @buttonClick="handleNext"/>
36
+ <BaseButton v-if="currentTab === 'Hosting'" class="w-1/2 mr-1 transition-all duration-300 ease-in-out h-12"
37
+ color="neutral" :label="submitButtonLabel" :selected="true" size="sm" type="primary"
38
+ @buttonClick="handleSubmit"/>
39
+ </div>
40
+
41
+ <div v-if="!isNewTournament" class="flex flex-row justify-center h-12 mt-4">
42
+ <BaseButton class="w-1/2 mr-1 transition-all duration-300 ease-in-out h-12" color="neutral"
43
+ :label="submitButtonLabel" :selected="true" size="sm" type="primary" @buttonClick="handleSubmit"/>
44
+ </div>
44
45
  </div>
45
46
  </template>
46
47
 
47
48
  <script>
48
- import TournamentPageOne from "./TournamentPageOne/TournamentPageOne.vue";
49
- import BaseText from "../../Atoms/Text/BaseText.vue";
50
- import ImageCropper from "../../Organisms/ComplexInputs/ImageCropper/ImageCropper.vue";
51
- import BaseButton from "../../Molecules/Buttons/BaseButton/BaseButton.vue";
52
- import EditEventsTopMenu from "../Menus/EditEventsTopMenu/EditEventsTopMenu.vue";
53
- import {tournamentTabs} from "../../Util/tabs.js";
54
- import TournamentPageTwo from "./TournamentPageTwo/TouranmentPageTwo.vue";
55
- import {validateField} from "../../Util/Validations/TournamentFieldsValidations.js";
56
- import BaseModal from "../../Molecules/Modals/BaseModal/BaseModal.vue";
57
-
58
- export default {
59
- title: 'TournamentManagement',
60
- components: {
61
- TournamentPageTwo,
62
- EditEventsTopMenu,
63
- BaseButton,
64
- ImageCropper,
65
- BaseText,
66
- TournamentPageOne,
67
- BaseModal
68
- },
69
- emits: ['submit:tournament', 'cancel', 'add:newAddress', 'update:address', 'update:image', 'tab:menu-click'],
49
+ import TournamentPageOne from "./TournamentPageOne/TournamentPageOne.vue";
50
+ import BaseButton from "../../Molecules/Buttons/BaseButton/BaseButton.vue";
51
+ import EditEventsTopMenu from "../Menus/EditEventsTopMenu/EditEventsTopMenu.vue";
52
+ import {tournamentTabs} from "../../Util/tabs.js";
53
+ import TournamentPageTwo from "./TournamentPageTwo/TournamentPageTwo.vue";
54
+ import {validateField} from "../../Util/Validations/TournamentFieldsValidations.js";
55
+
56
+ export default {
57
+ title: 'TournamentManagement',
58
+ components: {
59
+ TournamentPageTwo,
60
+ EditEventsTopMenu,
61
+ BaseButton,
62
+ TournamentPageOne,
63
+ },
64
+ emits: ['submit:tournament', 'cancel', 'add:newAddress', 'add:newPerson', 'update:address', 'update:image', 'tab:menu-click'],
70
65
  props: {
71
66
  tournament: {
72
67
  type: Object,
@@ -97,34 +92,42 @@ export default {
97
92
  type: String,
98
93
  default: 'Basic'
99
94
  },
100
- userLevel: {
101
- type: String,
102
- default: 'Club'
103
- }
104
- },
105
- data() {
106
- return {
107
- currentTab: this.showTab,
108
- localTournament: this.tournament,
109
- isNewTournament: true,
110
- saveButtonLabel: 'Save',
111
- validation: {
112
- Name: {invalid: false, message: ""},
113
- Address: {invalid: false, message: ""},
114
- StartDate: {invalid: false, message: ""},
115
- TotalDays: {invalid: false, message: ""},
116
- RegistrationCutOff: {invalid: false, message: ""},
117
- Description: {invalid: false, message: ""},
118
- WaiverScope: "None",
119
- },
120
- };
121
- },
122
- watch: {
123
- 'localTournament.StartDate': 'setEndDate',
124
- 'localTournament.TotalDays': 'setEndDate',
125
- },
126
- mounted() {
127
- this.checkIfNewTournament();
95
+ userLevel: {
96
+ type: String,
97
+ default: 'Club'
98
+ },
99
+ submitButtonLabel: {
100
+ type: String,
101
+ default: 'Save'
102
+ }
103
+ },
104
+ data() {
105
+ return {
106
+ currentTab: this.showTab,
107
+ localTournament: this.createNewTournamentDraft(),
108
+ isNewTournament: true,
109
+ validation: {
110
+ Name: {invalid: false, message: ""},
111
+ Address: {invalid: false, message: ""},
112
+ StartDate: {invalid: false, message: ""},
113
+ TotalDays: {invalid: false, message: ""},
114
+ RegistrationCutOff: {invalid: false, message: ""},
115
+ Description: {invalid: false, message: ""},
116
+ },
117
+ };
118
+ },
119
+ watch: {
120
+ tournament: {
121
+ handler: 'initializeTournamentDraft',
122
+ },
123
+ showTab(tab) {
124
+ this.currentTab = tab;
125
+ },
126
+ 'localTournament.StartDate': 'setEndDate',
127
+ 'localTournament.TotalDays': 'setEndDate',
128
+ },
129
+ mounted() {
130
+ this.initializeTournamentDraft();
128
131
  },
129
132
  computed: {
130
133
  filteredTabs() {
@@ -137,60 +140,81 @@ export default {
137
140
  },
138
141
  },
139
142
  methods: {
140
- tournamentTabs,
141
- handleTab(tab) {
142
- this.saveButtonLabel = 'Save';
143
- this.currentTab = tab;
144
- this.$emit('tab:menu-click', tab);
145
- },
146
- checkIfNewTournament() {
147
- if (!this.tournament || Object.keys(this.tournament).length === 0 || !this.tournament.Name) {
148
- this.isNewTournament = true;
149
- this.localTournament = {
150
- TournamentId: 0,
151
- Name: "",
152
- Address: "",
153
- TotalDays: 1,
154
- StartDate: new Date().toISOString().slice(0, 10),
155
- RegistrationCutOff: new Date().toISOString().slice(0, 10),
156
- Description: "",
157
- HostedOnM2: false,
158
- Visibility: "Open"
159
- };
160
- return;
161
- }
162
-
163
- this.isNewTournament = false;
164
-
165
- const startDate = new Date(this.tournament.StartDate);
166
- const endDate = new Date(this.tournament.EndDate);
167
- const TotalDays = (!isNaN(startDate.getTime()) && !isNaN(endDate.getTime()))
168
- ? Math.max(1, (endDate - startDate) / (1000 * 60 * 60 * 24) + 1)
169
- : 1;
170
-
171
- this.localTournament = {...this.tournament, TotalDays, WaiverScope: this.tournament.WaiverScope ?? "None",};
172
- console.log(this.localTournament)
173
- this.setEndDate();
174
- },
175
- handleAddNewAddress(newAddress) {
176
- this.localTournament.AddressId = 0;
177
- this.localTournament.Address = newAddress;
178
-
179
- this.$emit('add:newAddress', newAddress);
180
- },
181
- handleAddressUpdate(updatedAddress) {
182
- if (updatedAddress) {
183
- this.localTournament.AddressId = updatedAddress.AddressId
184
- this.localTournament.Address = updatedAddress;
185
- this.$emit('update:address', updatedAddress);
186
- this.validation.Address = validateField('Address', updatedAddress);
187
- }
188
-
189
- if (!updatedAddress) {
190
- this.localTournament.AddressId = 0;
191
- this.localTournament.Address = '';
192
- }
193
- },
143
+ tournamentTabs,
144
+ handleTab(tab) {
145
+ this.currentTab = tab;
146
+ this.$emit('tab:menu-click', tab);
147
+ },
148
+ initializeTournamentDraft() {
149
+ if (!this.tournament || Object.keys(this.tournament).length === 0 || !this.tournament.Name) {
150
+ this.isNewTournament = true;
151
+ this.localTournament = this.createNewTournamentDraft();
152
+ return;
153
+ }
154
+
155
+ this.isNewTournament = false;
156
+ this.localTournament = this.createExistingTournamentDraft(this.tournament);
157
+ this.setEndDate();
158
+ },
159
+ createNewTournamentDraft() {
160
+ const today = new Date().toISOString().slice(0, 10);
161
+
162
+ return {
163
+ TournamentId: 0,
164
+ Name: "",
165
+ Address: "",
166
+ TotalDays: 1,
167
+ StartDate: today,
168
+ RegistrationCutOff: today,
169
+ Description: "",
170
+ HostedOnM2: false,
171
+ ResultsEnabled: false,
172
+ Visibility: "Open",
173
+ WaiverScope: "None",
174
+ };
175
+ },
176
+ createExistingTournamentDraft(tournament) {
177
+ const tournamentDraft = this.cloneTournamentData(tournament);
178
+ const startDate = new Date(tournamentDraft.StartDate);
179
+ const endDate = new Date(tournamentDraft.EndDate);
180
+ const TotalDays = (!isNaN(startDate.getTime()) && !isNaN(endDate.getTime()))
181
+ ? Math.max(1, (endDate - startDate) / (1000 * 60 * 60 * 24) + 1)
182
+ : 1;
183
+
184
+ return {
185
+ ...tournamentDraft,
186
+ TotalDays,
187
+ StartDate: this.formatDateOnly(tournamentDraft.StartDate),
188
+ EndDate: this.formatDateOnly(tournamentDraft.EndDate),
189
+ RegistrationCutOff: this.formatDateOnly(tournamentDraft.RegistrationCutOff),
190
+ Visibility: tournamentDraft.Visibility ?? "Open",
191
+ WaiverScope: tournamentDraft.WaiverScope ?? "None",
192
+ ResultsEnabled: tournamentDraft.ResultsEnabled ?? false,
193
+ };
194
+ },
195
+ cloneTournamentData(tournament) {
196
+ return JSON.parse(JSON.stringify(tournament));
197
+ },
198
+ handleAddNewAddress(newAddress) {
199
+ this.updateTournament({ AddressId: 0, Address: newAddress });
200
+ this.$emit('add:newAddress', newAddress);
201
+ },
202
+ handleAddNewPerson(personName) {
203
+ this.$emit('add:newPerson', personName);
204
+ },
205
+ handleAddressUpdate(updatedAddress) {
206
+ if (updatedAddress) {
207
+ this.updateTournament({
208
+ AddressId: updatedAddress.AddressId,
209
+ Address: updatedAddress,
210
+ });
211
+ this.$emit('update:address', updatedAddress);
212
+ this.validation.Address = validateField('Address', updatedAddress);
213
+ return;
214
+ }
215
+
216
+ this.updateTournament({ AddressId: 0, Address: "" });
217
+ },
194
218
  validateAllFields() {
195
219
  const fieldsToValidate = ['Name', 'TotalDays', 'Address'];
196
220
  fieldsToValidate.forEach(field => {
@@ -198,32 +222,60 @@ export default {
198
222
  });
199
223
  return !Object.values(this.validation).some(field => field.invalid);
200
224
  },
201
- handleNewImageUrl(url) {
202
- this.tournament.imageLink = url;
203
- this.$emit('update:image', url);
204
- },
205
- updateTournament(updatedData) {
206
- this.localTournament = {...this.localTournament, ...updatedData};
207
- Object.keys(updatedData).forEach(field => {
208
- if (this.validation[field]) {
209
- this.validation[field] = validateField(field, updatedData[field]);
210
- }
211
- });
212
- },
213
- addDaysInclusiveYMD(startYmd, totalDays) {
214
- const [y, m, d] = startYmd.split('-').map(Number);
215
- const start = new Date(Date.UTC(y, m - 1, d));
225
+ handleNewImageUrl(imageUpdate) {
226
+ this.updateTournament(imageUpdate);
227
+ this.$emit('update:image', imageUpdate);
228
+ },
229
+ updateTournament(updatedData) {
230
+ const normalizedData = this.normalizeTournamentUpdate(updatedData);
231
+ this.localTournament = {...this.localTournament, ...normalizedData};
232
+ Object.keys(normalizedData).forEach(field => {
233
+ if (this.validation[field]) {
234
+ this.validation[field] = validateField(field, normalizedData[field]);
235
+ }
236
+ });
237
+ },
238
+ normalizeTournamentUpdate(updatedData) {
239
+ const normalizedData = {...updatedData};
240
+ const dateFields = ['StartDate', 'EndDate', 'RegistrationCutOff'];
241
+
242
+ dateFields.forEach(field => {
243
+ if (field in normalizedData) {
244
+ normalizedData[field] = this.formatDateOnly(normalizedData[field]);
245
+ }
246
+ });
247
+
248
+ return normalizedData;
249
+ },
250
+ formatDateOnly(dateValue) {
251
+ if (!dateValue) return "";
252
+ if (typeof dateValue === 'string') return dateValue.slice(0, 10);
253
+
254
+ const date = new Date(dateValue);
255
+ if (isNaN(date.getTime())) return "";
256
+
257
+ const year = date.getFullYear();
258
+ const month = String(date.getMonth() + 1).padStart(2, '0');
259
+ const day = String(date.getDate()).padStart(2, '0');
260
+ return `${year}-${month}-${day}`;
261
+ },
262
+ addDaysInclusiveYMD(startYmd, totalDays) {
263
+ const [y, m, d] = startYmd.split('-').map(Number);
264
+ const start = new Date(Date.UTC(y, m - 1, d));
216
265
  const end = new Date(start);
217
266
  end.setUTCDate(end.getUTCDate() + Math.max(1, Number(totalDays) || 1) - 1);
218
267
  return end.toISOString().slice(0, 10); // 'YYYY-MM-DD'
219
268
  },
220
- setEndDate() {
221
- if (!this.localTournament?.StartDate) return;
222
- const days = Math.max(1, Number(this.localTournament.TotalDays) || 1);
223
- this.localTournament.EndDate = this.addDaysInclusiveYMD(this.localTournament.StartDate, days);
224
- },
225
- handleCancel() {
226
- this.$emit('edit:cancel');
269
+ setEndDate() {
270
+ if (!this.localTournament?.StartDate) return;
271
+ const startDate = this.formatDateOnly(this.localTournament.StartDate);
272
+ if (!startDate) return;
273
+
274
+ const days = Math.max(1, Number(this.localTournament.TotalDays) || 1);
275
+ this.localTournament.EndDate = this.addDaysInclusiveYMD(startDate, days);
276
+ },
277
+ handleCancel() {
278
+ this.$emit('cancel');
227
279
  },
228
280
  transition(action) {
229
281
  const table = {
@@ -253,17 +305,11 @@ export default {
253
305
  handleBack() {
254
306
  this.transition('BACK');
255
307
  },
256
- handleSubmit() {
257
- console.log(this.tournament)
258
- if (this.validateAllFields()) {
259
- this.saveButtonLabel = 'Saving...';
260
- setTimeout(() => {
261
- this.saveButtonLabel = 'Saved!';
262
- }, 2000);
263
-
264
- this.$emit('submit:tournament', this.localTournament);
265
- }
266
- },
308
+ handleSubmit() {
309
+ if (this.validateAllFields()) {
310
+ this.$emit('submit:tournament', this.localTournament);
311
+ }
312
+ },
267
313
  },
268
314
  };
269
- </script>
315
+ </script>
@@ -0,0 +1,113 @@
1
+ import TournamentForm from "./TournamentPageOne.vue";
2
+ import mockLocation from "../../../../mocks/locationMock.js";
3
+ import mockTournaments from "../../../../mocks/tournamentMock.js";
4
+ import mockPersons from "../../../../mocks/personsMock.js";
5
+
6
+ const validTournamentFields = {
7
+ Name: { invalid: false, message: '' },
8
+ Address: { invalid: false, message: '' },
9
+ StartDate: { invalid: false, message: '' },
10
+ TotalDays: { invalid: false, message: '' },
11
+ RegistrationCutOff: { invalid: false, message: '' },
12
+ Description: { invalid: false, message: '' },
13
+ };
14
+
15
+ const invalidTournamentFields = {
16
+ Name: { invalid: true, message: 'Tournament name is required' },
17
+ Address: { invalid: true, message: 'Location is required' },
18
+ StartDate: { invalid: true, message: 'Start date is required' },
19
+ TotalDays: { invalid: true, message: 'Must be at least 1 day' },
20
+ RegistrationCutOff: { invalid: true, message: 'Registration cut off is required' },
21
+ Description: { invalid: true, message: 'Description is required' },
22
+ };
23
+
24
+ const emptyTournament = {
25
+ Name: '',
26
+ Address: { Name: '' },
27
+ StartDate: new Date().toISOString().slice(0, 10),
28
+ TotalDays: 1,
29
+ RegistrationCutOff: new Date().toISOString().slice(0, 10),
30
+ PrimaryContactId: mockPersons?.[0]?.PersonId ?? 0,
31
+ Images: [{ URL: '' }],
32
+ Description: '',
33
+ };
34
+
35
+ export default {
36
+ title: 'Templates/TournamentManagement/TournamentPageOne',
37
+ component: TournamentForm,
38
+ tags: ["autodocs"],
39
+ args: {
40
+ tournament: mockTournaments[0],
41
+ locations: mockLocation,
42
+ persons: mockPersons,
43
+ validation: validTournamentFields,
44
+ isNewTournament: true,
45
+ userLevel: 'Club',
46
+ },
47
+ argTypes: {
48
+ tournament: {
49
+ control: { type: "object" },
50
+ },
51
+ locations: {
52
+ control: { type: "object" },
53
+ },
54
+ persons: {
55
+ control: { type: "object" },
56
+ },
57
+ validation: {
58
+ control: { type: "object" },
59
+ },
60
+ isNewTournament: {
61
+ control: { type: "boolean" },
62
+ },
63
+ userLevel: {
64
+ control: { type: "text" },
65
+ },
66
+ },
67
+ };
68
+
69
+ export const Default = {
70
+ args: {
71
+ tournament: mockTournaments[0],
72
+ locations: mockLocation,
73
+ persons: mockPersons,
74
+ validation: validTournamentFields,
75
+ },
76
+ };
77
+
78
+ export const EmptyTournament = {
79
+ args: {
80
+ tournament: emptyTournament,
81
+ locations: mockLocation,
82
+ persons: mockPersons,
83
+ validation: validTournamentFields,
84
+ },
85
+ };
86
+
87
+ export const EditMode = {
88
+ args: {
89
+ tournament: mockTournaments[0],
90
+ locations: mockLocation,
91
+ persons: mockPersons,
92
+ validation: validTournamentFields,
93
+ isNewTournament: false,
94
+ },
95
+ };
96
+
97
+ export const InvalidFields = {
98
+ args: {
99
+ tournament: emptyTournament,
100
+ locations: mockLocation,
101
+ persons: mockPersons,
102
+ validation: invalidTournamentFields,
103
+ },
104
+ };
105
+
106
+ export const EmptyOptions = {
107
+ args: {
108
+ tournament: emptyTournament,
109
+ locations: [],
110
+ persons: [],
111
+ validation: validTournamentFields,
112
+ },
113
+ };