diff --git a/apps/angular/projects/catalog/src/pages/product/product.component.html b/apps/angular/projects/catalog/src/pages/product/product.component.html
index f4e5e651..0cc424c2 100644
--- a/apps/angular/projects/catalog/src/pages/product/product.component.html
+++ b/apps/angular/projects/catalog/src/pages/product/product.component.html
@@ -5,7 +5,9 @@
{{ 'AbpCatalog::Products' | abpLocalization }}
-
+
@@ -41,3 +43,53 @@
+
+
+
+ {{ (selected?.id ? 'AbpCatalog::Edit' : 'AbpCatalog::NewProduct') | abpLocalization }}
+
+
+
+
+
+
+
+
+
+
+ {{ 'AbpIdentity::Save' | abpLocalization }}
+
+
diff --git a/apps/angular/projects/catalog/src/pages/product/product.component.ts b/apps/angular/projects/catalog/src/pages/product/product.component.ts
index 365d2cc7..a29d12cc 100644
--- a/apps/angular/projects/catalog/src/pages/product/product.component.ts
+++ b/apps/angular/projects/catalog/src/pages/product/product.component.ts
@@ -1,4 +1,5 @@
import { ListService } from '@abp/ng.core';
+import { Confirmation, ConfirmationService } from '@abp/ng.theme.shared';
import { Component, OnInit } from '@angular/core';
import { ProductDto, ProductService } from '@catalog/proxy/products';
@@ -11,7 +12,17 @@ import { ProductDto, ProductService } from '@catalog/proxy/products';
export class ProductComponent implements OnInit {
items: ProductDto[] = [];
count = 0;
- constructor(public readonly productService: ProductService, public readonly list: ListService) {
+
+ selected: ProductDto;
+
+ isModalVisible: boolean;
+
+ modalBusy = false;
+ constructor(
+ public readonly productService: ProductService,
+ public readonly list: ListService,
+ private confirmationService: ConfirmationService
+ ) {
// TODO: this is an example of paging
this.list.maxResultCount = 2;
}
@@ -25,9 +36,29 @@ export class ProductComponent implements OnInit {
});
}
- onEdit(row: ProductDto) {
- // this.productService.edit(row);
+ onEdit(product: ProductDto) {
+ this.selected = product;
+ this.openModal();
+ }
+
+ onCreate() {
+ this.selected = {} as ProductDto;
+ this.openModal();
+ }
+
+ openModal() {
+ this.isModalVisible = true;
}
- onDelete(row: ProductDto) {}
+ onDelete(product: ProductDto) {
+ this.confirmationService
+ .warn('AbpCatalog::ProductDeletionConfirmationMessage', 'AbpCatalog::AreYouSure', {
+ messageLocalizationParams: [product.name],
+ })
+ .subscribe((status: Confirmation.Status) => {
+ if (status === Confirmation.Status.confirm) {
+ this.productService.delete(product.id).subscribe(() => this.list.get());
+ }
+ });
+ }
}