X-Git-Url: https://hackdaworld.org/gitweb/?p=outofuni%2Ftavern2.git;a=blobdiff_plain;f=lib%2Fproduct_detail_component.dart;fp=lib%2Fproduct_detail_component.dart;h=4a816add6fda2f448e5cc1ee8b23058a81ebdbbe;hp=59f9fab6bc73a747d4662aa6f9337abe41e2243f;hb=f1aaa26928a71a3112f1b7a68615310099ec1364;hpb=678f7561b74d47e36309ac4ee1007a326e4b7650 diff --git a/lib/product_detail_component.dart b/lib/product_detail_component.dart index 59f9fab..4a816ad 100644 --- a/lib/product_detail_component.dart +++ b/lib/product_detail_component.dart @@ -31,12 +31,12 @@ class ProductDetailComponent implements OnInit { String prod_name; String prod_category; - double prod_price; + String prod_price; ProductDetailComponent(this._prodSrv,this._prodcatSrv, this._routeParams) { prod_name='Product'; - prod_price=0; + prod_price='0'; } Future ngOnInit() async { @@ -46,7 +46,7 @@ class ProductDetailComponent implements OnInit { prodcats = await (_prodcatSrv.getAll()); } prod_name=prod.name; - prod_price=prod.price; + prod_price=prod.price.toString(); prod_category=prod.category; } @@ -55,7 +55,7 @@ class ProductDetailComponent implements OnInit { if(prod.name!=prod_name) { doupdate=true; } - if(prod.price!=prod_price) { + if(prod.price.toString()!=prod_price) { doupdate=true; } if(prod.category!=prod_category) { @@ -65,15 +65,15 @@ class ProductDetailComponent implements OnInit { print('Debug: Updating product '+ prod.name+'/'+prod.price.toString()+'/'+ prod.category+' -> '+ - prod_name+'/'+prod_price.toString()+'/'+ + prod_name+'/'+prod_price+'/'+ prod_category); await _prodSrv.updateProd( prod.id, prod_name, - prod_price, + double.parse(prod_price), prod_category ); - prod.price=prod_price; + prod.price=double.parse(prod_price); prod.name=prod_name; prod.category=prod_category; }