@ieeesa-npm/tenants 0.4.2 → 0.4.3

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.
Files changed (25) hide show
  1. package/esm2022/lib/assets/constants.json +64 -0
  2. package/esm2022/lib/assets/tenant-validations.mjs +5 -1
  3. package/esm2022/lib/components/create-modify-group-type/create-modify-group-type.component.mjs +477 -0
  4. package/esm2022/lib/components/view-tenant-details/view-tenant-details.component.mjs +27 -3
  5. package/esm2022/lib/components/view-tenant-group-types/view-tenant-group-types.component.mjs +39 -19
  6. package/esm2022/lib/models/create-group-type-config.model.mjs +22 -0
  7. package/esm2022/lib/models/create-group-type.model.mjs +2 -0
  8. package/esm2022/lib/models/tenant-function-type.model.mjs +3 -1
  9. package/esm2022/lib/models/view-tenant-group-types.model.mjs +3 -1
  10. package/esm2022/lib/services/tenant-applications.service.mjs +78 -2
  11. package/esm2022/public-api.mjs +4 -1
  12. package/fesm2022/ieeesa-npm-tenants.mjs +701 -25
  13. package/fesm2022/ieeesa-npm-tenants.mjs.map +1 -1
  14. package/lib/assets/tenant-validations.d.ts +4 -0
  15. package/lib/components/create-modify-group-type/create-modify-group-type.component.d.ts +129 -0
  16. package/lib/components/tenant-basic-details/tenant-basic-details.component.d.ts +64 -0
  17. package/lib/components/view-tenant-details/view-tenant-details.component.d.ts +7 -0
  18. package/lib/components/view-tenant-group-types/view-tenant-group-types.component.d.ts +5 -0
  19. package/lib/models/create-group-type-config.model.d.ts +16 -0
  20. package/lib/models/create-group-type.model.d.ts +49 -0
  21. package/lib/models/tenant-function-type.model.d.ts +3 -1
  22. package/lib/models/view-tenant-group-types.model.d.ts +3 -1
  23. package/lib/services/tenant-applications.service.d.ts +48 -7
  24. package/package.json +1 -1
  25. package/public-api.d.ts +3 -0
@@ -9,3 +9,7 @@ export declare const TenantsValidationPatterns: {
9
9
  export declare const RolesValidation: {
10
10
  roleNameMaxLength: number;
11
11
  };
12
+ export declare const GroupTypeValidation: {
13
+ groupTypeMaxLength: number;
14
+ descriptionMaxLength: number;
15
+ };
@@ -0,0 +1,129 @@
1
+ import { ComponentRef, ElementRef, EventEmitter, OnDestroy, OnInit, Renderer2, ViewContainerRef } from '@angular/core';
2
+ import { FormGroup } from '@angular/forms';
3
+ import { Subject } from 'rxjs';
4
+ import { SharedService, FormUtilityService } from '@ieeesa-npm/shared';
5
+ import { AlignType, CheckboxOption, FieldConfig, FormGrid, FormModel, RadioOption, DynamicFormComponent } from '@ieeesa-npm/presentation';
6
+ import { TenantApplicationsService } from '../../services/tenant-applications.service';
7
+ import { TenantFunctionType } from '../../models/tenant-function-type.model';
8
+ import { ViewGroupTypeResponse } from '../../models/view-tenant-group-types.model';
9
+ import { CreatedOrModifiedGroupTypeInfo } from '../../models/create-group-type.model';
10
+ import * as i0 from "@angular/core";
11
+ /**
12
+ * CreateModifyGroupTypeComponent uses DynamicFormComponent to build create add group type form or edit group type form and implement the functionalities of submission of form and handling success and error scenarios.
13
+ * @class CreateModifyGroupTypeComponent
14
+ * @implements {OnInit}
15
+ * @implements {OnDestroy}
16
+ */
17
+ export declare class CreateModifyGroupTypeComponent implements OnInit, OnDestroy {
18
+ private tenantAppService;
19
+ private sharedService;
20
+ private renderer;
21
+ private elementRef;
22
+ private formUtilityService;
23
+ destroy$: Subject<boolean>;
24
+ constants: any;
25
+ createGroupTypeScreenTexts: any;
26
+ leftButtonLabel: any;
27
+ rightButtonLabel: any;
28
+ colWidth: FormGrid;
29
+ createGroupTypeFormGroup: FormModel;
30
+ createModifyGroupTypeFormGroupRef: FormGroup;
31
+ actionButtonAlign: AlignType;
32
+ tenantFunctionType: TenantFunctionType;
33
+ isRootGroupOptions: {
34
+ id: number;
35
+ label: any;
36
+ checked: boolean;
37
+ }[];
38
+ rosterTypeOptions: RadioOption[];
39
+ settingOptions: CheckboxOption[];
40
+ officerRolesOptions: CheckboxOption[];
41
+ memberLevelOptions: CheckboxOption[];
42
+ allowedSubGroupTypesOptions: CheckboxOption[];
43
+ allowedSubGroupTypesFieldConfig: FieldConfig;
44
+ appId: string;
45
+ groupTypeDetails: ViewGroupTypeResponse;
46
+ selectedGroupTypeInfo: CreatedOrModifiedGroupTypeInfo;
47
+ dynamicFormComponent: DynamicFormComponent;
48
+ dynamicFormComponentViewRef: ViewContainerRef;
49
+ componentRef: ComponentRef<any>;
50
+ /**
51
+ * Event emitter for form submission response.
52
+ * @memberof CreateModifyGroupTypeComponent
53
+ */
54
+ submitFormResponse: EventEmitter<any>;
55
+ /**
56
+ * Event emitter for form cancel action.
57
+ * @memberof CreateModifyGroupTypeComponent
58
+ */
59
+ formCancel: EventEmitter<any>;
60
+ constructor(tenantAppService: TenantApplicationsService, sharedService: SharedService, renderer: Renderer2, elementRef: ElementRef, formUtilityService: FormUtilityService);
61
+ /**
62
+ * Sets appId, tenantFunctionType and calls getGroupTypes() & getRosterTypes() to get group and roster types.
63
+ * @memberof CreateModifyGroupTypeComponent
64
+ */
65
+ ngOnInit(): void;
66
+ /**
67
+ * Gets the list of roster types and updates the form control.
68
+ * @memberof CreateModifyGroupTypeComponent
69
+ */
70
+ getRosterTypes(): void;
71
+ /**
72
+ * Gets the list of settings and updates the form control.
73
+ * @memberof CreateModifyGroupTypeComponent
74
+ */
75
+ getSettings(): void;
76
+ /**
77
+ * Gets the list of roles and updates the form control.
78
+ * @memberof CreateModifyGroupTypeComponent
79
+ */
80
+ getRoles(): void;
81
+ /**
82
+ * Gets and filters non SYSTEM_USER group types, constructs allowed sub-group types options and form field config.
83
+ * @memberof CreateModifyGroupTypeComponent
84
+ */
85
+ getGroupTypes(): void;
86
+ /**
87
+ * Initialize the create/edit group type form group array.
88
+ * @param {*} [formValue]
89
+ * @memberof CreateModifyGroupTypeComponent
90
+ */
91
+ initializeCreateGroupTypeFormGroup(): void;
92
+ /**
93
+ * Add or removes allowed sub groups form control (checkbox group control and options) as when allow sub group selection and updates the form state.
94
+ * @param {*} selectedCheckbox
95
+ * @memberof CreateModifyGroupTypeComponent
96
+ */
97
+ onCheckboxSelectionChange(selectedCheckbox: CheckboxOption): void;
98
+ /**
99
+ * Sets create/modify group type reactive form group reference.
100
+ * @param {FormGroup[]} form -The form group array containing the form to be referenced.
101
+ * @memberof CreateModifyGroupTypeComponent
102
+ */
103
+ getCreateModifyGroupTypeFormGroupRef(form: FormGroup[]): void;
104
+ /**
105
+ * Find the provided setting name in setting option and return the boolean value.
106
+ * @param {string} settingName
107
+ * @return {*} {boolean}
108
+ * @memberof CreateModifyGroupTypeComponent
109
+ */
110
+ isSettingSelectedByName(settingName: string): boolean;
111
+ /**
112
+ * Creates a new group type on form submission and the form is valid.
113
+ * @param {FormGroup[]} form
114
+ * @memberof CreateModifyGroupTypeComponent
115
+ */
116
+ onCreateModifyGroupTypeFormSubmit(form: FormGroup[]): void;
117
+ /**
118
+ * Emits form cancel event.
119
+ * @memberof CreateModifyGroupTypeComponent
120
+ */
121
+ onFormCancel(): void;
122
+ /**
123
+ * Implementation of ngOnDestroy lifecycle hook method to unsubscribe the open observable subscriptions.
124
+ * @memberof CreateModifyGroupTypeComponent
125
+ */
126
+ ngOnDestroy(): void;
127
+ static ɵfac: i0.ɵɵFactoryDeclaration<CreateModifyGroupTypeComponent, never>;
128
+ static ɵcmp: i0.ɵɵComponentDeclaration<CreateModifyGroupTypeComponent, "ieeesa-create-modify-group-type", never, {}, { "submitFormResponse": "submitFormResponse"; "formCancel": "formCancel"; }, never, never, true, never>;
129
+ }
@@ -367,6 +367,70 @@ export declare class TenantBasicDetailsComponent implements OnDestroy {
367
367
  viewTenants: string;
368
368
  viewTenantDetails: string;
369
369
  };
370
+ createGroupType: {
371
+ heading: string;
372
+ label: {
373
+ leftButtonLabel: string;
374
+ rightButtonLabel: string;
375
+ groupType: string;
376
+ description: string;
377
+ settings: string;
378
+ rosterType: string;
379
+ appMemberLevel: string;
380
+ appOfficerRoles: string;
381
+ isRootGroup: string;
382
+ allowedSubGroupTypes: string;
383
+ ariaLabel: {
384
+ groupType: string;
385
+ description: string;
386
+ settings: string;
387
+ rosterType: string;
388
+ appMemberLevel: string;
389
+ appOfficerRoles: string;
390
+ isRootGroup: string;
391
+ allowedSubGroupTypes: string;
392
+ };
393
+ ariaDescribedById: {
394
+ groupType: string;
395
+ description: string;
396
+ settings: string;
397
+ rosterType: string;
398
+ appMemberLevel: string;
399
+ appOfficerRoles: string;
400
+ isRootGroup: string;
401
+ allowedSubGroupTypes: string;
402
+ };
403
+ };
404
+ message: {
405
+ success: {
406
+ submissionPart1: string;
407
+ submissionPart2: string;
408
+ };
409
+ error: {
410
+ required: string;
411
+ limit: {
412
+ groupTypeMaxChars: string;
413
+ descriptionMaxChars: string;
414
+ };
415
+ };
416
+ };
417
+ supportText: {
418
+ groupType: string;
419
+ description: string;
420
+ };
421
+ isRootGroupOptions: {
422
+ yes: string;
423
+ no: string;
424
+ };
425
+ errors: {
426
+ "2066": string;
427
+ "2067": string;
428
+ "3007": string;
429
+ "3017": string;
430
+ "3018": string;
431
+ "3019": string;
432
+ };
433
+ };
370
434
  };
371
435
  basicDetailTexts: {
372
436
  title: string;
@@ -58,6 +58,7 @@ export declare class ViewTenantDetailsComponent implements OnInit, OnDestroy {
58
58
  accordionDetails: typeof AccordionDetails;
59
59
  appTypeOptions: RadioOption[];
60
60
  isBasicDetailsExpanded: boolean;
61
+ createGroupTypeScreenTexts: any;
61
62
  editTenantScreenTexts: any;
62
63
  deleteRoleScreenTexts: any;
63
64
  mapRolesAndPermissionsScreenTexts: any;
@@ -128,6 +129,12 @@ export declare class ViewTenantDetailsComponent implements OnInit, OnDestroy {
128
129
  * @memberof ViewTenantDetailsComponent
129
130
  */
130
131
  openCreateRoleForm(): void;
132
+ /**
133
+ * Sets the dialog options for create group type modal and calls openModal method.
134
+ * @return -returns nothing
135
+ * @memberof ViewTenantDetailsComponent
136
+ */
137
+ openCreateGroupTypeForm(): void;
131
138
  /**
132
139
  * Sets the dialog options for edit role modal and calls openModal method.
133
140
  * @return -returns nothing
@@ -29,6 +29,11 @@ export declare class ViewTenantGroupTypesComponent implements OnInit, OnDestroy
29
29
  * @memberof ViewTenantGroupTypesComponent
30
30
  */
31
31
  ngOnInit(): void;
32
+ /**
33
+ * Get group types from tenant application service.
34
+ * @memberof ViewTenantGroupTypesComponent
35
+ */
36
+ getGroupTypes(): void;
32
37
  /**
33
38
  * Formats raw group types data into a required format for display.
34
39
  * @param {ViewGroupTypeResponse} groupTypeRes
@@ -0,0 +1,16 @@
1
+ export declare enum Settings {
2
+ ALLOW_SUB_GROUPS = "Allow Sub-Groups",
3
+ ALLOW_ROSTERS = "Rosters Enabled",
4
+ ALLOW_ALTERNATE_VOTING = "Allow Alternate Voting",
5
+ HAS_CLASSIFICATION = "Has Classification",
6
+ ALLOW_EDIT = "Allow Edit",
7
+ ALLOW_DELETE = "Allow Delete"
8
+ }
9
+ export declare enum VotingMemberLevelRole {
10
+ VOTING_MEMBER_PRINCIPAL = "Voting Member (Principal)",
11
+ VOTING_MEMBER_ALTERNATE = "Voting Member (Alternate)"
12
+ }
13
+ export declare enum RosterTypeLOVCode {
14
+ INDIVIDUAL = "IND",
15
+ ENTITY = "EN"
16
+ }
@@ -0,0 +1,49 @@
1
+ import { LOV } from '@ieeesa-npm/shared';
2
+ export interface GetRosterTypeOrSettingsResponse {
3
+ status: boolean;
4
+ message: string;
5
+ body?: LOV[] | null | {
6
+ errorCodes: string[];
7
+ };
8
+ }
9
+ export interface ConfigFieldValue {
10
+ name: string;
11
+ description: string;
12
+ businessRule: {
13
+ rosterType: string;
14
+ allowEdit: boolean;
15
+ allowRoster: boolean;
16
+ allowSubGroup: boolean;
17
+ allowAlternateVoting: boolean;
18
+ allowDelete: boolean;
19
+ hasClassification: boolean;
20
+ allowedGroupType: string[];
21
+ isRootGroup: boolean;
22
+ };
23
+ hierarchy?: number;
24
+ }
25
+ export interface CreatedOrModifiedGroupTypeInfo {
26
+ appId: string;
27
+ roles: {
28
+ roleId: string;
29
+ }[];
30
+ configFieldName: string;
31
+ configFieldValue: ConfigFieldValue;
32
+ }
33
+ export interface CreateGroupTypeRequestPayload {
34
+ payload: {
35
+ appId: string;
36
+ roles: {
37
+ roleId: string;
38
+ }[];
39
+ configFieldName: string;
40
+ configFieldValue: string;
41
+ };
42
+ }
43
+ export interface CreateGroupTypeResponse {
44
+ status: boolean;
45
+ message: string;
46
+ body?: string | null | {
47
+ errorCodes: string[];
48
+ };
49
+ }
@@ -3,5 +3,7 @@ export declare enum TenantFunctionType {
3
3
  EDIT = "EDIT",
4
4
  CREATE_ROLE = "CREATE_ROLE",
5
5
  EDIT_ROLE = "EDIT_ROLE",
6
- MAP_PERMISSION_AND_ROLE = "MAP_PERMISSION_AND_ROLE"
6
+ MAP_PERMISSION_AND_ROLE = "MAP_PERMISSION_AND_ROLE",
7
+ CREATE_GROUP_TYPE = "CREATE_GROUP_TYPE",
8
+ EDIT_GROUP_TYPE = "EDIT_GROUP_TYPE"
7
9
  }
@@ -23,5 +23,7 @@ export declare enum GroupTypeSettings {
23
23
  ALLOW_SUB_GROUP = "allowSubGroup",
24
24
  ALLOW_ROSTER = "allowRoster",
25
25
  ALLOW_ALTERNATE_VOTING = "allowAlternateVoting",
26
- HAS_CLASSIFICATION = "hasClassification"
26
+ HAS_CLASSIFICATION = "hasClassification",
27
+ ALLOW_EDIT = "allowEdit",
28
+ ALLOW_DELETE = "allowDelete"
27
29
  }
@@ -1,5 +1,5 @@
1
1
  import { HttpService } from '@ieeesa-npm/utility';
2
- import { Observable } from 'rxjs';
2
+ import { Observable, Subject } from 'rxjs';
3
3
  import { GetTenantsPayload } from '../models/table-column-schema-view-tenant-list.model';
4
4
  import { TenantsPermissions, UserPermission } from '../models/tenants-permission.model';
5
5
  import { PermissionType } from '../models/permission-type.model';
@@ -14,6 +14,7 @@ import { GetRolesAndPermissionsPayload, GetRolesAndPermissionsResponse, GetRoles
14
14
  import { UpdateTenantStatusRequestPayload, UpdateTenantStatusResponse } from '../models/update-tenant-status.model';
15
15
  import { GetRoleTypesPayload, RoleTypeConfiguration, RoleTypeOption, RoleTypeResponse } from '../models/role-type.model';
16
16
  import { ViewGroupTypeResponse } from '../models/view-tenant-group-types.model';
17
+ import { CreateGroupTypeRequestPayload, CreateGroupTypeResponse, CreatedOrModifiedGroupTypeInfo, GetRosterTypeOrSettingsResponse } from '../models/create-group-type.model';
17
18
  import * as i0 from "@angular/core";
18
19
  export declare class TenantApplicationsService {
19
20
  private httpService;
@@ -34,12 +35,6 @@ export declare class TenantApplicationsService {
34
35
  selectedTenantInfo: TenantBasicInfo | undefined;
35
36
  userTenantsPermissions: TenantsPermissions[];
36
37
  createTenantsText: {
37
- /**
38
- * Gets tenant details from server using HttpService
39
- * @param {string} appId
40
- * @return {Observable<TenantDetailsResponse>}
41
- * @memberof TenantApplicationsService
42
- */
43
38
  "2003": string;
44
39
  "2026": string;
45
40
  "2028": string;
@@ -79,6 +74,9 @@ export declare class TenantApplicationsService {
79
74
  roleTypeOption: RoleTypeOption[];
80
75
  selectedRoleInfo: RoleDetails;
81
76
  roles: Role[];
77
+ groupTypes: ViewGroupTypeResponse;
78
+ newlyCreatedGroupType: CreatedOrModifiedGroupTypeInfo;
79
+ isGroupTypeAddedOrModified: Subject<boolean>;
82
80
  constructor(httpService: HttpService, tenantPermissionsService: TenantPermissionsService, tenantPermissionsMapService: TenantPermissionsMapService);
83
81
  setAppConfig(apiBaseUrl: string, userPermission: UserPermission[]): void;
84
82
  /**
@@ -310,6 +308,18 @@ export declare class TenantApplicationsService {
310
308
  * @return {RoleInfo} -create role information.
311
309
  */
312
310
  getNewlyCreatedRoleInfo(): RoleInfo;
311
+ /**
312
+ * Stores the newly created group type information.
313
+ * @param {CreatedOrModifiedGroupTypeInfo} newlyCreatedGroupType
314
+ * @memberof TenantApplicationsService
315
+ */
316
+ setNewlyCreatedGroupTypeInfo(newlyCreatedGroupType: CreatedOrModifiedGroupTypeInfo): void;
317
+ /**
318
+ * Returns the newly created group type information.
319
+ * @return {*} {CreatedOrModifiedGroupTypeInfo}
320
+ * @memberof TenantApplicationsService
321
+ */
322
+ getNewlyCreatedGroupTypeInfo(): CreatedOrModifiedGroupTypeInfo;
313
323
  /**
314
324
  * Posts the edited tenant application form data to server using HttpService for updating the tenant information.
315
325
  * @param {CreateTenantPayload} editTenantPayload
@@ -331,6 +341,25 @@ export declare class TenantApplicationsService {
331
341
  * @memberof TenantApplicationsService
332
342
  */
333
343
  getFeaturesList(features: CheckboxOption[]): Features[];
344
+ /**
345
+ * Gets roster type from server using HttpService.
346
+ * @return {*} {Observable<GetRosterTypeOrSettingsResponse>}
347
+ * @memberof TenantApplicationsService
348
+ */
349
+ getRosterType(): Observable<GetRosterTypeOrSettingsResponse>;
350
+ /**
351
+ * Gets group type settings from server using HttpService.
352
+ * @return {*} {Observable<GetRosterTypeOrSettingsResponse>}
353
+ * @memberof TenantApplicationsService
354
+ */
355
+ getGroupTypeSettings(): Observable<GetRosterTypeOrSettingsResponse>;
356
+ /**
357
+ * Posts the group type details to server using HttpService to create new group type.
358
+ * @param {CreateGroupTypeRequestPayload} createGroupTypePayload
359
+ * @return {*} {Observable<CreateGroupTypeResponse>}
360
+ * @memberof TenantApplicationsService
361
+ */
362
+ createGroupType(createGroupTypePayload: CreateGroupTypeRequestPayload): Observable<CreateGroupTypeResponse>;
334
363
  /**
335
364
  * Returns sorted role list data.
336
365
  * @param {Role[]} roleList
@@ -352,6 +381,18 @@ export declare class TenantApplicationsService {
352
381
  * @memberof TenantApplicationsService
353
382
  */
354
383
  getGroupTypes(appId: string): Observable<ViewGroupTypeResponse>;
384
+ /**
385
+ * Sets group type details.
386
+ * @param {ViewGroupTypeResponse} groupTypes
387
+ * @memberof TenantApplicationsService
388
+ */
389
+ setGroupTypeDetails(groupTypes: ViewGroupTypeResponse): void;
390
+ /**
391
+ * Returns group type details.
392
+ * @return {ViewGroupTypeResponse}
393
+ * @memberof TenantApplicationsService
394
+ */
395
+ getGroupTypeDetails(): ViewGroupTypeResponse;
355
396
  static ɵfac: i0.ɵɵFactoryDeclaration<TenantApplicationsService, never>;
356
397
  static ɵprov: i0.ɵɵInjectableDeclaration<TenantApplicationsService>;
357
398
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ieeesa-npm/tenants",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^16.1.0",
6
6
  "@angular/core": "^16.1.0"
package/public-api.d.ts CHANGED
@@ -6,6 +6,7 @@ export * from './lib/components/tenant-basic-details/tenant-basic-details.compon
6
6
  export * from './lib/components/create-modify-role/create-modify-role.component';
7
7
  export * from './lib/components/roles-and-permissions-mapping/roles-and-permissions-mapping.component';
8
8
  export * from './lib/components/view-tenant-group-types/view-tenant-group-types.component';
9
+ export * from './lib/components/create-modify-group-type/create-modify-group-type.component';
9
10
  export * from './lib/models/app-type-config.model';
10
11
  export * from './lib/models/app-type.model';
11
12
  export * from './lib/models/tenant.model';
@@ -22,6 +23,8 @@ export * from './lib/models/role-type.model';
22
23
  export * from './lib/models/role-menu-action.model';
23
24
  export * from './lib/models/roles-and-permissions-table-type.model';
24
25
  export * from './lib/models/view-tenant-group-types.model';
26
+ export * from './lib/models/create-group-type.model';
27
+ export * from './lib/models/create-group-type-config.model';
25
28
  export * from './lib/services/tenant-applications.service';
26
29
  export * from './lib/services/tenant-permissions-map.service';
27
30
  export * from './lib/services/tenant-permissions.service';