diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/organization.component.html b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/organization.component.html index 6c753ed0..0b8a1051 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/organization.component.html +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/organization.component.html @@ -59,9 +59,10 @@ user.seq === userInfo.seq).length > 0 + ) { + return false; + } + + return true; + } /** 리스트 checkable 할 경우 checkbox 의 isChecked 를 관장하며 리스트의 전체선택 여부를 판단한다. */ getCheckedUser(userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN) { if (!!this.selectedUserList && this.selectedUserList.length > 0) { diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/chat/create-chat.dialog.component.html b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/chat/create-chat.dialog.component.html index bbe569a9..676860a9 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/chat/create-chat.dialog.component.html +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/chat/create-chat.dialog.component.html @@ -73,6 +73,7 @@ #groupExpansionPanel [groupBuddyList]="groupBuddyList$ | async" [selectedUserList]="selectedUserList" + [ignoreUserList]="data.curRoomUser" [checkable]="true" (checkGroup)="onCheckGroup($event)" class="group-expansion" @@ -84,6 +85,7 @@ [selectedUserList]="selectedUserList" [isChecked]="getCheckedUser(userInfo)" [checkable]="true" + [checkDisabled]="!getCheckableUser(userInfo)" (checkUser)="onCheckUser($event)" (click)="onToggleUser(userInfo)" class="list-item-frame" @@ -117,6 +119,7 @@ [selectedUserList]="selectedUserList" [isChecked]="getCheckedUser(userInfo)" [checkable]="true" + [checkDisabled]="!getCheckableUser(userInfo)" (checkUser)="onCheckUser($event)" (click)="onToggleUser(userInfo)" > @@ -134,6 +137,7 @@ { - if ( - this.selectedUserList.filter(user => user.seq === item.seq).length === - 0 - ) { - this.selectedUserList = [...this.selectedUserList, item]; - } - }); + if (this.data.type === UserSelectDialogType.EditChatMember) { + params.groupBuddyList.buddyList.forEach(item => { + if ( + this.selectedUserList.filter(user => user.seq === item.seq) + .length === 0 && + this.data.curRoomUser.filter(curUser => curUser.seq === item.seq) + .length === 0 + ) { + this.selectedUserList = [...this.selectedUserList, item]; + } + }); + } else { + params.groupBuddyList.buddyList.forEach(item => { + if ( + this.selectedUserList.filter(user => user.seq === item.seq) + .length === 0 + ) { + this.selectedUserList = [...this.selectedUserList, item]; + } + }); + } } else { - this.selectedUserList = this.selectedUserList.filter( - item => - params.groupBuddyList.buddyList.filter(del => del.seq === item.seq) - .length === 0 - ); + if (this.data.type === UserSelectDialogType.EditChatMember) { + this.selectedUserList = this.selectedUserList.filter( + item => + params.groupBuddyList.buddyList + .filter( + del => + this.data.curRoomUser.filter( + curUser => curUser.seq === del.seq + ).length === 0 + ) + .filter(del => del.seq === item.seq).length === 0 + ); + } else { + this.selectedUserList = this.selectedUserList.filter( + item => + params.groupBuddyList.buddyList.filter(del => del.seq === item.seq) + .length === 0 + ); + } } this.changeDetectorRef.detectChanges(); } @@ -390,20 +417,51 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy { isChecked: boolean; userInfos: (UserInfo | UserInfoSS | UserInfoF | UserInfoDN)[]; }) { - params.userInfos.forEach(userInfo => { - if (params.isChecked) { - if ( - this.selectedUserList.filter(user => user.seq === userInfo.seq) - .length === 0 - ) { - this.selectedUserList = [...this.selectedUserList, userInfo]; - } + // params.userInfos.forEach(userInfo => { + if (params.isChecked) { + if (this.data.type === UserSelectDialogType.EditChatMember) { + params.userInfos.forEach(item => { + if ( + this.selectedUserList.filter(user => user.seq === item.seq) + .length === 0 && + this.data.curRoomUser.filter(curUser => curUser.seq === item.seq) + .length === 0 + ) { + this.selectedUserList = [...this.selectedUserList, item]; + } + }); + } else { + params.userInfos.forEach(item => { + if ( + this.selectedUserList.filter(user => user.seq === item.seq) + .length === 0 + ) { + this.selectedUserList = [...this.selectedUserList, item]; + } + }); + } + } else { + if (this.data.type === UserSelectDialogType.EditChatMember) { + this.selectedUserList = this.selectedUserList.filter( + item => + params.userInfos + .filter( + del => + this.data.curRoomUser.filter( + curUser => curUser.seq === del.seq + ).length === 0 + ) + .filter(del => del.seq === item.seq).length === 0 + ); } else { this.selectedUserList = this.selectedUserList.filter( - user => user.seq !== userInfo.seq + item => + params.userInfos.filter(userInfo => userInfo.seq === item.seq) + .length === 0 ); } - }); + } + // }); } /** 동료그룹>부서원, 조직도>부서원 :: 리스트의 checkbox 의 이벤트를 받아 선택된 유저리스트를 수집. */ @@ -412,6 +470,15 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy { userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN; }) { if (params.isChecked) { + if (this.data.type === UserSelectDialogType.EditChatMember) { + if ( + this.data.curRoomUser.filter(user => user.seq === params.userInfo.seq) + .length > 0 + ) { + return; + } + } + if ( this.selectedUserList.filter(user => user.seq === params.userInfo.seq) .length === 0 && @@ -420,6 +487,15 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy { this.selectedUserList = [...this.selectedUserList, params.userInfo]; } } else { + if (this.data.type === UserSelectDialogType.EditChatMember) { + if ( + this.data.curRoomUser.filter(user => user.seq === params.userInfo.seq) + .length > 0 + ) { + return; + } + } + this.selectedUserList = this.selectedUserList.filter( item => item.seq !== params.userInfo.seq ); @@ -427,6 +503,15 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy { this.changeDetectorRef.detectChanges(); } onToggleUser(userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN) { + if (this.data.type === UserSelectDialogType.EditChatMember) { + if ( + this.data.curRoomUser.filter(user => user.seq === userInfo.seq).length > + 0 + ) { + return; + } + } + if ( this.selectedUserList.filter(user => user.seq === userInfo.seq).length === 0 @@ -459,6 +544,20 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy { } } + /** 그룹>부서원의 체크 가능여부 판단. */ + getCheckableUser(userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN) { + if (this.data.type === UserSelectDialogType.EditChatMember) { + if ( + this.data.curRoomUser.filter(user => user.seq === userInfo.seq).length > + 0 + ) { + return false; + } + } + + return true; + } + /** 그룹>부서원 리스트의 ischecked 를 판단. */ getCheckedUser(userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN) { if (!!this.selectedUserList && this.selectedUserList.length > 0) { 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 f08ca10c..346122ae 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 @@ -76,6 +76,7 @@ *ngIf="checkable" #checkbox [checked]="getCheckedGroup(node.groupDetail)" + [disabled]="!getCheckableGroup(node.groupDetail)" (change)="onChangeCheck(checkbox.checked, node.groupDetail)" (click)="$event.stopPropagation()" class="group-check" 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 77fe47a6..471f50fb 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 @@ -135,10 +135,12 @@ export class ExpansionPanelComponent @Input() checkable = false; - @Input() /** 선택된 사용자의 리스트 */ selectedUserList?: (UserInfo | UserInfoSS | UserInfoF | UserInfoDN)[] = []; + @Input() + /** 선택할 수 없는 사용자 리스트 */ + ignoreUserList?: (UserInfo | UserInfoSS | UserInfoF | UserInfoDN)[] = []; @Output() more = new EventEmitter<{ @@ -270,6 +272,24 @@ export class ExpansionPanelComponent } } + getCheckableGroup(group: GroupDetailData) { + if (!!this.ignoreUserList && this.ignoreUserList.length > 0) { + let allExist = true; + group.userSeqs.some(seq => { + if (this.ignoreUserList.filter(item => item.seq === seq).length === 0) { + allExist = false; + return true; + } + }); + + if (allExist) { + return false; + } + } + + return true; + } + /** 그룹리스트가 checkable 할 경우 checkbox 의 isChecked 를 관장하며, 하위 부서원들의 전체선택여부를 판단한다. */ getCheckedGroup(group: GroupDetailData) { if (!group || group === undefined) { diff --git a/projects/ucap-webmessenger-ui-profile/src/lib/components/user-list-item.component.html b/projects/ucap-webmessenger-ui-profile/src/lib/components/user-list-item.component.html index d68dcd83..b27cc911 100644 --- a/projects/ucap-webmessenger-ui-profile/src/lib/components/user-list-item.component.html +++ b/projects/ucap-webmessenger-ui-profile/src/lib/components/user-list-item.component.html @@ -36,6 +36,7 @@ *ngIf="checkable" #checkbox [checked]="isChecked" + [disabled]="checkDisabled" (change)="onChangeCheck(checkbox.checked, userInfo)" (click)="$event.stopPropagation()" > diff --git a/projects/ucap-webmessenger-ui-profile/src/lib/components/user-list-item.component.ts b/projects/ucap-webmessenger-ui-profile/src/lib/components/user-list-item.component.ts index 1b56f947..28d5212d 100644 --- a/projects/ucap-webmessenger-ui-profile/src/lib/components/user-list-item.component.ts +++ b/projects/ucap-webmessenger-ui-profile/src/lib/components/user-list-item.component.ts @@ -35,6 +35,8 @@ export class UserListItemComponent implements OnInit { @Input() checkable = false; @Input() + checkDisabled = false; + @Input() isChecked = false; @Input() compactable = false;