2019-10-11 18:03:01 +09:00
|
|
|
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
|
2019-10-11 11:40:35 +09:00
|
|
|
import { Info } from '@ucap-webmessenger/protocol-event';
|
2019-10-11 18:03:01 +09:00
|
|
|
import { NGXLogger } from 'ngx-logger';
|
|
|
|
import { StatusCode } from '@ucap-webmessenger/api';
|
2019-10-14 13:53:22 +09:00
|
|
|
import { MassTextInfo } from '../../models/mass-talk-info.json';
|
2019-10-07 13:49:12 +09:00
|
|
|
|
|
|
|
@Component({
|
|
|
|
selector: 'ucap-chat-message-box-mass',
|
|
|
|
templateUrl: './mass.component.html',
|
|
|
|
styleUrls: ['./mass.component.scss']
|
|
|
|
})
|
|
|
|
export class MassComponent implements OnInit {
|
2019-10-11 11:40:35 +09:00
|
|
|
@Input()
|
|
|
|
message: Info;
|
|
|
|
|
2019-10-11 18:03:01 +09:00
|
|
|
@Output()
|
|
|
|
massDetail = new EventEmitter<number>();
|
2019-10-07 13:49:12 +09:00
|
|
|
|
2019-10-11 18:03:01 +09:00
|
|
|
content: string;
|
|
|
|
eventMassSeq: number;
|
|
|
|
detailButteonShow = true;
|
|
|
|
|
|
|
|
constructor(private logger: NGXLogger) {}
|
|
|
|
|
|
|
|
ngOnInit() {
|
|
|
|
try {
|
|
|
|
const contentJson: MassTextInfo = JSON.parse(this.message.sentMessage);
|
|
|
|
if (contentJson.StatusCode === StatusCode.Success) {
|
|
|
|
this.content = contentJson.Content;
|
|
|
|
} else {
|
|
|
|
this.content = contentJson.ErrorMessage || '[Error] System Error!!';
|
|
|
|
this.detailButteonShow = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!!contentJson.EventMassSeq) {
|
|
|
|
this.eventMassSeq = contentJson.EventMassSeq;
|
|
|
|
} else {
|
|
|
|
this.detailButteonShow = false;
|
|
|
|
}
|
|
|
|
} catch (e) {
|
|
|
|
this.logger.error(e);
|
|
|
|
this.detailButteonShow = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
onClickDetailView() {
|
|
|
|
this.massDetail.emit(this.eventMassSeq);
|
|
|
|
}
|
|
|
|
}
|