From 4e5ace1d406a5214650ed942cbcc6f1eede6298e Mon Sep 17 00:00:00 2001 From: leejinho Date: Wed, 11 Dec 2019 08:18:32 +0900 Subject: [PATCH] =?UTF-8?q?=EC=AA=BD=EC=A7=80=20=EC=97=B0=EA=B2=B0.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../left-sidenav/group.component.html | 10 +- .../left-sidenav/group.component.ts | 115 ++++++++++++++---- .../left-sidenav/message.component.ts | 8 +- .../message-detail.dialog.component.ts | 26 ++++ .../message-write.dialog.component.html | 2 + .../message/message-write.dialog.component.ts | 6 +- .../profile/profile.dialog.component.html | 1 + .../profile/profile.dialog.component.ts | 27 ++++ .../src/lib/components/write.component.html | 38 +++--- .../src/lib/components/write.component.scss | 3 +- .../src/lib/components/write.component.ts | 73 ++++++++++- .../src/lib/components/profile.component.ts | 6 +- 12 files changed, 259 insertions(+), 56 deletions(-) diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/group.component.html b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/group.component.html index e22eec97..23c168c9 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/group.component.html +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/group.component.html @@ -27,7 +27,7 @@ > @@ -227,8 +227,8 @@ diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/group.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/group.component.ts index cbda8829..b3e05e93 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/group.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/group.component.ts @@ -21,7 +21,13 @@ import { NGXLogger } from 'ngx-logger'; import { Company } from '@ucap-webmessenger/api-external'; import { SessionStorageService } from '@ucap-webmessenger/web-storage'; import { VersionInfo2Response } from '@ucap-webmessenger/api-public'; -import { LoginInfo, KEY_LOGIN_INFO, UserSelectDialogType } from '@app/types'; +import { + LoginInfo, + KEY_LOGIN_INFO, + UserSelectDialogType, + EnvironmentsInfo, + KEY_ENVIRONMENTS_INFO +} from '@app/types'; import { KEY_VER_INFO } from '@app/types/ver-info.type'; import { ExpansionPanelComponent as GroupExpansionPanelComponent } from '@ucap-webmessenger/ui-group'; @@ -61,6 +67,11 @@ import { SelectGroupDialogResult, SelectGroupDialogData } from '../../dialogs/group/select-group.dialog.component'; +import { + MessageWriteDialogComponent, + MessageWriteDialogResult, + MessageWriteDialogData +} from '../../dialogs/message/message-write.dialog.component'; @Component({ selector: 'app-layout-chat-left-sidenav-group', @@ -87,15 +98,16 @@ export class GroupComponent implements OnInit, OnDestroy { groupContextMenuTrigger: MatMenuTrigger; groupContextMenuPosition = { x: '0px', y: '0px' }; - groupBuddyList$: Observable< - { group: GroupDetailData; buddyList: UserInfo[] }[] - >; + groupBuddyList: { group: GroupDetailData; buddyList: UserInfo[] }[]; + groupBuddyListSubscription: Subscription; + favoritBuddyList$: Observable; companyList$: Observable; companyCode: string; loginRes: LoginResponse; loginResSubscription: Subscription; + environmentsInfo: EnvironmentsInfo; sessionVerinfo: VersionInfo2Response; @@ -110,7 +122,11 @@ export class GroupComponent implements OnInit, OnDestroy { private queryProtocolService: QueryProtocolService, private statusProtocolService: StatusProtocolService, private logger: NGXLogger - ) {} + ) { + this.environmentsInfo = this.sessionStorageService.get( + KEY_ENVIRONMENTS_INFO + ); + } ngOnInit() { this.sessionVerinfo = this.sessionStorageService.get( @@ -132,31 +148,35 @@ export class GroupComponent implements OnInit, OnDestroy { select(AppStore.SettingSelector.CompanySelector.companyList) ); - this.groupBuddyList$ = combineLatest([ + this.groupBuddyListSubscription = combineLatest([ this.store.pipe( select(AppStore.MessengerSelector.SyncSelector.selectAllBuddy2) ), this.store.pipe( select(AppStore.MessengerSelector.SyncSelector.selectAllGroup2) ) - ]).pipe( - map(([buddyList, groupList]) => { - 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; - }) - }); - } + ]) + .pipe( + map(([buddyList, groupList]) => { + 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; + }) + }); + } - return groupBuddyList; - }) - ); + this.groupBuddyList = groupBuddyList; + + return groupBuddyList; + }) + ) + .subscribe(); this.favoritBuddyList$ = this.store .pipe(select(AppStore.MessengerSelector.SyncSelector.selectAllBuddy2)) @@ -173,6 +193,9 @@ export class GroupComponent implements OnInit, OnDestroy { if (!!this.loginResSubscription) { this.loginResSubscription.unsubscribe(); } + if (!!this.groupBuddyListSubscription) { + this.groupBuddyListSubscription.unsubscribe(); + } this.logger.debug('-----------------------GroupComponent ngOnDestroy'); } @@ -333,7 +356,7 @@ export class GroupComponent implements OnInit, OnDestroy { if (!group || group === undefined) { if ( menuType === 'REGISTER_FAVORITE' || - menuType === 'SEND_NOTE' || + menuType === 'SEND_MESSAGE' || menuType === 'REGISTER_NICKNAME' ) { // continue; @@ -465,6 +488,25 @@ export class GroupComponent implements OnInit, OnDestroy { }) ); break; + 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; } } @@ -501,7 +543,30 @@ export class GroupComponent implements OnInit, OnDestroy { ChatStore.openRoom({ userSeqList: group.userSeqs }) ); break; - case 'SEND_NOTE': + case 'SEND_MESSAGE': + { + const curGroupBuddyList = this.groupBuddyList.filter( + groupInfo => groupInfo.group.seq === group.seq + ); + + if (!!curGroupBuddyList && curGroupBuddyList.length > 0) { + this.dialogService.open< + MessageWriteDialogComponent, + MessageWriteDialogData, + MessageWriteDialogResult + >(MessageWriteDialogComponent, { + width: '600px', + height: '600px', + disableClose: true, + hasBackdrop: false, + data: { + loginRes: this.loginRes, + environmentsInfo: this.environmentsInfo, + receiverList: curGroupBuddyList[0].buddyList + } + }); + } + } break; case 'RENAME': { diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/message.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/message.component.ts index dff61f31..2f51dfcd 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/message.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/message.component.ts @@ -48,6 +48,7 @@ import { MessageDetailDialogResult, MessageDetailDialogData } from '../../dialogs/message/message-detail.dialog.component'; +import { EnvironmentsInfo, KEY_ENVIRONMENTS_INFO } from '@app/types'; @Component({ selector: 'app-layout-chat-left-sidenav-message', @@ -70,6 +71,7 @@ export class MessageBoxComponent loginRes: LoginResponse; sessionVerinfo: VersionInfo2Response; + environmentsInfo: EnvironmentsInfo; messageList: MessageList[] = []; @@ -108,6 +110,9 @@ export class MessageBoxComponent this.sessionVerinfo = this.sessionStorageService.get( KEY_VER_INFO ); + this.environmentsInfo = this.sessionStorageService.get( + KEY_ENVIRONMENTS_INFO + ); } ngOnInit() { @@ -357,7 +362,8 @@ export class MessageBoxComponent width: '600px', data: { detail: res, - loginRes: this.loginRes + loginRes: this.loginRes, + environmentsInfo: this.environmentsInfo } }); diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/message/message-detail.dialog.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/message/message-detail.dialog.component.ts index dda9dcc0..78a96bff 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/message/message-detail.dialog.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/message/message-detail.dialog.component.ts @@ -34,10 +34,17 @@ import { NGXLogger } from 'ngx-logger'; import { NativeService, UCAP_NATIVE_SERVICE } from '@ucap-webmessenger/native'; import { MessageStatusCode } from '@ucap-webmessenger/api'; import { of } from 'rxjs'; +import { + MessageWriteDialogComponent, + MessageWriteDialogResult, + MessageWriteDialogData +} from './message-write.dialog.component'; +import { EnvironmentsInfo } from '@app/types'; export interface MessageDetailDialogData { detail: DetailResponse; loginRes: LoginResponse; + environmentsInfo: EnvironmentsInfo; } export interface MessageDetailDialogResult { @@ -428,6 +435,25 @@ export class MessageDetailDialogComponent implements OnInit { } } break; + case 'MESSAGE_UPDATE': + { + this.dialogService.open< + MessageWriteDialogComponent, + MessageWriteDialogData, + MessageWriteDialogResult + >(MessageWriteDialogComponent, { + width: '600px', + height: '600px', + disableClose: true, + hasBackdrop: false, + data: { + loginRes: this.data.loginRes, + environmentsInfo: this.data.environmentsInfo, + detail: this.data.detail + } + }); + } + break; } } diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/message/message-write.dialog.component.html b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/message/message-write.dialog.component.html index 16eed9f2..094b2b52 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/message/message-write.dialog.component.html +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/message/message-write.dialog.component.html @@ -7,6 +7,8 @@ (MessageWriteDialogComponent, { + width: '600px', + height: '600px', + disableClose: true, + hasBackdrop: false, + data: { + loginRes: this.loginRes, + environmentsInfo: this.environmentsInfo, + receiverList: [userInfo] + } + }); + } + } + onClickToggleFavorit(param: { userInfo: UserInfo | UserInfoF; isFavorit: boolean; diff --git a/projects/ucap-webmessenger-ui-message/src/lib/components/write.component.html b/projects/ucap-webmessenger-ui-message/src/lib/components/write.component.html index 0c7979d3..183bd930 100644 --- a/projects/ucap-webmessenger-ui-message/src/lib/components/write.component.html +++ b/projects/ucap-webmessenger-ui-message/src/lib/components/write.component.html @@ -20,24 +20,26 @@ - - - - {{ receiver.name }} - - - - - + + + + + {{ receiver.name }} + + + + + +
diff --git a/projects/ucap-webmessenger-ui-message/src/lib/components/write.component.scss b/projects/ucap-webmessenger-ui-message/src/lib/components/write.component.scss index 5bb4af7e..91d3ac2e 100644 --- a/projects/ucap-webmessenger-ui-message/src/lib/components/write.component.scss +++ b/projects/ucap-webmessenger-ui-message/src/lib/components/write.component.scss @@ -4,6 +4,7 @@ .message-receiver-list { width: 100%; + height: 100px; } .message-title { @@ -18,7 +19,7 @@ display: inline-block; width: 100%; height: 100%; - min-height: 270px; + min-height: 250px; } [contenteditable] { diff --git a/projects/ucap-webmessenger-ui-message/src/lib/components/write.component.ts b/projects/ucap-webmessenger-ui-message/src/lib/components/write.component.ts index 2b1c6ac6..f06043bf 100644 --- a/projects/ucap-webmessenger-ui-message/src/lib/components/write.component.ts +++ b/projects/ucap-webmessenger-ui-message/src/lib/components/write.component.ts @@ -7,7 +7,8 @@ import { AfterViewInit, ChangeDetectorRef, OnDestroy, - ElementRef + ElementRef, + Input } from '@angular/core'; import { ucapAnimations, DialogService } from '@ucap-webmessenger/ui'; @@ -17,11 +18,13 @@ import { NGXLogger } from 'ngx-logger'; import moment from 'moment'; import { FileUtil } from '@ucap-webmessenger/core'; -import { FormGroup, FormBuilder, Validators } from '@angular/forms'; +import { FormGroup, FormBuilder } from '@angular/forms'; import { ContentType, CategoryType, - MessageType + MessageType, + DetailResponse, + DetailReceiver } from '@ucap-webmessenger/api-message'; import { FileUploadItem } from '@ucap-webmessenger/api'; import { UserInfo } from '@ucap-webmessenger/protocol-sync'; @@ -30,6 +33,8 @@ import { ScheduleSendDialogData, ScheduleSendDialogResult } from '../dialogs/schedule-send.dialog.component'; +import { RoleCode } from '@ucap-webmessenger/protocol-authentication'; +import { EmployeeType } from '@ucap-webmessenger/protocol-room'; const ATTR_FILE = 'UCAP_ATTR_FILE'; @@ -58,6 +63,11 @@ export interface Message { animations: ucapAnimations }) export class WriteComponent implements OnInit, OnDestroy, AfterViewInit { + @Input() + curReceiverList: UserInfo[] = []; + @Input() + detail?: DetailResponse; + @Output() send = new EventEmitter(); @@ -79,6 +89,8 @@ export class WriteComponent implements OnInit, OnDestroy, AfterViewInit { receiverList: UserInfo[] = []; contentLength = 0; + isModify = false; + constructor( private formBuilder: FormBuilder, private dialogService: DialogService, @@ -90,6 +102,27 @@ export class WriteComponent implements OnInit, OnDestroy, AfterViewInit { this.messageWriteForm = this.formBuilder.group({ title: ['', []] }); + + if (!!this.curReceiverList && this.curReceiverList.length > 0) { + this.receiverList = this.curReceiverList; + } else if (!!this.detail && this.detail.recvList.length > 0) { + this.receiverList = this.detail.recvList.map(recvInfo => + this.convertDetailReceivertoUserInfo(recvInfo) + ); + } + + if (!!this.detail && !!this.detail.msgInfo) { + this.isModify = true; + + if (!!this.detail.msgInfo.title) { + this.messageWriteForm.setValue({ title: this.detail.msgInfo.title }); + } + + if (!!this.detail.contents && this.detail.contents.length > 0) { + // 내용이 있다. + this.detail.contents.map(cont => console.log(cont)); + } + } } ngOnDestroy(): void {} @@ -379,4 +412,38 @@ export class WriteComponent implements OnInit, OnDestroy, AfterViewInit { range.insertNode(node); } + + private convertDetailReceivertoUserInfo(base: DetailReceiver): UserInfo { + return { + seq: base.userSeq, + name: base.userName, + profileImageFile: '', + grade: '', + intro: '', + companyCode: '', + hpNumber: '', + lineNumber: '', + email: '', + isMobile: false, + deptName: '', + isFavorit: false, + isBuddy: false, + isActive: false, + roleCd: RoleCode.Self, + employeeNum: '', + madn: '', + hardSadn: '', + fmcSadn: '', + nameEn: '', + nameCn: '', + gradeEn: '', + gradeCn: '', + deptNameEn: '', + deptNameCn: '', + isPrivacyAgree: false, + isValidLogin: false, + employeeType: EmployeeType.Regular, + nickName: '' + }; + } } diff --git a/projects/ucap-webmessenger-ui-profile/src/lib/components/profile.component.ts b/projects/ucap-webmessenger-ui-profile/src/lib/components/profile.component.ts index 232b470b..10a54c46 100644 --- a/projects/ucap-webmessenger-ui-profile/src/lib/components/profile.component.ts +++ b/projects/ucap-webmessenger-ui-profile/src/lib/components/profile.component.ts @@ -33,6 +33,8 @@ export class ProfileComponent implements OnInit { @Output() openChat = new EventEmitter(); @Output() + sendMessage = new EventEmitter(); + @Output() toggleFavorit = new EventEmitter<{ userInfo: UserInfo | UserInfoF; isFavorit: boolean; @@ -65,7 +67,9 @@ export class ProfileComponent implements OnInit { onClickVideoConference() {} - onClickMessage() {} + onClickMessage() { + this.sendMessage.emit(this.userInfo); + } onToggleFavorit() { this.isFavorit = !this.isFavorit;