Fixes and add label to tables
This commit is contained in:
@@ -45,6 +45,8 @@ class DashboardController < ApplicationController
|
||||
# GET /select_qr_image.svg
|
||||
def table_qr_image
|
||||
@table = Table.find(params[:table_id])
|
||||
hbs = Handlebars::Handlebars.new
|
||||
@qr_template = hbs.compile(@table.supplier.table_qr_template)
|
||||
#code = [get_the_app_url, {table_id: @table.id}.to_json].join('?')
|
||||
code = "q.mozo.bar/s?t=#{@table.id}"
|
||||
size = RQRCode.minimum_qr_size_from_string(code)
|
||||
@@ -53,7 +55,7 @@ class DashboardController < ApplicationController
|
||||
render text: "Pending table_qr_image"
|
||||
}
|
||||
format.svg {
|
||||
render qrcode: code, level: :l, unit: 10, table_number: @table.number, qcontainer: true
|
||||
render qrcode: code, level: :l, unit: 10, table_number: @qr_template.call(@table), qcontainer: true
|
||||
}
|
||||
format.png do
|
||||
render qrcode: code, level: :l, unit: 10, table_number: @table.number, qcontainer: true
|
||||
|
||||
@@ -75,7 +75,7 @@ module Suppliers
|
||||
private
|
||||
|
||||
def table_params
|
||||
permitted_attributes = [:number, :section_id, :position_x, :position_y, :width, :height]
|
||||
permitted_attributes = [:number, :label, :section_id, :position_x, :position_y, :width, :height]
|
||||
# do not raise in development and test for json communication
|
||||
if request.format.json?
|
||||
params.require(:table).slice(*permitted_attributes).permit!
|
||||
|
||||
@@ -11,8 +11,6 @@ class Supplier
|
||||
product_categories.products
|
||||
product_categories.products.product_variants
|
||||
]
|
||||
|
||||
|
||||
#devise :database_authenticatable, :recoverable, :rememberable, :trackable, :registerable, :confirmable
|
||||
|
||||
property :name
|
||||
@@ -30,6 +28,7 @@ class Supplier
|
||||
property :week_starts_on_monday, type: :boolean, default: true
|
||||
property :employee_settings_storage
|
||||
property :user_message
|
||||
property :table_qr_template, default: '{{#if label}}{{number}} - {{label}}{{else}}{{number}}{{/if}}'
|
||||
|
||||
# PAYMENT
|
||||
property :accept_bitpay, type: :boolean, default: false
|
||||
|
||||
@@ -4,6 +4,7 @@ class Table
|
||||
per_page_method :limit_value #kaminari
|
||||
|
||||
property :number, type: Integer, default: 1
|
||||
property :label
|
||||
property :position_x, type: Float, default: 0
|
||||
property :position_y, type: Float, default: 0
|
||||
property :needs_help, type: :boolean, default: false
|
||||
|
||||
Reference in New Issue
Block a user