diff --git a/projects/ucap-webmessenger-app/src/app/guards/auto-login.guard.ts b/projects/ucap-webmessenger-app/src/app/guards/auto-login.guard.ts index bc462712..038b77c8 100644 --- a/projects/ucap-webmessenger-app/src/app/guards/auto-login.guard.ts +++ b/projects/ucap-webmessenger-app/src/app/guards/auto-login.guard.ts @@ -50,7 +50,7 @@ export class AppAutoLoginGuard implements CanActivate { if ( !!appUserInfo && appUserInfo.settings.general.autoLogin && - !personLogout.personLogout + !(!!personLogout && !!personLogout.personLogout) ) { this.store.dispatch( AuthenticationStore.webLogin({ diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-side.component.html b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-side.component.html index ffc37043..8e139922 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-side.component.html +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-side.component.html @@ -186,6 +186,7 @@ (sendCall)="onClickSendClickToCall($event)" (sendSms)="onClickSendSms($event)" (toggleUser)="onToggleUser($event)" + (resetSelectedUserList)="onResetSelectedUserList($event)" class="organization-side" > diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-side.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-side.component.ts index 9c9a168f..aad4ba97 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-side.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-side.component.ts @@ -403,6 +403,11 @@ export class LeftSideComponent implements OnInit, OnDestroy { ); } } + onResetSelectedUserList( + selectedUserList: (UserInfo | UserInfoSS | UserInfoF | UserInfoDN)[] + ) { + this.selectedUserList = selectedUserList; + } /** FAB */ onClickFab(params: { btn: any }) { diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/organization.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/organization.component.ts index 6e592394..7403cfce 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/organization.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/organization.component.ts @@ -41,22 +41,27 @@ import { } from '@app/types'; import { take, map, tap, delay, catchError } from 'rxjs/operators'; import { VersionInfo2Response } from '@ucap-webmessenger/api-public'; -import { - SelectGroupDialogComponent, - SelectGroupDialogData, - SelectGroupDialogResult -} from '../../dialogs/group/select-group.dialog.component'; import { LoginResponse } from '@ucap-webmessenger/protocol-authentication'; import { Company } from '@ucap-webmessenger/api-external'; import { PerfectScrollbarDirective } from 'ngx-perfect-scrollbar'; import { CdkVirtualScrollViewport } from '@angular/cdk/scrolling'; import { MatMenuTrigger } from '@angular/material'; +import { TranslateService } from '@ngx-translate/core'; import { MessageWriteDialogComponent, MessageWriteDialogResult, MessageWriteDialogData } from '../../dialogs/message/message-write.dialog.component'; -import { TranslateService } from '@ngx-translate/core'; +import { + SelectGroupDialogComponent, + SelectGroupDialogResult, + SelectGroupDialogData +} from '../../dialogs/group/select-group.dialog.component'; +import { + SelectedUserListDialogComponent, + SelectedUserListDialogResult, + SelectedUserListDialogData +} from '../../dialogs/organization/selected-user-list.dialog.component'; @Component({ selector: 'app-layout-chat-left-sidenav-organization', @@ -99,6 +104,10 @@ export class OrganizationComponent userInfos: (UserInfo | UserInfoSS | UserInfoF | UserInfoDN)[]; }>(); @Output() + resetSelectedUserList = new EventEmitter< + (UserInfo | UserInfoSS | UserInfoF | UserInfoDN)[] + >(); + @Output() openProfile = new EventEmitter<{ userSeq: number }>(); @Output() sendCall = new EventEmitter(); @@ -411,8 +420,25 @@ export class OrganizationComponent this.sendCall.emit(calleeNumber); } - onClickShowSelectedUserList() { + async onClickShowSelectedUserList() { this.logger.debug('onClickShowSelectedUserList', this.selectedUserList); + + const result = await this.dialogService.open< + SelectedUserListDialogComponent, + SelectedUserListDialogData, + SelectedUserListDialogResult + >(SelectedUserListDialogComponent, { + data: { + title: '선택된 유저', + selectedUserList: this.selectedUserList + } + }); + + if (!!result && !!result.choice && result.choice) { + if (!!result.selectedUserList) { + this.resetSelectedUserList.emit(result.selectedUserList); + } + } } async onClickAddGroup() { diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/index.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/index.ts index 093e4297..6f4430e9 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/index.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/index.ts @@ -3,6 +3,7 @@ import { DIALOGS as CHAT_DIALOGS } from './chat'; import { DIALOGS as GROUP_DIALOGS } from './group'; import { DIALOGS as MESSAGE_DIALOGS } from './message'; import { DIALOGS as NOTICE_DIALOGS } from './notice'; +import { DIALOGS as ORGANIZATION_DIALOGS } from './organization'; import { DIALOGS as PROFILE_DIALOGS } from './profile'; import { DIALOGS as SETTINGS_DIALOGS } from './settings'; @@ -12,6 +13,7 @@ export const DIALOGS = [ ...GROUP_DIALOGS, ...MESSAGE_DIALOGS, ...NOTICE_DIALOGS, + ...ORGANIZATION_DIALOGS, ...PROFILE_DIALOGS, ...SETTINGS_DIALOGS ]; diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/organization/index.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/organization/index.ts new file mode 100644 index 00000000..27cf34ce --- /dev/null +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/organization/index.ts @@ -0,0 +1,3 @@ +import { SelectedUserListDialogComponent } from './selected-user-list.dialog.component'; + +export const DIALOGS = [SelectedUserListDialogComponent]; diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/organization/selected-user-list.dialog.component.html b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/organization/selected-user-list.dialog.component.html new file mode 100644 index 00000000..c533b4f5 --- /dev/null +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/organization/selected-user-list.dialog.component.html @@ -0,0 +1,66 @@ + + + + {{ data.title }} + + {{ selectedUserList.length }} / {{ data.selectedUserList.length }} + + + 전체선택 + + + + +
+ + + + +
+
+ + + + +
diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/organization/selected-user-list.dialog.component.scss b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/organization/selected-user-list.dialog.component.scss new file mode 100644 index 00000000..cc1fc087 --- /dev/null +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/organization/selected-user-list.dialog.component.scss @@ -0,0 +1,18 @@ +::ng-deep .mat-card-header-tex { + margin: 0; +} + +.confirm-card { + min-width: 500px; + .mat-card-content { + .item-list { + height: 450px; + } + } + .button-farm { + text-align: right; + .mat-primary { + margin-left: 4px; + } + } +} diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/organization/selected-user-list.dialog.component.spec.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/organization/selected-user-list.dialog.component.spec.ts new file mode 100644 index 00000000..861eecbc --- /dev/null +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/organization/selected-user-list.dialog.component.spec.ts @@ -0,0 +1,24 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { SelectedUserListDialogComponent } from './selected-user-list.dialog.component'; + +describe('app::layouts::messenger::SelectedUserListDialogComponent', () => { + let component: SelectedUserListDialogComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [SelectedUserListDialogComponent] + }).compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(SelectedUserListDialogComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/organization/selected-user-list.dialog.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/organization/selected-user-list.dialog.component.ts new file mode 100644 index 00000000..eb3d496f --- /dev/null +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/organization/selected-user-list.dialog.component.ts @@ -0,0 +1,120 @@ +import { Component, OnInit, Inject } from '@angular/core'; +import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material'; +import { UserInfo } from '@ucap-webmessenger/protocol-sync'; +import { + UserInfoSS, + UserInfoF, + UserInfoDN +} from '@ucap-webmessenger/protocol-query'; +import { VersionInfo2Response } from '@ucap-webmessenger/api-public'; +import { LoginResponse } from '@ucap-webmessenger/protocol-authentication'; +import { SessionStorageService } from '@ucap-webmessenger/web-storage'; +import { KEY_VER_INFO, KEY_LOGIN_RES_INFO } from '@app/types'; + +export interface SelectedUserListDialogData { + title: string; + /** 선택된 사용자의 리스트 */ + selectedUserList?: (UserInfo | UserInfoSS | UserInfoF | UserInfoDN)[]; +} + +export interface SelectedUserListDialogResult { + choice: boolean; + selectedUserList?: (UserInfo | UserInfoSS | UserInfoF | UserInfoDN)[]; +} + +@Component({ + selector: 'app-layout-messenger-selected-user-list', + templateUrl: './selected-user-list.dialog.component.html', + styleUrls: ['./selected-user-list.dialog.component.scss'] +}) +export class SelectedUserListDialogComponent implements OnInit { + selectedUserList: (UserInfo | UserInfoSS | UserInfoF | UserInfoDN)[] = []; + + loginRes: LoginResponse; + sessionVerinfo: VersionInfo2Response; + + constructor( + public dialogRef: MatDialogRef< + SelectedUserListDialogData, + SelectedUserListDialogResult + >, + @Inject(MAT_DIALOG_DATA) public data: SelectedUserListDialogData, + private sessionStorageService: SessionStorageService + ) { + this.loginRes = this.sessionStorageService.get( + KEY_LOGIN_RES_INFO + ); + this.sessionVerinfo = this.sessionStorageService.get( + KEY_VER_INFO + ); + } + + ngOnInit(): void { + this.selectedUserList = this.data.selectedUserList; + } + + /** 전체선택 이벤트 */ + onCheckAllUser(value: boolean) { + if (!!value) { + this.selectedUserList = this.data.selectedUserList; + } else { + this.selectedUserList = []; + } + } + + /** 리스트 checkable 할 경우 checkbox 의 isChecked 를 관장하며 리스트의 전체선택 여부를 판단한다. */ + getCheckedUser(userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN) { + if (!!this.selectedUserList && this.selectedUserList.length > 0) { + return ( + this.selectedUserList.filter(item => item.seq === userInfo.seq).length > + 0 + ); + } + return false; + } + + /** 리스트가 checkable 할 경우 checkbox 의 change 이벤트를 상위 컴포넌트로 전달한다. */ + onCheckUser(params: { + isChecked: boolean; + userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN; + }) { + if (params.isChecked) { + if ( + params.userInfo && + this.selectedUserList.filter(user => user.seq === params.userInfo.seq) + .length === 0 + ) { + this.selectedUserList = [...this.selectedUserList, params.userInfo]; + } + } else { + this.selectedUserList = this.selectedUserList.filter( + user => user.seq !== params.userInfo.seq + ); + } + } + onToggleUser(userInfo: UserInfo | UserInfoSS | UserInfoF | UserInfoDN) { + if (userInfo.seq === this.loginRes.userSeq) { + return; + } + + if ( + this.selectedUserList.filter(user => user.seq === userInfo.seq).length === + 0 + ) { + this.selectedUserList = [...this.selectedUserList, userInfo]; + } else { + this.selectedUserList = this.selectedUserList.filter( + item => item.seq !== userInfo.seq + ); + } + } + + onClickOpenProfile(userSeq: number) {} + + onClickChoice(choice: boolean): void { + this.dialogRef.close({ + choice, + selectedUserList: this.selectedUserList + }); + } +} diff --git a/projects/ucap-webmessenger-app/src/app/layouts/native/components/top-bar.component.html b/projects/ucap-webmessenger-app/src/app/layouts/native/components/top-bar.component.html index 7da7cea5..9edc0d6a 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/native/components/top-bar.component.html +++ b/projects/ucap-webmessenger-app/src/app/layouts/native/components/top-bar.component.html @@ -351,6 +351,9 @@ 확대 --> +
+ +