diff --git a/src/app/pages/uikit/overlaydemo.ts b/src/app/pages/uikit/overlaydemo.ts index 67def63..6e78530 100644 --- a/src/app/pages/uikit/overlaydemo.ts +++ b/src/app/pages/uikit/overlaydemo.ts @@ -1,22 +1,22 @@ -import { Component, OnInit } from '@angular/core'; -import { ConfirmationService, MessageService } from 'primeng/api'; -import { ButtonModule } from 'primeng/button'; -import { DialogModule } from 'primeng/dialog'; -import { ToastModule } from 'primeng/toast'; -import { DrawerModule } from 'primeng/drawer'; -import { Popover, PopoverModule } from 'primeng/popover'; -import { ConfirmPopupModule } from 'primeng/confirmpopup'; -import { InputTextModule } from 'primeng/inputtext'; -import { FormsModule } from '@angular/forms'; -import { TooltipModule } from 'primeng/tooltip'; -import { TableModule } from 'primeng/table'; -import { Product, ProductService } from '@/app/pages/service/product.service'; +import {Component, OnInit} from '@angular/core'; +import {ConfirmationService, MessageService} from 'primeng/api'; +import {ButtonModule} from 'primeng/button'; +import {DialogModule} from 'primeng/dialog'; +import {ToastModule} from 'primeng/toast'; +import {DrawerModule} from 'primeng/drawer'; +import {Popover, PopoverModule} from 'primeng/popover'; +import {ConfirmPopupModule} from 'primeng/confirmpopup'; +import {InputTextModule} from 'primeng/inputtext'; +import {FormsModule} from '@angular/forms'; +import {TooltipModule} from 'primeng/tooltip'; +import {TableModule} from 'primeng/table'; +import {Product, ProductService} from '@/app/pages/service/product.service'; @Component({ selector: 'app-overlay-demo', standalone: true, imports: [ToastModule, DialogModule, ButtonModule, DrawerModule, PopoverModule, ConfirmPopupModule, InputTextModule, FormsModule, TooltipModule, TableModule, ToastModule], - template: `
+ template: `
Dialog
@@ -40,15 +40,23 @@ import { Product, ProductService } from '@/app/pages/service/product.service'; - Name - Image - Price + + Name + + + Image + + Price + + {{ product.name }} - + + + {{ product.price }} @@ -113,7 +121,7 @@ import { Product, ProductService } from '@/app/pages/service/product.service';
ConfirmPopup
- +
@@ -122,7 +130,7 @@ import { Product, ProductService } from '@/app/pages/service/product.service';
- + Are you sure you want to proceed?
@@ -136,8 +144,6 @@ import { Product, ProductService } from '@/app/pages/service/product.service'; providers: [ConfirmationService, MessageService, ProductService] }) export class OverlayDemo implements OnInit { - images: any[] = []; - display: boolean = false; products: Product[] = []; @@ -164,28 +170,6 @@ export class OverlayDemo implements OnInit { ngOnInit() { this.productService.getProductsSmall().then((products) => (this.products = products)); - - this.images = []; - this.images.push({ - source: 'assets/demo/images/sopranos/sopranos1.jpg', - thumbnail: 'assets/demo/images/sopranos/sopranos1_small.jpg', - title: 'Sopranos 1' - }); - this.images.push({ - source: 'assets/demo/images/sopranos/sopranos2.jpg', - thumbnail: 'assets/demo/images/sopranos/sopranos2_small.jpg', - title: 'Sopranos 2' - }); - this.images.push({ - source: 'assets/demo/images/sopranos/sopranos3.jpg', - thumbnail: 'assets/demo/images/sopranos/sopranos3_small.jpg', - title: 'Sopranos 3' - }); - this.images.push({ - source: 'assets/demo/images/sopranos/sopranos4.jpg', - thumbnail: 'assets/demo/images/sopranos/sopranos4_small.jpg', - title: 'Sopranos 4' - }); } confirm(event: Event) { @@ -194,11 +178,27 @@ export class OverlayDemo implements OnInit { target: event.target || new EventTarget(), message: 'Are you sure that you want to proceed?', icon: 'pi pi-exclamation-triangle', + rejectButtonProps: { + label: 'Cancel', + severity: 'secondary', + outlined: true + }, + acceptButtonProps: { + label: 'Save' + }, accept: () => { - this.messageService.add({ severity: 'info', summary: 'Confirmed', detail: 'You have accepted' }); + this.messageService.add({ + severity: 'info', + summary: 'Confirmed', + detail: 'You have accepted' + }); }, reject: () => { - this.messageService.add({ severity: 'error', summary: 'Rejected', detail: 'You have rejected' }); + this.messageService.add({ + severity: 'error', + summary: 'Rejected', + detail: 'You have rejected' + }); } }); } @@ -217,7 +217,12 @@ export class OverlayDemo implements OnInit { onProductSelect(op: Popover, event: any) { op.hide(); - this.messageService.add({ severity: 'info', summary: 'Product Selected', detail: event?.data.name, life: 3000 }); + this.messageService.add({ + severity: 'info', + summary: 'Product Selected', + detail: event?.data.name, + life: 3000 + }); } openConfirmation() {