diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/chat/create-chat.dialog.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/chat/create-chat.dialog.component.ts index 93da2500..f6a36312 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/chat/create-chat.dialog.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/chat/create-chat.dialog.component.ts @@ -197,15 +197,39 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy { ); } - onCheckGroup(params: { isChecked: boolean; group: GroupDetailData }) { - this.logger.debug(params); + onCheckGroup(params: { + isChecked: boolean; + groupBuddyList: { group: GroupDetailData; buddyList: UserInfo[] }; + }) { + if (params.isChecked) { + params.groupBuddyList.buddyList.forEach(item => { + if ( + this.selectedUserList.filter(user => user.seq === item.seq).length === + 0 + ) { + this.selectedUserList.push(item); + } + }); + } else { + this.selectedUserList = this.selectedUserList.filter( + item => + params.groupBuddyList.buddyList.filter(del => del.seq === item.seq) + .length === 0 + ); + } } + onCheckUser(params: { isChecked: boolean; userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN; }) { if (params.isChecked) { - this.selectedUserList.push(params.userInfo); + if ( + this.selectedUserList.filter(user => user.seq === params.userInfo.seq) + .length === 0 + ) { + this.selectedUserList.push(params.userInfo); + } } else { this.selectedUserList = this.selectedUserList.filter( item => item.seq !== params.userInfo.seq diff --git a/projects/ucap-webmessenger-ui-group/src/lib/components/expansion-panel.component.html b/projects/ucap-webmessenger-ui-group/src/lib/components/expansion-panel.component.html index 061fd0ef..8ec6f550 100644 --- a/projects/ucap-webmessenger-ui-group/src/lib/components/expansion-panel.component.html +++ b/projects/ucap-webmessenger-ui-group/src/lib/components/expansion-panel.component.html @@ -28,7 +28,7 @@ (click)="onClickMore($event, groupBuddy.group)"> more_vert - diff --git a/projects/ucap-webmessenger-ui-group/src/lib/components/expansion-panel.component.ts b/projects/ucap-webmessenger-ui-group/src/lib/components/expansion-panel.component.ts index 8c021912..a4143cf4 100644 --- a/projects/ucap-webmessenger-ui-group/src/lib/components/expansion-panel.component.ts +++ b/projects/ucap-webmessenger-ui-group/src/lib/components/expansion-panel.component.ts @@ -40,7 +40,7 @@ export class ExpansionPanelComponent implements OnInit { @Output() checkGroup = new EventEmitter<{ isChecked: boolean; - group: GroupDetailData; + groupBuddyList: { group: GroupDetailData; buddyList: UserInfo[] }; }>(); @ContentChild(ExpansionPanelItemDirective, { @@ -67,10 +67,13 @@ export class ExpansionPanelComponent implements OnInit { this.more.emit({ event, group }); } - onChangeCheck(value: boolean, group: GroupDetailData) { + onChangeCheck( + value: boolean, + groupBuddyList: { group: GroupDetailData; buddyList: UserInfo[] } + ) { this.checkGroup.emit({ isChecked: value, - group + groupBuddyList }); } }