@dcrackel/hematournamentui 1.0.509 → 1.0.511

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.509",
4
+ "version": "1.0.511",
5
5
  "type": "module",
6
6
  "main": "dist/HemaTournamentUI-lib.umd.js",
7
7
  "module": "dist/HemaTournamentUI-lib.es.js",
@@ -11,22 +11,24 @@
11
11
  >
12
12
  <div class="w-full rounded-t-xl flex flex-row justify-between pt-2">
13
13
  <div class="absolute left-0 flex ml-2">
14
- <BaseIcon v-for="index in countYellowCards" icon-name="fa-circle-small" size="md" color="gold" class="mr-1" />
15
- <BaseIcon v-for=" index in countRedCards" icon-name="fa-circle-small" size="md" color="red" class="mr-1" />
14
+ <BaseIcon v-for="index in countYellowCards" icon-name="fa-circle-small" size="md" color="gold" class="mr-1"/>
15
+ <BaseIcon v-for=" index in countRedCards" icon-name="fa-circle-small" size="md" color="red" class="mr-1"/>
16
16
  </div>
17
17
  <div class="w-full text-center">
18
- <BaseText :text="fencer1 ? bout.Person1.DisplayName : bout.Person2.DisplayName" size="xl" weight="bold" color="primaryHighlight"/>
18
+ <BaseText :text="fencer1 ? bout.Person1.DisplayName : bout.Person2.DisplayName" size="xl" weight="bold"
19
+ color="primaryHighlight"/>
19
20
  </div>
20
21
  <div class="text-quaternary text-sm pr-3 pt-0.5" @click="$emit('open-report')">
21
22
  <i class="fa-solid fa-chevron-right" @click="openPenaltyModal"></i>
22
23
  </div>
23
24
  </div>
24
25
  <div class="flex flex-row w-full justify-center">
25
- <BaseText :text="lastNote" size="sm" color="primaryHighlight"/>
26
+ <BaseText :text="lastNote" size="sm" color="primaryHighlight"/>
26
27
  </div>
27
28
  <div class="w-full flex flex-row justify-around text-center px-4 pt-2">
28
29
  <div class="pt-1 w-1/4" @click="minus">
29
- <BaseIcon :icon-name="isCountingUp ? 'fa-square-minus' : 'fa-square-plus'" size="5xl" :color="computedColor" hover="quaternary" :disabled="baseScore <= 0"/>
30
+ <BaseIcon :icon-name="isCountingUp ? 'fa-square-minus' : 'fa-square-plus'" size="5xl" :color="computedColor"
31
+ hover="quaternary" :disabled="baseScore <= 0"/>
30
32
  </div>
31
33
  <div class="flex flex-row w-1/2 justify-center">
32
34
  <div class="text-5xl text-bluegray font-bold">
@@ -34,7 +36,8 @@
34
36
  </div>
35
37
  </div>
36
38
  <div class="pt-1 w-1/4" @click="plus">
37
- <BaseIcon :icon-name="isCountingUp ? 'fa-square-plus' : 'fa-square-minus'" size="5xl" :color="computedColor" hover="quaternary" :disabled="baseScore >= maxScore"/>
39
+ <BaseIcon :icon-name="isCountingUp ? 'fa-square-plus' : 'fa-square-minus'" size="5xl" :color="computedColor"
40
+ hover="quaternary" :disabled="baseScore >= maxScore"/>
38
41
  </div>
39
42
  </div>
40
43
  <div class="w-full flex flex-col justify-around text-center px-4 pb-6">
@@ -42,7 +45,8 @@
42
45
  <BaseText :text="fencer1 ? bout.Person1.Club.Name : bout.Person2.Club.Name" size="md" color="quinary"/>
43
46
  </div>
44
47
  </div>
45
- <HandshotCounterBox v-if="showHandShotCounterBox" :handShotValue="getHandShotValue" :fencer1="fencer1" :hostingClubColors="hostingClubColors" @update:HandShotValue="emitHandShotValue"/>
48
+ <HandshotCounterBox v-if="showHandShotCounterBox" :handShotValue="getHandShotValue" :fencer1="fencer1"
49
+ :hostingClubColors="hostingClubColors" @update:HandShotValue="emitHandShotValue"/>
46
50
  </div>
47
51
  </section>
48
52
  </template>
@@ -86,7 +90,7 @@ export default {
86
90
  type: Boolean,
87
91
  default: true
88
92
  },
89
- showHandShotCounterBox:{
93
+ showHandShotCounterBox: {
90
94
  type: Boolean,
91
95
  default: false
92
96
  }
@@ -98,8 +102,11 @@ export default {
98
102
  },
99
103
  computed: {
100
104
  lastNote() {
101
- const person = this.fencer1 ? this.bout.Person1 : this.bout.Person2;
102
- return person.EventPersons[0].LastNote ?? '';
105
+ const eventPersons = this.fencer1 ? this.bout.Person1?.EventPersons : this.bout.Person2?.EventPersons;
106
+ if (eventPersons && eventPersons.length > 0) {
107
+ return eventPersons[0].LastNote ?? "";
108
+ }
109
+ return "";
103
110
  },
104
111
  currentScore() {
105
112
  if (!this.isCountingUp) {
@@ -112,12 +119,18 @@ export default {
112
119
  return this.fencer1 ? this.hostingClubColors.Color1.toLowerCase() : this.hostingClubColors.Color2.toLowerCase();
113
120
  },
114
121
  countYellowCards() {
115
- return this.fencer1 ? this.bout.Person1.Penalties.filter(penalty => penalty.PenaltyType === 'Yellow' && penalty.BoutId === this.bout.BoutId).length
116
- : this.bout.Person2.Penalties.filter(penalty => penalty.PenaltyType === 'Yellow' && penalty.BoutId === this.bout.BoutId).length;
122
+ const penalties = this.fencer1 ? this.bout.Person1.Penalties : this.bout.Person2.Penalties;
123
+ if (!penalties) {
124
+ return 0;
125
+ }
126
+ return penalties.filter((t3) => t3.PenaltyType === "Yellow" && t3.BoutId === this.bout.BoutId).length;
117
127
  },
118
- countRedCards(){
119
- return this.fencer1 ? this.bout.Person1.Penalties.filter(penalty => penalty.PenaltyType === 'Red' && penalty.BoutId === this.bout.BoutId).length
120
- : this.bout.Person2.Penalties.filter(penalty => penalty.PenaltyType === 'Red' && penalty.BoutId === this.bout.BoutId).length;
128
+ countRedCards() {
129
+ const penalties = this.fencer1 ? this.bout.Person1.Penalties : this.bout.Person2.Penalties;
130
+ if (!penalties) {
131
+ return 0;
132
+ }
133
+ return penalties.filter((t3) => t3.PenaltyType === "Red" && t3.BoutId === this.bout.BoutId).length;
121
134
  },
122
135
  getHandShotValue() {
123
136
  const personId = this.fencer1 ? this.bout.Person1Id : this.bout.Person2Id;
@@ -194,11 +194,11 @@ export default {
194
194
  if (fencer1) {
195
195
  this.localBout.Person1.EventPersons[0].LastNote = updatedPenalty.Notes;
196
196
  updatedPenalty.PersonId = this.localBout.Person1Id;
197
- this.localBout.Person1.Penalties.push(updatedPenalty);
197
+ //this.localBout.Person1.Penalties.push(updatedPenalty);
198
198
  } else {
199
199
  this.localBout.Person2.EventPersons[0].LastNote = updatedPenalty.Notes;
200
200
  updatedPenalty.PersonId = this.localBout.Person2Id;
201
- this.localBout.Person2.Penalties.push(updatedPenalty);
201
+ //this.localBout.Person2.Penalties.push(updatedPenalty);
202
202
  }
203
203
 
204
204
  return updatedPenalty;
@@ -40,14 +40,14 @@
40
40
  <textarea v-model="currentNote" class="w-full h-20 border rounded-md p-2" placeholder="Add a note..."/>
41
41
  <div class="w-full flex justify-between">
42
42
  <BaseButton type="primary" label="Clear" size="sm" @buttonClick="clearPenalty()" />
43
- <BaseButton v-if="toggled" type="primary" label="Save Note" size="sm" @buttonClick="handlePenalty()" />
43
+ <BaseButton v-if="toggled" type="primary" label="Save Penalty" size="sm" @buttonClick="handlePenalty()" />
44
44
  <BaseText v-if="!toggled" text="Save Penalty" color="quinary" size="sm" class="bg-poolSetup border p-2 rounded-lg ml-1 resize-none focus:ring-primary focus:border-primary" />
45
45
  </div>
46
46
  </div>
47
47
 
48
- <!-- Past Notes Section -->
48
+ <!-- Past cards Section -->
49
49
  <div>
50
- <BaseText v-if="pastCards.length" text="Past Notes" type="h3" size="lg" color="primary" weight="bold" class="mb-2 "/>
50
+ <BaseText v-if="pastCards.length" text="Past Cards in this Event" type="h3" size="lg" color="primary" weight="bold" class="mb-2 "/>
51
51
  <div v-for="card in pastCards" :key="card.PenaltyId" class="flex items-center justify-between bg-neutral mb-2 border shadow-md p-2 rounded-lg">
52
52
  <BaseIcon :iconName="getFlagIcon(card.PenaltyType)" :color="getFlagColor(card.PenaltyType)"/>
53
53
  <div class="flex-grow ml-4 text-sm" @click="selectPastCard(card)">
@@ -134,13 +134,13 @@ export default {
134
134
  },
135
135
  countCards() {
136
136
  if (this.fencer1) {
137
- this.yellowCardCount = this.bout.Person1.Penalties.filter(c => c.PenaltyType === 'Yellow').length;
138
- this.redCardCount = this.bout.Person1.Penalties.filter(c => c.PenaltyType === 'Red').length;
137
+ this.yellowCardCount = this.bout.Person1.Penalties.filter(c => c.PenaltyType === 'Yellow' && c.BoutId === this.bout.BoutId).length;
138
+ this.redCardCount = this.bout.Person1.Penalties.filter(c => c.PenaltyType === 'Red' && c.BoutId === this.bout.BoutId).length;
139
139
  }
140
140
 
141
141
  if (!this.fencer1) {
142
- this.yellowCardCount = this.bout.Person2.Penalties.filter(c => c.PenaltyType === 'Yellow').length;
143
- this.redCardCount = this.bout.Person2.Penalties.filter(c => c.PenaltyType === 'Red').length;
142
+ this.yellowCardCount = this.bout.Person2.Penalties.filter(c => c.PenaltyType === 'Yellow' && c.BoutId === this.bout.BoutId).length;
143
+ this.redCardCount = this.bout.Person2.Penalties.filter(c => c.PenaltyType === 'Red' && c.BoutId === this.bout.BoutId).length;
144
144
  }
145
145
  },
146
146
  toggleAllOff(){
@@ -214,6 +214,7 @@ export default {
214
214
  this.bout.Person2.Penalties.push(newPenalty);
215
215
  }
216
216
 
217
+ this.countCards();
217
218
  this.$emit('penalty:add', newPenalty);
218
219
  this.currentNote = '';
219
220
  },
@@ -228,6 +229,7 @@ export default {
228
229
  this.$emit('penalty:update', penalties[existingPenaltyIndex]);
229
230
  }
230
231
 
232
+ this.countCards();
231
233
  this.selectPenaltyId = null;
232
234
  this.currentNote = '';
233
235
  },
@@ -256,6 +258,8 @@ export default {
256
258
  person.EventPersons[0].LastNote = '';
257
259
  }
258
260
  }
261
+
262
+ this.countCards();
259
263
  }
260
264
  },
261
265
  getFlagIcon(flag) {