diff --git a/app/assets/javascripts/qrammer.js.coffee b/app/assets/javascripts/qrammer.js.coffee
index 3bfc01ef..666e171c 100644
--- a/app/assets/javascripts/qrammer.js.coffee
+++ b/app/assets/javascripts/qrammer.js.coffee
@@ -20,82 +20,7 @@ root.Qrammer =
currency: (num) ->
num = 0.0 if isNaN(num) || num == '' || num == null
'€ ' + parseFloat(num).toFixed(2)
- load_active_orders: () ->
- $.get('/supplier/active_orders.json', (res) ->
- body = $('#active-orders-table tbody')
- body.find('tr').remove()
- foot = $('#active-orders-table tfoot')
- if(!res.orders && !res.orders.length)
- alert('No orders in list');
- return;
- for order in res.orders
- order_txts = []
- row = $('
').appendTo(body)
- process_btn = $('')
- process_callback = ( (ord) ->
- ->
- my_btn = $(this)
- $.post('/supplier/mark_order_in_process', {order_id: ord.id}, (res)-> my_btn.remove())
- )(order)
- process_btn.click(process_callback)
- delivered_btn = $('')
- delivered_callback = ( (ord, r) ->
- ->
- my_btn = $(this)
- $.post('/supplier/order_is_delivered', {order_id: ord.id}, (res)-> r.slideUp('slow'))
- )(order, row)
- delivered_btn.click(delivered_callback)
- for product in order.products
- order_txts.push(product.name + ' (' + product['number'] + ')')
- row.append($(' | ').text(order_txts.join(', ')))
- row.append($(' | ').text(order.table_number))
- row.append($(' | ').html(Qrammer.currency(order.total_amount)))
- td_buttons = $(' | ')
- td_buttons.append(process_btn).append(' ') if order.state == 'placed'
- td_buttons.append(delivered_btn)
- row.append(td_buttons)
- #foot.append(' | '+Qrammer.currency(res.total_amount)+' |
');
- )
-
-
- load_active_lists: () ->
- $.get('/supplier/active_lists.json', (res) ->
- body = $('#active-lists-table tbody')
- body.find('tr').remove()
- foot = $('#active-lists-table tfoot')
- for list in res.lists
- order_txts = []
- row = $('
').appendTo(body)
- close_btn = $('')
- close_callback = ( (lst, r) ->
- ->
- my_btn = $(this)
- $.post('/supplier/close_list', {list_id: list._id}, (res)-> r.slideUp('slow'))
- )(list, row)
- close_btn.click(close_callback)
-
- needs_help_btn = $('')
- needs_help_callback = ( (lst, r) ->
- ->
- my_btn = $(this)
- $.post('/supplier/mark_list_as_helped', {list_id: list._id}, (res)-> my_btn.remove() )
- )(list, row)
- needs_help_btn.click(needs_help_callback)
-
-
- icons_td = $(' | ').appendTo(row)
- icons_td.append('').append(' ') if list.needs_help # or icon-bell
- icons_td.append('') if list.needs_payment
-
- row.append($(' | ').text(list.table_number))
- row.append($(' | ').html(Qrammer.currency(list.total_amount)))
- td_buttons = $(' | ')
- td_buttons.append(needs_help_btn).append(' ') if list.needs_help
- td_buttons.append(close_btn)
- row.append(td_buttons)
- #foot.append(' | '+Qrammer.currency(res.total_amount)+' |
');
- )
build_product_list_as_modal: ->
wrapper = $('')
diff --git a/app/assets/javascripts/qsupplier.js.coffee b/app/assets/javascripts/qsupplier.js.coffee
index bf7d5a43..2cb8b084 100644
--- a/app/assets/javascripts/qsupplier.js.coffee
+++ b/app/assets/javascripts/qsupplier.js.coffee
@@ -13,8 +13,8 @@ root.Qsupplier=
data: {table: {section_id: current_section_id}},
dataType: 'json'
)
- position_table_in_active_section: (section_container, table_container, skip_persisting)->
- skip_persisting ||= false
+ position_table_in_active_section: (section_container, table_container, make_draggable)->
+ make_draggable ||= false
button_container = table_container.find('.action-button-container')
button_container.html('')
button_container.append($('').click( -> Qsupplier.move_table_to_inactive_section(table_container.data('table-id')) ))
@@ -37,7 +37,7 @@ root.Qsupplier=
data: {table: {position_x: position_x, position_y: position_y}},
dataType: 'json'
)
- )
+ ) if make_draggable
move_table_to_inactive_section: (table_id)->
table_container = $('#section-table-'+table_id)
table_container.css('left', 'auto')
@@ -54,3 +54,81 @@ root.Qsupplier=
data: {table: {section_id: ''}},
dataType: 'json'
)
+
+ load_active_lists: () ->
+ $.get('/supplier/active_lists.json', (res) ->
+ body = $('#active-lists-table tbody')
+ body.find('tr').remove()
+ foot = $('#active-lists-table tfoot')
+ for list in res.lists
+ order_txts = []
+ row = $('
').appendTo(body)
+ close_btn = $('')
+ close_callback = ( (lst, r) ->
+ ->
+ my_btn = $(this)
+ $.post('/supplier/close_list', {list_id: list._id}, (res)-> r.slideUp('slow'))
+ )(list, row)
+ close_btn.click(close_callback)
+
+ needs_help_btn = $('')
+ needs_help_callback = ( (lst, r) ->
+ ->
+ my_btn = $(this)
+ $.post('/supplier/mark_list_as_helped', {list_id: list._id}, (res)-> my_btn.remove() )
+ )(list, row)
+ needs_help_btn.click(needs_help_callback)
+
+
+ icons_td = $(' | ').appendTo(row)
+ icons_td.append('').append(' ') if list.needs_help # or icon-bell
+ icons_td.append('') if list.needs_payment
+
+ row.append($(' | ').text(list.table_number))
+ row.append($(' | ').text(list.section_title))
+ row.append($(' | ').html(Qrammer.currency(list.total_amount)))
+ td_buttons = $(' | ')
+ td_buttons.append(needs_help_btn).append(' ') if list.needs_help
+ td_buttons.append(close_btn)
+ row.append(td_buttons)
+ #foot.append(' | '+Qrammer.currency(res.total_amount)+' |
');
+ )
+
+ load_active_orders: () ->
+ $.get('/supplier/active_orders.json', (res) ->
+ body = $('#active-orders-table tbody')
+ body.find('tr').remove()
+ foot = $('#active-orders-table tfoot')
+ if(!res.orders && !res.orders.length)
+ alert('No orders in list');
+ return;
+ for order in res.orders
+ order_txts = []
+ row = $('
').appendTo(body)
+ process_btn = $('')
+ process_callback = ( (ord) ->
+ ->
+ my_btn = $(this)
+ $.post('/supplier/mark_order_in_process', {order_id: ord.id}, (res)-> my_btn.remove())
+ )(order)
+ process_btn.click(process_callback)
+
+ delivered_btn = $('')
+ delivered_callback = ( (ord, r) ->
+ ->
+ my_btn = $(this)
+ $.post('/supplier/order_is_delivered', {order_id: ord.id}, (res)-> r.slideUp('slow'))
+ )(order, row)
+ delivered_btn.click(delivered_callback)
+ for product in order.products
+ order_txts.push(product.name + ' (' + product['number'] + ')')
+ row.append($(' | ').text(order_txts.join(', ')))
+ row.append($(' | ').text(order.table_number))
+ row.append($(' | ').text(order.section_title))
+ row.append($(' | ').html(Qrammer.currency(order.total_amount)))
+ td_buttons = $(' | ')
+ td_buttons.append(process_btn).append(' ') if order.state == 'placed'
+ td_buttons.append(delivered_btn)
+ row.append(td_buttons)
+ #foot.append(' | '+Qrammer.currency(res.total_amount)+' |
');
+ )
diff --git a/app/assets/stylesheets/phone/bootstrap_overrides.css.sass b/app/assets/stylesheets/phone/bootstrap_overrides.css.sass
new file mode 100644
index 00000000..8fcf3817
--- /dev/null
+++ b/app/assets/stylesheets/phone/bootstrap_overrides.css.sass
@@ -0,0 +1,17 @@
+
+//BOOTSTRAP overrides
+body
+ a
+ color: white
+ &:hover
+ color: white
+ .table-hover
+ tbody
+ tr
+ &:hover
+ td
+ background-color: #555
+ .navbar-inner
+ $navbar-inner-teint: 200
+ background-color: rgba($navbar-inner-teint, $navbar-inner-teint, $navbar-inner-teint, 0.8)
+ background-image: url()
diff --git a/app/assets/stylesheets/phone/structure.css.sass b/app/assets/stylesheets/phone/structure.css.sass
index f851ced4..05258971 100644
--- a/app/assets/stylesheets/phone/structure.css.sass
+++ b/app/assets/stylesheets/phone/structure.css.sass
@@ -1,6 +1,8 @@
@import compass
$side-spacing: 5px
$qbrown: #8B5A2B
+
+
html
background-image: image-url('textures/wood5.jpg')
body
diff --git a/app/assets/stylesheets/structure.css.sass b/app/assets/stylesheets/structure.css.sass
index 46ce60cd..24a216fd 100644
--- a/app/assets/stylesheets/structure.css.sass
+++ b/app/assets/stylesheets/structure.css.sass
@@ -5,6 +5,9 @@ table
text-align: right
&.numeric
text-align: right
+ &.actions
+ text-align: right
+
tbody
td
&.status-icons
diff --git a/app/assets/stylesheets/tablet/application.css b/app/assets/stylesheets/tablet/application.css
index 61fbe6b7..eff84b95 100644
--- a/app/assets/stylesheets/tablet/application.css
+++ b/app/assets/stylesheets/tablet/application.css
@@ -1,4 +1,5 @@
/*
*= require_self
*= require_directory .
+ *= require 'phone/bootstrap_overrides'
*/
diff --git a/app/assets/stylesheets/tablet/section_tables.css.sass b/app/assets/stylesheets/tablet/section_tables.css.sass
new file mode 100644
index 00000000..19bac1b5
--- /dev/null
+++ b/app/assets/stylesheets/tablet/section_tables.css.sass
@@ -0,0 +1,36 @@
+.section-tables-container
+ .section-table
+ background-color: #ccc
+ height: 44px
+ background-repeat: no-repeat
+ width: 45px
+ color: black
+ a
+ color: black
+ //background-image: image-url('icons/section-table.png')
+ .table-link
+ margin-top: -45px
+ .table-number
+ position: absolute
+ top: 0
+ line-height: 44px
+ width: 45px
+ font-size: 42px
+ text-align: center
+ .action-button-container
+ margin-right: -20px
+ &.section-tables-active
+ position: relative
+ padding: 0
+ height: 400px
+ //background-image: image-url('textures/wood4.jpg')
+ background-color: rgba(0,0,0,0.4)
+ .section-table
+ position: absolute
+ cursor: move
+ &.section-tables-inactive
+ .section-table
+ margin-top: 10px
+ margin-bottom: 30px
+ float: left
+ margin-right: 30px
diff --git a/app/assets/stylesheets/tablet/structure.css.sass b/app/assets/stylesheets/tablet/structure.css.sass
index ffff9cc6..127b8f38 100644
--- a/app/assets/stylesheets/tablet/structure.css.sass
+++ b/app/assets/stylesheets/tablet/structure.css.sass
@@ -12,38 +12,6 @@ body
margin-top: 4px
margin-bottom: 6px
padding-bottom: 0
-.section-tables-container
- .section-table
- background-color: #ccc
- height: 44px
- background-repeat: no-repeat
- width: 45px
- //background-image: image-url('icons/section-table.png')
- .table-link
- margin-top: -45px
- .table-number
- position: absolute
- top: 0
- line-height: 44px
- width: 45px
- font-size: 42px
- text-align: center
- .action-button-container
- margin-right: -20px
- &.section-tables-active
- position: relative
- padding: 0
- height: 400px
- background-image: image-url('textures/wood5.jpg')
- .section-table
- position: absolute
- cursor: move
- &.section-tables-inactive
- .section-table
- margin-top: 10px
- margin-bottom: 30px
- float: left
- margin-right: 30px
.supplier-is-closed
.alert
form
diff --git a/app/controllers/supplier_controller.rb b/app/controllers/supplier_controller.rb
index 0e40c82e..d49a0af6 100644
--- a/app/controllers/supplier_controller.rb
+++ b/app/controllers/supplier_controller.rb
@@ -49,6 +49,7 @@ class SupplierController < ApplicationController
ho[:total_amount] = order_total.round(2)
ho[:state] = order.state
ho[:table_number] = order.table_number
+ ho[:section_title] = order.list.table.section.title
ho[:id] = order.id
list_total += ho[:total_amount]
h[:orders] << ho
@@ -73,6 +74,7 @@ class SupplierController < ApplicationController
hl = list.as_json
hl[:total_amount] = list.orders.inject(0.0){|sum, o| sum + o.product_orders.inject(0.0){|s, po| s + (po.amount * po.price).round(2)}}.round(2)
grand_total += hl[:total_amount]
+ hl[:section_title] = list.table.section.title
h[:lists] << hl
end
h[:total_amount] = grand_total.round(2)
diff --git a/app/controllers/suppliers/sections_controller.rb b/app/controllers/suppliers/sections_controller.rb
index f784251d..12e1a1f9 100644
--- a/app/controllers/suppliers/sections_controller.rb
+++ b/app/controllers/suppliers/sections_controller.rb
@@ -83,5 +83,27 @@ module Suppliers
format.json { head :no_content }
end
end
+
+ # GET /sections/1/manage_tables
+ # GET /sections/1/manage_tables.json
+ def manage_tables
+ @section = Section.find(params[:id])
+
+ respond_to do |format|
+ format.html # show.html.erb
+ format.json { render json: @section }
+ end
+ end
+
+ # GET /sections/1/tables_view
+ # GET /sections/1/tables_view.json
+ def tables_view
+ @section = Section.find(params[:id])
+
+ respond_to do |format|
+ format.html # show.html.erb
+ format.json { render json: @section }
+ end
+ end
end
end
diff --git a/app/models/supplier.rb b/app/models/supplier.rb
index e43473fc..461215c6 100644
--- a/app/models/supplier.rb
+++ b/app/models/supplier.rb
@@ -25,7 +25,7 @@ class Supplier
def active_orders
return @active_orders if @active_orders
@active_orders = Order.active_for_supplier(id)
- @active_orders.include_relation(list: :table, product_orders: :order)
+ @active_orders.include_relation(list: {table: :section}, product_orders: :order)
@active_orders
end
@@ -34,7 +34,7 @@ class Supplier
@tables ||= active_tables
@tables.include_relation(:lists)
@active_lists = @tables.map(&:lists).flatten.select(&:active?)
- @active_lists.include_relations(:table, orders: {product_orders: :product})
+ @active_lists.include_relations(table: :section, orders: {product_orders: :product})
end
diff --git a/app/views/supplier/active_lists.html.slim b/app/views/supplier/active_lists.html.slim
index 74a2f6d1..c8ef2252 100644
--- a/app/views/supplier/active_lists.html.slim
+++ b/app/views/supplier/active_lists.html.slim
@@ -1,17 +1,19 @@
.page-header= title t('supplier.active_lists.title', lists: List.model_name.human_plural)
-table#active-lists-table.table.table-striped
- thead
- tr
- th.status-icons
- th.number Table number
- th.currency Price
- th.actions
- tbody
+.well
+ table#active-lists-table.table
+ thead
+ tr
+ th.status-icons
+ th.numeric= t('supplier.table_number')
+ th= Section.model_name.human
+ th.currency= t('supplier.active_lists.price')
+ th.actions
+ tbody
- content_for :footer do
javascript:
var active_lists_interval;
jQuery(function(){
- Qrammer.load_active_lists()
- active_lists_interval = setInterval('Qrammer.load_active_lists()', 7500);
+ Qsupplier.load_active_lists()
+ active_lists_interval = setInterval('Qsupplier.load_active_lists()', 7500);
});
diff --git a/app/views/supplier/active_orders.html.slim b/app/views/supplier/active_orders.html.slim
index a5d0d609..1d352e11 100644
--- a/app/views/supplier/active_orders.html.slim
+++ b/app/views/supplier/active_orders.html.slim
@@ -1,16 +1,18 @@
.page-header= title 'Active orders'
-table#active-orders-table.table
- thead
- tr
- th Order
- th.number Table number
- th.currency Price
- th.actions
- tbody
+.well
+ table#active-orders-table.table
+ thead
+ tr
+ th= Order.model_name.human
+ th.numeric= t('supplier.table_number')
+ th= Section.model_name.human
+ th.currency= t('supplier.active_orders.price')
+ th.actions
+ tbody
- content_for :footer do
javascript:
jQuery(function(){
- Qrammer.load_active_orders()
- setInterval( 'Qrammer.load_active_orders()', 7500);
+ Qsupplier.load_active_orders()
+ setInterval( 'Qsupplier.load_active_orders()', 7500);
});
diff --git a/app/views/suppliers/product_categories/index.html.slim b/app/views/suppliers/product_categories/index.html.slim
index 445218c2..6c825906 100644
--- a/app/views/suppliers/product_categories/index.html.slim
+++ b/app/views/suppliers/product_categories/index.html.slim
@@ -1,25 +1,26 @@
- model_class = ProductCategory
.page-header= title :index, model_class
-- if @product_categories.any?
- table.table.table-striped
- thead
- tr
- th= model_class.human_attribute_name(:name)
- th= model_class.human_attribute_name(:position)
- th.timestamp= model_class.human_attribute_name(:created_at)
- th.actions=t 'helpers.actions'
- tbody
- - @product_categories.each do |product_category|
+.well
+ - if @product_categories.any?
+ table.table
+ thead
tr
- td.link= link_to product_category.name, [:suppliers, product_category]
- td= product_category.position
- td.timestamp=l product_category.created_at, format: :short
- td.actions
- = link_to t('helpers.links.edit'), [:edit, :suppliers, product_category], class: 'btn btn-mini'
- '
- = link_to t("helpers.links.destroy"), [:suppliers, product_category], method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-mini btn-danger'
-- else
- = no_content_given model_class
+ th= model_class.human_attribute_name(:name)
+ th= model_class.human_attribute_name(:position)
+ th.timestamp= model_class.human_attribute_name(:created_at)
+ th.actions=t 'helpers.actions'
+ tbody
+ - @product_categories.each do |product_category|
+ tr
+ td.link= link_to product_category.name, [:suppliers, product_category]
+ td= product_category.position
+ td.timestamp=l product_category.created_at, format: :short
+ td.actions
+ = link_to t('helpers.links.edit'), [:edit, :suppliers, product_category], class: 'btn btn-mini'
+ '
+ = link_to t("helpers.links.destroy"), [:suppliers, product_category], method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-mini btn-danger'
+ - else
+ = no_content_given model_class
.form-actions
= link_to t("helpers.links.new"), new_suppliers_product_category_path, class: 'btn btn-primary'
diff --git a/app/views/suppliers/products/index.html.slim b/app/views/suppliers/products/index.html.slim
index fd271e93..9c890720 100644
--- a/app/views/suppliers/products/index.html.slim
+++ b/app/views/suppliers/products/index.html.slim
@@ -1,28 +1,29 @@
- model_class = Product
.page-header= title :index, model_class
-- if @products.any?
- table.table.table-striped
- thead
- tr
- th= model_class.human_attribute_name(:name)
- th= model_class.human_attribute_name(:code)
- th.currency= model_class.human_attribute_name(:price)
- th= ProductCategory.model_name.human
- th.timestamp= model_class.human_attribute_name(:created_at)
- th.actions=t 'helpers.actions'
- tbody
- - @products.each do |product|
+.well
+ - if @products.any?
+ table.table
+ thead
tr
- td.link= link_to product.name, product
- td= product.code
- td.currency=currency product.price
- td.link= link_to_if product.product_category.present?, product.product_category.try(:name), [:suppliers, product.product_category]
- td.timestamp=l product.created_at, format: :short
- td.actions
- = link_to t('helpers.links.edit'), [:edit, :suppliers, product], class: 'btn btn-mini'
- '
- = link_to t("helpers.links.destroy"), [:suppliers, product], method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-mini btn-danger'
-- else
- = no_content_given model_class
+ th= model_class.human_attribute_name(:name)
+ th= model_class.human_attribute_name(:code)
+ th.currency= model_class.human_attribute_name(:price)
+ th= ProductCategory.model_name.human
+ th.timestamp= model_class.human_attribute_name(:created_at)
+ th.actions=t 'helpers.actions'
+ tbody
+ - @products.each do |product|
+ tr
+ td.link= link_to product.name, [:suppliers, product]
+ td= product.code
+ td.currency=currency product.price
+ td.link= link_to_if product.product_category.present?, product.product_category.try(:name), [:suppliers, product.product_category]
+ td.timestamp=l product.created_at, format: :short
+ td.actions
+ = link_to t('helpers.links.edit'), [:edit, :suppliers, product], class: 'btn btn-mini'
+ '
+ = link_to t("helpers.links.destroy"), [:suppliers, product], method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-mini btn-danger'
+ - else
+ = no_content_given model_class
= link_to t("helpers.links.new"), new_suppliers_product_path(product_category_id: @product_category.try(:id)), class: 'btn btn-primary'
diff --git a/app/views/suppliers/sections/index.html.slim b/app/views/suppliers/sections/index.html.slim
index ba31fbcd..ecf4f15f 100644
--- a/app/views/suppliers/sections/index.html.slim
+++ b/app/views/suppliers/sections/index.html.slim
@@ -1,25 +1,27 @@
- model_class = Section
.page-header= title :index, model_class
-- if @sections.any?
- table.table.table-striped
- thead
- tr
- th.link= model_class.human_attribute_name(:title)
- th.numeric= model_class.human_attribute_name(:width)
- th.numeric= model_class.human_attribute_name(:height)
- th.timestamp= model_class.human_attribute_name(:created_at)
- th.actions=t 'helpers.actions'
- tbody
- - @sections.each do |section|
+.well
+ - if @sections.any?
+ table.table
+ thead
tr
- td.link= link_to section.title, [:suppliers, section]
- td.numeric= section.width
- td.numeric= section.height
- td.timestamp=l section.created_at, format: :short
- td.actions
- = link_to t('helpers.links.edit'), [:edit, :suppliers, section], class: 'btn btn-mini'
- '
- = link_to t("helpers.links.destroy"), [:suppliers, section], method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-mini btn-danger'
-- else
- = no_content_given model_class
-= link_to t("helpers.links.new"), new_suppliers_section_path, class: 'btn btn-primary'
+ th.link= model_class.human_attribute_name(:title)
+ th.numeric= model_class.human_attribute_name(:width)
+ th.numeric= model_class.human_attribute_name(:height)
+ th.timestamp= model_class.human_attribute_name(:created_at)
+ th.actions=t 'helpers.actions'
+ tbody
+ - @sections.each do |section|
+ tr
+ td.link= link_to section.title, [:suppliers, section]
+ td.numeric= section.width
+ td.numeric= section.height
+ td.timestamp=l section.created_at, format: :short
+ td.actions
+ = link_to t('helpers.links.edit'), [:edit, :suppliers, section], class: 'btn btn-mini'
+ '
+ = link_to t("helpers.links.destroy"), [:suppliers, section], method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-mini btn-danger'
+ - else
+ = no_content_given model_class
+.form-actions
+ = link_to t("helpers.links.new"), new_suppliers_section_path, class: 'btn btn-primary'
diff --git a/app/views/suppliers/sections/manage_tables.html.slim b/app/views/suppliers/sections/manage_tables.html.slim
new file mode 100644
index 00000000..8d742b72
--- /dev/null
+++ b/app/views/suppliers/sections/manage_tables.html.slim
@@ -0,0 +1,36 @@
+- model_class = Section
+.page-header= title t('section.manage_tables.title', section: Section.model_name.human.downcase, title: @section.title)
+- content_for :row do
+ ul.nav.nav-pills
+ - for section in @section.supplier.sections
+ li class=(section == @section ? 'active' : nil) = link_to section.title, [:suppliers, section]
+ .span9
+ .well.section-tables-container.section-tables-active
+ - for table in @section.tables
+ .section-table.hide{ id="section-table-#{table.id}" data-position-x=table.position_x data-position-y=table.position_y data-table-id=table.id}
+ .pull-right.action-button-container
+ = link_to :i, [:suppliers, table], class: 'btn btn-mini table-link'
+ .table-number = table.number
+ .span3
+ h3= t('table.has_no_section')
+ .well.section-tables-container.section-tables-inactive
+ - for table in @section.supplier.non_placed_tables
+ .section-table{ id="section-table-#{table.id}" data-position-x=table.position_x data-position-y=table.position_y data-table-id=table.id}
+ .pull-right.action-button-container
+ button.btn.btn-primary.btn-mini onClick="Qsupplier.move_table_to_active_section('#{table.id}')" +
+ = link_to :i, [:suppliers, table], class: 'btn btn-mini table-link'
+ .table-number = table.number
+ .clearfix
+- content_for :footer do
+ javascript:
+ var current_section_id = '#{@section.id}';
+ var current_section_width = #{@section.width};
+ var current_section_height = #{@section.height};
+ $(function(){
+ var active_section_container = $('.section-tables-active')
+ active_section_container.css('width', active_section_container.width()); // break fluid layout
+ active_section_container.css('height', #{@section.height/@section.width}*active_section_container.width());
+ active_section_container.find('.section-table').each(function(){
+ Qsupplier.position_table_in_active_section(active_section_container, $(this), true);
+ });
+ });
diff --git a/app/views/suppliers/sections/show.html.slim b/app/views/suppliers/sections/show.html.slim
index db03a7f9..4cd46089 100644
--- a/app/views/suppliers/sections/show.html.slim
+++ b/app/views/suppliers/sections/show.html.slim
@@ -6,38 +6,8 @@
'
= link_to t('helpers.links.edit'), [:edit, :suppliers, @section], class: 'btn'
'
+ = link_to t('supplier.section.manage_tables'), [:manage_tables, :suppliers, @section], class: [:btn, 'btn-warning']
+ '
+ = link_to t('supplier.section.tables_view'), [:tables_view, :suppliers, @section], class: [:btn, 'btn-info']
+ '
= link_to t("helpers.links.destroy"), [:suppliers, @section], method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-danger'
-- content_for :row do
- ul.nav.nav-pills
- - for section in @section.supplier.sections
- li class=(section == @section ? 'active' : nil) = link_to section.title, [:suppliers, section]
- .span9
- .well.section-tables-container.section-tables-active
- - for table in @section.tables
- .section-table.hide{ id="section-table-#{table.id}" data-position-x=table.position_x data-position-y=table.position_y data-table-id=table.id}
- .pull-right.action-button-container
- = link_to :i, [:suppliers, table], class: 'btn btn-mini table-link'
- .table-number = table.number
- .span3
- h3= t('table.has_no_section')
- .well.section-tables-container.section-tables-inactive
- - for table in @section.supplier.non_placed_tables
- .section-table{ id="section-table-#{table.id}" data-position-x=table.position_x data-position-y=table.position_y data-table-id=table.id}
- .pull-right.action-button-container
- button.btn.btn-primary.btn-mini onClick="Qsupplier.move_table_to_active_section('#{table.id}')" +
- = link_to :i, [:suppliers, table], class: 'btn btn-mini table-link'
- .table-number = table.number
- .clearfix
-- content_for :footer do
- javascript:
- var current_section_id = '#{@section.id}';
- var current_section_width = #{@section.width};
- var current_section_height = #{@section.height};
- $(function(){
- var active_section_container = $('.section-tables-active')
- active_section_container.css('width', active_section_container.width()); // break fluid layout
- active_section_container.css('height', #{@section.height/@section.width}*active_section_container.width());
- active_section_container.find('.section-table').each(function(){
- Qsupplier.position_table_in_active_section(active_section_container, $(this), true);
- });
- });
diff --git a/app/views/suppliers/sections/tables_view.html.slim b/app/views/suppliers/sections/tables_view.html.slim
new file mode 100644
index 00000000..1293a46c
--- /dev/null
+++ b/app/views/suppliers/sections/tables_view.html.slim
@@ -0,0 +1,20 @@
+- model_class = Section
+- content_for :row do
+ .span12
+ .well.section-tables-container.section-tables-active
+ - for table in @section.tables
+ .section-table.hide{ id="section-table-#{table.id}" data-position-x=table.position_x data-position-y=table.position_y data-table-id=table.id}
+ .table-number = link_to table.number, suppliers_table_path(table)
+- content_for :footer do
+ javascript:
+ var current_section_id = '#{@section.id}';
+ var current_section_width = #{@section.width};
+ var current_section_height = #{@section.height};
+ $(function(){
+ var active_section_container = $('.section-tables-active')
+ active_section_container.css('width', active_section_container.width()); // break fluid layout
+ active_section_container.css('height', #{@section.height/@section.width}*active_section_container.width());
+ active_section_container.find('.section-table').each(function(){
+ Qsupplier.position_table_in_active_section(active_section_container, $(this), false);
+ });
+ });
diff --git a/app/views/suppliers/tables/index.html.slim b/app/views/suppliers/tables/index.html.slim
index 769f4c47..64f2269a 100644
--- a/app/views/suppliers/tables/index.html.slim
+++ b/app/views/suppliers/tables/index.html.slim
@@ -1,24 +1,26 @@
- model_class = Table
div.page-header= title :index, model_class
-- if @tables.any?
- table.table.table-striped
- thead
- tr
- th.link= model_class.human_attribute_name(:number)
- th.link= Section.model_name.human
- th.timestamp= model_class.human_attribute_name(:created_at)
- th.actions=t 'helpers.actions'
- tbody
- - @tables.each do |table|
+.well
+ - if @tables.any?
+ table.table
+ thead
tr
- td.link= link_to table.number, [:suppliers, table]
- td.link= link_to_if table.section.present?, table.section.try(:title), [:suppliers, table.section]
- td.timestamp=l table.created_at, format: :short
- td.actions
- = link_to t('helpers.links.edit'), [:edit, :suppliers, table], class: 'btn btn-mini'
- '
- = link_to t("helpers.links.destroy"), [:suppliers, table], method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-mini btn-danger'
-- else
- = no_content_given model_class
-= link_to t("helpers.links.new"), new_suppliers_table_path, class: 'btn btn-primary'
+ th.link= model_class.human_attribute_name(:number)
+ th.link= Section.model_name.human
+ th.timestamp= model_class.human_attribute_name(:created_at)
+ th.actions=t 'helpers.actions'
+ tbody
+ - @tables.each do |table|
+ tr
+ td.link= link_to table.number, [:suppliers, table]
+ td.link= link_to_if table.section.present?, table.section.try(:title), [:suppliers, table.section]
+ td.timestamp=l table.created_at, format: :short
+ td.actions
+ = link_to t('helpers.links.edit'), [:edit, :suppliers, table], class: 'btn btn-mini'
+ '
+ = link_to t("helpers.links.destroy"), [:suppliers, table], method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-mini btn-danger'
+ - else
+ = no_content_given model_class
+.form-actions
+ = link_to t("helpers.links.new"), new_suppliers_table_path, class: 'btn btn-primary'
diff --git a/app/views/user/active_list.html.slim b/app/views/user/active_list.html.slim
index 775f67b0..e753ead8 100644
--- a/app/views/user/active_list.html.slim
+++ b/app/views/user/active_list.html.slim
@@ -1,16 +1,18 @@
.page-header
.table-number
h4= t('user.active_list.title', list: List.model_name.human)
-= link_to t('helpers.links.place_order'), user_list_products_path, class: ['btn btn-primary']
-span#list-needs-payment-button
-span#list-needs-help-button
-table#active-list-table.table.table-striped
- thead
- tr
- th= Order.model_name.human
- th.currency= Product.human_attribute_name(:price)
- tbody
- tfoot
+.form-actions
+ = link_to t('helpers.links.place_order'), user_list_products_path, class: ['btn btn-primary']
+ span#list-needs-payment-button
+ span#list-needs-help-button
+.well
+ table#active-list-table.table
+ thead
+ tr
+ th= Order.model_name.human
+ th.currency= Product.human_attribute_name(:price)
+ tbody
+ tfoot
- content_for :footer do
javascript:
jQuery(function(){
diff --git a/app/views/user/list_products.html.slim b/app/views/user/list_products.html.slim
index 1c0f9a8b..11987c36 100644
--- a/app/views/user/list_products.html.slim
+++ b/app/views/user/list_products.html.slim
@@ -1,27 +1,29 @@
.page-header
.table-number
h4= t('user.show_products.title', products: Product.model_name.human_plural)
-= link_to t('helpers.links.show_active_list', list: List.model_name.human), user_active_list_path, class: ['btn btn']
-span#list-needs-help-button
-table#products-table.table.table-striped.table-hover
- tbody
-table#active-order-table.table.table-striped.hide
- thead
- tr
- th Product
- th #
- th.currency Total
- th
- tbody
- tfoot
- tr
- td colspan=2
- button class="btn btn-primary" onClick="Quser.handle_active_list(function(){Quser.order_selected_products()})" Bestellen
- |
- button class="btn btn btn-warning" onClick="Quser.clear_selected_products()" Clear
- td.currency
- strong#active-order-total
- td
+.form-actions
+ = link_to t('helpers.links.show_active_list', list: List.model_name.human), user_active_list_path, class: ['btn btn']
+ span#list-needs-help-button
+.well
+ table#products-table.table
+ tbody
+ table#active-order-table.table.table-striped.hide
+ thead
+ tr
+ th Product
+ th #
+ th.currency Total
+ th
+ tbody
+ tfoot
+ tr
+ td colspan=2
+ button class="btn btn-primary" onClick="Quser.handle_active_list(function(){Quser.order_selected_products()})" Bestellen
+ |
+ button class="btn btn btn-warning" onClick="Quser.clear_selected_products()" Clear
+ td.currency
+ strong#active-order-total
+ td
- content_for :footer do
javascript:
jQuery(function(){
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 78a95ace..cc22771b 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -65,9 +65,13 @@ en:
active_lists: Active %{lists}
active_lists:
title: Active %{lists}
+ price: Price
+ active_orders:
+ price: Price
close: Close the shop
you_are_currently_closed_alert: 'You are currently closed and not able to take orders'
mark_as_open_button: 'Open up the place!'
+ table_number: Table
user:
active_list:
title: Active %{list}
@@ -85,3 +89,5 @@ en:
show_active_list_products: Go to the menu
section:
first_section_title: Room
+ manage_tables:
+ title: "Manage tables for %{section}: %{title}"
diff --git a/config/routes.rb b/config/routes.rb
index 573b6eb2..e8f10e0e 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -55,12 +55,19 @@ Qrammer::Application.routes.draw do
post '/user/check_table_join_status' => 'user#check_table_join_status'
- match '/show_products' => 'dashboard#show_products', as: :user_products
+ #match '/show_products' => 'dashboard#show_products', as: :user_products
+ # DEVELOPMENT ONLY
match '/qr' => 'dashboard#qr'
+ match '/demo_both' => 'dashboard#demo_both'
namespace :suppliers, path: '/supplier' do
- resources :sections
+ resources :sections do
+ member do
+ get :manage_tables
+ get :tables_view
+ end
+ end
resources :tables
resources :products
resources :product_categories