partial #237 - on mobile, collapse items in cart when adding another item
This commit is contained in:
parent
8cbd2a0814
commit
cb68b8caed
@ -22,6 +22,13 @@ NGApp.factory('CartService', function () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Collapse all items
|
||||||
|
service.collapseItems = function(){
|
||||||
|
for( x in service.restaurants[ service.id_restaurant ].items ){
|
||||||
|
service.restaurants[ service.id_restaurant ].items[ x ].details.customization.expanded = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
service.clean = function(){
|
service.clean = function(){
|
||||||
for( x in service.restaurants ){
|
for( x in service.restaurants ){
|
||||||
service.restaurants[x] = { uuidInc : 0, items : {} };
|
service.restaurants[x] = { uuidInc : 0, items : {} };
|
||||||
@ -29,6 +36,9 @@ NGApp.factory('CartService', function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
service.add = function (item) {
|
service.add = function (item) {
|
||||||
|
|
||||||
|
// Collapose all expanded items when user adds a new one
|
||||||
|
service.collapseItems();
|
||||||
var id = service.uuid(),
|
var id = service.uuid(),
|
||||||
dish = App.cache('Dish', item);
|
dish = App.cache('Dish', item);
|
||||||
dish_options = dish.options(),
|
dish_options = dish.options(),
|
||||||
@ -67,6 +77,7 @@ NGApp.factory('CartService', function () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
service.restaurants[ service.id_restaurant ].items[id] = {
|
service.restaurants[ service.id_restaurant ].items[id] = {
|
||||||
id: item,
|
id: item,
|
||||||
options: options,
|
options: options,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user