Lists display fixes

This commit is contained in:
2015-10-08 00:43:54 +02:00
parent b163304b46
commit 7fa9a7d941
3 changed files with 44 additions and 31 deletions
@@ -6,7 +6,7 @@ App.ListsIndexController = Ember.Controller.extend
@set 'loading', true @set 'loading', true
@store.query 'list', date: date @store.query 'list', date: date
.then => @set('loading', false) .then => @set('loading', false)
).observes('date') ).observes('date').on('init')
lists: Ember.computed 'date', -> lists: Ember.computed 'date', ->
return @store.peekAll('list') unless selected_date = @get('date') return @store.peekAll('list') unless selected_date = @get('date')
@store.peekAll('list').filter (list)-> @store.peekAll('list').filter (list)->
@@ -16,3 +16,5 @@ App.ListsIndexController = Ember.Controller.extend
sorted_lists: Ember.computed 'lists.[]', -> sorted_lists: Ember.computed 'lists.[]', ->
@get('lists').sortBy('created_at').reverseObjects() @get('lists').sortBy('created_at').reverseObjects()
pricesList: Ember.computed.mapBy 'sorted_lists', 'price'
date_lists_total: Ember.computed.sum 'pricesList'
@@ -1,6 +1,9 @@
.row: .small-12.columns .row.sections-route: .small-12.columns
h2.main-section-header=t 'models.plural.list' h2.main-section-header=t 'models.plural.list'
= list-display-date-selector value=date = list-display-date-selector value=date
if loading
.row: .small-12.columns: .panel: span.loading
else
if sorted_lists if sorted_lists
table.table table.table
thead thead
@@ -24,10 +27,15 @@
td.table_number= list.table.number td.table_number= list.table.number
td.currency=currency list.price td.currency=currency list.price
td.timestamp=time list.created_at td.timestamp=time list.created_at
tfoot
tr
td
td
td
td
td
td.total.currency= currency date_lists_total
td
else else
.row: .small-12.columns .row: .small-12.columns
.panel .panel=t 'list.none_found'
if loading
span.loading
else
=t 'list.none_found'
@@ -0,0 +1,3 @@
.sections-route
.picker__button--clear
display: none