2019-11-29 18:24:51 +09:00
|
|
|
import {
|
|
|
|
Component,
|
|
|
|
OnInit,
|
|
|
|
Input,
|
|
|
|
EventEmitter,
|
|
|
|
Output,
|
|
|
|
ViewChild,
|
|
|
|
ElementRef
|
|
|
|
} from '@angular/core';
|
2019-11-08 13:35:39 +09:00
|
|
|
|
|
|
|
import { UserInfo } from '@ucap-webmessenger/protocol-sync';
|
2019-12-15 21:36:12 +09:00
|
|
|
import { UserInfoF, UserInfoSS } from '@ucap-webmessenger/protocol-query';
|
2019-12-03 18:59:11 +09:00
|
|
|
import { FileUploadItem } from '@ucap-webmessenger/api';
|
2019-12-02 18:46:07 +09:00
|
|
|
import { FormControl } from '@angular/forms';
|
2019-11-08 13:35:39 +09:00
|
|
|
|
|
|
|
@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()
|
2019-12-15 21:36:12 +09:00
|
|
|
userInfo: UserInfoSS;
|
2019-12-16 17:42:49 +09:00
|
|
|
@Input()
|
|
|
|
myMadn?: string;
|
2019-11-08 13:35:39 +09:00
|
|
|
|
|
|
|
@Output()
|
2019-12-15 21:36:12 +09:00
|
|
|
openChat = new EventEmitter<UserInfoSS>();
|
2019-11-20 14:57:54 +09:00
|
|
|
@Output()
|
2019-12-15 21:36:12 +09:00
|
|
|
sendMessage = new EventEmitter<UserInfoSS>();
|
2019-12-11 08:18:32 +09:00
|
|
|
@Output()
|
2019-12-16 17:42:49 +09:00
|
|
|
sendCall = new EventEmitter<string>();
|
|
|
|
@Output()
|
2019-11-20 14:57:54 +09:00
|
|
|
toggleFavorit = new EventEmitter<{
|
2019-12-15 21:36:12 +09:00
|
|
|
userInfo: UserInfoSS;
|
2019-11-20 14:57:54 +09:00
|
|
|
isFavorit: boolean;
|
|
|
|
}>();
|
|
|
|
@Output()
|
|
|
|
toggleBuddy = new EventEmitter<{
|
2019-12-15 21:36:12 +09:00
|
|
|
userInfo: UserInfoSS;
|
2019-11-20 14:57:54 +09:00
|
|
|
isBuddy: boolean;
|
|
|
|
}>();
|
2019-11-08 13:35:39 +09:00
|
|
|
|
2019-11-29 18:24:51 +09:00
|
|
|
@Output()
|
|
|
|
uploadProfileImage = new EventEmitter<FileUploadItem>();
|
|
|
|
|
|
|
|
@ViewChild('profileImageFileInput', { static: false })
|
|
|
|
profileImageFileInput: ElementRef<HTMLInputElement>;
|
|
|
|
|
2019-12-02 18:46:07 +09:00
|
|
|
userIntroFormControl = new FormControl('');
|
|
|
|
|
2019-11-29 18:24:51 +09:00
|
|
|
profileImageFileUploadItem: FileUploadItem;
|
|
|
|
|
2019-11-08 13:35:39 +09:00
|
|
|
constructor() {}
|
|
|
|
|
|
|
|
ngOnInit() {}
|
|
|
|
|
|
|
|
onClickOpenChat() {
|
|
|
|
this.openChat.emit(this.userInfo);
|
|
|
|
}
|
|
|
|
|
2019-12-16 17:42:49 +09:00
|
|
|
onClickCall(type: string) {
|
|
|
|
let calleeNumber = '';
|
|
|
|
|
|
|
|
if (type === 'LINE') {
|
|
|
|
calleeNumber = this.userInfo.lineNumber;
|
|
|
|
} else {
|
|
|
|
calleeNumber = this.userInfo.hpNumber;
|
|
|
|
}
|
|
|
|
this.sendCall.emit(calleeNumber);
|
|
|
|
}
|
2019-12-15 21:36:12 +09:00
|
|
|
|
|
|
|
onClickSMS() {}
|
2019-11-08 13:35:39 +09:00
|
|
|
|
|
|
|
onClickVideoConference() {}
|
|
|
|
|
2019-12-11 08:18:32 +09:00
|
|
|
onClickMessage() {
|
|
|
|
this.sendMessage.emit(this.userInfo);
|
|
|
|
}
|
2019-11-20 14:57:54 +09:00
|
|
|
|
|
|
|
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
|
|
|
|
});
|
|
|
|
}
|
2019-11-29 18:24:51 +09:00
|
|
|
|
|
|
|
onChangeFileInput() {
|
|
|
|
this.profileImageFileUploadItem = FileUploadItem.fromFiles(
|
|
|
|
this.profileImageFileInput.nativeElement.files
|
|
|
|
)[0];
|
|
|
|
|
|
|
|
this.uploadProfileImage.emit(this.profileImageFileUploadItem);
|
|
|
|
|
|
|
|
this.profileImageFileInput.nativeElement.value = '';
|
|
|
|
}
|
2019-12-15 21:36:12 +09:00
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
2019-12-16 17:42:49 +09:00
|
|
|
|
|
|
|
getDisabledBtn(type: string): boolean {
|
|
|
|
if (!this.myMadn || this.myMadn.trim().length === 0) {
|
|
|
|
if (type === 'LINE' || type === 'MOBILE') {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (type === 'LINE') {
|
|
|
|
if (
|
|
|
|
!!this.userInfo &&
|
|
|
|
!!this.userInfo.lineNumber &&
|
|
|
|
this.userInfo.lineNumber.trim().length > 0
|
|
|
|
) {
|
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
} else if (type === 'MOBILE') {
|
|
|
|
if (
|
|
|
|
!!this.userInfo &&
|
|
|
|
!!this.userInfo.hpNumber &&
|
|
|
|
this.userInfo.hpNumber.trim().length > 0
|
|
|
|
) {
|
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
} else if (type === 'SMS') {
|
|
|
|
if (
|
|
|
|
!!this.userInfo &&
|
|
|
|
!!this.userInfo.hpNumber &&
|
|
|
|
this.userInfo.hpNumber.trim().length > 0
|
|
|
|
) {
|
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2019-11-08 13:35:39 +09:00
|
|
|
}
|