From 84ee61beea6067f62e7aff55d513bcd61388a0e2 Mon Sep 17 00:00:00 2001 From: Park Byung Eun Date: Fri, 12 Aug 2022 07:16:28 +0000 Subject: [PATCH] dialog bug fixed --- .../partner/components/list.component.html | 2 +- .../partner/components/list.component.ts | 9 +++-- .../compose/regist-compose.component.html | 11 +++--- .../compose/regist-compose.component.ts | 34 +++++-------------- .../admin/member/partner/partner.module.ts | 2 ++ 5 files changed, 24 insertions(+), 34 deletions(-) diff --git a/src/app/modules/admin/member/partner/components/list.component.html b/src/app/modules/admin/member/partner/components/list.component.html index cdf7201..53e99bc 100644 --- a/src/app/modules/admin/member/partner/components/list.component.html +++ b/src/app/modules/admin/member/partner/components/list.component.html @@ -167,7 +167,7 @@ mat-flat-button class="bet-mat-small-8" [color]="'primary'" - (click)="__onClickRegist($event)" + (click)="__onClickRegist($event, partner)" > 대본등록 diff --git a/src/app/modules/admin/member/partner/components/list.component.ts b/src/app/modules/admin/member/partner/components/list.component.ts index 52d8ea3..732f5ec 100644 --- a/src/app/modules/admin/member/partner/components/list.component.ts +++ b/src/app/modules/admin/member/partner/components/list.component.ts @@ -14,13 +14,16 @@ import { MatPaginator } from '@angular/material/paginator'; import { MatSort } from '@angular/material/sort'; import { debounceTime, + delay, map, merge, Observable, of, + startWith, Subject, switchMap, takeUntil, + timer, } from 'rxjs'; import { fuseAnimations } from '@fuse/animations'; import { FuseConfirmationService } from '@fuse/services/confirmation'; @@ -158,7 +161,7 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { }); // Mark for check - this._changeDetectorRef.markForCheck(); + this._changeDetectorRef.detectChanges(); // If the partner changes the sort order... this._sort.sortChange @@ -234,9 +237,9 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { return item.id || index; } - __onClickRegist(event: MouseEvent): void { + __onClickRegist(event: MouseEvent, partner: MemberModel): void { const dialogRef = this._matDialog.open(RegistComposeComponent, { - data: { title: '대본', parentId: 'kgon2', sites: this.sites }, + data: { title: '대본 등록하기', parent: partner, sites: this.sites }, }); dialogRef.afterClosed().subscribe((result) => { diff --git a/src/app/modules/admin/member/partner/compose/regist-compose.component.html b/src/app/modules/admin/member/partner/compose/regist-compose.component.html index d8c9e7a..bc2548e 100644 --- a/src/app/modules/admin/member/partner/compose/regist-compose.component.html +++ b/src/app/modules/admin/member/partner/compose/regist-compose.component.html @@ -25,25 +25,26 @@ - + - + diff --git a/src/app/modules/admin/member/partner/compose/regist-compose.component.ts b/src/app/modules/admin/member/partner/compose/regist-compose.component.ts index 6c60772..74d4491 100644 --- a/src/app/modules/admin/member/partner/compose/regist-compose.component.ts +++ b/src/app/modules/admin/member/partner/compose/regist-compose.component.ts @@ -10,10 +10,11 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; import { SiteService } from 'app/modules/polyglot/domain/services/site.service'; import { IdentityService } from 'app/modules/polyglot/member/services/identity.service'; import { Site } from 'app/modules/protobuf/models/domain/site_pb'; +import { MemberModel } from 'app/modules/protobuf/models/member/member_pb'; export interface RegistComposeData { title: string; - parentId: string; + parent: MemberModel; sites: Site[]; } export interface RegistComposeResult { @@ -56,10 +57,7 @@ export class RegistComposeComponent implements OnInit { private _identityService: IdentityService, private _changeDetectorRef: ChangeDetectorRef ) { - this.data.sites.map((v) => { - const a = v.toObject(); - this.sites.push(a); - }); + this.data.sites.forEach((v) => console.log(v.getUrl())); } // ----------------------------------------------------------------------------------------------------- @@ -72,7 +70,7 @@ export class RegistComposeComponent implements OnInit { ngOnInit(): void { // Create the form this.composeForm = this._formBuilder.group({ - partnerId: [{ value: this.data.parentId, disabled: true }], + partnerId: [{ value: this.data.parent.getUsername(), disabled: true }], siteName: ['', [Validators.required]], signinId: ['', [Validators.required]], password: ['', [Validators.required]], @@ -114,7 +112,9 @@ export class RegistComposeComponent implements OnInit { /** * Send the message */ - send(): void {} + send(): void { + console.log(this.composeForm.value); + } __checkSigninId(event: FocusEvent): void { const signinId = this.composeForm.get('signinId')?.value; @@ -127,7 +127,7 @@ export class RegistComposeComponent implements OnInit { .get('signinId') ?.setErrors({ signinIdDuplicate: true }); } - this._changeDetectorRef.markForCheck(); + // this._changeDetectorRef.markForCheck(); }); } @@ -142,23 +142,7 @@ export class RegistComposeComponent implements OnInit { .get('nickname') ?.setErrors({ nicknameDuplicate: true }); } - this._changeDetectorRef.markForCheck(); + // this._changeDetectorRef.markForCheck(); }); } - - // checkSameName(): ValidatorFn { - // return (control: AbstractControl): { [key: string]: any } | null => { - // if ( - // !control || - // !control.value || - // !this.groupList || - // 0 === this.groupList.length - // ) { - // return null; - // } - // const v = (control.value as string).trim(); - // const ban = -1 < this.groupList.findIndex((g) => g.name === v); - // return ban ? { groupNameSamed: { value: control.value } } : null; - // }; - // } } diff --git a/src/app/modules/admin/member/partner/partner.module.ts b/src/app/modules/admin/member/partner/partner.module.ts index 1f83f7d..70ee63b 100644 --- a/src/app/modules/admin/member/partner/partner.module.ts +++ b/src/app/modules/admin/member/partner/partner.module.ts @@ -24,6 +24,7 @@ import { COMPONENTS } from './components'; import { COMPOSE } from './compose'; import { partnerRoutes } from './partner.routing'; +import { MatDialogModule } from '@angular/material/dialog'; @NgModule({ declarations: [COMPONENTS, COMPOSE], @@ -35,6 +36,7 @@ import { partnerRoutes } from './partner.routing'; ReactiveFormsModule, FormsModule, + MatDialogModule, MatButtonModule, MatFormFieldModule, MatIconModule,