From: hackbard Date: Thu, 6 Oct 2016 22:41:05 +0000 (+0200) Subject: disable category create button X-Git-Url: https://hackdaworld.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3307c69f4b16867ba7522626b6b0acf2d6d9a478;p=outofuni%2Ftavern2.git disable category create button --- 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()">