Upgrades and fixes, maintenance

This commit is contained in:
2014-06-09 19:07:46 +02:00
parent 78a894759b
commit 0e4993e8a6
23 changed files with 87 additions and 57 deletions
@@ -6,11 +6,15 @@ Qsupplier.App.List = DS.Model.extend
user_requests_closing: attr('boolean')
users: DS.hasMany('user')
is_paid: attr 'boolean'
has_active_orders: attr 'boolean'
#has_active_orders: attr 'boolean'
has_active_orders: (->
return false unless @get('state') == 'active'
!!@get('orders').filterProperty('state', 'active').length
).property('state', 'orders.@each.state')
price: attr 'number'
closed_at: DS.attr('date')
#table_number: attr 'number'
table: DS.belongsTo('table', inverse: 'active_list')
#table: DS.belongsTo('table', inverse: 'active_list')
#users: DS.hasMany('user', inverse: 'active_list')
orders: DS.hasMany('order')
section: DS.belongsTo('section')
@@ -18,7 +22,7 @@ Qsupplier.App.List = DS.Model.extend
active: ( -> @get('state') == 'active' ).property('state')
markClosed: ->
@set('state', 'closed')
@set 'has_active_orders', false
#@set 'has_active_orders', false
@markHelped()
@markIsPaid()
markHelped: ->
@@ -7,7 +7,9 @@ Qsupplier.App.Table = DS.Model.extend
position_y: attr 'number'
occupied: attr 'boolean'
section: DS.belongsTo('section')
#active_list: DS.belongsTo('list', key: 'active_list')
active_list: DS.belongsTo('list')
#list: DS.belongsTo('list')
#active_list: (->
#@get('list')
#).property('list')