From cc794339a85cd47f1b8b444eb2985935d5f3f3c4 Mon Sep 17 00:00:00 2001 From: Park Byung Eun Date: Tue, 26 Jul 2022 07:05:59 +0000 Subject: [PATCH] =?UTF-8?q?=EC=95=8C=EB=A6=BC=20=EC=BB=B4=ED=8F=AC?= =?UTF-8?q?=EB=84=8C=ED=8A=B8=20=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/list.component.html | 1 + .../components/list.component.ts | 34 +++++++++++++++++++ .../components/redit.component.html | 24 +++++++++++++ .../components/redit.component.ts | 12 +++++-- 4 files changed, 69 insertions(+), 2 deletions(-) diff --git a/src/app/modules/admin/board/customer-template/components/list.component.html b/src/app/modules/admin/board/customer-template/components/list.component.html index 74a4c0d..2d1346e 100644 --- a/src/app/modules/admin/board/customer-template/components/list.component.html +++ b/src/app/modules/admin/board/customer-template/components/list.component.html @@ -94,6 +94,7 @@ mat-flat-button class="bet-mat-small-8" [color]="'primary'" + (click)="__onClickRemoveBtn($event, customerTemplate.id)" > 삭제 diff --git a/src/app/modules/admin/board/customer-template/components/list.component.ts b/src/app/modules/admin/board/customer-template/components/list.component.ts index 0f11c59..f1e350c 100644 --- a/src/app/modules/admin/board/customer-template/components/list.component.ts +++ b/src/app/modules/admin/board/customer-template/components/list.component.ts @@ -77,6 +77,7 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { searchInputControl = new FormControl(); selectedCustomerTemplate?: CustomerTemplate; pagination?: CustomerTemplatePagination; + configForm!: FormGroup; private _unsubscribeAll: Subject = new Subject(); @@ -99,6 +100,29 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { * On init */ ngOnInit(): void { + // Build the config form + this.configForm = this._formBuilder.group({ + title: '알림', + message: + '정말로 삭제하시겠습니까? 삭제!', + icon: this._formBuilder.group({ + show: true, + name: 'heroicons_outline:exclamation', + color: 'warn', + }), + actions: this._formBuilder.group({ + confirm: this._formBuilder.group({ + show: true, + label: '삭제', + color: 'warn', + }), + cancel: this._formBuilder.group({ + show: true, + label: '취소', + }), + }), + dismissible: true, + }); // Get the pagination this._customerTemplateService.pagination$ .pipe(takeUntil(this._unsubscribeAll)) @@ -190,6 +214,16 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy { this.router.navigateByUrl(url); } + __onClickRemoveBtn(event: MouseEvent, id: string): void { + // Open the dialog and save the reference of it + const dialogRef = this._fuseConfirmationService.open(this.configForm.value); + + // Subscribe to afterClosed from the dialog reference + dialogRef.afterClosed().subscribe((result) => { + console.log(result); + }); + } + /** * Track by function for ngFor loops * diff --git a/src/app/modules/admin/board/customer-template/components/redit.component.html b/src/app/modules/admin/board/customer-template/components/redit.component.html index 432cf3e..eb397d8 100644 --- a/src/app/modules/admin/board/customer-template/components/redit.component.html +++ b/src/app/modules/admin/board/customer-template/components/redit.component.html @@ -52,6 +52,30 @@ + +
+
+ + + + +
+
diff --git a/src/app/modules/admin/board/customer-template/components/redit.component.ts b/src/app/modules/admin/board/customer-template/components/redit.component.ts index 9fca484..0816d2f 100644 --- a/src/app/modules/admin/board/customer-template/components/redit.component.ts +++ b/src/app/modules/admin/board/customer-template/components/redit.component.ts @@ -31,7 +31,7 @@ import { FuseConfirmationService } from '@fuse/services/confirmation'; import { User } from 'app/modules/admin/member/user/models/user'; import { UserService } from 'app/modules/admin/member/user/services/user.service'; -import { ActivatedRoute } from '@angular/router'; +import { ActivatedRoute, Router } from '@angular/router'; import { CustomerTemplateService } from '../services/customer-template.service'; import { CustomerTemplate } from '../models/ customer-template'; @@ -84,7 +84,8 @@ export class ReditComponent implements OnInit, AfterViewInit, OnDestroy { private _formBuilder: FormBuilder, private _customerTemplateService: CustomerTemplateService, private _userService: UserService, - private _route: ActivatedRoute + private _route: ActivatedRoute, + private _router: Router ) {} // ----------------------------------------------------------------------------------------------------- @@ -155,6 +156,13 @@ export class ReditComponent implements OnInit, AfterViewInit, OnDestroy { * @param productId */ __toggleDetails(productId: string): void {} + __onClickeCancel(): void { + let url: string = 'board/customer-template/'; + this._router.navigateByUrl(url); + } + __onClickReditBtn(targetTemplate: CustomerTemplate | undefined): void { + console.log('click: ', targetTemplate?.id); + } /** * Track by function for ngFor loops