add font for print setting
This commit is contained in:
@@ -36,7 +36,7 @@ class Origami::AddordersController < BaseOrigamiController
|
|||||||
if (params[:id])
|
if (params[:id])
|
||||||
#Pull this menu
|
#Pull this menu
|
||||||
@menu = MenuCategory.find_by_id(params[:id])
|
@menu = MenuCategory.find_by_id(params[:id])
|
||||||
puts @menu.menu_items[1].item_attributes.to_json
|
# puts @menu.menu_items[1].item_attributes.to_json
|
||||||
return @menu
|
return @menu
|
||||||
else
|
else
|
||||||
MenuCategory.current_menu
|
MenuCategory.current_menu
|
||||||
|
|||||||
@@ -70,6 +70,6 @@ class PrintSettingsController < ApplicationController
|
|||||||
|
|
||||||
# Never trust parameters from the scary internet, only allow the white list through.
|
# Never trust parameters from the scary internet, only allow the white list through.
|
||||||
def print_setting_params
|
def print_setting_params
|
||||||
params.require(:print_setting).permit(:name, :unique_code, :template, :printer_name, :api_settings, :page_width, :page_height, :print_copies,:precision,:delimiter,:heading_space)
|
params.require(:print_setting).permit(:name, :unique_code, :template, :printer_name, :font, :api_settings, :page_width, :page_height, :print_copies,:precision,:delimiter,:heading_space)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -21,7 +21,18 @@ class CloseCashierPdf < Prawn::Document
|
|||||||
#setting page margin and width
|
#setting page margin and width
|
||||||
super(:margin => [printer_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
super(:margin => [printer_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||||
|
|
||||||
# font "public/fonts/#{font_name}".to_s + ".ttf".to_s
|
# db font setup
|
||||||
|
if printer_settings.font != nil
|
||||||
|
font_families.update("#{printer_settings.font}" => {
|
||||||
|
:normal => "public/fonts/#{printer_settings.font}.ttf",
|
||||||
|
:italic => "public/fonts/#{printer_settings.font}.ttf",
|
||||||
|
:bold => "public/fonts/#{printer_settings.font}.ttf",
|
||||||
|
:bold_italic => "public/fonts/#{printer_settings.font}.ttf"
|
||||||
|
})
|
||||||
|
|
||||||
|
font "#{printer_settings.font}"
|
||||||
|
fallback_fonts ["Courier", "Helvetica", "Times-Roman"]
|
||||||
|
end
|
||||||
# font "public/fonts/Zawgyi-One.ttf"
|
# font "public/fonts/Zawgyi-One.ttf"
|
||||||
# font "public/fonts/padauk.ttf"
|
# font "public/fonts/padauk.ttf"
|
||||||
self.header_font_size = 10
|
self.header_font_size = 10
|
||||||
|
|||||||
@@ -18,6 +18,20 @@ class CrmOrderPdf < Prawn::Document
|
|||||||
@half_qty = @qty_width / 2
|
@half_qty = @qty_width / 2
|
||||||
#setting page margin and width
|
#setting page margin and width
|
||||||
super(:margin => [self.margin, self.margin, self.margin, self.margin], :page_size => [self.p_width, self.page_height])
|
super(:margin => [self.margin, self.margin, self.margin, self.margin], :page_size => [self.p_width, self.page_height])
|
||||||
|
|
||||||
|
# db font setup
|
||||||
|
if printer_settings.font != nil
|
||||||
|
font_families.update("#{printer_settings.font}" => {
|
||||||
|
:normal => "public/fonts/#{printer_settings.font}.ttf",
|
||||||
|
:italic => "public/fonts/#{printer_settings.font}.ttf",
|
||||||
|
:bold => "public/fonts/#{printer_settings.font}.ttf",
|
||||||
|
:bold_italic => "public/fonts/#{printer_settings.font}.ttf"
|
||||||
|
})
|
||||||
|
|
||||||
|
font "#{printer_settings.font}"
|
||||||
|
fallback_fonts ["Courier", "Helvetica", "Times-Roman"]
|
||||||
|
end
|
||||||
|
|
||||||
self.header_font_size = 10
|
self.header_font_size = 10
|
||||||
self.item_font_size = 9
|
self.item_font_size = 9
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,18 @@ class OrderItemPdf < Prawn::Document
|
|||||||
super(:margin => [print_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
super(:margin => [print_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||||
# super(:margin => [10, 5, 30, 5], :page_size => [200,400])
|
# super(:margin => [10, 5, 30, 5], :page_size => [200,400])
|
||||||
|
|
||||||
# font "public/fonts/#{font_name}".to_s + ".ttf".to_s
|
# db font setup
|
||||||
|
if print_settings.font != nil
|
||||||
|
font_families.update("#{print_settings.font}" => {
|
||||||
|
:normal => "public/fonts/#{print_settings.font}.ttf",
|
||||||
|
:italic => "public/fonts/#{print_settings.font}.ttf",
|
||||||
|
:bold => "public/fonts/#{print_settings.font}.ttf",
|
||||||
|
:bold_italic => "public/fonts/#{print_settings.font}.ttf"
|
||||||
|
})
|
||||||
|
|
||||||
|
font "#{print_settings.font}"
|
||||||
|
fallback_fonts ["Courier", "Helvetica", "Times-Roman"]
|
||||||
|
end
|
||||||
# font "public/fonts/Zawgyi-One.ttf"
|
# font "public/fonts/Zawgyi-One.ttf"
|
||||||
# font "public/fonts/padauk.ttf"
|
# font "public/fonts/padauk.ttf"
|
||||||
#font "public/fonts/Chinese.ttf"
|
#font "public/fonts/Chinese.ttf"
|
||||||
|
|||||||
@@ -15,9 +15,20 @@ class OrderSummaryPdf < Prawn::Document
|
|||||||
|
|
||||||
super(:margin => [print_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
super(:margin => [print_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||||
|
|
||||||
# font "public/fonts/#{font_name}".to_s + ".ttf".to_s
|
# db font setup
|
||||||
|
if print_settings.font != nil
|
||||||
|
font_families.update("#{print_settings.font}" => {
|
||||||
|
:normal => "public/fonts/#{print_settings.font}.ttf",
|
||||||
|
:italic => "public/fonts/#{print_settings.font}.ttf",
|
||||||
|
:bold => "public/fonts/#{print_settings.font}.ttf",
|
||||||
|
:bold_italic => "public/fonts/#{print_settings.font}.ttf"
|
||||||
|
})
|
||||||
|
|
||||||
|
font "#{print_settings.font}"
|
||||||
|
fallback_fonts ["Courier", "Helvetica", "Times-Roman"]
|
||||||
|
end
|
||||||
# font "public/fonts/Zawgyi-One.ttf"
|
# font "public/fonts/Zawgyi-One.ttf"
|
||||||
font "public/fonts/padauk.ttf"
|
# font "public/fonts/padauk.ttf"
|
||||||
self.header_font_size = 12
|
self.header_font_size = 12
|
||||||
self.item_font_size = 10
|
self.item_font_size = 10
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,19 @@ class QueueNoPdf < Prawn::Document
|
|||||||
|
|
||||||
super(:margin => [self.margin, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
super(:margin => [self.margin, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||||
|
|
||||||
|
# db font setup
|
||||||
|
if printer_settings.font != nil
|
||||||
|
font_families.update("#{printer_settings.font}" => {
|
||||||
|
:normal => "public/fonts/#{printer_settings.font}.ttf",
|
||||||
|
:italic => "public/fonts/#{printer_settings.font}.ttf",
|
||||||
|
:bold => "public/fonts/#{printer_settings.font}.ttf",
|
||||||
|
:bold_italic => "public/fonts/#{printer_settings.font}.ttf"
|
||||||
|
})
|
||||||
|
|
||||||
|
font "#{printer_settings.font}"
|
||||||
|
fallback_fonts ["Courier", "Helvetica", "Times-Roman"]
|
||||||
|
end
|
||||||
|
|
||||||
self.header_font_size = 10
|
self.header_font_size = 10
|
||||||
self.item_font_size = 8
|
self.item_font_size = 8
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,18 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
#setting page margin and width
|
#setting page margin and width
|
||||||
super(:margin => [printer_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
super(:margin => [printer_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||||
|
|
||||||
# font "public/fonts/#{font_name}".to_s + ".ttf".to_s
|
# db font setup
|
||||||
|
if printer_settings.font != nil
|
||||||
|
font_families.update("#{printer_settings.font}" => {
|
||||||
|
:normal => "public/fonts/#{printer_settings.font}.ttf",
|
||||||
|
:italic => "public/fonts/#{printer_settings.font}.ttf",
|
||||||
|
:bold => "public/fonts/#{printer_settings.font}.ttf",
|
||||||
|
:bold_italic => "public/fonts/#{printer_settings.font}.ttf"
|
||||||
|
})
|
||||||
|
|
||||||
|
font "#{printer_settings.font}"
|
||||||
|
fallback_fonts ["Courier", "Helvetica", "Times-Roman"]
|
||||||
|
end
|
||||||
# font "public/fonts/Zawgyi-One.ttf"
|
# font "public/fonts/Zawgyi-One.ttf"
|
||||||
# font "public/fonts/padauk.ttf"
|
# font "public/fonts/padauk.ttf"
|
||||||
self.header_font_size = 10
|
self.header_font_size = 10
|
||||||
@@ -226,7 +237,7 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
move_down 5
|
move_down 5
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
move_down 5
|
move_down 5
|
||||||
bounding_box([0,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
bounding_box([0,y_position], :width =>self.item_description_width) do
|
||||||
text "Grand Total",:style => :bold, :size => self.header_font_size,:align => :left
|
text "Grand Total",:style => :bold, :size => self.header_font_size,:align => :left
|
||||||
end
|
end
|
||||||
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
bounding_box([self.item_description_width,y_position], :width =>self.label_width) do
|
||||||
@@ -453,8 +464,8 @@ class ReceiptBillPdf < Prawn::Document
|
|||||||
move_down 5
|
move_down 5
|
||||||
|
|
||||||
y_position = cursor
|
y_position = cursor
|
||||||
bounding_box([0, y_position], :width =>self.label_width, :height => self.item_height) do
|
bounding_box([0, y_position], :width =>self.label_width) do
|
||||||
text "#{printed_status}",:style => :bold, :size => self.header_font_size,:align => :left
|
text "#{printed_status}",:style => :bold, :size => header_font_size,:align => :left
|
||||||
end
|
end
|
||||||
bounding_box([self.item_description_width,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
bounding_box([self.item_description_width,y_position], :width =>self.item_description_width, :height => self.item_height) do
|
||||||
text "Thank You! See you Again", :left_margin => -10, :size => self.item_font_size,:align => :left
|
text "Thank You! See you Again", :left_margin => -10, :size => self.item_font_size,:align => :left
|
||||||
|
|||||||
@@ -21,7 +21,19 @@ class StockResultPdf < Prawn::Document
|
|||||||
#setting page margin and width
|
#setting page margin and width
|
||||||
super(:margin => [printer_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
super(:margin => [printer_settings.heading_space, self.margin, self.margin, self.margin], :page_size => [self.page_width, self.page_height])
|
||||||
|
|
||||||
# font "public/fonts/#{font_name}".to_s + ".ttf".to_s
|
# db font setup
|
||||||
|
if printer_settings.font != nil
|
||||||
|
font_families.update("#{printer_settings.font}" => {
|
||||||
|
:normal => "public/fonts/#{printer_settings.font}.ttf",
|
||||||
|
:italic => "public/fonts/#{printer_settings.font}.ttf",
|
||||||
|
:bold => "public/fonts/#{printer_settings.font}.ttf",
|
||||||
|
:bold_italic => "public/fonts/#{printer_settings.font}.ttf"
|
||||||
|
})
|
||||||
|
|
||||||
|
font "#{printer_settings.font}"
|
||||||
|
fallback_fonts ["Courier", "Helvetica", "Times-Roman"]
|
||||||
|
end
|
||||||
|
|
||||||
# font "public/fonts/Zawgyi-One.ttf"
|
# font "public/fonts/Zawgyi-One.ttf"
|
||||||
# font "public/fonts/padauk.ttf"
|
# font "public/fonts/padauk.ttf"
|
||||||
self.header_font_size = 10
|
self.header_font_size = 10
|
||||||
|
|||||||
@@ -39,18 +39,18 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).on('turbolinks:load', function () {
|
$(document).ready(function() {
|
||||||
$(".pin_pad").click(function(event) {
|
$(".pin_pad").click(function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
var old_value = $("#login_form_password").val();
|
||||||
var value = $(this).data("value");
|
var value = $(this).data("value");
|
||||||
|
console.log(old_value);
|
||||||
|
console.log(value);
|
||||||
if (value == "CLR") {
|
if (value == "CLR") {
|
||||||
$("#login_form_password").val("");
|
$("#login_form_password").val("");
|
||||||
} else if (value == "ENT") {
|
} else if (value == "ENT") {
|
||||||
$("#new_login_form").submit();
|
$("#new_login_form").submit();
|
||||||
} else {
|
} else {
|
||||||
var old_value = $("#login_form_password").val();
|
|
||||||
console.log(old_value);
|
|
||||||
$("#login_form_password").val(old_value + value);
|
$("#login_form_password").val(old_value + value);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -9,8 +9,6 @@
|
|||||||
<title>SmartSales : Restaurant</title>
|
<title>SmartSales : Restaurant</title>
|
||||||
<%= csrf_meta_tags %>
|
<%= csrf_meta_tags %>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- oqs -->
|
<!-- oqs -->
|
||||||
<%= stylesheet_link_tag 'OQS', media: 'all', 'data-turbolinks-track': 'reload' %>
|
<%= stylesheet_link_tag 'OQS', media: 'all', 'data-turbolinks-track': 'reload' %>
|
||||||
<!-- crm -->
|
<!-- crm -->
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
<%= f.input :unique_code %>
|
<%= f.input :unique_code %>
|
||||||
<%= f.input :template %>
|
<%= f.input :template %>
|
||||||
<%= f.input :printer_name %>
|
<%= f.input :printer_name %>
|
||||||
|
<%= f.input :font %>
|
||||||
<%= f.input :api_settings %>
|
<%= f.input :api_settings %>
|
||||||
<%= f.input :page_width %>
|
<%= f.input :page_width %>
|
||||||
<%= f.input :page_height %>
|
<%= f.input :page_height %>
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
json.extract! print_setting, :id, :name,, :unique_code,, :template,, :db_name,, :db_type,, :db_username,, :db_password,, :printer_name,, :api_settings,, :page_width, :page_height, :print_copies, :created_at, :updated_at
|
json.extract! print_setting, :id, :name, :unique_code, :template, :printer_name, :font, :api_settings, :page_width, :page_height, :print_copies, :created_at, :updated_at
|
||||||
json.url print_setting_url(print_setting, format: :json)
|
json.url print_setting_url(print_setting, format: :json)
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
<th>Unique code</th>
|
<th>Unique code</th>
|
||||||
<th>Template</th>
|
<th>Template</th>
|
||||||
<th>Printer name</th>
|
<th>Printer name</th>
|
||||||
|
<th>Font</th>
|
||||||
<th>Api settings</th>
|
<th>Api settings</th>
|
||||||
<th>Page width</th>
|
<th>Page width</th>
|
||||||
<th>Page height</th>
|
<th>Page height</th>
|
||||||
@@ -36,6 +37,7 @@
|
|||||||
<td><%= print_setting.unique_code %></td>
|
<td><%= print_setting.unique_code %></td>
|
||||||
<td><%= print_setting.template %></td>
|
<td><%= print_setting.template %></td>
|
||||||
<td><%= print_setting.printer_name %></td>
|
<td><%= print_setting.printer_name %></td>
|
||||||
|
<td><%= print_setting.font %></td>
|
||||||
<td><%= print_setting.api_settings %></td>
|
<td><%= print_setting.api_settings %></td>
|
||||||
<td><%= print_setting.page_width %></td>
|
<td><%= print_setting.page_width %></td>
|
||||||
<td><%= print_setting.page_height %></td>
|
<td><%= print_setting.page_height %></td>
|
||||||
|
|||||||
@@ -32,6 +32,10 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th>Printer name</th>
|
<th>Printer name</th>
|
||||||
<td><%= @print_setting.printer_name %></td>
|
<td><%= @print_setting.printer_name %></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th>Font</th>
|
||||||
|
<td><%= @print_setting.font %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Api settings</th>
|
<th>Api settings</th>
|
||||||
|
|||||||
@@ -3,7 +3,8 @@ class CreatePrintSettings < ActiveRecord::Migration[5.1]
|
|||||||
create_table :print_settings do |t|
|
create_table :print_settings do |t|
|
||||||
t.string :name, :null => false
|
t.string :name, :null => false
|
||||||
t.string :unique_code, :null => false
|
t.string :unique_code, :null => false
|
||||||
t.string :template
|
t.string :template
|
||||||
|
t.string :font
|
||||||
t.string :printer_name, :null => false
|
t.string :printer_name, :null => false
|
||||||
t.string :api_settings
|
t.string :api_settings
|
||||||
t.decimal :page_width, :null => false, :default => 200
|
t.decimal :page_width, :null => false, :default => 200
|
||||||
|
|||||||
Reference in New Issue
Block a user