@dcrackel/hematournamentui 1.0.711 → 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.
Files changed (109) hide show
  1. package/.prettierignore +7 -7
  2. package/.storybook/main.js +3 -1
  3. package/README.md +182 -148
  4. package/dist/HemaTournamentUI-lib.es.js +4150 -4039
  5. package/dist/HemaTournamentUI-lib.umd.js +27 -27
  6. package/dist/hematournamentui-tailwind.css +11 -0
  7. package/package.json +96 -96
  8. package/prettier.config.js +16 -16
  9. package/src/main.js +1 -1
  10. package/src/mocks/getDEBouts-TableOf128.js +37 -37
  11. package/src/mocks/getDEBouts-TableOf64.js +35 -35
  12. package/src/stories/Atoms/Input/BaseInput.test.js +97 -97
  13. package/src/stories/Atoms/Input/BaseInput.vue +149 -149
  14. package/src/stories/Molecules/Indicators/MissingHemaRatingsId/MissingHemaRatingsId.stories.js +23 -23
  15. package/src/stories/Molecules/Indicators/MissingHemaRatingsId/MissingHemaRatingsId.vue +35 -35
  16. package/src/stories/Molecules/Indicators/RegistrationStatus/RegistrationStatus.vue +30 -0
  17. package/src/stories/Molecules/Menus/HoverActions/HoverActions.test.js +138 -0
  18. package/src/stories/Molecules/Menus/HoverActions/HoverActions.vue +212 -0
  19. package/src/stories/Molecules/Modals/DirectorModal/DirectorModal.stories.js +6 -0
  20. package/src/stories/Molecules/Modals/DirectorModal/DirectorModal.test.js +18 -18
  21. package/src/stories/Molecules/Modals/DirectorModal/DirectorModal.vue +1 -1
  22. package/src/stories/Organisms/Cards/BoutCard/BoutCard.vue +5 -1
  23. package/src/stories/Organisms/Cards/BoutCard/Variants/BoutCardActive/BoutCardActive.vue +19 -10
  24. package/src/stories/Organisms/Cards/BoutCard/Variants/BoutCardInactive/BoutCardInactive.vue +11 -7
  25. package/src/stories/Organisms/Cards/BracketDirectorAssignmentCard/BracketDirectorAssignmentCard.stories.js +33 -33
  26. package/src/stories/Organisms/Cards/BracketDirectorAssignmentCard/BracketDirectorAssignmentCard.test.js +45 -45
  27. package/src/stories/Organisms/Cards/BracketDirectorAssignmentCard/BracketDirectorAssignmentCard.vue +103 -103
  28. package/src/stories/Organisms/Cards/Director/DirectorCard.test.js +82 -0
  29. package/src/stories/Organisms/Cards/Director/DirectorCard.vue +32 -51
  30. package/src/stories/Organisms/Cards/EditBout/EditBout.test.js +51 -51
  31. package/src/stories/Organisms/Cards/EventCard/EventCard.stories.js +41 -1
  32. package/src/stories/Organisms/Cards/EventCard/EventCard.test.js +106 -0
  33. package/src/stories/Organisms/Cards/EventCard/EventCard.vue +62 -30
  34. package/src/stories/Organisms/Cards/FencerCard/FencerCard.vue +298 -298
  35. package/src/stories/Organisms/Cards/TableauBoutCard/TableauBoutCard.stories.js +77 -60
  36. package/src/stories/Organisms/Cards/TableauBoutCard/TableauBoutCard.test.js +144 -143
  37. package/src/stories/Organisms/Cards/TableauBoutCard/TableauBoutCard.vue +289 -256
  38. package/src/stories/Organisms/Cards/TableauFencerCard/TableauFencerCard.stories.js +69 -69
  39. package/src/stories/Organisms/Cards/TableauFencerCard/TableauFencerCard.vue +80 -80
  40. package/src/stories/Organisms/Cards/WaitlistFencerCard/WaitlistFencerCard.vue +153 -153
  41. package/src/stories/Organisms/ComplexInputs/DropDown/DropDownMenu.vue +4 -0
  42. package/src/stories/Organisms/ComplexInputs/ImageCropper/ImageCropper.stories.js +31 -31
  43. package/src/stories/Organisms/ComplexInputs/ImageCropper/ImageCropper.test.js +109 -109
  44. package/src/stories/Organisms/ComplexInputs/ImageCropper/ImageCropper.vue +192 -192
  45. package/src/stories/Organisms/Containers/Tableau/Tableau.stories.js +1 -0
  46. package/src/stories/Organisms/Containers/Tableau/Tableau.test.js +247 -204
  47. package/src/stories/Organisms/Containers/Tableau/Tableau.vue +89 -15
  48. package/src/stories/Organisms/Containers/Tableau/components/BracketDirectorAssignmentPanel.test.js +29 -29
  49. package/src/stories/Organisms/Containers/Tableau/components/BracketDirectorAssignmentPanel.vue +46 -46
  50. package/src/stories/Organisms/Containers/Tableau/components/TableauSvgOverlay.test.js +21 -21
  51. package/src/stories/Organisms/Containers/Tableau/components/TableauSvgOverlay.vue +39 -39
  52. package/src/stories/Organisms/Containers/Tableau/layout/TableauLayoutEngine.js +145 -145
  53. package/src/stories/Organisms/Containers/Tableau/layout/TableauLayoutEngine.test.js +64 -64
  54. package/src/stories/Organisms/Containers/Tableau/plannedAssignments.js +36 -57
  55. package/src/stories/Organisms/Containers/Tableau/plannedAssignments.test.js +101 -65
  56. package/src/stories/Organisms/Containers/TableauColumn/TableauColumn.vue +14 -1
  57. package/src/stories/Organisms/Headers/AttendanceSummary/AttendanceSummary.vue +12 -5
  58. package/src/stories/Organisms/Wizards/EditEventWizard/BasicEventInfo/BasicEventInfo.stories.js +52 -48
  59. package/src/stories/Organisms/Wizards/EditEventWizard/BasicEventInfo/BasicEventInfo.vue +256 -227
  60. package/src/stories/Organisms/Wizards/EditEventWizard/DirectElimination/DirectElimination.vue +226 -226
  61. package/src/stories/Organisms/Wizards/EditEventWizard/DirectEliminationPromotion/DirectEliminationPromotion.vue +204 -204
  62. package/src/stories/Organisms/Wizards/EditEventWizard/EditEventWizard.stories.js +137 -133
  63. package/src/stories/Organisms/Wizards/EditEventWizard/EditEventWizard.test.js +221 -191
  64. package/src/stories/Organisms/Wizards/EditEventWizard/EditEventWizard.vue +372 -366
  65. package/src/stories/Organisms/Wizards/EditEventWizard/EventCustomization/EventCustomization.vue +172 -172
  66. package/src/stories/Organisms/Wizards/EditEventWizard/PoolConfiguration/PoolConfiguration.vue +216 -216
  67. package/src/stories/Organisms/Wizards/EditEventWizard/PriceFields.test.js +79 -79
  68. package/src/stories/Organisms/Wizards/EditEventWizard/RuleSerialization.test.js +29 -0
  69. package/src/stories/Organisms/Wizards/EditEventWizard/WeaponSelection.test.js +138 -0
  70. package/src/stories/Templates/EventManagement/Bracket/Bracket.stories.js +123 -12
  71. package/src/stories/Templates/EventManagement/Bracket/Bracket.test.js +178 -166
  72. package/src/stories/Templates/EventManagement/Bracket/Bracket.vue +35 -7
  73. package/src/stories/Templates/EventManagement/Bracket/BracketDirectorAssignment.test.js +242 -0
  74. package/src/stories/Templates/EventManagement/Bracket/BracketMobile.test.js +131 -0
  75. package/src/stories/Templates/EventManagement/Bracket/BracketPlannedSuggestions.js +42 -39
  76. package/src/stories/Templates/EventManagement/Bracket/BracketStories.test.js +80 -0
  77. package/src/stories/Templates/EventManagement/Bracket/BracketStoryAssignments.js +93 -0
  78. package/src/stories/Templates/EventManagement/Bracket/BracketStoryAssignments.test.js +152 -0
  79. package/src/stories/Templates/EventManagement/Bracket/BracketStoryHarness.js +39 -39
  80. package/src/stories/Templates/EventManagement/Bracket/BracketStoryHarness.test.js +79 -79
  81. package/src/stories/Templates/EventManagement/EditEventInfo/EditEventInfo.stories.js +93 -93
  82. package/src/stories/Templates/EventManagement/EditEventInfo/EditEventInfo.vue +91 -91
  83. package/src/stories/Templates/EventManagement/EventAttendance/EventAttendance.stories.js +31 -1
  84. package/src/stories/Templates/EventManagement/PoolLive/PoolLive.test.js +121 -121
  85. package/src/stories/Templates/Menus/EditEventsTopMenu/EditEventsTopMenu.stories.js +9 -2
  86. package/src/stories/Templates/Menus/EditEventsTopMenu/EditEventsTopMenu.vue +5 -4
  87. package/src/stories/Templates/PersonManagement/Admin/Administration/Administration.stories.js +81 -81
  88. package/src/stories/Templates/PersonManagement/Admin/Administration/Administration.test.js +39 -39
  89. package/src/stories/Templates/PersonManagement/Admin/Administration/Administration.vue +101 -101
  90. package/src/stories/Templates/PersonManagement/Admin/FencerAdmin/FencerAdmin.stories.js +71 -71
  91. package/src/stories/Templates/PersonManagement/Admin/FencerAdmin/FencerAdmin.vue +86 -86
  92. package/src/stories/Templates/PersonManagement/Admin/MergeAccounts/MergeAccounts.stories.js +86 -86
  93. package/src/stories/Templates/PersonManagement/Admin/MergeAccounts/MergeAccounts.vue +247 -247
  94. package/src/stories/Templates/PersonManagement/Basic/BasicEdit.vue +170 -170
  95. package/src/stories/Templates/PersonManagement/PersonManagement.stories.js +156 -156
  96. package/src/stories/Templates/PersonManagement/PersonManagement.test.js +329 -329
  97. package/src/stories/Templates/PersonManagement/PersonManagement.vue +329 -329
  98. package/src/stories/Templates/PersonManagement/PersonManagementDraft.js +42 -42
  99. package/src/stories/Templates/TournamentManagement/ListEvents/ListEvents.stories.js +58 -45
  100. package/src/stories/Templates/TournamentManagement/TournamentManagement.stories.js +84 -84
  101. package/src/stories/Templates/TournamentManagement/TournamentManagement.test.js +114 -114
  102. package/src/stories/Templates/TournamentManagement/TournamentManagement.vue +363 -363
  103. package/src/stories/Templates/TournamentManagement/TournamentPageOne/TournamentPageOne.stories.js +116 -116
  104. package/src/stories/Templates/TournamentManagement/TournamentPageOne/TournamentPageOne.vue +307 -307
  105. package/src/stories/Util/Validations/PersonManagementValidations.js +45 -45
  106. package/src/stories/Util/Validations/PriceValidation.js +6 -6
  107. package/src/stories/Util/boutDirectorAssignment.js +46 -0
  108. package/src/stories/Util/registrationStatus.js +11 -0
  109. package/src/stories/Util/tabs.js +19 -47
@@ -1,298 +1,298 @@
1
- <template>
2
- <div
3
- v-if="person"
4
- class="flex items-center border border-dropdownSelect rounded-lg shadow-lg bg-white hover:border-bright"
5
- >
6
- <div class="hidden md:block mr-4 border-r border-dropdownSelect h-20 w-10 items-center text-center">
7
- <BaseIcon
8
- v-if="isEdit"
9
- icon-name="fa-caret-up"
10
- size="xl"
11
- :color="person.PoolPosition === 1 ? 'neutral' : 'quinary'"
12
- :hover="person.PoolPosition === 1 ? 'neutral' : 'bright'"
13
- class="m-0"
14
- @click="handelMoveUp"
15
- />
16
- <BaseText
17
- :text="person.PoolPosition"
18
- :size="isEdit ? 'lg' : '2xl'"
19
- color="quaternary"
20
- weight="bold"
21
- :class="isEdit ? '-mt-0.5 -mb-0.5' : 'mt-5'"
22
- />
23
- <BaseIcon
24
- v-if="isEdit"
25
- icon-name="fa-caret-down"
26
- size="xl"
27
- :color="isLast ? 'neutral' : 'quinary'"
28
- :hover="isLast ? 'neutral' : 'bright'"
29
- @click="handelMoveDown"
30
- />
31
- </div>
32
- <div class="bock md:hidden mr-4 border-r border-dropdownSelect h-16 w-5 items-center text-center">
33
- <BaseIcon
34
- v-if="isEdit"
35
- icon-name="fa-caret-up"
36
- size="sm"
37
- :color="person.PoolPosition === 1 ? 'neutral' : 'quinary'"
38
- :hover="person.PoolPosition === 1 ? 'neutral' : 'bright'"
39
- class="m-0"
40
- @click="handelMoveUp"
41
- />
42
- <BaseText
43
- :text="person.PoolPosition"
44
- :size="isEdit ? 'sm' : 'md'"
45
- color="quaternary"
46
- weight="bold"
47
- :class="isEdit ? '-mt-0.5 -mb-0.5' : 'mt-5'"
48
- />
49
- <BaseIcon
50
- v-if="isEdit"
51
- icon-name="fa-caret-down"
52
- size="sm"
53
- :color="isLast ? 'neutral' : 'quinary'"
54
- :hover="isLast ? 'neutral' : 'bright'"
55
- @click="handelMoveDown"
56
- />
57
- </div>
58
-
59
- <div class="hidden md:block mr-4">
60
- <div v-if="!portraitURL" class="w-14 h-14 r ounded-xl bg-dropdownSelect flex items-center justify-center">
61
- <BaseText text="" size="sm" color="neutral" weight="bold" />
62
- </div>
63
- <img v-if="portraitURL" :src="portraitURL" alt="Portrait" class="w-14 h-14 rounded-xl" />
64
- </div>
65
-
66
- <div class="flex flex-col w-3/4 md:w-4/12 justify-start">
67
- <span class="flex justify-start overflow-hidden">
68
- <BaseText
69
- :text="person.Person.DisplayName"
70
- size="md"
71
- color="quaternary"
72
- weight="bold"
73
- class="text-sm md:text-xl"
74
- />
75
- </span>
76
- <span class="w-full flex justify-start">
77
- <BaseText :text="person.Person.Club.Name" size="md" color="quinary" weight="normal" class="hidden md:block" />
78
- <BaseText
79
- :text="person.Person.Club.ShortName"
80
- size="xs"
81
- color="quinary"
82
- weight="normal"
83
- class="block md:hidden"
84
- />
85
- </span>
86
-
87
- <div class="grid md:hidden grid-cols-2 gap-x-4 mr-10">
88
- <div class="flex">
89
- <BaseText text="M²: " size="xs" color="quaternary" weight="normal" class="mr-1" />
90
- <BaseText :text="M2Rating" size="xs" color="quinary" weight="bold" class="ml-1" />
91
- </div>
92
- <div class="flex">
93
- <BaseText text="HR: " size="xs" color="quaternary" weight="normal" class="mr-1" />
94
- <BaseText :text="HEMARating" size="xs" color="quinary" weight="bold" class="ml-1" />
95
- </div>
96
- </div>
97
- </div>
98
-
99
- <div class="hidden md:grid grid-col ls-2 gap-x-4 mr-4 w-36">
100
- <div class="flex">
101
- <BaseText text="M2Rating:" size="sm" color="quaternary" weight="normal" class="mr-2" />
102
- <BaseText :text="M2Rating" size="sm" color="quinary" weight="bold" class="pt-0.5" />
103
- </div>
104
- <div class="flex">
105
- <BaseText text="HemaRating:" size="sm" color="quaternary" weight="normal" class="mr-2" />
106
- <BaseText :text="HEMARating" size="sm" color="quinary" weight="bold" />
107
- </div>
108
- </div>
109
-
110
- <div class="mr-2 md:mr-4 md:ml-auto flex flex-row items-center">
111
- <div class="mr-2 md:mr-6 w-6 md:w-7 shrink-0">
112
- <span
113
- v-if="hasMissingHemaRatingsId"
114
- role="img"
115
- aria-label="Missing HEMA Ratings ID"
116
- title="Missing HEMA Ratings ID"
117
- class="flex items-center justify-center text-darkgray"
118
- >
119
- <svg class="h-6 w-6 md:h-7 md:w-7" viewBox="0 0 32 32" fill="none" aria-hidden="true">
120
- <circle cx="16" cy="16" r="13" stroke="currentColor" stroke-width="2" />
121
- <text x="16" y="20" text-anchor="middle" fill="currentColor" font-size="11" class="font-bold">HR</text>
122
- <path d="M7 25 25 7" stroke="currentColor" stroke-width="2" stroke-linecap="round" />
123
- </svg>
124
- </span>
125
- </div>
126
- <div class="flex justify-center w-20">
127
- <BaseButton
128
- label="Edit"
129
- size="xs"
130
- color="quinary"
131
- class="hidden md:block mr-10 h-9 mt-1"
132
- @buttonClick="handleForwardToProfile"
133
- />
134
- </div>
135
- <div class="w-44 flex justify-end">
136
- <BaseButton
137
- v-if="isEdit && weaverRequired && !weaverSigned"
138
- label="Sign Waiver"
139
- size="xs"
140
- color="quinary"
141
- class="border border-dropdownSelect shadow-md rounded-l-lg bg-natural w-40 m-0! p-0! h-10"
142
- @buttonClick="requestWeaverSign"
143
- />
144
-
145
- <ButtonBar
146
- v-else
147
- :buttons="buttons"
148
- :selected="computedSelected"
149
- @update:selected="handleAttendance"
150
- class="mr-1 h-10"
151
- />
152
- </div>
153
- </div>
154
- <div
155
- class="block md:ml-4 border-l border-dropdownSelect h-16 w-9 md:h-20 md:w-10 items-center text-center hover:bg-eventBoxRed rounded-tr-lg rounded-br-lg pt-5 md:pt-6"
156
- >
157
- <BaseIcon
158
- v-if="!showSpinner"
159
- icon-name="fa-circle-xmark"
160
- size=""
161
- color="quinary"
162
- hover="alarm"
163
- @click="handlerRemoveFencer"
164
- class="text-md md:text-2xl"
165
- />
166
- <BaseIcon
167
- v-if="showSpinner"
168
- icon-name="fa-spinner-third"
169
- size=""
170
- color="alarm"
171
- class="animate-spin text-md md:text-2xl"
172
- hover="alarm"
173
- />
174
- </div>
175
- </div>
176
- </template>
177
-
178
- <script>
179
- import BaseText from '../../../Atoms/Text/BaseText.vue';
180
- import ButtonBar from '../../../Molecules/Buttons/ButtonBar/ButtonBar.vue';
181
- import BaseIcon from '../../../Atoms/Icon/BaseIcon.vue';
182
- import BaseButton from '../../../Molecules/Buttons/BaseButton/BaseButton.vue';
183
-
184
- export default {
185
- name: 'FencerCard',
186
- emits: [
187
- 'forward:toProfile',
188
- 'remove:fencer',
189
- 'request:weaver-sign',
190
- 'update:moveDown',
191
- 'update:moveUp',
192
- 'update:status',
193
- 'weaver:required'
194
- ],
195
- components: { BaseButton, BaseIcon, ButtonBar, BaseText },
196
- props: {
197
- person: {
198
- type: Object,
199
- required: true
200
- },
201
- isLast: {
202
- type: Boolean,
203
- required: false,
204
- default: false
205
- },
206
- isEdit: {
207
- type: Boolean,
208
- required: false,
209
- default: false
210
- }
211
- },
212
- computed: {
213
- hasMissingHemaRatingsId() {
214
- const person = this.person?.Person;
215
- const id = Number(person?.HemaRatingsId ?? person?.HEMARatings?.[0]?.HemaRatingId);
216
- return !Number.isInteger(id) || id <= 0;
217
- },
218
- weaver() {
219
- return this.person?.Person?.Weaver ?? { Required: false, Scope: 'none', Signed: true, SignedAt: null };
220
- },
221
- weaverRequired() {
222
- return !!this.weaver.Required && (this.weaver.Scope ?? 'none') !== 'none';
223
- },
224
- weaverSigned() {
225
- return this.weaverRequired ? this.localWeaverSigned : true;
226
- },
227
- portraitURL() {
228
- const images = this.person.Person.Images || [];
229
- const portrait = images.find(image => image.Type === 'Portrait');
230
- return portrait ? portrait.URL : '';
231
- },
232
- buttons() {
233
- return [
234
- { id: 'Absent', label: 'Absent', defaultBgColor: 'bg-natural', selectedBgColor: 'bg-eventBoxBlueTwo' },
235
- { id: 'Present', label: 'Present', defaultBgColor: 'bg-natural', selectedBgColor: 'bg-eventBoxGreenTwo' }
236
- ];
237
- },
238
- HEMARating() {
239
- if (!this.person.Person.HEMARatings || this.person.Person.HEMARatings.length === 0) {
240
- return 0;
241
- }
242
- return this.person.Person.HEMARatings[0].Rating;
243
- },
244
- M2Rating() {
245
- if (!this.person.Person.M2Ratings || this.person.Person.M2Ratings.length === 0) {
246
- return 'U';
247
- }
248
- return this.person.Person.M2Ratings[0].Rating;
249
- },
250
- computedSelected() {
251
- return this.person.Status === 'Absent' ? 'Absent' : 'Present';
252
- }
253
- },
254
- data() {
255
- return {
256
- showSpinner: false,
257
- localWeaverSigned: false
258
- };
259
- },
260
- watch: {
261
- person: {
262
- immediate: true,
263
- deep: true,
264
- handler(newVal) {
265
- const signed = newVal?.Person?.Weaver?.Signed;
266
- this.localWeaverSigned = Boolean(signed ?? false);
267
- }
268
- }
269
- },
270
- methods: {
271
- requestWeaverSign() {
272
- this.$emit('request:weaver-sign', this.person);
273
- },
274
- handleAttendance(selected) {
275
- if (selected === 'Present' && this.weaverRequired && !this.weaverSigned) {
276
- this.$emit('weaver:required', this.person);
277
- return;
278
- }
279
-
280
- const person = { ...this.person, Status: selected };
281
- this.$emit('update:status', person);
282
- },
283
- handlerRemoveFencer() {
284
- this.showSpinner = true;
285
- this.$emit('remove:fencer', this.person);
286
- },
287
- handelMoveUp() {
288
- if (this.person.PoolPosition > 1) this.$emit('update:moveUp', this.person);
289
- },
290
- handelMoveDown() {
291
- if (!this.isLast) this.$emit('update:moveDown', this.person);
292
- },
293
- handleForwardToProfile() {
294
- this.$emit('forward:toProfile', this.person.PersonId);
295
- }
296
- }
297
- };
298
- </script>
1
+ <template>
2
+ <div
3
+ v-if="person"
4
+ class="flex items-center border border-dropdownSelect rounded-lg shadow-lg bg-white hover:border-bright"
5
+ >
6
+ <div class="hidden md:block mr-4 border-r border-dropdownSelect h-20 w-10 items-center text-center">
7
+ <BaseIcon
8
+ v-if="isEdit"
9
+ icon-name="fa-caret-up"
10
+ size="xl"
11
+ :color="person.PoolPosition === 1 ? 'neutral' : 'quinary'"
12
+ :hover="person.PoolPosition === 1 ? 'neutral' : 'bright'"
13
+ class="m-0"
14
+ @click="handelMoveUp"
15
+ />
16
+ <BaseText
17
+ :text="person.PoolPosition"
18
+ :size="isEdit ? 'lg' : '2xl'"
19
+ color="quaternary"
20
+ weight="bold"
21
+ :class="isEdit ? '-mt-0.5 -mb-0.5' : 'mt-5'"
22
+ />
23
+ <BaseIcon
24
+ v-if="isEdit"
25
+ icon-name="fa-caret-down"
26
+ size="xl"
27
+ :color="isLast ? 'neutral' : 'quinary'"
28
+ :hover="isLast ? 'neutral' : 'bright'"
29
+ @click="handelMoveDown"
30
+ />
31
+ </div>
32
+ <div class="bock md:hidden mr-4 border-r border-dropdownSelect h-16 w-5 items-center text-center">
33
+ <BaseIcon
34
+ v-if="isEdit"
35
+ icon-name="fa-caret-up"
36
+ size="sm"
37
+ :color="person.PoolPosition === 1 ? 'neutral' : 'quinary'"
38
+ :hover="person.PoolPosition === 1 ? 'neutral' : 'bright'"
39
+ class="m-0"
40
+ @click="handelMoveUp"
41
+ />
42
+ <BaseText
43
+ :text="person.PoolPosition"
44
+ :size="isEdit ? 'sm' : 'md'"
45
+ color="quaternary"
46
+ weight="bold"
47
+ :class="isEdit ? '-mt-0.5 -mb-0.5' : 'mt-5'"
48
+ />
49
+ <BaseIcon
50
+ v-if="isEdit"
51
+ icon-name="fa-caret-down"
52
+ size="sm"
53
+ :color="isLast ? 'neutral' : 'quinary'"
54
+ :hover="isLast ? 'neutral' : 'bright'"
55
+ @click="handelMoveDown"
56
+ />
57
+ </div>
58
+
59
+ <div class="hidden md:block mr-4">
60
+ <div v-if="!portraitURL" class="w-14 h-14 rounded-xl bg-dropdownSelect flex items-center justify-center">
61
+ <BaseText text="" size="sm" color="neutral" weight="bold" />
62
+ </div>
63
+ <img v-if="portraitURL" :src="portraitURL" alt="Portrait" class="w-14 h-14 rounded-xl" />
64
+ </div>
65
+
66
+ <div class="flex flex-col w-3/4 md:w-4/12 justify-start">
67
+ <span class="flex justify-start overflow-hidden">
68
+ <BaseText
69
+ :text="person.Person.DisplayName"
70
+ size="md"
71
+ color="quaternary"
72
+ weight="bold"
73
+ class="text-sm md:text-xl"
74
+ />
75
+ </span>
76
+ <span class="w-full flex justify-start">
77
+ <BaseText :text="person.Person.Club.Name" size="md" color="quinary" weight="normal" class="hidden md:block" />
78
+ <BaseText
79
+ :text="person.Person.Club.ShortName"
80
+ size="xs"
81
+ color="quinary"
82
+ weight="normal"
83
+ class="block md:hidden"
84
+ />
85
+ </span>
86
+
87
+ <div class="grid md:hidden grid-cols-2 gap-x-4 mr-10">
88
+ <div class="flex">
89
+ <BaseText text="M²: " size="xs" color="quaternary" weight="normal" class="mr-1" />
90
+ <BaseText :text="M2Rating" size="xs" color="quinary" weight="bold" class="ml-1" />
91
+ </div>
92
+ <div class="flex">
93
+ <BaseText text="HR: " size="xs" color="quaternary" weight="normal" class="mr-1" />
94
+ <BaseText :text="HEMARating" size="xs" color="quinary" weight="bold" class="ml-1" />
95
+ </div>
96
+ </div>
97
+ </div>
98
+
99
+ <div class="hidden md:grid grid-col ls-2 gap-x-4 mr-4 w-36">
100
+ <div class="flex">
101
+ <BaseText text="M2Rating:" size="sm" color="quaternary" weight="normal" class="mr-2" />
102
+ <BaseText :text="M2Rating" size="sm" color="quinary" weight="bold" class="pt-0.5" />
103
+ </div>
104
+ <div class="flex">
105
+ <BaseText text="HemaRating:" size="sm" color="quaternary" weight="normal" class="mr-2" />
106
+ <BaseText :text="HEMARating" size="sm" color="quinary" weight="bold" />
107
+ </div>
108
+ </div>
109
+
110
+ <div class="mr-2 md:mr-4 md:ml-auto flex flex-row items-center">
111
+ <div class="mr-2 md:mr-6 w-6 md:w-7 shrink-0">
112
+ <span
113
+ v-if="hasMissingHemaRatingsId"
114
+ role="img"
115
+ aria-label="Missing HEMA Ratings ID"
116
+ title="Missing HEMA Ratings ID"
117
+ class="flex items-center justify-center text-darkgray"
118
+ >
119
+ <svg class="h-6 w-6 md:h-7 md:w-7" viewBox="0 0 32 32" fill="none" aria-hidden="true">
120
+ <circle cx="16" cy="16" r="13" stroke="currentColor" stroke-width="2" />
121
+ <text x="16" y="20" text-anchor="middle" fill="currentColor" font-size="11" class="font-bold">HR</text>
122
+ <path d="M7 25 25 7" stroke="currentColor" stroke-width="2" stroke-linecap="round" />
123
+ </svg>
124
+ </span>
125
+ </div>
126
+ <div class="flex justify-center w-20">
127
+ <BaseButton
128
+ label="Edit"
129
+ size="xs"
130
+ color="quinary"
131
+ class="hidden md:block mr-10 h-9 mt-1"
132
+ @buttonClick="handleForwardToProfile"
133
+ />
134
+ </div>
135
+ <div class="w-44 flex justify-end">
136
+ <BaseButton
137
+ v-if="isEdit && weaverRequired && !weaverSigned"
138
+ label="Sign Waiver"
139
+ size="xs"
140
+ color="quinary"
141
+ class="border border-dropdownSelect shadow-md rounded-l-lg bg-natural w-40 m-0! p-0! h-10"
142
+ @buttonClick="requestWeaverSign"
143
+ />
144
+
145
+ <ButtonBar
146
+ v-else
147
+ :buttons="buttons"
148
+ :selected="computedSelected"
149
+ @update:selected="handleAttendance"
150
+ class="mr-1 h-10"
151
+ />
152
+ </div>
153
+ </div>
154
+ <div
155
+ class="block md:ml-4 border-l border-dropdownSelect h-16 w-9 md:h-20 md:w-10 items-center text-center hover:bg-eventBoxRed rounded-tr-lg rounded-br-lg pt-5 md:pt-6"
156
+ >
157
+ <BaseIcon
158
+ v-if="!showSpinner"
159
+ icon-name="fa-circle-xmark"
160
+ size=""
161
+ color="quinary"
162
+ hover="alarm"
163
+ @click="handlerRemoveFencer"
164
+ class="text-md md:text-2xl"
165
+ />
166
+ <BaseIcon
167
+ v-if="showSpinner"
168
+ icon-name="fa-spinner-third"
169
+ size=""
170
+ color="alarm"
171
+ class="animate-spin text-md md:text-2xl"
172
+ hover="alarm"
173
+ />
174
+ </div>
175
+ </div>
176
+ </template>
177
+
178
+ <script>
179
+ import BaseText from '../../../Atoms/Text/BaseText.vue';
180
+ import ButtonBar from '../../../Molecules/Buttons/ButtonBar/ButtonBar.vue';
181
+ import BaseIcon from '../../../Atoms/Icon/BaseIcon.vue';
182
+ import BaseButton from '../../../Molecules/Buttons/BaseButton/BaseButton.vue';
183
+
184
+ export default {
185
+ name: 'FencerCard',
186
+ emits: [
187
+ 'forward:toProfile',
188
+ 'remove:fencer',
189
+ 'request:weaver-sign',
190
+ 'update:moveDown',
191
+ 'update:moveUp',
192
+ 'update:status',
193
+ 'weaver:required'
194
+ ],
195
+ components: { BaseButton, BaseIcon, ButtonBar, BaseText },
196
+ props: {
197
+ person: {
198
+ type: Object,
199
+ required: true
200
+ },
201
+ isLast: {
202
+ type: Boolean,
203
+ required: false,
204
+ default: false
205
+ },
206
+ isEdit: {
207
+ type: Boolean,
208
+ required: false,
209
+ default: false
210
+ }
211
+ },
212
+ computed: {
213
+ hasMissingHemaRatingsId() {
214
+ const person = this.person?.Person;
215
+ const id = Number(person?.HemaRatingsId ?? person?.HEMARatings?.[0]?.HemaRatingId);
216
+ return !Number.isInteger(id) || id <= 0;
217
+ },
218
+ weaver() {
219
+ return this.person?.Person?.Weaver ?? { Required: false, Scope: 'none', Signed: true, SignedAt: null };
220
+ },
221
+ weaverRequired() {
222
+ return !!this.weaver.Required && (this.weaver.Scope ?? 'none') !== 'none';
223
+ },
224
+ weaverSigned() {
225
+ return this.weaverRequired ? this.localWeaverSigned : true;
226
+ },
227
+ portraitURL() {
228
+ const images = this.person.Person.Images || [];
229
+ const portrait = images.find(image => image.Type === 'Portrait');
230
+ return portrait ? portrait.URL : '';
231
+ },
232
+ buttons() {
233
+ return [
234
+ { id: 'Absent', label: 'Absent', defaultBgColor: 'bg-natural', selectedBgColor: 'bg-eventBoxBlueTwo' },
235
+ { id: 'Present', label: 'Present', defaultBgColor: 'bg-natural', selectedBgColor: 'bg-eventBoxGreenTwo' }
236
+ ];
237
+ },
238
+ HEMARating() {
239
+ if (!this.person.Person.HEMARatings || this.person.Person.HEMARatings.length === 0) {
240
+ return 0;
241
+ }
242
+ return this.person.Person.HEMARatings[0].Rating;
243
+ },
244
+ M2Rating() {
245
+ if (!this.person.Person.M2Ratings || this.person.Person.M2Ratings.length === 0) {
246
+ return 'U';
247
+ }
248
+ return this.person.Person.M2Ratings[0].Rating;
249
+ },
250
+ computedSelected() {
251
+ return this.person.Status === 'Absent' ? 'Absent' : 'Present';
252
+ }
253
+ },
254
+ data() {
255
+ return {
256
+ showSpinner: false,
257
+ localWeaverSigned: false
258
+ };
259
+ },
260
+ watch: {
261
+ person: {
262
+ immediate: true,
263
+ deep: true,
264
+ handler(newVal) {
265
+ const signed = newVal?.Person?.Weaver?.Signed;
266
+ this.localWeaverSigned = Boolean(signed ?? false);
267
+ }
268
+ }
269
+ },
270
+ methods: {
271
+ requestWeaverSign() {
272
+ this.$emit('request:weaver-sign', this.person);
273
+ },
274
+ handleAttendance(selected) {
275
+ if (selected === 'Present' && this.weaverRequired && !this.weaverSigned) {
276
+ this.$emit('weaver:required', this.person);
277
+ return;
278
+ }
279
+
280
+ const person = { ...this.person, Status: selected };
281
+ this.$emit('update:status', person);
282
+ },
283
+ handlerRemoveFencer() {
284
+ this.showSpinner = true;
285
+ this.$emit('remove:fencer', this.person);
286
+ },
287
+ handelMoveUp() {
288
+ if (this.person.PoolPosition > 1) this.$emit('update:moveUp', this.person);
289
+ },
290
+ handelMoveDown() {
291
+ if (!this.isLast) this.$emit('update:moveDown', this.person);
292
+ },
293
+ handleForwardToProfile() {
294
+ this.$emit('forward:toProfile', this.person.PersonId);
295
+ }
296
+ }
297
+ };
298
+ </script>