Many supplier features and style upgrades and fixes

This commit is contained in:
2015-10-06 16:08:00 +02:00
parent b7a5b3b750
commit 2df5b290ef
50 changed files with 225 additions and 474 deletions
@@ -1,7 +1,7 @@
App.ButtonRemoveListNeedsPaymentComponent = Ember.Component.extend
tagName: 'button'
layoutName: 'components/button/remove-list-needs-payment'
classNames: ['remove_list_needs_payment']
classNames: ['remove-list-needs-payment-button']
classNameBindings: ['content.needs_payment:show:hide']
click: ->
@get('content').invoke 'remove_needs_payment'
@@ -0,0 +1,6 @@
App.ButtonShowListComponent = Ember.Component.extend
tagName: 'button'
layoutName: 'components/button/show-list'
classNames: ['show-list-button']
click: ->
@get('targetObject.targetObject').transitionToRoute('list', @get('content'))
@@ -1,8 +1,5 @@
App.DashboardActiveListComponent = Ember.Component.extend
tagName: 'tr'
classNames: ['row']
layoutName: 'dashboard/active-list'
classNameBindings: ['classIdentifier']
classIdentifier: Ember.computed 'list.id', -> "list-row-#{@get('list.id')}"
actions:
showList: (list)->
@get('targetObject').transitionToRoute 'list', list
@@ -1,5 +1,5 @@
App.DashboardActiveOrderComponent = Ember.Component.extend
tagName: 'tr'
classNames: ['row']
layoutName: 'dashboard/active-order'
classNameBindings: ['order.active:active', 'order.delivered:delivered', 'classIdentifier']
classIdentifier: Ember.computed 'order.id', -> "order-row-#{@get('order.id')}"
@@ -28,6 +28,7 @@ App.MySelectComponent = Ember.Component.extend
@$('select:first').prop('selectedIndex', index)
actions:
showDebugger: -> debugger
change: ->
selectedIndex = @$('select:first').get(0).selectedIndex
@@ -17,5 +17,6 @@ App.SelectMinuteOfDayComponent = Ember.Component.extend
@set 'value', 60*hour + parseInt(value)
value
get: ->
number = Math.floor @get('value')%60
return "00" unless value = @get('value')
number = Math.floor value%60
"0#{number}".substr(-2,2)
@@ -0,0 +1,7 @@
App.UsersButtonsComponent = Ember.Component.extend
classNames: ['users-buttons']
actions:
userClick: (user)->
@modal 'user_info',
title_path: 'modal.user_info.title'
model: user
@@ -1,20 +1,18 @@
App.ListsIndexController = Ember.Controller.extend
loading: true
date: (new Date()).toISOString().substr(0,10) # 2015-11-02
dateChanged: (->
return unless date = @get('date')
@set 'loading', true
lists = if @get('date') then @store.findAll('list', date: @get('date')) else @store.findAll('list')
lists.then => @set('loading', false)
@set 'model', lists
@store.query 'list', date: date
.then => @set('loading', false)
).observes('date')
lists: (->
return @store.peekAll('list') unless date = @get('date')
@store.filter('list', (l)->
return false unless list_date = l.get('created_at')
list_date = list_date.toISOString().substring(0,10) if typeof(list_date) is 'object'
list_date == date
)
).property('date')
lists: Ember.computed 'date', ->
return @store.peekAll('list') unless selected_date = @get('date')
@store.peekAll('list').filter (list)->
return false unless list_creation_date = list.get('created_at')
list_creation_date = list_creation_date.toISOString().substring(0,10) if typeof(list_creation_date) is 'object'
selected_date is list_creation_date
sorted_lists: (->
sorted_lists: Ember.computed 'lists.[]', ->
@get('lists').sortBy('created_at').reverseObjects()
).property('lists.[]')
@@ -1,4 +1,4 @@
App.ListsIndexRoute = Ember.Route.extend
#model: -> @store.findAll 'list'
setupController: (controller, model)->
controller.set 'date', (new Date()).toISOString().substr(0,10) unless controller.get('date')
#App.ListsIndexRoute = Ember.Route.extend
# #model: -> @store.findAll 'list'
# setupController: (controller, model)->
# controller.set 'date', (new Date()).toISOString().substr(0,10) unless controller.get('date')
@@ -0,0 +1 @@
span.fa.fa-list.fa-2x
@@ -0,0 +1,5 @@
if user
a.user-avatar-button{action "userClick" user}= user.avatar_tag
else
each users as |user|
a.user-avatar-button{action "userClick" user}= user.avatar_tag
@@ -1,17 +1,16 @@
td.user-info.show-for-large-up
each list.users as |user|
= user.avatar_tag
td.status-icons
if list.needs_help
span.icon.needs-help
if list.needs_payment
|
span.icon.needs-payment
td.numeric.table_number= table-number-with-info list=list
td.section_title: link-to 'section' list.table.section.id: span=list.table.section.title
td.currency.total_list_amount=currency list.total
td.actions
= button-mark-list-helped content=list
= button-remove-list-needs-payment content=list
= button-close-list content=list
button.show-list.button{action "showList" list}: span
.small-12.columns
= users-buttons users=list.users
.status-icons
if list.needs_help
span.icon.needs-help
if list.needs_payment
span.icon.needs-payment
span.table-number= table-number list.table.number
= link-to 'section' list.table.section class="link-to-section"
span=list.table.section.title
span.currency=currency list.total
.actions
= button-mark-list-helped content=list
= button-remove-list-needs-payment content=list
= button-close-list content=list
= button-show-list content=list
@@ -1,13 +1,15 @@
td.user-info.show-for-large-up= order.user.avatar_tag
td.status-icons
if order.active
span.active-order
td= order.display
td.numeric.table_number= table-number-with-info list=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"
td.actions
= button-mark-order-active order=order
= button-mark-order-delivered order=order
= button-mark-order-cancelled order=order
.small-12.columns
= users-buttons users=order.list.users
.status-icons
if order.active
span.active-order
span.order-display= order.display
span.table-number= table-number order.list.table.number
= link-to 'section' order.list.table.section class="link-to-section"
span=order.list.table.section.title
span.currency=currency order.total
span.time= time order.created_at format="HH:mm"
.actions
= button-mark-order-active order=order
= button-mark-order-delivered order=order
= button-mark-order-cancelled order=order
@@ -1,4 +1,4 @@
.row.select-minute-of-day
.small-5.columns= my-select content=hours_list selection=hour identity=false
.small-5.columns.hour-of-day= my-select content=hours_list selection=hour identity=false
.small-1.columns: span
.small-5.columns.end= my-select content=minutes_list selection=minute identity=false
.small-5.columns.end.minute-of-hour= my-select content=minutes_list selection=minute identity=false
@@ -17,18 +17,9 @@
else
h3=t 'dashboard.active_lists.no_lists'
if show_lists_table
table.active-lists-table.table
thead
tr
th.user-info.show-for-large-up
th.status-icons
th.numeric=t 'table_number'
th=t 'models.section'
th.currency=t 'active_lists.price'
th.actions
tbody
each active_lists as |list|
= dashboard-active-list list=list
.active-lists-table
each active_lists as |list|
= dashboard-active-list list=list
.page-header
if active_orders.length
h3.dashboard-orders-header{action "toggleDashboardOrders"}
@@ -41,17 +32,6 @@
else
h3= t 'dashboard.active_orders.no_orders'
if show_orders_table
table.active-orders-table.table
thead
tr
th.user-info.show-for-large-up
th.status-icons
th=t 'models.order'
th.numeric=t 'table_number'
th=t 'models.section'
th.currency=t 'active_orders.price'
th.time
th.actions
tbody
each active_orders as |order|
= dashboard-active-order order=order
.active-orders-table
each active_orders as |order|
= dashboard-active-order order=order
@@ -21,9 +21,7 @@ if list.active
.display-field
= button-mark-list-helped content=list
= button-close-list content=list
.user-info-container
each list.users as |user|
= user.avatar_tag
= users-buttons users=list.users
if list.sorted_orders
.list-orders-container
each list.sorted_orders as |order|
@@ -1,7 +1,5 @@
h4=t 'modal.change_list_table.subtitle' current_table_number=model.table.number
.user-info-container
each model.users as |user|
= user.avatar_tag
= users-buttons users=model.users
each sections as |section|
h3= section.title
ul.change-list-table-section-tables
@@ -31,11 +31,11 @@
.form-field.half= boolean-switch value=model.active_on_sunday
.small-12.medium-6.columns
.row
.small-12.columns.text-center= boolean-button value=model.full_day reverse=true text_path="product_category.modal.active_between.top"
.small-12.columns.text-center= boolean-button value=model.full_day reverse=true text_path="product_category.modal.active_between.top" class="toggle-full-day-button"
unless model.full_day
.row
.small-12.columns= select-minute-of-day value=model.start_from
.small-12.columns.select-start_from= select-minute-of-day value=model.start_from
.row
.small-12.columns.text-center= t 'product_category.modal.active_between.middle'
.row
.small-12.columns= select-minute-of-day value=model.end_on
.small-12.columns.select-end_on= select-minute-of-day value=model.end_on
@@ -0,0 +1,9 @@
.form-row
.form-label  
.form-value= model.avatar_tag
.form-row
.form-label= t 'attributes.user.name'
.form-value= model.name
.form-row
.form-label= t 'user.number_of_lists_at_supplier'
.form-value 1
@@ -12,9 +12,7 @@ table.table
tbody
each orders as |order|
tr
td
each order.list.users as |user|
= user.avatar_tag
td= users-buttons users=order.list.users
td.status-icons
if order.active
span.active-order.fa.fa-check.fa-lg
@@ -20,5 +20,4 @@ if table.active_list
=currency table.active_list.total
/.table-action-row
a{action "editTable" table}: span.fa.fa-lg.fa-wrench
each table.active_list.users as |user|
= user.avatar_tag
= users-buttons users=table.active_list.users
@@ -22,7 +22,6 @@ var Qstorage = localStorage;
$.extend($translations.en, <%= I18n.t('supplier', locale: :en).to_json %>);
$.extend($translations.nl, <%= I18n.t('supplier', locale: :nl).to_json %>);
String.prototype.capitalize = function() { return this.charAt(0).toUpperCase() + this.slice(1); }
window.time_zones = <%= ActiveSupport::TimeZone.all.map{|tz| {name: tz.name, formatted: "GMT#{tz.formatted_offset} #{tz.name}"}}.to_json.html_safe %>;
@@ -16,10 +16,6 @@ td.boolean
.boolean-false
@extend .fa, .fa-lg, .fa-minus
.change-list-table-button
+button($bg: $warning-color, $padding: $button-tny)
margin: 0
margin-bottom: 8px
.change-list-table-section-tables
list-style: none
+clearfix
@@ -1,3 +1,4 @@
// spin-rotate is currently used when clicked on a section-element in a section view
.spin-rotate
+animation(spinRotate 2s)
+keyframes(spinRotate)
@@ -1,3 +1,42 @@
.button-text
// Only icons for now
display: none
.mark-list-as-helped-button
+button-icon-only
vertical-align: middle
padding-left: 8px //do not ask me why, just looks
padding-right: 2px //do not ask me why, just looks
margin-right: $button-spacing
span
@extend .fa, .fa-2x, .fa-bell-slash-o
.mark-order-active-button
+button-icon-only
margin-right: 0.6em
.mark-order-delivered-button
+button-icon-only
.show-list-button
+button-icon-only
vertical-align: middle
margin-left: $button-spacing
.mark-order-cancelled-button
+button($bg: $alert-color)
+button-icon-only
margin-left: $button-spacing
span
@extend .fa
@extend .fa-2x
@extend .fa-times
.change-list-table-button
+button($bg: $warning-color, $padding: $button-tny)
margin: 0
margin-bottom: 8px
.close-list-button
+button-icon-only
vertical-align: middle
.remove-list-needs-payment-button
+button-icon-only
vertical-align: middle
padding-left: 8px //do not ask me why, just looks
padding-right: 2px //do not ask me why, just looks
margin-right: $button-spacing
@@ -1,21 +0,0 @@
.mark-list-as-helped-button
+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
span
@extend .fa, .fa-2x, .fa-bell-slash-o
.mark-order-active-button
+button-icon-only
margin-right: 0.6em
.mark-order-delivered-button
+button-icon-only
.mark-order-cancelled-button
+button($bg: $alert-color)
+button-icon-only
margin-left: $button-spacing
span
@extend .fa
@extend .fa-2x
@extend .fa-times
@@ -18,23 +18,41 @@
min-width: 124px
select
width: calc(100% - 30px)
.active-lists-table
width: 100%
.show-list
+button-icon-only
margin-left: $button-spacing
span
@extend .fa
@extend .fa-2x
@extend .fa-list
.remove_list_needs_payment
+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
.close-list-button
+button-icon-only
= active-list-div($float: left, $padding: 4px)
line-height: 50px
float: $float
display: inline-block
vertical-align: middle
padding-left: $padding
padding-right: $padding
.active-lists-table, .active-orders-table
.row
border-bottom: 1px solid #777
background-color: white
padding: 5px
.users-buttons
float: left
.status-icons
font-size: 1.5rem
+active-list-div
.needs-payment
margin-left: 7px
.order-display
+active-list-div
.table-number
+active-list-div
.link-to-section
+active-list-div
.currency
+active-list-div
font-weight: bold
.actions
+active-list-div(right)
button
vertical-align: middle
.time
+active-list-div(right)
.active-orders-table
width: 100%
.go-to-orders-list