@dcrackel/hematournamentui 1.0.712 → 1.0.714

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 (107) hide show
  1. package/.prettierignore +7 -7
  2. package/.storybook/main.js +3 -1
  3. package/README.md +42 -0
  4. package/dist/HemaTournamentUI-lib.es.js +6856 -6243
  5. package/dist/HemaTournamentUI-lib.umd.js +27 -27
  6. package/dist/hematournamentui-tailwind.css +79 -9
  7. package/package.json +96 -96
  8. package/prettier.config.js +16 -16
  9. package/src/index.js +43 -42
  10. package/src/main.js +1 -1
  11. package/src/mocks/getDEBouts-TableOf128.js +37 -37
  12. package/src/mocks/getDEBouts-TableOf64.js +35 -35
  13. package/src/stories/Atoms/Input/BaseInput.test.js +97 -97
  14. package/src/stories/Atoms/Input/BaseInput.vue +149 -149
  15. package/src/stories/Molecules/Indicators/MissingHemaRatingsId/MissingHemaRatingsId.stories.js +23 -23
  16. package/src/stories/Molecules/Indicators/MissingHemaRatingsId/MissingHemaRatingsId.vue +35 -35
  17. package/src/stories/Molecules/Indicators/RegistrationStatus/RegistrationStatus.vue +30 -30
  18. package/src/stories/Molecules/Menus/HoverActions/HoverActions.test.js +138 -0
  19. package/src/stories/Molecules/Menus/HoverActions/HoverActions.vue +212 -0
  20. package/src/stories/Molecules/Modals/BracketDirectorsModal/BracketDirectorsModal.stories.js +49 -0
  21. package/src/stories/Molecules/Modals/BracketDirectorsModal/BracketDirectorsModal.test.js +129 -0
  22. package/src/stories/Molecules/Modals/BracketDirectorsModal/BracketDirectorsModal.vue +165 -0
  23. package/src/stories/Molecules/Modals/DirectorModal/DirectorModal.stories.js +6 -0
  24. package/src/stories/Molecules/Modals/DirectorModal/DirectorModal.test.js +18 -18
  25. package/src/stories/Molecules/Modals/DirectorModal/DirectorModal.vue +1 -1
  26. package/src/stories/Organisms/Cards/BoutCard/BoutCard.vue +5 -1
  27. package/src/stories/Organisms/Cards/BoutCard/Variants/BoutCardActive/BoutCardActive.vue +19 -10
  28. package/src/stories/Organisms/Cards/BoutCard/Variants/BoutCardInactive/BoutCardInactive.vue +11 -7
  29. package/src/stories/Organisms/Cards/BracketDirectorAssignmentCard/BracketDirectorAssignmentCard.stories.js +42 -33
  30. package/src/stories/Organisms/Cards/BracketDirectorAssignmentCard/BracketDirectorAssignmentCard.test.js +76 -45
  31. package/src/stories/Organisms/Cards/BracketDirectorAssignmentCard/BracketDirectorAssignmentCard.vue +122 -103
  32. package/src/stories/Organisms/Cards/Director/DirectorCard.test.js +82 -0
  33. package/src/stories/Organisms/Cards/Director/DirectorCard.vue +32 -51
  34. package/src/stories/Organisms/Cards/EditBout/EditBout.test.js +51 -51
  35. package/src/stories/Organisms/Cards/EventCard/EventCard.test.js +106 -106
  36. package/src/stories/Organisms/Cards/FencerCard/FencerCard.vue +298 -298
  37. package/src/stories/Organisms/Cards/TableauBoutCard/TableauBoutCard.stories.js +77 -60
  38. package/src/stories/Organisms/Cards/TableauBoutCard/TableauBoutCard.test.js +144 -143
  39. package/src/stories/Organisms/Cards/TableauBoutCard/TableauBoutCard.vue +289 -256
  40. package/src/stories/Organisms/Cards/TableauFencerCard/TableauFencerCard.stories.js +69 -69
  41. package/src/stories/Organisms/Cards/TableauFencerCard/TableauFencerCard.vue +80 -80
  42. package/src/stories/Organisms/Cards/WaitlistFencerCard/WaitlistFencerCard.vue +153 -153
  43. package/src/stories/Organisms/ComplexInputs/DropDown/DropDownMenu.vue +4 -0
  44. package/src/stories/Organisms/ComplexInputs/ImageCropper/ImageCropper.stories.js +31 -31
  45. package/src/stories/Organisms/ComplexInputs/ImageCropper/ImageCropper.test.js +109 -109
  46. package/src/stories/Organisms/ComplexInputs/ImageCropper/ImageCropper.vue +192 -192
  47. package/src/stories/Organisms/Containers/Tableau/Tableau.stories.js +1 -0
  48. package/src/stories/Organisms/Containers/Tableau/Tableau.test.js +247 -204
  49. package/src/stories/Organisms/Containers/Tableau/Tableau.vue +89 -15
  50. package/src/stories/Organisms/Containers/Tableau/components/BracketDirectorAssignmentPanel.test.js +51 -29
  51. package/src/stories/Organisms/Containers/Tableau/components/BracketDirectorAssignmentPanel.vue +63 -46
  52. package/src/stories/Organisms/Containers/Tableau/components/TableauSvgOverlay.test.js +21 -21
  53. package/src/stories/Organisms/Containers/Tableau/components/TableauSvgOverlay.vue +39 -39
  54. package/src/stories/Organisms/Containers/Tableau/layout/TableauLayoutEngine.js +145 -145
  55. package/src/stories/Organisms/Containers/Tableau/layout/TableauLayoutEngine.test.js +64 -64
  56. package/src/stories/Organisms/Containers/Tableau/plannedAssignments.js +36 -57
  57. package/src/stories/Organisms/Containers/Tableau/plannedAssignments.test.js +101 -65
  58. package/src/stories/Organisms/Containers/TableauColumn/TableauColumn.vue +14 -1
  59. package/src/stories/Organisms/Wizards/EditEventWizard/BasicEventInfo/BasicEventInfo.stories.js +52 -52
  60. package/src/stories/Organisms/Wizards/EditEventWizard/BasicEventInfo/BasicEventInfo.vue +10 -3
  61. package/src/stories/Organisms/Wizards/EditEventWizard/DirectElimination/DirectElimination.vue +226 -226
  62. package/src/stories/Organisms/Wizards/EditEventWizard/DirectEliminationPromotion/DirectEliminationPromotion.vue +204 -204
  63. package/src/stories/Organisms/Wizards/EditEventWizard/EditEventWizard.stories.js +137 -137
  64. package/src/stories/Organisms/Wizards/EditEventWizard/EventCustomization/EventCustomization.vue +172 -172
  65. package/src/stories/Organisms/Wizards/EditEventWizard/PoolConfiguration/PoolConfiguration.vue +216 -216
  66. package/src/stories/Organisms/Wizards/EditEventWizard/PriceFields.test.js +79 -79
  67. package/src/stories/Organisms/Wizards/EditEventWizard/RuleSerialization.test.js +29 -29
  68. package/src/stories/Organisms/Wizards/EditEventWizard/WeaponSelection.test.js +138 -0
  69. package/src/stories/Templates/EventManagement/Bracket/Bracket.stories.js +149 -9
  70. package/src/stories/Templates/EventManagement/Bracket/Bracket.test.js +54 -2
  71. package/src/stories/Templates/EventManagement/Bracket/Bracket.vue +77 -8
  72. package/src/stories/Templates/EventManagement/Bracket/BracketDirectorAssignment.test.js +242 -0
  73. package/src/stories/Templates/EventManagement/Bracket/BracketMobile.test.js +131 -0
  74. package/src/stories/Templates/EventManagement/Bracket/BracketPlannedSuggestions.js +50 -39
  75. package/src/stories/Templates/EventManagement/Bracket/BracketStories.test.js +201 -0
  76. package/src/stories/Templates/EventManagement/Bracket/BracketStoryAssignments.js +93 -0
  77. package/src/stories/Templates/EventManagement/Bracket/BracketStoryAssignments.test.js +152 -0
  78. package/src/stories/Templates/EventManagement/Bracket/BracketStoryHarness.js +39 -39
  79. package/src/stories/Templates/EventManagement/Bracket/BracketStoryHarness.test.js +79 -79
  80. package/src/stories/Templates/EventManagement/EditEventInfo/EditEventInfo.stories.js +93 -93
  81. package/src/stories/Templates/EventManagement/EditEventInfo/EditEventInfo.vue +91 -91
  82. package/src/stories/Templates/EventManagement/PoolLive/PoolLive.test.js +121 -121
  83. package/src/stories/Templates/Menus/EditEventsTopMenu/EditEventsTopMenu.stories.js +9 -2
  84. package/src/stories/Templates/Menus/EditEventsTopMenu/EditEventsTopMenu.vue +5 -4
  85. package/src/stories/Templates/PersonManagement/Admin/Administration/Administration.stories.js +81 -81
  86. package/src/stories/Templates/PersonManagement/Admin/Administration/Administration.test.js +39 -39
  87. package/src/stories/Templates/PersonManagement/Admin/Administration/Administration.vue +101 -101
  88. package/src/stories/Templates/PersonManagement/Admin/FencerAdmin/FencerAdmin.stories.js +71 -71
  89. package/src/stories/Templates/PersonManagement/Admin/FencerAdmin/FencerAdmin.vue +86 -86
  90. package/src/stories/Templates/PersonManagement/Admin/MergeAccounts/MergeAccounts.stories.js +86 -86
  91. package/src/stories/Templates/PersonManagement/Admin/MergeAccounts/MergeAccounts.vue +247 -247
  92. package/src/stories/Templates/PersonManagement/Basic/BasicEdit.vue +170 -170
  93. package/src/stories/Templates/PersonManagement/PersonManagement.stories.js +156 -156
  94. package/src/stories/Templates/PersonManagement/PersonManagement.test.js +329 -329
  95. package/src/stories/Templates/PersonManagement/PersonManagement.vue +329 -329
  96. package/src/stories/Templates/PersonManagement/PersonManagementDraft.js +42 -42
  97. package/src/stories/Templates/TournamentManagement/TournamentManagement.stories.js +84 -84
  98. package/src/stories/Templates/TournamentManagement/TournamentManagement.test.js +114 -114
  99. package/src/stories/Templates/TournamentManagement/TournamentManagement.vue +363 -363
  100. package/src/stories/Templates/TournamentManagement/TournamentPageOne/TournamentPageOne.stories.js +116 -116
  101. package/src/stories/Templates/TournamentManagement/TournamentPageOne/TournamentPageOne.vue +307 -307
  102. package/src/stories/Util/Validations/PersonManagementValidations.js +45 -45
  103. package/src/stories/Util/Validations/PriceValidation.js +6 -6
  104. package/src/stories/Util/boutDirectorAssignment.js +46 -0
  105. package/src/stories/Util/bracketDirectors.js +86 -0
  106. package/src/stories/Util/registrationStatus.js +11 -11
  107. package/src/stories/Util/tabs.js +19 -47
@@ -1,39 +1,39 @@
1
- import { afterEach, describe, expect, it } from 'vitest';
2
- import { enableAutoUnmount, mount } from '@vue/test-utils';
3
- import Administration from './Administration.vue';
4
- import TitledInput from '../../../../Molecules/CombinationInputs/TitledInput/TitledInput.vue';
5
-
6
- enableAutoUnmount(afterEach);
7
-
8
- function mountAdministration(id) {
9
- return mount(Administration, {
10
- props: {
11
- person: { PersonId: 1, HemaRatingsId: id, HEMARatings: [{ HemaRatingId: 123 }], AccessLevel: 'User' },
12
- userLevel: 'Admin'
13
- },
14
- global: { stubs: { DropDownMenu: true } }
15
- });
16
- }
17
-
18
- const findHemaInput = wrapper => wrapper.findAllComponents(TitledInput)[1].find('input');
19
-
20
- describe('Administration HR ID draft', () => {
21
- it.each([null, ''])('keeps the explicitly cleared ID %j blank', id => {
22
- const wrapper = mountAdministration(id);
23
- expect(findHemaInput(wrapper).element.value).toBe('');
24
- expect(findHemaInput(wrapper).attributes('aria-invalid')).toBe('false');
25
- });
26
-
27
- it('falls back to legacy ratings only when the canonical ID is undefined', () => {
28
- const wrapper = mountAdministration(undefined);
29
- expect(findHemaInput(wrapper).element.value).toBe('123');
30
- });
31
-
32
- it('shows invalid-ID feedback and preserves invalid input for correction', async () => {
33
- const wrapper = mountAdministration(0);
34
- expect(wrapper.text()).toContain('positive whole-number ID');
35
- expect(findHemaInput(wrapper).attributes('aria-invalid')).toBe('true');
36
- await findHemaInput(wrapper).setValue('-5');
37
- expect(wrapper.emitted('update:person')).toEqual([[{ field: 'HemaRatingsId', value: '-5' }]]);
38
- });
39
- });
1
+ import { afterEach, describe, expect, it } from 'vitest';
2
+ import { enableAutoUnmount, mount } from '@vue/test-utils';
3
+ import Administration from './Administration.vue';
4
+ import TitledInput from '../../../../Molecules/CombinationInputs/TitledInput/TitledInput.vue';
5
+
6
+ enableAutoUnmount(afterEach);
7
+
8
+ function mountAdministration(id) {
9
+ return mount(Administration, {
10
+ props: {
11
+ person: { PersonId: 1, HemaRatingsId: id, HEMARatings: [{ HemaRatingId: 123 }], AccessLevel: 'User' },
12
+ userLevel: 'Admin'
13
+ },
14
+ global: { stubs: { DropDownMenu: true } }
15
+ });
16
+ }
17
+
18
+ const findHemaInput = wrapper => wrapper.findAllComponents(TitledInput)[1].find('input');
19
+
20
+ describe('Administration HR ID draft', () => {
21
+ it.each([null, ''])('keeps the explicitly cleared ID %j blank', id => {
22
+ const wrapper = mountAdministration(id);
23
+ expect(findHemaInput(wrapper).element.value).toBe('');
24
+ expect(findHemaInput(wrapper).attributes('aria-invalid')).toBe('false');
25
+ });
26
+
27
+ it('falls back to legacy ratings only when the canonical ID is undefined', () => {
28
+ const wrapper = mountAdministration(undefined);
29
+ expect(findHemaInput(wrapper).element.value).toBe('123');
30
+ });
31
+
32
+ it('shows invalid-ID feedback and preserves invalid input for correction', async () => {
33
+ const wrapper = mountAdministration(0);
34
+ expect(wrapper.text()).toContain('positive whole-number ID');
35
+ expect(findHemaInput(wrapper).attributes('aria-invalid')).toBe('true');
36
+ await findHemaInput(wrapper).setValue('-5');
37
+ expect(wrapper.emitted('update:person')).toEqual([[{ field: 'HemaRatingsId', value: '-5' }]]);
38
+ });
39
+ });
@@ -1,101 +1,101 @@
1
- <template>
2
- <section class="mt-2">
3
- <div class="flex flex-col mb-4">
4
- <TitledInput
5
- :inputValue="personId"
6
- :inputType="'number'"
7
- placeholder="Meyer Squared ID"
8
- title="Meyer Squared ID"
9
- :disabled="true"
10
- aria-disabled="true"
11
- />
12
- </div>
13
-
14
- <div class="flex flex-col mb-4">
15
- <TitledInput
16
- :inputValue="hemaRatingId"
17
- inputType="text"
18
- placeholder="HEMA Rating ID"
19
- :invalid="hemaRatingValidation.invalid"
20
- :title="hemaRatingLabel"
21
- @update:value="emitUpdate('HemaRatingsId', $event)"
22
- />
23
- </div>
24
-
25
- <div class="flex flex-col mb-4">
26
- <BaseText text="Access Level" size="sm" color="quaternary" />
27
- <DropDownMenu
28
- :key="accessLevelDropdownKey"
29
- :label="accessLevelLabel"
30
- :items="accessLevels"
31
- class="pb-2"
32
- :selectedItem="selectedAccessLevel"
33
- @update:selectedItem="emitUpdate('AccessLevel', $event.text)"
34
- width="w-full"
35
- dropDownWidth="w-full"
36
- />
37
- </div>
38
- </section>
39
- </template>
40
-
41
- <script>
42
- import TitledInput from '../../../../Molecules/CombinationInputs/TitledInput/TitledInput.vue';
43
- import BaseText from '../../../../Atoms/Text/BaseText.vue';
44
- import DropDownMenu from '../../../../Organisms/ComplexInputs/DropDown/DropDownMenu.vue';
45
- import { getDraftHemaRatingsId } from '../../PersonManagementDraft.js';
46
- import { validateField } from '../../../../Util/Validations/PersonManagementValidations.js';
47
-
48
- const STANDARD_ACCESS_LEVELS = [
49
- { text: 'User', link: 'User' },
50
- { text: 'Director', link: 'Director' },
51
- { text: 'Club', link: 'Club' }
52
- ];
53
-
54
- const ADMIN_ACCESS_LEVELS = [...STANDARD_ACCESS_LEVELS, { text: 'Admin', link: 'Admin' }];
55
-
56
- export default {
57
- name: 'Administration',
58
- emits: ['update:person'],
59
- components: { TitledInput, BaseText, DropDownMenu },
60
- props: {
61
- person: { type: Object, required: true },
62
- userLevel: { type: String, required: true }
63
- },
64
- computed: {
65
- personId() {
66
- return this.person?.PersonId ?? '';
67
- },
68
- hemaRatingId() {
69
- return getDraftHemaRatingsId(this.person);
70
- },
71
- hemaRatingValidation() {
72
- return validateField('HemaRatingsId', this.hemaRatingId);
73
- },
74
- hemaRatingLabel() {
75
- if (this.hemaRatingValidation.invalid) return `HEMA Rating ID - ${this.hemaRatingValidation.message}`;
76
- return 'HEMA Rating ID';
77
- },
78
- accessLevels() {
79
- if (this.userLevel === 'Admin') {
80
- return ADMIN_ACCESS_LEVELS;
81
- }
82
-
83
- return STANDARD_ACCESS_LEVELS;
84
- },
85
- selectedAccessLevel() {
86
- return { text: this.person.AccessLevel, link: this.person.AccessLevel };
87
- },
88
- accessLevelLabel() {
89
- return this.person.AccessLevel ? '' : 'Select Access Level';
90
- },
91
- accessLevelDropdownKey() {
92
- return `${this.userLevel}-${this.person.AccessLevel || 'none'}`;
93
- }
94
- },
95
- methods: {
96
- emitUpdate(field, value) {
97
- this.$emit('update:person', { field, value });
98
- }
99
- }
100
- };
101
- </script>
1
+ <template>
2
+ <section class="mt-2">
3
+ <div class="flex flex-col mb-4">
4
+ <TitledInput
5
+ :inputValue="personId"
6
+ :inputType="'number'"
7
+ placeholder="Meyer Squared ID"
8
+ title="Meyer Squared ID"
9
+ :disabled="true"
10
+ aria-disabled="true"
11
+ />
12
+ </div>
13
+
14
+ <div class="flex flex-col mb-4">
15
+ <TitledInput
16
+ :inputValue="hemaRatingId"
17
+ inputType="text"
18
+ placeholder="HEMA Rating ID"
19
+ :invalid="hemaRatingValidation.invalid"
20
+ :title="hemaRatingLabel"
21
+ @update:value="emitUpdate('HemaRatingsId', $event)"
22
+ />
23
+ </div>
24
+
25
+ <div class="flex flex-col mb-4">
26
+ <BaseText text="Access Level" size="sm" color="quaternary" />
27
+ <DropDownMenu
28
+ :key="accessLevelDropdownKey"
29
+ :label="accessLevelLabel"
30
+ :items="accessLevels"
31
+ class="pb-2"
32
+ :selectedItem="selectedAccessLevel"
33
+ @update:selectedItem="emitUpdate('AccessLevel', $event.text)"
34
+ width="w-full"
35
+ dropDownWidth="w-full"
36
+ />
37
+ </div>
38
+ </section>
39
+ </template>
40
+
41
+ <script>
42
+ import TitledInput from '../../../../Molecules/CombinationInputs/TitledInput/TitledInput.vue';
43
+ import BaseText from '../../../../Atoms/Text/BaseText.vue';
44
+ import DropDownMenu from '../../../../Organisms/ComplexInputs/DropDown/DropDownMenu.vue';
45
+ import { getDraftHemaRatingsId } from '../../PersonManagementDraft.js';
46
+ import { validateField } from '../../../../Util/Validations/PersonManagementValidations.js';
47
+
48
+ const STANDARD_ACCESS_LEVELS = [
49
+ { text: 'User', link: 'User' },
50
+ { text: 'Director', link: 'Director' },
51
+ { text: 'Club', link: 'Club' }
52
+ ];
53
+
54
+ const ADMIN_ACCESS_LEVELS = [...STANDARD_ACCESS_LEVELS, { text: 'Admin', link: 'Admin' }];
55
+
56
+ export default {
57
+ name: 'Administration',
58
+ emits: ['update:person'],
59
+ components: { TitledInput, BaseText, DropDownMenu },
60
+ props: {
61
+ person: { type: Object, required: true },
62
+ userLevel: { type: String, required: true }
63
+ },
64
+ computed: {
65
+ personId() {
66
+ return this.person?.PersonId ?? '';
67
+ },
68
+ hemaRatingId() {
69
+ return getDraftHemaRatingsId(this.person);
70
+ },
71
+ hemaRatingValidation() {
72
+ return validateField('HemaRatingsId', this.hemaRatingId);
73
+ },
74
+ hemaRatingLabel() {
75
+ if (this.hemaRatingValidation.invalid) return `HEMA Rating ID - ${this.hemaRatingValidation.message}`;
76
+ return 'HEMA Rating ID';
77
+ },
78
+ accessLevels() {
79
+ if (this.userLevel === 'Admin') {
80
+ return ADMIN_ACCESS_LEVELS;
81
+ }
82
+
83
+ return STANDARD_ACCESS_LEVELS;
84
+ },
85
+ selectedAccessLevel() {
86
+ return { text: this.person.AccessLevel, link: this.person.AccessLevel };
87
+ },
88
+ accessLevelLabel() {
89
+ return this.person.AccessLevel ? '' : 'Select Access Level';
90
+ },
91
+ accessLevelDropdownKey() {
92
+ return `${this.userLevel}-${this.person.AccessLevel || 'none'}`;
93
+ }
94
+ },
95
+ methods: {
96
+ emitUpdate(field, value) {
97
+ this.$emit('update:person', { field, value });
98
+ }
99
+ }
100
+ };
101
+ </script>
@@ -1,71 +1,71 @@
1
- import FencerAdmin from './FencerAdmin.vue';
2
- import personsMock from '../../../../../mocks/personsMock.js';
3
- import peopleMock from '../../../../../mocks/personGetAllMock.js';
4
-
5
- export default {
6
- title: 'Templates/PersonManagement/Admin/FencerAdmin',
7
- component: FencerAdmin,
8
- tags: ['autodocs'],
9
- args: {
10
- person: personsMock[1],
11
- people: peopleMock,
12
- userLevel: 'Club',
13
- canMergeAccounts: null
14
- },
15
- argTypes: {
16
- person: { control: { type: 'object' } },
17
- people: { control: { type: 'object' } },
18
- userLevel: {
19
- control: { type: 'select' },
20
- options: ['User', 'Director', 'Club', 'Admin']
21
- },
22
- canMergeAccounts: { control: { type: 'boolean' } },
23
- 'update:person': { action: 'update:person' },
24
- 'merge:merge': { action: 'merge:merge' }
25
- }
26
- };
27
-
28
- export const ClubUser = {
29
- args: {
30
- person: {
31
- ...personsMock[1],
32
- AccessLevel: 'Club'
33
- },
34
- people: peopleMock,
35
- userLevel: 'Club'
36
- }
37
- };
38
-
39
- export const AdminViewingUser = {
40
- args: {
41
- person: {
42
- ...personsMock[1],
43
- AccessLevel: 'User'
44
- },
45
- people: peopleMock,
46
- userLevel: 'Admin'
47
- }
48
- };
49
-
50
- export const AdminViewingAdmin = {
51
- args: {
52
- person: {
53
- ...personsMock[1],
54
- AccessLevel: 'Admin'
55
- },
56
- people: peopleMock,
57
- userLevel: 'Admin'
58
- }
59
- };
60
-
61
- export const MergeDisabledByParent = {
62
- args: {
63
- person: {
64
- ...personsMock[1],
65
- AccessLevel: 'User'
66
- },
67
- people: peopleMock,
68
- userLevel: 'Admin',
69
- canMergeAccounts: false
70
- }
71
- };
1
+ import FencerAdmin from './FencerAdmin.vue';
2
+ import personsMock from '../../../../../mocks/personsMock.js';
3
+ import peopleMock from '../../../../../mocks/personGetAllMock.js';
4
+
5
+ export default {
6
+ title: 'Templates/PersonManagement/Admin/FencerAdmin',
7
+ component: FencerAdmin,
8
+ tags: ['autodocs'],
9
+ args: {
10
+ person: personsMock[1],
11
+ people: peopleMock,
12
+ userLevel: 'Club',
13
+ canMergeAccounts: null
14
+ },
15
+ argTypes: {
16
+ person: { control: { type: 'object' } },
17
+ people: { control: { type: 'object' } },
18
+ userLevel: {
19
+ control: { type: 'select' },
20
+ options: ['User', 'Director', 'Club', 'Admin']
21
+ },
22
+ canMergeAccounts: { control: { type: 'boolean' } },
23
+ 'update:person': { action: 'update:person' },
24
+ 'merge:merge': { action: 'merge:merge' }
25
+ }
26
+ };
27
+
28
+ export const ClubUser = {
29
+ args: {
30
+ person: {
31
+ ...personsMock[1],
32
+ AccessLevel: 'Club'
33
+ },
34
+ people: peopleMock,
35
+ userLevel: 'Club'
36
+ }
37
+ };
38
+
39
+ export const AdminViewingUser = {
40
+ args: {
41
+ person: {
42
+ ...personsMock[1],
43
+ AccessLevel: 'User'
44
+ },
45
+ people: peopleMock,
46
+ userLevel: 'Admin'
47
+ }
48
+ };
49
+
50
+ export const AdminViewingAdmin = {
51
+ args: {
52
+ person: {
53
+ ...personsMock[1],
54
+ AccessLevel: 'Admin'
55
+ },
56
+ people: peopleMock,
57
+ userLevel: 'Admin'
58
+ }
59
+ };
60
+
61
+ export const MergeDisabledByParent = {
62
+ args: {
63
+ person: {
64
+ ...personsMock[1],
65
+ AccessLevel: 'User'
66
+ },
67
+ people: peopleMock,
68
+ userLevel: 'Admin',
69
+ canMergeAccounts: false
70
+ }
71
+ };
@@ -1,86 +1,86 @@
1
- <template>
2
- <section class="mt-2 min-h-80">
3
- <div class="pb-6">
4
- <BaseText text="Administration" size="lg" color="primary" />
5
- <div class="mt-3">
6
- <Administration :person="person" :userLevel="userLevel" @update:person="$emit('update:person', $event)" />
7
- </div>
8
- </div>
9
-
10
- <div v-if="showMergeAccounts" class="pt-6 border-t border-dropdownSelect">
11
- <button
12
- :id="mergeAccountsToggleId"
13
- type="button"
14
- class="w-full flex items-center justify-between text-left"
15
- :aria-expanded="mergeOpen"
16
- :aria-controls="mergeAccountsPanelId"
17
- @click="toggleMergeOpen"
18
- >
19
- <div>
20
- <BaseText text="Merge Accounts" size="lg" color="primary" />
21
- <BaseText
22
- class="mt-1"
23
- text="Merge other fencer accounts into this one. This will move all references and delete the duplicate accounts."
24
- size="sm"
25
- color="quaternary"
26
- />
27
- </div>
28
-
29
- <span
30
- class="fa-solid fa-chevron-down ml-4 text-quaternary transition-transform duration-200"
31
- :class="mergeOpen ? 'rotate-180' : 'rotate-0'"
32
- aria-hidden="true"
33
- />
34
- </button>
35
-
36
- <div v-if="mergeOpen" :id="mergeAccountsPanelId" class="mt-4">
37
- <MergeAccounts :person="person" :people="people" @merge:merge="emitMergeAccounts" />
38
- </div>
39
- </div>
40
- </section>
41
- </template>
42
-
43
- <script>
44
- import BaseText from '../../../../Atoms/Text/BaseText.vue';
45
- import Administration from '../Administration/Administration.vue';
46
- import MergeAccounts from '../MergeAccounts/MergeAccounts.vue';
47
-
48
- export default {
49
- name: 'FencerAdmin',
50
- emits: ['update:person', 'merge:merge'],
51
- components: { BaseText, Administration, MergeAccounts },
52
- props: {
53
- person: { type: Object, required: true },
54
- people: { type: Array, required: true },
55
- userLevel: { type: String, required: true },
56
- canMergeAccounts: { type: Boolean, default: null }
57
- },
58
- data() {
59
- return {
60
- mergeOpen: false
61
- };
62
- },
63
- computed: {
64
- showMergeAccounts() {
65
- return this.canMergeAccounts ?? this.userLevel === 'Admin';
66
- },
67
- personIdForDom() {
68
- return this.person?.PersonId ?? 'unknown';
69
- },
70
- mergeAccountsToggleId() {
71
- return `merge-accounts-toggle-${this.personIdForDom}`;
72
- },
73
- mergeAccountsPanelId() {
74
- return `merge-accounts-panel-${this.personIdForDom}`;
75
- }
76
- },
77
- methods: {
78
- toggleMergeOpen() {
79
- this.mergeOpen = !this.mergeOpen;
80
- },
81
- emitMergeAccounts(data) {
82
- this.$emit('merge:merge', data);
83
- }
84
- }
85
- };
86
- </script>
1
+ <template>
2
+ <section class="mt-2 min-h-80">
3
+ <div class="pb-6">
4
+ <BaseText text="Administration" size="lg" color="primary" />
5
+ <div class="mt-3">
6
+ <Administration :person="person" :userLevel="userLevel" @update:person="$emit('update:person', $event)" />
7
+ </div>
8
+ </div>
9
+
10
+ <div v-if="showMergeAccounts" class="pt-6 border-t border-dropdownSelect">
11
+ <button
12
+ :id="mergeAccountsToggleId"
13
+ type="button"
14
+ class="w-full flex items-center justify-between text-left"
15
+ :aria-expanded="mergeOpen"
16
+ :aria-controls="mergeAccountsPanelId"
17
+ @click="toggleMergeOpen"
18
+ >
19
+ <div>
20
+ <BaseText text="Merge Accounts" size="lg" color="primary" />
21
+ <BaseText
22
+ class="mt-1"
23
+ text="Merge other fencer accounts into this one. This will move all references and delete the duplicate accounts."
24
+ size="sm"
25
+ color="quaternary"
26
+ />
27
+ </div>
28
+
29
+ <span
30
+ class="fa-solid fa-chevron-down ml-4 text-quaternary transition-transform duration-200"
31
+ :class="mergeOpen ? 'rotate-180' : 'rotate-0'"
32
+ aria-hidden="true"
33
+ />
34
+ </button>
35
+
36
+ <div v-if="mergeOpen" :id="mergeAccountsPanelId" class="mt-4">
37
+ <MergeAccounts :person="person" :people="people" @merge:merge="emitMergeAccounts" />
38
+ </div>
39
+ </div>
40
+ </section>
41
+ </template>
42
+
43
+ <script>
44
+ import BaseText from '../../../../Atoms/Text/BaseText.vue';
45
+ import Administration from '../Administration/Administration.vue';
46
+ import MergeAccounts from '../MergeAccounts/MergeAccounts.vue';
47
+
48
+ export default {
49
+ name: 'FencerAdmin',
50
+ emits: ['update:person', 'merge:merge'],
51
+ components: { BaseText, Administration, MergeAccounts },
52
+ props: {
53
+ person: { type: Object, required: true },
54
+ people: { type: Array, required: true },
55
+ userLevel: { type: String, required: true },
56
+ canMergeAccounts: { type: Boolean, default: null }
57
+ },
58
+ data() {
59
+ return {
60
+ mergeOpen: false
61
+ };
62
+ },
63
+ computed: {
64
+ showMergeAccounts() {
65
+ return this.canMergeAccounts ?? this.userLevel === 'Admin';
66
+ },
67
+ personIdForDom() {
68
+ return this.person?.PersonId ?? 'unknown';
69
+ },
70
+ mergeAccountsToggleId() {
71
+ return `merge-accounts-toggle-${this.personIdForDom}`;
72
+ },
73
+ mergeAccountsPanelId() {
74
+ return `merge-accounts-panel-${this.personIdForDom}`;
75
+ }
76
+ },
77
+ methods: {
78
+ toggleMergeOpen() {
79
+ this.mergeOpen = !this.mergeOpen;
80
+ },
81
+ emitMergeAccounts(data) {
82
+ this.$emit('merge:merge', data);
83
+ }
84
+ }
85
+ };
86
+ </script>