add printer brand and api and type
This commit is contained in:
@@ -689,7 +689,9 @@
|
||||
receipt_no = ($("#receipt_no").html()).trim();
|
||||
if((receipt_no!=undefined) && (receipt_no!=""))
|
||||
createReceiptNoInFirstBillData(receipt_no,"");
|
||||
|
||||
|
||||
// console.log(result);
|
||||
code2lab.printBill(result.filepath, result.printer_model, result.printer_url);
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
<%= f.input :template %>
|
||||
<%= f.input :font %>
|
||||
<%= f.input :printer_name, :as => :select, :collection => Printer::PrinterWorker.printers, include_blank: false %>
|
||||
<%= f.input :brand_name %>
|
||||
<%= f.input :printer_type %>
|
||||
<%= f.input :api_settings %>
|
||||
<%= f.input :page_width %>
|
||||
<%= f.input :page_height %>
|
||||
@@ -61,6 +63,22 @@
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
|
||||
// if selected printer change call and bind
|
||||
$("#print_setting_printer_name").on("change", function(){
|
||||
var printer_name = $(this).val();
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "/get_printer_options/"+printer_name,
|
||||
success:function(result){
|
||||
$("#print_setting_brand_name").val(result.model);
|
||||
$("#print_setting_api_settings").val(result.url);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function isNumberKey(evt) {
|
||||
var charCode = (evt.which) ? evt.which : event.keyCode;
|
||||
if (charCode != 46 && charCode > 31 && (charCode < 48 || charCode > 57)) {
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
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.extract! print_setting, :id, :name, :unique_code, :template, :printer_name, :brand_name, :printer_type, :font, :api_settings, :page_width, :page_height, :print_copies, :created_at, :updated_at
|
||||
json.url print_setting_url(print_setting, format: :json)
|
||||
|
||||
@@ -30,6 +30,14 @@
|
||||
<th><%= t("views.right_panel.detail.printer_name") %></th>
|
||||
<td><%= @print_setting.printer_name %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><%= t("views.right_panel.detail.brand_name") %></th>
|
||||
<td><%= @print_setting.brand_name %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><%= t("views.right_panel.detail.printer_type") %></th>
|
||||
<td><%= @print_setting.printer_type %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><%= t("views.right_panel.detail.font") %></th>
|
||||
<td><%= @print_setting.font rescue '-' %></td>
|
||||
|
||||
Reference in New Issue
Block a user