@dcrackel/hematournamentui 1.0.708 → 1.0.710

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 (38) hide show
  1. package/README.md +148 -106
  2. package/dist/HemaTournamentUI-lib.es.js +6678 -6196
  3. package/dist/HemaTournamentUI-lib.umd.js +27 -27
  4. package/dist/hematournamentui-tailwind.css +16 -6
  5. package/package.json +1 -1
  6. package/src/stories/Atoms/Input/BaseInput.test.js +97 -85
  7. package/src/stories/Atoms/Input/BaseInput.vue +149 -150
  8. package/src/stories/Organisms/ComplexInputs/ImageCropper/ImageCropper.stories.js +31 -20
  9. package/src/stories/Organisms/ComplexInputs/ImageCropper/ImageCropper.test.js +109 -0
  10. package/src/stories/Organisms/ComplexInputs/ImageCropper/ImageCropper.vue +192 -133
  11. package/src/stories/Organisms/Wizards/EditEventWizard/BasicEventInfo/BasicEventInfo.stories.js +48 -41
  12. package/src/stories/Organisms/Wizards/EditEventWizard/BasicEventInfo/BasicEventInfo.vue +227 -206
  13. package/src/stories/Organisms/Wizards/EditEventWizard/DirectElimination/DirectElimination.vue +226 -225
  14. package/src/stories/Organisms/Wizards/EditEventWizard/DirectEliminationPromotion/DirectEliminationPromotion.vue +204 -204
  15. package/src/stories/Organisms/Wizards/EditEventWizard/EditEventWizard.stories.js +133 -91
  16. package/src/stories/Organisms/Wizards/EditEventWizard/EditEventWizard.test.js +191 -0
  17. package/src/stories/Organisms/Wizards/EditEventWizard/EditEventWizard.vue +366 -309
  18. package/src/stories/Organisms/Wizards/EditEventWizard/EventCustomization/EventCustomization.vue +172 -171
  19. package/src/stories/Organisms/Wizards/EditEventWizard/PoolConfiguration/PoolConfiguration.vue +216 -215
  20. package/src/stories/Organisms/Wizards/EditEventWizard/PriceFields.test.js +79 -0
  21. package/src/stories/Templates/EventManagement/EditEventInfo/EditEventInfo.stories.js +93 -52
  22. package/src/stories/Templates/EventManagement/EditEventInfo/EditEventInfo.vue +91 -75
  23. package/src/stories/Templates/PersonManagement/Admin/Administration/Administration.stories.js +14 -0
  24. package/src/stories/Templates/PersonManagement/Admin/Administration/Administration.test.js +39 -0
  25. package/src/stories/Templates/PersonManagement/Admin/Administration/Administration.vue +13 -3
  26. package/src/stories/Templates/PersonManagement/Basic/BasicEdit.vue +170 -172
  27. package/src/stories/Templates/PersonManagement/PersonManagement.stories.js +156 -103
  28. package/src/stories/Templates/PersonManagement/PersonManagement.test.js +329 -0
  29. package/src/stories/Templates/PersonManagement/PersonManagement.vue +329 -213
  30. package/src/stories/Templates/PersonManagement/PersonManagementDraft.js +42 -0
  31. package/src/stories/Templates/TournamentManagement/TournamentManagement.stories.js +84 -83
  32. package/src/stories/Templates/TournamentManagement/TournamentManagement.test.js +89 -0
  33. package/src/stories/Templates/TournamentManagement/TournamentManagement.vue +363 -360
  34. package/src/stories/Templates/TournamentManagement/TournamentPageOne/TournamentPageOne.stories.js +116 -113
  35. package/src/stories/Templates/TournamentManagement/TournamentPageOne/TournamentPageOne.vue +292 -280
  36. package/src/stories/Util/Validations/PersonManagementValidations.js +45 -29
  37. package/src/stories/Util/Validations/PriceValidation.js +6 -0
  38. package/src/stories/Util/Validations/TournamentFieldsValidations.js +4 -0
@@ -1,204 +1,204 @@
1
- <template>
2
- <div class="flex flex-col h-full pb-4">
3
- <div class="w-full flex justify-center grow">
4
- <StepIndicator :steps="steps" :selected="currentStep" />
5
- </div>
6
- <div class="w-full flex flex-row justify-center my-4 grow">
7
- <BaseText
8
- :color="'primaryHighlight'"
9
- :size="'2xl'"
10
- text="DIRECT ELIMINATION PROMOTION"
11
- :weight="'normal'"
12
- data-testid="text-add-tournament"
13
- />
14
- </div>
15
-
16
- <div class="w-full flex mb-3 ml-1 grow">
17
- <BaseText
18
- :color="'quinary'"
19
- :size="'sm'"
20
- :text="'Define the criteria for promoting fencers to the Direct Elimination (DE) stage. These options specify how fencers advance based on their performance metrics. Ensure the correct order of criteria to reflect their importance in the promotion process.'"
21
- :weight="'normal'"
22
- data-testid="text-registration"
23
- />
24
- </div>
25
-
26
- <div class="grow">
27
- <div class="mt-8">
28
- <BaseText
29
- :color="'quaternary'"
30
- :size="'sm'"
31
- :text="'DIRECT ELIMINATION PROMOTION CRITERIA'"
32
- class="border-b mt-5"
33
- />
34
- </div>
35
-
36
- <div class="mt-1 mb-4 grow">
37
- <BaseText
38
- :color="'quinary'"
39
- :size="'sm'"
40
- text="Choose how people are promoted from pools into the elimination bracket."
41
- :weight="'normal'"
42
- data-testid="text-registration"
43
- class="mb-5"
44
- />
45
-
46
- {{ eventConfig.DEPromoteBy }}
47
- <DropDownMenu
48
- label=""
49
- :items="DEPromotionTypes"
50
- :selectedItem="selectedItem"
51
- :alignEnd="false"
52
- :width="'w-full'"
53
- @update:selectedItem="handleDEPromotionTypeChange"
54
- />
55
- </div>
56
-
57
- <div class="mb-2 flex flex-col">
58
- <BaseText
59
- :color="'quinary'"
60
- :size="'sm'"
61
- :text="DEPromotionDescription"
62
- :weight="'normal'"
63
- data-testid="text-registration"
64
- class="mb-4"
65
- />
66
- <TitledInput
67
- :inputValue="eventConfig.DEPromotionAmount"
68
- :invalid="validation.DEPromotionAmount"
69
- :allowPercent="true"
70
- placeholder="Enter Number or Percent.."
71
- title=""
72
- @update:value="handleDEPromotionAmountChange"
73
- />
74
- </div>
75
- </div>
76
-
77
- <div class="grow">
78
- <div class="mt-8">
79
- <BaseText
80
- :color="'quaternary'"
81
- :size="'sm'"
82
- :text="'ORDER OF STATS TO DECIDE PROMOTION'"
83
- class="border-b mt-5"
84
- />
85
- </div>
86
- <div class="pb-4 -mt-3">
87
- <MultiSelect
88
- label="Select and arrange the statistical criteria that will be used to promote participants to the Direct Elimination (DE) stage. The order of these criteria is crucial as it determines the priority for promotion. Choose up to three stats from the available options."
89
- :initialSelectedTags="eventConfig.DEPromotionOrder"
90
- :availableTags="['Win Percent', 'Win Count', 'Indicator', 'Points Scored']"
91
- @update:selectedTags="handleMultiSelect"
92
- />
93
- </div>
94
- </div>
95
- <div class="flex flex-row justify-center h-12 mt-4">
96
- <BaseButton class="w-1/2 ml-1" color="neutral" label="Back" size="sm" type="primary" @buttonClick="handleBack" />
97
- <BaseButton
98
- class="w-1/2 mr-1 transition-all duration-300 ease-in-out h-12"
99
- color="neutral"
100
- label="Next"
101
- selected="selected"
102
- size="sm"
103
- type="primary"
104
- @buttonClick="handleNext"
105
- />
106
- </div>
107
- </div>
108
- </template>
109
-
110
- <script>
111
- import TitledInput from '../../../../Molecules/CombinationInputs/TitledInput/TitledInput.vue';
112
- import MultiSelect from '../../../../Molecules/Inputs/MultiSelect/MultiSelect.vue';
113
- import BaseText from '../../../../Atoms/Text/BaseText.vue';
114
- import BaseButton from '../../../../Molecules/Buttons/BaseButton/BaseButton.vue';
115
- import StepIndicator from '../../../../Molecules/StepIndicator/BaseStepIndicator/StepIndicator.vue';
116
- import DropDownMenu from '../../../ComplexInputs/DropDown/DropDownMenu.vue';
117
- import Toggle from '../../../../Molecules/Inputs/Toggle/Toggle.vue';
118
-
119
- const promotionTypeDefaults = {
120
- 'Top Percent': { typeCode: 'Percent', defaultAmount: '100%' },
121
- 'Top Count': { typeCode: 'Count', defaultAmount: '16' },
122
- 'Top Count of Each Pool': { typeCode: 'Top', defaultAmount: '2' }
123
- };
124
-
125
- const defaultPromotionType = { typeCode: 'Percent', defaultAmount: '100%' };
126
-
127
- export default {
128
- name: 'DirectEliminationPromotion',
129
- emits: ['update', 'update:back', 'update:DEPromotionType', 'update:next'],
130
- components: { Toggle, DropDownMenu, StepIndicator, BaseButton, BaseText, TitledInput, MultiSelect },
131
- props: {
132
- eventConfig: Object,
133
- validation: Object,
134
- currentStep: Number,
135
- steps: Array
136
- },
137
- data() {
138
- return {
139
- selectedItem: null
140
- };
141
- },
142
- watch: {
143
- 'eventConfig.DEPromoteBy': {
144
- immediate: true,
145
- handler(value) {
146
- const map = {
147
- Percent: 'Top Percent',
148
- Count: 'Top Count',
149
- Top: 'Top Count of Each Pool'
150
- };
151
- const display = map[value] || 'Top Percent';
152
- this.selectedItem = this.DEPromotionTypes.find(item => item.text === display);
153
- }
154
- }
155
- },
156
- computed: {
157
- selectedFormat() {
158
- return this.selectedFormat.Name;
159
- },
160
- DEPromotionTypes() {
161
- return [
162
- { text: 'Top Percent', link: 'Top Percent' },
163
- { text: 'Top Count', link: 'Top Count' },
164
- { text: 'Top Count of Each Pool', link: 'Top Count of Each Pool' }
165
- ];
166
- },
167
- DEPromotionDescription() {
168
- if (this.selectedItem.text === 'Top Percent') {
169
- return 'Use this option to promote a percentage of participants to the Direct Elimination (DE) stage. Enter a percentage value (e.g., 100% to promote all participants or 50% to promote the top half).';
170
- }
171
- if (this.selectedItem.text === 'Top Count') {
172
- return 'Use this option to promote a specific number of participants to the Direct Elimination (DE) stage. Enter a whole number (e.g., 16 to promote the top 16 participants).';
173
- }
174
- if (this.selectedItem.text === 'Top Count of Each Pool') {
175
- return 'Use this option to promote a set number of participants from each pool to the Direct Elimination (DE) stage. Enter a whole number (e.g., 2 to promote the top 2 participants from each pool).';
176
- }
177
- }
178
- },
179
- methods: {
180
- handleDEPromotionAmountChange(value) {
181
- this.$emit('update', { DEPromotionAmount: value });
182
- },
183
- handleMultiSelect(value) {
184
- this.$emit('update', { DEPromotionOrder: value });
185
- },
186
- handleBack() {
187
- this.$emit('update:back');
188
- },
189
- handleNext() {
190
- this.$emit('update:next', this.eventConfig);
191
- },
192
- handleDEPromotionTypeChange(item) {
193
- this.selectedItem = item;
194
-
195
- const { typeCode, defaultAmount } = promotionTypeDefaults[item.text] || defaultPromotionType;
196
-
197
- this.eventConfig.DEPromotionTypes = typeCode;
198
- this.eventConfig.DEPromotionAmount = defaultAmount;
199
-
200
- this.$emit('update:DEPromotionType', typeCode);
201
- }
202
- }
203
- };
204
- </script>
1
+ <template>
2
+ <div class="flex flex-col h-full pb-4">
3
+ <div class="w-full flex justify-center grow">
4
+ <StepIndicator :steps="steps" :selected="currentStep" />
5
+ </div>
6
+ <div class="w-full flex flex-row justify-center my-4 grow">
7
+ <BaseText
8
+ :color="'primaryHighlight'"
9
+ :size="'2xl'"
10
+ text="DIRECT ELIMINATION PROMOTION"
11
+ :weight="'normal'"
12
+ data-testid="text-add-tournament"
13
+ />
14
+ </div>
15
+
16
+ <div class="w-full flex mb-3 ml-1 grow">
17
+ <BaseText
18
+ :color="'quinary'"
19
+ :size="'sm'"
20
+ :text="'Define the criteria for promoting fencers to the Direct Elimination (DE) stage. These options specify how fencers advance based on their performance metrics. Ensure the correct order of criteria to reflect their importance in the promotion process.'"
21
+ :weight="'normal'"
22
+ data-testid="text-registration"
23
+ />
24
+ </div>
25
+
26
+ <div class="grow">
27
+ <div class="mt-8">
28
+ <BaseText
29
+ :color="'quaternary'"
30
+ :size="'sm'"
31
+ :text="'DIRECT ELIMINATION PROMOTION CRITERIA'"
32
+ class="border-b mt-5"
33
+ />
34
+ </div>
35
+
36
+ <div class="mt-1 mb-4 grow">
37
+ <BaseText
38
+ :color="'quinary'"
39
+ :size="'sm'"
40
+ text="Choose how people are promoted from pools into the elimination bracket."
41
+ :weight="'normal'"
42
+ data-testid="text-registration"
43
+ class="mb-5"
44
+ />
45
+
46
+ {{ eventConfig.DEPromoteBy }}
47
+ <DropDownMenu
48
+ label=""
49
+ :items="DEPromotionTypes"
50
+ :selectedItem="selectedItem"
51
+ :alignEnd="false"
52
+ :width="'w-full'"
53
+ @update:selectedItem="handleDEPromotionTypeChange"
54
+ />
55
+ </div>
56
+
57
+ <div class="mb-2 flex flex-col">
58
+ <BaseText
59
+ :color="'quinary'"
60
+ :size="'sm'"
61
+ :text="DEPromotionDescription"
62
+ :weight="'normal'"
63
+ data-testid="text-registration"
64
+ class="mb-4"
65
+ />
66
+ <TitledInput
67
+ :inputValue="eventConfig.DEPromotionAmount"
68
+ :invalid="validation.DEPromotionAmount"
69
+ :allowPercent="true"
70
+ placeholder="Enter Number or Percent.."
71
+ title=""
72
+ @update:value="handleDEPromotionAmountChange"
73
+ />
74
+ </div>
75
+ </div>
76
+
77
+ <div class="grow">
78
+ <div class="mt-8">
79
+ <BaseText
80
+ :color="'quaternary'"
81
+ :size="'sm'"
82
+ :text="'ORDER OF STATS TO DECIDE PROMOTION'"
83
+ class="border-b mt-5"
84
+ />
85
+ </div>
86
+ <div class="pb-4 -mt-3">
87
+ <MultiSelect
88
+ label="Select and arrange the statistical criteria that will be used to promote participants to the Direct Elimination (DE) stage. The order of these criteria is crucial as it determines the priority for promotion. Choose up to three stats from the available options."
89
+ :initialSelectedTags="eventConfig.DEPromotionOrder"
90
+ :availableTags="['Win Percent', 'Win Count', 'Indicator', 'Points Scored']"
91
+ @update:selectedTags="handleMultiSelect"
92
+ />
93
+ </div>
94
+ </div>
95
+ <div class="flex flex-row justify-center h-12 mt-4">
96
+ <BaseButton class="w-1/2 ml-1" color="neutral" label="Back" size="sm" type="primary" @buttonClick="handleBack" />
97
+ <BaseButton
98
+ class="w-1/2 mr-1 transition-all duration-300 ease-in-out h-12"
99
+ color="neutral"
100
+ :label="nextButtonLabel"
101
+ selected="selected"
102
+ size="sm"
103
+ type="primary"
104
+ @buttonClick="handleNext"
105
+ />
106
+ </div>
107
+ </div>
108
+ </template>
109
+
110
+ <script>
111
+ import TitledInput from '../../../../Molecules/CombinationInputs/TitledInput/TitledInput.vue';
112
+ import MultiSelect from '../../../../Molecules/Inputs/MultiSelect/MultiSelect.vue';
113
+ import BaseText from '../../../../Atoms/Text/BaseText.vue';
114
+ import BaseButton from '../../../../Molecules/Buttons/BaseButton/BaseButton.vue';
115
+ import StepIndicator from '../../../../Molecules/StepIndicator/BaseStepIndicator/StepIndicator.vue';
116
+ import DropDownMenu from '../../../ComplexInputs/DropDown/DropDownMenu.vue';
117
+ import Toggle from '../../../../Molecules/Inputs/Toggle/Toggle.vue';
118
+
119
+ const promotionTypeDefaults = {
120
+ 'Top Percent': { typeCode: 'Percent', defaultAmount: '100%' },
121
+ 'Top Count': { typeCode: 'Count', defaultAmount: '16' },
122
+ 'Top Count of Each Pool': { typeCode: 'Top', defaultAmount: '2' }
123
+ };
124
+
125
+ const defaultPromotionType = { typeCode: 'Percent', defaultAmount: '100%' };
126
+
127
+ export default {
128
+ name: 'DirectEliminationPromotion',
129
+ emits: ['update', 'update:back', 'update:DEPromotionType', 'update:next'],
130
+ components: { Toggle, DropDownMenu, StepIndicator, BaseButton, BaseText, TitledInput, MultiSelect },
131
+ props: {
132
+ nextButtonLabel: { type: String, default: 'Next' },
133
+ eventConfig: Object,
134
+ validation: Object,
135
+ currentStep: Number,
136
+ steps: Array
137
+ },
138
+ data() {
139
+ return {
140
+ selectedItem: null
141
+ };
142
+ },
143
+ watch: {
144
+ 'eventConfig.DEPromoteBy': {
145
+ immediate: true,
146
+ handler(value) {
147
+ const map = {
148
+ Percent: 'Top Percent',
149
+ Count: 'Top Count',
150
+ Top: 'Top Count of Each Pool'
151
+ };
152
+ const display = map[value] || 'Top Percent';
153
+ this.selectedItem = this.DEPromotionTypes.find(item => item.text === display);
154
+ }
155
+ }
156
+ },
157
+ computed: {
158
+ selectedFormat() {
159
+ return this.selectedFormat.Name;
160
+ },
161
+ DEPromotionTypes() {
162
+ return [
163
+ { text: 'Top Percent', link: 'Top Percent' },
164
+ { text: 'Top Count', link: 'Top Count' },
165
+ { text: 'Top Count of Each Pool', link: 'Top Count of Each Pool' }
166
+ ];
167
+ },
168
+ DEPromotionDescription() {
169
+ if (this.selectedItem.text === 'Top Percent') {
170
+ return 'Use this option to promote a percentage of participants to the Direct Elimination (DE) stage. Enter a percentage value (e.g., 100% to promote all participants or 50% to promote the top half).';
171
+ }
172
+ if (this.selectedItem.text === 'Top Count') {
173
+ return 'Use this option to promote a specific number of participants to the Direct Elimination (DE) stage. Enter a whole number (e.g., 16 to promote the top 16 participants).';
174
+ }
175
+ if (this.selectedItem.text === 'Top Count of Each Pool') {
176
+ return 'Use this option to promote a set number of participants from each pool to the Direct Elimination (DE) stage. Enter a whole number (e.g., 2 to promote the top 2 participants from each pool).';
177
+ }
178
+ }
179
+ },
180
+ methods: {
181
+ handleDEPromotionAmountChange(value) {
182
+ this.$emit('update', { DEPromotionAmount: value });
183
+ },
184
+ handleMultiSelect(value) {
185
+ this.$emit('update', { DEPromotionOrder: value });
186
+ },
187
+ handleBack() {
188
+ this.$emit('update:back');
189
+ },
190
+ handleNext() {
191
+ this.$emit('update:next', this.eventConfig);
192
+ },
193
+ handleDEPromotionTypeChange(item) {
194
+ this.selectedItem = item;
195
+
196
+ const { typeCode, defaultAmount } = promotionTypeDefaults[item.text] || defaultPromotionType;
197
+
198
+ this.$emit('update', { DEPromoteBy: typeCode, DEPromotionAmount: defaultAmount });
199
+
200
+ this.$emit('update:DEPromotionType', typeCode);
201
+ }
202
+ }
203
+ };
204
+ </script>
@@ -1,91 +1,133 @@
1
- import EditEvent from './EditEventWizard.vue';
2
- import singleEventMock from '../../../../mocks/singleEventMock.js';
3
-
4
- export default {
5
- title: 'Organisms/Wizards/EditEventWizard/EditEventWizard',
6
- component: EditEvent,
7
- args: {
8
- event: singleEventMock,
9
- weapons: [
10
- { text: 'Longsword', link: 1 },
11
- { text: 'Saber', link: 2 },
12
- { text: 'Rapier', link: 3 }
13
- ],
14
- DEFormats: [
15
- { text: 'Single Elimination', link: 1 },
16
- { text: 'Double Elimination', link: 2 },
17
- { text: 'Single Elimination with Round Robin Semi-Final', link: 3 }
18
- ],
19
- userLevel: 'Admin'
20
- },
21
- argTypes: {
22
- event: { control: 'object' },
23
- weapons: { control: 'object' },
24
- DEFormats: { control: 'object' },
25
- userLevel: { control: 'string' }
26
- }
27
- };
28
-
29
- export const Default = {
30
- args: {
31
- event: singleEventMock,
32
- weapons: [
33
- { text: 'Longsword', link: 1 },
34
- { text: 'Saber', link: 2 },
35
- { text: 'Rapier', link: 3 }
36
- ],
37
- DEFormats: [
38
- { text: 'Single Elimination', link: 1 },
39
- { text: 'Double Elimination', link: 2 },
40
- { text: 'Single Elimination with Round Robin Semi-Final', link: 3 }
41
- ],
42
- userLevel: 'Admin'
43
- }
44
- };
45
- // new Date().toISOString().split('T')[0],
46
- export const newEventAsClub = {
47
- args: {
48
- event: {
49
- EventId: 0,
50
- CountDoubles: false,
51
- CountHandshots: false,
52
- CutOffNumber: 64,
53
- DEBoutCount: 7,
54
- DEBoutCounter: false,
55
- DEMax: false,
56
- DEMaxPoints: 12,
57
- DEPromoteBy: ['Top Percent', 'Top Count', 'Top Count of Each Pool'],
58
- DEPromotionAmount: '100%',
59
- DEPromotionOrder: ['Win Percent', 'Win Count', 'Indicator', 'Points Scored'],
60
- DETime: 180,
61
- DETimer: false,
62
- DEType: 'single',
63
- Date: new Date().toISOString().split('T')[0],
64
- EventName: '',
65
- NumberOfRings: 2,
66
- PenaltiesReset: true,
67
- PoolScoreDirection: true,
68
- StartTime: '12:00:00',
69
- WeaponId: 1,
70
- boutCount: 5,
71
- boutCounter: false,
72
- poolMax: false,
73
- poolMaxPoints: 7,
74
- poolTime: 180,
75
- poolTimer: false,
76
- seedWith: 'M2 - MeyerSquared',
77
- thirdPlaceBout: false
78
- },
79
- weapons: [
80
- { text: 'Longsword', link: 1 },
81
- { text: 'Saber', link: 2 },
82
- { text: 'Rapier', link: 3 }
83
- ],
84
- DEFormats: [
85
- { text: 'Single Elimination', link: 1 },
86
- { text: 'Double Elimination', link: 2 },
87
- { text: 'Single Elimination with Round Robin Semi-Final', link: 3 }
88
- ],
89
- userLevel: 'Club'
90
- }
91
- };
1
+ import { ref } from 'vue';
2
+ import EditEvent from './EditEventWizard.vue';
3
+ import singleEventMock from '../../../../mocks/singleEventMock.js';
4
+
5
+ export default {
6
+ title: 'Organisms/Wizards/EditEventWizard/EditEventWizard',
7
+ component: EditEvent,
8
+ args: {
9
+ event: { ...singleEventMock, EventPrice: 25.5 },
10
+ weapons: [
11
+ { text: 'Longsword', link: 1 },
12
+ { text: 'Saber', link: 2 },
13
+ { text: 'Rapier', link: 3 }
14
+ ],
15
+ DEFormats: [
16
+ { text: 'Single Elimination', link: 1 },
17
+ { text: 'Double Elimination', link: 2 },
18
+ { text: 'Single Elimination with Round Robin Semi-Final', link: 3 }
19
+ ],
20
+ userLevel: 'Admin'
21
+ },
22
+ argTypes: {
23
+ editMode: { control: 'boolean' },
24
+ step: { control: { type: 'number', min: 1, max: 5 } },
25
+ saving: { control: 'boolean' },
26
+ saveError: { control: 'text' },
27
+ saveNotice: { control: 'text' },
28
+ event: { control: 'object' },
29
+ weapons: { control: 'object' },
30
+ DEFormats: { control: 'object' },
31
+ userLevel: { control: 'string' }
32
+ }
33
+ };
34
+
35
+ export const Default = {
36
+ args: {
37
+ event: { ...singleEventMock, EventPrice: 25.5 },
38
+ weapons: [
39
+ { text: 'Longsword', link: 1 },
40
+ { text: 'Saber', link: 2 },
41
+ { text: 'Rapier', link: 3 }
42
+ ],
43
+ DEFormats: [
44
+ { text: 'Single Elimination', link: 1 },
45
+ { text: 'Double Elimination', link: 2 },
46
+ { text: 'Single Elimination with Round Robin Semi-Final', link: 3 }
47
+ ],
48
+ userLevel: 'Admin'
49
+ }
50
+ };
51
+ // new Date().toISOString().split('T')[0],
52
+ export const newEventAsClub = {
53
+ args: {
54
+ event: {
55
+ EventId: 0,
56
+ CountDoubles: false,
57
+ CountHandshots: false,
58
+ CutOffNumber: 64,
59
+ DEBoutCount: 7,
60
+ DEBoutCounter: false,
61
+ DEMax: false,
62
+ DEMaxPoints: 12,
63
+ DEPromoteBy: ['Top Percent', 'Top Count', 'Top Count of Each Pool'],
64
+ DEPromotionAmount: '100%',
65
+ DEPromotionOrder: ['Win Percent', 'Win Count', 'Indicator', 'Points Scored'],
66
+ DETime: 180,
67
+ DETimer: false,
68
+ DEType: 'single',
69
+ Date: new Date().toISOString().split('T')[0],
70
+ EventName: '',
71
+ EventPrice: '',
72
+ NumberOfRings: 2,
73
+ PenaltiesReset: true,
74
+ PoolScoreDirection: true,
75
+ StartTime: '12:00:00',
76
+ WeaponId: 1,
77
+ boutCount: 5,
78
+ boutCounter: false,
79
+ poolMax: false,
80
+ poolMaxPoints: 7,
81
+ poolTime: 180,
82
+ poolTimer: false,
83
+ seedWith: 'M2 - MeyerSquared',
84
+ thirdPlaceBout: false
85
+ },
86
+ weapons: [
87
+ { text: 'Longsword', link: 1 },
88
+ { text: 'Saber', link: 2 },
89
+ { text: 'Rapier', link: 3 }
90
+ ],
91
+ DEFormats: [
92
+ { text: 'Single Elimination', link: 1 },
93
+ { text: 'Double Elimination', link: 2 },
94
+ { text: 'Single Elimination with Round Robin Semi-Final', link: 3 }
95
+ ],
96
+ userLevel: 'Club'
97
+ }
98
+ };
99
+
100
+ export const EditWithStepSaves = {
101
+ args: { ...Default.args, editMode: true, step: 1 },
102
+ render: args => ({
103
+ components: { Editor: EditEvent },
104
+ setup() {
105
+ const event = ref(JSON.parse(JSON.stringify(args.event)));
106
+ const step = ref(args.step);
107
+ const saving = ref(false);
108
+ const notice = ref('');
109
+ const saveStep = async request => {
110
+ saving.value = true;
111
+ await new Promise(resolve => setTimeout(resolve, 500));
112
+ event.value = request.event;
113
+ step.value = Math.min(request.step + 1, 5);
114
+ notice.value = 'Changes saved.';
115
+ saving.value = false;
116
+ };
117
+ const clearNotice = dirty => {
118
+ if (dirty) notice.value = '';
119
+ };
120
+ return { args, event, step, saving, notice, saveStep, clearNotice };
121
+ },
122
+ template:
123
+ '<Editor v-bind="args" :weapons="args.weapons" :event="event" :step="step" :saving="saving" :saveNotice="notice" @save:step="saveStep" @navigate:step="step = $event" @update:dirty="clearNotice" />'
124
+ })
125
+ };
126
+
127
+ export const SavingStep = {
128
+ args: { ...Default.args, editMode: true, step: 2, saving: true }
129
+ };
130
+
131
+ export const StepSaveFailed = {
132
+ args: { ...Default.args, editMode: true, step: 2, saveError: 'Changes could not be saved. Please try again.' }
133
+ };