@ieeesa-npm/groups 0.8.2 → 0.8.4
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/esm2022/lib/assets/constants.json +13 -2
- package/esm2022/lib/assets/form-validations.mjs +3 -1
- package/esm2022/lib/components/add-user-roster/add-user-roster.component.mjs +187 -85
- package/esm2022/lib/models/add-or-edit-user-group.model.mjs +1 -1
- package/fesm2022/ieeesa-npm-groups.mjs +201 -86
- package/fesm2022/ieeesa-npm-groups.mjs.map +1 -1
- package/lib/assets/form-validations.d.ts +1 -0
- package/lib/components/add-user-roster/add-user-roster.component.d.ts +32 -2
- package/lib/models/add-or-edit-user-group.model.d.ts +3 -1
- package/lib/services/groups.service.d.ts +25 -1
- package/package.json +3 -3
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export {};
|
|
2
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
2
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYWRkLW9yLWVkaXQtdXNlci1ncm91cC5tb2RlbC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3Byb2plY3RzL2dyb3Vwcy9zcmMvbGliL21vZGVscy9hZGQtb3ItZWRpdC11c2VyLWdyb3VwLm1vZGVsLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgaW50ZXJmYWNlIEFkZE9yRWRpdEdyb3VwVXNlckRldGFpbHNSZXNwb25zZSB7XHJcbiAgc3RhdHVzOiBib29sZWFuO1xyXG4gIG1lc3NhZ2U6IHN0cmluZztcclxuICBib2R5Pzogc3RyaW5nIHwgbnVsbCB8IHsgZXJyb3JDb2Rlczogc3RyaW5nW10gfTtcclxufVxyXG5cclxuZXhwb3J0IGludGVyZmFjZSBBZGRPckVkaXRVc2VyUm9sZVBheWxvYWQge1xyXG4gIGdyb3VwSWQ6IHN0cmluZztcclxuICB1c2VySWQ/OiBzdHJpbmc7XHJcbiAgcm9sZXM6IHN0cmluZ1tdO1xyXG4gIGVtYWlsOiBzdHJpbmc7XHJcbiAgZmlyc3ROYW1lPzogc3RyaW5nO1xyXG4gIGxhc3ROYW1lPzogc3RyaW5nXHJcbn1cclxuXHJcbmV4cG9ydCBpbnRlcmZhY2UgQWRkT3JFZGl0SW5kaXZpZHVhbFJvc3RlclBheWxvYWRcclxuICBleHRlbmRzIEFkZE9yRWRpdFVzZXJSb2xlUGF5bG9hZCB7XHJcbiAgY2xhc3NpZmljYXRpb24/OiB7XHJcbiAgICBjbGFzc2lmaWNhdGlvbklkOiBzdHJpbmc7XHJcbiAgfTtcclxuICBvcmdhbml6YXRpb246IHsgb3JnSWQ6IHN0cmluZzsgb3JnTmFtZTogc3RyaW5nIH07XHJcbiAgbWVtYmVyU3RhdHVzOiB7IG1lbWJlclN0YXR1c0lkOiBzdHJpbmcgfTtcclxufVxyXG5cclxuZXhwb3J0IGludGVyZmFjZSBBZGRPckVkaXRVc2VyUGF5bG9hZCB7XHJcbiAgcGF5bG9hZDogQWRkT3JFZGl0VXNlclJvbGVQYXlsb2FkO1xyXG59XHJcblxyXG5leHBvcnQgaW50ZXJmYWNlIEFkZE9yRWRpdFVzZXJJbmRpdmlkdWFsUm9zdGVyUGF5bG9hZCB7XHJcbiAgcGF5bG9hZDogQWRkT3JFZGl0SW5kaXZpZHVhbFJvc3RlclBheWxvYWQ7XHJcbn1cclxuIl19
|
|
@@ -28,6 +28,8 @@ var addUserRoster = {
|
|
|
28
28
|
leftButtonLabel: "Cancel",
|
|
29
29
|
saveButtonLabel: "Save",
|
|
30
30
|
fullName: "Name",
|
|
31
|
+
firstName: "First Name",
|
|
32
|
+
lastName: "Last Name",
|
|
31
33
|
role: "Role",
|
|
32
34
|
classification: "Classification",
|
|
33
35
|
representingOrganization: "Representing Organization",
|
|
@@ -35,6 +37,8 @@ var addUserRoster = {
|
|
|
35
37
|
ariaLabel: {
|
|
36
38
|
email: "Email Address",
|
|
37
39
|
fullName: "Full name",
|
|
40
|
+
firstName: "First Name",
|
|
41
|
+
lastName: "Last Name",
|
|
38
42
|
role: "Role",
|
|
39
43
|
classification: "Classification",
|
|
40
44
|
memberType: "Member Type",
|
|
@@ -43,6 +47,8 @@ var addUserRoster = {
|
|
|
43
47
|
ariaDescribedById: {
|
|
44
48
|
email: "ariaEmailAddress",
|
|
45
49
|
fullName: "ariaFullName",
|
|
50
|
+
firstName: "ariaFirstName",
|
|
51
|
+
lastName: "ariaLastName",
|
|
46
52
|
role: "ariaRole",
|
|
47
53
|
classification: "ariaClassification",
|
|
48
54
|
memberType: "ariaMemberType",
|
|
@@ -58,7 +64,8 @@ var addUserRoster = {
|
|
|
58
64
|
},
|
|
59
65
|
pattern: {
|
|
60
66
|
email: "Please enter valid email.",
|
|
61
|
-
representingOrganization: "Representing Organization contains invalid characters. Please enter alphanumeric, special characters and whitespace only."
|
|
67
|
+
representingOrganization: "Representing Organization contains invalid characters. Please enter alphanumeric, special characters and whitespace only.",
|
|
68
|
+
firstOrLastName: "This field is required."
|
|
62
69
|
}
|
|
63
70
|
},
|
|
64
71
|
success: {
|
|
@@ -68,6 +75,8 @@ var addUserRoster = {
|
|
|
68
75
|
supportText: {
|
|
69
76
|
emailAddress: "Please enter valid email address which includes @ symbol, dot (.) and domain. For example, user@ieee.org",
|
|
70
77
|
fullName: "Enter user full name.",
|
|
78
|
+
firstName: "Enter user's first name.",
|
|
79
|
+
lastName: "Enter user's last name.",
|
|
71
80
|
role: "<strong>Note:</strong> In order to remove all roles, please remove the user from the system user group.",
|
|
72
81
|
roleForIndividualRoster: "Select Role(s) from the options.",
|
|
73
82
|
classification: "Select Classification from the dropdown.",
|
|
@@ -293,7 +302,9 @@ var errors = {
|
|
|
293
302
|
"1032": "No record found!",
|
|
294
303
|
"1033": "Please enter at least 3 characters to perform search operation.",
|
|
295
304
|
"1034": "No record(s) found.",
|
|
296
|
-
"
|
|
305
|
+
"1035": "First name is required.",
|
|
306
|
+
"1036": "Last name is required.",
|
|
307
|
+
"2001": "No user found. Please add details for the new user.",
|
|
297
308
|
"2002": "Role does not belong to the group type.",
|
|
298
309
|
"2010": "User not found.",
|
|
299
310
|
"2011": "User not found.",
|
|
@@ -357,6 +368,8 @@ const GroupsValidationPatterns = {
|
|
|
357
368
|
representingOrgNameMinLength: 3,
|
|
358
369
|
// Representing Organization field regular expression which accept Alpha Numeric, Special Characters and whitespace.
|
|
359
370
|
representingOrganization: /^(?=.*[a-zA-Z])[\w\s!"#$%&'()*+,-.\/\:;<=>?@[\]^_`{|}~\\]+$/i,
|
|
371
|
+
// First or Last Name field regular expression which does not allow only whitespace or empty string.
|
|
372
|
+
firstOrLastName: /^(?!\s*$).+/
|
|
360
373
|
};
|
|
361
374
|
|
|
362
375
|
/* eslint-disable no-unused-vars */
|
|
@@ -2523,6 +2536,7 @@ class AddUserRosterComponent {
|
|
|
2523
2536
|
this.memberTypes = [];
|
|
2524
2537
|
this.organizations = [];
|
|
2525
2538
|
this.hasClassification = false;
|
|
2539
|
+
this.isUserExist = false;
|
|
2526
2540
|
this.submitFormResponse = new EventEmitter();
|
|
2527
2541
|
this.formCancel = new EventEmitter();
|
|
2528
2542
|
}
|
|
@@ -2536,12 +2550,7 @@ class AddUserRosterComponent {
|
|
|
2536
2550
|
this.hasClassification = groupType?.hasClassification ?? false;
|
|
2537
2551
|
this.groupRosterType = groupType?.rosterType;
|
|
2538
2552
|
if (!this.groupRosterType)
|
|
2539
|
-
this.
|
|
2540
|
-
status: 'custom',
|
|
2541
|
-
message: this.constants?.errors?.ER1001,
|
|
2542
|
-
alertType: AlertType.ERROR,
|
|
2543
|
-
isCloseNeeded: true,
|
|
2544
|
-
});
|
|
2553
|
+
this.showAlertMessage(this.constants?.errors?.ER1001, AlertType.ERROR);
|
|
2545
2554
|
else {
|
|
2546
2555
|
if (this.groupRosterType === GroupRosterType.INDIVIDUAL) {
|
|
2547
2556
|
if (this.hasClassification)
|
|
@@ -2605,12 +2614,35 @@ class AddUserRosterComponent {
|
|
|
2605
2614
|
next: (res) => {
|
|
2606
2615
|
if (res?.status) {
|
|
2607
2616
|
this.userInfo = res?.body;
|
|
2617
|
+
this.isUserExist = true;
|
|
2608
2618
|
this.validateUserExistence();
|
|
2609
2619
|
}
|
|
2610
2620
|
},
|
|
2611
2621
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2612
2622
|
error: (error) => {
|
|
2613
|
-
this.
|
|
2623
|
+
this.isUserExist = false;
|
|
2624
|
+
const errorCodes = error?.error?.body?.errorCodes;
|
|
2625
|
+
if (errorCodes?.includes('2001')) {
|
|
2626
|
+
this.isSearchUserForm = false;
|
|
2627
|
+
this.rightButtonLabel =
|
|
2628
|
+
this.addUserRosterTexts?.label?.saveButtonLabel;
|
|
2629
|
+
this.isSubmitButtonDisabled = true;
|
|
2630
|
+
if (!this.isAddUserFormEmailSearch ||
|
|
2631
|
+
!(this.addUserFormGroupRef.contains('firstName') &&
|
|
2632
|
+
this.addUserFormGroupRef.contains('lastName'))) {
|
|
2633
|
+
if (this.userInfo?.email)
|
|
2634
|
+
this.userInfo.email = email;
|
|
2635
|
+
this.updateAddUserFormGroupValues(JSON.stringify(this.addUserFormGroupRef?.value));
|
|
2636
|
+
}
|
|
2637
|
+
else {
|
|
2638
|
+
this.addUserFormGroupRef?.get('firstName')?.setValue('');
|
|
2639
|
+
this.addUserFormGroupRef?.get('lastName')?.setValue('');
|
|
2640
|
+
}
|
|
2641
|
+
this.showAlertMessage(this.constants?.errors?.['2001'], AlertType.ERROR);
|
|
2642
|
+
}
|
|
2643
|
+
else {
|
|
2644
|
+
this.handleErrors(error);
|
|
2645
|
+
}
|
|
2614
2646
|
},
|
|
2615
2647
|
});
|
|
2616
2648
|
}
|
|
@@ -2630,12 +2662,7 @@ class AddUserRosterComponent {
|
|
|
2630
2662
|
.pipe(takeUntil$1(this.destroy$))
|
|
2631
2663
|
?.subscribe({
|
|
2632
2664
|
next: () => {
|
|
2633
|
-
this.
|
|
2634
|
-
status: 'custom',
|
|
2635
|
-
message: this.constants?.errors?.['1022'],
|
|
2636
|
-
alertType: AlertType.ERROR,
|
|
2637
|
-
isCloseNeeded: true,
|
|
2638
|
-
});
|
|
2665
|
+
this.showAlertMessage(this.constants?.errors?.['1022'], AlertType.ERROR);
|
|
2639
2666
|
},
|
|
2640
2667
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2641
2668
|
error: (error) => {
|
|
@@ -2644,74 +2671,17 @@ class AddUserRosterComponent {
|
|
|
2644
2671
|
this.isSearchUserForm = false;
|
|
2645
2672
|
this.rightButtonLabel =
|
|
2646
2673
|
this.addUserRosterTexts?.label?.saveButtonLabel;
|
|
2674
|
+
const addUserFormGroupPrevValues = JSON.stringify(this.addUserFormGroupRef?.value);
|
|
2647
2675
|
if (!this.isAddUserFormEmailSearch) {
|
|
2648
2676
|
this.selectedUserRoles = [];
|
|
2649
2677
|
this.isSubmitButtonDisabled = true;
|
|
2650
|
-
this.
|
|
2651
|
-
formGroup: [
|
|
2652
|
-
{
|
|
2653
|
-
legend: '',
|
|
2654
|
-
controls: [
|
|
2655
|
-
{
|
|
2656
|
-
type: FormControlType.SEARCH,
|
|
2657
|
-
label: this.addUserRosterTexts?.label?.email + '*',
|
|
2658
|
-
controlName: 'emailSearch',
|
|
2659
|
-
value: this.userInfo?.email,
|
|
2660
|
-
searchType: SearchType.ON_CLICK,
|
|
2661
|
-
validation: [
|
|
2662
|
-
Validators.required,
|
|
2663
|
-
Validators.pattern(GroupsValidationPatterns.email),
|
|
2664
|
-
],
|
|
2665
|
-
supportMessage: this.addUserRosterTexts?.supportText?.emailAddress,
|
|
2666
|
-
requiredErrorMessage: this.addUserRosterTexts?.message?.error?.required,
|
|
2667
|
-
patternErrorMessage: this.addUserRosterTexts?.message?.error?.pattern
|
|
2668
|
-
?.email,
|
|
2669
|
-
ariaLabel: this.addUserRosterTexts?.label?.ariaLabel?.email,
|
|
2670
|
-
ariaDescribedById: this.addUserRosterTexts?.label?.ariaDescribedById
|
|
2671
|
-
?.email,
|
|
2672
|
-
},
|
|
2673
|
-
{
|
|
2674
|
-
type: FormControlType.TEXT_AREA,
|
|
2675
|
-
label: this.addUserRosterTexts?.label?.fullName + '*',
|
|
2676
|
-
controlName: 'fullName',
|
|
2677
|
-
value: this.userInfo?.name,
|
|
2678
|
-
validation: [Validators.required],
|
|
2679
|
-
requiredErrorMessage: this.addUserRosterTexts?.message?.error?.required,
|
|
2680
|
-
isReadonly: true,
|
|
2681
|
-
ariaMultiline: false,
|
|
2682
|
-
ariaLabel: this.addUserRosterTexts?.label?.ariaLabel?.fullName,
|
|
2683
|
-
ariaDescribedById: this.addUserRosterTexts?.label?.ariaDescribedById
|
|
2684
|
-
?.fullName,
|
|
2685
|
-
},
|
|
2686
|
-
{
|
|
2687
|
-
type: FormControlType.CHECKBOX,
|
|
2688
|
-
label: this.groupRosterType === GroupRosterType.INDIVIDUAL
|
|
2689
|
-
? this.addUserRosterTexts?.label?.role
|
|
2690
|
-
: this.addUserRosterTexts?.label?.role + '*',
|
|
2691
|
-
controlName: 'roles',
|
|
2692
|
-
checkboxOptions: this.userRoles,
|
|
2693
|
-
minSelectionRequired: 1,
|
|
2694
|
-
ariaLabel: this.addUserRosterTexts?.label?.ariaLabel?.role,
|
|
2695
|
-
ariaDescribedById: this.addUserRosterTexts?.label?.ariaDescribedById
|
|
2696
|
-
?.role,
|
|
2697
|
-
supportMessage: this.groupRosterType === GroupRosterType.INDIVIDUAL
|
|
2698
|
-
? this.addUserRosterTexts?.supportText
|
|
2699
|
-
?.roleForIndividualRoster
|
|
2700
|
-
: this.addUserRosterTexts?.supportText?.role,
|
|
2701
|
-
requiredErrorMessage: this.addUserRosterTexts?.message?.error?.required,
|
|
2702
|
-
validation: this.groupRosterType === GroupRosterType.INDIVIDUAL
|
|
2703
|
-
? []
|
|
2704
|
-
: [Validators.required],
|
|
2705
|
-
},
|
|
2706
|
-
],
|
|
2707
|
-
},
|
|
2708
|
-
],
|
|
2709
|
-
};
|
|
2678
|
+
this.createAddUserFormGroup();
|
|
2710
2679
|
if (this.groupRosterType === GroupRosterType.INDIVIDUAL) {
|
|
2711
2680
|
this.updateAddUserFormGroup();
|
|
2712
2681
|
}
|
|
2713
2682
|
}
|
|
2714
2683
|
else {
|
|
2684
|
+
this.updateAddUserFormGroupValues(addUserFormGroupPrevValues);
|
|
2715
2685
|
this.addUserFormGroupRef
|
|
2716
2686
|
?.get('emailSearch')
|
|
2717
2687
|
?.setValue(this.userInfo?.email);
|
|
@@ -2727,17 +2697,141 @@ class AddUserRosterComponent {
|
|
|
2727
2697
|
},
|
|
2728
2698
|
});
|
|
2729
2699
|
}
|
|
2700
|
+
/**
|
|
2701
|
+
* Creates add user form group and updates it with prev form values.
|
|
2702
|
+
* @param {string} stringifiedAddUserFormPrevValues
|
|
2703
|
+
* @memberof AddUserRosterComponent
|
|
2704
|
+
*/
|
|
2705
|
+
updateAddUserFormGroupValues(addUserFormValues) {
|
|
2706
|
+
this.createAddUserFormGroup(this.userInfo?.email);
|
|
2707
|
+
if (this.groupRosterType === GroupRosterType.INDIVIDUAL) {
|
|
2708
|
+
const formValues = addUserFormValues ? JSON.parse(addUserFormValues) : '';
|
|
2709
|
+
this.updateAddUserFormGroup({
|
|
2710
|
+
classification: formValues?.classification,
|
|
2711
|
+
memberType: formValues?.memberType,
|
|
2712
|
+
representingOrg: formValues?.representingOrg,
|
|
2713
|
+
});
|
|
2714
|
+
}
|
|
2715
|
+
}
|
|
2716
|
+
/**
|
|
2717
|
+
* Initialize the add user form group array.
|
|
2718
|
+
* @param {string} [email]
|
|
2719
|
+
* @memberof AddUserRosterComponent
|
|
2720
|
+
*/
|
|
2721
|
+
createAddUserFormGroup(email) {
|
|
2722
|
+
this.addUserFormGroup = {
|
|
2723
|
+
formGroup: [
|
|
2724
|
+
{
|
|
2725
|
+
legend: '',
|
|
2726
|
+
controls: [
|
|
2727
|
+
{
|
|
2728
|
+
type: FormControlType.SEARCH,
|
|
2729
|
+
label: this.addUserRosterTexts?.label?.email + '*',
|
|
2730
|
+
controlName: 'emailSearch',
|
|
2731
|
+
value: this.isUserExist ? this.userInfo?.email : email,
|
|
2732
|
+
searchType: SearchType.ON_CLICK,
|
|
2733
|
+
validation: [
|
|
2734
|
+
Validators.required,
|
|
2735
|
+
Validators.pattern(GroupsValidationPatterns.email),
|
|
2736
|
+
],
|
|
2737
|
+
supportMessage: this.addUserRosterTexts?.supportText?.emailAddress,
|
|
2738
|
+
requiredErrorMessage: this.addUserRosterTexts?.message?.error?.required,
|
|
2739
|
+
patternErrorMessage: this.addUserRosterTexts?.message?.error?.pattern?.email,
|
|
2740
|
+
ariaLabel: this.addUserRosterTexts?.label?.ariaLabel?.email,
|
|
2741
|
+
ariaDescribedById: this.addUserRosterTexts?.label?.ariaDescribedById?.email,
|
|
2742
|
+
},
|
|
2743
|
+
...(this.isUserExist
|
|
2744
|
+
? [
|
|
2745
|
+
{
|
|
2746
|
+
type: FormControlType.TEXT_AREA,
|
|
2747
|
+
label: this.addUserRosterTexts?.label?.fullName + '*',
|
|
2748
|
+
controlName: 'fullName',
|
|
2749
|
+
value: this.userInfo?.name,
|
|
2750
|
+
validation: [Validators.required],
|
|
2751
|
+
requiredErrorMessage: this.addUserRosterTexts?.message?.error?.required,
|
|
2752
|
+
isReadonly: true,
|
|
2753
|
+
ariaMultiline: false,
|
|
2754
|
+
ariaLabel: this.addUserRosterTexts?.label?.ariaLabel?.fullName,
|
|
2755
|
+
ariaDescribedById: this.addUserRosterTexts?.label?.ariaDescribedById
|
|
2756
|
+
?.fullName,
|
|
2757
|
+
},
|
|
2758
|
+
]
|
|
2759
|
+
: [
|
|
2760
|
+
{
|
|
2761
|
+
type: FormControlType.INPUT,
|
|
2762
|
+
label: this.addUserRosterTexts?.label?.firstName + '*',
|
|
2763
|
+
controlName: 'firstName',
|
|
2764
|
+
validation: [
|
|
2765
|
+
Validators.required,
|
|
2766
|
+
Validators.pattern(GroupsValidationPatterns.firstOrLastName),
|
|
2767
|
+
],
|
|
2768
|
+
requiredErrorMessage: this.addUserRosterTexts?.message?.error?.required,
|
|
2769
|
+
patternErrorMessage: this.addUserRosterTexts?.message?.error?.pattern
|
|
2770
|
+
?.firstOrLastName,
|
|
2771
|
+
ariaLabel: this.addUserRosterTexts?.label?.ariaLabel?.firstName,
|
|
2772
|
+
ariaDescribedById: this.addUserRosterTexts?.label?.ariaDescribedById
|
|
2773
|
+
?.firstName,
|
|
2774
|
+
supportMessage: this.addUserRosterTexts?.supportText?.firstName,
|
|
2775
|
+
},
|
|
2776
|
+
{
|
|
2777
|
+
type: FormControlType.INPUT,
|
|
2778
|
+
label: this.addUserRosterTexts?.label?.lastName + '*',
|
|
2779
|
+
controlName: 'lastName',
|
|
2780
|
+
validation: [
|
|
2781
|
+
Validators.required,
|
|
2782
|
+
Validators.pattern(GroupsValidationPatterns.firstOrLastName),
|
|
2783
|
+
],
|
|
2784
|
+
requiredErrorMessage: this.addUserRosterTexts?.message?.error?.required,
|
|
2785
|
+
patternErrorMessage: this.addUserRosterTexts?.message?.error?.pattern
|
|
2786
|
+
?.firstOrLastName,
|
|
2787
|
+
ariaLabel: this.addUserRosterTexts?.label?.ariaLabel?.lastName,
|
|
2788
|
+
ariaDescribedById: this.addUserRosterTexts?.label?.ariaDescribedById
|
|
2789
|
+
?.lastName,
|
|
2790
|
+
supportMessage: this.addUserRosterTexts?.supportText?.lastName,
|
|
2791
|
+
},
|
|
2792
|
+
]),
|
|
2793
|
+
{
|
|
2794
|
+
type: FormControlType.CHECKBOX,
|
|
2795
|
+
label: this.groupRosterType === GroupRosterType.INDIVIDUAL
|
|
2796
|
+
? this.addUserRosterTexts?.label?.role
|
|
2797
|
+
: this.addUserRosterTexts?.label?.role + '*',
|
|
2798
|
+
controlName: 'roles',
|
|
2799
|
+
checkboxOptions: this.userRoles,
|
|
2800
|
+
minSelectionRequired: 1,
|
|
2801
|
+
ariaLabel: this.addUserRosterTexts?.label?.ariaLabel?.role,
|
|
2802
|
+
ariaDescribedById: this.addUserRosterTexts?.label?.ariaDescribedById?.role,
|
|
2803
|
+
supportMessage: this.groupRosterType === GroupRosterType.INDIVIDUAL
|
|
2804
|
+
? this.addUserRosterTexts?.supportText
|
|
2805
|
+
?.roleForIndividualRoster
|
|
2806
|
+
: this.addUserRosterTexts?.supportText?.role,
|
|
2807
|
+
requiredErrorMessage: this.addUserRosterTexts?.message?.error?.required,
|
|
2808
|
+
validation: this.groupRosterType === GroupRosterType.INDIVIDUAL
|
|
2809
|
+
? []
|
|
2810
|
+
: [Validators.required],
|
|
2811
|
+
},
|
|
2812
|
+
],
|
|
2813
|
+
},
|
|
2814
|
+
],
|
|
2815
|
+
};
|
|
2816
|
+
}
|
|
2730
2817
|
/**
|
|
2731
2818
|
* Adds classification, Member Type and Representing Organization form controls while adding new user to an individual group roster.
|
|
2819
|
+
* @param {{
|
|
2820
|
+
* classification: SelectOption;
|
|
2821
|
+
* memberType: SelectOption;
|
|
2822
|
+
* representingOrg: SelectOption;
|
|
2823
|
+
* }} [addUserFormGroupPrevValues]
|
|
2732
2824
|
* @memberof AddUserRosterComponent
|
|
2733
2825
|
*/
|
|
2734
|
-
updateAddUserFormGroup() {
|
|
2826
|
+
updateAddUserFormGroup(addUserFormGroupPrevValues) {
|
|
2735
2827
|
if (this.hasClassification)
|
|
2736
2828
|
this.updateAddUserFormControls(this.addUserFormGroup.formGroup[0].controls.length - 1, {
|
|
2737
2829
|
type: FormControlType.SELECT,
|
|
2738
2830
|
label: this.addUserRosterTexts?.label?.classification + '*',
|
|
2739
2831
|
controlName: 'classification',
|
|
2740
2832
|
dropdownOptions: this.classifications,
|
|
2833
|
+
value: this.classifications?.find((classification) => classification.id ===
|
|
2834
|
+
addUserFormGroupPrevValues?.classification?.id),
|
|
2741
2835
|
validation: [Validators.required],
|
|
2742
2836
|
placeholder: '',
|
|
2743
2837
|
supportMessage: this.addUserRosterTexts?.supportText?.classification,
|
|
@@ -2750,6 +2844,7 @@ class AddUserRosterComponent {
|
|
|
2750
2844
|
label: this.addUserRosterTexts?.label?.memberType + '*',
|
|
2751
2845
|
controlName: 'memberType',
|
|
2752
2846
|
dropdownOptions: this.memberTypes,
|
|
2847
|
+
value: this.memberTypes?.find((memberType) => memberType.id === addUserFormGroupPrevValues?.memberType?.id),
|
|
2753
2848
|
validation: [Validators.required],
|
|
2754
2849
|
placeholder: '',
|
|
2755
2850
|
supportMessage: this.addUserRosterTexts?.supportText?.memberType,
|
|
@@ -2761,6 +2856,7 @@ class AddUserRosterComponent {
|
|
|
2761
2856
|
type: FormControlType.AUTO_COMPLETE,
|
|
2762
2857
|
label: this.addUserRosterTexts?.label?.representingOrganization + '*',
|
|
2763
2858
|
controlName: 'representingOrg',
|
|
2859
|
+
value: addUserFormGroupPrevValues?.representingOrg,
|
|
2764
2860
|
validation: [
|
|
2765
2861
|
Validators.required,
|
|
2766
2862
|
Validators.maxLength(GroupsValidationPatterns.representingOrgNameMaxLength),
|
|
@@ -2965,12 +3061,7 @@ class AddUserRosterComponent {
|
|
|
2965
3061
|
if (Array.isArray(errorCodes) && !error?.error?.status) {
|
|
2966
3062
|
if (errorCodes[0] !== '3004') {
|
|
2967
3063
|
const errorMessage = this.groupService.parseErrorMessage(errorCodes);
|
|
2968
|
-
this.
|
|
2969
|
-
status: 'custom',
|
|
2970
|
-
message: errorMessage,
|
|
2971
|
-
alertType: AlertType.ERROR,
|
|
2972
|
-
isCloseNeeded: true,
|
|
2973
|
-
});
|
|
3064
|
+
this.showAlertMessage(errorMessage, AlertType.ERROR);
|
|
2974
3065
|
}
|
|
2975
3066
|
}
|
|
2976
3067
|
else if (error && error instanceof HttpErrorResponse) {
|
|
@@ -2999,8 +3090,9 @@ class AddUserRosterComponent {
|
|
|
2999
3090
|
if (this.groupRosterType === GroupRosterType.INDIVIDUAL) {
|
|
3000
3091
|
payload = {
|
|
3001
3092
|
payload: {
|
|
3002
|
-
email: this.
|
|
3003
|
-
|
|
3093
|
+
email: this.isUserExist
|
|
3094
|
+
? this.userInfo?.email
|
|
3095
|
+
: formData?.emailSearch,
|
|
3004
3096
|
roles: this.selectedUserRoles,
|
|
3005
3097
|
groupId: this.groupService.selectedGroupInfo?.groupId,
|
|
3006
3098
|
memberStatus: {
|
|
@@ -3024,12 +3116,20 @@ class AddUserRosterComponent {
|
|
|
3024
3116
|
else
|
|
3025
3117
|
payload = {
|
|
3026
3118
|
payload: {
|
|
3027
|
-
email: this.
|
|
3119
|
+
email: this.isUserExist
|
|
3120
|
+
? this.userInfo?.email
|
|
3121
|
+
: formData?.emailSearch,
|
|
3028
3122
|
roles: this.selectedUserRoles,
|
|
3029
|
-
userId: this.userInfo?.userId,
|
|
3030
3123
|
groupId: this.groupService.selectedGroupInfo?.groupId,
|
|
3031
3124
|
},
|
|
3032
3125
|
};
|
|
3126
|
+
if (this.isUserExist) {
|
|
3127
|
+
payload.payload.userId = this.userInfo?.userId;
|
|
3128
|
+
}
|
|
3129
|
+
else {
|
|
3130
|
+
payload.payload.firstName = formData?.firstName?.trim();
|
|
3131
|
+
payload.payload.lastName = formData?.lastName?.trim();
|
|
3132
|
+
}
|
|
3033
3133
|
return payload;
|
|
3034
3134
|
}
|
|
3035
3135
|
/**
|
|
@@ -3040,6 +3140,21 @@ class AddUserRosterComponent {
|
|
|
3040
3140
|
this.updateFormControlOptions('representingOrg', 'autoCompleteOptions', []);
|
|
3041
3141
|
this.isSubmitButtonDisabled = true;
|
|
3042
3142
|
}
|
|
3143
|
+
/**
|
|
3144
|
+
* Handles alerts for error, warning.
|
|
3145
|
+
* @param {(string | string[])} message -error or warning message
|
|
3146
|
+
* @param {AlertType} alertType
|
|
3147
|
+
* @return -returns nothing
|
|
3148
|
+
* @memberof AddUserRosterComponent
|
|
3149
|
+
*/
|
|
3150
|
+
showAlertMessage(message, alertType) {
|
|
3151
|
+
this.alertService?.showMessage({
|
|
3152
|
+
status: 'custom',
|
|
3153
|
+
message: message,
|
|
3154
|
+
alertType: alertType,
|
|
3155
|
+
isCloseNeeded: true,
|
|
3156
|
+
});
|
|
3157
|
+
}
|
|
3043
3158
|
/**
|
|
3044
3159
|
* NgOnDestroy performs necessary cleanup tasks, such as unsubscribing from subscription when the component is being destroyed.
|
|
3045
3160
|
* @memberof AddUserRosterComponent
|