diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-side.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-side.component.ts index 97bdd7e5..7dca715b 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-side.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-side.component.ts @@ -10,6 +10,7 @@ import { Observable } from 'rxjs'; import { Store, select } from '@ngrx/store'; import * as AppStore from '@app/store'; +import * as ChatStore from '@app/store/messenger/chat'; @Component({ selector: 'app-layout-messenger-left-side', @@ -45,11 +46,14 @@ export class LeftSideComponent implements OnInit { } }); - this.logger.debug(result.choice); - // if (result.choice) { + if (!!result && !!result.choice && result.choice) { + this.logger.debug(result.selectedUserList); + if (!!result.selectedUserList && result.selectedUserList.length > 0) { + const userSeqs: number[] = []; + result.selectedUserList.map(user => userSeqs.push(user.seq)); - // } else { - - // } + this.store.dispatch(ChatStore.openRoom({ userSeqList: userSeqs })); + } + } } } 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 e1c70420..29245154 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 @@ -1,28 +1,19 @@ -
+
- +
(선택된부서명)
- +
-
+
(하단버튼영역)
diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/organization.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/organization.component.ts index 06cecc51..625e42c7 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/organization.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/organization.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit, Output, EventEmitter, Input } from '@angular/core'; import { ucapAnimations } from '@ucap-webmessenger/ui'; import { Observable } from 'rxjs'; import { @@ -6,8 +6,11 @@ import { QueryProtocolService, DeptSearchType, UserInfoSS, - DeptUserResponse + DeptUserResponse, + UserInfoF, + UserInfoDN } from '@ucap-webmessenger/protocol-query'; +import { UserInfo } from '@ucap-webmessenger/protocol-sync'; import { Store, select } from '@ngrx/store'; import { NGXLogger } from 'ngx-logger'; @@ -26,6 +29,19 @@ import { KEY_VER_INFO } from '@app/types/ver-info.type'; animations: ucapAnimations }) export class OrganizationComponent implements OnInit { + @Input() + /** 사용자 선택용으로 사용시 true 로 유입 */ + isUserSelect = false; + @Input() + /** 선택된 사용자의 리스트 */ + selectedUserList?: (UserInfo | UserInfoSS | UserInfoF | UserInfoDN)[] = []; + + @Output() + checkUser = new EventEmitter<{ + isChecked: boolean; + userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN; + }>(); + departmentInfoList$: Observable; selectedDepartmentUserInfoList$: Observable; selectedDepartmentStatus$: Observable; @@ -97,4 +113,24 @@ export class OrganizationComponent implements OnInit { ) .subscribe(); } + + /** 리스트 checkable 할 경우 checkbox 의 isChecked 를 관장하며 리스트의 전체선택 여부를 판단한다. */ + getCheckedUser(userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN) { + if (!!this.selectedUserList && this.selectedUserList.length > 0) { + return ( + this.selectedUserList.filter(item => item.seq === userInfo.seq).length > + 0 + ); + } + return false; + } + + /** 리스트가 checkable 할 경우 checkbox 의 change 이벤트를 상위 컴포넌트로 전달한다. */ + onCheckUser(params: { + isChecked: boolean; + userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN; + }) { + console.log(this.selectedUserList); + this.checkUser.emit(params); + } } 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 8e632e65..660361bc 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 @@ -13,9 +13,11 @@ + [favoritBuddyList]="favoritBuddyList$ | async" [selectedUserList]="selectedUserList" [checkable]="true" + (checkGroup)="onCheckGroup($event)"> + [sessionVerinfo]="sessionVerinfo" [selectedUserList]="selectedUserList" + [isChecked]="getCheckedUser(userInfo)" [checkable]="true" (checkUser)="onCheckUser($event)"> @@ -23,7 +25,9 @@ device_hub - + + 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 f6a36312..34841844 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 @@ -38,6 +38,7 @@ export interface CreateChatDialogData { export interface CreateChatDialogResult { choice: boolean; + selectedUserList?: (UserInfo | UserInfoSS | UserInfoF | UserInfoDN)[]; } @Component({ @@ -197,6 +198,7 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy { ); } + /** 동료그룹 :: 그룹의 checkbox 의 이벤트를 받아 선택된 유저리스트를 수집. */ onCheckGroup(params: { isChecked: boolean; groupBuddyList: { group: GroupDetailData; buddyList: UserInfo[] }; @@ -207,7 +209,7 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy { this.selectedUserList.filter(user => user.seq === item.seq).length === 0 ) { - this.selectedUserList.push(item); + this.selectedUserList = [...this.selectedUserList, item]; } }); } else { @@ -219,6 +221,7 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy { } } + /** 동료그룹>부서원, 조직도>부서원 :: 리스트의 checkbox 의 이벤트를 받아 선택된 유저리스트를 수집. */ onCheckUser(params: { isChecked: boolean; userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN; @@ -226,9 +229,10 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy { if (params.isChecked) { if ( this.selectedUserList.filter(user => user.seq === params.userInfo.seq) - .length === 0 + .length === 0 && + params.userInfo ) { - this.selectedUserList.push(params.userInfo); + this.selectedUserList = [...this.selectedUserList, params.userInfo]; } } else { this.selectedUserList = this.selectedUserList.filter( @@ -237,9 +241,22 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy { } } + /** 그룹>부서원 리스트의 ischecked 를 판단. */ + getCheckedUser(userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN) { + if (!!this.selectedUserList && this.selectedUserList.length > 0) { + return ( + this.selectedUserList.filter(item => item.seq === userInfo.seq).length > + 0 + ); + } + return false; + } + + /** 팝업의 선택 이벤트 전달. */ onClickChoice(choice: boolean): void { - // this.dialogRef.close({ - // choice - // }); + this.dialogRef.close({ + choice, + selectedUserList: this.selectedUserList + }); } } 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 8ec6f550..76af2331 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,8 +28,8 @@ (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 a4143cf4..8a48c64f 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 @@ -14,6 +14,11 @@ import { ucapAnimations } from '@ucap-webmessenger/ui'; import { GroupDetailData, UserInfo } from '@ucap-webmessenger/protocol-sync'; import { MatAccordion } from '@angular/material'; import { ExpansionPanelItemDirective } from '../directives/expansion-panel-item.directive'; +import { + UserInfoSS, + UserInfoF, + UserInfoDN +} from '@ucap-webmessenger/protocol-query'; @Component({ selector: 'ucap-group-expansion-panel', @@ -24,12 +29,13 @@ import { ExpansionPanelItemDirective } from '../directives/expansion-panel-item. export class ExpansionPanelComponent implements OnInit { @Input() groupBuddyList: { group: GroupDetailData; buddyList: UserInfo[] }[]; - @Input() favoritBuddyList: UserInfo[]; - @Input() checkable = false; + @Input() + /** 선택된 사용자의 리스트 */ + selectedUserList?: (UserInfo | UserInfoSS | UserInfoF | UserInfoDN)[] = []; @Output() more = new EventEmitter<{ @@ -67,6 +73,7 @@ export class ExpansionPanelComponent implements OnInit { this.more.emit({ event, group }); } + /** 그룹리스트가 checkable 할 경우 checkbox 의 change 이벤트를 상위 컴포넌트로 전달한다. */ onChangeCheck( value: boolean, groupBuddyList: { group: GroupDetailData; buddyList: UserInfo[] } @@ -76,4 +83,28 @@ export class ExpansionPanelComponent implements OnInit { groupBuddyList }); } + + /** 그룹리스트가 checkable 할 경우 checkbox 의 isChecked 를 관장하며, 하위 부서원들의 전체선택여부를 판단한다. */ + getCheckedGroup(groupBuddy: { + group: GroupDetailData; + buddyList: UserInfo[]; + }) { + if (groupBuddy.buddyList.length === 0) { + return false; + } + if (!!this.selectedUserList && this.selectedUserList.length > 0) { + let allExist = true; + groupBuddy.buddyList.some(groupUser => { + if ( + this.selectedUserList.filter(item => item.seq === groupUser.seq) + .length === 0 + ) { + allExist = false; + return true; + } + }); + return allExist; + } + return false; + } } 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 dc882336..1ae14b37 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 @@ -48,6 +48,9 @@ export class UserListItemComponent implements OnInit, OnDestroy { compactable = false; @Input() sessionVerinfo: VersionInfo2Response; + @Input() + /** 선택된 사용자의 리스트 */ + selectedUserList?: (UserInfo | UserInfoSS | UserInfoF | UserInfoDN)[] = []; @Output() checkUser = new EventEmitter<{ @@ -115,6 +118,7 @@ export class UserListItemComponent implements OnInit, OnDestroy { return rtnClass; } + /** 리스트가 checkable 할 경우 checkbox 의 change 이벤트를 상위 컴포넌트로 전달한다. */ onChangeCheck( value: boolean, userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN