Add hidden supplier orders display route
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
App.OrdersDisplayController = Ember.ObjectController.extend
|
||||
needs: ['application']
|
||||
active_section: null
|
||||
sections: (-> @store.all('section') ).property()
|
||||
orders: Ember.computed 'model.@each', 'active_section.id', ->
|
||||
orders = @get('model').filterBy('needs_supplier_attention')
|
||||
orders = orders.filterBy('section.id', id) if id = @get('active_section.id')
|
||||
orders.sortBy('created_at') # Not reversed, oldest on top, start with oldest order first :-) Customer happyness
|
||||
activeSectionDidChange: Ember.observer 'active_section.id', ->
|
||||
container = Ember.$('.orders-display-nav')
|
||||
container.find('dd').removeClass('active')
|
||||
if id = @get('active_section.id')
|
||||
container.find("[data-section='#{id}']").addClass 'active'
|
||||
else
|
||||
container.find('[data-section="all"]').addClass 'active'
|
||||
actions:
|
||||
clearActiveSection: ->
|
||||
@set 'active_section', null
|
||||
setActiveSection: (section)->
|
||||
@set 'active_section', section
|
||||
@@ -10,7 +10,7 @@ App.Order = DS.Model.extend
|
||||
active: (-> @get('state') == 'active').property('state')
|
||||
delivered: (-> @get('state') == 'delivered').property('state')
|
||||
placed: (-> @get('state') == 'placed').property('state')
|
||||
needs_supplier_attention: (-> @get('state') == 'placed' || @get('state') == 'active').property('state')
|
||||
needs_supplier_attention: (-> (@get('state') == 'placed') || (@get('state') == 'active')).property('state')
|
||||
|
||||
#display: (->
|
||||
#return '' unless @get('product_orders')
|
||||
|
||||
@@ -12,6 +12,7 @@ App.Router.map ->
|
||||
@resource 'table', path: ':table_id'
|
||||
@resource 'lists', ->
|
||||
@resource 'list', path: ':list_id'
|
||||
@route 'orders_display' # chromecast etc
|
||||
@route 'settings'
|
||||
@route 'empty'
|
||||
#@resource 'lists', queryParams: ['state']
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
App.OrdersDisplayRoute = Ember.Route.extend
|
||||
model: -> @store.all('order')
|
||||
@@ -2,7 +2,8 @@ td.user-info.show-for-large-up
|
||||
each user in view.content.list.users
|
||||
= user.facebook_image_tag
|
||||
td.status-icons
|
||||
span.active-order.fa.fa-check.fa-lg
|
||||
if view.content.active
|
||||
span.active-order.fa.fa-check.fa-lg
|
||||
td= view.content.display
|
||||
td.numeric.table_number: App.TableNumberWithInfoView contextBinding="view.content.list"
|
||||
td.section_title: link-to 'section' view.content.list.table.section.id: span=view.content.list.table.section.title
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
dl.orders-display-nav.sub-nav
|
||||
dd.active data-section="all": a.active{action "clearActiveSection"} href="" All
|
||||
each section in sections
|
||||
dd data-section=section.id: a{action "setActiveSection" section} href="#" = section.title
|
||||
table.table
|
||||
thead
|
||||
tr
|
||||
th.user-info
|
||||
th.status-icons
|
||||
th=t 'models.order'
|
||||
th.numeric=t 'table_number'
|
||||
th=t 'models.section'
|
||||
th.currency=t 'active_orders.price'
|
||||
th.time
|
||||
tbody
|
||||
each order in orders
|
||||
tr
|
||||
td
|
||||
each user in order.list.users
|
||||
= user.facebook_image_tag
|
||||
td.status-icons
|
||||
if order.active
|
||||
span.active-order.fa.fa-check.fa-lg
|
||||
td= order.display
|
||||
td.numeric.table_number: App.TableNumberWithInfoView contextBinding="order.list"
|
||||
td.section_title: link-to 'section' order.list.table.section.id: span=order.list.table.section.title
|
||||
td.currency=currency order.total
|
||||
td.time= time order.created_at format="HH:mm"
|
||||
Reference in New Issue
Block a user