Qwaiter supplier on Ember 1.0
This commit is contained in:
@@ -11,3 +11,8 @@ Qsupplier.App.List = DS.Model.extend
|
||||
orders: DS.hasMany('Qsupplier.App.Order')
|
||||
section: DS.belongsTo('Qsupplier.App.Section')
|
||||
section_id: attr('string')
|
||||
close: ->
|
||||
@get('orders').forEach (order)->
|
||||
order.close()
|
||||
@set('table', null)
|
||||
@list.set('state', 'closed')
|
||||
|
||||
@@ -2,7 +2,7 @@ attr = DS.attr
|
||||
Qsupplier.App.Order = DS.Model.extend
|
||||
state: attr('string')
|
||||
list: DS.belongsTo('Qsupplier.App.List')
|
||||
total_amount: attr('number')
|
||||
price: attr('number')
|
||||
product_orders: attr('object')
|
||||
section: DS.belongsTo('Qsupplier.App.Section')
|
||||
section_id: attr('string')
|
||||
@@ -13,5 +13,9 @@ Qsupplier.App.Order = DS.Model.extend
|
||||
needs_supplier_attention: (-> @get('state') == 'placed' || @get('state') == 'active').property('state')
|
||||
|
||||
display: (->
|
||||
return '' unless @get('product_orders')
|
||||
@get('product_orders').map((po)-> "#{po.product_name} (#{po.quantity})").join(',')
|
||||
).property('product_orders')
|
||||
|
||||
close: ->
|
||||
@set('state', 'closed')
|
||||
|
||||
Reference in New Issue
Block a user