이벤트 타입 [이벤트(P)] 처리.

This commit is contained in:
leejinho 2019-12-23 16:53:07 +09:00
parent b4a6081edd
commit 166b86677f
5 changed files with 107 additions and 15 deletions

View File

@ -4,11 +4,16 @@ import { JsonAnalization } from '@ucap-webmessenger/api';
export interface PlanEventJson {
planSeq?: number;
title?: string;
contents?: string;
contents?: PlanContentType;
date?: string;
endDate?: string;
active?: boolean;
}
export enum PlanContentType {
New = 'PLAN_CONTENTS_NEW',
Update = 'PLAN_CONTENTS_UPDATE',
Delete = 'PLAN_CONTENTS_DELETE'
}
export const decodePlanEventJson: EventJsonDecoder<PlanEventJson> = (
message: string
@ -18,10 +23,9 @@ export const decodePlanEventJson: EventJsonDecoder<PlanEventJson> = (
return {
planSeq: json.planSeq,
title: json.title,
contents: json.contents,
contents: json.contents as PlanContentType,
date: json.date,
endDate: json.endDate,
chat: json.chat,
active: !!json.activeYn && 'Y' === json.activeYn ? true : false
} as PlanEventJson;
} catch (e) {

View File

@ -1,16 +1,37 @@
<div class="event-main">
<div class="event-header">이벤트제목</div>
<div class="event-header">
<ng-container
*ngIf="!!message.sentMessageJson && !!message.sentMessageJson.contents"
>
<ng-container [ngSwitch]="message.sentMessageJson.contents">
<ng-container *ngSwitchCase="PlanContentType.New">
[이벤트] 등록
</ng-container>
<ng-container *ngSwitchCase="PlanContentType.Update">
[이벤트] 수정
</ng-container>
<ng-container *ngSwitchCase="PlanContentType.Delete">
[이벤트] 삭제
</ng-container>
<ng-container *ngSwitchDefault>
[이벤트] 조회중..
</ng-container>
</ng-container>
</ng-container>
</div>
<ul class="event-info">
<li class="event-title">
이벤트 타일틀이벤트 타일틀이벤트 타일틀이벤트 타일틀이벤트 타일틀이벤트
타일틀이벤트 타일틀이벤트 타일틀이벤트 타일틀이벤트 타일틀이벤트
타일틀이벤트 타일틀
{{ message.sentMessageJson.title }}
</li>
<li class="event-date">
<span>날짜</span>{{ date | ucapDate: 'YYYY.MM.DD' }}
</li>
<li class="event-time">
<span>시간</span>{{ date | ucapDate: 'a hh:mm' }}
</li>
<li class="event-date"><span>날짜</span> 2019.09.30</li>
<li class="event-time"><span>시간</span>오후 10시</li>
</ul>
<div class="btn-box">
<!-- <div class="btn-box">
<button mat-button (click)="onClickSave()">상세보기</button>
</div>
</div> -->
</div>

View File

@ -1,4 +1,10 @@
import { Component, OnInit } from '@angular/core';
import { Component, OnInit, Input } from '@angular/core';
import {
Info,
PlanEventJson,
PlanContentType
} from '@ucap-webmessenger/protocol-event';
import moment from 'moment';
@Component({
selector: 'ucap-chat-message-box-schedule',
@ -6,9 +12,60 @@ import { Component, OnInit } from '@angular/core';
styleUrls: ['./schedule.component.scss']
})
export class ScheduleComponent implements OnInit {
@Input()
message: Info<PlanEventJson>;
PlanContentType = PlanContentType;
date: any;
endDate: any;
constructor() {}
ngOnInit() {}
ngOnInit() {
if (!!this.message && !!this.message.sentMessageJson) {
if (!!this.message.sentMessageJson.date) {
let str_date = this.message.sentMessageJson.date
.replace(/ /g, '')
// .replace(/\n/g, '')
.replace(/(\([월,화,수,목,금,토,일]\))/g, '');
if (str_date.indexOf('오전') > -1) {
str_date = str_date.replace('오전', ' ');
} else if (str_date.indexOf('오후') > -1) {
str_date = str_date.replace('오후', ' ');
const arr = str_date.split(' ');
let h = Number(arr[1].split(':')[0]) + 12;
str_date = arr[0] + ' ' + h + ':' + arr[1].split(':')[1];
}
this.date = moment(str_date).toDate();
if (this.date === 'Invalid Date') {
this.date = this.message.sentMessageJson.date.replace(/\n/g, '');
}
}
// if (!!this.message.sentMessageJson.endDate) {
// let str_endDate = this.message.sentMessageJson.endDate
// .replace(/ /g, '')
// .replace(/\n/g, '')
// .replace(/(\([월,화,수,목,금,토,일]\))/g, '');
// if (str_endDate.indexOf('오전') > -1) {
// str_endDate = str_endDate.replace('오전', ' ');
// } else if (str_endDate.indexOf('오후') > -1) {
// str_endDate = str_endDate.replace('오후', ' ');
// const arr = str_endDate.split(' ');
// let h = Number(arr[1].split(':')[0]) + 12;
// str_endDate = arr[0] + ' ' + h + ':' + arr[1].split(':')[1];
// }
// this.endDate = moment(str_endDate).toDate();
// if (this.endDate === 'Invalid Date') {
// this.endDate = this.message.sentMessageJson.endDate.replace(
// /\n/g,
// ''
// );
// }
// }
}
}
onClickSave(): void {}
}

View File

@ -161,12 +161,17 @@
(contextmenu)="onContextMenuMessage($event, message)"
>
</ucap-chat-message-box-text>
<ucap-chat-message-box-schedule
*ngSwitchCase="EventType.Plan"
[message]="message"
(contextmenu)="onContextMenuMessage($event, message)"
>
</ucap-chat-message-box-schedule>
<div *ngSwitchDefault>
<!-- mass-translation
<ucap-chat-message-box-mass-translation></ucap-chat-message-box-mass-translation>
notice
<ucap-chat-message-box-notice></ucap-chat-message-box-notice>
<ucap-chat-message-box-schedule></ucap-chat-message-box-schedule>
translation
<ucap-chat-message-box-translation></ucap-chat-message-box-translation>
video-conference

View File

@ -101,7 +101,12 @@ export class DatePipe implements PipeTransform, OnDestroy {
updateValue(date: any, format: string = 'L', options?: DateOptions): void {
try {
const value = this.dateService.get(date, format, options);
if (value === 'Invalid date') {
this.value = date;
} else {
this.value = value;
}
} catch (error) {
this.value = date;
}