@dcrackel/hematournamentui 1.0.715 → 1.0.716
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/dist/HemaTournamentUI-lib.es.js +1614 -1146
- package/dist/HemaTournamentUI-lib.umd.js +1 -1
- package/dist/hematournamentui-tailwind.css +240 -3
- package/package.json +1 -1
- package/src/index.js +45 -43
- package/src/stories/Organisms/Cards/RingBoutCard/RingBoutCard.vue +158 -0
- package/src/stories/Organisms/Cards/TableauFencerCard/TableauFencerCard.stories.js +10 -0
- package/src/stories/Organisms/Cards/TableauFencerCard/TableauFencerCard.vue +140 -80
- package/src/stories/Organisms/Cards/WaitlistFencerCard/WaitlistFencerCard.test.js +94 -0
- package/src/stories/Organisms/Cards/WaitlistFencerCard/WaitlistFencerCard.vue +180 -153
- package/src/stories/Templates/EventManagement/EventAttendance/EventAttendance.stories.js +35 -3
- package/src/stories/Templates/EventManagement/EventAttendance/EventAttendance.test.js +73 -0
- package/src/stories/Templates/EventManagement/EventAttendance/EventAttendance.vue +417 -403
- package/src/stories/Templates/EventManagement/RingBoard/README.md +29 -0
- package/src/stories/Templates/EventManagement/RingBoard/RingBoard.stories.js +118 -0
- package/src/stories/Templates/EventManagement/RingBoard/RingBoard.test.js +208 -0
- package/src/stories/Templates/EventManagement/RingBoard/RingBoard.vue +170 -0
- package/src/stories/Util/ringBoard.js +103 -0
- package/src/stories/Util/waitlistAttendance.js +8 -0
|
@@ -1,403 +1,417 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<section>
|
|
3
|
-
<EditEventsTopMenu :currentTab="'Checkin'" :tabs="tabs(role, isMobile)" @tabMenuClick="handleTabMenuClick" />
|
|
4
|
-
<AttendanceSummary
|
|
5
|
-
:event="event"
|
|
6
|
-
:absent="absent"
|
|
7
|
-
:present="present"
|
|
8
|
-
:activeCount="activeRosterCount"
|
|
9
|
-
:waitlistCount="waitlistCount"
|
|
10
|
-
:capacity="eventCapacity"
|
|
11
|
-
/>
|
|
12
|
-
<div class="w-full flex flex-row justify-center mt-1 md:mt-3">
|
|
13
|
-
<section class="w-full">
|
|
14
|
-
<div class="w-full flex flex-col justify-center items-center" style="text-align: center">
|
|
15
|
-
<section class="grid grid-cols-2 w-full mb-3 py-2">
|
|
16
|
-
<div class="col-start-1 col-end-2 flex justify-start">
|
|
17
|
-
<FindOrAddPerson
|
|
18
|
-
:persons="personsAll"
|
|
19
|
-
:fencingClubs="fencingClubs"
|
|
20
|
-
:addBorder="false"
|
|
21
|
-
:addNewText="'Add New'"
|
|
22
|
-
@new-person-submitted="handleNewPerson"
|
|
23
|
-
@person-selected="handleAddExistingPerson"
|
|
24
|
-
/>
|
|
25
|
-
</div>
|
|
26
|
-
<div class="col-start-2 col-end-3 flex justify-end">
|
|
27
|
-
<DropDownMenu
|
|
28
|
-
:label="label"
|
|
29
|
-
:items="items"
|
|
30
|
-
:selectedItem="localSelectedItem"
|
|
31
|
-
@update:selectedItem="handleSelectedItem"
|
|
32
|
-
/>
|
|
33
|
-
</div>
|
|
34
|
-
</section>
|
|
35
|
-
|
|
36
|
-
<section v-if="loading" class="w-full">
|
|
37
|
-
<div v-for="index in 6" :key="index">
|
|
38
|
-
<FencerCardSkeleton class="mb-4" />
|
|
39
|
-
</div>
|
|
40
|
-
</section>
|
|
41
|
-
<section v-if="!loading" class="w-full">
|
|
42
|
-
<div v-if="activeRosterCount > 0" class="mb-2 flex items-center justify-between">
|
|
43
|
-
<BaseText text="Active Roster" size="md" color="quaternary" weight="bold" />
|
|
44
|
-
<BaseText :text="activeRosterSummary" size="sm" color="quinary" />
|
|
45
|
-
</div>
|
|
46
|
-
<div
|
|
47
|
-
v-for="(person, index) in sortedActivePersons"
|
|
48
|
-
:key="person.PersonId || person.Person?.PersonId || index"
|
|
49
|
-
>
|
|
50
|
-
<FencerCard
|
|
51
|
-
:person="person"
|
|
52
|
-
class="mb-4"
|
|
53
|
-
:isLast="index === sortedActivePersons.length - 1"
|
|
54
|
-
:isEdit="event.Status === 'planning' || event.Status === 'preparation'"
|
|
55
|
-
@forward:toProfile="handleForwardToProfile"
|
|
56
|
-
@update:status="handleStatus"
|
|
57
|
-
@remove:fencer="handleRemoveFencer"
|
|
58
|
-
@update:moveUp="handleMoveUp"
|
|
59
|
-
@update:moveDown="handleMoveDown"
|
|
60
|
-
@request:weaver-sign="openWeaverModal"
|
|
61
|
-
/>
|
|
62
|
-
</div>
|
|
63
|
-
<section v-if="waitlistCount > 0" class="mt-6 w-full">
|
|
64
|
-
<div class="mb-2 flex items-center justify-between">
|
|
65
|
-
<BaseText text="Waitlist" size="md" color="quaternary" weight="bold" />
|
|
66
|
-
<BaseText :text="waitlistSummary" size="sm" color="quinary" />
|
|
67
|
-
</div>
|
|
68
|
-
<div
|
|
69
|
-
v-for="(person, index) in sortedWaitlistedPersons"
|
|
70
|
-
:key="person.PersonId || person.Person?.PersonId || index"
|
|
71
|
-
class="mb-3"
|
|
72
|
-
>
|
|
73
|
-
<WaitlistFencerCard
|
|
74
|
-
:person="person"
|
|
75
|
-
:queuePosition="index + 1"
|
|
76
|
-
|
|
77
|
-
@
|
|
78
|
-
@
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
:
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
:
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
import
|
|
136
|
-
import
|
|
137
|
-
import
|
|
138
|
-
import
|
|
139
|
-
import
|
|
140
|
-
import
|
|
141
|
-
import
|
|
142
|
-
import
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
const
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
};
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
const
|
|
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
|
-
type:
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
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
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
this.
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
this.
|
|
367
|
-
},
|
|
368
|
-
|
|
369
|
-
this
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
}
|
|
403
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<section>
|
|
3
|
+
<EditEventsTopMenu :currentTab="'Checkin'" :tabs="tabs(role, isMobile)" @tabMenuClick="handleTabMenuClick" />
|
|
4
|
+
<AttendanceSummary
|
|
5
|
+
:event="event"
|
|
6
|
+
:absent="absent"
|
|
7
|
+
:present="present"
|
|
8
|
+
:activeCount="activeRosterCount"
|
|
9
|
+
:waitlistCount="waitlistCount"
|
|
10
|
+
:capacity="eventCapacity"
|
|
11
|
+
/>
|
|
12
|
+
<div class="w-full flex flex-row justify-center mt-1 md:mt-3">
|
|
13
|
+
<section class="w-full">
|
|
14
|
+
<div class="w-full flex flex-col justify-center items-center" style="text-align: center">
|
|
15
|
+
<section class="grid grid-cols-2 w-full mb-3 py-2">
|
|
16
|
+
<div class="col-start-1 col-end-2 flex justify-start">
|
|
17
|
+
<FindOrAddPerson
|
|
18
|
+
:persons="personsAll"
|
|
19
|
+
:fencingClubs="fencingClubs"
|
|
20
|
+
:addBorder="false"
|
|
21
|
+
:addNewText="'Add New'"
|
|
22
|
+
@new-person-submitted="handleNewPerson"
|
|
23
|
+
@person-selected="handleAddExistingPerson"
|
|
24
|
+
/>
|
|
25
|
+
</div>
|
|
26
|
+
<div class="col-start-2 col-end-3 flex justify-end">
|
|
27
|
+
<DropDownMenu
|
|
28
|
+
:label="label"
|
|
29
|
+
:items="items"
|
|
30
|
+
:selectedItem="localSelectedItem"
|
|
31
|
+
@update:selectedItem="handleSelectedItem"
|
|
32
|
+
/>
|
|
33
|
+
</div>
|
|
34
|
+
</section>
|
|
35
|
+
|
|
36
|
+
<section v-if="loading" class="w-full">
|
|
37
|
+
<div v-for="index in 6" :key="index">
|
|
38
|
+
<FencerCardSkeleton class="mb-4" />
|
|
39
|
+
</div>
|
|
40
|
+
</section>
|
|
41
|
+
<section v-if="!loading" class="w-full">
|
|
42
|
+
<div v-if="activeRosterCount > 0" class="mb-2 flex items-center justify-between">
|
|
43
|
+
<BaseText text="Active Roster" size="md" color="quaternary" weight="bold" />
|
|
44
|
+
<BaseText :text="activeRosterSummary" size="sm" color="quinary" />
|
|
45
|
+
</div>
|
|
46
|
+
<div
|
|
47
|
+
v-for="(person, index) in sortedActivePersons"
|
|
48
|
+
:key="person.PersonId || person.Person?.PersonId || index"
|
|
49
|
+
>
|
|
50
|
+
<FencerCard
|
|
51
|
+
:person="person"
|
|
52
|
+
class="mb-4"
|
|
53
|
+
:isLast="index === sortedActivePersons.length - 1"
|
|
54
|
+
:isEdit="event.Status === 'planning' || event.Status === 'preparation'"
|
|
55
|
+
@forward:toProfile="handleForwardToProfile"
|
|
56
|
+
@update:status="handleStatus"
|
|
57
|
+
@remove:fencer="handleRemoveFencer"
|
|
58
|
+
@update:moveUp="handleMoveUp"
|
|
59
|
+
@update:moveDown="handleMoveDown"
|
|
60
|
+
@request:weaver-sign="openWeaverModal"
|
|
61
|
+
/>
|
|
62
|
+
</div>
|
|
63
|
+
<section v-if="waitlistCount > 0" class="mt-6 w-full">
|
|
64
|
+
<div class="mb-2 flex items-center justify-between">
|
|
65
|
+
<BaseText text="Waitlist" size="md" color="quaternary" weight="bold" />
|
|
66
|
+
<BaseText :text="waitlistSummary" size="sm" color="quinary" />
|
|
67
|
+
</div>
|
|
68
|
+
<div
|
|
69
|
+
v-for="(person, index) in sortedWaitlistedPersons"
|
|
70
|
+
:key="person.PersonId || person.Person?.PersonId || index"
|
|
71
|
+
class="mb-3"
|
|
72
|
+
>
|
|
73
|
+
<WaitlistFencerCard
|
|
74
|
+
:person="person"
|
|
75
|
+
:queuePosition="index + 1"
|
|
76
|
+
:isNextCheckedIn="person === nextCheckedInPerson"
|
|
77
|
+
@update:check-in="handleWaitlistCheckIn"
|
|
78
|
+
@request:weaver-sign="openWeaverModal"
|
|
79
|
+
@forward:toProfile="handleForwardToProfile"
|
|
80
|
+
@move:active="handleMoveWaitlistToActive"
|
|
81
|
+
@remove:fencer="handleRemoveWaitlistFencer"
|
|
82
|
+
/>
|
|
83
|
+
</div>
|
|
84
|
+
</section>
|
|
85
|
+
</section>
|
|
86
|
+
<div v-if="!loading && personsInTournament.length === 0" class="mb-10">
|
|
87
|
+
<div class="flex items-center border border-dropdownSelect rounded-lg shadow-lg bg-poolBox">
|
|
88
|
+
<BaseText
|
|
89
|
+
text="Remember to assign staff to your event!"
|
|
90
|
+
size="lg"
|
|
91
|
+
color="quaternary"
|
|
92
|
+
weight="bold"
|
|
93
|
+
class="w-full text-center py-2 px-8"
|
|
94
|
+
/>
|
|
95
|
+
</div>
|
|
96
|
+
<img alt="Small desert scene with wind blowing." class="w-60 mt-8 mx-auto" :src="emptyDesertIcon" />
|
|
97
|
+
<BaseText
|
|
98
|
+
:color="'primaryHighlight'"
|
|
99
|
+
:size="'lg'"
|
|
100
|
+
:text="'0 fencers have been added!'"
|
|
101
|
+
:weight="'normal'"
|
|
102
|
+
data-testid="text-num-events"
|
|
103
|
+
/>
|
|
104
|
+
<BaseText
|
|
105
|
+
:color="'primaryHighlight'"
|
|
106
|
+
:size="'md'"
|
|
107
|
+
:text="'Click Add New button to get started.'"
|
|
108
|
+
:weight="'normal'"
|
|
109
|
+
data-testid="text-num-events"
|
|
110
|
+
/>
|
|
111
|
+
</div>
|
|
112
|
+
</div>
|
|
113
|
+
</section>
|
|
114
|
+
</div>
|
|
115
|
+
<BaseModal
|
|
116
|
+
:show="showWeaverModal"
|
|
117
|
+
@update:show="
|
|
118
|
+
v => {
|
|
119
|
+
if (!v) closeWeaverModal();
|
|
120
|
+
}
|
|
121
|
+
"
|
|
122
|
+
headerText="Confirm Waiver Signature"
|
|
123
|
+
:bodyText="weaverModalBody"
|
|
124
|
+
buttonText="Waiver Signed!"
|
|
125
|
+
iconColor="dropdownSelect"
|
|
126
|
+
iconBackgroundColor="toggleBackground"
|
|
127
|
+
iconClass="ml-3"
|
|
128
|
+
iconName="fa-file-signature"
|
|
129
|
+
@submitModal="confirmWeaverSigned"
|
|
130
|
+
/>
|
|
131
|
+
</section>
|
|
132
|
+
</template>
|
|
133
|
+
|
|
134
|
+
<script>
|
|
135
|
+
import BaseText from '../../../Atoms/Text/BaseText.vue';
|
|
136
|
+
import emptyDesertIcon from '../../../../assets/empty_desert_icon.png';
|
|
137
|
+
import FencerCard from '../../../Organisms/Cards/FencerCard/FencerCard.vue';
|
|
138
|
+
import WaitlistFencerCard from '../../../Organisms/Cards/WaitlistFencerCard/WaitlistFencerCard.vue';
|
|
139
|
+
import EditEventsTopMenu from '../../Menus/EditEventsTopMenu/EditEventsTopMenu.vue';
|
|
140
|
+
import DropDownMenu from '../../../Organisms/ComplexInputs/DropDown/DropDownMenu.vue';
|
|
141
|
+
import FindOrAddPerson from '../../../Organisms/ComplexInputs/FindOrAddPerson/FindOrAddPerson.vue';
|
|
142
|
+
import AttendanceSummary from '../../../Organisms/Headers/AttendanceSummary/AttendanceSummary.vue';
|
|
143
|
+
import FencerCardSkeleton from '../../../Organisms/Skeletons/FencerCard/FencerCardSkeleton.vue';
|
|
144
|
+
import BaseModal from '../../../Molecules/Modals/BaseModal/BaseModal.vue';
|
|
145
|
+
import { tabs } from '../../../Util/tabs.js';
|
|
146
|
+
import { isWaitlistCheckedIn } from '../../../Util/waitlistAttendance.js';
|
|
147
|
+
|
|
148
|
+
const personSorters = {
|
|
149
|
+
Seed: (a, b) => (a.Seed || 0) - (b.Seed || 0),
|
|
150
|
+
FullName: (a, b) => a.Person.DisplayName.localeCompare(b.Person.DisplayName),
|
|
151
|
+
HEMARating: (a, b) => {
|
|
152
|
+
const ratingA = a.Person.HEMARatings?.[0]?.Rating || 0;
|
|
153
|
+
const ratingB = b.Person.HEMARatings?.[0]?.Rating || 0;
|
|
154
|
+
return ratingB - ratingA;
|
|
155
|
+
},
|
|
156
|
+
M2Rating: (a, b) => {
|
|
157
|
+
const m2RatingA = a.Person.M2Ratings?.[0]?.Rating || 'U00';
|
|
158
|
+
const m2RatingB = b.Person.M2Ratings?.[0]?.Rating || 'U00';
|
|
159
|
+
return m2RatingA.localeCompare(m2RatingB);
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
const waitlistStatuses = new Set(['waitlist', 'waitlisted', 'waitinglist']);
|
|
164
|
+
|
|
165
|
+
const normalizeStatus = status =>
|
|
166
|
+
String(status || '')
|
|
167
|
+
.toLocaleLowerCase()
|
|
168
|
+
.replace(/[\s_-]/g, '');
|
|
169
|
+
|
|
170
|
+
const isWaitlistedPerson = person => waitlistStatuses.has(normalizeStatus(person?.Status));
|
|
171
|
+
|
|
172
|
+
const getEventRuleValue = (event, ruleName) => {
|
|
173
|
+
const rule = event?.EventRules?.find(eventRule => eventRule?.Rules?.RuleName === ruleName);
|
|
174
|
+
return rule?.RuleValue;
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
const waitlistOrderFields = ['WaitlistPosition', 'WaitlistOrder', 'CreatedAt', 'Seed', 'PoolPosition'];
|
|
178
|
+
|
|
179
|
+
const getFirstDefinedFieldValue = (record, fieldNames, fallback) => {
|
|
180
|
+
const source = record || {};
|
|
181
|
+
const fieldName = fieldNames.find(name => source[name] !== null && source[name] !== undefined);
|
|
182
|
+
if (!fieldName) return fallback;
|
|
183
|
+
return source[fieldName];
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
const normalizeOrderValue = value => {
|
|
187
|
+
const numericValue = Number(value);
|
|
188
|
+
return Number.isNaN(numericValue) ? value : numericValue;
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
const getWaitlistOrderValue = person => {
|
|
192
|
+
const order = getFirstDefinedFieldValue(person, waitlistOrderFields, 0);
|
|
193
|
+
return normalizeOrderValue(order);
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
export default {
|
|
197
|
+
emits: [
|
|
198
|
+
'add:existing-person',
|
|
199
|
+
'add:person',
|
|
200
|
+
'forward:toProfile',
|
|
201
|
+
'move:waitlist-to-active',
|
|
202
|
+
'remove:fencer',
|
|
203
|
+
'remove:waitlist-fencer',
|
|
204
|
+
'tab:menu-click',
|
|
205
|
+
'update:moveDown',
|
|
206
|
+
'update:moveUp',
|
|
207
|
+
'update:person',
|
|
208
|
+
'update:waitlist-check-in',
|
|
209
|
+
'weaver:sign'
|
|
210
|
+
],
|
|
211
|
+
components: {
|
|
212
|
+
WaitlistFencerCard,
|
|
213
|
+
FencerCardSkeleton,
|
|
214
|
+
AttendanceSummary,
|
|
215
|
+
FindOrAddPerson,
|
|
216
|
+
DropDownMenu,
|
|
217
|
+
EditEventsTopMenu,
|
|
218
|
+
FencerCard,
|
|
219
|
+
BaseText,
|
|
220
|
+
BaseModal
|
|
221
|
+
},
|
|
222
|
+
props: {
|
|
223
|
+
personsAll: Array,
|
|
224
|
+
event: {
|
|
225
|
+
type: Object,
|
|
226
|
+
required: true,
|
|
227
|
+
default: () => ({})
|
|
228
|
+
},
|
|
229
|
+
fencingClubs: {
|
|
230
|
+
type: Array,
|
|
231
|
+
default: () => []
|
|
232
|
+
},
|
|
233
|
+
personsInTournament: {
|
|
234
|
+
type: Array,
|
|
235
|
+
default: () => []
|
|
236
|
+
},
|
|
237
|
+
loading: {
|
|
238
|
+
type: Boolean,
|
|
239
|
+
default: false
|
|
240
|
+
},
|
|
241
|
+
role: {
|
|
242
|
+
type: String,
|
|
243
|
+
default: 'Admin'
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
data() {
|
|
247
|
+
return {
|
|
248
|
+
emptyDesertIcon,
|
|
249
|
+
tabs,
|
|
250
|
+
windowWidth: window.innerWidth,
|
|
251
|
+
label: 'Sort by',
|
|
252
|
+
items: [
|
|
253
|
+
{ text: 'Seed', link: 'Seed' },
|
|
254
|
+
{ text: 'Name', link: 'FullName' },
|
|
255
|
+
{ text: 'M2Rating', link: 'M2Rating' },
|
|
256
|
+
{ text: 'HEMARating', link: 'HEMARating' }
|
|
257
|
+
],
|
|
258
|
+
localSelectedItem: { text: 'Seed', link: 'Seed' },
|
|
259
|
+
showWeaverModal: false,
|
|
260
|
+
pendingWeaverPerson: null
|
|
261
|
+
};
|
|
262
|
+
},
|
|
263
|
+
mounted() {
|
|
264
|
+
window.addEventListener('resize', this.handleResize);
|
|
265
|
+
},
|
|
266
|
+
beforeUnmount() {
|
|
267
|
+
window.removeEventListener('resize', this.handleResize);
|
|
268
|
+
},
|
|
269
|
+
computed: {
|
|
270
|
+
weaverModalBody() {
|
|
271
|
+
const p = this.pendingWeaverPerson?.Person;
|
|
272
|
+
const name = p?.DisplayName ?? 'This fencer';
|
|
273
|
+
return `Has ${name} completed signing the waiver?`;
|
|
274
|
+
},
|
|
275
|
+
isMobile() {
|
|
276
|
+
return this.windowWidth <= 748;
|
|
277
|
+
},
|
|
278
|
+
activePersons() {
|
|
279
|
+
if (!Array.isArray(this.personsInTournament) || this.personsInTournament.length === 0) {
|
|
280
|
+
return [];
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
return this.personsInTournament.filter(person => !isWaitlistedPerson(person));
|
|
284
|
+
},
|
|
285
|
+
waitlistedPersons() {
|
|
286
|
+
if (!Array.isArray(this.personsInTournament) || this.personsInTournament.length === 0) {
|
|
287
|
+
return [];
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
return this.personsInTournament.filter(isWaitlistedPerson);
|
|
291
|
+
},
|
|
292
|
+
sortedActivePersons() {
|
|
293
|
+
if (this.activePersons.length === 0) {
|
|
294
|
+
return [];
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
let sortedArray = [...this.activePersons]; // Clone array to prevent modifying props
|
|
298
|
+
|
|
299
|
+
sortedArray.sort((a, b) => {
|
|
300
|
+
if (!a || !b || !a.Person || !b.Person) {
|
|
301
|
+
console.warn('Undefined person object detected:', a, b);
|
|
302
|
+
return 0;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
const sortPersons = personSorters[this.localSelectedItem.link];
|
|
306
|
+
if (sortPersons) return sortPersons(a, b);
|
|
307
|
+
|
|
308
|
+
console.warn('Unknown sorting key:', this.localSelectedItem.link);
|
|
309
|
+
return 0;
|
|
310
|
+
});
|
|
311
|
+
return sortedArray;
|
|
312
|
+
},
|
|
313
|
+
sortedWaitlistedPersons() {
|
|
314
|
+
return [...this.waitlistedPersons].sort((a, b) => {
|
|
315
|
+
const orderA = getWaitlistOrderValue(a);
|
|
316
|
+
const orderB = getWaitlistOrderValue(b);
|
|
317
|
+
|
|
318
|
+
if (typeof orderA === 'number' && typeof orderB === 'number') {
|
|
319
|
+
return orderA - orderB;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
return String(orderA).localeCompare(String(orderB));
|
|
323
|
+
});
|
|
324
|
+
},
|
|
325
|
+
activeRosterCount() {
|
|
326
|
+
return this.activePersons.length;
|
|
327
|
+
},
|
|
328
|
+
waitlistCount() {
|
|
329
|
+
return this.waitlistedPersons.length;
|
|
330
|
+
},
|
|
331
|
+
waitlistCheckedInCount() {
|
|
332
|
+
return this.waitlistedPersons.filter(isWaitlistCheckedIn).length;
|
|
333
|
+
},
|
|
334
|
+
nextCheckedInPerson() {
|
|
335
|
+
return this.sortedWaitlistedPersons.find(isWaitlistCheckedIn) || null;
|
|
336
|
+
},
|
|
337
|
+
eventCapacity() {
|
|
338
|
+
const capacity =
|
|
339
|
+
this.event?.CutOffNumber ?? this.event?.MaxFencers ?? getEventRuleValue(this.event, 'CutOffNumber');
|
|
340
|
+
if (capacity === 0 || capacity === '0') {
|
|
341
|
+
return 'Unlimited';
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
return capacity || '';
|
|
345
|
+
},
|
|
346
|
+
activeRosterSummary() {
|
|
347
|
+
if (!this.eventCapacity) {
|
|
348
|
+
return `${this.activeRosterCount} active`;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
return `${this.activeRosterCount} / ${this.eventCapacity}`;
|
|
352
|
+
},
|
|
353
|
+
waitlistSummary() {
|
|
354
|
+
return `${this.waitlistCount} waiting · ${this.waitlistCheckedInCount} checked in`;
|
|
355
|
+
},
|
|
356
|
+
absent() {
|
|
357
|
+
return this.activePersons.filter(person => person.Status === 'Absent').length;
|
|
358
|
+
},
|
|
359
|
+
present() {
|
|
360
|
+
return this.activePersons.filter(person => person.Status === 'Present').length;
|
|
361
|
+
}
|
|
362
|
+
},
|
|
363
|
+
methods: {
|
|
364
|
+
openWeaverModal(person) {
|
|
365
|
+
this.pendingWeaverPerson = person;
|
|
366
|
+
this.showWeaverModal = true;
|
|
367
|
+
},
|
|
368
|
+
closeWeaverModal() {
|
|
369
|
+
this.showWeaverModal = false;
|
|
370
|
+
this.pendingWeaverPerson = null;
|
|
371
|
+
},
|
|
372
|
+
confirmWeaverSigned() {
|
|
373
|
+
this.$emit('weaver:sign', this.pendingWeaverPerson);
|
|
374
|
+
this.closeWeaverModal();
|
|
375
|
+
},
|
|
376
|
+
handleSelectedItem(selectedItem) {
|
|
377
|
+
this.localSelectedItem = selectedItem;
|
|
378
|
+
},
|
|
379
|
+
handleStatus(person) {
|
|
380
|
+
this.$emit('update:person', person);
|
|
381
|
+
},
|
|
382
|
+
handleNewPerson(value) {
|
|
383
|
+
this.$emit('add:person', value);
|
|
384
|
+
},
|
|
385
|
+
handleAddExistingPerson(value) {
|
|
386
|
+
this.$emit('add:existing-person', value);
|
|
387
|
+
},
|
|
388
|
+
handleTabMenuClick(value) {
|
|
389
|
+
this.$emit('tab:menu-click', value);
|
|
390
|
+
},
|
|
391
|
+
handleRemoveFencer(value) {
|
|
392
|
+
this.$emit('remove:fencer', value);
|
|
393
|
+
},
|
|
394
|
+
handleWaitlistCheckIn(person) {
|
|
395
|
+
this.$emit('update:waitlist-check-in', person);
|
|
396
|
+
},
|
|
397
|
+
handleMoveWaitlistToActive(person) {
|
|
398
|
+
this.$emit('move:waitlist-to-active', person);
|
|
399
|
+
},
|
|
400
|
+
handleRemoveWaitlistFencer(person) {
|
|
401
|
+
this.$emit('remove:waitlist-fencer', person);
|
|
402
|
+
},
|
|
403
|
+
handleMoveUp(person) {
|
|
404
|
+
this.$emit('update:moveUp', person);
|
|
405
|
+
},
|
|
406
|
+
handleMoveDown(person) {
|
|
407
|
+
this.$emit('update:moveDown', person);
|
|
408
|
+
},
|
|
409
|
+
handleForwardToProfile(personId) {
|
|
410
|
+
this.$emit('forward:toProfile', personId);
|
|
411
|
+
},
|
|
412
|
+
handleResize() {
|
|
413
|
+
this.windowWidth = window.innerWidth;
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
};
|
|
417
|
+
</script>
|