Better dashboard

This commit is contained in:
2014-07-22 19:00:12 +02:00
parent 3202ba8f19
commit b111b22b94
8 changed files with 81 additions and 51 deletions
@@ -7,11 +7,7 @@ Qsupplier.App.List = DS.Model.extend
users: DS.hasMany('user') users: DS.hasMany('user')
is_paid: attr 'boolean' 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
!!@get('orders').filter( (order) -> order.get('state') is 'active' or order.get('state') is 'placed').length
).property('state', 'orders.@each.state')
price: attr 'number' price: attr 'number'
closed_at: DS.attr('date') closed_at: DS.attr('date')
#table_number: attr 'number' #table_number: attr 'number'
@@ -40,7 +36,11 @@ Qsupplier.App.List = DS.Model.extend
total: (-> total: (->
@get('relevant_orders').getEach('total').reduce(((sum, total) -> sum + total), 0) @get('relevant_orders').getEach('total').reduce(((sum, total) -> sum + total), 0)
).property('relevant_orders.@each.total') ).property('relevant_orders.@each.total')
has_active_orders: (->
return false unless @get('state') == 'active'
#!!@get('orders').filterProperty('state', 'active').length
!!@get('orders').filter( (order) -> order.get('state') is 'active' or order.get('state') is 'placed').length
).property('state', 'orders.@each.state')
close: -> close: ->
@markClosed() @markClosed()
$.post Routes.supplier_close_list_path(), list_id: @id $.post Routes.supplier_close_list_path(), list_id: @id
@@ -21,6 +21,10 @@ Qsupplier.App.Order = DS.Model.extend
@set 'state', 'closed' @set 'state', 'closed'
markCancelled: -> markCancelled: ->
@set 'state', 'cancelled' @set 'state', 'cancelled'
markDelivered: ->
@set 'state', 'closed'
markActive: ->
@set 'state', 'active'
total: (-> total: (->
@get('product_orders').getEach('total').reduce(((sum, total) -> sum + total), 0) @get('product_orders').getEach('total').reduce(((sum, total) -> sum + total), 0)
).property('product_orders.@each.total') ).property('product_orders.@each.total')
@@ -13,6 +13,8 @@ td.actions
span.fa-stack.fa-2x.fa-stack-sized span.fa-stack.fa-2x.fa-stack-sized
i.fa.fa-bell.fa-stack-small i.fa.fa-bell.fa-stack-small
i.fa.fa-ban.revoke i.fa.fa-ban.revoke
/span.button-text=t 'list.is_helped_button' button.close_list{ action closeList view.content.id}
button.close_list{ action closeList view.content.id}: span span.fa-stack.fa-2x.fa-stack-sized
i.fa.fa-credit-card
i.fa-stack-check
button.show-list.button{action "showList" view.content.id}: span button.show-list.button{action "showList" view.content.id}: span
@@ -1,8 +1,8 @@
.table-number {{table.number}} .table-number {{table.number}}
.status-icons .status-icons
span.needs_payment.icon-flag span.needs_payment
span.needs_help.icon-bell span.needs_help
span.active_order.icon-glass span.active_order
div class="table-actions table-actions-#{unbound table.id}" div class="table-actions table-actions-#{unbound table.id}"
.title {{table.number}} .title {{table.number}}
if table.active_list.needs_help if table.active_list.needs_help
@@ -51,11 +51,15 @@ root.Qsupplier=
$('#list-is-helped-button-'+list_id).addClass('hide') $('#list-is-helped-button-'+list_id).addClass('hide')
$('.section-table-list-'+list_id).removeClass('needs_help') $('.section-table-list-'+list_id).removeClass('needs_help')
else if e.event == 'order_being_processed' else if e.event == 'order_being_processed'
$('#order-in-process-button-'+e.data.id).hide() if Qsupplier.App and order = Qsupplier.App.Order.findCached(e.data.id)
$('.order-row-'+e.data.id).removeClass('placed').addClass('active') order.markActive()
# $('#order-in-process-button-'+e.data.id).hide()
# $('.order-row-'+e.data.id).removeClass('placed').addClass('active')
else if e.event == 'order_being_delivered' else if e.event == 'order_being_delivered'
$('.order-row-'+e.data.id).remove() if Qsupplier.App and order = Qsupplier.App.Order.findCached(e.data.id)
$('.section-table-list-'+e.data.list_id).removeClass('active_order') order.markDelivered()
# $('.order-row-'+e.data.id).remove()
# $('.section-table-list-'+e.data.list_id).removeClass('active_order')
else if e.event == 'orders_in_process_count' else if e.event == 'orders_in_process_count'
$('.supplier-orders-in-process-count-number').text e.data.count $('.supplier-orders-in-process-count-number').text e.data.count
else if e.event == 'orders_placed_count' else if e.event == 'orders_placed_count'
@@ -57,3 +57,10 @@ button, .button
&.fa-stack-small &.fa-stack-small
margin-left: -1.35rem margin-left: -1.35rem
vertical-align: 30% vertical-align: 30%
.fa-stack-check:last-child
@extend .fa
@extend .fa-check
color: #ffd600
margin-left: -2rem
vertical-align: 0
text-shadow: 1px 4px 1px rgba(0, 0, 0, 0.45)
@@ -8,10 +8,13 @@ $button-spacing: 8px
width: 100% width: 100%
.mark_list_as_helped .mark_list_as_helped
+button-icon-only +button-icon-only
vertical-align: top
padding-left: 8px //do not ask me why, just looks
padding-right: 2px //do not ask me why, just looks
margin-right: $button-spacing margin-right: $button-spacing
.close_list .close_list
+button-icon-only +button-icon-only
span //span
@extend .fa @extend .fa
@extend .fa-2x @extend .fa-2x
@extend .fa-times // This is not good!!! @extend .fa-times // This is not good!!!
@@ -22,7 +22,14 @@
border-right: $section-border border-right: $section-border
border-bottom: $section-border border-bottom: $section-border
border: $section-border border: $section-border
position: relative
padding: 0
height: 400px
//background-image: image-url('textures/wood4.jpg')
//background-color: rgba(0,0,0,0.4)
.section-table .section-table
position: absolute
cursor: pointer
background-color: #ccc background-color: #ccc
//TODO remove width and height for ember control //TODO remove width and height for ember control
height: 48px height: 48px
@@ -31,8 +38,41 @@
box-shadow: 5px 5px 5px #888888 box-shadow: 5px 5px 5px #888888
color: black color: black
border-radius: 3px border-radius: 3px
.status-icons
// float: right
// width: 16px
margin-top: -18px
.needs_help, .needs_payment, .occupied, .active_order
display: none
float: right
@extend .fa
.needs_help
@extend .fa-bell
.needs_payment
@extend .fa-money
.active_order
@extend .fa-coffee
&.occupied
background-color: #ffa
&.needs_help
background-color: #7f7
.status-icons .needs_help
display: inline-block
&.needs_payment
// background-image: image-url('icons/needs-payment.png')
// background-position: 40px 2px
.status-icons .needs_payment
display: inline-block
&.active_order
.active_order
display: block
.status-icons .active_order
display: inline-block
//background-color: #f77
a a
color: black color: black
&:hover
text-decoration: none
//background-image: image-url('icons/section-table.png') //background-image: image-url('icons/section-table.png')
.table-link .table-link
margin-top: -45px margin-top: -45px
@@ -44,12 +84,7 @@
width: 45px width: 45px
font-size: 42px font-size: 42px
text-align: center text-align: center
.status-icons
float: right
width: 16px
span
display: none
float: right
.action-button-container .action-button-container
margin-right: -20px margin-right: -20px
.table-actions .table-actions
@@ -73,37 +108,12 @@
top: -30px top: -30px
select select
width: 92px width: 92px
&.section-tables-active //&.section-tables-active
position: relative
padding: 0 //&.section-tables-manage
height: 400px
//background-image: image-url('textures/wood4.jpg')
//background-color: rgba(0,0,0,0.4)
.section-table
position: absolute
cursor: pointer
&.occupied
background-color: #ffa
&.needs_help
background-color: #7f7
.needs_help
display: block
&.needs_payment
background-image: image-url('icons/needs-payment.png')
background-position: 40px 2px
.needs_payment
display: block
&.active_order
.active_order
display: block
//background-color: #f77
a
&:hover
text-decoration: none
&.section-tables-manage
.section-table .section-table
cursor: move cursor: move
&.section-tables-inactive //&.section-tables-inactive
.section-table .section-table
position: relative position: relative
margin-top: 10px margin-top: 10px