leejinho c193020409 프로필 정보 팝업 정보 수집방식 변경.
>> 기존 여려 type 으로 유입되는 userInfo 들을 SSVC_TYPE_QUERY_DATA_USER_REQ 프로토콜을 통한 {사용자정보SS} 타입으로 일괄처리하도록 수정.

>> 대상향으로 추가정보 추가 수집하도록 커스터마이징
2019-12-15 21:36:12 +09:00

131 lines
2.7 KiB
TypeScript

import {
Component,
OnInit,
Input,
EventEmitter,
Output,
ViewChild,
ElementRef
} from '@angular/core';
import { UserInfo } from '@ucap-webmessenger/protocol-sync';
import { UserInfoF, UserInfoSS } from '@ucap-webmessenger/protocol-query';
import { FileUploadItem } from '@ucap-webmessenger/api';
import { FormControl } from '@angular/forms';
@Component({
selector: 'ucap-profile-profile',
templateUrl: './profile.component.html',
styleUrls: ['./profile.component.scss']
})
export class ProfileComponent implements OnInit {
@Input()
profileImageRoot: string;
@Input()
isMe: boolean;
@Input()
isBuddy: boolean;
@Input()
isFavorit: boolean;
@Input()
userInfo: UserInfoSS;
@Output()
openChat = new EventEmitter<UserInfoSS>();
@Output()
sendMessage = new EventEmitter<UserInfoSS>();
@Output()
toggleFavorit = new EventEmitter<{
userInfo: UserInfoSS;
isFavorit: boolean;
}>();
@Output()
toggleBuddy = new EventEmitter<{
userInfo: UserInfoSS;
isBuddy: boolean;
}>();
@Output()
uploadProfileImage = new EventEmitter<FileUploadItem>();
@ViewChild('profileImageFileInput', { static: false })
profileImageFileInput: ElementRef<HTMLInputElement>;
userIntroFormControl = new FormControl('');
profileImageFileUploadItem: FileUploadItem;
constructor() {}
ngOnInit() {}
onClickOpenChat() {
this.openChat.emit(this.userInfo);
}
onClickCall(type: string) {}
onClickSMS() {}
onClickVideoConference() {}
onClickMessage() {
this.sendMessage.emit(this.userInfo);
}
onToggleFavorit() {
this.isFavorit = !this.isFavorit;
this.toggleFavorit.emit({
userInfo: this.userInfo,
isFavorit: this.isFavorit
});
}
onClickAddBuddy() {
this.toggleBuddy.emit({
userInfo: this.userInfo,
isBuddy: true
});
}
onClickDelBuddy() {
this.toggleBuddy.emit({
userInfo: this.userInfo,
isBuddy: false
});
}
onChangeFileInput() {
this.profileImageFileUploadItem = FileUploadItem.fromFiles(
this.profileImageFileInput.nativeElement.files
)[0];
this.uploadProfileImage.emit(this.profileImageFileUploadItem);
this.profileImageFileInput.nativeElement.value = '';
}
getWorkstatus(userInfo: UserInfoSS): string {
let workstatus = '';
if (!!userInfo && !!userInfo.workstatus) {
switch (userInfo.workstatus) {
case 'V01':
workstatus = '오전휴가';
break;
case 'V02':
workstatus = '오후휴가';
break;
case 'V03':
workstatus = '종일휴가';
break;
case 'V04':
workstatus = '장기휴가';
break;
}
}
return workstatus;
}
}