projects
/
outofuni
/
tavern2.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
b2028ca
)
update views + reduced providers in main app
author
hackbard
<hackbard@hackdaworld.org>
Mon, 17 Oct 2016 20:28:20 +0000
(22:28 +0200)
committer
hackbard
<hackbard@hackdaworld.org>
Mon, 17 Oct 2016 20:28:20 +0000
(22:28 +0200)
lib/app_component.dart
patch
|
blob
|
history
lib/product_category_component.dart
patch
|
blob
|
history
lib/product_category_service.dart
patch
|
blob
|
history
lib/product_detail_component.dart
patch
|
blob
|
history
lib/product_service.dart
patch
|
blob
|
history
diff --git
a/lib/app_component.dart
b/lib/app_component.dart
index
2175bdf
..
814cfb9
100644
(file)
--- a/
lib/app_component.dart
+++ b/
lib/app_component.dart
@@
-6,8
+6,8
@@
import 'package:angular2_rbi/directives.dart';
import 'product_component.dart';
import 'product_category_component.dart';
import 'product_detail_component.dart';
import 'product_component.dart';
import 'product_category_component.dart';
import 'product_detail_component.dart';
-import 'product_service.dart';
-import '
product_category_service
.dart';
+
+import '
tables_component
.dart';
@Component(
selector: 'my-app',
@Component(
selector: 'my-app',
@@
-18,8
+18,6
@@
import 'product_category_service.dart';
MaterialLayout
],
providers: const [
MaterialLayout
],
providers: const [
- ProductService,
- ProductCategoryService,
ROUTER_PROVIDERS
]
)
ROUTER_PROVIDERS
]
)
@@
-40,6
+38,11
@@
import 'product_category_service.dart';
path: '/product/:id',
name: 'ProductDetail',
component: ProductDetailComponent
path: '/product/:id',
name: 'ProductDetail',
component: ProductDetailComponent
+ ),
+ const Route(
+ path: '/tables',
+ name: 'Tables',
+ component: TablesComponent
)
])
)
])
diff --git
a/lib/product_category_component.dart
b/lib/product_category_component.dart
index
b7d3bf1
..
70b1a93
100644
(file)
--- a/
lib/product_category_component.dart
+++ b/
lib/product_category_component.dart
@@
-29,8
+29,13
@@
class ProductCategoryComponent implements OnInit {
ProductCategoryComponent(this._prodcatSrv,this._router);
Future<Null> createProductCategory() async {
ProductCategoryComponent(this._prodcatSrv,this._router);
Future<Null> createProductCategory() async {
- await _prodcatSrv.createProdCategory(new_prod_category_name);
- await ngOnInit();
+ String id = await _prodcatSrv.createProdCategory(
+ new_prod_category_name
+ );
+ product_categories.add(new ProductCategory(
+ id,new_prod_category_name,'product_cetegory'
+ ));
+ new_prod_category_name='';
}
Future<Null> ngOnInit() async {
}
Future<Null> ngOnInit() async {
diff --git
a/lib/product_category_service.dart
b/lib/product_category_service.dart
index
f246a71
..
0d2830d
100644
(file)
--- a/
lib/product_category_service.dart
+++ b/
lib/product_category_service.dart
@@
-35,9
+35,9
@@
class ProductCategoryService {
}
}
}
}
- Future<
Null
> createProdCategory(String name) async {
+ Future<
String
> createProdCategory(String name) async {
try {
try {
- await _http.post(
+
var res =
await _http.post(
_posturl,
headers: {'Content-Type': 'application/json'},
body: JSON.encode({
_posturl,
headers: {'Content-Type': 'application/json'},
body: JSON.encode({
@@
-45,6
+45,7
@@
class ProductCategoryService {
'type': 'product_category'
})
);
'type': 'product_category'
})
);
+ return(JSON.decode(res.body)['id']);
}
catch(e) {
throw _handleError(e);
}
catch(e) {
throw _handleError(e);
diff --git
a/lib/product_detail_component.dart
b/lib/product_detail_component.dart
index
14ba7a7
..
59f9fab
100644
(file)
--- a/
lib/product_detail_component.dart
+++ b/
lib/product_detail_component.dart
@@
-70,9
+70,12
@@
class ProductDetailComponent implements OnInit {
await _prodSrv.updateProd(
prod.id,
prod_name,
await _prodSrv.updateProd(
prod.id,
prod_name,
-
double.parse(prod_price)
,
+
prod_price
,
prod_category
);
prod_category
);
+ prod.price=prod_price;
+ prod.name=prod_name;
+ prod.category=prod_category;
}
}
}
}
diff --git
a/lib/product_service.dart
b/lib/product_service.dart
index
0ffe964
..
218b169
100644
(file)
--- a/
lib/product_service.dart
+++ b/
lib/product_service.dart
@@
-57,7
+57,7
@@
class ProductService {
}
}
}
}
- Future<
Null> createProduct(String name,double price
,String cat) async {
+ Future<
String> createProduct(String name,double pri
,String cat) async {
try {
var url=_server+'/'+_db;
var response = await _http.post(
try {
var url=_server+'/'+_db;
var response = await _http.post(
@@
-65,7
+65,7
@@
class ProductService {
headers: {'Content-Type': 'application/json'},
body: JSON.encode({
'name': name,
headers: {'Content-Type': 'application/json'},
body: JSON.encode({
'name': name,
- 'price': pri
ce
,
+ 'price': pri,
'type': 'product',
'category': cat
})
'type': 'product',
'category': cat
})