layout changes and section handling
This commit is contained in:
@@ -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 = $('<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(' ') 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(' ') 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(' ') 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: ->
|
||||
wrapper = $('<div class="modal"></div>')
|
||||
|
||||
@@ -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($('<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}},
|
||||
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 = $('<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(' ') 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(' ') 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(' ') 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
|
||||
$side-spacing: 5px
|
||||
$qbrown: #8B5A2B
|
||||
|
||||
|
||||
html
|
||||
background-image: image-url('textures/wood5.jpg')
|
||||
body
|
||||
|
||||
@@ -5,6 +5,9 @@ table
|
||||
text-align: right
|
||||
&.numeric
|
||||
text-align: right
|
||||
&.actions
|
||||
text-align: right
|
||||
|
||||
tbody
|
||||
td
|
||||
&.status-icons
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
/*
|
||||
*= require_self
|
||||
*= 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-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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
|
||||
|
||||
@@ -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'
|
||||
|
||||
|
||||
@@ -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'
|
||||
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
});
|
||||
@@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
});
|
||||
@@ -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'
|
||||
|
||||
@@ -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(){
|
||||
|
||||
@@ -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(){
|
||||
|
||||
Reference in New Issue
Block a user