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 3ebfe9e5..dd105a29 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 @@ -49,7 +49,6 @@ export class LeftSideComponent implements OnInit { }); if (!!result && !!result.choice && result.choice) { - this.logger.debug(result.selectedUserList); if (!!result.selectedUserList && result.selectedUserList.length > 0) { const userSeqs: number[] = []; result.selectedUserList.map(user => userSeqs.push(user.seq)); diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/group.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/group.component.ts index 7b28ea9f..82ce0e91 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/group.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/group.component.ts @@ -1,3 +1,9 @@ +import { UserSelectDialogType } from './../../../../types/userselect.dialog.type'; +import { + CreateChatDialogComponent, + CreateChatDialogData, + CreateChatDialogResult +} from './../../dialogs/chat/create-chat.dialog.component'; import { Component, OnInit, ViewChild, OnDestroy } from '@angular/core'; import { Observable, combineLatest, Subscription } from 'rxjs'; @@ -155,16 +161,29 @@ export class GroupComponent implements OnInit, OnDestroy { case 'GROUP_NEW': { const result = await this.dialogService.open< - CreateGroupDialogComponent, - CreateGroupDialogData, - CreateGroupDialogResult - >(CreateGroupDialogComponent, { - width: '220px', + CreateChatDialogComponent, + CreateChatDialogData, + CreateChatDialogResult + >(CreateChatDialogComponent, { + width: '600px', + height: '500px', data: { - title: 'Logout', - message: 'Logout ?' + type: UserSelectDialogType.NewGroup, + title: 'New Group' } }); + + if (!!result && !!result.choice && result.choice) { + this.logger.debug(result); + if ( + !!result.selectedUserList && + result.selectedUserList.length > 0 + ) { + // const userSeqs: number[] = []; + // result.selectedUserList.map(user => userSeqs.push(user.seq)); + // this.store.dispatch(ChatStore.openRoom({ userSeqList: userSeqs })); + } + } } break; case 'GROUP_EXPAND_MORE': diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/chat/create-chat.dialog.component.html b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/chat/create-chat.dialog.component.html index 7636d80a..74c41d99 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/chat/create-chat.dialog.component.html +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/chat/create-chat.dialog.component.html @@ -2,85 +2,101 @@ {{ data.title }} - - - - - - group - + + + + + + {{ input.value?.length || 0 }}/20 + + + + + + + + + group + - - - + + + + + + + + device_hub + + - - - - - - device_hub - - - - - - - chat - - - - - - - - - - {{ userInfo.name }} - - close - - - - + + + + + chat + + + + + + + + + + {{ userInfo.name }} + + close + + + + + diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/chat/create-chat.dialog.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/chat/create-chat.dialog.component.ts index c3961b12..983b36cd 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/chat/create-chat.dialog.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/chat/create-chat.dialog.component.ts @@ -1,5 +1,6 @@ import { UserSelectDialogType } from './../../../../types/userselect.dialog.type'; import { Component, OnInit, OnDestroy, Inject } from '@angular/core'; +import { FormGroup, FormBuilder, Validators } from '@angular/forms'; import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material'; import { NGXLogger } from 'ngx-logger'; import { Observable, combineLatest, Subscription } from 'rxjs'; @@ -41,6 +42,7 @@ export interface CreateChatDialogData { export interface CreateChatDialogResult { choice: boolean; selectedUserList?: (UserInfo | UserInfoSS | UserInfoF | UserInfoDN)[]; + groupName?: string; } @Component({ @@ -57,6 +59,7 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy { @Inject(MAT_DIALOG_DATA) public data: CreateChatDialogData, private store: Store, private sessionStorageService: SessionStorageService, + private formBuilder: FormBuilder, private logger: NGXLogger ) {} @@ -83,6 +86,8 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy { // 수집 데이터 selectedUserList: (UserInfo | UserInfoSS | UserInfoF | UserInfoDN)[] = []; + inputForm: FormGroup; + ngOnInit() { const loginInfo = this.sessionStorageService.get(KEY_LOGIN_INFO); this.companyCode = loginInfo.companyCode; @@ -155,6 +160,10 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy { }) ) .subscribe(); + + this.inputForm = this.formBuilder.group({ + groupName: ['', [Validators.required]] + }); } ngOnDestroy(): void { @@ -267,7 +276,11 @@ export class CreateChatDialogComponent implements OnInit, OnDestroy { onClickChoice(choice: boolean): void { this.dialogRef.close({ choice, - selectedUserList: this.selectedUserList + selectedUserList: this.selectedUserList, + groupName: + this.data.type === UserSelectDialogType.NewGroup + ? this.inputForm.get('groupName').value + : '' }); } } diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/messenger.layout.module.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/messenger.layout.module.ts index 7185e852..bf70600c 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/messenger.layout.module.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/messenger.layout.module.ts @@ -13,6 +13,8 @@ import { MatMenuModule } from '@angular/material/menu'; import { MatProgressBarModule } from '@angular/material/progress-bar'; import { MatTabsModule } from '@angular/material/tabs'; import { MatToolbarModule } from '@angular/material/toolbar'; +import { MatFormFieldModule } from '@angular/material/form-field'; +import { MatInputModule } from '@angular/material/input'; import { DragDropModule } from '@angular/cdk/drag-drop'; @@ -25,12 +27,16 @@ import { UCapUiOrganizationModule } from '@ucap-webmessenger/ui-organization'; import { COMPONENTS } from './components'; import { DIALOGS } from './dialogs'; +import { ReactiveFormsModule } from '@angular/forms'; @NgModule({ imports: [ CommonModule, FlexLayoutModule, DragDropModule, + ReactiveFormsModule, + MatFormFieldModule, + MatInputModule, MatBadgeModule, MatButtonModule, MatCardModule, diff --git a/projects/ucap-webmessenger-app/src/app/store/messenger/event/effects.ts b/projects/ucap-webmessenger-app/src/app/store/messenger/event/effects.ts index a367fdfc..0e6bb360 100644 --- a/projects/ucap-webmessenger-app/src/app/store/messenger/event/effects.ts +++ b/projects/ucap-webmessenger-app/src/app/store/messenger/event/effects.ts @@ -227,13 +227,15 @@ export class Effects { // not opened room :: unread count increased if (!roomInfo || roomInfo.roomSeq !== action.roomSeq) { - const noReadCnt = trgtRoomInfos[action.roomSeq].noReadCnt; - this.store.dispatch( - SyncStore.updateUnreadCount({ - roomSeq: action.roomSeq, - noReadCnt: noReadCnt + 1 - }) - ); + if (!!trgtRoomInfos && !!trgtRoomInfos[action.roomSeq]) { + const noReadCnt = trgtRoomInfos[action.roomSeq].noReadCnt; + this.store.dispatch( + SyncStore.updateUnreadCount({ + roomSeq: action.roomSeq, + noReadCnt: noReadCnt + 1 + }) + ); + } } // 대화 > 리스트 :: finalEventMessage refresh diff --git a/projects/ucap-webmessenger-app/src/app/store/messenger/sync/reducers.ts b/projects/ucap-webmessenger-app/src/app/store/messenger/sync/reducers.ts index 4775698b..a1609ac3 100644 --- a/projects/ucap-webmessenger-app/src/app/store/messenger/sync/reducers.ts +++ b/projects/ucap-webmessenger-app/src/app/store/messenger/sync/reducers.ts @@ -69,6 +69,12 @@ export const reducer = createReducer( } let unReadCount = 0; + /** SYNC ROOM 으로 정보 수집시 증분값을 받는다면 기존 state 의 정보를 뒤져 noReadCount 를 계산 후 중분 값에 대한 noReadCount 를 더한다. */ + // tslint:disable-next-line: forin + for (const key in state.room.entities) { + const value = state.room.entities[key]; + unReadCount += value.noReadCnt; + } action.roomList.map(item => (unReadCount += item.noReadCnt)); return {