Fixes and add label to tables

This commit is contained in:
2022-04-16 15:21:07 -05:00
parent 073cc9452e
commit 8b0ddff515
13 changed files with 76 additions and 38 deletions
+3 -1
View File
@@ -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!