From d29ca388bf330cc755db0af22f9b1a85c2542e03 Mon Sep 17 00:00:00 2001 From: leejh Date: Thu, 17 Oct 2019 15:07:39 +0900 Subject: [PATCH] =?UTF-8?q?=EC=88=98=EC=A0=95=20::=20=EC=83=88=EB=A1=9C?= =?UTF-8?q?=EC=9A=B4=20=EB=8C=80=ED=99=94=20=EA=B0=9C=EC=84=A4=EC=9A=A9=20?= =?UTF-8?q?=EC=9C=A0=EC=A0=80=20=EC=84=A0=ED=83=9D=20=ED=8C=9D=EC=97=85=20?= =?UTF-8?q?>=20=EC=9C=A0=EC=A0=80=EC=84=A0=ED=83=9D=20=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chat/create-chat.dialog.component.ts | 30 +++++++++++++++++-- .../components/expansion-panel.component.html | 2 +- .../components/expansion-panel.component.ts | 9 ++++-- 3 files changed, 34 insertions(+), 7 deletions(-) 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 }); } }