@dcrackel/hematournamentui 1.0.699 → 1.0.702
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/AGENTS.md +3 -0
- package/dist/HemaTournamentUI-lib.es.js +10913 -10269
- package/dist/HemaTournamentUI-lib.umd.js +27 -27
- package/dist/hematournamentui-tailwind.css +23 -0
- package/dist/hematournamentui.css +1 -1
- package/package.json +8 -8
- package/src/stories/Molecules/Boxes/BoutBoxes/TimerBox/TimerBox.vue +1 -1
- package/src/stories/Molecules/Buttons/BaseButton/BaseButton.vue +1 -1
- package/src/stories/Molecules/Buttons/ButtonBar/ButtonBar.vue +1 -1
- package/src/stories/Molecules/Modals/DirectorModal/DirectorModal.vue +2 -2
- package/src/stories/Organisms/Cards/BoutCard/Variants/BoutCardActive/BoutCardActive.vue +25 -22
- package/src/stories/Organisms/Cards/BoutCard/Variants/BoutCardInactive/BoutCardInactive.vue +31 -29
- package/src/stories/Organisms/Cards/BoutCard/Variants/BoutCardWaiting/BoutCardWaiting.vue +2 -4
- package/src/stories/Organisms/Cards/KioskCard/KioskCard.vue +54 -35
- package/src/stories/Organisms/Cards/PenaltyCard/PenaltyCard.stories.js +6 -6
- package/src/stories/Organisms/Cards/PenaltyCard/PenaltyCard.vue +64 -53
- package/src/stories/Organisms/Cards/PenaltyFencerCard/PenaltyFencerCard.stories.js +6 -7
- package/src/stories/Organisms/Cards/PenaltyFencerCard/PenaltyFencerCard.vue +18 -10
- package/src/stories/Organisms/Cards/StaffCard/StaffCard.vue +4 -4
- package/src/stories/Organisms/Cards/WaitlistFencerCard/WaitlistFencerCard.vue +129 -0
- package/src/stories/Organisms/ComplexInputs/DatePicker/DatePicker.vue +64 -45
- package/src/stories/Organisms/Containers/KioskContainer/KioskContainer.vue +13 -9
- package/src/stories/Organisms/Containers/Pool/Pool.vue +1 -1
- package/src/stories/Organisms/Containers/PoolResults/PoolResultsTable.vue +35 -20
- package/src/stories/Organisms/Headers/AttendanceSummary/AttendanceSummary.vue +45 -19
- package/src/stories/Templates/Assignment/Assignment.stories.js +17 -15
- package/src/stories/Templates/Assignment/Assignment.vue +71 -40
- package/src/stories/Templates/ClubManagement/ClubBasic/ClubBasic.stories.js +49 -30
- package/src/stories/Templates/ClubManagement/ClubBasic/ClubBasic.vue +29 -28
- package/src/stories/Templates/ClubManagement/{ClubMangement.stories.js → ClubManagement.stories.js} +74 -59
- package/src/stories/Templates/ClubManagement/ClubManagement.vue +104 -92
- package/src/stories/Templates/EventManagement/Bracket/Bracket.vue +92 -97
- package/src/stories/Templates/EventManagement/EditEventInfo/EditEventInfo.stories.js +37 -33
- package/src/stories/Templates/EventManagement/EditEventInfo/EditEventInfo.vue +11 -14
- package/src/stories/Templates/EventManagement/EventAttendance/EventAttendance.stories.js +49 -14
- package/src/stories/Templates/EventManagement/EventAttendance/EventAttendance.vue +156 -62
- package/src/stories/Templates/EventManagement/EventFinalResults/EventFinalResults.stories.js +11 -10
- package/src/stories/Templates/EventManagement/EventFinalResults/EventFinalResults.vue +8 -8
- package/src/stories/Templates/EventManagement/KioskDisplay/KioskDisplay.stories.js +13 -16
- package/src/stories/Templates/EventManagement/KioskDisplay/KioskDisplay.vue +25 -25
- package/src/stories/Templates/EventManagement/Penalties/PenaltyReport.stories.js +25 -24
- package/src/stories/Templates/EventManagement/Penalties/PenaltyReport.vue +28 -34
- package/src/stories/Templates/EventManagement/PoolLive/PoolLive.stories.js +54 -19
- package/src/stories/Templates/EventManagement/PoolLive/PoolLive.vue +75 -68
- package/src/stories/Templates/EventManagement/PoolManagement/PoolManagement.stories.js +55 -45
- package/src/stories/Templates/EventManagement/PoolManagement/PoolManagement.vue +47 -55
- package/src/stories/Templates/EventManagement/PoolResults/PoolResults.stories.js +56 -55
- package/src/stories/Templates/EventManagement/PoolResults/PoolResults.vue +71 -73
- package/src/stories/Templates/EventManagement/StaffList/StaffList.stories.js +18 -16
- package/src/stories/Templates/EventManagement/StaffList/StaffList.vue +9 -6
- package/src/stories/Templates/Menus/Admin/AdminLeftMenu.stories.js +22 -19
- package/src/stories/Templates/Menus/Admin/AdminLeftMenu.vue +44 -36
- package/src/stories/Templates/Menus/EditEventsTopMenu/EditEventsTopMenu.stories.js +30 -23
- package/src/stories/Templates/Menus/EditEventsTopMenu/EditEventsTopMenu.vue +55 -58
- package/src/stories/Templates/PersonManagement/Admin/Administration/Administration.stories.js +67 -0
- package/src/stories/Templates/PersonManagement/Admin/{Administration.vue → Administration/Administration.vue} +94 -87
- package/src/stories/Templates/PersonManagement/Admin/FencerAdmin/FencerAdmin.stories.js +71 -0
- package/src/stories/Templates/PersonManagement/Admin/{FencerAdmin.vue → FencerAdmin/FencerAdmin.vue} +90 -77
- package/src/stories/Templates/PersonManagement/Admin/MergeAccounts/MergeAccounts.stories.js +86 -0
- package/src/stories/Templates/PersonManagement/Admin/{MergeAccounts.vue → MergeAccounts/MergeAccounts.vue} +258 -242
- package/src/stories/Templates/PersonManagement/Attendance/Attendance.vue +28 -28
- package/src/stories/Templates/PersonManagement/PersonManagement.vue +1 -1
- package/src/stories/Templates/TournamentManagement/ListEvents/ListEvents.stories.js +45 -28
- package/src/stories/Templates/TournamentManagement/ListEvents/ListEvents.vue +22 -16
- package/src/stories/Templates/TournamentManagement/{TournamentMangement.stories.js → TournamentManagement.stories.js} +68 -39
- package/src/stories/Templates/TournamentManagement/TournamentManagement.vue +199 -153
- package/src/stories/Templates/TournamentManagement/TournamentPageOne/TournamentPageOne.stories.js +113 -0
- package/src/stories/Templates/TournamentManagement/TournamentPageOne/TournamentPageOne.vue +123 -106
- package/src/stories/Templates/TournamentManagement/TournamentPageTwo/TournamentPageTwo.stories.js +76 -31
- package/src/stories/Templates/TournamentManagement/TournamentPageTwo/{TouranmentPageTwo.vue → TournamentPageTwo.vue} +63 -44
- package/src/stories/Templates/PersonManagement/Admin/FencerAdmin.stories.js +0 -48
- package/src/stories/Templates/TournamentManagement/TournamentPageOne/TouranmentPageOne.stories.js +0 -63
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import MergeAccounts from './MergeAccounts.vue';
|
|
2
|
+
import personsMock from "../../../../../mocks/personsMock.js";
|
|
3
|
+
import peopleMock from "../../../../../mocks/personGetAllMock.js";
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Templates/PersonManagement/Admin/MergeAccounts',
|
|
7
|
+
component: MergeAccounts,
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
args: {
|
|
10
|
+
person: personsMock[1],
|
|
11
|
+
people: peopleMock
|
|
12
|
+
},
|
|
13
|
+
argTypes: {
|
|
14
|
+
person: { control: { type: 'object' } },
|
|
15
|
+
people: { control: { type: 'object' } },
|
|
16
|
+
'merge:merge': { action: 'merge:merge' }
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const Default = {
|
|
21
|
+
args: {
|
|
22
|
+
person: personsMock[1],
|
|
23
|
+
people: peopleMock
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const EmptyResults = {
|
|
28
|
+
args: {
|
|
29
|
+
person: personsMock[1],
|
|
30
|
+
people: []
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const MissingRootDetails = {
|
|
35
|
+
args: {
|
|
36
|
+
person: {
|
|
37
|
+
PersonId: 2001,
|
|
38
|
+
DisplayName: '',
|
|
39
|
+
FirstName: '',
|
|
40
|
+
LastName: '',
|
|
41
|
+
Club: null,
|
|
42
|
+
PersonEmails: []
|
|
43
|
+
},
|
|
44
|
+
people: peopleMock
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const SparsePeopleData = {
|
|
49
|
+
args: {
|
|
50
|
+
person: personsMock[1],
|
|
51
|
+
people: [
|
|
52
|
+
{
|
|
53
|
+
PersonId: 2002,
|
|
54
|
+
DisplayName: 'Missing Email',
|
|
55
|
+
FirstName: 'Missing',
|
|
56
|
+
LastName: 'Email',
|
|
57
|
+
Club: {
|
|
58
|
+
Name: 'Columbus United Fencing Club',
|
|
59
|
+
ShortName: 'CUFC'
|
|
60
|
+
},
|
|
61
|
+
PersonEmails: []
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
PersonId: 2003,
|
|
65
|
+
DisplayName: 'Missing Club',
|
|
66
|
+
FirstName: 'Missing',
|
|
67
|
+
LastName: 'Club',
|
|
68
|
+
Club: null,
|
|
69
|
+
PersonEmails: [
|
|
70
|
+
{
|
|
71
|
+
EmailAddress: 'missing-club@example.com',
|
|
72
|
+
IsPrimary: true
|
|
73
|
+
}
|
|
74
|
+
]
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
PersonId: 2004,
|
|
78
|
+
DisplayName: 'No Optional Details',
|
|
79
|
+
FirstName: '',
|
|
80
|
+
LastName: '',
|
|
81
|
+
Club: null,
|
|
82
|
+
PersonEmails: []
|
|
83
|
+
}
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
};
|
|
@@ -1,242 +1,258 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<section class="w-full">
|
|
3
|
-
<div class="flex w-full
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
<
|
|
30
|
-
<div class="
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
</div>
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
</div>
|
|
59
|
-
</div>
|
|
60
|
-
|
|
61
|
-
<div>
|
|
62
|
-
<
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
<span>
|
|
94
|
-
|
|
95
|
-
</span>
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
<div class="text-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
</div>
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
</div>
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
const
|
|
160
|
-
return
|
|
161
|
-
},
|
|
162
|
-
|
|
163
|
-
return this.person?.
|
|
164
|
-
},
|
|
165
|
-
|
|
166
|
-
const
|
|
167
|
-
const
|
|
168
|
-
return
|
|
169
|
-
},
|
|
170
|
-
|
|
171
|
-
return this.
|
|
172
|
-
},
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
if (!q) return
|
|
188
|
-
|
|
189
|
-
return
|
|
190
|
-
},
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
);
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
},
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<section class="w-full">
|
|
3
|
+
<div class="flex w-full flex-col gap-6 md:flex-row">
|
|
4
|
+
<section class="border border-dropdownSelect rounded-lg p-4 bg-white md:w-1/2">
|
|
5
|
+
<BaseText
|
|
6
|
+
:text="`Merge into this account: ${person?.DisplayName || 'Root Account'}`"
|
|
7
|
+
size="md"
|
|
8
|
+
color="primary"
|
|
9
|
+
/>
|
|
10
|
+
|
|
11
|
+
<div class="mt-3 space-y-2">
|
|
12
|
+
<div class="text-sm text-quaternary">
|
|
13
|
+
<span class="font-semibold text-primary">PersonId:</span> {{ rootPersonId }}
|
|
14
|
+
</div>
|
|
15
|
+
<div class="text-sm text-quaternary">
|
|
16
|
+
<span class="font-semibold text-primary">Legal Name:</span> {{ legalName }}
|
|
17
|
+
</div>
|
|
18
|
+
<div class="text-sm text-quaternary">
|
|
19
|
+
<span class="font-semibold text-primary">Club:</span> {{ clubName }}
|
|
20
|
+
</div>
|
|
21
|
+
<div class="text-sm text-quaternary">
|
|
22
|
+
<span class="font-semibold text-primary">Email:</span> {{ primaryEmail }}
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
|
|
26
|
+
<div class="mt-4 flex h-64 flex-col justify-between">
|
|
27
|
+
<div class="min-h-0">
|
|
28
|
+
<BaseText text="Accounts to merge in" size="sm" color="quaternary" weight="bold" />
|
|
29
|
+
<div class="border-b border-dropdownSelect h-2"></div>
|
|
30
|
+
<div v-if="selected.length === 0" class="mt-2 text-sm text-quaternary">
|
|
31
|
+
None selected yet.
|
|
32
|
+
</div>
|
|
33
|
+
<div v-else class="mt-2 max-h-44 overflow-y-auto border border-dropdownSelect rounded-lg">
|
|
34
|
+
<div
|
|
35
|
+
v-for="p in selected"
|
|
36
|
+
:key="p.PersonId"
|
|
37
|
+
class="flex items-center justify-between px-3 py-2 border-b border-dropdownSelect last:border-b-0"
|
|
38
|
+
>
|
|
39
|
+
<div class="min-w-0">
|
|
40
|
+
<div class="text-sm text-primary font-semibold truncate">
|
|
41
|
+
{{ p.DisplayName }}
|
|
42
|
+
<span class="text-xs text-quaternary font-normal">(#{{ p.PersonId }})</span>
|
|
43
|
+
</div>
|
|
44
|
+
<div class="text-xs text-quaternary truncate">
|
|
45
|
+
{{ p.FirstName }} {{ p.LastName }}
|
|
46
|
+
<span v-if="p?.Club?.Name">{{ personClubSuffix(p) }}</span>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
|
|
50
|
+
<BaseButton
|
|
51
|
+
color="warn"
|
|
52
|
+
label="Remove"
|
|
53
|
+
size="xs"
|
|
54
|
+
type="primary"
|
|
55
|
+
@buttonClick="removeSelected(p.PersonId)"
|
|
56
|
+
/>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
|
|
61
|
+
<div class="flex justify-end">
|
|
62
|
+
<BaseButton
|
|
63
|
+
color="warn"
|
|
64
|
+
label="Merge Accounts Together"
|
|
65
|
+
size="sm"
|
|
66
|
+
type="primary"
|
|
67
|
+
:disabled="!canMerge"
|
|
68
|
+
@buttonClick="emitMergeAccounts"
|
|
69
|
+
/>
|
|
70
|
+
</div>
|
|
71
|
+
</div>
|
|
72
|
+
</section>
|
|
73
|
+
|
|
74
|
+
<section class="border border-dropdownSelect rounded-lg p-4 bg-white md:w-1/2">
|
|
75
|
+
<BaseText text="Results" size="md" color="primary" />
|
|
76
|
+
|
|
77
|
+
<div class="mt-4">
|
|
78
|
+
<TitledInput
|
|
79
|
+
title="Filter people"
|
|
80
|
+
placeholder="Type name or club..."
|
|
81
|
+
:inputValue="filterText"
|
|
82
|
+
@update:value="filterText = $event"
|
|
83
|
+
/>
|
|
84
|
+
<div class="text-xs text-quaternary mt-1">
|
|
85
|
+
Filters Display Name, First/Last Name, or Club Name.
|
|
86
|
+
</div>
|
|
87
|
+
</div>
|
|
88
|
+
|
|
89
|
+
<div class="mt-4 flex items-center justify-between text-xs text-quaternary">
|
|
90
|
+
<span>
|
|
91
|
+
Showing {{ filteredPeople.length }}{{ totalMatches > resultLimit ? '+' : '' }} results
|
|
92
|
+
</span>
|
|
93
|
+
<span v-if="totalMatches > resultLimit">
|
|
94
|
+
(limited to first {{ resultLimit }})
|
|
95
|
+
</span>
|
|
96
|
+
</div>
|
|
97
|
+
|
|
98
|
+
<div class="mt-2 border border-dropdownSelect rounded-lg h-64 overflow-y-auto">
|
|
99
|
+
<div
|
|
100
|
+
v-for="p in filteredPeople"
|
|
101
|
+
:key="p.PersonId"
|
|
102
|
+
class="flex items-center justify-between px-3 py-2 border-b border-dropdownSelect last:border-b-0"
|
|
103
|
+
>
|
|
104
|
+
<div class="min-w-0">
|
|
105
|
+
<div class="text-sm text-primary font-semibold truncate">
|
|
106
|
+
<span class="text-xs text-quaternary font-normal">(#{{ p.PersonId }})</span>
|
|
107
|
+
{{ resultTitle(p) }}
|
|
108
|
+
</div>
|
|
109
|
+
<div class="text-xs text-quaternary truncate">
|
|
110
|
+
{{ p.FirstName }} {{ p.LastName }}
|
|
111
|
+
<span v-if="p?.Club?.Name">{{ personClubSuffix(p) }}</span>
|
|
112
|
+
</div>
|
|
113
|
+
</div>
|
|
114
|
+
|
|
115
|
+
<BaseButton
|
|
116
|
+
color="neutral"
|
|
117
|
+
label="Add"
|
|
118
|
+
size="xs"
|
|
119
|
+
type="primary"
|
|
120
|
+
@buttonClick="addSelected(p)"
|
|
121
|
+
/>
|
|
122
|
+
</div>
|
|
123
|
+
|
|
124
|
+
<div v-if="filteredPeople.length === 0" class="px-3 py-3 text-sm text-quaternary">
|
|
125
|
+
No matches.
|
|
126
|
+
</div>
|
|
127
|
+
</div>
|
|
128
|
+
</section>
|
|
129
|
+
</div>
|
|
130
|
+
</section>
|
|
131
|
+
</template>
|
|
132
|
+
|
|
133
|
+
<script>
|
|
134
|
+
import BaseText from "../../../../Atoms/Text/BaseText.vue";
|
|
135
|
+
import TitledInput from "../../../../Molecules/CombinationInputs/TitledInput/TitledInput.vue";
|
|
136
|
+
import BaseButton from "../../../../Molecules/Buttons/BaseButton/BaseButton.vue";
|
|
137
|
+
|
|
138
|
+
export default {
|
|
139
|
+
name: "MergeAccounts",
|
|
140
|
+
components: { BaseText, TitledInput, BaseButton },
|
|
141
|
+
emits: ["merge:merge"],
|
|
142
|
+
props: {
|
|
143
|
+
person: { type: Object, required: true },
|
|
144
|
+
people: { type: Array, required: true },
|
|
145
|
+
},
|
|
146
|
+
data() {
|
|
147
|
+
return {
|
|
148
|
+
filterText: "",
|
|
149
|
+
selected: [],
|
|
150
|
+
resultLimit: 200,
|
|
151
|
+
};
|
|
152
|
+
},
|
|
153
|
+
computed: {
|
|
154
|
+
rootPersonId() {
|
|
155
|
+
return this.person?.PersonId ?? "";
|
|
156
|
+
},
|
|
157
|
+
legalName() {
|
|
158
|
+
const first = this.person?.FirstName || "";
|
|
159
|
+
const last = this.person?.LastName || "";
|
|
160
|
+
return `${first} ${last}`.trim() || "-";
|
|
161
|
+
},
|
|
162
|
+
clubName() {
|
|
163
|
+
return this.person?.Club?.Name || "-";
|
|
164
|
+
},
|
|
165
|
+
primaryEmail() {
|
|
166
|
+
const emails = this.person?.PersonEmails || [];
|
|
167
|
+
const primary = emails.find((email) => email.IsPrimary);
|
|
168
|
+
return primary?.EmailAddress || "-";
|
|
169
|
+
},
|
|
170
|
+
selectedIds() {
|
|
171
|
+
return new Set(this.selected.map((p) => p.PersonId));
|
|
172
|
+
},
|
|
173
|
+
canMerge() {
|
|
174
|
+
return this.selected.length > 0;
|
|
175
|
+
},
|
|
176
|
+
normalizedFilterText() {
|
|
177
|
+
return (this.filterText || "").trim().toLowerCase();
|
|
178
|
+
},
|
|
179
|
+
candidatePeople() {
|
|
180
|
+
return (this.people || []).filter(
|
|
181
|
+
(p) => p && p.PersonId !== this.rootPersonId && !this.selectedIds.has(p.PersonId)
|
|
182
|
+
);
|
|
183
|
+
},
|
|
184
|
+
matchingPeople() {
|
|
185
|
+
const q = this.normalizedFilterText;
|
|
186
|
+
|
|
187
|
+
if (!q) return this.candidatePeople;
|
|
188
|
+
|
|
189
|
+
return this.candidatePeople.filter((p) => this.matchesQuery(p, q));
|
|
190
|
+
},
|
|
191
|
+
totalMatches() {
|
|
192
|
+
return this.matchingPeople.length;
|
|
193
|
+
},
|
|
194
|
+
filteredPeople() {
|
|
195
|
+
return this.matchingPeople.slice(0, this.resultLimit);
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
watch: {
|
|
199
|
+
rootPersonId() {
|
|
200
|
+
this.selected = [];
|
|
201
|
+
},
|
|
202
|
+
people() {
|
|
203
|
+
this.removeUnavailableSelectedPeople();
|
|
204
|
+
},
|
|
205
|
+
},
|
|
206
|
+
methods: {
|
|
207
|
+
personClubSuffix(p) {
|
|
208
|
+
return ` - ${p.Club.Name}`;
|
|
209
|
+
},
|
|
210
|
+
resultTitle(p) {
|
|
211
|
+
const email = this.getPrimaryEmail(p);
|
|
212
|
+
|
|
213
|
+
if (!email) return p.DisplayName || "";
|
|
214
|
+
|
|
215
|
+
return `${p.DisplayName} - ${email}`;
|
|
216
|
+
},
|
|
217
|
+
getPrimaryEmail(p) {
|
|
218
|
+
const emails = p?.PersonEmails || [];
|
|
219
|
+
return emails.find((email) => email.IsPrimary)?.EmailAddress || "";
|
|
220
|
+
},
|
|
221
|
+
matchesQuery(p, q) {
|
|
222
|
+
const display = (p.DisplayName || "").toLowerCase();
|
|
223
|
+
const first = (p.FirstName || "").toLowerCase();
|
|
224
|
+
const last = (p.LastName || "").toLowerCase();
|
|
225
|
+
const club = (p?.Club?.Name || "").toLowerCase();
|
|
226
|
+
const clubShort = (p?.Club?.ShortName || "").toLowerCase();
|
|
227
|
+
|
|
228
|
+
return (
|
|
229
|
+
display.includes(q) ||
|
|
230
|
+
first.includes(q) ||
|
|
231
|
+
last.includes(q) ||
|
|
232
|
+
club.includes(q) ||
|
|
233
|
+
clubShort.includes(q)
|
|
234
|
+
);
|
|
235
|
+
},
|
|
236
|
+
removeUnavailableSelectedPeople() {
|
|
237
|
+
const availableIds = new Set((this.people || []).map((p) => p?.PersonId));
|
|
238
|
+
this.selected = this.selected.filter((p) => availableIds.has(p.PersonId));
|
|
239
|
+
},
|
|
240
|
+
addSelected(p) {
|
|
241
|
+
if (!p || p.PersonId === this.rootPersonId) return;
|
|
242
|
+
if (this.selectedIds.has(p.PersonId)) return;
|
|
243
|
+
this.selected = [...this.selected, p];
|
|
244
|
+
},
|
|
245
|
+
removeSelected(personId) {
|
|
246
|
+
this.selected = this.selected.filter((p) => p.PersonId !== personId);
|
|
247
|
+
},
|
|
248
|
+
emitMergeAccounts() {
|
|
249
|
+
if (!this.canMerge) return;
|
|
250
|
+
|
|
251
|
+
this.$emit("merge:merge", {
|
|
252
|
+
rootPersonId: this.rootPersonId,
|
|
253
|
+
mergePersonIds: this.selected.map((p) => p.PersonId),
|
|
254
|
+
});
|
|
255
|
+
},
|
|
256
|
+
},
|
|
257
|
+
};
|
|
258
|
+
</script>
|