From 33d8e733d1e412d10863dc18d993f29231bc6f02 Mon Sep 17 00:00:00 2001 From: Richard Park Date: Mon, 7 Oct 2019 16:29:38 +0900 Subject: [PATCH] tenent search component is added --- .../left-sidenav/group.component.html | 20 +- .../left-sidenav/group.component.ts | 29 ++- .../dialogs/confirm.dialog.component.html | 23 +++ .../dialogs/confirm.dialog.component.scss | 0 .../dialogs/confirm.dialog.component.spec.ts | 24 +++ .../dialogs/confirm.dialog.component.ts | 51 +++++ .../components/template.page.component.html | 14 ++ .../components/template.page.component.ts | 184 ++++++++++++++++++ .../pages/template/template.page.module.ts | 6 +- .../src/app/resolvers/messenger.resolver.ts | 7 + .../components/tenant-search.component.html | 20 ++ .../components/tenant-search.component.scss | 12 ++ .../tenant-search.component.spec.ts | 24 +++ .../lib/components/tenant-search.component.ts | 30 +++ .../src/lib/ucap-ui-organization.module.ts | 7 +- .../src/public-api.ts | 1 + .../src/lib/ucap-ui-profile.module.ts | 6 +- 17 files changed, 447 insertions(+), 11 deletions(-) create mode 100644 projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/confirm.dialog.component.html create mode 100644 projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/confirm.dialog.component.scss create mode 100644 projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/confirm.dialog.component.spec.ts create mode 100644 projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/confirm.dialog.component.ts create mode 100644 projects/ucap-webmessenger-ui-organization/src/lib/components/tenant-search.component.html create mode 100644 projects/ucap-webmessenger-ui-organization/src/lib/components/tenant-search.component.scss create mode 100644 projects/ucap-webmessenger-ui-organization/src/lib/components/tenant-search.component.spec.ts create mode 100644 projects/ucap-webmessenger-ui-organization/src/lib/components/tenant-search.component.ts diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/group.component.html b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/group.component.html index ef28f944..cf8249bf 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/group.component.html +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/group.component.html @@ -1,4 +1,16 @@ - +
+
+ +
+
+ + +
+
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 e08d39d2..d7edeb03 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 @@ -11,6 +11,9 @@ import { UserInfo, GroupDetailData } from '@ucap-webmessenger/protocol-sync'; import * as AppStore from '@app/store'; import * as ChatStore from '@app/store/messenger/chat'; import { NGXLogger } from 'ngx-logger'; +import { Company } from '@ucap-webmessenger/api-external'; +import { SessionStorageService } from '@ucap-webmessenger/web-storage'; +import { LoginInfo, KEY_LOGIN_INFO } from '@app/types'; @Component({ selector: 'app-layout-chat-left-sidenav-group', @@ -22,10 +25,27 @@ export class GroupComponent implements OnInit { groupBuddyList$: Observable< { group: GroupDetailData; buddyList: UserInfo[] }[] >; + companyList$: Observable; + companyCode: string; - constructor(private store: Store, private logger: NGXLogger) {} + constructor( + private store: Store, + private sessionStorageService: SessionStorageService, + private logger: NGXLogger + ) {} ngOnInit() { + const loginInfo = this.sessionStorageService.get(KEY_LOGIN_INFO); + this.companyCode = loginInfo.companyCode; + + this.companyList$ = this.store.pipe( + select(AppStore.SettingSelector.CompanySelector.companyList), + map(list => { + this.logger.debug('list', list); + return list; + }) + ); + this.groupBuddyList$ = this.store .pipe( select(AppStore.MessengerSelector.SyncSelector.groupListAndBuddyList) @@ -74,4 +94,11 @@ export class GroupComponent implements OnInit { onSelectBuddy(buddy: UserInfo) { this.store.dispatch(ChatStore.selectedRoom({ roomSeq: buddy.seq })); } + + onKeyDownEnterOrganizationTenantSearch(params: { + companyCode: string; + searchWord: string; + }) { + this.logger.debug('params', params); + } } diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/confirm.dialog.component.html b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/confirm.dialog.component.html new file mode 100644 index 00000000..7ea339fa --- /dev/null +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/confirm.dialog.component.html @@ -0,0 +1,23 @@ + + + {{ data.title }} + + + +
+ {{ data.message }} +
+
+ + + + +
diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/confirm.dialog.component.scss b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/confirm.dialog.component.scss new file mode 100644 index 00000000..e69de29b diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/confirm.dialog.component.spec.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/confirm.dialog.component.spec.ts new file mode 100644 index 00000000..de089c82 --- /dev/null +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/confirm.dialog.component.spec.ts @@ -0,0 +1,24 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ConfirmDialogComponent } from './confirm.dialog.component'; + +describe('ui::ConfirmDialogComponent', () => { + let component: ConfirmDialogComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ConfirmDialogComponent] + }).compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ConfirmDialogComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/confirm.dialog.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/confirm.dialog.component.ts new file mode 100644 index 00000000..4ca3a569 --- /dev/null +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/dialogs/confirm.dialog.component.ts @@ -0,0 +1,51 @@ +import { + Component, + OnInit, + Inject, + ViewChild, + ElementRef +} from '@angular/core'; +import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material'; + +export interface ConfirmDialogData { + title: string; + message?: string; + html?: string; + hideAction?: boolean; +} + +export interface ConfirmDialogResult { + choice: boolean; +} + +@Component({ + selector: 'ucap-ui-confirm-dialog', + templateUrl: './confirm.dialog.component.html', + styleUrls: ['./confirm.dialog.component.scss'] +}) +export class ConfirmDialogComponent implements OnInit { + @ViewChild('messageContainer', { static: true }) + messageContainer: ElementRef; + + hideAction = false; + + constructor( + public dialogRef: MatDialogRef, + @Inject(MAT_DIALOG_DATA) public data: ConfirmDialogData + ) {} + + ngOnInit(): void { + if (!!this.data.html) { + this.messageContainer.nativeElement.innerHTML = this.data.html; + } + if (!!this.data.hideAction) { + this.hideAction = this.data.hideAction; + } + } + + onClickChoice(choice: boolean): void { + this.dialogRef.close({ + choice + }); + } +} diff --git a/projects/ucap-webmessenger-app/src/app/pages/template/components/template.page.component.html b/projects/ucap-webmessenger-app/src/app/pages/template/components/template.page.component.html index bebf7471..2503b6e1 100644 --- a/projects/ucap-webmessenger-app/src/app/pages/template/components/template.page.component.html +++ b/projects/ucap-webmessenger-app/src/app/pages/template/components/template.page.component.html @@ -29,6 +29,20 @@ > +

Organization

+
+
+
+ Tenant Search +
+
+ +
+
+

Chat::MessageBox

diff --git a/projects/ucap-webmessenger-app/src/app/pages/template/components/template.page.component.ts b/projects/ucap-webmessenger-app/src/app/pages/template/components/template.page.component.ts index 78c710ba..b1738f70 100644 --- a/projects/ucap-webmessenger-app/src/app/pages/template/components/template.page.component.ts +++ b/projects/ucap-webmessenger-app/src/app/pages/template/components/template.page.component.ts @@ -9,6 +9,7 @@ import { } from '@ucap-webmessenger/protocol-status'; import { StatusCode } from '@ucap-webmessenger/core'; import { Router } from '@angular/router'; +import { Company } from '@ucap-webmessenger/api-external'; @Component({ selector: 'app-template.page', @@ -22,6 +23,10 @@ export class TemplatePageComponent implements OnInit { presence: StatusBulkInfo = status; + companyList: Company[] = companyList; + + companyCode: string = 'GUC006'; + constructor(private router: Router) {} ngOnInit() {} @@ -84,3 +89,182 @@ export const buddyData: UserInfo = { employeeType: EmployeeType.Regular, nickName: '채책임(닉)' }; + +const companyList: Company[] = [ + { + companyCode: 'GUC002', + companyName: 'LG Electronics.', + companyDomain: 'lge.com', + companyConfAuthYn: 'N', + ucapUseYn: 'Y', + companyTimerChatAuthYn: 'Y' + }, + { + companyCode: 'GUC040', + companyName: 'LGE한국영업협력사', + companyDomain: 'lgepartner.com', + companyConfAuthYn: 'Y', + ucapUseYn: 'Y', + companyTimerChatAuthYn: 'Y' + }, + { + companyCode: 'GUC021', + companyName: 'LG이노텍', + companyDomain: 'lginnotek.com', + companyConfAuthYn: 'N', + ucapUseYn: 'Y', + companyTimerChatAuthYn: 'Y' + }, + { + companyCode: 'GUC036', + companyName: '하이프라자', + companyDomain: 'hiplaza.co.kr', + companyConfAuthYn: 'Y', + ucapUseYn: 'Y', + companyTimerChatAuthYn: 'Y' + }, + { + companyCode: 'GUC006', + companyName: 'LG CNS', + companyDomain: 'lgcns.com', + companyConfAuthYn: 'Y', + ucapUseYn: 'Y', + companyTimerChatAuthYn: 'Y' + }, + { + companyCode: 'GUC041', + companyName: 'LGEIL', + companyDomain: 'lgeil.com', + companyConfAuthYn: 'Y', + ucapUseYn: 'Y', + companyTimerChatAuthYn: 'Y' + }, + { + companyCode: 'GUC100', + companyName: 'LG UCAP', + companyDomain: 'lgucap.com', + companyConfAuthYn: 'Y', + ucapUseYn: 'Y', + companyTimerChatAuthYn: 'Y' + }, + { + companyCode: 'GUCIM', + companyName: '아메사용회사', + companyDomain: 'test.com', + companyConfAuthYn: 'N', + ucapUseYn: 'N', + companyTimerChatAuthYn: 'Y' + }, + { + companyCode: 'GUC005', + companyName: 'LG화학', + companyDomain: 'lgchem.com', + companyConfAuthYn: 'N', + ucapUseYn: 'Y', + companyTimerChatAuthYn: 'Y' + }, + { + companyCode: 'GSGAL', + companyName: 'GS칼텍스', + companyDomain: 'gscaltex.com', + companyConfAuthYn: 'N', + ucapUseYn: 'Y', + companyTimerChatAuthYn: 'Y' + }, + { + companyCode: 'GUC001', + companyName: 'LG U+', + companyDomain: 'lguplus.com', + companyConfAuthYn: 'N', + ucapUseYn: 'Y', + companyTimerChatAuthYn: 'Y' + }, + { + companyCode: 'GUC007', + companyName: 'LG Display', + companyDomain: 'lgdisplay.com', + companyConfAuthYn: 'N', + ucapUseYn: 'Y', + companyTimerChatAuthYn: 'N' + }, + { + companyCode: 'GUC011', + companyName: 'LG인화원', + companyDomain: 'lgacademy.com', + companyConfAuthYn: 'N', + ucapUseYn: 'Y', + companyTimerChatAuthYn: 'Y' + }, + { + companyCode: 'GUC013', + companyName: 'LG MMA', + companyDomain: 'lgmma.com', + companyConfAuthYn: 'N', + ucapUseYn: 'Y', + companyTimerChatAuthYn: 'Y' + }, + { + companyCode: 'GUC015', + companyName: '(주)LG', + companyDomain: 'lg.com', + companyConfAuthYn: 'N', + ucapUseYn: 'Y', + companyTimerChatAuthYn: 'Y' + }, + { + companyCode: 'GUC016', + companyName: 'LGERI', + companyDomain: 'lgeri.com', + companyConfAuthYn: 'N', + ucapUseYn: 'Y', + companyTimerChatAuthYn: 'Y' + }, + { + companyCode: 'GUC024', + companyName: 'LG Hausys', + companyDomain: 'lghausys.com', + companyConfAuthYn: 'N', + ucapUseYn: 'Y', + companyTimerChatAuthYn: 'Y' + }, + { + companyCode: 'GUC028', + companyName: 'LG상사', + companyDomain: 'lgi.co.kr', + companyConfAuthYn: 'N', + ucapUseYn: 'Y', + companyTimerChatAuthYn: 'Y' + }, + { + companyCode: 'GUC032', + companyName: '코리아일레콤', + companyDomain: 'koreaelecom.com', + companyConfAuthYn: 'N', + ucapUseYn: 'Y', + companyTimerChatAuthYn: 'Y' + }, + { + companyCode: 'GUC035', + companyName: 'HLDS', + companyDomain: 'hlds.co.kr', + companyConfAuthYn: 'N', + ucapUseYn: 'Y', + companyTimerChatAuthYn: 'Y' + }, + { + companyCode: 'GUC038', + companyName: 'BizTech Partners', + companyDomain: 'GUC018', + companyConfAuthYn: 'N', + ucapUseYn: 'Y', + companyTimerChatAuthYn: 'Y' + }, + { + companyCode: 'GUC042', + companyName: 'Japan R&D Lab', + companyDomain: 'lgjlab.com', + companyConfAuthYn: 'N', + ucapUseYn: 'Y', + companyTimerChatAuthYn: 'Y' + } +]; diff --git a/projects/ucap-webmessenger-app/src/app/pages/template/template.page.module.ts b/projects/ucap-webmessenger-app/src/app/pages/template/template.page.module.ts index d05f6c7a..3c543f3e 100644 --- a/projects/ucap-webmessenger-app/src/app/pages/template/template.page.module.ts +++ b/projects/ucap-webmessenger-app/src/app/pages/template/template.page.module.ts @@ -7,7 +7,8 @@ import { MatButtonModule } from '@angular/material/button'; import { UCapUiChatModule } from '@ucap-webmessenger/ui-chat'; import { UCapUiGroupModule } from '@ucap-webmessenger/ui-group'; -import { UcapUiProfileModule } from '@ucap-webmessenger/ui-profile'; +import { UCapUiOrganizationModule } from '@ucap-webmessenger/ui-organization'; +import { UCapUiProfileModule } from '@ucap-webmessenger/ui-profile'; import { AppTemplateRoutingPageModule } from './template-routing.page.module'; @@ -21,7 +22,8 @@ import { COMPONENTS, MET_MODULES } from './components'; MatButtonModule, UCapUiChatModule, UCapUiGroupModule, - UcapUiProfileModule, + UCapUiOrganizationModule, + UCapUiProfileModule, AppTemplateRoutingPageModule ], declarations: [...COMPONENTS], diff --git a/projects/ucap-webmessenger-app/src/app/resolvers/messenger.resolver.ts b/projects/ucap-webmessenger-app/src/app/resolvers/messenger.resolver.ts index eb0c1285..d20fadb4 100644 --- a/projects/ucap-webmessenger-app/src/app/resolvers/messenger.resolver.ts +++ b/projects/ucap-webmessenger-app/src/app/resolvers/messenger.resolver.ts @@ -39,6 +39,7 @@ import { QueryProtocolService } from '@ucap-webmessenger/protocol-query'; import { OptionProtocolService } from '@ucap-webmessenger/protocol-option'; import * as AppStore from '@app/store'; +import * as CompanyStore from '@app/store/setting/company'; import * as VersionInfoStore from '@app/store/setting/version-info'; import * as OptionStore from '@app/store/messenger/option'; import * as QueryStore from '@app/store/messenger/query'; @@ -124,6 +125,12 @@ export class AppMessengerResolver implements Resolve { ); this.store.dispatch(QueryStore.authSuccess({ res: authRes })); + this.store.dispatch( + CompanyStore.companyList({ + companyGroupCode: 'LG' + }) + ); + // this.store.dispatch(AuthenticationStore.postLogin({ loginRes })); }), withLatestFrom( diff --git a/projects/ucap-webmessenger-ui-organization/src/lib/components/tenant-search.component.html b/projects/ucap-webmessenger-ui-organization/src/lib/components/tenant-search.component.html new file mode 100644 index 00000000..c7da8ceb --- /dev/null +++ b/projects/ucap-webmessenger-ui-organization/src/lib/components/tenant-search.component.html @@ -0,0 +1,20 @@ +
+
+ + + {{ company.companyName }} + + +
+
+ +
+
diff --git a/projects/ucap-webmessenger-ui-organization/src/lib/components/tenant-search.component.scss b/projects/ucap-webmessenger-ui-organization/src/lib/components/tenant-search.component.scss new file mode 100644 index 00000000..a1ef3408 --- /dev/null +++ b/projects/ucap-webmessenger-ui-organization/src/lib/components/tenant-search.component.scss @@ -0,0 +1,12 @@ +.organization-tree { + ul, + li { + margin-top: 0; + margin-bottom: 0; + list-style-type: none; + } + + .organization-tree-node-invisible { + display: none; + } +} diff --git a/projects/ucap-webmessenger-ui-organization/src/lib/components/tenant-search.component.spec.ts b/projects/ucap-webmessenger-ui-organization/src/lib/components/tenant-search.component.spec.ts new file mode 100644 index 00000000..f0590de8 --- /dev/null +++ b/projects/ucap-webmessenger-ui-organization/src/lib/components/tenant-search.component.spec.ts @@ -0,0 +1,24 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { TenantSearchComponent } from './tenant-search.component'; + +describe('Organization::TenantSearchComponent', () => { + let component: TenantSearchComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [TenantSearchComponent] + }).compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(TenantSearchComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/projects/ucap-webmessenger-ui-organization/src/lib/components/tenant-search.component.ts b/projects/ucap-webmessenger-ui-organization/src/lib/components/tenant-search.component.ts new file mode 100644 index 00000000..13b35fbd --- /dev/null +++ b/projects/ucap-webmessenger-ui-organization/src/lib/components/tenant-search.component.ts @@ -0,0 +1,30 @@ +import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; +import { NGXLogger } from 'ngx-logger'; +import { Company } from '@ucap-webmessenger/api-external'; + +@Component({ + selector: 'ucap-organization-tenant-search', + templateUrl: './tenant-search.component.html', + styleUrls: ['./tenant-search.component.scss'] +}) +export class TenantSearchComponent implements OnInit { + @Input() + companyList: Company[]; + + @Input() + companyCode: string; + + @Output() + keyDownEnter = new EventEmitter<{ + companyCode: string; + searchWord: string; + }>(); + + constructor(private logger: NGXLogger) {} + + ngOnInit() {} + + onKeyDownEnter(searchWord: string) { + this.keyDownEnter.emit({ companyCode: this.companyCode, searchWord }); + } +} diff --git a/projects/ucap-webmessenger-ui-organization/src/lib/ucap-ui-organization.module.ts b/projects/ucap-webmessenger-ui-organization/src/lib/ucap-ui-organization.module.ts index 2e2bf6fb..cd6f451a 100644 --- a/projects/ucap-webmessenger-ui-organization/src/lib/ucap-ui-organization.module.ts +++ b/projects/ucap-webmessenger-ui-organization/src/lib/ucap-ui-organization.module.ts @@ -4,11 +4,14 @@ import { ReactiveFormsModule } from '@angular/forms'; import { MatButtonModule } from '@angular/material/button'; import { MatIconModule } from '@angular/material/icon'; +import { MatInputModule } from '@angular/material/input'; +import { MatSelectModule } from '@angular/material/select'; import { MatTreeModule } from '@angular/material/tree'; +import { TenantSearchComponent } from './components/tenant-search.component'; import { TreeComponent } from './components/tree.component'; -const COMPONENTS = [TreeComponent]; +const COMPONENTS = [TenantSearchComponent, TreeComponent]; const SERVICES = []; @NgModule({ @@ -17,6 +20,8 @@ const SERVICES = []; ReactiveFormsModule, MatButtonModule, MatIconModule, + MatInputModule, + MatSelectModule, MatTreeModule ], exports: [...COMPONENTS], diff --git a/projects/ucap-webmessenger-ui-organization/src/public-api.ts b/projects/ucap-webmessenger-ui-organization/src/public-api.ts index 869f9218..d0409ad6 100644 --- a/projects/ucap-webmessenger-ui-organization/src/public-api.ts +++ b/projects/ucap-webmessenger-ui-organization/src/public-api.ts @@ -1,6 +1,7 @@ /* * Public API Surface of ucap-webmessenger-ui-organization */ +export * from './lib/components/tenant-search.component'; export * from './lib/components/tree.component'; export * from './lib/ucap-ui-organization.module'; diff --git a/projects/ucap-webmessenger-ui-profile/src/lib/ucap-ui-profile.module.ts b/projects/ucap-webmessenger-ui-profile/src/lib/ucap-ui-profile.module.ts index 383ba76a..ce7e3f50 100644 --- a/projects/ucap-webmessenger-ui-profile/src/lib/ucap-ui-profile.module.ts +++ b/projects/ucap-webmessenger-ui-profile/src/lib/ucap-ui-profile.module.ts @@ -26,10 +26,10 @@ const SERVICES = []; exports: [...COMPONENTS], declarations: [...COMPONENTS] }) -export class UcapUiProfileModule { - public static forRoot(): ModuleWithProviders { +export class UCapUiProfileModule { + public static forRoot(): ModuleWithProviders { return { - ngModule: UcapUiProfileModule, + ngModule: UCapUiProfileModule, providers: [...SERVICES] }; }