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
@store.query 'list', date: date
.then => @set('loading', false)
).observes('date')
).observes('date').on('init')
lists: Ember.computed 'date', ->
return @store.peekAll('list') unless selected_date = @get('date')
@store.peekAll('list').filter (list)->
@@ -16,3 +16,5 @@ App.ListsIndexController = Ember.Controller.extend
sorted_lists: Ember.computed 'lists.[]', ->
@get('lists').sortBy('created_at').reverseObjects()
pricesList: Ember.computed.mapBy 'sorted_lists', 'price'
date_lists_total: Ember.computed.sum 'pricesList'
@@ -1,33 +1,41 @@
.row: .small-12.columns
.row.sections-route: .small-12.columns
h2.main-section-header=t 'models.plural.list'
= list-display-date-selector value=date
if sorted_lists
table.table
thead
tr
th.state=t 'attributes.list.state'
th.boolean=t 'attributes.list.needs_help'
th.boolean=t 'attributes.list.needs_payment'
th.timestamp=t 'attributes.list.closed_at'
th.table_number=t 'models.table'
th.currentcy=t 'attributes.list.price'
th.timestamp=t 'attributes.list.created_at'
tbody
each sorted_lists as |list|
tr
td.state
link-to 'list' list.id
= state 'list' list.state
td.boolean.needs_help=boolean list.needs_help
td.boolean.needs_payment=boolean list.needs_payment
td.timestamp=time list.closed_at
td.table_number= list.table.number
td.currency=currency list.price
td.timestamp=time list.created_at
if loading
.row: .small-12.columns: .panel: span.loading
else
.row: .small-12.columns
.panel
if loading
span.loading
else
=t 'list.none_found'
if sorted_lists
table.table
thead
tr
th.state=t 'attributes.list.state'
th.boolean=t 'attributes.list.needs_help'
th.boolean=t 'attributes.list.needs_payment'
th.timestamp=t 'attributes.list.closed_at'
th.table_number=t 'models.table'
th.currentcy=t 'attributes.list.price'
th.timestamp=t 'attributes.list.created_at'
tbody
each sorted_lists as |list|
tr
td.state
link-to 'list' list.id
= state 'list' list.state
td.boolean.needs_help=boolean list.needs_help
td.boolean.needs_payment=boolean list.needs_payment
td.timestamp=time list.closed_at
td.table_number= list.table.number
td.currency=currency list.price
td.timestamp=time list.created_at
tfoot
tr
td
td
td
td
td
td.total.currency= currency date_lists_total
td
else
.row: .small-12.columns
.panel=t 'list.none_found'
@@ -0,0 +1,3 @@
.sections-route
.picker__button--clear
display: none