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 4c7f704a..d3a26a22 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 @@ -10,7 +10,7 @@ [isModify]="isModify" [detail]="data.detail" [detailContents]="data.detailContents" - [curReceiverList]="data.receiverList" + [curReceiverList]="curReceiverList" [fileAllowSize]="fileAllowSize" (send)="onSend($event)" (selectReceiver)="onSelectReceiver($event)" diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/message/message-write.dialog.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/message/message-write.dialog.component.ts index 14acd2ef..c388fa50 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/message/message-write.dialog.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/message/message-write.dialog.component.ts @@ -7,10 +7,14 @@ import { DetailResponse, DetailContent, MessageApiService, - MessageType + MessageType, + DetailReceiver } from '@ucap-webmessenger/api-message'; -import { LoginResponse } from '@ucap-webmessenger/protocol-authentication'; +import { + LoginResponse, + RoleCode +} from '@ucap-webmessenger/protocol-authentication'; import { NGXLogger } from 'ngx-logger'; import { WriteComponent as UCapMessageWriteComponent, @@ -34,6 +38,7 @@ import { TranslateService } from '@ngx-translate/core'; import { VersionInfo2Response } from '@ucap-webmessenger/api-public'; import { SessionStorageService } from '@ucap-webmessenger/web-storage'; import { environment } from '../../../../../environments/environment'; +import { EmployeeType } from '@ucap-webmessenger/protocol-room'; export interface MessageWriteDialogData { loginRes: LoginResponse; @@ -62,6 +67,8 @@ export class MessageWriteDialogComponent implements OnInit { @ViewChild('messageWrite', { static: true }) messageWrite: UCapMessageWriteComponent; + curReceiverList: (UserInfo | UserInfoSS)[]; + sessionVerInfo: VersionInfo2Response; fileAllowSize: number; @@ -94,6 +101,11 @@ export class MessageWriteDialogComponent implements OnInit { if (!!this.data.detail && !!this.data.detail.msgInfo) { this.isModify = true; + this.curReceiverList = this.data.detail.recvList.map(recvInfo => + this.convertDetailReceivertoUserInfo(recvInfo) + ); + } else { + this.curReceiverList = this.data.receiverList; } } @@ -112,12 +124,14 @@ export class MessageWriteDialogComponent implements OnInit { }); if (!!result && !!result.choice && result.choice) { - while (receiverList.length) { - receiverList.pop(); - } + // while (receiverList.length) { + // receiverList.pop(); + // } + const selectedUserList: UserInfo[] = []; result.selectedUserList.forEach(v => { - receiverList.push(v as UserInfo); + selectedUserList.push(v as UserInfo); }); + this.curReceiverList = selectedUserList; } } @@ -220,4 +234,40 @@ export class MessageWriteDialogComponent implements OnInit { getBtnValid() { return true; } + + 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: '', + + order: '' + }; + } } 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 7f5fcd93..88c1259b 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 @@ -13,7 +13,7 @@ }} {{ 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 06836207..a5eeabe3 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 @@ -79,7 +79,11 @@ export interface MessageModify extends Message { }) export class WriteComponent implements OnInit, OnDestroy, AfterViewInit { @Input() - curReceiverList: UserInfo[] = []; + set curReceiverList(userInfoList: UserInfo[]) { + if (!!userInfoList && userInfoList.length > 0) { + this.receiverList = userInfoList; + } + } @Input() detail?: DetailResponse; @Input() @@ -122,14 +126,6 @@ export class WriteComponent implements OnInit, OnDestroy, AfterViewInit { 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.isModify) { if (!!this.detail.msgInfo.title) { this.messageWriteForm.setValue({ title: this.detail.msgInfo.title }); @@ -563,40 +559,4 @@ 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: '', - - order: '' - }; - } }