@dcrackel/hematournamentui 1.0.71 → 1.0.73

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dcrackel/hematournamentui",
3
3
  "private": false,
4
- "version": "1.0.71",
4
+ "version": "1.0.73",
5
5
  "type": "module",
6
6
  "main": "dist/HemaTouranmentUI-lib.umd.js",
7
7
  "module": "dist/HemaTouranmentUI-lib.es.js",
@@ -10,7 +10,7 @@ export default {
10
10
 
11
11
  props: {
12
12
  text: {
13
- type: String,
13
+ type: [String, Number],
14
14
  required: true,
15
15
  default: ''
16
16
  },
@@ -19,7 +19,7 @@ export default {
19
19
  components: {BaseText},
20
20
  props: {
21
21
  statusCount: {
22
- type: Number,
22
+ type: [Number, String],
23
23
  required: true,
24
24
  },
25
25
  statusLabel: {
@@ -5,7 +5,7 @@
5
5
  </div>
6
6
  <div class="mr-4">
7
7
  <div v-if="!portraitURL" class="w-14 h-14 rounded-xl bg-dropdownSelect flex items-center justify-center">
8
- <BaseText text="" size="sm" color="white" weight="bold"/>
8
+ <BaseText text="" size="sm" color="neutral" weight="bold"/>
9
9
  </div>
10
10
  <img v-if="portraitURL" :src="portraitURL" alt="Portrait" class="w-14 h-14 rounded-xl">
11
11
  </div>
@@ -27,12 +27,9 @@ export default {
27
27
  },
28
28
  items: {
29
29
  type: Array,
30
- validator: (itemsArray) => itemsArray.every(item => typeof item.text === 'string')
31
30
  },
32
31
  selectedItem: {
33
- type: Object,
34
- default: () => ({ text: '' }),
35
- validator: (obj) => typeof obj.text === 'string'
32
+ type: [Object, String],
36
33
  },
37
34
  width: {
38
35
  type: String,
@@ -47,13 +47,13 @@ import DropDownMenu from "../DropDown/DropDownMenu.vue";
47
47
 
48
48
  export default {
49
49
  name: 'FindOrAddPerson',
50
- components: {DropDownMenu, BaseModal, BaseText, BaseButton, BaseInput },
50
+ components: { DropDownMenu, BaseModal, BaseText, BaseButton, BaseInput },
51
51
  props: {
52
52
  persons: {
53
53
  type: Array,
54
54
  required: true
55
55
  },
56
- clubs: {
56
+ fencingClubs: {
57
57
  type: Array,
58
58
  required: true
59
59
  },
@@ -82,18 +82,17 @@ export default {
82
82
  modalButtonText: 'Find Person',
83
83
  selectedPronouns: '',
84
84
  pronouns: [
85
- {text: 'He/Him', link: 'he-him'},
86
- {text: 'She/Her', link: 'she-her'},
87
- {text: 'They/Them', link: 'they-them'},
88
- {text: 'Ze/Hir', link: 'ze-hir'},
89
- {text: 'Xe/Xem', link: 'xe-xem'}
85
+ { text: 'He/Him', link: 'he-him' },
86
+ { text: 'She/Her', link: 'she-her' },
87
+ { text: 'They/Them', link: 'they-them' },
88
+ { text: 'Ze/Hir', link: 'ze-hir' },
89
+ { text: 'Xe/Xem', link: 'xe-xem' }
90
90
  ],
91
91
  selectedClub: '',
92
92
  formattedClubs: []
93
93
  };
94
94
  },
95
- created() {
96
- this.formattedClubs = this.mapClubData(this.clubs);
95
+ computed: {
97
96
  },
98
97
  watch: {
99
98
  inputValue(newValue) {
@@ -107,12 +106,25 @@ export default {
107
106
  }
108
107
  }
109
108
  },
109
+ created() {
110
+ this.formatClubs();
111
+ },
110
112
  methods: {
113
+ formatClubs() {
114
+ if (!this.fencingClubs[0].Name) return
115
+ console.log('----------------------- Mapping clubs:', this.fencingClubs); // Debug log
116
+ this.formattedClubs = this.fencingClubs.map(club => ({
117
+ text: club.Name,
118
+ link: club.ClubId.toString()
119
+ }));
120
+ console.log('----------------------- Mapping clubs:', this.formattedClubs); // Debug log
121
+ },
111
122
  updateInput(event) {
112
123
  this.inputValue = event.target.value;
113
124
  },
114
125
  selectPerson(person) {
115
- console.log(person)
126
+ console.log(`------- FindOrAddPerson: selectPerson -------`);
127
+ console.log(person);
116
128
  this.showDropdown = false;
117
129
  this.inputValue = '';
118
130
  this.$emit('person-selected', person);
@@ -153,22 +165,15 @@ export default {
153
165
  clubId: this.selectedClub.link
154
166
  };
155
167
  this.$emit('new-person-submitted', newPerson);
156
- console.log(newPerson)
168
+ console.log(newPerson);
157
169
  this.showModal = false;
158
170
  },
159
- mapClubData(clubs) {
160
- return clubs.map(club => ({
161
- text: club.Name,
162
- link: club.ClubId.toString()
163
- }));
164
- },
165
- handleSelectedClub(value){
171
+ handleSelectedClub(value) {
166
172
  this.selectedClub = value;
167
173
  },
168
174
  handleSelectedPronouns(value) {
169
175
  this.selectedPronouns = value;
170
176
  }
171
-
172
177
  }
173
178
  };
174
179
  </script>
@@ -6,18 +6,18 @@
6
6
  <span class="h-8"></span>
7
7
  </section>
8
8
  <section class="flex space-x-4">
9
- <CounterBox :recommended="7" :count="event.PoolSize" label="Pool Size" />
10
- <CounterBox :recommended="event.NumberOfPools" :count="event.NumberOfPools" label="Num Pools" />
11
- <CounterBox :recommended="0" :count="event.numberOfFlights" label="Flights" />
9
+ <CounterBox :recommended="7" :count="poolSize" label="Pool Size" />
10
+ <CounterBox :recommended="2" :count="numberOfPools" label="Num Pools" />
11
+ <CounterBox :recommended="0" :count="numberOfFlights" label="Flights" />
12
12
  </section>
13
13
  <section class="flex flex-col">
14
14
  <div class="flex justify-center items-center">
15
- <BaseText text="Fencer Counts" size="sm" color="quinary" weight="" />
15
+ <BaseText text="Fencer Counts" size="sm" color="quinary" />
16
16
  </div>
17
17
  <div class="flex">
18
- <EventStatusBox :status-count="event.Absent" status-label="ABSENT" box-color="bg-eventBoxBlue" />
19
- <EventStatusBox :status-count="event.Present" status-label="PRESENT" box-color="bg-eventBoxGreen" />
20
- <EventStatusBox :status-count="event.Removed" status-label="REMOVED" box-color="bg-eventBoxRed" />
18
+ <EventStatusBox :status-count="absent" status-label="ABSENT" box-color="bg-eventBoxBlue" />
19
+ <EventStatusBox :status-count="present" status-label="PRESENT" box-color="bg-eventBoxGreen" />
20
+ <EventStatusBox :status-count="removed" status-label="REMOVED" box-color="bg-eventBoxRed" />
21
21
  </div>
22
22
  </section>
23
23
 
@@ -40,16 +40,39 @@ export default {
40
40
  const requiredFields = [
41
41
  'EventName',
42
42
  'RuleSummary',
43
- 'PoolSize',
44
- 'NumberOfPools',
45
- 'NumberOfFlights',
46
43
  'Absent',
47
44
  'Present',
48
45
  'Removed',
49
46
  ];
50
- return requiredFields.every(field => field in event);
47
+
48
+ const missingFields = requiredFields.filter(field => !(field in event));
49
+ if (missingFields.length) {
50
+ console.warn(`Invalid event object: Missing fields: ${missingFields.join(', ')}`);
51
+ return false;
52
+ }
53
+ return true;
51
54
  },
52
55
  },
53
56
  },
57
+ computed: {
58
+ poolSize() {
59
+ return this.event.PoolSize || 0;
60
+ },
61
+ numberOfPools() {
62
+ return this.event.NumberOfPools || 0;
63
+ },
64
+ numberOfFlights() {
65
+ return this.event.NumberOfFlights || 0;
66
+ },
67
+ absent() {
68
+ return this.event.Absent || "0";
69
+ },
70
+ present() {
71
+ return this.event.Present || "0";
72
+ },
73
+ removed() {
74
+ return this.event.Removed || "0";
75
+ },
76
+ },
54
77
  };
55
78
  </script>
@@ -2,6 +2,7 @@ import EditEvents from './EventAttendance.vue';
2
2
  import personsMock from '../../../../mocks/personsMock.js';
3
3
  import personsAllMock from '../../../../mocks/personGetAllMock.js';
4
4
  import eventMock from '../../../../mocks/eventMock.js';
5
+ import clubsMock from '../../../../mocks/clubGetAllMock.js';
5
6
 
6
7
  export default {
7
8
  title: 'Templates/EventManagement/EditTournament/EventAttendance',
@@ -10,24 +11,59 @@ export default {
10
11
  args: {
11
12
  personsInTournament: personsMock,
12
13
  personsAll: personsAllMock,
14
+ fencingClubs: clubsMock,
13
15
  event: eventMock[0]
14
16
  },
15
- argTypes: {}
16
- };
17
+ argTypes: {
18
+ personsInTournament: {
19
+ control: {type: 'array'},
20
+ description: 'List of persons in the tournament',
21
+ table: {
22
+ type: {summary: 'Array'},
23
+ defaultValue: {summary: '[]'}
24
+ }
25
+ },
26
+ personsAll: {
27
+ control: {type: 'array'},
28
+ description: 'List of all persons',
29
+ table: {
30
+ type: {summary: 'Array'},
31
+ defaultValue: {summary: '[]'}
32
+ }
33
+ },
34
+ fencingClubs: {
35
+ control: {type: 'array'},
36
+ description: 'List of clubs',
37
+ table: {
38
+ type: {summary: 'Array'},
39
+ defaultValue: {summary: '[]'}
40
+ }
41
+ },
42
+ event: {
43
+ control: {type: 'object'},
44
+ description: 'Event details',
45
+ table: {
46
+ type: {summary: 'Object'},
47
+ defaultValue: {summary: '{}'}
48
+ }
49
+ }
50
+ }
51
+ }
17
52
 
18
53
  export const Default = {
19
54
  args: {
20
55
  personsInTournament: personsMock,
21
56
  personsAll: personsAllMock,
57
+ fencingClubs: clubsMock,
22
58
  event: eventMock[0]
23
59
  }
24
60
  };
25
61
 
26
-
27
62
  export const NoPeople = {
28
63
  args: {
29
64
  personsInTournament: [],
30
65
  personsAll: personsAllMock,
66
+ fencingClubs: clubsMock,
31
67
  event: eventMock[0]
32
68
  }
33
69
  };
@@ -1,6 +1,5 @@
1
1
  <template>
2
2
  <section>
3
-
4
3
  <EditEventsTopMenu :currentTab="'Checkin'" :tabs="tabs"/>
5
4
  <PoolSummary :event="event"/>
6
5
 
@@ -9,19 +8,28 @@
9
8
  <div class="w-full flex flex-col justify-center items-center" style="text-align: center">
10
9
  <section class="grid grid-cols-2 w-full mb-3">
11
10
  <div class="col-start-1 col-end-2 flex justify-start">
12
- <FindOrAddPerson :clubs="clubs" :persons="personsAll" @new-person-submitted="handleNewPerson" @person-selected="handleAddExistingPerson" />
11
+ <FindOrAddPerson
12
+ :persons="personsAll"
13
+ :fencingClubs="fencingClubs"
14
+ :addBorder="false"
15
+ :addNewText="'Add New'"
16
+ @new-person-submitted="handleNewPerson"
17
+ @person-selected="handleAddExistingPerson" />
13
18
  </div>
14
19
  <div class="col-start-2 col-end-3 flex justify-end">
15
- <DropDownMenu :label="label" :items="items" :selectedItem="localSelectedItem"
16
- @update:selectedItem="handleSelectedItem"/>
20
+ <DropDownMenu
21
+ :label="label"
22
+ :items="items"
23
+ :selectedItem="localSelectedItem"
24
+ @update:selectedItem="handleSelectedItem"/>
17
25
  </div>
18
26
  </section>
19
27
 
20
28
  <div v-if="personsInTournament.length === 0" class="mb-10">
21
29
  <img alt="Small desert scene with wind blowing." class="w-96" :src="emptyDesertIcon"/>
22
- <BaseText :color="'primaryHighlight'" :size="'lf'" :text="'0 events added yet.'"
30
+ <BaseText :color="'primaryHighlight'" :size="'lg'" :text="'0 events added yet.'"
23
31
  :weight="'normal'" data-testid="text-num-events"/>
24
- <BaseText :color="'primaryHighlight'" :size="'lf'" :text="'Click below to add first event.'"
32
+ <BaseText :color="'primaryHighlight'" :size="'lg'" :text="'Click below to add first event.'"
25
33
  :weight="'normal'" data-testid="text-num-events"/>
26
34
  </div>
27
35
 
@@ -29,7 +37,6 @@
29
37
  <FencerCard :person="person" class="mb-4" @update:status="handleStatus"/>
30
38
  </section>
31
39
  </div>
32
-
33
40
  </section>
34
41
  </div>
35
42
  </section>
@@ -62,7 +69,7 @@ export default {
62
69
  props: {
63
70
  personsAll: Array,
64
71
  event: Object,
65
- clubs: {
72
+ fencingClubs: {
66
73
  type: Array,
67
74
  default: () => []
68
75
  },
@@ -120,23 +127,22 @@ export default {
120
127
  },
121
128
  methods: {
122
129
  handleSelectedItem(selectedItem) {
123
- console.log(`selectedItem: ${selectedItem}`)
130
+ console.log(`----- selectedItem: ${selectedItem}`);
124
131
  this.localSelectedItem = selectedItem;
125
132
  },
126
133
  handleStatus(person) {
127
- console.log(`handleStatus: ${person}`)
134
+ console.log(`----- handleStatus: ${person}`);
128
135
  person.Status = person.Status === 'Absent' ? 'Present' : 'Absent';
129
136
  this.$emit('update:person', person);
130
137
  },
131
- handleNewPerson(value)
132
- {
133
- console.log(`handleNewPerson: ${value}`)
138
+ handleNewPerson(value) {
139
+ console.log(`----- handleNewPerson: ${value}`);
134
140
  this.$emit('add:person', value);
135
141
  },
136
- handleAddExistingPerson(value){
137
- console.log(`handleAddExistingPerson: ${value}`)
142
+ handleAddExistingPerson(value) {
143
+ console.log(`----- handleAddExistingPerson: ${value}`);
138
144
  this.$emit('add:existing-person', value);
139
145
  }
140
146
  }
141
147
  }
142
- </script>
148
+ </script>