쪽지 연결.

This commit is contained in:
leejinho 2019-12-11 08:18:32 +09:00
parent b81975be9b
commit 4e5ace1d40
12 changed files with 259 additions and 56 deletions

View File

@ -27,7 +27,7 @@
> >
<ucap-group-expansion-panel <ucap-group-expansion-panel
#groupExpansionPanel #groupExpansionPanel
[groupBuddyList]="groupBuddyList$ | async" [groupBuddyList]="groupBuddyList"
[favoritBuddyList]="favoritBuddyList$ | async" [favoritBuddyList]="favoritBuddyList$ | async"
[myProfileInfo]="loginRes.userInfo" [myProfileInfo]="loginRes.userInfo"
(more)="onMoreGroup($event)" (more)="onMoreGroup($event)"
@ -190,8 +190,8 @@
</button> </button>
<button <button
mat-menu-item mat-menu-item
*ngIf="getShowProfileContextMenu('SEND_NOTE', userInfo, group)" *ngIf="getShowProfileContextMenu('SEND_MESSAGE', userInfo, group)"
(click)="onClickProfileContextMenu('SEND_NOTE', userInfo)" (click)="onClickProfileContextMenu('SEND_MESSAGE', userInfo)"
> >
쪽지 보내기 쪽지 보내기
</button> </button>
@ -227,8 +227,8 @@
</button> </button>
<button <button
mat-menu-item mat-menu-item
*ngIf="getShowGroupContextMenu('SEND_NOTE', group)" *ngIf="getShowGroupContextMenu('SEND_MESSAGE', group)"
(click)="onClickGroupContextMenu('SEND_NOTE', group)" (click)="onClickGroupContextMenu('SEND_MESSAGE', group)"
> >
그룹 쪽지 보내기 그룹 쪽지 보내기
</button> </button>

View File

@ -21,7 +21,13 @@ import { NGXLogger } from 'ngx-logger';
import { Company } from '@ucap-webmessenger/api-external'; import { Company } from '@ucap-webmessenger/api-external';
import { SessionStorageService } from '@ucap-webmessenger/web-storage'; import { SessionStorageService } from '@ucap-webmessenger/web-storage';
import { VersionInfo2Response } from '@ucap-webmessenger/api-public'; 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 { KEY_VER_INFO } from '@app/types/ver-info.type';
import { ExpansionPanelComponent as GroupExpansionPanelComponent } from '@ucap-webmessenger/ui-group'; import { ExpansionPanelComponent as GroupExpansionPanelComponent } from '@ucap-webmessenger/ui-group';
@ -61,6 +67,11 @@ import {
SelectGroupDialogResult, SelectGroupDialogResult,
SelectGroupDialogData SelectGroupDialogData
} from '../../dialogs/group/select-group.dialog.component'; } from '../../dialogs/group/select-group.dialog.component';
import {
MessageWriteDialogComponent,
MessageWriteDialogResult,
MessageWriteDialogData
} from '../../dialogs/message/message-write.dialog.component';
@Component({ @Component({
selector: 'app-layout-chat-left-sidenav-group', selector: 'app-layout-chat-left-sidenav-group',
@ -87,15 +98,16 @@ export class GroupComponent implements OnInit, OnDestroy {
groupContextMenuTrigger: MatMenuTrigger; groupContextMenuTrigger: MatMenuTrigger;
groupContextMenuPosition = { x: '0px', y: '0px' }; groupContextMenuPosition = { x: '0px', y: '0px' };
groupBuddyList$: Observable< groupBuddyList: { group: GroupDetailData; buddyList: UserInfo[] }[];
{ group: GroupDetailData; buddyList: UserInfo[] }[] groupBuddyListSubscription: Subscription;
>;
favoritBuddyList$: Observable<UserInfo[]>; favoritBuddyList$: Observable<UserInfo[]>;
companyList$: Observable<Company[]>; companyList$: Observable<Company[]>;
companyCode: string; companyCode: string;
loginRes: LoginResponse; loginRes: LoginResponse;
loginResSubscription: Subscription; loginResSubscription: Subscription;
environmentsInfo: EnvironmentsInfo;
sessionVerinfo: VersionInfo2Response; sessionVerinfo: VersionInfo2Response;
@ -110,7 +122,11 @@ export class GroupComponent implements OnInit, OnDestroy {
private queryProtocolService: QueryProtocolService, private queryProtocolService: QueryProtocolService,
private statusProtocolService: StatusProtocolService, private statusProtocolService: StatusProtocolService,
private logger: NGXLogger private logger: NGXLogger
) {} ) {
this.environmentsInfo = this.sessionStorageService.get<EnvironmentsInfo>(
KEY_ENVIRONMENTS_INFO
);
}
ngOnInit() { ngOnInit() {
this.sessionVerinfo = this.sessionStorageService.get<VersionInfo2Response>( this.sessionVerinfo = this.sessionStorageService.get<VersionInfo2Response>(
@ -132,14 +148,15 @@ export class GroupComponent implements OnInit, OnDestroy {
select(AppStore.SettingSelector.CompanySelector.companyList) select(AppStore.SettingSelector.CompanySelector.companyList)
); );
this.groupBuddyList$ = combineLatest([ this.groupBuddyListSubscription = combineLatest([
this.store.pipe( this.store.pipe(
select(AppStore.MessengerSelector.SyncSelector.selectAllBuddy2) select(AppStore.MessengerSelector.SyncSelector.selectAllBuddy2)
), ),
this.store.pipe( this.store.pipe(
select(AppStore.MessengerSelector.SyncSelector.selectAllGroup2) select(AppStore.MessengerSelector.SyncSelector.selectAllGroup2)
) )
]).pipe( ])
.pipe(
map(([buddyList, groupList]) => { map(([buddyList, groupList]) => {
const groupBuddyList: { const groupBuddyList: {
group: GroupDetailData; group: GroupDetailData;
@ -154,9 +171,12 @@ export class GroupComponent implements OnInit, OnDestroy {
}); });
} }
this.groupBuddyList = groupBuddyList;
return groupBuddyList; return groupBuddyList;
}) })
); )
.subscribe();
this.favoritBuddyList$ = this.store this.favoritBuddyList$ = this.store
.pipe(select(AppStore.MessengerSelector.SyncSelector.selectAllBuddy2)) .pipe(select(AppStore.MessengerSelector.SyncSelector.selectAllBuddy2))
@ -173,6 +193,9 @@ export class GroupComponent implements OnInit, OnDestroy {
if (!!this.loginResSubscription) { if (!!this.loginResSubscription) {
this.loginResSubscription.unsubscribe(); this.loginResSubscription.unsubscribe();
} }
if (!!this.groupBuddyListSubscription) {
this.groupBuddyListSubscription.unsubscribe();
}
this.logger.debug('-----------------------GroupComponent ngOnDestroy'); this.logger.debug('-----------------------GroupComponent ngOnDestroy');
} }
@ -333,7 +356,7 @@ export class GroupComponent implements OnInit, OnDestroy {
if (!group || group === undefined) { if (!group || group === undefined) {
if ( if (
menuType === 'REGISTER_FAVORITE' || menuType === 'REGISTER_FAVORITE' ||
menuType === 'SEND_NOTE' || menuType === 'SEND_MESSAGE' ||
menuType === 'REGISTER_NICKNAME' menuType === 'REGISTER_NICKNAME'
) { ) {
// continue; // continue;
@ -465,6 +488,25 @@ export class GroupComponent implements OnInit, OnDestroy {
}) })
); );
break; 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 }) ChatStore.openRoom({ userSeqList: group.userSeqs })
); );
break; 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; break;
case 'RENAME': case 'RENAME':
{ {

View File

@ -48,6 +48,7 @@ import {
MessageDetailDialogResult, MessageDetailDialogResult,
MessageDetailDialogData MessageDetailDialogData
} from '../../dialogs/message/message-detail.dialog.component'; } from '../../dialogs/message/message-detail.dialog.component';
import { EnvironmentsInfo, KEY_ENVIRONMENTS_INFO } from '@app/types';
@Component({ @Component({
selector: 'app-layout-chat-left-sidenav-message', selector: 'app-layout-chat-left-sidenav-message',
@ -70,6 +71,7 @@ export class MessageBoxComponent
loginRes: LoginResponse; loginRes: LoginResponse;
sessionVerinfo: VersionInfo2Response; sessionVerinfo: VersionInfo2Response;
environmentsInfo: EnvironmentsInfo;
messageList: MessageList[] = []; messageList: MessageList[] = [];
@ -108,6 +110,9 @@ export class MessageBoxComponent
this.sessionVerinfo = this.sessionStorageService.get<VersionInfo2Response>( this.sessionVerinfo = this.sessionStorageService.get<VersionInfo2Response>(
KEY_VER_INFO KEY_VER_INFO
); );
this.environmentsInfo = this.sessionStorageService.get<EnvironmentsInfo>(
KEY_ENVIRONMENTS_INFO
);
} }
ngOnInit() { ngOnInit() {
@ -357,7 +362,8 @@ export class MessageBoxComponent
width: '600px', width: '600px',
data: { data: {
detail: res, detail: res,
loginRes: this.loginRes loginRes: this.loginRes,
environmentsInfo: this.environmentsInfo
} }
}); });

View File

@ -34,10 +34,17 @@ import { NGXLogger } from 'ngx-logger';
import { NativeService, UCAP_NATIVE_SERVICE } from '@ucap-webmessenger/native'; import { NativeService, UCAP_NATIVE_SERVICE } from '@ucap-webmessenger/native';
import { MessageStatusCode } from '@ucap-webmessenger/api'; import { MessageStatusCode } from '@ucap-webmessenger/api';
import { of } from 'rxjs'; import { of } from 'rxjs';
import {
MessageWriteDialogComponent,
MessageWriteDialogResult,
MessageWriteDialogData
} from './message-write.dialog.component';
import { EnvironmentsInfo } from '@app/types';
export interface MessageDetailDialogData { export interface MessageDetailDialogData {
detail: DetailResponse; detail: DetailResponse;
loginRes: LoginResponse; loginRes: LoginResponse;
environmentsInfo: EnvironmentsInfo;
} }
export interface MessageDetailDialogResult { export interface MessageDetailDialogResult {
@ -428,6 +435,25 @@ export class MessageDetailDialogComponent implements OnInit {
} }
} }
break; 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;
} }
} }

View File

@ -7,6 +7,8 @@
<mat-card-content> <mat-card-content>
<ucap-message-write <ucap-message-write
#messageWrite #messageWrite
[detail]="data.detail"
[curReceiverList]="data.receiverList"
(send)="onSend($event)" (send)="onSend($event)"
(selectReceiver)="onSelectReceiver($event)" (selectReceiver)="onSelectReceiver($event)"
(cancel)="onCancel()" (cancel)="onCancel()"

View File

@ -6,7 +6,8 @@ import { DialogService, SnackBarService } from '@ucap-webmessenger/ui';
import { import {
DetailResponse, DetailResponse,
DetailContent, DetailContent,
MessageApiService MessageApiService,
DetailReceiver
} from '@ucap-webmessenger/api-message'; } from '@ucap-webmessenger/api-message';
import { LoginResponse } from '@ucap-webmessenger/protocol-authentication'; import { LoginResponse } from '@ucap-webmessenger/protocol-authentication';
@ -29,6 +30,7 @@ export interface MessageWriteDialogData {
loginRes: LoginResponse; loginRes: LoginResponse;
environmentsInfo: EnvironmentsInfo; environmentsInfo: EnvironmentsInfo;
detail?: DetailResponse; detail?: DetailResponse;
receiverList?: UserInfo[];
} }
// tslint:disable-next-line: no-empty-interface // tslint:disable-next-line: no-empty-interface
@ -117,7 +119,7 @@ export class MessageWriteDialogComponent implements OnInit {
duration: 3000, duration: 3000,
verticalPosition: 'bottom' verticalPosition: 'bottom'
}); });
this.dialogRef.close({}); // this.dialogRef.close({});
} }
); );
} }

View File

@ -5,6 +5,7 @@
[isBuddy]="isBuddy" [isBuddy]="isBuddy"
[isFavorit]="isFavorit" [isFavorit]="isFavorit"
(openChat)="onClickChat($event)" (openChat)="onClickChat($event)"
(sendMessage)="onClickSendMessage($event)"
(toggleFavorit)="onClickToggleFavorit($event)" (toggleFavorit)="onClickToggleFavorit($event)"
(toggleBuddy)="onClickToggleBuddy($event)" (toggleBuddy)="onClickToggleBuddy($event)"
(uploadProfileImage)="onUploadProfileImage($event)" (uploadProfileImage)="onUploadProfileImage($event)"

View File

@ -36,6 +36,11 @@ import { FileUploadItem } from '@ucap-webmessenger/api';
import { CommonApiService } from '@ucap-webmessenger/api-common'; import { CommonApiService } from '@ucap-webmessenger/api-common';
import { EnvironmentsInfo, KEY_ENVIRONMENTS_INFO } from '@app/types'; import { EnvironmentsInfo, KEY_ENVIRONMENTS_INFO } from '@app/types';
import { StatusCode } from '@ucap-webmessenger/api'; import { StatusCode } from '@ucap-webmessenger/api';
import {
MessageWriteDialogComponent,
MessageWriteDialogResult,
MessageWriteDialogData
} from '../message/message-write.dialog.component';
export interface ProfileDialogData { export interface ProfileDialogData {
userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN; userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN;
@ -119,6 +124,28 @@ export class ProfileDialogComponent implements OnInit, OnDestroy {
this.dialogRef.close(); this.dialogRef.close();
} }
onClickSendMessage(userInfo: UserInfo) {
if (userInfo.seq !== this.loginRes.userSeq) {
this.dialogRef.close();
this.dialogService.open<
MessageWriteDialogComponent,
MessageWriteDialogData,
MessageWriteDialogResult
>(MessageWriteDialogComponent, {
width: '600px',
height: '600px',
disableClose: true,
hasBackdrop: false,
data: {
loginRes: this.loginRes,
environmentsInfo: this.environmentsInfo,
receiverList: [userInfo]
}
});
}
}
onClickToggleFavorit(param: { onClickToggleFavorit(param: {
userInfo: UserInfo | UserInfoF; userInfo: UserInfo | UserInfoF;
isFavorit: boolean; isFavorit: boolean;

View File

@ -20,6 +20,7 @@
</mat-list> </mat-list>
</mat-card-content> </mat-card-content>
<perfect-scrollbar>
<mat-form-field class="message-receiver-list"> <mat-form-field class="message-receiver-list">
<mat-chip-list #chipList aria-label="receiver selection"> <mat-chip-list #chipList aria-label="receiver selection">
<mat-chip <mat-chip
@ -38,6 +39,7 @@
/> />
</mat-chip-list> </mat-chip-list>
</mat-form-field> </mat-form-field>
</perfect-scrollbar>
<mat-card-actions> <mat-card-actions>
<div class="editor-tools"> <div class="editor-tools">

View File

@ -4,6 +4,7 @@
.message-receiver-list { .message-receiver-list {
width: 100%; width: 100%;
height: 100px;
} }
.message-title { .message-title {
@ -18,7 +19,7 @@
display: inline-block; display: inline-block;
width: 100%; width: 100%;
height: 100%; height: 100%;
min-height: 270px; min-height: 250px;
} }
[contenteditable] { [contenteditable] {

View File

@ -7,7 +7,8 @@ import {
AfterViewInit, AfterViewInit,
ChangeDetectorRef, ChangeDetectorRef,
OnDestroy, OnDestroy,
ElementRef ElementRef,
Input
} from '@angular/core'; } from '@angular/core';
import { ucapAnimations, DialogService } from '@ucap-webmessenger/ui'; import { ucapAnimations, DialogService } from '@ucap-webmessenger/ui';
@ -17,11 +18,13 @@ import { NGXLogger } from 'ngx-logger';
import moment from 'moment'; import moment from 'moment';
import { FileUtil } from '@ucap-webmessenger/core'; import { FileUtil } from '@ucap-webmessenger/core';
import { FormGroup, FormBuilder, Validators } from '@angular/forms'; import { FormGroup, FormBuilder } from '@angular/forms';
import { import {
ContentType, ContentType,
CategoryType, CategoryType,
MessageType MessageType,
DetailResponse,
DetailReceiver
} from '@ucap-webmessenger/api-message'; } from '@ucap-webmessenger/api-message';
import { FileUploadItem } from '@ucap-webmessenger/api'; import { FileUploadItem } from '@ucap-webmessenger/api';
import { UserInfo } from '@ucap-webmessenger/protocol-sync'; import { UserInfo } from '@ucap-webmessenger/protocol-sync';
@ -30,6 +33,8 @@ import {
ScheduleSendDialogData, ScheduleSendDialogData,
ScheduleSendDialogResult ScheduleSendDialogResult
} from '../dialogs/schedule-send.dialog.component'; } 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'; const ATTR_FILE = 'UCAP_ATTR_FILE';
@ -58,6 +63,11 @@ export interface Message {
animations: ucapAnimations animations: ucapAnimations
}) })
export class WriteComponent implements OnInit, OnDestroy, AfterViewInit { export class WriteComponent implements OnInit, OnDestroy, AfterViewInit {
@Input()
curReceiverList: UserInfo[] = [];
@Input()
detail?: DetailResponse;
@Output() @Output()
send = new EventEmitter<Message>(); send = new EventEmitter<Message>();
@ -79,6 +89,8 @@ export class WriteComponent implements OnInit, OnDestroy, AfterViewInit {
receiverList: UserInfo[] = []; receiverList: UserInfo[] = [];
contentLength = 0; contentLength = 0;
isModify = false;
constructor( constructor(
private formBuilder: FormBuilder, private formBuilder: FormBuilder,
private dialogService: DialogService, private dialogService: DialogService,
@ -90,6 +102,27 @@ export class WriteComponent implements OnInit, OnDestroy, AfterViewInit {
this.messageWriteForm = this.formBuilder.group({ this.messageWriteForm = this.formBuilder.group({
title: ['', []] 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 {} ngOnDestroy(): void {}
@ -379,4 +412,38 @@ export class WriteComponent implements OnInit, OnDestroy, AfterViewInit {
range.insertNode(node); 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: ''
};
}
} }

View File

@ -33,6 +33,8 @@ export class ProfileComponent implements OnInit {
@Output() @Output()
openChat = new EventEmitter<UserInfo | UserInfoF>(); openChat = new EventEmitter<UserInfo | UserInfoF>();
@Output() @Output()
sendMessage = new EventEmitter<UserInfo | UserInfoF>();
@Output()
toggleFavorit = new EventEmitter<{ toggleFavorit = new EventEmitter<{
userInfo: UserInfo | UserInfoF; userInfo: UserInfo | UserInfoF;
isFavorit: boolean; isFavorit: boolean;
@ -65,7 +67,9 @@ export class ProfileComponent implements OnInit {
onClickVideoConference() {} onClickVideoConference() {}
onClickMessage() {} onClickMessage() {
this.sendMessage.emit(this.userInfo);
}
onToggleFavorit() { onToggleFavorit() {
this.isFavorit = !this.isFavorit; this.isFavorit = !this.isFavorit;