2019-10-21 08:23:02 +00:00
|
|
|
import { MatMenuTrigger } from '@angular/material';
|
2019-11-04 08:52:47 +00:00
|
|
|
import {
|
|
|
|
Component,
|
|
|
|
OnInit,
|
|
|
|
ViewChild,
|
|
|
|
OnDestroy,
|
|
|
|
EventEmitter,
|
|
|
|
Output
|
|
|
|
} from '@angular/core';
|
2019-09-25 08:26:19 +00:00
|
|
|
|
2019-10-23 06:07:41 +00:00
|
|
|
import { Observable, combineLatest, Subscription, of } from 'rxjs';
|
|
|
|
import { map, tap, catchError, exhaustMap } from 'rxjs/operators';
|
2019-09-25 08:26:19 +00:00
|
|
|
import { Store, select } from '@ngrx/store';
|
|
|
|
|
|
|
|
import * as AppStore from '@app/store';
|
2019-09-27 03:53:21 +00:00
|
|
|
import * as ChatStore from '@app/store/messenger/chat';
|
2019-10-18 07:48:53 +00:00
|
|
|
import * as SyncStore from '@app/store/messenger/sync';
|
2019-10-23 06:07:41 +00:00
|
|
|
import * as StatusStore from '@app/store/messenger/status';
|
2019-10-21 08:23:02 +00:00
|
|
|
|
2019-09-27 03:53:21 +00:00
|
|
|
import { NGXLogger } from 'ngx-logger';
|
2019-10-07 07:29:38 +00:00
|
|
|
import { Company } from '@ucap-webmessenger/api-external';
|
|
|
|
import { SessionStorageService } from '@ucap-webmessenger/web-storage';
|
2019-10-21 08:23:02 +00:00
|
|
|
import { VersionInfo2Response } from '@ucap-webmessenger/api-public';
|
2019-12-10 23:18:32 +00:00
|
|
|
import {
|
|
|
|
LoginInfo,
|
|
|
|
KEY_LOGIN_INFO,
|
|
|
|
UserSelectDialogType,
|
|
|
|
EnvironmentsInfo,
|
2019-12-13 05:38:42 +00:00
|
|
|
KEY_ENVIRONMENTS_INFO,
|
|
|
|
KEY_VER_INFO
|
2019-12-10 23:18:32 +00:00
|
|
|
} from '@app/types';
|
2019-10-07 08:02:14 +00:00
|
|
|
import { ExpansionPanelComponent as GroupExpansionPanelComponent } from '@ucap-webmessenger/ui-group';
|
2019-10-21 08:23:02 +00:00
|
|
|
|
2019-10-08 08:57:57 +00:00
|
|
|
import { LoginResponse } from '@ucap-webmessenger/protocol-authentication';
|
2019-10-21 08:23:02 +00:00
|
|
|
import { UserInfo, GroupDetailData } from '@ucap-webmessenger/protocol-sync';
|
2019-10-15 02:07:26 +00:00
|
|
|
import {
|
|
|
|
DeptSearchType,
|
|
|
|
UserInfoSS,
|
|
|
|
UserInfoF,
|
2019-10-23 06:07:41 +00:00
|
|
|
UserInfoDN,
|
|
|
|
QueryProtocolService,
|
|
|
|
SSVC_TYPE_QUERY_DEPT_USER_DATA,
|
|
|
|
SSVC_TYPE_QUERY_DEPT_USER_RES,
|
|
|
|
DeptUserData
|
2019-10-15 02:07:26 +00:00
|
|
|
} from '@ucap-webmessenger/protocol-query';
|
2019-12-26 08:34:52 +00:00
|
|
|
import { OpenProfileOptions } from '@ucap-webmessenger/protocol-buddy';
|
2019-10-16 06:36:18 +00:00
|
|
|
|
2019-10-21 08:23:02 +00:00
|
|
|
import {
|
|
|
|
ucapAnimations,
|
|
|
|
DialogService,
|
|
|
|
ConfirmDialogData,
|
|
|
|
ConfirmDialogComponent,
|
|
|
|
ConfirmDialogResult
|
|
|
|
} from '@ucap-webmessenger/ui';
|
|
|
|
import {
|
|
|
|
CreateChatDialogComponent,
|
|
|
|
CreateChatDialogData,
|
|
|
|
CreateChatDialogResult
|
|
|
|
} from './../../dialogs/chat/create-chat.dialog.component';
|
2019-10-16 06:36:18 +00:00
|
|
|
import {
|
|
|
|
EditGroupDialogComponent,
|
|
|
|
EditGroupDialogData,
|
|
|
|
EditGroupDialogResult
|
2019-10-17 00:18:55 +00:00
|
|
|
} from '@app/layouts/messenger/dialogs/group/edit-group.dialog.component';
|
2019-11-21 02:46:49 +00:00
|
|
|
import {
|
|
|
|
SelectGroupDialogComponent,
|
|
|
|
SelectGroupDialogResult,
|
|
|
|
SelectGroupDialogData
|
|
|
|
} from '../../dialogs/group/select-group.dialog.component';
|
2019-12-10 23:18:32 +00:00
|
|
|
import {
|
|
|
|
MessageWriteDialogComponent,
|
|
|
|
MessageWriteDialogResult,
|
|
|
|
MessageWriteDialogData
|
|
|
|
} from '../../dialogs/message/message-write.dialog.component';
|
2019-12-16 08:42:49 +00:00
|
|
|
import { environment } from '../../../../../environments/environment';
|
2020-01-09 05:24:09 +00:00
|
|
|
import { TranslateService } from '@ngx-translate/core';
|
2019-09-23 05:23:24 +00:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'app-layout-chat-left-sidenav-group',
|
|
|
|
templateUrl: './group.component.html',
|
|
|
|
styleUrls: ['./group.component.scss'],
|
|
|
|
animations: ucapAnimations
|
|
|
|
})
|
2019-10-15 09:28:01 +00:00
|
|
|
export class GroupComponent implements OnInit, OnDestroy {
|
2019-11-04 08:52:47 +00:00
|
|
|
@Output()
|
|
|
|
newGroupAndMember = new EventEmitter();
|
2019-11-08 04:35:39 +00:00
|
|
|
@Output()
|
2019-12-26 08:34:52 +00:00
|
|
|
openProfile = new EventEmitter<{
|
2020-01-02 06:58:16 +00:00
|
|
|
userSeq: number;
|
2019-12-26 08:34:52 +00:00
|
|
|
openProfileOptions?: OpenProfileOptions;
|
|
|
|
}>();
|
2019-11-04 08:52:47 +00:00
|
|
|
|
2019-11-15 01:13:18 +00:00
|
|
|
@ViewChild('groupExpansionPanel', { static: false })
|
2019-10-07 08:02:14 +00:00
|
|
|
groupExpansionPanel: GroupExpansionPanelComponent;
|
|
|
|
|
2019-10-16 01:20:49 +00:00
|
|
|
@ViewChild('profileContextMenuTrigger', { static: true })
|
|
|
|
profileContextMenuTrigger: MatMenuTrigger;
|
2019-10-16 07:33:19 +00:00
|
|
|
profileContextMenuPosition = { x: '0px', y: '0px' };
|
2019-10-16 01:20:49 +00:00
|
|
|
|
|
|
|
@ViewChild('groupContextMenuTrigger', { static: true })
|
|
|
|
groupContextMenuTrigger: MatMenuTrigger;
|
2019-10-15 02:50:59 +00:00
|
|
|
groupContextMenuPosition = { x: '0px', y: '0px' };
|
|
|
|
|
2019-12-10 23:18:32 +00:00
|
|
|
groupBuddyList: { group: GroupDetailData; buddyList: UserInfo[] }[];
|
|
|
|
groupBuddyListSubscription: Subscription;
|
|
|
|
|
2019-10-10 09:35:23 +00:00
|
|
|
favoritBuddyList$: Observable<UserInfo[]>;
|
2020-01-07 04:45:11 +00:00
|
|
|
favoritBuddyList: UserInfo[] = [];
|
|
|
|
|
2019-10-07 07:29:38 +00:00
|
|
|
companyList$: Observable<Company[]>;
|
|
|
|
companyCode: string;
|
2019-09-25 08:26:19 +00:00
|
|
|
|
2019-10-08 08:57:57 +00:00
|
|
|
loginRes: LoginResponse;
|
|
|
|
loginResSubscription: Subscription;
|
2019-12-10 23:18:32 +00:00
|
|
|
environmentsInfo: EnvironmentsInfo;
|
2019-10-08 08:57:57 +00:00
|
|
|
|
2019-10-18 03:49:23 +00:00
|
|
|
sessionVerinfo: VersionInfo2Response;
|
2019-10-15 05:58:11 +00:00
|
|
|
|
2019-10-23 06:07:41 +00:00
|
|
|
isShowSearch = false;
|
|
|
|
searchProcessing = false;
|
|
|
|
searchUserInfos: UserInfoSS[] = [];
|
|
|
|
|
2019-10-07 07:29:38 +00:00
|
|
|
constructor(
|
|
|
|
private store: Store<any>,
|
|
|
|
private sessionStorageService: SessionStorageService,
|
2019-10-08 00:18:40 +00:00
|
|
|
private dialogService: DialogService,
|
2019-10-23 06:07:41 +00:00
|
|
|
private queryProtocolService: QueryProtocolService,
|
2020-01-09 05:24:09 +00:00
|
|
|
private translateService: TranslateService,
|
2019-10-07 07:29:38 +00:00
|
|
|
private logger: NGXLogger
|
2019-12-10 23:18:32 +00:00
|
|
|
) {
|
|
|
|
this.environmentsInfo = this.sessionStorageService.get<EnvironmentsInfo>(
|
|
|
|
KEY_ENVIRONMENTS_INFO
|
|
|
|
);
|
|
|
|
}
|
2019-09-23 05:23:24 +00:00
|
|
|
|
2019-09-25 08:26:19 +00:00
|
|
|
ngOnInit() {
|
2019-10-18 03:49:23 +00:00
|
|
|
this.sessionVerinfo = this.sessionStorageService.get<VersionInfo2Response>(
|
|
|
|
KEY_VER_INFO
|
|
|
|
);
|
2019-10-07 07:29:38 +00:00
|
|
|
const loginInfo = this.sessionStorageService.get<LoginInfo>(KEY_LOGIN_INFO);
|
|
|
|
this.companyCode = loginInfo.companyCode;
|
|
|
|
|
2019-10-08 08:57:57 +00:00
|
|
|
this.loginResSubscription = this.store
|
|
|
|
.pipe(
|
|
|
|
select(AppStore.AccountSelector.AuthenticationSelector.loginRes),
|
|
|
|
tap(loginRes => {
|
2020-01-08 04:21:09 +00:00
|
|
|
if (!!loginRes) {
|
|
|
|
this.loginRes = loginRes;
|
|
|
|
}
|
2019-10-08 08:57:57 +00:00
|
|
|
})
|
|
|
|
)
|
|
|
|
.subscribe();
|
|
|
|
|
2019-10-07 07:29:38 +00:00
|
|
|
this.companyList$ = this.store.pipe(
|
2019-10-08 00:18:40 +00:00
|
|
|
select(AppStore.SettingSelector.CompanySelector.companyList)
|
2019-10-07 07:29:38 +00:00
|
|
|
);
|
|
|
|
|
2019-12-10 23:18:32 +00:00
|
|
|
this.groupBuddyListSubscription = combineLatest([
|
2019-10-11 02:58:03 +00:00
|
|
|
this.store.pipe(
|
|
|
|
select(AppStore.MessengerSelector.SyncSelector.selectAllBuddy2)
|
|
|
|
),
|
|
|
|
this.store.pipe(
|
|
|
|
select(AppStore.MessengerSelector.SyncSelector.selectAllGroup2)
|
2019-09-27 03:53:21 +00:00
|
|
|
)
|
2019-12-10 23:18:32 +00:00
|
|
|
])
|
|
|
|
.pipe(
|
|
|
|
map(([buddyList, groupList]) => {
|
2020-01-06 02:02:02 +00:00
|
|
|
// sort..
|
|
|
|
if (!!groupList && groupList.length > 0) {
|
|
|
|
const tempOrderArr: GroupDetailData[] = [];
|
|
|
|
let myDeptGroup: GroupDetailData;
|
|
|
|
let defaultGroup: GroupDetailData;
|
|
|
|
|
|
|
|
groupList.forEach(group => {
|
|
|
|
if (
|
|
|
|
!!environment.productConfig.CommonSetting.useMyDeptGroup &&
|
|
|
|
environment.productConfig.CommonSetting.myDeptGroupSeq ===
|
|
|
|
group.seq
|
|
|
|
) {
|
|
|
|
myDeptGroup = group;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (0 === group.seq) {
|
|
|
|
defaultGroup = group;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
if (!!myDeptGroup) {
|
|
|
|
tempOrderArr.push(myDeptGroup);
|
|
|
|
}
|
|
|
|
|
|
|
|
tempOrderArr.push(
|
|
|
|
...groupList
|
|
|
|
.filter(
|
|
|
|
group =>
|
|
|
|
group.seq !==
|
|
|
|
environment.productConfig.CommonSetting.myDeptGroupSeq &&
|
|
|
|
group.seq !== 0
|
|
|
|
)
|
|
|
|
.sort((a, b) =>
|
|
|
|
a.name < b.name ? -1 : a.name > b.name ? 1 : 0
|
|
|
|
)
|
|
|
|
);
|
|
|
|
|
|
|
|
if (!!defaultGroup) {
|
|
|
|
tempOrderArr.push(defaultGroup);
|
|
|
|
}
|
|
|
|
|
|
|
|
groupList = tempOrderArr;
|
|
|
|
}
|
|
|
|
|
2019-12-10 23:18:32 +00:00
|
|
|
const groupBuddyList: {
|
|
|
|
group: GroupDetailData;
|
|
|
|
buddyList: UserInfo[];
|
|
|
|
}[] = [];
|
|
|
|
for (const group of groupList) {
|
|
|
|
groupBuddyList.push({
|
|
|
|
group,
|
|
|
|
buddyList: buddyList.filter(buddy => {
|
|
|
|
return group.userSeqs.indexOf(buddy.seq) > -1;
|
|
|
|
})
|
|
|
|
});
|
|
|
|
}
|
2019-09-27 03:53:21 +00:00
|
|
|
|
2019-12-10 23:18:32 +00:00
|
|
|
this.groupBuddyList = groupBuddyList;
|
|
|
|
|
|
|
|
return groupBuddyList;
|
|
|
|
})
|
|
|
|
)
|
|
|
|
.subscribe();
|
2019-10-10 09:35:23 +00:00
|
|
|
|
|
|
|
this.favoritBuddyList$ = this.store
|
2019-10-11 03:58:41 +00:00
|
|
|
.pipe(select(AppStore.MessengerSelector.SyncSelector.selectAllBuddy2))
|
2019-10-10 09:35:23 +00:00
|
|
|
.pipe(
|
|
|
|
map(buddyInfoList => {
|
2020-01-07 04:45:11 +00:00
|
|
|
this.favoritBuddyList = buddyInfoList
|
2019-10-10 09:35:23 +00:00
|
|
|
.filter(buddy => buddy.isFavorit)
|
|
|
|
.sort((a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0));
|
2020-01-07 04:45:11 +00:00
|
|
|
return this.favoritBuddyList;
|
2019-10-10 09:35:23 +00:00
|
|
|
})
|
|
|
|
);
|
2019-09-27 03:53:21 +00:00
|
|
|
}
|
|
|
|
|
2019-10-15 09:28:01 +00:00
|
|
|
ngOnDestroy(): void {
|
|
|
|
if (!!this.loginResSubscription) {
|
|
|
|
this.loginResSubscription.unsubscribe();
|
|
|
|
}
|
2019-12-10 23:18:32 +00:00
|
|
|
if (!!this.groupBuddyListSubscription) {
|
|
|
|
this.groupBuddyListSubscription.unsubscribe();
|
|
|
|
}
|
2019-11-21 01:29:19 +00:00
|
|
|
|
|
|
|
this.logger.debug('-----------------------GroupComponent ngOnDestroy');
|
2019-10-15 09:28:01 +00:00
|
|
|
}
|
|
|
|
|
2019-10-08 00:18:40 +00:00
|
|
|
async onClickGroupMenu(menuType: string) {
|
2019-10-07 08:02:14 +00:00
|
|
|
this.logger.debug('menuType', menuType);
|
|
|
|
switch (menuType) {
|
|
|
|
case 'GROUP_NEW':
|
2019-10-08 00:18:40 +00:00
|
|
|
{
|
2019-11-04 08:52:47 +00:00
|
|
|
this.newGroupAndMember.emit();
|
2019-10-08 00:18:40 +00:00
|
|
|
}
|
2019-10-07 08:02:14 +00:00
|
|
|
break;
|
|
|
|
case 'GROUP_EXPAND_MORE':
|
2019-10-08 00:18:40 +00:00
|
|
|
{
|
|
|
|
this.groupExpansionPanel.expandMore();
|
|
|
|
}
|
2019-10-07 08:02:14 +00:00
|
|
|
break;
|
|
|
|
case 'GROUP_EXPAND_LESS':
|
2019-10-08 00:18:40 +00:00
|
|
|
{
|
|
|
|
this.groupExpansionPanel.expandLess();
|
|
|
|
}
|
2019-10-07 08:02:14 +00:00
|
|
|
break;
|
|
|
|
case 'GROUP_SAVE':
|
|
|
|
break;
|
|
|
|
case 'GROUP_RESTORE':
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-27 03:53:21 +00:00
|
|
|
onSelectBuddy(buddy: UserInfo) {
|
2019-10-22 00:47:14 +00:00
|
|
|
if (buddy.seq === this.loginRes.userSeq) {
|
|
|
|
this.store.dispatch(
|
|
|
|
ChatStore.openRoom({ userSeqList: [this.loginRes.talkWithMeBotSeq] })
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
this.store.dispatch(ChatStore.openRoom({ userSeqList: [buddy.seq] }));
|
|
|
|
}
|
2019-09-25 08:26:19 +00:00
|
|
|
}
|
2019-10-07 07:29:38 +00:00
|
|
|
|
2019-10-11 09:24:57 +00:00
|
|
|
getStatusBulkInfo(buddy: UserInfo) {
|
|
|
|
return this.store.pipe(
|
|
|
|
select(
|
|
|
|
AppStore.MessengerSelector.StatusSelector.selectEntitiesStatusBulkInfo
|
|
|
|
),
|
|
|
|
map(statusBulkInfo =>
|
|
|
|
!!statusBulkInfo ? statusBulkInfo[buddy.seq] : undefined
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2019-10-23 06:07:41 +00:00
|
|
|
/** 유저검색 */
|
2019-10-07 07:29:38 +00:00
|
|
|
onKeyDownEnterOrganizationTenantSearch(params: {
|
|
|
|
companyCode: string;
|
|
|
|
searchWord: string;
|
|
|
|
}) {
|
2019-10-23 06:07:41 +00:00
|
|
|
if (params.searchWord.trim().length > 1) {
|
|
|
|
this.isShowSearch = true;
|
|
|
|
this.searchProcessing = true;
|
|
|
|
|
|
|
|
const searchUserInfos: UserInfoSS[] = [];
|
|
|
|
this.queryProtocolService
|
|
|
|
.deptUser({
|
|
|
|
divCd: 'GRP',
|
|
|
|
companyCode: params.companyCode,
|
|
|
|
searchRange: DeptSearchType.All,
|
|
|
|
search: params.searchWord,
|
|
|
|
senderCompanyCode: params.companyCode,
|
|
|
|
senderEmployeeType: this.loginRes.userInfo.employeeType
|
|
|
|
})
|
|
|
|
.pipe(
|
|
|
|
map(res => {
|
|
|
|
switch (res.SSVC_TYPE) {
|
|
|
|
case SSVC_TYPE_QUERY_DEPT_USER_DATA:
|
2019-12-19 08:19:36 +00:00
|
|
|
const userInfos = (res as DeptUserData).userInfos;
|
2019-12-20 02:33:14 +00:00
|
|
|
// searchUserInfos.push(
|
|
|
|
// ...userInfos.filter(
|
|
|
|
// userInfo => userInfo.seq !== this.loginRes.userSeq
|
|
|
|
// )
|
|
|
|
// );
|
|
|
|
searchUserInfos.push(...userInfos);
|
2019-10-23 06:07:41 +00:00
|
|
|
break;
|
|
|
|
case SSVC_TYPE_QUERY_DEPT_USER_RES:
|
|
|
|
{
|
|
|
|
// 검색 결과 처리.
|
|
|
|
this.searchUserInfos = searchUserInfos;
|
|
|
|
this.searchProcessing = false;
|
|
|
|
|
|
|
|
// 검색 결과에 따른 프레즌스 조회.
|
|
|
|
const userSeqList: number[] = [];
|
|
|
|
this.searchUserInfos.map(user => userSeqList.push(user.seq));
|
|
|
|
if (userSeqList.length > 0) {
|
|
|
|
this.store.dispatch(
|
|
|
|
StatusStore.bulkInfo({
|
|
|
|
divCd: 'groupSrch',
|
|
|
|
userSeqs: userSeqList
|
|
|
|
})
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
catchError(error => {
|
|
|
|
this.searchProcessing = false;
|
|
|
|
return of(this.logger.error(error));
|
|
|
|
})
|
|
|
|
)
|
|
|
|
.subscribe();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/** 검색 취소 */
|
|
|
|
onClickCancel() {
|
|
|
|
this.isShowSearch = false;
|
|
|
|
this.searchUserInfos = [];
|
2019-10-07 07:29:38 +00:00
|
|
|
}
|
2019-10-15 02:07:26 +00:00
|
|
|
|
2019-11-21 07:15:15 +00:00
|
|
|
/** 그룹 header > more 버튼 > visible of context menu */
|
|
|
|
getShowGroupContextMenu(menuType: string, group: GroupDetailData) {
|
2019-11-22 00:10:37 +00:00
|
|
|
// 즐겨찾기 그룹 숨김메뉴
|
2019-11-21 07:15:15 +00:00
|
|
|
if (
|
|
|
|
menuType === 'DIV1' ||
|
|
|
|
menuType === 'RENAME' ||
|
|
|
|
menuType === 'EDIT_MEMBER' ||
|
|
|
|
menuType === 'DELETE'
|
|
|
|
) {
|
2020-01-07 04:45:11 +00:00
|
|
|
if (
|
|
|
|
!group ||
|
|
|
|
group === undefined ||
|
|
|
|
(group.seq < 0 && group.name === 'Favorit')
|
|
|
|
) {
|
2019-11-22 00:10:37 +00:00
|
|
|
return false;
|
|
|
|
}
|
2019-12-16 08:42:49 +00:00
|
|
|
|
|
|
|
/** 수정불가 그룹 핸들링. */
|
2020-01-06 02:15:11 +00:00
|
|
|
if (!!group && !!environment.productConfig.CommonSetting.fixedGroupSeqs) {
|
2019-12-16 08:42:49 +00:00
|
|
|
const fixedGroupSeqs: number[] =
|
2020-01-06 02:15:11 +00:00
|
|
|
environment.productConfig.CommonSetting.fixedGroupSeqs;
|
2019-12-16 08:42:49 +00:00
|
|
|
if (!!fixedGroupSeqs && fixedGroupSeqs.length > 0) {
|
|
|
|
if (fixedGroupSeqs.indexOf(group.seq) > -1) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-11-22 00:10:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// 기본 그룹 숨김메뉴
|
|
|
|
if (menuType === 'RENAME' || menuType === 'DELETE') {
|
|
|
|
if (!!group && group.seq === 0) {
|
2019-11-21 07:15:15 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-27 06:30:14 +00:00
|
|
|
// 그룹원 0명인 그룹 메뉴 정리
|
2020-01-07 04:45:11 +00:00
|
|
|
if (
|
|
|
|
menuType === 'CHAT' ||
|
|
|
|
menuType === 'SEND_MESSAGE' ||
|
|
|
|
menuType === 'DIV1'
|
|
|
|
) {
|
2019-11-27 06:30:14 +00:00
|
|
|
if (!!group && !!group.userSeqs && group.userSeqs.length > 0) {
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-21 07:15:15 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** 그룹 > 그룹원 > visible of context menu */
|
|
|
|
getShowProfileContextMenu(
|
2019-11-21 02:46:49 +00:00
|
|
|
menuType: string,
|
|
|
|
userInfo: UserInfo | UserInfoF,
|
2019-12-19 08:47:10 +00:00
|
|
|
group: GroupDetailData,
|
|
|
|
isSearchData: boolean
|
2019-11-21 02:46:49 +00:00
|
|
|
) {
|
2019-10-22 00:53:16 +00:00
|
|
|
if (userInfo.seq === this.loginRes.userSeq) {
|
|
|
|
return false;
|
|
|
|
}
|
2019-11-21 02:46:49 +00:00
|
|
|
|
2019-12-19 08:47:10 +00:00
|
|
|
if (!!isSearchData) {
|
|
|
|
if (menuType === 'VIEW_PROFILE' || menuType === 'SEND_MESSAGE') {
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-21 02:46:49 +00:00
|
|
|
if (!group || group === undefined) {
|
|
|
|
if (
|
|
|
|
menuType === 'REGISTER_FAVORITE' ||
|
2019-12-10 23:18:32 +00:00
|
|
|
menuType === 'SEND_MESSAGE' ||
|
2019-11-21 02:46:49 +00:00
|
|
|
menuType === 'REGISTER_NICKNAME'
|
|
|
|
) {
|
|
|
|
// continue;
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-12-17 23:40:45 +00:00
|
|
|
/** 수정불가 그룹 핸들링. */
|
2020-01-06 02:15:11 +00:00
|
|
|
if (!!group && !!environment.productConfig.CommonSetting.fixedGroupSeqs) {
|
|
|
|
const fixedGroupSeqs: number[] =
|
|
|
|
environment.productConfig.CommonSetting.fixedGroupSeqs;
|
2019-12-17 23:40:45 +00:00
|
|
|
if (!!fixedGroupSeqs && fixedGroupSeqs.length > 0) {
|
|
|
|
if (fixedGroupSeqs.indexOf(group.seq) > -1) {
|
|
|
|
if (menuType === 'REMOVE_FROM_GROUP' || menuType === 'MOVE_BUDDY') {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-21 02:46:49 +00:00
|
|
|
return true;
|
2019-10-22 00:53:16 +00:00
|
|
|
}
|
2019-11-21 02:46:49 +00:00
|
|
|
async onClickProfileContextMenu(
|
|
|
|
menuType: string,
|
|
|
|
userInfo: UserInfo | UserInfoF,
|
|
|
|
group?: GroupDetailData
|
|
|
|
) {
|
2019-10-15 09:20:50 +00:00
|
|
|
this.logger.debug(
|
|
|
|
'onClickProfileContextMenu',
|
|
|
|
'menuType',
|
|
|
|
menuType,
|
|
|
|
'userInfo',
|
2019-11-21 02:46:49 +00:00
|
|
|
userInfo,
|
|
|
|
'group',
|
|
|
|
group
|
2019-10-15 09:20:50 +00:00
|
|
|
);
|
2019-10-21 08:23:02 +00:00
|
|
|
switch (menuType) {
|
2019-11-21 00:07:25 +00:00
|
|
|
case 'VIEW_PROFILE':
|
2020-01-15 05:05:36 +00:00
|
|
|
let useBuddyButton = false;
|
|
|
|
if (
|
|
|
|
!!group &&
|
|
|
|
environment.productConfig.CommonSetting.useMyDeptGroup &&
|
|
|
|
environment.productConfig.CommonSetting.myDeptGroupSeq !== group.seq
|
|
|
|
) {
|
|
|
|
useBuddyButton = true;
|
|
|
|
}
|
2019-12-26 08:34:52 +00:00
|
|
|
this.openProfile.emit({
|
2020-01-02 06:58:16 +00:00
|
|
|
userSeq: userInfo.seq,
|
2019-12-26 08:34:52 +00:00
|
|
|
openProfileOptions: {
|
2020-01-15 05:05:36 +00:00
|
|
|
useBuddyButton
|
2019-12-26 08:34:52 +00:00
|
|
|
}
|
|
|
|
});
|
2019-11-21 00:07:25 +00:00
|
|
|
break;
|
|
|
|
case 'CHAT':
|
|
|
|
this.onSelectBuddy(userInfo);
|
|
|
|
break;
|
2019-11-21 02:46:49 +00:00
|
|
|
case 'REMOVE_FROM_GROUP':
|
|
|
|
{
|
|
|
|
const result = await this.dialogService.open<
|
|
|
|
ConfirmDialogComponent,
|
|
|
|
ConfirmDialogData,
|
|
|
|
ConfirmDialogResult
|
|
|
|
>(ConfirmDialogComponent, {
|
|
|
|
width: '360px',
|
|
|
|
data: {
|
2020-01-09 05:24:09 +00:00
|
|
|
title: this.translateService.instant(
|
|
|
|
'group.removeBuddyFromGroup'
|
|
|
|
),
|
|
|
|
html: this.translateService.instant(
|
|
|
|
'group.confirmRemoveBuddyFromGroupInContextMenu',
|
|
|
|
{
|
|
|
|
target: `${userInfo.name} ${userInfo.grade}`,
|
|
|
|
targetGroup: `${group.name}`
|
|
|
|
}
|
|
|
|
)
|
2019-11-21 02:46:49 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
if (!!result && !!result.choice && result.choice) {
|
|
|
|
const trgtUserSeq = group.userSeqs.filter(
|
|
|
|
user => user !== userInfo.seq
|
|
|
|
);
|
|
|
|
this.store.dispatch(
|
|
|
|
SyncStore.updateGroupMember({
|
|
|
|
oldGroup: group,
|
|
|
|
trgtUserSeq
|
|
|
|
})
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'COPY_BUDDY':
|
|
|
|
{
|
|
|
|
const result = await this.dialogService.open<
|
|
|
|
SelectGroupDialogComponent,
|
|
|
|
SelectGroupDialogData,
|
|
|
|
SelectGroupDialogResult
|
|
|
|
>(SelectGroupDialogComponent, {
|
|
|
|
width: '600px',
|
|
|
|
data: {
|
2020-01-09 05:24:09 +00:00
|
|
|
title: this.translateService.instant('group.selectTargetGroup')
|
2019-11-21 02:46:49 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
if (!!result && !!result.choice && result.choice) {
|
|
|
|
if (!!result.group) {
|
|
|
|
const oldGroup: GroupDetailData = result.group;
|
|
|
|
const trgtUserSeq: number[] = [];
|
|
|
|
let exist = false;
|
|
|
|
result.group.userSeqs.map(seq => {
|
|
|
|
trgtUserSeq.push(seq);
|
|
|
|
if (seq === userInfo.seq) {
|
|
|
|
exist = true;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
if (!exist) {
|
|
|
|
trgtUserSeq.push(userInfo.seq);
|
|
|
|
}
|
|
|
|
|
|
|
|
this.store.dispatch(
|
|
|
|
SyncStore.updateGroupMember({
|
|
|
|
oldGroup,
|
|
|
|
trgtUserSeq
|
|
|
|
})
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'MOVE_BUDDY':
|
|
|
|
{
|
|
|
|
const result = await this.dialogService.open<
|
|
|
|
SelectGroupDialogComponent,
|
|
|
|
SelectGroupDialogData,
|
|
|
|
SelectGroupDialogResult
|
|
|
|
>(SelectGroupDialogComponent, {
|
|
|
|
width: '600px',
|
|
|
|
data: {
|
2020-01-09 05:24:09 +00:00
|
|
|
title: this.translateService.instant('group.selectTargetGroup')
|
2019-11-21 02:46:49 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
if (!!result && !!result.choice && result.choice) {
|
|
|
|
if (!!result.group) {
|
|
|
|
this.store.dispatch(
|
|
|
|
SyncStore.moveGroupMember({
|
|
|
|
fromGroup: group,
|
|
|
|
toGroup: result.group,
|
|
|
|
trgtUserSeq: [userInfo.seq]
|
|
|
|
})
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2019-10-21 08:23:02 +00:00
|
|
|
case 'REGISTER_FAVORITE':
|
|
|
|
this.store.dispatch(
|
|
|
|
SyncStore.updateBuddy({
|
|
|
|
seq: userInfo.seq,
|
|
|
|
isFavorit: !userInfo.isFavorit
|
|
|
|
})
|
|
|
|
);
|
|
|
|
break;
|
2019-12-10 23:18:32 +00:00
|
|
|
case 'SEND_MESSAGE':
|
|
|
|
{
|
|
|
|
this.dialogService.open<
|
|
|
|
MessageWriteDialogComponent,
|
|
|
|
MessageWriteDialogData,
|
|
|
|
MessageWriteDialogResult
|
|
|
|
>(MessageWriteDialogComponent, {
|
|
|
|
width: '600px',
|
|
|
|
height: '600px',
|
|
|
|
disableClose: true,
|
|
|
|
hasBackdrop: false,
|
|
|
|
data: {
|
|
|
|
loginRes: this.loginRes,
|
|
|
|
environmentsInfo: this.environmentsInfo,
|
|
|
|
receiverList: [userInfo]
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
break;
|
2019-10-21 08:23:02 +00:00
|
|
|
}
|
2019-10-15 09:20:50 +00:00
|
|
|
}
|
|
|
|
|
2020-01-06 02:02:02 +00:00
|
|
|
onClickOpenProfile(userSeq: number, group: GroupDetailData) {
|
2020-01-15 05:05:36 +00:00
|
|
|
let useBuddyButton = false;
|
|
|
|
if (
|
|
|
|
!!group &&
|
|
|
|
environment.productConfig.CommonSetting.useMyDeptGroup &&
|
|
|
|
environment.productConfig.CommonSetting.myDeptGroupSeq !== group.seq
|
|
|
|
) {
|
|
|
|
useBuddyButton = true;
|
|
|
|
}
|
|
|
|
|
2019-12-26 08:34:52 +00:00
|
|
|
this.openProfile.emit({
|
2020-01-02 06:58:16 +00:00
|
|
|
userSeq,
|
2019-12-26 08:34:52 +00:00
|
|
|
openProfileOptions: {
|
2020-01-15 05:05:36 +00:00
|
|
|
useBuddyButton
|
2019-12-26 08:34:52 +00:00
|
|
|
}
|
|
|
|
});
|
2019-11-08 04:35:39 +00:00
|
|
|
}
|
|
|
|
|
2019-10-15 07:39:58 +00:00
|
|
|
onContextMenuProfile(
|
|
|
|
event: MouseEvent,
|
2019-11-21 02:46:49 +00:00
|
|
|
userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN,
|
2019-12-19 08:47:10 +00:00
|
|
|
group: GroupDetailData,
|
|
|
|
isSearchData: boolean
|
2019-10-15 07:39:58 +00:00
|
|
|
) {
|
|
|
|
event.preventDefault();
|
|
|
|
event.stopPropagation();
|
|
|
|
|
|
|
|
this.profileContextMenuPosition.x = event.clientX + 'px';
|
|
|
|
this.profileContextMenuPosition.y = event.clientY + 'px';
|
2019-10-16 01:20:49 +00:00
|
|
|
this.profileContextMenuTrigger.menu.focusFirstItem('mouse');
|
2019-12-19 08:47:10 +00:00
|
|
|
this.profileContextMenuTrigger.menuData = { userInfo, group, isSearchData };
|
2019-10-16 01:20:49 +00:00
|
|
|
this.profileContextMenuTrigger.openMenu();
|
2019-10-15 02:07:26 +00:00
|
|
|
}
|
2019-10-15 02:50:59 +00:00
|
|
|
|
2019-10-16 06:36:18 +00:00
|
|
|
async onClickGroupContextMenu(menuType: string, group: GroupDetailData) {
|
2019-10-15 09:20:50 +00:00
|
|
|
this.logger.debug(
|
|
|
|
'onClickGroupContextMenu',
|
|
|
|
'menuType',
|
|
|
|
menuType,
|
|
|
|
'group',
|
|
|
|
group
|
|
|
|
);
|
2019-10-16 05:53:53 +00:00
|
|
|
switch (menuType) {
|
|
|
|
case 'CHAT':
|
|
|
|
this.store.dispatch(
|
|
|
|
ChatStore.openRoom({ userSeqList: group.userSeqs })
|
|
|
|
);
|
|
|
|
break;
|
2019-12-10 23:18:32 +00:00
|
|
|
case 'SEND_MESSAGE':
|
|
|
|
{
|
2020-01-07 04:45:11 +00:00
|
|
|
let receiverList: UserInfo[] = [];
|
|
|
|
const isFavGroup =
|
|
|
|
group.seq < 0 && group.name === 'Favorit' ? true : false;
|
|
|
|
|
|
|
|
if (!!isFavGroup) {
|
|
|
|
receiverList = this.favoritBuddyList;
|
|
|
|
} else {
|
|
|
|
const curGroupBuddyList = this.groupBuddyList.filter(
|
|
|
|
groupInfo => groupInfo.group.seq === group.seq
|
|
|
|
);
|
|
|
|
if (!!curGroupBuddyList && curGroupBuddyList.length > 0) {
|
|
|
|
receiverList = curGroupBuddyList[0].buddyList;
|
|
|
|
}
|
|
|
|
}
|
2019-12-10 23:18:32 +00:00
|
|
|
|
2020-01-07 04:45:11 +00:00
|
|
|
if (receiverList.length > 0) {
|
2019-12-10 23:18:32 +00:00
|
|
|
this.dialogService.open<
|
|
|
|
MessageWriteDialogComponent,
|
|
|
|
MessageWriteDialogData,
|
|
|
|
MessageWriteDialogResult
|
|
|
|
>(MessageWriteDialogComponent, {
|
|
|
|
width: '600px',
|
|
|
|
height: '600px',
|
|
|
|
disableClose: true,
|
|
|
|
hasBackdrop: false,
|
|
|
|
data: {
|
|
|
|
loginRes: this.loginRes,
|
|
|
|
environmentsInfo: this.environmentsInfo,
|
2020-01-07 04:45:11 +00:00
|
|
|
receiverList
|
2019-12-10 23:18:32 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
2019-10-16 05:53:53 +00:00
|
|
|
break;
|
|
|
|
case 'RENAME':
|
2019-10-16 06:36:18 +00:00
|
|
|
{
|
|
|
|
const result = await this.dialogService.open<
|
|
|
|
EditGroupDialogComponent,
|
|
|
|
EditGroupDialogData,
|
|
|
|
EditGroupDialogResult
|
|
|
|
>(EditGroupDialogComponent, {
|
|
|
|
data: {
|
2020-01-09 05:24:09 +00:00
|
|
|
title: this.translateService.instant('group.changeGroupName'),
|
2019-10-21 07:32:22 +00:00
|
|
|
group
|
2019-10-16 06:36:18 +00:00
|
|
|
}
|
|
|
|
});
|
2019-10-21 07:32:22 +00:00
|
|
|
|
|
|
|
if (!!result && !!result.choice && result.choice) {
|
|
|
|
if (!!result.groupName && result.groupName.trim().length > 0) {
|
|
|
|
this.store.dispatch(
|
|
|
|
SyncStore.updateGroup({
|
|
|
|
groupSeq: result.group.seq,
|
|
|
|
groupName: result.groupName,
|
|
|
|
userSeqs: result.group.userSeqs
|
|
|
|
})
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2019-10-16 06:36:18 +00:00
|
|
|
}
|
2019-10-16 05:53:53 +00:00
|
|
|
break;
|
|
|
|
case 'EDIT_MEMBER':
|
2019-10-16 06:36:18 +00:00
|
|
|
{
|
|
|
|
const result = await this.dialogService.open<
|
2019-10-21 04:10:19 +00:00
|
|
|
CreateChatDialogComponent,
|
|
|
|
CreateChatDialogData,
|
|
|
|
CreateChatDialogResult
|
|
|
|
>(CreateChatDialogComponent, {
|
|
|
|
width: '600px',
|
2019-10-16 06:36:18 +00:00
|
|
|
data: {
|
2019-10-21 04:10:19 +00:00
|
|
|
type: UserSelectDialogType.EditMember,
|
2020-01-09 05:24:09 +00:00
|
|
|
title: this.translateService.instant('group.modifyGroupMember'),
|
2019-10-21 04:10:19 +00:00
|
|
|
group
|
2019-10-16 06:36:18 +00:00
|
|
|
}
|
|
|
|
});
|
2019-10-21 04:10:19 +00:00
|
|
|
|
|
|
|
if (!!result && !!result.choice && result.choice) {
|
|
|
|
if (!!result.oldGroup) {
|
|
|
|
const userSeqs: number[] = [];
|
|
|
|
result.selectedUserList.map(user => userSeqs.push(user.seq));
|
|
|
|
|
|
|
|
this.store.dispatch(
|
|
|
|
SyncStore.updateGroupMember({
|
|
|
|
oldGroup: group,
|
|
|
|
trgtUserSeq: userSeqs
|
|
|
|
})
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2019-10-16 06:36:18 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'DELETE':
|
|
|
|
{
|
|
|
|
const result = await this.dialogService.open<
|
2019-10-21 07:11:33 +00:00
|
|
|
ConfirmDialogComponent,
|
|
|
|
ConfirmDialogData,
|
|
|
|
ConfirmDialogResult
|
|
|
|
>(ConfirmDialogComponent, {
|
2019-10-29 10:06:25 +00:00
|
|
|
width: '360px',
|
2019-10-16 06:36:18 +00:00
|
|
|
data: {
|
2020-01-09 05:24:09 +00:00
|
|
|
title: this.translateService.instant('group.removeGroup'),
|
|
|
|
html: this.translateService.instant('group.confirmRemoveGroup', {
|
|
|
|
nameOfGroup: `${group.name}`
|
|
|
|
})
|
2019-10-16 06:36:18 +00:00
|
|
|
}
|
|
|
|
});
|
2019-10-21 07:11:33 +00:00
|
|
|
|
|
|
|
if (!!result && !!result.choice && result.choice) {
|
|
|
|
this.store.dispatch(SyncStore.delGroup({ group }));
|
|
|
|
}
|
2019-10-16 06:36:18 +00:00
|
|
|
}
|
2019-10-16 05:53:53 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2019-10-15 09:20:50 +00:00
|
|
|
}
|
|
|
|
|
2019-10-15 02:50:59 +00:00
|
|
|
onMoreGroup(params: { event: MouseEvent; group: GroupDetailData }) {
|
2019-10-15 09:20:50 +00:00
|
|
|
params.event.preventDefault();
|
|
|
|
params.event.stopPropagation();
|
|
|
|
|
2019-10-15 02:50:59 +00:00
|
|
|
this.groupContextMenuPosition.x = params.event.clientX + 'px';
|
|
|
|
this.groupContextMenuPosition.y = params.event.clientY + 'px';
|
2019-10-16 01:20:49 +00:00
|
|
|
this.groupContextMenuTrigger.menu.focusFirstItem('mouse');
|
|
|
|
this.groupContextMenuTrigger.menuData = { group: params.group };
|
|
|
|
this.groupContextMenuTrigger.openMenu();
|
2019-10-15 02:50:59 +00:00
|
|
|
}
|
2019-09-23 05:23:24 +00:00
|
|
|
}
|