From 7fa9a7d9415ae320fc59983b0b5f2d556698de19 Mon Sep 17 00:00:00 2001 From: Benjamin ter Kuile Date: Thu, 8 Oct 2015 00:43:54 +0200 Subject: [PATCH] Lists display fixes --- .../lists_index_controller.js.coffee | 4 +- .../supplier/app/templates/lists/index.emblem | 68 +++++++++++-------- .../foundation1/resources/_sections.sass | 3 + 3 files changed, 44 insertions(+), 31 deletions(-) create mode 100644 app/assets/stylesheets/supplier/foundation1/resources/_sections.sass diff --git a/app/assets/javascripts/supplier/app/controllers/lists_index_controller.js.coffee b/app/assets/javascripts/supplier/app/controllers/lists_index_controller.js.coffee index 3e607630..71c95fe9 100644 --- a/app/assets/javascripts/supplier/app/controllers/lists_index_controller.js.coffee +++ b/app/assets/javascripts/supplier/app/controllers/lists_index_controller.js.coffee @@ -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' diff --git a/app/assets/javascripts/supplier/app/templates/lists/index.emblem b/app/assets/javascripts/supplier/app/templates/lists/index.emblem index ad025eec..f52ef749 100644 --- a/app/assets/javascripts/supplier/app/templates/lists/index.emblem +++ b/app/assets/javascripts/supplier/app/templates/lists/index.emblem @@ -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' diff --git a/app/assets/stylesheets/supplier/foundation1/resources/_sections.sass b/app/assets/stylesheets/supplier/foundation1/resources/_sections.sass new file mode 100644 index 00000000..fe4889f5 --- /dev/null +++ b/app/assets/stylesheets/supplier/foundation1/resources/_sections.sass @@ -0,0 +1,3 @@ +.sections-route + .picker__button--clear + display: none