칭찬코끼리 보내기 기능 추가.

This commit is contained in:
leejinho 2020-03-19 10:35:29 +09:00
parent 705e74a27b
commit 5fe7b9cb22
4 changed files with 85 additions and 9 deletions

View File

@ -9,7 +9,9 @@
[openProfileOptions]="data.openProfileOptions"
[useBuddyToggleButton]="useBuddyToggleButton"
[authInfo]="authInfo"
[enableElephantButton]="getEnableElephantButton()"
(profileImageView)="onClickProfileImageView()"
(sendElephant)="onClickSendElephant()"
(openChat)="onClickChat($event)"
(sendMessage)="onClickSendMessage($event)"
(sendCall)="onClickSendClickToCall($event)"

View File

@ -1,7 +1,15 @@
import { Component, OnInit, Inject, OnDestroy } from '@angular/core';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { KEY_LOGIN_RES_INFO, KEY_VER_INFO, KEY_AUTH_INFO } from '@app/types';
import { SessionStorageService } from '@ucap-webmessenger/web-storage';
import {
KEY_LOGIN_RES_INFO,
KEY_VER_INFO,
KEY_AUTH_INFO,
KEY_URL_INFO
} from '@app/types';
import {
SessionStorageService,
LocalStorageService
} from '@ucap-webmessenger/web-storage';
import { Store, select } from '@ngrx/store';
import * as AppStore from '@app/store';
@ -52,7 +60,7 @@ import {
ConferenceService
} from '@ucap-webmessenger/api-prompt';
import { NGXLogger } from 'ngx-logger';
import { SmsUtils } from '@ucap-webmessenger/daesang';
import { SmsUtils, WebLinkType } from '@ucap-webmessenger/daesang';
import { NativeService, UCAP_NATIVE_SERVICE } from '@ucap-webmessenger/native';
import { environment } from '../../../../../environments/environment';
import { TranslateService } from '@ngx-translate/core';
@ -64,6 +72,8 @@ import {
} from '@app/layouts/common/dialogs/file-viewer.dialog.component';
import { FileEventJson } from '@ucap-webmessenger/protocol-event';
import { FileType } from '@ucap-webmessenger/protocol-file';
import { DaesangUrlInfoResponse } from '@ucap-webmessenger/api-external';
import { AppUserInfo, KEY_APP_USER_INFO } from '@app/types/app-user-info.type';
export interface ProfileDialogData {
userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN;
@ -101,6 +111,7 @@ export class ProfileDialogComponent implements OnInit, OnDestroy {
@Inject(UCAP_NATIVE_SERVICE) private nativeService: NativeService,
@Inject(MAT_DIALOG_DATA) public data: ProfileDialogData,
private dialogService: DialogService,
private localStorageService: LocalStorageService,
private sessionStorageService: SessionStorageService,
private commonApiService: CommonApiService,
private conferenceService: ConferenceService,
@ -496,6 +507,53 @@ export class ProfileDialogComponent implements OnInit, OnDestroy {
});
}
getEnableElephantButton() {
if (!this.loginRes) {
return false;
}
const myEmployeeNum = this.loginRes.userInfo.employeeNum;
const profEmployeeNum = this.userInfo.employeeNum;
const trgtEmployeeCode = '10'; // only 10
if (
!this.isMe &&
!!myEmployeeNum &&
!!profEmployeeNum &&
myEmployeeNum.slice(0, 2) === trgtEmployeeCode &&
profEmployeeNum.slice(0, 2) === trgtEmployeeCode
) {
return true;
}
return false;
}
onClickSendElephant() {
const urlInfo: DaesangUrlInfoResponse = this.sessionStorageService.get<
DaesangUrlInfoResponse
>(KEY_URL_INFO);
if (!!urlInfo && !!urlInfo.webLink) {
const links = urlInfo.webLink.filter(
link => link.key === WebLinkType.Elephant
);
if (!!links && links.length > 0) {
const appUserInfo = this.localStorageService.encGet<AppUserInfo>(
KEY_APP_USER_INFO,
environment.customConfig.appKey
);
let elephantUrl = links[0].url
.replace(/(\(%USER_PASS%\))/g, appUserInfo.loginPw) // exchange USER_PASS params
.replace('kind%3D3', 'kind%3D2'); // change value of 'kind'
elephantUrl += '%26empno%3D' + this.userInfo.employeeNum + ','; // add parameter of 'empno'
console.log(elephantUrl);
this.nativeService.openDefaultBrowser(elephantUrl);
}
}
}
onUpdateIntro(intro: string) {
this.store.dispatch(
AuthenticationStore.infoUser({

View File

@ -29,18 +29,26 @@
>
<i class="mid mdi-camera"></i>
</button>
<!-- <button
<button
mat-mini-fab
class="mat-elevation-z6 icon-button btn-elephant"
*ngIf="!isMe"
*ngIf="!!enableElephantButton"
matTooltip="칭찬 코끼리 보내기"
(click)="onClickSendElephant()"
>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30" stroke-width="1.5"
stroke="#357abc" fill="#98d7e2">
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 30 30"
stroke-width="1.5"
stroke="#357abc"
fill="#98d7e2"
>
<path
d="M29,17.3a21.32,21.32,0,0,0-.63-4.39A10.59,10.59,0,0,0,28,11.85c0-.14-.1-.27-.15-.41l-.16-.39a13,13,0,0,0-.81-1.52,11.29,11.29,0,0,0-1.59-2c-.2-.2-.4-.4-.62-.58s-.43-.36-.66-.53a10.83,10.83,0,0,0-1.82-1.09l-.39-.18c-.26-.11-.53-.21-.81-.31A11.06,11.06,0,0,0,6.62,13.71l0,.09v0s0,.07,0,.1v0a.52.52,0,0,0,0,.11h0a.43.43,0,0,1,0,.11h0a.32.32,0,0,1,0,.09v0s0,.05,0,.08h0a.1.1,0,0,1,0,0h0l-.05,0h0l0,0a1.42,1.42,0,0,1-.56-.62,1.84,1.84,0,0,1-.13-1.17A4,4,0,0,1,6,11.55L2.14,9.83h0a6.75,6.75,0,0,0-.84,1.78c-.05.14-.09.29-.13.45A6.18,6.18,0,0,0,1,13.31a5,5,0,0,0,.78,2.84c.08.13.17.26.26.38l.06.08c.09.11.17.22.27.33l0,0,.26.28.07.06.28.25,0,0a2.48,2.48,0,0,0,.26.19l.06,0,.3.19.05,0,.27.14.06,0,.29.13.06,0,.25.09,0,0,.29.09h.06l.24.06h0l.26.05h0l.23,0h0l.23,0h.94l.13.43c.07.19.15.38.23.57s.17.38.27.56a11.26,11.26,0,0,0,1,1.51c.13.16.25.32.39.48a5.34,5.34,0,0,0,.39.44A11.78,11.78,0,0,0,10.9,24.1c.27.2.54.39.83.57a11.72,11.72,0,0,0,1.78,1l.16.06h.19l.13,0h0l.1-.06h0a.39.39,0,0,0,.08-.1h0l.05-.11v0l0-.1h0s0-.06,0-.09v-.08h0v-1a3.27,3.27,0,0,1,.41-1.59,3.36,3.36,0,0,1,2.94-1.76h0a3.31,3.31,0,0,1,1,.16l.3.11a3.15,3.15,0,0,1,.57.31,2.48,2.48,0,0,1,.26.19A3.34,3.34,0,0,1,21,24.08v.79h0v.29l0,0v0a.43.43,0,0,1,0,0v0a.25.25,0,0,0,0,.07h0a.21.21,0,0,0,0,.06v0l0,0,0,0,0,0,0,0,0,0h.18l.09,0a11,11,0,0,0,1.65-.82c.27-.16.53-.34.78-.52a10.65,10.65,0,0,0,1.07-.93c.11-.12.22-.23.32-.35a7.25,7.25,0,0,0,.58-.76l.24-.4a6.43,6.43,0,0,0,.41-.88l.15-.46.15.64c0,.09,0,.18.05.27v.09l0,.18v.1l0,.19V22l0,.2v.05l0,.2v.07c0,.05,0,.09,0,.14v.07a.69.69,0,0,1,0,.13V23a.94.94,0,0,1,0,.16v0a.56.56,0,0,0,0,.12v0l0,.08v0l0,.06,0,0a.1.1,0,0,0,.05,0h.07l.05,0s0,0,0,0a.12.12,0,0,0,.05,0l0,0a.52.52,0,0,0,.08-.11A9.41,9.41,0,0,0,29,18.52C29,18.12,29,17.71,29,17.3ZM10.55,11.59a.86.86,0,1,1,0-1.71.85.85,0,0,1,.85.85A.86.86,0,0,1,10.55,11.59Zm9.79,4.79A5.27,5.27,0,0,1,17,18.07a2.67,2.67,0,0,1-2-.95,7.21,7.21,0,0,1-1.69-4.84c.07-1.18.76-4,5.58-4.94a4.18,4.18,0,0,1,.61,0v0a3.43,3.43,0,0,1,3.11,2.29C23.5,11.73,22.63,14.27,20.34,16.38Z"
transform="translate(-1 -4.29)" />
transform="translate(-1 -4.29)"
/>
</svg>
</button> -->
</button>
<span
*ngIf="getWorkstatus(userInfo).length > 0"
class="work-status"

View File

@ -44,6 +44,8 @@ export class ProfileComponent implements OnInit {
useBuddyToggleButton: boolean;
@Input()
authInfo: AuthResponse;
@Input()
enableElephantButton: boolean; // 칭찬코끼리 버튼 활성화 대상 여부.
@Output()
profileImageView = new EventEmitter<void>();
@ -72,6 +74,8 @@ export class ProfileComponent implements OnInit {
@Output()
updateIntro = new EventEmitter<string>();
@Output()
sendElephant = new EventEmitter();
@Output()
close = new EventEmitter();
@ViewChild('profileImageFileInput', { static: false })
@ -92,6 +96,10 @@ export class ProfileComponent implements OnInit {
this.profileImageView.emit();
}
onClickSendElephant() {
this.sendElephant.emit();
}
onClickOpenChat() {
this.openChat.emit(this.userInfo);
}