Fix new product orders display for users
This commit is contained in:
@@ -10,4 +10,4 @@ App.MenuItemProductOrdersComponent = Ember.Component.extend
|
||||
#orderTotal: Ember.computed 'product_orders.@each.total', ->
|
||||
# debugger
|
||||
click: ->
|
||||
@get('targetObject').transitionToRoute 'product_orders'
|
||||
@get('targetObject').transitionToRoute 'product-orders'
|
||||
|
||||
+3
-1
@@ -1,8 +1,10 @@
|
||||
App.ProductOrdersListComponent = Ember.Component.extend
|
||||
App.NewProductOrdersListComponent = Ember.Component.extend
|
||||
orderTotal: (->
|
||||
#Math.round(Math.random()*100)
|
||||
@get('product_orders').getEach('total').reduce(((sum, total) -> sum + total), 0)
|
||||
).property('product_orders.@each.quantity')
|
||||
all_product_orders: Ember.computed -> @store.peekAll('product_order')
|
||||
product_orders: Ember.computed 'all_product_orders.@each.isNew', -> @get('all_product_orders').filterBy('isNew')
|
||||
#product_orders: (->@get('model')).property('model')
|
||||
#product_orders: -> @store.peekAll('product_order')
|
||||
showTotal: (-> if @get('product_orders.length') && @get('product_orders.length') > 1 then true else false ).property('product_orders.length')
|
||||
@@ -16,8 +16,6 @@ App.TableController = Ember.Controller.extend
|
||||
return false if @get('globals.list') # if you already have an active list, do not join another
|
||||
if @get('model.occupied') then true else false # no point in joining tables that are not occupied
|
||||
).property('globals.list.id', 'supplier.can_take_orders', 'model.occupied', 'model.id', 'globals.list.table.id')
|
||||
all_product_orders: Ember.computed -> @store.peekAll('product_order')
|
||||
new_product_orders: Ember.computed 'all_product_orders.@each.isNew', -> @get('all_product_orders').filterBy('isNew')
|
||||
actions:
|
||||
joinOccupiedTable: ->
|
||||
Ember.$.post("#{$data_host}/user/join_occupied_table.json", table_id: @get('model.id'))
|
||||
|
||||
@@ -18,9 +18,9 @@ App.Product = DS.Model.extend
|
||||
addOrderItem: (options = {})->
|
||||
#if existing = @store.all('product_order').find((po)-> po.get('product') == product and not po.get('order'))
|
||||
if options.product_variant
|
||||
existing = @get('product_orders').find( (po)-> !po.get('isNew') and po.get('product_variant') is options.product_variant )
|
||||
existing = @get('product_orders').find( (po)-> po.get('isNew') and po.get('product_variant') is options.product_variant )
|
||||
else
|
||||
existing = @get('product_orders').find( (po)-> !po.get('isNew') )
|
||||
existing = @get('product_orders').find( (po)-> po.get('isNew') )
|
||||
|
||||
if existing
|
||||
existing.increment()
|
||||
|
||||
@@ -13,7 +13,7 @@ App.Router.map ->
|
||||
@resource 'lists', ->
|
||||
@resource 'list', path: ':list_id'
|
||||
@route 'settings'
|
||||
@route 'product_orders'
|
||||
@route 'product-orders'
|
||||
@route 'error'
|
||||
@route 'about'
|
||||
@route 'scanning'
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
= new-product-orders-list
|
||||
@@ -1,4 +1,4 @@
|
||||
.row
|
||||
.row: .small-12.columns
|
||||
h3
|
||||
span.supplier-name= supplier.name
|
||||
span.table-number
|
||||
@@ -11,10 +11,9 @@
|
||||
span=t 'join_request.requestor.waiting_for_approval'
|
||||
else
|
||||
button.join-table-button{action "joinOccupiedTable"}=t 'join_request.requestor.join_this_table'
|
||||
.row
|
||||
if tableCanTakeOrders
|
||||
.large-6.columns= menu-product-categories product_categories=supplier.product_categories orderProducts=true
|
||||
.large-6.columns= product-orders-list table=model product_orders=new_product_orders
|
||||
.large-6.columns= new-product-orders-list table=model
|
||||
else
|
||||
.large12= menu-product-categories product_categories=supplier.product_categories orderProducts=false
|
||||
each new_product_orders as |po|
|
||||
.row: b=po.display
|
||||
|
||||
Reference in New Issue
Block a user