@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.
- package/.prettierignore +7 -7
- package/.storybook/main.js +3 -1
- package/README.md +42 -0
- package/dist/HemaTournamentUI-lib.es.js +6856 -6243
- package/dist/HemaTournamentUI-lib.umd.js +27 -27
- package/dist/hematournamentui-tailwind.css +79 -9
- package/package.json +96 -96
- package/prettier.config.js +16 -16
- package/src/index.js +43 -42
- package/src/main.js +1 -1
- package/src/mocks/getDEBouts-TableOf128.js +37 -37
- package/src/mocks/getDEBouts-TableOf64.js +35 -35
- package/src/stories/Atoms/Input/BaseInput.test.js +97 -97
- package/src/stories/Atoms/Input/BaseInput.vue +149 -149
- package/src/stories/Molecules/Indicators/MissingHemaRatingsId/MissingHemaRatingsId.stories.js +23 -23
- package/src/stories/Molecules/Indicators/MissingHemaRatingsId/MissingHemaRatingsId.vue +35 -35
- package/src/stories/Molecules/Indicators/RegistrationStatus/RegistrationStatus.vue +30 -30
- package/src/stories/Molecules/Menus/HoverActions/HoverActions.test.js +138 -0
- package/src/stories/Molecules/Menus/HoverActions/HoverActions.vue +212 -0
- package/src/stories/Molecules/Modals/BracketDirectorsModal/BracketDirectorsModal.stories.js +49 -0
- package/src/stories/Molecules/Modals/BracketDirectorsModal/BracketDirectorsModal.test.js +129 -0
- package/src/stories/Molecules/Modals/BracketDirectorsModal/BracketDirectorsModal.vue +165 -0
- package/src/stories/Molecules/Modals/DirectorModal/DirectorModal.stories.js +6 -0
- package/src/stories/Molecules/Modals/DirectorModal/DirectorModal.test.js +18 -18
- package/src/stories/Molecules/Modals/DirectorModal/DirectorModal.vue +1 -1
- package/src/stories/Organisms/Cards/BoutCard/BoutCard.vue +5 -1
- package/src/stories/Organisms/Cards/BoutCard/Variants/BoutCardActive/BoutCardActive.vue +19 -10
- package/src/stories/Organisms/Cards/BoutCard/Variants/BoutCardInactive/BoutCardInactive.vue +11 -7
- package/src/stories/Organisms/Cards/BracketDirectorAssignmentCard/BracketDirectorAssignmentCard.stories.js +42 -33
- package/src/stories/Organisms/Cards/BracketDirectorAssignmentCard/BracketDirectorAssignmentCard.test.js +76 -45
- package/src/stories/Organisms/Cards/BracketDirectorAssignmentCard/BracketDirectorAssignmentCard.vue +122 -103
- package/src/stories/Organisms/Cards/Director/DirectorCard.test.js +82 -0
- package/src/stories/Organisms/Cards/Director/DirectorCard.vue +32 -51
- package/src/stories/Organisms/Cards/EditBout/EditBout.test.js +51 -51
- package/src/stories/Organisms/Cards/EventCard/EventCard.test.js +106 -106
- package/src/stories/Organisms/Cards/FencerCard/FencerCard.vue +298 -298
- package/src/stories/Organisms/Cards/TableauBoutCard/TableauBoutCard.stories.js +77 -60
- package/src/stories/Organisms/Cards/TableauBoutCard/TableauBoutCard.test.js +144 -143
- package/src/stories/Organisms/Cards/TableauBoutCard/TableauBoutCard.vue +289 -256
- package/src/stories/Organisms/Cards/TableauFencerCard/TableauFencerCard.stories.js +69 -69
- package/src/stories/Organisms/Cards/TableauFencerCard/TableauFencerCard.vue +80 -80
- package/src/stories/Organisms/Cards/WaitlistFencerCard/WaitlistFencerCard.vue +153 -153
- package/src/stories/Organisms/ComplexInputs/DropDown/DropDownMenu.vue +4 -0
- package/src/stories/Organisms/ComplexInputs/ImageCropper/ImageCropper.stories.js +31 -31
- package/src/stories/Organisms/ComplexInputs/ImageCropper/ImageCropper.test.js +109 -109
- package/src/stories/Organisms/ComplexInputs/ImageCropper/ImageCropper.vue +192 -192
- package/src/stories/Organisms/Containers/Tableau/Tableau.stories.js +1 -0
- package/src/stories/Organisms/Containers/Tableau/Tableau.test.js +247 -204
- package/src/stories/Organisms/Containers/Tableau/Tableau.vue +89 -15
- package/src/stories/Organisms/Containers/Tableau/components/BracketDirectorAssignmentPanel.test.js +51 -29
- package/src/stories/Organisms/Containers/Tableau/components/BracketDirectorAssignmentPanel.vue +63 -46
- package/src/stories/Organisms/Containers/Tableau/components/TableauSvgOverlay.test.js +21 -21
- package/src/stories/Organisms/Containers/Tableau/components/TableauSvgOverlay.vue +39 -39
- package/src/stories/Organisms/Containers/Tableau/layout/TableauLayoutEngine.js +145 -145
- package/src/stories/Organisms/Containers/Tableau/layout/TableauLayoutEngine.test.js +64 -64
- package/src/stories/Organisms/Containers/Tableau/plannedAssignments.js +36 -57
- package/src/stories/Organisms/Containers/Tableau/plannedAssignments.test.js +101 -65
- package/src/stories/Organisms/Containers/TableauColumn/TableauColumn.vue +14 -1
- package/src/stories/Organisms/Wizards/EditEventWizard/BasicEventInfo/BasicEventInfo.stories.js +52 -52
- package/src/stories/Organisms/Wizards/EditEventWizard/BasicEventInfo/BasicEventInfo.vue +10 -3
- package/src/stories/Organisms/Wizards/EditEventWizard/DirectElimination/DirectElimination.vue +226 -226
- package/src/stories/Organisms/Wizards/EditEventWizard/DirectEliminationPromotion/DirectEliminationPromotion.vue +204 -204
- package/src/stories/Organisms/Wizards/EditEventWizard/EditEventWizard.stories.js +137 -137
- package/src/stories/Organisms/Wizards/EditEventWizard/EventCustomization/EventCustomization.vue +172 -172
- package/src/stories/Organisms/Wizards/EditEventWizard/PoolConfiguration/PoolConfiguration.vue +216 -216
- package/src/stories/Organisms/Wizards/EditEventWizard/PriceFields.test.js +79 -79
- package/src/stories/Organisms/Wizards/EditEventWizard/RuleSerialization.test.js +29 -29
- package/src/stories/Organisms/Wizards/EditEventWizard/WeaponSelection.test.js +138 -0
- package/src/stories/Templates/EventManagement/Bracket/Bracket.stories.js +149 -9
- package/src/stories/Templates/EventManagement/Bracket/Bracket.test.js +54 -2
- package/src/stories/Templates/EventManagement/Bracket/Bracket.vue +77 -8
- package/src/stories/Templates/EventManagement/Bracket/BracketDirectorAssignment.test.js +242 -0
- package/src/stories/Templates/EventManagement/Bracket/BracketMobile.test.js +131 -0
- package/src/stories/Templates/EventManagement/Bracket/BracketPlannedSuggestions.js +50 -39
- package/src/stories/Templates/EventManagement/Bracket/BracketStories.test.js +201 -0
- package/src/stories/Templates/EventManagement/Bracket/BracketStoryAssignments.js +93 -0
- package/src/stories/Templates/EventManagement/Bracket/BracketStoryAssignments.test.js +152 -0
- package/src/stories/Templates/EventManagement/Bracket/BracketStoryHarness.js +39 -39
- package/src/stories/Templates/EventManagement/Bracket/BracketStoryHarness.test.js +79 -79
- package/src/stories/Templates/EventManagement/EditEventInfo/EditEventInfo.stories.js +93 -93
- package/src/stories/Templates/EventManagement/EditEventInfo/EditEventInfo.vue +91 -91
- package/src/stories/Templates/EventManagement/PoolLive/PoolLive.test.js +121 -121
- package/src/stories/Templates/Menus/EditEventsTopMenu/EditEventsTopMenu.stories.js +9 -2
- package/src/stories/Templates/Menus/EditEventsTopMenu/EditEventsTopMenu.vue +5 -4
- package/src/stories/Templates/PersonManagement/Admin/Administration/Administration.stories.js +81 -81
- package/src/stories/Templates/PersonManagement/Admin/Administration/Administration.test.js +39 -39
- package/src/stories/Templates/PersonManagement/Admin/Administration/Administration.vue +101 -101
- package/src/stories/Templates/PersonManagement/Admin/FencerAdmin/FencerAdmin.stories.js +71 -71
- package/src/stories/Templates/PersonManagement/Admin/FencerAdmin/FencerAdmin.vue +86 -86
- package/src/stories/Templates/PersonManagement/Admin/MergeAccounts/MergeAccounts.stories.js +86 -86
- package/src/stories/Templates/PersonManagement/Admin/MergeAccounts/MergeAccounts.vue +247 -247
- package/src/stories/Templates/PersonManagement/Basic/BasicEdit.vue +170 -170
- package/src/stories/Templates/PersonManagement/PersonManagement.stories.js +156 -156
- package/src/stories/Templates/PersonManagement/PersonManagement.test.js +329 -329
- package/src/stories/Templates/PersonManagement/PersonManagement.vue +329 -329
- package/src/stories/Templates/PersonManagement/PersonManagementDraft.js +42 -42
- package/src/stories/Templates/TournamentManagement/TournamentManagement.stories.js +84 -84
- package/src/stories/Templates/TournamentManagement/TournamentManagement.test.js +114 -114
- package/src/stories/Templates/TournamentManagement/TournamentManagement.vue +363 -363
- package/src/stories/Templates/TournamentManagement/TournamentPageOne/TournamentPageOne.stories.js +116 -116
- package/src/stories/Templates/TournamentManagement/TournamentPageOne/TournamentPageOne.vue +307 -307
- package/src/stories/Util/Validations/PersonManagementValidations.js +45 -45
- package/src/stories/Util/Validations/PriceValidation.js +6 -6
- package/src/stories/Util/boutDirectorAssignment.js +46 -0
- package/src/stories/Util/bracketDirectors.js +86 -0
- package/src/stories/Util/registrationStatus.js +11 -11
- package/src/stories/Util/tabs.js +19 -47
|
@@ -1,91 +1,91 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<section>
|
|
3
|
-
<EditEventsTopMenu :currentTab="'Edit'" :tabs="tabs(userLevel, isMobile)" @tabMenuClick="handleTabMenuClick" />
|
|
4
|
-
|
|
5
|
-
<div class="w-full flex flex-row justify-center mt-3">
|
|
6
|
-
<EditEventWizard
|
|
7
|
-
:event="event"
|
|
8
|
-
:rules="rules"
|
|
9
|
-
:weapons="weapons"
|
|
10
|
-
:userLevel="userLevel"
|
|
11
|
-
:editMode="editMode"
|
|
12
|
-
:step="step"
|
|
13
|
-
:saving="saving"
|
|
14
|
-
:saveError="saveError"
|
|
15
|
-
:saveNotice="saveNotice"
|
|
16
|
-
@save:step="$emit('save:step', $event)"
|
|
17
|
-
@navigate:step="$emit('navigate:step', $event)"
|
|
18
|
-
@update:dirty="$emit('update:dirty', $event)"
|
|
19
|
-
@update:cancel="$emit('update:cancel')"
|
|
20
|
-
@update:submit="handleSubmit"
|
|
21
|
-
/>
|
|
22
|
-
</div>
|
|
23
|
-
</section>
|
|
24
|
-
</template>
|
|
25
|
-
|
|
26
|
-
<script>
|
|
27
|
-
import EditEventsTopMenu from '../../Menus/EditEventsTopMenu/EditEventsTopMenu.vue';
|
|
28
|
-
import EditEventWizard from '../../../Organisms/Wizards/EditEventWizard/EditEventWizard.vue';
|
|
29
|
-
import { tabs } from '../../../Util/tabs.js';
|
|
30
|
-
|
|
31
|
-
export default {
|
|
32
|
-
emits: ['tab:menu-click', 'update:submit', 'save:step', 'navigate:step', 'update:dirty', 'update:cancel'],
|
|
33
|
-
components: {
|
|
34
|
-
EditEventWizard,
|
|
35
|
-
EditEventsTopMenu
|
|
36
|
-
},
|
|
37
|
-
props: {
|
|
38
|
-
editMode: { type: Boolean, default: false },
|
|
39
|
-
step: { type: Number, default: 1 },
|
|
40
|
-
saving: { type: Boolean, default: false },
|
|
41
|
-
saveError: { type: String, default: '' },
|
|
42
|
-
saveNotice: { type: String, default: '' },
|
|
43
|
-
|
|
44
|
-
event: {
|
|
45
|
-
type: Object,
|
|
46
|
-
required: true
|
|
47
|
-
},
|
|
48
|
-
weapons: {
|
|
49
|
-
type: Array,
|
|
50
|
-
required: true
|
|
51
|
-
},
|
|
52
|
-
rules: {
|
|
53
|
-
type: Array,
|
|
54
|
-
required: true
|
|
55
|
-
},
|
|
56
|
-
userLevel: {
|
|
57
|
-
type: String,
|
|
58
|
-
default: 'Club'
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
data() {
|
|
62
|
-
return {
|
|
63
|
-
tabs,
|
|
64
|
-
windowWidth: window.innerWidth
|
|
65
|
-
};
|
|
66
|
-
},
|
|
67
|
-
mounted() {
|
|
68
|
-
window.addEventListener('resize', this.handleResize);
|
|
69
|
-
},
|
|
70
|
-
beforeUnmount() {
|
|
71
|
-
window.removeEventListener('resize', this.handleResize);
|
|
72
|
-
},
|
|
73
|
-
computed: {
|
|
74
|
-
isMobile() {
|
|
75
|
-
return this.windowWidth <= 748;
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
|
-
methods: {
|
|
79
|
-
handleTabMenuClick(value) {
|
|
80
|
-
if (this.saving) return;
|
|
81
|
-
this.$emit('tab:menu-click', value);
|
|
82
|
-
},
|
|
83
|
-
handleSubmit(value) {
|
|
84
|
-
this.$emit('update:submit', value);
|
|
85
|
-
},
|
|
86
|
-
handleResize() {
|
|
87
|
-
this.windowWidth = window.innerWidth;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
</script>
|
|
1
|
+
<template>
|
|
2
|
+
<section>
|
|
3
|
+
<EditEventsTopMenu :currentTab="'Edit'" :tabs="tabs(userLevel, isMobile)" @tabMenuClick="handleTabMenuClick" />
|
|
4
|
+
|
|
5
|
+
<div class="w-full flex flex-row justify-center mt-3">
|
|
6
|
+
<EditEventWizard
|
|
7
|
+
:event="event"
|
|
8
|
+
:rules="rules"
|
|
9
|
+
:weapons="weapons"
|
|
10
|
+
:userLevel="userLevel"
|
|
11
|
+
:editMode="editMode"
|
|
12
|
+
:step="step"
|
|
13
|
+
:saving="saving"
|
|
14
|
+
:saveError="saveError"
|
|
15
|
+
:saveNotice="saveNotice"
|
|
16
|
+
@save:step="$emit('save:step', $event)"
|
|
17
|
+
@navigate:step="$emit('navigate:step', $event)"
|
|
18
|
+
@update:dirty="$emit('update:dirty', $event)"
|
|
19
|
+
@update:cancel="$emit('update:cancel')"
|
|
20
|
+
@update:submit="handleSubmit"
|
|
21
|
+
/>
|
|
22
|
+
</div>
|
|
23
|
+
</section>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<script>
|
|
27
|
+
import EditEventsTopMenu from '../../Menus/EditEventsTopMenu/EditEventsTopMenu.vue';
|
|
28
|
+
import EditEventWizard from '../../../Organisms/Wizards/EditEventWizard/EditEventWizard.vue';
|
|
29
|
+
import { tabs } from '../../../Util/tabs.js';
|
|
30
|
+
|
|
31
|
+
export default {
|
|
32
|
+
emits: ['tab:menu-click', 'update:submit', 'save:step', 'navigate:step', 'update:dirty', 'update:cancel'],
|
|
33
|
+
components: {
|
|
34
|
+
EditEventWizard,
|
|
35
|
+
EditEventsTopMenu
|
|
36
|
+
},
|
|
37
|
+
props: {
|
|
38
|
+
editMode: { type: Boolean, default: false },
|
|
39
|
+
step: { type: Number, default: 1 },
|
|
40
|
+
saving: { type: Boolean, default: false },
|
|
41
|
+
saveError: { type: String, default: '' },
|
|
42
|
+
saveNotice: { type: String, default: '' },
|
|
43
|
+
|
|
44
|
+
event: {
|
|
45
|
+
type: Object,
|
|
46
|
+
required: true
|
|
47
|
+
},
|
|
48
|
+
weapons: {
|
|
49
|
+
type: Array,
|
|
50
|
+
required: true
|
|
51
|
+
},
|
|
52
|
+
rules: {
|
|
53
|
+
type: Array,
|
|
54
|
+
required: true
|
|
55
|
+
},
|
|
56
|
+
userLevel: {
|
|
57
|
+
type: String,
|
|
58
|
+
default: 'Club'
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
data() {
|
|
62
|
+
return {
|
|
63
|
+
tabs,
|
|
64
|
+
windowWidth: window.innerWidth
|
|
65
|
+
};
|
|
66
|
+
},
|
|
67
|
+
mounted() {
|
|
68
|
+
window.addEventListener('resize', this.handleResize);
|
|
69
|
+
},
|
|
70
|
+
beforeUnmount() {
|
|
71
|
+
window.removeEventListener('resize', this.handleResize);
|
|
72
|
+
},
|
|
73
|
+
computed: {
|
|
74
|
+
isMobile() {
|
|
75
|
+
return this.windowWidth <= 748;
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
methods: {
|
|
79
|
+
handleTabMenuClick(value) {
|
|
80
|
+
if (this.saving) return;
|
|
81
|
+
this.$emit('tab:menu-click', value);
|
|
82
|
+
},
|
|
83
|
+
handleSubmit(value) {
|
|
84
|
+
this.$emit('update:submit', value);
|
|
85
|
+
},
|
|
86
|
+
handleResize() {
|
|
87
|
+
this.windowWidth = window.innerWidth;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
</script>
|
|
@@ -1,121 +1,121 @@
|
|
|
1
|
-
import { shallowMount } from '@vue/test-utils';
|
|
2
|
-
import { describe, expect, it } from 'vitest';
|
|
3
|
-
import DirectorModal from '../../../Molecules/Modals/DirectorModal/DirectorModal.vue';
|
|
4
|
-
import EditBoutModal from '../../../Molecules/Modals/EditBoutModal/EditBoutModal.vue';
|
|
5
|
-
import PoolLive from './PoolLive.vue';
|
|
6
|
-
|
|
7
|
-
const createBout = (overrides = {}) => ({
|
|
8
|
-
BoutId: 42,
|
|
9
|
-
DEBoutId: null,
|
|
10
|
-
EventId: 8,
|
|
11
|
-
PoolId: 3,
|
|
12
|
-
OrderIndex: 0,
|
|
13
|
-
Status: 'Scheduled',
|
|
14
|
-
Score1: 4,
|
|
15
|
-
Score2: 3,
|
|
16
|
-
Person1: { PersonId: 1, DisplayName: 'Fencer One' },
|
|
17
|
-
Person2: { PersonId: 2, DisplayName: 'Fencer Two' },
|
|
18
|
-
...overrides
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
const mountPoolLive = bouts =>
|
|
22
|
-
shallowMount(PoolLive, {
|
|
23
|
-
props: {
|
|
24
|
-
bouts,
|
|
25
|
-
event: { EventRules: [] },
|
|
26
|
-
hostingClubColors: {},
|
|
27
|
-
connectedToServer: true,
|
|
28
|
-
editMode: true
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
describe('PoolLive bout ownership', () => {
|
|
33
|
-
it('emits directing intent and waits for authoritative Active props', async () => {
|
|
34
|
-
const bout = createBout();
|
|
35
|
-
const wrapper = mountPoolLive([bout]);
|
|
36
|
-
|
|
37
|
-
wrapper.vm.directBout(bout);
|
|
38
|
-
await wrapper.vm.$nextTick();
|
|
39
|
-
|
|
40
|
-
expect(wrapper.emitted('update:directing-bout')).toEqual([[bout]]);
|
|
41
|
-
expect(wrapper.vm.localBouts[0].Status).toBe('Scheduled');
|
|
42
|
-
expect(wrapper.findComponent(DirectorModal).props('show')).toBe(false);
|
|
43
|
-
|
|
44
|
-
await wrapper.setProps({ bouts: [{ ...bout, Status: 'Active' }] });
|
|
45
|
-
|
|
46
|
-
expect(wrapper.findComponent(DirectorModal).props('show')).toBe(true);
|
|
47
|
-
expect(wrapper.findComponent(DirectorModal).props('bout').Status).toBe('Active');
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
it('resumes an active bout through directing intent', async () => {
|
|
51
|
-
const bout = createBout({ Status: 'Active' });
|
|
52
|
-
const wrapper = mountPoolLive([bout]);
|
|
53
|
-
|
|
54
|
-
wrapper.vm.directBout(bout);
|
|
55
|
-
await wrapper.vm.$nextTick();
|
|
56
|
-
|
|
57
|
-
expect(wrapper.emitted('update:directing-bout')).toEqual([[bout]]);
|
|
58
|
-
expect(wrapper.findComponent(DirectorModal).props('show')).toBe(true);
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
it('closes scoring without resetting status or scores', async () => {
|
|
62
|
-
const bout = createBout({ Status: 'Active', Score1: 6, Score2: 5 });
|
|
63
|
-
const wrapper = mountPoolLive([bout]);
|
|
64
|
-
|
|
65
|
-
wrapper.vm.directBout(bout);
|
|
66
|
-
await wrapper.vm.$nextTick();
|
|
67
|
-
wrapper.findComponent(DirectorModal).vm.$emit('update:closeModal', bout);
|
|
68
|
-
await wrapper.vm.$nextTick();
|
|
69
|
-
|
|
70
|
-
expect(wrapper.vm.localBouts[0]).toMatchObject({ Status: 'Active', Score1: 6, Score2: 5 });
|
|
71
|
-
expect(wrapper.emitted('update:bout')).toBeUndefined();
|
|
72
|
-
expect(wrapper.findComponent(DirectorModal).props('show')).toBe(false);
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
it('submits the draft without assigning Completed or Ended', async () => {
|
|
76
|
-
const bout = createBout({ Status: 'Active' });
|
|
77
|
-
const submittedBout = { ...bout, Score1: 7 };
|
|
78
|
-
const wrapper = mountPoolLive([bout]);
|
|
79
|
-
|
|
80
|
-
wrapper.findComponent(DirectorModal).vm.$emit('submit:bout', submittedBout);
|
|
81
|
-
await wrapper.vm.$nextTick();
|
|
82
|
-
|
|
83
|
-
const emittedBout = wrapper.emitted('submit:bout')[0][0];
|
|
84
|
-
expect(emittedBout).toEqual(submittedBout);
|
|
85
|
-
expect(emittedBout.Status).toBe('Active');
|
|
86
|
-
expect(emittedBout.Ended).toBeUndefined();
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
it('opens completed bouts for editing', async () => {
|
|
90
|
-
const bout = createBout({ Status: 'Completed' });
|
|
91
|
-
const wrapper = mountPoolLive([bout]);
|
|
92
|
-
|
|
93
|
-
wrapper.vm.editBout(bout);
|
|
94
|
-
await wrapper.vm.$nextTick();
|
|
95
|
-
|
|
96
|
-
expect(wrapper.findComponent(EditBoutModal).props('show')).toBe(true);
|
|
97
|
-
expect(wrapper.findComponent(DirectorModal).props('show')).toBe(false);
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
it('forwards make-active intent without changing the draft status', async () => {
|
|
101
|
-
const bout = createBout({ Status: 'Completed' });
|
|
102
|
-
const wrapper = mountPoolLive([bout]);
|
|
103
|
-
|
|
104
|
-
wrapper.findComponent(EditBoutModal).vm.$emit('request:bout-active', bout);
|
|
105
|
-
await wrapper.vm.$nextTick();
|
|
106
|
-
|
|
107
|
-
expect(wrapper.emitted('request:bout-active')).toEqual([[bout]]);
|
|
108
|
-
expect(wrapper.vm.localBouts[0].Status).toBe('Completed');
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
it('swaps scheduled bout order without mutating incoming bouts', () => {
|
|
112
|
-
const firstBout = createBout({ BoutId: 1, OrderIndex: 0 });
|
|
113
|
-
const secondBout = createBout({ BoutId: 2, OrderIndex: 1 });
|
|
114
|
-
const wrapper = mountPoolLive([firstBout, secondBout]);
|
|
115
|
-
|
|
116
|
-
wrapper.vm._swapOrderBetweenIds(firstBout.BoutId, secondBout.BoutId);
|
|
117
|
-
|
|
118
|
-
expect(wrapper.vm.localBouts.map(bout => bout.OrderIndex)).toEqual([1, 0]);
|
|
119
|
-
expect([firstBout.OrderIndex, secondBout.OrderIndex]).toEqual([0, 1]);
|
|
120
|
-
});
|
|
121
|
-
});
|
|
1
|
+
import { shallowMount } from '@vue/test-utils';
|
|
2
|
+
import { describe, expect, it } from 'vitest';
|
|
3
|
+
import DirectorModal from '../../../Molecules/Modals/DirectorModal/DirectorModal.vue';
|
|
4
|
+
import EditBoutModal from '../../../Molecules/Modals/EditBoutModal/EditBoutModal.vue';
|
|
5
|
+
import PoolLive from './PoolLive.vue';
|
|
6
|
+
|
|
7
|
+
const createBout = (overrides = {}) => ({
|
|
8
|
+
BoutId: 42,
|
|
9
|
+
DEBoutId: null,
|
|
10
|
+
EventId: 8,
|
|
11
|
+
PoolId: 3,
|
|
12
|
+
OrderIndex: 0,
|
|
13
|
+
Status: 'Scheduled',
|
|
14
|
+
Score1: 4,
|
|
15
|
+
Score2: 3,
|
|
16
|
+
Person1: { PersonId: 1, DisplayName: 'Fencer One' },
|
|
17
|
+
Person2: { PersonId: 2, DisplayName: 'Fencer Two' },
|
|
18
|
+
...overrides
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const mountPoolLive = bouts =>
|
|
22
|
+
shallowMount(PoolLive, {
|
|
23
|
+
props: {
|
|
24
|
+
bouts,
|
|
25
|
+
event: { EventRules: [] },
|
|
26
|
+
hostingClubColors: {},
|
|
27
|
+
connectedToServer: true,
|
|
28
|
+
editMode: true
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
describe('PoolLive bout ownership', () => {
|
|
33
|
+
it('emits directing intent and waits for authoritative Active props', async () => {
|
|
34
|
+
const bout = createBout();
|
|
35
|
+
const wrapper = mountPoolLive([bout]);
|
|
36
|
+
|
|
37
|
+
wrapper.vm.directBout(bout);
|
|
38
|
+
await wrapper.vm.$nextTick();
|
|
39
|
+
|
|
40
|
+
expect(wrapper.emitted('update:directing-bout')).toEqual([[bout]]);
|
|
41
|
+
expect(wrapper.vm.localBouts[0].Status).toBe('Scheduled');
|
|
42
|
+
expect(wrapper.findComponent(DirectorModal).props('show')).toBe(false);
|
|
43
|
+
|
|
44
|
+
await wrapper.setProps({ bouts: [{ ...bout, Status: 'Active' }] });
|
|
45
|
+
|
|
46
|
+
expect(wrapper.findComponent(DirectorModal).props('show')).toBe(true);
|
|
47
|
+
expect(wrapper.findComponent(DirectorModal).props('bout').Status).toBe('Active');
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it('resumes an active bout through directing intent', async () => {
|
|
51
|
+
const bout = createBout({ Status: 'Active' });
|
|
52
|
+
const wrapper = mountPoolLive([bout]);
|
|
53
|
+
|
|
54
|
+
wrapper.vm.directBout(bout);
|
|
55
|
+
await wrapper.vm.$nextTick();
|
|
56
|
+
|
|
57
|
+
expect(wrapper.emitted('update:directing-bout')).toEqual([[bout]]);
|
|
58
|
+
expect(wrapper.findComponent(DirectorModal).props('show')).toBe(true);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it('closes scoring without resetting status or scores', async () => {
|
|
62
|
+
const bout = createBout({ Status: 'Active', Score1: 6, Score2: 5 });
|
|
63
|
+
const wrapper = mountPoolLive([bout]);
|
|
64
|
+
|
|
65
|
+
wrapper.vm.directBout(bout);
|
|
66
|
+
await wrapper.vm.$nextTick();
|
|
67
|
+
wrapper.findComponent(DirectorModal).vm.$emit('update:closeModal', bout);
|
|
68
|
+
await wrapper.vm.$nextTick();
|
|
69
|
+
|
|
70
|
+
expect(wrapper.vm.localBouts[0]).toMatchObject({ Status: 'Active', Score1: 6, Score2: 5 });
|
|
71
|
+
expect(wrapper.emitted('update:bout')).toBeUndefined();
|
|
72
|
+
expect(wrapper.findComponent(DirectorModal).props('show')).toBe(false);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it('submits the draft without assigning Completed or Ended', async () => {
|
|
76
|
+
const bout = createBout({ Status: 'Active' });
|
|
77
|
+
const submittedBout = { ...bout, Score1: 7 };
|
|
78
|
+
const wrapper = mountPoolLive([bout]);
|
|
79
|
+
|
|
80
|
+
wrapper.findComponent(DirectorModal).vm.$emit('submit:bout', submittedBout);
|
|
81
|
+
await wrapper.vm.$nextTick();
|
|
82
|
+
|
|
83
|
+
const emittedBout = wrapper.emitted('submit:bout')[0][0];
|
|
84
|
+
expect(emittedBout).toEqual(submittedBout);
|
|
85
|
+
expect(emittedBout.Status).toBe('Active');
|
|
86
|
+
expect(emittedBout.Ended).toBeUndefined();
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
it('opens completed bouts for editing', async () => {
|
|
90
|
+
const bout = createBout({ Status: 'Completed' });
|
|
91
|
+
const wrapper = mountPoolLive([bout]);
|
|
92
|
+
|
|
93
|
+
wrapper.vm.editBout(bout);
|
|
94
|
+
await wrapper.vm.$nextTick();
|
|
95
|
+
|
|
96
|
+
expect(wrapper.findComponent(EditBoutModal).props('show')).toBe(true);
|
|
97
|
+
expect(wrapper.findComponent(DirectorModal).props('show')).toBe(false);
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
it('forwards make-active intent without changing the draft status', async () => {
|
|
101
|
+
const bout = createBout({ Status: 'Completed' });
|
|
102
|
+
const wrapper = mountPoolLive([bout]);
|
|
103
|
+
|
|
104
|
+
wrapper.findComponent(EditBoutModal).vm.$emit('request:bout-active', bout);
|
|
105
|
+
await wrapper.vm.$nextTick();
|
|
106
|
+
|
|
107
|
+
expect(wrapper.emitted('request:bout-active')).toEqual([[bout]]);
|
|
108
|
+
expect(wrapper.vm.localBouts[0].Status).toBe('Completed');
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
it('swaps scheduled bout order without mutating incoming bouts', () => {
|
|
112
|
+
const firstBout = createBout({ BoutId: 1, OrderIndex: 0 });
|
|
113
|
+
const secondBout = createBout({ BoutId: 2, OrderIndex: 1 });
|
|
114
|
+
const wrapper = mountPoolLive([firstBout, secondBout]);
|
|
115
|
+
|
|
116
|
+
wrapper.vm._swapOrderBetweenIds(firstBout.BoutId, secondBout.BoutId);
|
|
117
|
+
|
|
118
|
+
expect(wrapper.vm.localBouts.map(bout => bout.OrderIndex)).toEqual([1, 0]);
|
|
119
|
+
expect([firstBout.OrderIndex, secondBout.OrderIndex]).toEqual([0, 1]);
|
|
120
|
+
});
|
|
121
|
+
});
|
|
@@ -11,7 +11,7 @@ export default {
|
|
|
11
11
|
},
|
|
12
12
|
argTypes: {
|
|
13
13
|
currentTab: { control: { type: 'text' } },
|
|
14
|
-
tabs: { control: { type: '
|
|
14
|
+
tabs: { control: { type: 'object' } },
|
|
15
15
|
tabMenuClick: { action: 'tabMenuClick' }
|
|
16
16
|
}
|
|
17
17
|
};
|
|
@@ -25,7 +25,7 @@ export const Default = {
|
|
|
25
25
|
|
|
26
26
|
export const DirectorMenu = {
|
|
27
27
|
args: {
|
|
28
|
-
currentTab: '
|
|
28
|
+
currentTab: 'Pools',
|
|
29
29
|
tabs: tabs('Director')
|
|
30
30
|
}
|
|
31
31
|
};
|
|
@@ -43,3 +43,10 @@ export const PersonProfileAdmin = {
|
|
|
43
43
|
tabs: personProfileTabs('admin')
|
|
44
44
|
}
|
|
45
45
|
};
|
|
46
|
+
|
|
47
|
+
export const PhoneDirector = {
|
|
48
|
+
args: {
|
|
49
|
+
currentTab: 'Pools',
|
|
50
|
+
tabs: tabs('Admin', true)
|
|
51
|
+
}
|
|
52
|
+
};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
3
|
<section class="flex">
|
|
4
|
-
<TabBar class="border-b border-dropdownSelect mb-5 overflow-auto w-full flex
|
|
5
|
-
<div class="w-full flex md:flex-
|
|
4
|
+
<TabBar class="border-b border-dropdownSelect mb-5 overflow-x-auto w-full flex">
|
|
5
|
+
<div class="w-full flex md:flex-wrap">
|
|
6
6
|
<BaseButton
|
|
7
7
|
v-for="tab in tabs"
|
|
8
8
|
:key="tab.id"
|
|
9
9
|
:selected="currentTab === tab.id"
|
|
10
|
-
class="mx-
|
|
10
|
+
class="mx-1 md:mx-3 min-h-11 shrink-0 text-xs md:text-sm"
|
|
11
|
+
:class="{ 'hidden md:inline-block': tab.mobileHidden }"
|
|
11
12
|
size="sm"
|
|
12
13
|
:dropDown="!!tab.children"
|
|
13
14
|
:iconName="getIconName(tab)"
|
|
@@ -70,7 +71,7 @@ export default {
|
|
|
70
71
|
},
|
|
71
72
|
computed: {
|
|
72
73
|
isMobile() {
|
|
73
|
-
return this.windowWidth
|
|
74
|
+
return this.windowWidth < 768;
|
|
74
75
|
},
|
|
75
76
|
selectedDropdownItems() {
|
|
76
77
|
return this.tabs.find(tab => tab.id === this.activeDropdown)?.children || [];
|
package/src/stories/Templates/PersonManagement/Admin/Administration/Administration.stories.js
CHANGED
|
@@ -1,81 +1,81 @@
|
|
|
1
|
-
import Administration from './Administration.vue';
|
|
2
|
-
import personsMock from '../../../../../mocks/personsMock.js';
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
title: 'Templates/PersonManagement/Admin/Administration',
|
|
6
|
-
component: Administration,
|
|
7
|
-
tags: ['autodocs'],
|
|
8
|
-
args: {
|
|
9
|
-
person: personsMock[1],
|
|
10
|
-
userLevel: 'Club'
|
|
11
|
-
},
|
|
12
|
-
argTypes: {
|
|
13
|
-
person: { control: { type: 'object' } },
|
|
14
|
-
userLevel: {
|
|
15
|
-
control: { type: 'select' },
|
|
16
|
-
options: ['User', 'Director', 'Club', 'Admin']
|
|
17
|
-
},
|
|
18
|
-
'update:person': { action: 'update:person' }
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export const Default = {
|
|
23
|
-
args: {
|
|
24
|
-
person: personsMock[1],
|
|
25
|
-
userLevel: 'Club'
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export const AdminCanSelectAdminAccess = {
|
|
30
|
-
args: {
|
|
31
|
-
person: {
|
|
32
|
-
...personsMock[1],
|
|
33
|
-
AccessLevel: 'Admin'
|
|
34
|
-
},
|
|
35
|
-
userLevel: 'Admin'
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
export const AdminEditingUserAccess = {
|
|
40
|
-
args: {
|
|
41
|
-
person: {
|
|
42
|
-
...personsMock[1],
|
|
43
|
-
AccessLevel: 'User'
|
|
44
|
-
},
|
|
45
|
-
userLevel: 'Admin'
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
export const WithoutHemaRating = {
|
|
50
|
-
args: {
|
|
51
|
-
person: {
|
|
52
|
-
...personsMock[1],
|
|
53
|
-
HemaRatingsId: ''
|
|
54
|
-
},
|
|
55
|
-
userLevel: 'Club'
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
export const EmptyAccessLevel = {
|
|
60
|
-
args: {
|
|
61
|
-
person: {
|
|
62
|
-
...personsMock[1],
|
|
63
|
-
AccessLevel: ''
|
|
64
|
-
},
|
|
65
|
-
userLevel: 'Club'
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
export const ClearedHemaRatingId = {
|
|
70
|
-
args: {
|
|
71
|
-
person: { ...personsMock[1], HemaRatingsId: null, HEMARatings: [{ HemaRatingId: 123 }] },
|
|
72
|
-
userLevel: 'Admin'
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
export const InvalidHemaRatingId = {
|
|
77
|
-
args: {
|
|
78
|
-
person: { ...personsMock[1], HemaRatingsId: '1.5' },
|
|
79
|
-
userLevel: 'Admin'
|
|
80
|
-
}
|
|
81
|
-
};
|
|
1
|
+
import Administration from './Administration.vue';
|
|
2
|
+
import personsMock from '../../../../../mocks/personsMock.js';
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: 'Templates/PersonManagement/Admin/Administration',
|
|
6
|
+
component: Administration,
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
args: {
|
|
9
|
+
person: personsMock[1],
|
|
10
|
+
userLevel: 'Club'
|
|
11
|
+
},
|
|
12
|
+
argTypes: {
|
|
13
|
+
person: { control: { type: 'object' } },
|
|
14
|
+
userLevel: {
|
|
15
|
+
control: { type: 'select' },
|
|
16
|
+
options: ['User', 'Director', 'Club', 'Admin']
|
|
17
|
+
},
|
|
18
|
+
'update:person': { action: 'update:person' }
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const Default = {
|
|
23
|
+
args: {
|
|
24
|
+
person: personsMock[1],
|
|
25
|
+
userLevel: 'Club'
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const AdminCanSelectAdminAccess = {
|
|
30
|
+
args: {
|
|
31
|
+
person: {
|
|
32
|
+
...personsMock[1],
|
|
33
|
+
AccessLevel: 'Admin'
|
|
34
|
+
},
|
|
35
|
+
userLevel: 'Admin'
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const AdminEditingUserAccess = {
|
|
40
|
+
args: {
|
|
41
|
+
person: {
|
|
42
|
+
...personsMock[1],
|
|
43
|
+
AccessLevel: 'User'
|
|
44
|
+
},
|
|
45
|
+
userLevel: 'Admin'
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const WithoutHemaRating = {
|
|
50
|
+
args: {
|
|
51
|
+
person: {
|
|
52
|
+
...personsMock[1],
|
|
53
|
+
HemaRatingsId: ''
|
|
54
|
+
},
|
|
55
|
+
userLevel: 'Club'
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export const EmptyAccessLevel = {
|
|
60
|
+
args: {
|
|
61
|
+
person: {
|
|
62
|
+
...personsMock[1],
|
|
63
|
+
AccessLevel: ''
|
|
64
|
+
},
|
|
65
|
+
userLevel: 'Club'
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export const ClearedHemaRatingId = {
|
|
70
|
+
args: {
|
|
71
|
+
person: { ...personsMock[1], HemaRatingsId: null, HEMARatings: [{ HemaRatingId: 123 }] },
|
|
72
|
+
userLevel: 'Admin'
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export const InvalidHemaRatingId = {
|
|
77
|
+
args: {
|
|
78
|
+
person: { ...personsMock[1], HemaRatingsId: '1.5' },
|
|
79
|
+
userLevel: 'Admin'
|
|
80
|
+
}
|
|
81
|
+
};
|