layout changes and section handling

This commit is contained in:
2012-09-02 14:23:17 +02:00
parent 50434c28cf
commit 0b56d07ed1
24 changed files with 390 additions and 283 deletions
-75
View File
@@ -20,82 +20,7 @@ root.Qrammer =
currency: (num) -> currency: (num) ->
num = 0.0 if isNaN(num) || num == '' || num == null num = 0.0 if isNaN(num) || num == '' || num == null
'€ ' + parseFloat(num).toFixed(2) '€ ' + 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 = $('<tr></tr>').appendTo(body)
process_btn = $('<button class="btn btn-success">In process!</button>')
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 = $('<button class="btn btn-inverse">Is delivered!</button>')
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($('<td></td>').text(order_txts.join(', ')))
row.append($('<td class="numeric"></td>').text(order.table_number))
row.append($('<td class="currency"></td>').html(Qrammer.currency(order.total_amount)))
td_buttons = $('<td class="actions"></td>')
td_buttons.append(process_btn).append('&nbsp;') if order.state == 'placed'
td_buttons.append(delivered_btn)
row.append(td_buttons)
#foot.append('<tr><td></td><td class="currency"><strong>'+Qrammer.currency(res.total_amount)+'</strong></td></tr>');
)
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 = $('<tr></tr>').appendTo(body)
close_btn = $('<button class="btn btn-warning">Close!</button>')
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 = $('<button class="btn btn-info">Question answered!</button>')
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 = $('<td class="status-icons"></td>').appendTo(row)
icons_td.append('<i class="icon-hand-up"></i>').append('&nbsp;') if list.needs_help # or icon-bell
icons_td.append('<i class="icon-check"></i>') if list.needs_payment
row.append($('<td></td>').text(list.table_number))
row.append($('<td class="currency"></td>').html(Qrammer.currency(list.total_amount)))
td_buttons = $('<td class="actions"></td>')
td_buttons.append(needs_help_btn).append('&nbsp;') if list.needs_help
td_buttons.append(close_btn)
row.append(td_buttons)
#foot.append('<tr><td></td><td class="currency"><strong>'+Qrammer.currency(res.total_amount)+'</strong></td></tr>');
)
build_product_list_as_modal: -> build_product_list_as_modal: ->
wrapper = $('<div class="modal"></div>') wrapper = $('<div class="modal"></div>')
+81 -3
View File
@@ -13,8 +13,8 @@ root.Qsupplier=
data: {table: {section_id: current_section_id}}, data: {table: {section_id: current_section_id}},
dataType: 'json' dataType: 'json'
) )
position_table_in_active_section: (section_container, table_container, skip_persisting)-> position_table_in_active_section: (section_container, table_container, make_draggable)->
skip_persisting ||= false make_draggable ||= false
button_container = table_container.find('.action-button-container') button_container = table_container.find('.action-button-container')
button_container.html('') button_container.html('')
button_container.append($('<button class="btn btn-warning btn-mini">x</button>').click( -> Qsupplier.move_table_to_inactive_section(table_container.data('table-id')) )) button_container.append($('<button class="btn btn-warning btn-mini">x</button>').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}}, data: {table: {position_x: position_x, position_y: position_y}},
dataType: 'json' dataType: 'json'
) )
) ) if make_draggable
move_table_to_inactive_section: (table_id)-> move_table_to_inactive_section: (table_id)->
table_container = $('#section-table-'+table_id) table_container = $('#section-table-'+table_id)
table_container.css('left', 'auto') table_container.css('left', 'auto')
@@ -54,3 +54,81 @@ root.Qsupplier=
data: {table: {section_id: ''}}, data: {table: {section_id: ''}},
dataType: 'json' 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 = $('<tr></tr>').appendTo(body)
close_btn = $('<button class="btn btn-warning">Close!</button>')
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 = $('<button class="btn btn-info">Question answered!</button>')
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 = $('<td class="status-icons"></td>').appendTo(row)
icons_td.append('<i class="icon-hand-up"></i>').append('&nbsp;') if list.needs_help # or icon-bell
icons_td.append('<i class="icon-check"></i>') if list.needs_payment
row.append($('<td class="numeric"></td>').text(list.table_number))
row.append($('<td></td>').text(list.section_title))
row.append($('<td class="currency"></td>').html(Qrammer.currency(list.total_amount)))
td_buttons = $('<td class="actions"></td>')
td_buttons.append(needs_help_btn).append('&nbsp;') if list.needs_help
td_buttons.append(close_btn)
row.append(td_buttons)
#foot.append('<tr><td></td><td class="currency"><strong>'+Qrammer.currency(res.total_amount)+'</strong></td></tr>');
)
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 = $('<tr></tr>').appendTo(body)
process_btn = $('<button class="btn btn-success">In process!</button>')
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 = $('<button class="btn btn-inverse">Is delivered!</button>')
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($('<td></td>').text(order_txts.join(', ')))
row.append($('<td class="numeric"></td>').text(order.table_number))
row.append($('<td></td>').text(order.section_title))
row.append($('<td class="currency"></td>').html(Qrammer.currency(order.total_amount)))
td_buttons = $('<td class="actions"></td>')
td_buttons.append(process_btn).append('&nbsp;') if order.state == 'placed'
td_buttons.append(delivered_btn)
row.append(td_buttons)
#foot.append('<tr><td></td><td class="currency"><strong>'+Qrammer.currency(res.total_amount)+'</strong></td></tr>');
)
@@ -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()
@@ -1,6 +1,8 @@
@import compass @import compass
$side-spacing: 5px $side-spacing: 5px
$qbrown: #8B5A2B $qbrown: #8B5A2B
html html
background-image: image-url('textures/wood5.jpg') background-image: image-url('textures/wood5.jpg')
body body
@@ -5,6 +5,9 @@ table
text-align: right text-align: right
&.numeric &.numeric
text-align: right text-align: right
&.actions
text-align: right
tbody tbody
td td
&.status-icons &.status-icons
@@ -1,4 +1,5 @@
/* /*
*= require_self *= require_self
*= require_directory . *= require_directory .
*= require 'phone/bootstrap_overrides'
*/ */
@@ -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
@@ -12,38 +12,6 @@ body
margin-top: 4px margin-top: 4px
margin-bottom: 6px margin-bottom: 6px
padding-bottom: 0 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 .supplier-is-closed
.alert .alert
form form
+2
View File
@@ -49,6 +49,7 @@ class SupplierController < ApplicationController
ho[:total_amount] = order_total.round(2) ho[:total_amount] = order_total.round(2)
ho[:state] = order.state ho[:state] = order.state
ho[:table_number] = order.table_number ho[:table_number] = order.table_number
ho[:section_title] = order.list.table.section.title
ho[:id] = order.id ho[:id] = order.id
list_total += ho[:total_amount] list_total += ho[:total_amount]
h[:orders] << ho h[:orders] << ho
@@ -73,6 +74,7 @@ class SupplierController < ApplicationController
hl = list.as_json 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) 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] grand_total += hl[:total_amount]
hl[:section_title] = list.table.section.title
h[:lists] << hl h[:lists] << hl
end end
h[:total_amount] = grand_total.round(2) h[:total_amount] = grand_total.round(2)
@@ -83,5 +83,27 @@ module Suppliers
format.json { head :no_content } format.json { head :no_content }
end end
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
end end
+2 -2
View File
@@ -25,7 +25,7 @@ class Supplier
def active_orders def active_orders
return @active_orders if @active_orders return @active_orders if @active_orders
@active_orders = Order.active_for_supplier(id) @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 @active_orders
end end
@@ -34,7 +34,7 @@ class Supplier
@tables ||= active_tables @tables ||= active_tables
@tables.include_relation(:lists) @tables.include_relation(:lists)
@active_lists = @tables.map(&:lists).flatten.select(&:active?) @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 end
+12 -10
View File
@@ -1,17 +1,19 @@
.page-header= title t('supplier.active_lists.title', lists: List.model_name.human_plural) .page-header= title t('supplier.active_lists.title', lists: List.model_name.human_plural)
table#active-lists-table.table.table-striped .well
thead table#active-lists-table.table
tr thead
th.status-icons tr
th.number Table number th.status-icons
th.currency Price th.numeric= t('supplier.table_number')
th.actions th= Section.model_name.human
tbody th.currency= t('supplier.active_lists.price')
th.actions
tbody
- content_for :footer do - content_for :footer do
javascript: javascript:
var active_lists_interval; var active_lists_interval;
jQuery(function(){ jQuery(function(){
Qrammer.load_active_lists() Qsupplier.load_active_lists()
active_lists_interval = setInterval('Qrammer.load_active_lists()', 7500); active_lists_interval = setInterval('Qsupplier.load_active_lists()', 7500);
}); });
+12 -10
View File
@@ -1,16 +1,18 @@
.page-header= title 'Active orders' .page-header= title 'Active orders'
table#active-orders-table.table .well
thead table#active-orders-table.table
tr thead
th Order tr
th.number Table number th= Order.model_name.human
th.currency Price th.numeric= t('supplier.table_number')
th.actions th= Section.model_name.human
tbody th.currency= t('supplier.active_orders.price')
th.actions
tbody
- content_for :footer do - content_for :footer do
javascript: javascript:
jQuery(function(){ jQuery(function(){
Qrammer.load_active_orders() Qsupplier.load_active_orders()
setInterval( 'Qrammer.load_active_orders()', 7500); setInterval( 'Qsupplier.load_active_orders()', 7500);
}); });
@@ -1,25 +1,26 @@
- model_class = ProductCategory - model_class = ProductCategory
.page-header= title :index, model_class .page-header= title :index, model_class
- if @product_categories.any? .well
table.table.table-striped - if @product_categories.any?
thead table.table
tr thead
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 tr
td.link= link_to product_category.name, [:suppliers, product_category] th= model_class.human_attribute_name(:name)
td= product_category.position th= model_class.human_attribute_name(:position)
td.timestamp=l product_category.created_at, format: :short th.timestamp= model_class.human_attribute_name(:created_at)
td.actions th.actions=t 'helpers.actions'
= link_to t('helpers.links.edit'), [:edit, :suppliers, product_category], class: 'btn btn-mini' tbody
' - @product_categories.each do |product_category|
= link_to t("helpers.links.destroy"), [:suppliers, product_category], method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-mini btn-danger' tr
- else td.link= link_to product_category.name, [:suppliers, product_category]
= no_content_given model_class 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 .form-actions
= link_to t("helpers.links.new"), new_suppliers_product_category_path, class: 'btn btn-primary' = link_to t("helpers.links.new"), new_suppliers_product_category_path, class: 'btn btn-primary'
+24 -23
View File
@@ -1,28 +1,29 @@
- model_class = Product - model_class = Product
.page-header= title :index, model_class .page-header= title :index, model_class
- if @products.any? .well
table.table.table-striped - if @products.any?
thead table.table
tr thead
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 tr
td.link= link_to product.name, product th= model_class.human_attribute_name(:name)
td= product.code th= model_class.human_attribute_name(:code)
td.currency=currency product.price th.currency= model_class.human_attribute_name(:price)
td.link= link_to_if product.product_category.present?, product.product_category.try(:name), [:suppliers, product.product_category] th= ProductCategory.model_name.human
td.timestamp=l product.created_at, format: :short th.timestamp= model_class.human_attribute_name(:created_at)
td.actions th.actions=t 'helpers.actions'
= link_to t('helpers.links.edit'), [:edit, :suppliers, product], class: 'btn btn-mini' tbody
' - @products.each do |product|
= link_to t("helpers.links.destroy"), [:suppliers, product], method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-mini btn-danger' tr
- else td.link= link_to product.name, [:suppliers, product]
= no_content_given model_class 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' = link_to t("helpers.links.new"), new_suppliers_product_path(product_category_id: @product_category.try(:id)), class: 'btn btn-primary'
+24 -22
View File
@@ -1,25 +1,27 @@
- model_class = Section - model_class = Section
.page-header= title :index, model_class .page-header= title :index, model_class
- if @sections.any? .well
table.table.table-striped - if @sections.any?
thead table.table
tr thead
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 tr
td.link= link_to section.title, [:suppliers, section] th.link= model_class.human_attribute_name(:title)
td.numeric= section.width th.numeric= model_class.human_attribute_name(:width)
td.numeric= section.height th.numeric= model_class.human_attribute_name(:height)
td.timestamp=l section.created_at, format: :short th.timestamp= model_class.human_attribute_name(:created_at)
td.actions th.actions=t 'helpers.actions'
= link_to t('helpers.links.edit'), [:edit, :suppliers, section], class: 'btn btn-mini' tbody
' - @sections.each do |section|
= link_to t("helpers.links.destroy"), [:suppliers, section], method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-mini btn-danger' tr
- else td.link= link_to section.title, [:suppliers, section]
= no_content_given model_class td.numeric= section.width
= link_to t("helpers.links.new"), new_suppliers_section_path, class: 'btn btn-primary' 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'
@@ -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);
});
});
+4 -34
View File
@@ -6,38 +6,8 @@
' '
= link_to t('helpers.links.edit'), [:edit, :suppliers, @section], class: 'btn' = 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' = 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);
});
});
@@ -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);
});
});
+22 -20
View File
@@ -1,24 +1,26 @@
- model_class = Table - model_class = Table
div.page-header= title :index, model_class div.page-header= title :index, model_class
- if @tables.any? .well
table.table.table-striped - if @tables.any?
thead table.table
tr thead
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 tr
td.link= link_to table.number, [:suppliers, table] th.link= model_class.human_attribute_name(:number)
td.link= link_to_if table.section.present?, table.section.try(:title), [:suppliers, table.section] th.link= Section.model_name.human
td.timestamp=l table.created_at, format: :short th.timestamp= model_class.human_attribute_name(:created_at)
td.actions th.actions=t 'helpers.actions'
= link_to t('helpers.links.edit'), [:edit, :suppliers, table], class: 'btn btn-mini' tbody
' - @tables.each do |table|
= link_to t("helpers.links.destroy"), [:suppliers, table], method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-mini btn-danger' tr
- else td.link= link_to table.number, [:suppliers, table]
= no_content_given model_class td.link= link_to_if table.section.present?, table.section.try(:title), [:suppliers, table.section]
= link_to t("helpers.links.new"), new_suppliers_table_path, class: 'btn btn-primary' 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'
+12 -10
View File
@@ -1,16 +1,18 @@
.page-header .page-header
.table-number .table-number
h4= t('user.active_list.title', list: List.model_name.human) 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'] .form-actions
span#list-needs-payment-button = link_to t('helpers.links.place_order'), user_list_products_path, class: ['btn btn-primary']
span#list-needs-help-button span#list-needs-payment-button
table#active-list-table.table.table-striped span#list-needs-help-button
thead .well
tr table#active-list-table.table
th= Order.model_name.human thead
th.currency= Product.human_attribute_name(:price) tr
tbody th= Order.model_name.human
tfoot th.currency= Product.human_attribute_name(:price)
tbody
tfoot
- content_for :footer do - content_for :footer do
javascript: javascript:
jQuery(function(){ jQuery(function(){
+23 -21
View File
@@ -1,27 +1,29 @@
.page-header .page-header
.table-number .table-number
h4= t('user.show_products.title', products: Product.model_name.human_plural) 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'] .form-actions
span#list-needs-help-button = link_to t('helpers.links.show_active_list', list: List.model_name.human), user_active_list_path, class: ['btn btn']
table#products-table.table.table-striped.table-hover span#list-needs-help-button
tbody .well
table#active-order-table.table.table-striped.hide table#products-table.table
thead tbody
tr table#active-order-table.table.table-striped.hide
th Product thead
th # tr
th.currency Total th Product
th th #
tbody th.currency Total
tfoot th
tr tbody
td colspan=2 tfoot
button class="btn btn-primary" onClick="Quser.handle_active_list(function(){Quser.order_selected_products()})" Bestellen tr
|&nbsp; td colspan=2
button class="btn btn btn-warning" onClick="Quser.clear_selected_products()" Clear button class="btn btn-primary" onClick="Quser.handle_active_list(function(){Quser.order_selected_products()})" Bestellen
td.currency |&nbsp;
strong#active-order-total button class="btn btn btn-warning" onClick="Quser.clear_selected_products()" Clear
td td.currency
strong#active-order-total
td
- content_for :footer do - content_for :footer do
javascript: javascript:
jQuery(function(){ jQuery(function(){
+6
View File
@@ -65,9 +65,13 @@ en:
active_lists: Active %{lists} active_lists: Active %{lists}
active_lists: active_lists:
title: Active %{lists} title: Active %{lists}
price: Price
active_orders:
price: Price
close: Close the shop close: Close the shop
you_are_currently_closed_alert: 'You are currently closed and not able to take orders' you_are_currently_closed_alert: 'You are currently closed and not able to take orders'
mark_as_open_button: 'Open up the place!' mark_as_open_button: 'Open up the place!'
table_number: Table
user: user:
active_list: active_list:
title: Active %{list} title: Active %{list}
@@ -85,3 +89,5 @@ en:
show_active_list_products: Go to the menu show_active_list_products: Go to the menu
section: section:
first_section_title: Room first_section_title: Room
manage_tables:
title: "Manage tables for %{section}: %{title}"
+9 -2
View File
@@ -55,12 +55,19 @@ Qrammer::Application.routes.draw do
post '/user/check_table_join_status' => 'user#check_table_join_status' 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 '/qr' => 'dashboard#qr'
match '/demo_both' => 'dashboard#demo_both'
namespace :suppliers, path: '/supplier' do namespace :suppliers, path: '/supplier' do
resources :sections resources :sections do
member do
get :manage_tables
get :tables_view
end
end
resources :tables resources :tables
resources :products resources :products
resources :product_categories resources :product_categories