- make second display to be responsive
This commit is contained in:
aungthetkhaing
2025-05-26 18:07:55 +06:30
parent da6a80a9bb
commit 613cb3a0cb
6 changed files with 320 additions and 83 deletions

View File

@@ -191,32 +191,25 @@ class Foodcourt::QrpayController < BaseFoodcourtController
@merchant = KbzMerchant.new(@paymethod)
@response = @merchant.create_order(amount: @sale_data.grand_total, merch_order_id: @sale_data.receipt_no)
@qr_string = @response['qrCode']
case @response[:status]
when 'success'
@qr_string = @response[:data]["qrCode"]
qrcode = RQRCode::QRCode.new(@qr_string)
qrcode = RQRCode::QRCode.new(@qr_string)
@qr_svg = qrcode.as_svg(
color: "000",
shape_rendering: "crispEdges",
module_size: 2,
standalone: true,
use_path: true
)
ActionCable.server.broadcast('second_display_view_channel', { data: @qr_string, qr_svg: @qr_svg, grand_total: @sale_data.grand_total, invoice_no: @sale_data.receipt_no })
@qr_svg = qrcode.as_svg(
color: "000",
shape_rendering: "crispEdges",
module_size: 2,
standalone: true,
use_path: true
)
# png_data = qrcode.as_png(
# bit_depth: 1,
# border_modules: 4,
# color_mode: ChunkyPNG::COLOR_GRAYSCALE,
# color: 'black',
# file: nil,
# fill: 'white',
# module_px_size: 8, # Pixel size of each module
# resize_exactly_to: false,
# resize_gte_to: false,
# size: 240 # Approximate size of the image in pixels (e.g., 240x240)
# ).to_s
ActionCable.server.broadcast('second_display_view_channel', { data: @qr_string, qr_svg: @qr_svg, grand_total: @sale_data.grand_total, invoice_no: @sale_data.receipt_no })
when 'error'
@error = @response[:message]
when 'failed'
@error = @response[:message]
end
end
end