From 967d25c155fbd9b8222554e7c325c1166b50bb17 Mon Sep 17 00:00:00 2001 From: leejinho Date: Thu, 12 Dec 2019 15:11:49 +0900 Subject: [PATCH] =?UTF-8?q?=EC=98=88=EC=95=BD=EC=AA=BD=EC=A7=80=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20=EA=B8=B0=EB=8A=A5=20=EA=B5=AC=ED=98=84.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/lib/apis/edit-reservation-ex.ts | 61 +++++++- .../src/lib/services/message-api.service.ts | 43 ++++-- .../components/left-side.component.html | 1 + .../components/left-side.component.ts | 41 ++++-- .../left-sidenav/message.component.ts | 7 + .../message-detail.dialog.component.html | 20 ++- .../message-detail.dialog.component.ts | 54 ++++++- .../message-write.dialog.component.html | 6 +- .../message/message-write.dialog.component.ts | 61 +++++++- .../src/lib/components/write.component.html | 26 ++++ .../src/lib/components/write.component.ts | 139 +++++++++++++----- .../dialogs/schedule-send.dialog.component.ts | 10 +- 12 files changed, 385 insertions(+), 84 deletions(-) diff --git a/projects/ucap-webmessenger-api-message/src/lib/apis/edit-reservation-ex.ts b/projects/ucap-webmessenger-api-message/src/lib/apis/edit-reservation-ex.ts index a18a4bb0..70bfe827 100644 --- a/projects/ucap-webmessenger-api-message/src/lib/apis/edit-reservation-ex.ts +++ b/projects/ucap-webmessenger-api-message/src/lib/apis/edit-reservation-ex.ts @@ -2,7 +2,10 @@ import { APIRequest, MessageAPIResponse, APIJsonEncoder, - APIDecoder + APIDecoder, + FileUploadItem, + ParameterUtil, + APIFormDataEncoder } from '@ucap-webmessenger/api'; import { DeviceType } from '@ucap-webmessenger/core'; import { CategoryType } from '../types/category.type'; @@ -17,19 +20,69 @@ export interface EditReservationRequest extends APIRequest { title: string; titleYn: boolean; listOrder: ContentType[]; + resSeqList: number[]; reservationTime: string; - smsYn: boolean; + smsYn?: boolean; textContent: { text: string }[]; recvUserList: { userSeq: number; userName: string }[]; + + files?: File[]; + fileUploadItem?: FileUploadItem; } export interface EditReservationResponse extends MessageAPIResponse {} -export const encodeEditReservation: APIJsonEncoder = ( +const editReservationEncodeMap = { + userSeq: 'userSeq', + deviceType: 'deviceType', + tokenKey: 'tokenKey', + msgId: 'msgId', + category: 'category', + title: 'title', + titleYn: 'titleYn', + listOrder: 'listOrder', + resSeqList: 'resSeqList', + reservationTime: 'reservationTime', + smsYn: 'smsYn', + textContent: 'textContent', + recvUserList: 'recvUserList', + files: 'files' +}; + +export const encodeEditReservation: APIFormDataEncoder = ( req: EditReservationRequest ) => { - return JSON.stringify(req); + const extraParams: any = {}; + + extraParams.userSeq = String(req.userSeq); + if (!!req.titleYn) { + extraParams.titleYn = req.titleYn ? 'Y' : 'N'; + } + if (!!req.smsYn) { + extraParams.smsYn = req.smsYn ? 'Y' : 'N'; + } + if (!!req.listOrder) { + let s = ''; + req.listOrder.forEach(v => { + s = s + String(v); + }); + extraParams.listOrder = s; + } + if (!!req.resSeqList) { + extraParams.resSeqList = req.resSeqList.map(v => v.toString()).join(','); + } + if (!!req.textContent) { + extraParams.textContent = JSON.stringify(req.textContent); + } + if (!!req.recvUserList) { + extraParams.recvUserList = JSON.stringify(req.recvUserList); + } + return ParameterUtil.encodeFormData( + editReservationEncodeMap, + req, + extraParams + ); }; export const decodeEditReservation: APIDecoder = ( diff --git a/projects/ucap-webmessenger-api-message/src/lib/services/message-api.service.ts b/projects/ucap-webmessenger-api-message/src/lib/services/message-api.service.ts index 0521c6aa..7f0be966 100644 --- a/projects/ucap-webmessenger-api-message/src/lib/services/message-api.service.ts +++ b/projects/ucap-webmessenger-api-message/src/lib/services/message-api.service.ts @@ -188,6 +188,34 @@ export class MessageApiService { }) ); } + /** edit reservation */ + public editReservationMessageEx( + req: EditReservationRequest + ): Observable { + const httpReq = new HttpRequest( + 'POST', + this.urls.editReservationMessageEx, + encodeEditReservation(req), + { reportProgress: true, responseType: 'text' as 'json' } + ); + + const progress = req.fileUploadItem.uploadStart(); + + return this.httpClient.request(httpReq).pipe( + filter(event => { + if (event instanceof HttpResponse) { + return true; + } else if (HttpEventType.UploadProgress === event.type) { + progress.next(Math.round((100 * event.loaded) / event.total)); + } + return false; + }), + map((event: HttpResponse) => { + req.fileUploadItem.uploadComplete(); + return decodeSend(event.body); + }) + ); + } /** detail */ public detailMessage(req: DetailRequest): Observable { @@ -299,21 +327,6 @@ export class MessageApiService { .pipe(map(res => decodeEditMy(res))); } - /** edit reservation */ - public editReservationMessageEx( - req: EditReservationRequest - ): Observable { - return this.httpClient - .post( - this.urls.editReservationMessageEx, - encodeEditReservation(req), - { - headers: this.headers - } - ) - .pipe(map(res => decodeEditReservation(res))); - } - /** send-copy(forward) */ public sendCopyMessage(req: SendCopyRequest): Observable { return this.httpClient diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-side.component.html b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-side.component.html index d380db62..247261f0 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-side.component.html +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-side.component.html @@ -199,6 +199,7 @@ style="display: none;" > 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 b031b7af..a2256384 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 @@ -7,7 +7,8 @@ import { ViewChildren, QueryList, ElementRef, - OnDestroy + OnDestroy, + ViewChild } from '@angular/core'; import { NGXLogger } from 'ngx-logger'; import { ucapAnimations, DialogService } from '@ucap-webmessenger/ui'; @@ -34,7 +35,7 @@ import { SessionStorageService } from '@ucap-webmessenger/web-storage'; import { KEY_LOGIN_RES_INFO } from '@app/types/login-res-info.type'; import { VersionInfo2Response } from '@ucap-webmessenger/api-public'; import { KEY_VER_INFO } from '@app/types/ver-info.type'; -import { MessageApiService } from '@ucap-webmessenger/api-message'; +import { MessageApiService, MessageType } from '@ucap-webmessenger/api-message'; import { DeviceType } from '@ucap-webmessenger/core'; import { UnreadCountRequest } from 'projects/ucap-webmessenger-api-message/src/lib/apis/unread-count'; import { map, catchError, tap } from 'rxjs/operators'; @@ -45,6 +46,7 @@ import { MessageWriteDialogData } from '../dialogs/message/message-write.dialog.component'; import { EnvironmentsInfo, KEY_ENVIRONMENTS_INFO } from '@app/types'; +import { MessageBoxComponent } from './left-sidenav/message.component'; export enum MainMenu { Group = 'GROUP', @@ -70,6 +72,9 @@ export class LeftSideComponent implements OnInit, OnDestroy { @ViewChildren('tabs') tabs: QueryList>; currentTabLable: string; + @ViewChild('messageBoxComponent', { static: false }) + messageBoxComponent: MessageBoxComponent; + badgeChatUnReadCount: number; badgeChatUnReadCountSubscription: Subscription; badgeMessageUnReadCount: number; @@ -229,20 +234,24 @@ export class LeftSideComponent implements OnInit, OnDestroy { } }); - // if (!!result && !!result.choice && result.choice) { - // if (!!result.selectedUserList && result.selectedUserList.length > 0) { - // const userSeqs: number[] = []; - // result.selectedUserList.map(user => userSeqs.push(user.seq)); - - // if (type === 'NORMAL') { - // this.store.dispatch(ChatStore.openRoom({ userSeqList: userSeqs })); - // } else if (type === 'TIMER') { - // this.store.dispatch( - // ChatStore.openRoom({ userSeqList: userSeqs, isTimeRoom: true }) - // ); - // } - // } - // } + if (!!result && !!result.sendFlag && result.sendFlag) { + if ( + this.currentTabLable === MainMenu.Message && + !!this.messageBoxComponent + ) { + const type = result.sendType || MessageType.Send; + switch (type) { + case MessageType.Send: + this.messageBoxComponent.onSelectedIndexChange(1); + this.messageBoxComponent.onSelectedIndexTab(1); + break; + case MessageType.Reservation: + this.messageBoxComponent.onSelectedIndexChange(2); + this.messageBoxComponent.onSelectedIndexTab(2); + break; + } + } + } } onClickOpenProfile(userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN) { 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 2f51dfcd..e035ce41 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 @@ -154,6 +154,9 @@ export class MessageBoxComponent } } + onSelectedIndexTab(value: number) { + this.tabs.selectedIndex = value; + } onSelectedIndexChange(value: number) { this.currentTabIndex = value; let type: MessageType; @@ -377,6 +380,10 @@ export class MessageBoxComponent // 단건 발송취소(예약) this.doMessageCancelReservation(result.messageInfo); break; + case 'UPDATE': + // 예약 수정 + this.getRetrieveMessage(MessageType.Reservation, 0); + break; } } } else { diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/message/message-detail.dialog.component.html b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/message/message-detail.dialog.component.html index 5b99d12d..c073949b 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/message/message-detail.dialog.component.html +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/message/message-detail.dialog.component.html @@ -42,11 +42,27 @@ {{ getSendReceiverNames() }}
  • - 받은시간 - {{ + 받은시간 + 보낸시간 + 발송예정시간 + {{ messageInfo.regDate | dateToStringFormat: 'YYYY.MM.dd (KS) a/p HH:mm' }} + {{ + messageInfo.reservationTime + | dateToStringFormat: 'YYYY.MM.dd (KS) a/p HH:mm' + }}
  • 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 e48b15cd..f0a0c4b1 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 @@ -180,6 +180,32 @@ export class MessageDetailDialogComponent implements OnInit { } }); } + getBaseImage(): void { + this.contents.forEach(content => { + if (content.resType === ContentType.Image) { + this.messageApiService + .retrieveResourceFile({ + userSeq: this.data.loginRes.userSeq, + deviceType: DeviceType.PC, + tokenKey: this.data.loginRes.tokenString, + type: this.messageInfo.type, + msgId: this.messageInfo.msgId, + resUrl: content.resUrl + } as RetrieveResourceFileRequest) + .pipe( + take(1), + map(async rawBlob => { + const reader = new FileReader(); + reader.readAsDataURL(rawBlob); + reader.onloadend = () => { + content.imageSrc = reader.result; + }; + }) + ) + .subscribe(); + } + }); + } // /** // * @deprecated @@ -442,7 +468,7 @@ export class MessageDetailDialogComponent implements OnInit { break; case 'MESSAGE_UPDATE': { - this.dialogService.open< + const result = await this.dialogService.open< MessageWriteDialogComponent, MessageWriteDialogData, MessageWriteDialogResult @@ -454,14 +480,38 @@ export class MessageDetailDialogComponent implements OnInit { data: { loginRes: this.data.loginRes, environmentsInfo: this.data.environmentsInfo, - detail: this.data.detail + detail: this.data.detail, + detailContents: this.convertContentsToEdit() } }); + + if (!!result && !!result.sendFlag && result.sendFlag) { + this.dialogRef.close({ + returnType: 'UPDATE' + }); + } } break; } } + /** 기존 내용을 editor 에 맞게 컨버팅 한다. */ + private convertContentsToEdit(): string { + // const contents: DetailContent[] = this.data.detail.contents; + const contents = this.contents; + let html = ''; + contents.forEach(content => { + if (content.resType === ContentType.Text) { + html += content.resContent.replace(/\n/g, '
    '); + } else if (content.resType === ContentType.Image) { + html += ``; + } else if (content.resType === ContentType.AttachFile) { + } + html += '
    '; + }); + return html; + } + async cancelSendMessageForUsers() { if ( !!this.unReadUsers && 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 094b2b52..2456ffbc 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 @@ -1,13 +1,13 @@ - - 쪽지 보내기 - + 쪽지 {{ isModify ? '수정' : '보내기' }} { this.snackBarService.open(`쪽지를 전송에 실패 하였습니다.`, '', { @@ -123,9 +142,37 @@ export class MessageWriteDialogComponent implements OnInit { } ); } + onModifySend(message: MessageModify) { + this.messageApiService + .editReservationMessageEx({ + ...message, + userSeq: this.data.loginRes.userInfo.seq, + deviceType: this.data.environmentsInfo.deviceType, + tokenKey: this.data.loginRes.tokenString, + titleYn: '' !== message.title ? true : false + }) + .pipe(take(1)) + .subscribe( + res => { + this.snackBarService.open('쪽지를 수정하였습니다.', '', { + duration: 3000, + verticalPosition: 'bottom' + }); + + this.dialogRef.close({ sendFlag: true, sendType: message.type }); + }, + error => { + this.snackBarService.open(`쪽지 수정에 실패 하였습니다.`, '', { + duration: 3000, + verticalPosition: 'bottom' + }); + // this.dialogRef.close({}); + } + ); + } onCancel() { - this.dialogRef.close({}); + this.dialogRef.close({ sendFlag: false }); } getBtnValid() { 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 183bd930..0a48def7 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 @@ -14,6 +14,16 @@ > + + {{ oldAttachment.resContent }} + + {{ attachment.name }} @@ -80,6 +90,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 f06043bf..3b2910b2 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 @@ -24,7 +24,8 @@ import { CategoryType, MessageType, DetailResponse, - DetailReceiver + DetailReceiver, + DetailContent } from '@ucap-webmessenger/api-message'; import { FileUploadItem } from '@ucap-webmessenger/api'; import { UserInfo } from '@ucap-webmessenger/protocol-sync'; @@ -35,12 +36,14 @@ import { } from '../dialogs/schedule-send.dialog.component'; import { RoleCode } from '@ucap-webmessenger/protocol-authentication'; import { EmployeeType } from '@ucap-webmessenger/protocol-room'; +import { contentTracing } from 'electron'; const ATTR_FILE = 'UCAP_ATTR_FILE'; interface Content { contentType: ContentType; content: string | File; + resSeq: number; } export interface Message { @@ -55,6 +58,11 @@ export interface Message { reservationTime?: string; smsYn?: boolean; } +export interface MessageModify extends Message { + resSeqList: number[]; + reservationTime: string; + msgId: number; +} @Component({ selector: 'ucap-message-write', @@ -67,9 +75,13 @@ export class WriteComponent implements OnInit, OnDestroy, AfterViewInit { curReceiverList: UserInfo[] = []; @Input() detail?: DetailResponse; + @Input() + detailContents?: string; + @Input() + isModify = false; @Output() - send = new EventEmitter(); + send = new EventEmitter(); @Output() cancel = new EventEmitter(); @@ -84,13 +96,12 @@ export class WriteComponent implements OnInit, OnDestroy, AfterViewInit { fileInput: ElementRef; messageWriteForm: FormGroup; + oldAttachmentList: DetailContent[] = []; attachmentList: File[]; fileUploadItem: FileUploadItem; receiverList: UserInfo[] = []; contentLength = 0; - isModify = false; - constructor( private formBuilder: FormBuilder, private dialogService: DialogService, @@ -111,17 +122,21 @@ export class WriteComponent implements OnInit, OnDestroy, AfterViewInit { ); } - if (!!this.detail && !!this.detail.msgInfo) { - this.isModify = true; - + if (this.isModify) { 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)); + if (!!this.detailContents) { + this.editor.nativeElement.innerHTML = this.detailContents; + this.onInputEditor(); } + + this.detail.contents.forEach(content => { + if (content.resType === ContentType.AttachFile) { + this.oldAttachmentList.push(content); + } + }); } } @@ -129,6 +144,12 @@ export class WriteComponent implements OnInit, OnDestroy, AfterViewInit { ngAfterViewInit(): void {} + onClickDeleteOldAttachment(oldAttachment: DetailContent) { + this.oldAttachmentList = this.oldAttachmentList.filter( + detailContent => detailContent.resSeq !== oldAttachment.resSeq + ); + } + onClickImage() { this.fileInput.nativeElement.click(); const self = this; @@ -206,6 +227,10 @@ export class WriteComponent implements OnInit, OnDestroy, AfterViewInit { } async onClickSendSchedule() { + const reservationDate = this.isModify + ? moment(this.detail.msgInfo.reservationTime) + : undefined; + const result = await this.dialogService.open< ScheduleSendDialogComponent, ScheduleSendDialogData, @@ -214,7 +239,9 @@ export class WriteComponent implements OnInit, OnDestroy, AfterViewInit { width: '600px', height: '600px', disableClose: true, - data: {} + data: { + reservationDate + } }); if (!!result && !!result.scheduleSendDate) { @@ -247,7 +274,7 @@ export class WriteComponent implements OnInit, OnDestroy, AfterViewInit { return; } - const { listOrder, textContent, files } = result; + const { listOrder, textContent, files, resSeqList } = result; if (!listOrder || 0 === listOrder.length) { return; @@ -265,19 +292,39 @@ export class WriteComponent implements OnInit, OnDestroy, AfterViewInit { this.fileUploadItem = FileUploadItem.from(); - this.send.emit({ - category: CategoryType.General, - type: !!reservationDate ? MessageType.Reservation : MessageType.Send, - title, - listOrder, - textContent, - recvUserList, - reservationTime: !!reservationDate - ? `${reservationDate.format('YYYY-MM-DD HH:mm')}:00` - : undefined, - files, - fileUploadItem: this.fileUploadItem - }); + if (!this.isModify) { + const message: Message = { + category: CategoryType.General, + type: !!reservationDate ? MessageType.Reservation : MessageType.Send, + title, + listOrder, + textContent, + recvUserList, + reservationTime: !!reservationDate + ? `${reservationDate.format('YYYY-MM-DD HH:mm')}:00` + : undefined, + files, + fileUploadItem: this.fileUploadItem + }; + this.send.emit(message); + } else { + const message: MessageModify = { + category: CategoryType.General, + type: !!reservationDate ? MessageType.Reservation : MessageType.Send, + msgId: this.detail.msgInfo.msgId, + title, + listOrder, + resSeqList, + textContent, + recvUserList, + reservationTime: !!reservationDate + ? `${reservationDate.format('YYYY-MM-DD HH:mm')}:00` + : undefined, + files, + fileUploadItem: this.fileUploadItem + }; + this.send.emit(message); + } } private parseContent(): @@ -285,6 +332,7 @@ export class WriteComponent implements OnInit, OnDestroy, AfterViewInit { listOrder: ContentType[]; textContent: { text: string }[]; files: File[]; + resSeqList: number[]; } | undefined { const contentList: Content[] = this.generateContent(); @@ -295,20 +343,26 @@ export class WriteComponent implements OnInit, OnDestroy, AfterViewInit { const listOrder: ContentType[] = []; const textContent: { text: string }[] = []; const files: File[] = []; + const resSeqList: number[] = []; contentList.forEach(v => { listOrder.push(v.contentType); + resSeqList.push(v.resSeq); switch (v.contentType) { case ContentType.Text: let content = v.content as string; if ('\n' === content.charAt(content.length - 1)) { - content = content.substring(0, content.length - 2); + content = content.substring(0, content.length - 1); } textContent.push({ text: content }); break; case ContentType.Image: case ContentType.AttachFile: - files.push(v.content as File); + { + if (v.resSeq === 0) { + files.push(v.content as File); + } + } break; default: break; @@ -318,7 +372,8 @@ export class WriteComponent implements OnInit, OnDestroy, AfterViewInit { return { listOrder, textContent, - files + files, + resSeqList }; } @@ -329,11 +384,22 @@ export class WriteComponent implements OnInit, OnDestroy, AfterViewInit { this.parseNode(contentList, v); }); + if (!!this.oldAttachmentList && 0 < this.oldAttachmentList.length) { + this.oldAttachmentList.forEach(v => { + contentList.push({ + contentType: ContentType.AttachFile, + content: v.resContent, + resSeq: v.resSeq + }); + }); + } + if (!!this.attachmentList && 0 < this.attachmentList.length) { this.attachmentList.forEach(v => { contentList.push({ contentType: ContentType.AttachFile, - content: v + content: v, + resSeq: 0 }); }); } @@ -362,7 +428,12 @@ export class WriteComponent implements OnInit, OnDestroy, AfterViewInit { } else { if ('IMG' === node.nodeName) { const img: HTMLImageElement = node as HTMLImageElement; - this.appendNode(contentList, ContentType.Image, img[ATTR_FILE]); + this.appendNode( + contentList, + ContentType.Image, + img[ATTR_FILE], + !!img.getAttribute('id') ? Number(img.getAttribute('id')) : 0 + ); } else if ('BR' === node.nodeName) { this.appendNode(contentList, ContentType.Text, `\n`); } else { @@ -382,7 +453,8 @@ export class WriteComponent implements OnInit, OnDestroy, AfterViewInit { private appendNode( contentList: Content[], contentType: ContentType, - content: string | File + content: string | File, + resSeq: number = 0 ) { const prevContent = contentList[contentList.length - 1]; switch (contentType) { @@ -392,12 +464,13 @@ export class WriteComponent implements OnInit, OnDestroy, AfterViewInit { } else { contentList.push({ contentType: ContentType.Text, - content + content, + resSeq }); } break; default: - contentList.push({ contentType, content }); + contentList.push({ contentType, content, resSeq }); break; } } diff --git a/projects/ucap-webmessenger-ui-message/src/lib/dialogs/schedule-send.dialog.component.ts b/projects/ucap-webmessenger-ui-message/src/lib/dialogs/schedule-send.dialog.component.ts index e49d9332..39d15d71 100644 --- a/projects/ucap-webmessenger-ui-message/src/lib/dialogs/schedule-send.dialog.component.ts +++ b/projects/ucap-webmessenger-ui-message/src/lib/dialogs/schedule-send.dialog.component.ts @@ -6,7 +6,9 @@ import { FormGroup, FormBuilder, Validators } from '@angular/forms'; import moment from 'moment'; // tslint:disable-next-line: no-empty-interface -export interface ScheduleSendDialogData {} +export interface ScheduleSendDialogData { + reservationDate?: moment.Moment; +} export interface ScheduleSendDialogResult { scheduleSendDate?: moment.Moment; @@ -48,7 +50,11 @@ export class ScheduleSendDialogComponent implements OnInit { private formBuilder: FormBuilder, private logger: NGXLogger ) { - this.selectedDate = moment().add(1, 'hours'); + if (!!this.data.reservationDate) { + this.selectedDate = this.data.reservationDate; + } else { + this.selectedDate = moment().add(1, 'hours'); + } } ngOnInit(): void {