From 3307c69f4b16867ba7522626b6b0acf2d6d9a478 Mon Sep 17 00:00:00 2001 From: hackbard Date: Fri, 7 Oct 2016 00:41:05 +0200 Subject: [PATCH] disable category create button --- lib/product_category_component.dart | 16 ++++++++++++++++ lib/product_category_component.html | 9 ++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/lib/product_category_component.dart b/lib/product_category_component.dart index 6963399..7b48a2a 100644 --- a/lib/product_category_component.dart +++ b/lib/product_category_component.dart @@ -26,6 +26,7 @@ class ProductCategoryComponent implements OnInit { String new_prod_category_id; final ProductCategoryService _prodcatSrv; final Router _router; + var docreate=false; ProductCategoryComponent(this._prodcatSrv,this._router); @@ -44,6 +45,21 @@ class ProductCategoryComponent implements OnInit { getProductCategories(); } + void checkInput() { + if(new_prod_category_name=='' || new_prod_category_id=='') { + docreate=false; + } + else { + docreate=true; + for(var cat in product_categories) { + if(cat.id==new_prod_category_id) { + docreate=false; + break; + } + } + } + } + choose(ProductCategory pt) { selected_prod_category=pt; goto_products(pt); diff --git a/lib/product_category_component.html b/lib/product_category_component.html index e255a54..6fff730 100644 --- a/lib/product_category_component.html +++ b/lib/product_category_component.html @@ -17,17 +17,20 @@
+ [(ngModel)]="new_prod_category_name" + (keyup)="checkInput()">
+ [(ngModel)]="new_prod_category_id" + (keyup)="checkInput()">
-- 2.39.2