From e582280e56a8cc422fe917226903423f1be9fb40 Mon Sep 17 00:00:00 2001 From: bnymncoskuner Date: Fri, 10 Dec 2021 14:28:00 +0300 Subject: [PATCH] feat: add form in product component --- .../src/pages/product/product.component.html | 83 ++++++++++++------- .../src/pages/product/product.component.ts | 18 +++- 2 files changed, 72 insertions(+), 29 deletions(-) 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 bbabdb07..9ea1c5eb 100644 --- a/apps/angular/projects/catalog/src/pages/product/product.component.html +++ b/apps/angular/projects/catalog/src/pages/product/product.component.html @@ -80,36 +80,63 @@ >
- +
+ + +
+ + +
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 c06cabe2..5095f405 100644 --- a/apps/angular/projects/catalog/src/pages/product/product.component.ts +++ b/apps/angular/projects/catalog/src/pages/product/product.component.ts @@ -1,6 +1,7 @@ import { ListService } from '@abp/ng.core'; import { Confirmation, ConfirmationService } from '@abp/ng.theme.shared'; import { Component, OnInit } from '@angular/core'; +import { FormBuilder, FormGroup } from '@angular/forms'; import { eCatalogPolicyNames } from '@catalog/config'; import { ProductDto, ProductService } from '@catalog/proxy/products'; @@ -25,10 +26,13 @@ export class ProductComponent implements OnInit { isModalVisible: boolean; modalBusy = false; + + form: FormGroup; constructor( public readonly productService: ProductService, public readonly list: ListService, - private confirmationService: ConfirmationService + private confirmationService: ConfirmationService, + private fb: FormBuilder ) { // TODO: this is an example of paging this.list.maxResultCount = 2; @@ -43,6 +47,15 @@ export class ProductComponent implements OnInit { }); } + buildForm() { + this.form = this.fb.group({ + name: [this.selected.name], + code: [this.selected.code], + price: [this.selected.price], + stockCount: [this.selected.stockCount], + }); + } + onEdit(product: ProductDto) { this.selected = product; this.openModal(); @@ -55,6 +68,7 @@ export class ProductComponent implements OnInit { openModal() { this.isModalVisible = true; + this.buildForm(); } onDelete(product: ProductDto) { @@ -68,4 +82,6 @@ export class ProductComponent implements OnInit { } }); } + + save() {} }