@dcrackel/hematournamentui 1.0.708 → 1.0.709

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.
@@ -1,172 +1,170 @@
1
- <template>
2
- <section class="mt-2 min-h-80">
3
- <div>
4
- <div class="flex flex-col mb-4">
5
- <TitledInput
6
- :inputValue="person.DisplayName || ''"
7
- placeholder="Enter Display Name"
8
- :invalid="validation.DisplayName.invalid"
9
- :title="
10
- validation.DisplayName.invalid ? `DisplayName Name - ${validation.DisplayName.message}` : 'Display Name'
11
- "
12
- @update:value="emitUpdate('DisplayName', $event)"
13
- />
14
- </div>
15
-
16
- <div class="flex flex-col mb-4">
17
- <TitledInput
18
- :inputValue="getLegalName"
19
- placeholder="Enter Your Legal Name"
20
- :invalid="validation.LegalName.invalid"
21
- :title="
22
- validation.LegalName.invalid
23
- ? `Legal Name - ${validation.LegalName.message}`
24
- : 'Legal Name (not shown on site)'
25
- "
26
- @update:value="emitUpdate('LegalName', $event)"
27
- />
28
- </div>
29
-
30
- <div class="flex flex-col mb-4">
31
- <BaseText text="Club Name" size="sm" color="quaternary" />
32
- <DropDownMenu
33
- :label="formattedClubs.length < 2 ? 'Select Club' : ''"
34
- :items="formattedClubs"
35
- :selectedItem="getClubName"
36
- class="pb-2"
37
- @update:selectedItem="emitUpdate('Club', { Name: $event.text, ClubId: $event.link })"
38
- width="w-full"
39
- dropDownWidth="w-full"
40
- />
41
- </div>
42
-
43
- <div class="flex flex-col mb-4">
44
- <BaseText text="Preferred Pronouns" size="sm" color="quaternary" />
45
- <DropDownMenu
46
- :label="getPronounLabel"
47
- :items="pronouns"
48
- class="pb-2"
49
- :selectedItem="getSelectedPronouns"
50
- @update:selectedItem="emitUpdate('Pronouns', $event.text)"
51
- width="w-full"
52
- dropDownWidth="w-full"
53
- />
54
- </div>
55
-
56
- <div class="flex flex-col mb-4">
57
- <TitledInput
58
- :inputValue="getEmail || ''"
59
- placeholder="Enter Your Email"
60
- :invalid="validation.EmailAddress.invalid"
61
- :title="
62
- validation.EmailAddress.invalid ? `Email Address - ${validation.EmailAddress.message}` : 'Email Address'
63
- "
64
- @update:value="emitUpdate('EmailAddress', $event)"
65
- />
66
- </div>
67
-
68
- <div class="border-b border-dropdownSelect mt-6">
69
- <BaseText color="quinary" size="sm" text="PROFILE USE" weight="normal" data-testid="text-registration" />
70
- </div>
71
-
72
- <div class="my-4 w-full">
73
- <BaseText
74
- color="quinary"
75
- size="sm"
76
- text="Your information belongs to you..."
77
- weight="normal"
78
- data-testid="text-registration"
79
- class="mb-4"
80
- />
81
-
82
- <Toggle
83
- :checked="person.ShowData"
84
- label="Allow your name and profile image to be displayed on M² Website?"
85
- :labelLeft="false"
86
- @update:checked="emitUpdate('ShowData', $event)"
87
- />
88
-
89
- <Toggle
90
- :checked="person.ShareData"
91
- label="Share information with 3rd Parties? (like: Hema Ratings)"
92
- :labelLeft="false"
93
- @update:checked="emitUpdate('ShareData', $event)"
94
- />
95
- </div>
96
- </div>
97
- </section>
98
- </template>
99
-
100
- <script>
101
- import TitledInput from '../../../Molecules/CombinationInputs/TitledInput/TitledInput.vue';
102
- import BaseText from '../../../Atoms/Text/BaseText.vue';
103
- import DropDownMenu from '../../../Organisms/ComplexInputs/DropDown/DropDownMenu.vue';
104
- import Toggle from '../../../Molecules/Inputs/Toggle/Toggle.vue';
105
-
106
- export default {
107
- name: 'BasicEdit',
108
- emits: ['update:person'], // Generic emit event
109
- components: { Toggle, DropDownMenu, BaseText, TitledInput },
110
- props: {
111
- person: {
112
- type: Object,
113
- required: true
114
- },
115
- fencingClubs: {
116
- type: Array,
117
- default: () => []
118
- },
119
- validation: {
120
- type: Object,
121
- required: true
122
- }
123
- },
124
- data() {
125
- return {
126
- pronouns: [
127
- { text: 'He/Him', link: 'He/Him' },
128
- { text: 'She/Her', link: 'She/Her' },
129
- { text: 'They/Them', link: 'They/Them' },
130
- { text: 'Other', link: 'Other' }
131
- ]
132
- };
133
- },
134
- computed: {
135
- formattedClubs() {
136
- return this.fencingClubs.map(club => ({
137
- text: club.Name,
138
- link: club.ClubId.toString()
139
- }));
140
- },
141
- getLegalName() {
142
- if (!this.person.FirstName && !this.person.LastName) {
143
- return ``;
144
- }
145
- return `${this.person.FirstName} ${this.person.LastName}`;
146
- },
147
- getClubName() {
148
- return this.person?.Club
149
- ? { text: this.person.Club.Name, link: this.person.Club.ClubId }
150
- : { text: 'No Club', link: null };
151
- },
152
- getSelectedPronouns() {
153
- if (!this.person.Pronouns) {
154
- return { text: 'He/Him', link: 'He/Him' };
155
- }
156
- return { text: this.person.Pronouns, link: this.person.Pronouns };
157
- },
158
- getEmail() {
159
- const primaryEmail = this.person.PersonEmails?.find(e => e.IsPrimary === true);
160
- return primaryEmail ? primaryEmail.EmailAddress : '';
161
- },
162
- getPronounLabel() {
163
- return this.person.Pronouns ? '' : 'Please select your preferred pronouns';
164
- }
165
- },
166
- methods: {
167
- emitUpdate(field, value) {
168
- this.$emit('update:person', { field, value });
169
- }
170
- }
171
- };
172
- </script>
1
+ <template>
2
+ <section class="mt-2 min-h-80">
3
+ <div>
4
+ <div class="flex flex-col mb-4">
5
+ <TitledInput
6
+ :inputValue="person.DisplayName || ''"
7
+ placeholder="Enter Display Name"
8
+ :invalid="validation.DisplayName.invalid"
9
+ :title="
10
+ validation.DisplayName.invalid ? `DisplayName Name - ${validation.DisplayName.message}` : 'Display Name'
11
+ "
12
+ @update:value="emitUpdate('DisplayName', $event)"
13
+ />
14
+ </div>
15
+
16
+ <div class="flex flex-col mb-4">
17
+ <TitledInput
18
+ :inputValue="getLegalName"
19
+ placeholder="Enter Your Legal Name"
20
+ :invalid="validation.LegalName.invalid"
21
+ :title="
22
+ validation.LegalName.invalid
23
+ ? `Legal Name - ${validation.LegalName.message}`
24
+ : 'Legal Name (not shown on site)'
25
+ "
26
+ @update:value="emitUpdate('LegalName', $event)"
27
+ />
28
+ </div>
29
+
30
+ <div class="flex flex-col mb-4">
31
+ <BaseText text="Club Name" size="sm" color="quaternary" />
32
+ <DropDownMenu
33
+ :label="formattedClubs.length < 2 ? 'Select Club' : ''"
34
+ :items="formattedClubs"
35
+ :selectedItem="getClubName"
36
+ class="pb-2"
37
+ @update:selectedItem="emitUpdate('Club', { Name: $event.text, ClubId: $event.link })"
38
+ width="w-full"
39
+ dropDownWidth="w-full"
40
+ />
41
+ </div>
42
+
43
+ <div class="flex flex-col mb-4">
44
+ <BaseText text="Preferred Pronouns" size="sm" color="quaternary" />
45
+ <DropDownMenu
46
+ :label="getPronounLabel"
47
+ :items="pronouns"
48
+ class="pb-2"
49
+ :selectedItem="getSelectedPronouns"
50
+ @update:selectedItem="emitUpdate('Pronouns', $event.text)"
51
+ width="w-full"
52
+ dropDownWidth="w-full"
53
+ />
54
+ </div>
55
+
56
+ <div class="flex flex-col mb-4">
57
+ <TitledInput
58
+ :inputValue="getEmail || ''"
59
+ inputType="email"
60
+ placeholder="Enter Your Email"
61
+ :invalid="validation.EmailAddress.invalid"
62
+ :title="
63
+ validation.EmailAddress.invalid ? `Email Address - ${validation.EmailAddress.message}` : 'Email Address'
64
+ "
65
+ @update:value="emitUpdate('EmailAddress', $event)"
66
+ />
67
+ </div>
68
+
69
+ <div class="border-b border-dropdownSelect mt-6">
70
+ <BaseText color="quinary" size="sm" text="PROFILE USE" weight="normal" data-testid="text-registration" />
71
+ </div>
72
+
73
+ <div class="my-4 w-full">
74
+ <BaseText
75
+ color="quinary"
76
+ size="sm"
77
+ text="Your information belongs to you..."
78
+ weight="normal"
79
+ data-testid="text-registration"
80
+ class="mb-4"
81
+ />
82
+
83
+ <Toggle
84
+ :checked="person.ShowData"
85
+ label="Allow your name and profile image to be displayed on M² Website?"
86
+ :labelLeft="false"
87
+ @update:checked="emitUpdate('ShowData', $event)"
88
+ />
89
+
90
+ <Toggle
91
+ :checked="person.ShareData"
92
+ label="Share information with 3rd Parties? (like: Hema Ratings)"
93
+ :labelLeft="false"
94
+ @update:checked="emitUpdate('ShareData', $event)"
95
+ />
96
+ </div>
97
+ </div>
98
+ </section>
99
+ </template>
100
+
101
+ <script>
102
+ import TitledInput from '../../../Molecules/CombinationInputs/TitledInput/TitledInput.vue';
103
+ import BaseText from '../../../Atoms/Text/BaseText.vue';
104
+ import DropDownMenu from '../../../Organisms/ComplexInputs/DropDown/DropDownMenu.vue';
105
+ import Toggle from '../../../Molecules/Inputs/Toggle/Toggle.vue';
106
+ import { getDraftEmailAddress, getDraftLegalName } from '../PersonManagementDraft.js';
107
+
108
+ export default {
109
+ name: 'BasicEdit',
110
+ emits: ['update:person'], // Generic emit event
111
+ components: { Toggle, DropDownMenu, BaseText, TitledInput },
112
+ props: {
113
+ person: {
114
+ type: Object,
115
+ required: true
116
+ },
117
+ fencingClubs: {
118
+ type: Array,
119
+ default: () => []
120
+ },
121
+ validation: {
122
+ type: Object,
123
+ required: true
124
+ }
125
+ },
126
+ data() {
127
+ return {
128
+ pronouns: [
129
+ { text: 'He/Him', link: 'He/Him' },
130
+ { text: 'She/Her', link: 'She/Her' },
131
+ { text: 'They/Them', link: 'They/Them' },
132
+ { text: 'Other', link: 'Other' }
133
+ ]
134
+ };
135
+ },
136
+ computed: {
137
+ formattedClubs() {
138
+ return this.fencingClubs.map(club => ({
139
+ text: club.Name,
140
+ link: club.ClubId.toString()
141
+ }));
142
+ },
143
+ getLegalName() {
144
+ return getDraftLegalName(this.person);
145
+ },
146
+ getClubName() {
147
+ return this.person?.Club
148
+ ? { text: this.person.Club.Name, link: this.person.Club.ClubId }
149
+ : { text: 'No Club', link: null };
150
+ },
151
+ getSelectedPronouns() {
152
+ if (!this.person.Pronouns) {
153
+ return { text: 'He/Him', link: 'He/Him' };
154
+ }
155
+ return { text: this.person.Pronouns, link: this.person.Pronouns };
156
+ },
157
+ getEmail() {
158
+ return getDraftEmailAddress(this.person);
159
+ },
160
+ getPronounLabel() {
161
+ return this.person.Pronouns ? '' : 'Please select your preferred pronouns';
162
+ }
163
+ },
164
+ methods: {
165
+ emitUpdate(field, value) {
166
+ this.$emit('update:person', { field, value });
167
+ }
168
+ }
169
+ };
170
+ </script>
@@ -1,103 +1,156 @@
1
- import PersonManagement from './PersonManagement.vue';
2
- import clubGetAllMock from '../../../mocks/clubGetAllMock.js';
3
- import personsMock from '../../../mocks/personsMock.js';
4
- import attendance from '../../../mocks/getAttendance.js';
5
- import allPersonsMock from '../../../mocks/personGetAllMock.js';
6
-
7
- export default {
8
- title: 'Templates/PersonManagement/PersonManagement',
9
- component: PersonManagement,
10
- tags: ['autodocs'],
11
- args: {
12
- personProfile: personsMock,
13
- fencingClubs: clubGetAllMock,
14
- attendance: attendance,
15
- uploadImageName: 'profile-test.png',
16
- uploadServer: 'http://localhost:3000/api/upload/',
17
- imageServer: 'https://meyersquaredimages.com/uploads/',
18
- userLevel: 'user'
19
- },
20
- argTypes: {
21
- personProfile: { control: { type: 'object' } },
22
- fencingClubs: { control: { type: 'object' } },
23
- attendance: { control: { type: 'object' } },
24
- uploadImageName: { control: { type: 'text' } },
25
- uploadServer: { control: { type: 'text' } },
26
- imageServer: { control: { type: 'text' } },
27
- userLevel: { control: { type: 'string' } }
28
- }
29
- };
30
-
31
- export const Default = {
32
- args: {
33
- personProfile: personsMock[1],
34
- fencingClubs: clubGetAllMock,
35
- attendance: attendance,
36
- uploadImageName: 'profile-test',
37
- uploadServer: 'http://localhost:3000/api/upload/',
38
- imageServer: 'http://localhost:3000/uploads/',
39
- userLevel: 'User'
40
- }
41
- };
42
-
43
- export const admin = {
44
- args: {
45
- personProfile: personsMock[1],
46
- fencingClubs: clubGetAllMock,
47
- attendance: attendance,
48
- people: allPersonsMock,
49
- uploadImageName: 'profile-test',
50
- uploadServer: 'http://localhost:3000/api/upload/',
51
- imageServer: 'http://localhost:3000/uploads/',
52
- userLevel: 'Admin'
53
- }
54
- };
55
-
56
- export const clubAdmin = {
57
- args: {
58
- personProfile: personsMock[1],
59
- fencingClubs: clubGetAllMock,
60
- people: allPersonsMock,
61
- attendance: attendance,
62
- uploadImageName: 'profile-test',
63
- uploadServer: 'http://localhost:3000/api/upload/',
64
- imageServer: 'http://localhost:3000/uploads/',
65
- userLevel: 'Club'
66
- }
67
- };
68
-
69
- export const adminWithLoading = {
70
- args: {
71
- personProfile: personsMock,
72
- fencingClubs: clubGetAllMock,
73
- attendance: attendance,
74
- people: allPersonsMock,
75
- uploadImageName: 'profile-test',
76
- uploadServer: 'http://localhost:3000/api/upload/',
77
- imageServer: 'http://localhost:3000/uploads/',
78
- userLevel: 'Admin',
79
- loading: true
80
- }
81
- };
82
-
83
- export const emptyProfile = {
84
- args: {
85
- personProfile: {
86
- DisplayName: '',
87
- LegalName: '',
88
- EmailAddress: '',
89
- Club: { Name: 'No Club Affiliation ', ClubId: '17' },
90
- AccessLevel: 'User',
91
- ShareData: true,
92
- ShowData: true
93
- },
94
- fencingClubs: clubGetAllMock,
95
- attendance: attendance,
96
- people: allPersonsMock,
97
- uploadImageName: 'profile-test',
98
- uploadServer: 'http://localhost:3000/api/upload/',
99
- imageServer: 'http://localhost:3000/uploads/',
100
- userLevel: 'Admin',
101
- loading: false
102
- }
103
- };
1
+ import { ref } from 'vue';
2
+ import PersonManagement from './PersonManagement.vue';
3
+ import clubGetAllMock from '../../../mocks/clubGetAllMock.js';
4
+ import personsMock from '../../../mocks/personsMock.js';
5
+ import attendance from '../../../mocks/getAttendance.js';
6
+ import allPersonsMock from '../../../mocks/personGetAllMock.js';
7
+
8
+ export default {
9
+ title: 'Templates/PersonManagement/PersonManagement',
10
+ component: PersonManagement,
11
+ tags: ['autodocs'],
12
+ args: {
13
+ personProfile: personsMock[1],
14
+ fencingClubs: clubGetAllMock,
15
+ attendance: attendance,
16
+ uploadImageName: 'profile-test',
17
+ uploadServer: 'http://localhost:3000/api/upload/',
18
+ imageServer: 'https://meyersquaredimages.com/uploads/',
19
+ userLevel: 'User',
20
+ saving: false,
21
+ disabled: false,
22
+ draftResetKey: 0
23
+ },
24
+ argTypes: {
25
+ personProfile: { control: { type: 'object' } },
26
+ fencingClubs: { control: { type: 'object' } },
27
+ attendance: { control: { type: 'object' } },
28
+ uploadImageName: { control: { type: 'text' } },
29
+ uploadServer: { control: { type: 'text' } },
30
+ imageServer: { control: { type: 'text' } },
31
+ userLevel: { control: { type: 'select' }, options: ['User', 'Club', 'Admin'] },
32
+ saving: { control: 'boolean', description: 'Disables editing and actions while the parent saves.' },
33
+ disabled: { control: 'boolean', description: 'Disables the entire profile form.' },
34
+ draftResetKey: { control: 'number', description: 'Change after a confirmed reload to replace the draft.' },
35
+ 'submit:person': { action: 'submit:person' },
36
+ 'update:image': { action: 'update:image' },
37
+ 'error:image': { action: 'error:image' }
38
+ }
39
+ };
40
+
41
+ export const Default = {
42
+ args: {
43
+ personProfile: personsMock[1],
44
+ fencingClubs: clubGetAllMock,
45
+ attendance: attendance,
46
+ uploadImageName: 'profile-test',
47
+ uploadServer: 'http://localhost:3000/api/upload/',
48
+ imageServer: 'http://localhost:3000/uploads/',
49
+ userLevel: 'User'
50
+ }
51
+ };
52
+
53
+ export const admin = {
54
+ args: {
55
+ personProfile: personsMock[1],
56
+ fencingClubs: clubGetAllMock,
57
+ attendance: attendance,
58
+ people: allPersonsMock,
59
+ uploadImageName: 'profile-test',
60
+ uploadServer: 'http://localhost:3000/api/upload/',
61
+ imageServer: 'http://localhost:3000/uploads/',
62
+ userLevel: 'Admin'
63
+ }
64
+ };
65
+
66
+ export const clubAdmin = {
67
+ args: {
68
+ personProfile: personsMock[1],
69
+ fencingClubs: clubGetAllMock,
70
+ people: allPersonsMock,
71
+ attendance: attendance,
72
+ uploadImageName: 'profile-test',
73
+ uploadServer: 'http://localhost:3000/api/upload/',
74
+ imageServer: 'http://localhost:3000/uploads/',
75
+ userLevel: 'Club'
76
+ }
77
+ };
78
+
79
+ export const adminWithLoading = {
80
+ args: {
81
+ personProfile: personsMock[1],
82
+ fencingClubs: clubGetAllMock,
83
+ attendance: attendance,
84
+ people: allPersonsMock,
85
+ uploadImageName: 'profile-test',
86
+ uploadServer: 'http://localhost:3000/api/upload/',
87
+ imageServer: 'http://localhost:3000/uploads/',
88
+ userLevel: 'Admin',
89
+ loading: true
90
+ }
91
+ };
92
+
93
+ export const Saving = {
94
+ args: { ...admin.args, saving: true }
95
+ };
96
+
97
+ export const Disabled = {
98
+ args: { ...Default.args, disabled: true }
99
+ };
100
+
101
+ export const CurrentDraft = {
102
+ args: {
103
+ ...admin.args,
104
+ personProfile: {
105
+ ...personsMock[1],
106
+ LegalName: 'Updated Legal Name',
107
+ EmailAddress: 'draft@example.com',
108
+ HemaRatingsId: null,
109
+ Images: []
110
+ }
111
+ }
112
+ };
113
+
114
+ export const ResetDraft = {
115
+ args: { ...admin.args },
116
+ render: args => ({
117
+ components: { PersonManagement },
118
+ setup() {
119
+ const revision = ref(0);
120
+ const resetDraft = () => {
121
+ revision.value += 1;
122
+ };
123
+ return { args, revision, resetDraft };
124
+ },
125
+ template: `
126
+ <div>
127
+ <button type="button" class="mb-4 rounded border border-dropdownSelect p-2 text-quinary" @click="resetDraft">
128
+ Reset unsaved changes to supplied profile
129
+ </button>
130
+ <PersonManagement v-bind="args" :draftResetKey="revision" />
131
+ </div>
132
+ `
133
+ })
134
+ };
135
+
136
+ export const emptyProfile = {
137
+ args: {
138
+ personProfile: {
139
+ DisplayName: '',
140
+ LegalName: '',
141
+ EmailAddress: '',
142
+ Club: { Name: 'No Club Affiliation ', ClubId: '17' },
143
+ AccessLevel: 'User',
144
+ ShareData: true,
145
+ ShowData: true
146
+ },
147
+ fencingClubs: clubGetAllMock,
148
+ attendance: attendance,
149
+ people: allPersonsMock,
150
+ uploadImageName: 'profile-test',
151
+ uploadServer: 'http://localhost:3000/api/upload/',
152
+ imageServer: 'http://localhost:3000/uploads/',
153
+ userLevel: 'Admin',
154
+ loading: false
155
+ }
156
+ };