string double issue fixed
[outofuni/tavern2.git] / lib / product_detail_component.dart
index 59f9fab..4a816ad 100644 (file)
@@ -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<Null> 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;
                }