backup push
This commit is contained in:
@@ -21,9 +21,9 @@ root.Qrammer =
|
|||||||
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)
|
||||||
add_product: (product) ->
|
add_product: (product) ->
|
||||||
window.active_list = {} unless window.active_list
|
window.active_products_list = {} unless window.active_products_list
|
||||||
window.active_list[product._id] = {product: product, number: 0} unless window.active_list[product._id]
|
window.active_products_list[product._id] = {product: product, number: 0} unless window.active_products_list[product._id]
|
||||||
window.active_list[product._id].number += 1
|
window.active_products_list[product._id].number += 1
|
||||||
Qrammer.build_product_list()
|
Qrammer.build_product_list()
|
||||||
build_product_list: ->
|
build_product_list: ->
|
||||||
table = $('#active-order-table')
|
table = $('#active-order-table')
|
||||||
@@ -31,22 +31,22 @@ root.Qrammer =
|
|||||||
tbody = $('<tbody></tbody>').appendTo(table) unless tbody.length
|
tbody = $('<tbody></tbody>').appendTo(table) unless tbody.length
|
||||||
tbody.find('tr').remove()
|
tbody.find('tr').remove()
|
||||||
total = 0.0
|
total = 0.0
|
||||||
for product_id, info of window.active_list
|
for product_id, info of window.active_products_list
|
||||||
total += info.product.price * info.number
|
total += info.product.price * info.number
|
||||||
row = $('<tr></tr>').attr('id', 'active-order-row-'+product_id).appendTo(tbody)
|
row = $('<tr></tr>').attr('id', 'active-order-row-'+product_id).appendTo(tbody)
|
||||||
row.append('<td>'+info.product.name+'</td>')
|
row.append('<td>'+info.product.name+'</td>')
|
||||||
row.append('<td>'+info.number+'</td>')
|
row.append('<td>'+info.number+'</td>')
|
||||||
row.append('<td class="currency">'+Qrammer.currency(info.product.price * info.number)+'</td>')
|
row.append('<td class="currency">'+Qrammer.currency(info.product.price * info.number)+'</td>')
|
||||||
x_btn = $('<button class="btn btn-warning btn-mini">x</button>').click(-> delete(window.active_list[product_id]) && Qrammer.build_product_list() )
|
x_btn = $('<button class="btn btn-warning btn-mini">x</button>').click(-> delete(window.active_products_list[product_id]) && Qrammer.build_product_list() )
|
||||||
row.append($('<td></td>').append(x_btn))
|
row.append($('<td></td>').append(x_btn))
|
||||||
$('#active-order-total').html(Qrammer.currency(total))
|
$('#active-order-total').html(Qrammer.currency(total))
|
||||||
table.show()
|
table.show()
|
||||||
clear_active_list: ->
|
clear_active_list: ->
|
||||||
window.active_list = {}
|
window.active_products_list = {}
|
||||||
$('#active-order-table').hide()
|
$('#active-order-table').hide()
|
||||||
order_active_list: (post_uri)->
|
order_active_products_list: (post_uri)->
|
||||||
h = {list_id: active_list_id}
|
h = {list_id: active_list_id}
|
||||||
for product_id, info of window.active_list
|
for product_id, info of window.active_products_list
|
||||||
h['products['+product_id+']'] = info.number
|
h['products['+product_id+']'] = info.number
|
||||||
$.post(post_uri, h, ((res) -> Qrammer.handle_response(res)), 'json')
|
$.post(post_uri, h, ((res) -> Qrammer.handle_response(res)), 'json')
|
||||||
handle_response: (res) ->
|
handle_response: (res) ->
|
||||||
@@ -96,6 +96,29 @@ root.Qrammer =
|
|||||||
row.append(td_buttons)
|
row.append(td_buttons)
|
||||||
#foot.append('<tr><td></td><td class="currency"><strong>'+Qrammer.currency(res.total_amount)+'</strong></td></tr>');
|
#foot.append('<tr><td></td><td class="currency"><strong>'+Qrammer.currency(res.total_amount)+'</strong></td></tr>');
|
||||||
)
|
)
|
||||||
|
|
||||||
|
handle_active_user_list: (callback) ->
|
||||||
|
$.get('/user_list_info.json', (res) ->
|
||||||
|
if !res.list_active
|
||||||
|
window.location = '/phone_home?list_closed=true'
|
||||||
|
return
|
||||||
|
window.active_list = res
|
||||||
|
callback.call() if callback
|
||||||
|
Qrammer.handle_active_user_list_default_actions()
|
||||||
|
)
|
||||||
|
handle_active_user_list_default_actions: ->
|
||||||
|
Qrammer.list_needs_help_default_action()
|
||||||
|
list_needs_help_default_action: ->
|
||||||
|
needs_help_container = $('#list-needs-help-button')
|
||||||
|
if needs_help_container.length
|
||||||
|
if window.active_list.needs_help
|
||||||
|
needs_help_container.html('Help requested')
|
||||||
|
else
|
||||||
|
needs_help_container.html($('<button class="btn btn-info">I have a question</button>').click(Qrammer.list_needs_help)) #TODO TEXT
|
||||||
|
list_needs_help: ->
|
||||||
|
return unless window.active_list && !window.active_list.needs_help
|
||||||
|
$.post('/active_user_list_needs_help.json', (res) -> window.active_list = res; Qrammer.list_needs_help_default_action())
|
||||||
|
|
||||||
load_active_lists: (supplier_id) ->
|
load_active_lists: (supplier_id) ->
|
||||||
$.get('/suppliers/'+supplier_id+'/active_lists.json', (res) ->
|
$.get('/suppliers/'+supplier_id+'/active_lists.json', (res) ->
|
||||||
body = $('#active-lists-table tbody')
|
body = $('#active-lists-table tbody')
|
||||||
@@ -104,7 +127,7 @@ root.Qrammer =
|
|||||||
for list in res.lists
|
for list in res.lists
|
||||||
order_txts = []
|
order_txts = []
|
||||||
row = $('<tr></tr>').appendTo(body)
|
row = $('<tr></tr>').appendTo(body)
|
||||||
close_btn = $('<button class="btn btn-success">Close!</button>')
|
close_btn = $('<button class="btn btn-warning">Close!</button>')
|
||||||
close_callback = ( (lst, r) ->
|
close_callback = ( (lst, r) ->
|
||||||
->
|
->
|
||||||
my_btn = $(this)
|
my_btn = $(this)
|
||||||
@@ -112,13 +135,23 @@ root.Qrammer =
|
|||||||
)(list, row)
|
)(list, row)
|
||||||
close_btn.click(close_callback)
|
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('/lists/'+lst._id+'/is_helped', {}, (res)-> my_btn.remove() )
|
||||||
|
)(list, row)
|
||||||
|
needs_help_btn.click(needs_help_callback)
|
||||||
|
|
||||||
|
|
||||||
icons_td = $('<td class="status-icons"></td>').appendTo(row)
|
icons_td = $('<td class="status-icons"></td>').appendTo(row)
|
||||||
icons_td.append('<li class="icon-hand-up"></li>') if list.need_help # or icon-bell
|
icons_td.append('<i class="icon-hand-up"></i>').append(' ') if list.needs_help # or icon-bell
|
||||||
icons_td.append('<li class="icon-check"></li>') if list.needs_payment
|
icons_td.append('<i class="icon-check"></i>') if list.needs_payment
|
||||||
|
|
||||||
row.append($('<td></td>').text(list.table_number))
|
row.append($('<td></td>').text(list.table_number))
|
||||||
row.append($('<td class="currency"></td>').html(Qrammer.currency(list.total_amount)))
|
row.append($('<td class="currency"></td>').html(Qrammer.currency(list.total_amount)))
|
||||||
td_buttons = $('<td class="actions"></td>')
|
td_buttons = $('<td class="actions"></td>')
|
||||||
|
td_buttons.append(needs_help_btn).append(' ') if list.needs_help
|
||||||
td_buttons.append(close_btn)
|
td_buttons.append(close_btn)
|
||||||
row.append(td_buttons)
|
row.append(td_buttons)
|
||||||
#foot.append('<tr><td></td><td class="currency"><strong>'+Qrammer.currency(res.total_amount)+'</strong></td></tr>');
|
#foot.append('<tr><td></td><td class="currency"><strong>'+Qrammer.currency(res.total_amount)+'</strong></td></tr>');
|
||||||
@@ -158,7 +191,7 @@ root.Qrammer =
|
|||||||
body = $('<div class="modal-body"></div>')
|
body = $('<div class="modal-body"></div>')
|
||||||
table = $('<table class="table"></table>').appendTo(body)
|
table = $('<table class="table"></table>').appendTo(body)
|
||||||
tbody = $('<tbody></tbody>').appendTo(table)
|
tbody = $('<tbody></tbody>').appendTo(table)
|
||||||
for product_id, info of window.active_list
|
for product_id, info of window.active_products_list
|
||||||
row = $('<tr></tr>').appendTo(tbody)
|
row = $('<tr></tr>').appendTo(tbody)
|
||||||
row.append('<td>'+info.product.name+'</td>')
|
row.append('<td>'+info.product.name+'</td>')
|
||||||
row.append('<td>'+info.number+'</td>')
|
row.append('<td>'+info.number+'</td>')
|
||||||
|
|||||||
@@ -1,7 +1,13 @@
|
|||||||
|
$side-spacing: 5px
|
||||||
body
|
body
|
||||||
padding-left: 0px
|
padding-left: $side-spacing
|
||||||
padding-right: 0px
|
padding-right: $side-spacing
|
||||||
//padding-top: 50px
|
//padding-top: 50px
|
||||||
.navbar-fixed-top
|
.navbar-fixed-top
|
||||||
margin-left: 0px
|
margin-left: -$side-spacing
|
||||||
margin-right: 0px
|
margin-right: -$side-spacing
|
||||||
|
margin-bottom: 3px
|
||||||
|
.page-header
|
||||||
|
margin-top: 4px
|
||||||
|
margin-bottom: 6px
|
||||||
|
padding-bottom: 0
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ table
|
|||||||
text-align: right
|
text-align: right
|
||||||
tbody
|
tbody
|
||||||
td
|
td
|
||||||
|
&.status-icons
|
||||||
&.currency
|
&.currency
|
||||||
text-align: right
|
text-align: right
|
||||||
&.numeric
|
&.numeric
|
||||||
@@ -61,3 +62,10 @@ table
|
|||||||
top: 100px
|
top: 100px
|
||||||
width: 880px
|
width: 880px
|
||||||
height: 590px
|
height: 590px
|
||||||
|
|
||||||
|
#list-needs-help-button
|
||||||
|
button
|
||||||
|
margin-left: 5px
|
||||||
|
#list-needs-payment-button
|
||||||
|
button
|
||||||
|
margin-left: 5px
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ class ApplicationController < ActionController::Base
|
|||||||
if session[:active_list_id]
|
if session[:active_list_id]
|
||||||
unless active_list.active?
|
unless active_list.active?
|
||||||
session[:active_list_id] = nil
|
session[:active_list_id] = nil
|
||||||
redirect_to root_path, alert: t('messages.the_list_has_been_closed')
|
redirect_to phone_root_path, alert: t('messages.the_list_has_been_closed', list: List.model_name.human)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ class DashboardController < ApplicationController
|
|||||||
|
|
||||||
end
|
end
|
||||||
def phone_home
|
def phone_home
|
||||||
|
flash.now[:notice] = t('messages.the_list_has_been_closed', list: List.model_name.human) if params[:list_closed].present?
|
||||||
render layout: 'phone'
|
render layout: 'phone'
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -32,7 +33,7 @@ class DashboardController < ApplicationController
|
|||||||
render layout: 'phone'
|
render layout: 'phone'
|
||||||
end
|
end
|
||||||
|
|
||||||
def order_active_list
|
def order_active_products_list
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html do
|
format.html do
|
||||||
redirect_to(root_path, alert: t('messages.cannot_order_without_list_id')) and return if params[:list_id].blank?
|
redirect_to(root_path, alert: t('messages.cannot_order_without_list_id')) and return if params[:list_id].blank?
|
||||||
@@ -62,7 +63,7 @@ class DashboardController < ApplicationController
|
|||||||
render layout: 'phone'
|
render layout: 'phone'
|
||||||
end
|
end
|
||||||
|
|
||||||
def list_info
|
def user_list_info
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.json do
|
format.json do
|
||||||
render json: {list_active: false} and return unless session[:active_list_id].present?
|
render json: {list_active: false} and return unless session[:active_list_id].present?
|
||||||
@@ -78,4 +79,16 @@ class DashboardController < ApplicationController
|
|||||||
def supplier_lists
|
def supplier_lists
|
||||||
redirect_to active_lists_supplier_path(Supplier.first)
|
redirect_to active_lists_supplier_path(Supplier.first)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# POST /active_user_list_needs_help
|
||||||
|
def active_user_list_needs_help
|
||||||
|
respond_to do |format|
|
||||||
|
format.json do
|
||||||
|
render json: {list_active: false} and return unless session[:active_list_id].present?
|
||||||
|
active_list.needs_help = true
|
||||||
|
active_list.save
|
||||||
|
render json: active_list.as_json.merge(list_active: true)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -94,8 +94,8 @@ class ListsController < ApplicationController
|
|||||||
ho = {products: []}
|
ho = {products: []}
|
||||||
order_total = 0.0
|
order_total = 0.0
|
||||||
for product_order in order.product_orders
|
for product_order in order.product_orders
|
||||||
order_total += (product_order.amount * product_order.product.price).round(2)
|
order_total += (product_order.amount * product_order.price).round(2)
|
||||||
ho[:products] << {name: product_order.product.name, id: product_order.product_id, number: product_order.amount, price: product_order.product.price}
|
ho[:products] << {name: product_order.product.name, id: product_order.product_id, number: product_order.amount, price: product_order.price}
|
||||||
end
|
end
|
||||||
ho[:total_amount] = order_total.round(2)
|
ho[:total_amount] = order_total.round(2)
|
||||||
ho[:state] = order.state
|
ho[:state] = order.state
|
||||||
@@ -110,12 +110,20 @@ class ListsController < ApplicationController
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# POST /orders/1/is_delivered
|
# POST /orders/1/is_closed
|
||||||
def is_closed
|
def is_closed
|
||||||
@list = List.find(params[:id])
|
@list = List.find(params[:id])
|
||||||
@list.close!
|
@list.close!
|
||||||
render nothing: true
|
render nothing: true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# POST /orders/1/is_helped
|
||||||
|
def is_helped
|
||||||
|
@list = List.find(params[:id])
|
||||||
|
@list.needs_help = false
|
||||||
|
@list.save
|
||||||
|
render nothing: true
|
||||||
|
end
|
||||||
private
|
private
|
||||||
|
|
||||||
def set_relation_options
|
def set_relation_options
|
||||||
|
|||||||
@@ -113,8 +113,8 @@ class SuppliersController < ApplicationController
|
|||||||
ho = {products: []}
|
ho = {products: []}
|
||||||
order_total = 0.0
|
order_total = 0.0
|
||||||
for product_order in order.product_orders
|
for product_order in order.product_orders
|
||||||
order_total += (product_order.amount * product_order.product.price).round(2)
|
order_total += (product_order.amount * product_order.price).round(2)
|
||||||
ho[:products] << {name: product_order.product.name, id: product_order.product_id, number: product_order.amount, price: product_order.product.price}
|
ho[:products] << {name: product_order.product.name, id: product_order.product_id, number: product_order.amount, price: product_order.price}
|
||||||
end
|
end
|
||||||
ho[:total_amount] = order_total.round(2)
|
ho[:total_amount] = order_total.round(2)
|
||||||
ho[:state] = order.state
|
ho[:state] = order.state
|
||||||
@@ -141,7 +141,7 @@ class SuppliersController < ApplicationController
|
|||||||
grand_total = 0.0
|
grand_total = 0.0
|
||||||
for list in @supplier.active_lists
|
for list in @supplier.active_lists
|
||||||
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.product.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]
|
||||||
h[:lists] << hl
|
h[:lists] << hl
|
||||||
end
|
end
|
||||||
@@ -150,6 +150,7 @@ class SuppliersController < ApplicationController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def set_relation_options
|
def set_relation_options
|
||||||
|
|||||||
+4
-2
@@ -2,7 +2,7 @@ class List
|
|||||||
include SimplyStored::Couch
|
include SimplyStored::Couch
|
||||||
|
|
||||||
property :state, default: 'active' # active, #closed
|
property :state, default: 'active' # active, #closed
|
||||||
property :need_help, type: :boolean, default: false
|
property :needs_help, type: :boolean, default: false
|
||||||
property :needs_payment, type: :boolean, default: false
|
property :needs_payment, type: :boolean, default: false
|
||||||
property :closed_at, type: Time
|
property :closed_at, type: Time
|
||||||
has_many :orders, dependent: :destroy
|
has_many :orders, dependent: :destroy
|
||||||
@@ -34,9 +34,11 @@ class List
|
|||||||
return unless products.any?
|
return unless products.any?
|
||||||
@order = Order.create list: self, supplier: supplier
|
@order = Order.create list: self, supplier: supplier
|
||||||
return unless @order.id
|
return unless @order.id
|
||||||
|
loaded_products = self.class.database.load_document products.keys
|
||||||
products.each do |product_id, number|
|
products.each do |product_id, number|
|
||||||
number = number.to_i
|
number = number.to_i
|
||||||
ProductOrder.create order: @order, product_id: product_id, amount: number if number > 0
|
product = loaded_products.find{|p| p.id == product_id} # to get the price
|
||||||
|
ProductOrder.create order: @order, product_id: product_id, amount: number, price: product.price if number > 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ class ProductOrder
|
|||||||
include SimplyStored::Couch
|
include SimplyStored::Couch
|
||||||
|
|
||||||
property :amount, type: Fixnum
|
property :amount, type: Fixnum
|
||||||
|
property :price, type: Float
|
||||||
|
|
||||||
belongs_to :product
|
belongs_to :product
|
||||||
belongs_to :order
|
belongs_to :order
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
.page-header
|
||||||
|
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
|
table#products-table.table.table-striped.table-hover
|
||||||
tbody
|
tbody
|
||||||
-# content_for :sidebar do
|
-# content_for :sidebar do
|
||||||
@@ -12,7 +16,7 @@ table#active-order-table.table.table-striped.hide
|
|||||||
tfoot
|
tfoot
|
||||||
tr
|
tr
|
||||||
td colspan=2
|
td colspan=2
|
||||||
button class="btn btn-primary" onClick="Qrammer.order_active_list('/order_active_list')" Bestellen
|
button class="btn btn-primary" onClick="Qrammer.handle_active_user_list(function(){Qrammer.order_active_products_list('/order_active_products_list')})" Bestellen
|
||||||
|
|
|
|
||||||
button class="btn btn btn-warning" onClick="Qrammer.clear_active_list()" Clear
|
button class="btn btn btn-warning" onClick="Qrammer.clear_active_list()" Clear
|
||||||
td.currency
|
td.currency
|
||||||
@@ -21,26 +25,29 @@ table#active-order-table.table.table-striped.hide
|
|||||||
- content_for :footer do
|
- content_for :footer do
|
||||||
javascript:
|
javascript:
|
||||||
jQuery(function(){
|
jQuery(function(){
|
||||||
$.get('#{product_list_supplier_path(@supplier, format: :json).html_safe}', function(res){
|
Qrammer.handle_active_user_list(function(){
|
||||||
window.products = res
|
$.get('#{product_list_supplier_path(@supplier, format: :json).html_safe}', function(res){
|
||||||
body = $('#products-table tbody')
|
window.products = res
|
||||||
for(var category in window.products){
|
body = $('#products-table tbody')
|
||||||
body.append('<tr><td colspan="3"><h4>'+category+'<h4></td></tr>');
|
for(var category in window.products){
|
||||||
var category_ref = window.products[category];
|
body.append('<tr><td colspan="3"><h4>'+category+'<h4></td></tr>');
|
||||||
for(var iproduct = 0; iproduct < window.products[category].length; iproduct++){
|
var category_ref = window.products[category];
|
||||||
var product_index = iproduct;
|
for(var iproduct = 0; iproduct < window.products[category].length; iproduct++){
|
||||||
row = $('<tr></tr>');
|
var product_index = iproduct;
|
||||||
button = $('<button class="btn btn-mini btn-primary">Add</button>');
|
row = $('<tr></tr>');
|
||||||
var callback = (function(ref){
|
button = $('<button class="btn btn-mini btn-primary">Add</button>');
|
||||||
return function(){ Qrammer.add_product(ref[product_index]) }
|
var callback = (function(ref){
|
||||||
})(category_ref)
|
return function(){ Qrammer.add_product(ref[product_index]) }
|
||||||
button.click(callback);
|
})(category_ref)
|
||||||
row.append('<td>'+window.products[category][iproduct].name+'</td>');
|
button.click(callback);
|
||||||
row.append('<td>'+Qrammer.currency(window.products[category][iproduct].price)+'</td>');
|
row.append('<td>'+window.products[category][iproduct].name+'</td>');
|
||||||
row.append($('<td></td>').append(button));
|
row.append('<td>'+Qrammer.currency(window.products[category][iproduct].price)+'</td>');
|
||||||
body.append(row);
|
row.append($('<td></td>').append(button));
|
||||||
|
body.append(row);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
|
setInterval('Qrammer.handle_active_user_list()', 7500);
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
.page-header
|
.page-header
|
||||||
h1 List overview
|
h4= t('user.active_list.title', list: List.model_name.human)
|
||||||
table#active-list-table.table
|
= link_to t('helpers.links.place_order'), user_products_path, class: ['btn btn-primary']
|
||||||
|
span#list-needs-payment-button
|
||||||
|
span#list-needs-help-button
|
||||||
|
table#active-list-table.table.table-striped
|
||||||
thead
|
thead
|
||||||
tr
|
tr
|
||||||
th Order
|
th= Order.model_name.human
|
||||||
th.currency Price
|
th.currency= Product.human_attribute_name(:price)
|
||||||
tbody
|
tbody
|
||||||
tfoot
|
tfoot
|
||||||
- content_for :footer do
|
- content_for :footer do
|
||||||
|
|||||||
@@ -4,6 +4,14 @@
|
|||||||
= f.label :state, class: 'control-label'
|
= f.label :state, class: 'control-label'
|
||||||
.controls
|
.controls
|
||||||
= f.text_field :state, class: 'text_field'
|
= f.text_field :state, class: 'text_field'
|
||||||
|
.control-group class=(@list.errors[:need_help].any? ? 'error' : nil)
|
||||||
|
= f.label :need_help, class: 'control-label'
|
||||||
|
.controls
|
||||||
|
= f.check_box :need_help, class: 'check_box'
|
||||||
|
.control-group class=(@list.errors[:needs_payment].any? ? 'error' : nil)
|
||||||
|
= f.label :needs_payment, class: 'control-label'
|
||||||
|
.controls
|
||||||
|
= f.check_box :needs_payment, class: 'check_box'
|
||||||
.control-group class=(@list.errors[:closed_at].any? ? 'error' : nil)
|
.control-group class=(@list.errors[:closed_at].any? ? 'error' : nil)
|
||||||
= f.label :closed_at, class: 'control-label'
|
= f.label :closed_at, class: 'control-label'
|
||||||
.controls
|
.controls
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ div.page-header= title :index, model_class
|
|||||||
thead
|
thead
|
||||||
tr
|
tr
|
||||||
th= model_class.human_attribute_name(:state)
|
th= model_class.human_attribute_name(:state)
|
||||||
|
th= model_class.human_attribute_name(:need_help)
|
||||||
|
th= model_class.human_attribute_name(:needs_payment)
|
||||||
th= model_class.human_attribute_name(:closed_at)
|
th= model_class.human_attribute_name(:closed_at)
|
||||||
th= Table.model_name.human
|
th= Table.model_name.human
|
||||||
th= model_class.human_attribute_name(:created_at)
|
th= model_class.human_attribute_name(:created_at)
|
||||||
@@ -13,8 +15,10 @@ div.page-header= title :index, model_class
|
|||||||
- @lists.each do |list|
|
- @lists.each do |list|
|
||||||
tr
|
tr
|
||||||
td= link_to list.state, list
|
td= link_to list.state, list
|
||||||
|
td= list.need_help
|
||||||
|
td= list.needs_payment
|
||||||
td= list.closed_at
|
td= list.closed_at
|
||||||
td= link_to list.table.number, list.table
|
td= link_to_if list.table.present?, list.table.try(:number), list.table
|
||||||
td=l list.created_at, format: :short
|
td=l list.created_at, format: :short
|
||||||
td
|
td
|
||||||
= link_to t('helpers.links.edit'), [:edit, list], class: 'btn btn-mini'
|
= link_to t('helpers.links.edit'), [:edit, list], class: 'btn btn-mini'
|
||||||
|
|||||||
@@ -4,6 +4,10 @@
|
|||||||
dl.dl-horizontal.show-list
|
dl.dl-horizontal.show-list
|
||||||
dt= model_class.human_attribute_name(:state)
|
dt= model_class.human_attribute_name(:state)
|
||||||
dd= @list.state
|
dd= @list.state
|
||||||
|
dt= model_class.human_attribute_name(:need_help)
|
||||||
|
dd= @list.need_help
|
||||||
|
dt= model_class.human_attribute_name(:needs_payment)
|
||||||
|
dd= @list.needs_payment
|
||||||
dt= model_class.human_attribute_name(:closed_at)
|
dt= model_class.human_attribute_name(:closed_at)
|
||||||
dd= @list.closed_at
|
dd= @list.closed_at
|
||||||
- if @list.table.present?
|
- if @list.table.present?
|
||||||
|
|||||||
@@ -9,8 +9,9 @@ table#active-lists-table.table.table-striped
|
|||||||
tbody
|
tbody
|
||||||
- content_for :footer do
|
- content_for :footer do
|
||||||
javascript:
|
javascript:
|
||||||
|
var active_lists_interval;
|
||||||
jQuery(function(){
|
jQuery(function(){
|
||||||
Qrammer.load_active_lists('#{@supplier.id}')
|
Qrammer.load_active_lists('#{@supplier.id}')
|
||||||
setInterval( "Qrammer.load_active_lists('#{@supplier.id}')", 7500);
|
active_lists_interval = setInterval( "Qrammer.load_active_lists('#{@supplier.id}')", 7500);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
+13
-1
@@ -5,6 +5,8 @@ en:
|
|||||||
helpers:
|
helpers:
|
||||||
links:
|
links:
|
||||||
are_you_sure: 'Are you sure?'
|
are_you_sure: 'Are you sure?'
|
||||||
|
place_order: Place order
|
||||||
|
show_active_list: Show %{list}
|
||||||
forms:
|
forms:
|
||||||
errors:
|
errors:
|
||||||
title: There are problems found during saving (%{count})
|
title: There are problems found during saving (%{count})
|
||||||
@@ -12,7 +14,7 @@ en:
|
|||||||
cannot_order_without_list_id: You cannot place an order without specifying a list
|
cannot_order_without_list_id: You cannot place an order without specifying a list
|
||||||
cannot_order_on_non_active_list: You cannot place an order on a closed list
|
cannot_order_on_non_active_list: You cannot place an order on a closed list
|
||||||
order_is_placed: Your order has been received in good order
|
order_is_placed: Your order has been received in good order
|
||||||
the_list_has_been_closed: The list has been closed
|
the_list_has_been_closed: The %{list} has been closed
|
||||||
action:
|
action:
|
||||||
index:
|
index:
|
||||||
label: Listing %{models}
|
label: Listing %{models}
|
||||||
@@ -43,6 +45,16 @@ en:
|
|||||||
list: Lists
|
list: Lists
|
||||||
product: Products
|
product: Products
|
||||||
product_category: Product categories
|
product_category: Product categories
|
||||||
|
attributes:
|
||||||
|
product:
|
||||||
|
price: Price
|
||||||
supplier:
|
supplier:
|
||||||
menu:
|
menu:
|
||||||
active_lists: Active %{lists}
|
active_lists: Active %{lists}
|
||||||
|
user:
|
||||||
|
active_list:
|
||||||
|
title: Active %{list}
|
||||||
|
needs_payment: Check please!
|
||||||
|
show_products:
|
||||||
|
# The title gets products: Product.model_name.human_plural that can be used: e.g.: Showing %{products}
|
||||||
|
title: Menu
|
||||||
|
|||||||
+7
-2
@@ -22,18 +22,23 @@ Qrammer::Application.routes.draw do
|
|||||||
member do
|
member do
|
||||||
get :current
|
get :current
|
||||||
post :is_closed
|
post :is_closed
|
||||||
|
post :is_helped
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
resources :products
|
resources :products
|
||||||
resources :product_categories
|
resources :product_categories
|
||||||
|
|
||||||
match "/:action", controller: 'dashboard'
|
match '/view_active_list' => 'dashboard#view_active_list', as: :view_active_list # depricated
|
||||||
match '/view_active_list' => 'dashboard#view_active_list', as: :view_active_list
|
match '/view_active_list' => 'dashboard#view_active_list', as: :user_active_list
|
||||||
match '/phone_home' => 'dashboard#phone_home', as: :phone_root
|
match '/phone_home' => 'dashboard#phone_home', as: :phone_root
|
||||||
match '/supplier_home' => 'dashboard#supplier_home', as: :supplier_root
|
match '/supplier_home' => 'dashboard#supplier_home', as: :supplier_root
|
||||||
match '/supplier_home' => 'dashboard#supplier_home', as: :supplier_orders
|
match '/supplier_home' => 'dashboard#supplier_home', as: :supplier_orders
|
||||||
match '/supplier_lists' => 'dashboard#supplier_lists', as: :supplier_lists
|
match '/supplier_lists' => 'dashboard#supplier_lists', as: :supplier_lists
|
||||||
|
match '/user_list_info' => 'dashboard#user_list_info', as: :user_list_info
|
||||||
match '/user_history' => 'dashboard#user_history', as: :user_history
|
match '/user_history' => 'dashboard#user_history', as: :user_history
|
||||||
|
match '/show_products' => 'dashboard#show_products', as: :user_products
|
||||||
|
post '/active_user_list_needs_help' => 'dashboard#active_user_list_needs_help', as: :active_user_list_needs_help
|
||||||
|
match "/:action", controller: 'dashboard'
|
||||||
|
|
||||||
# The priority is based upon order of creation:
|
# The priority is based upon order of creation:
|
||||||
# first created -> highest priority.
|
# first created -> highest priority.
|
||||||
|
|||||||
Reference in New Issue
Block a user