print setting for jade print

This commit is contained in:
Yan
2018-04-05 16:08:20 +06:30
parent c8755106ef
commit 09594f83f2
5 changed files with 46 additions and 19 deletions

View File

@@ -93,8 +93,7 @@ $(document).on('turbolinks:load', function() {
var oqs_append = $('.oqs_append');
oqs_append.empty();
var filter = $('.filter').text();
console.log(table_id)
//Start Ajax
$.ajax({
type: "GET",

View File

@@ -18,10 +18,12 @@ class PrintSettingsController < ApplicationController
# GET /print_settings/new
def new
@print_setting = PrintSetting.new
@server_mode = ENV["SERVER_MODE"]
end
# GET /print_settings/1/edit
def edit
@server_mode = ENV["SERVER_MODE"]
end
# POST /print_settings

View File

@@ -11,8 +11,8 @@
<link rel="icon" href="favicon.ico" type="image/x-icon">
<!-- Google Fonts -->
<link href="https://fonts.googleapis.com/css?family=Roboto:400,700&subset=latin,cyrillic-ext" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" type="text/css">
<!-- <link href="https://fonts.googleapis.com/css?family=Roboto:400,700&subset=latin,cyrillic-ext" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" type="text/css"> -->
<%= stylesheet_link_tag 'login', media: 'all', 'data-turbolinks-track': 'reload' %>

View File

@@ -1,4 +1,3 @@
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-9 col-lg-9">
<div class="card">
@@ -11,7 +10,16 @@
<%= f.input :unique_code %>
<%= f.input :template %>
<%= f.input :font %>
<%= f.input :printer_name, :as => :select, :collection => Printer::PrinterWorker.printers, include_blank: false %>
<%
if(@server_mode != 'cloud')
%>
<%= f.input :printer_name, :as => :select, :collection => Printer::PrinterWorker.printers, include_blank: false %>
<%
else
%>
<%= f.input :printer_name, :as => :select, :collection => [], include_blank: false %>
<% end %>
<%= f.input :brand_name %>
<%= f.input :printer_type %>
<%= f.input :api_settings %>
@@ -64,20 +72,38 @@
<script type="text/javascript">
$(document).ready(function(){
var serverMode = "<%= @server_mode %>";
if(serverMode == 'cloud'){
var printers = code2lab.getPrinters();
var printerInfo = JSON.parse([printers]);
var select = $("#print_setting_printer_name");
$.each(printerInfo, function(key, value) {
$('#print_setting_printer_name')
.append($("<option></option>")
.attr("value",value.target)
.text(value.deviceName));
});
}
// 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);
}
});
});
});
$("#print_setting_printer_name").on("change", function(){
if(serverMode != 'cloud'){
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);
}
});
}
else {
$("#print_setting_api_settings").val($(this).val());
}
});
});
function isNumberKey(evt) {
var charCode = (evt.which) ? evt.which : event.keyCode;

View File

@@ -13,7 +13,7 @@
development:
secret_key_base: b61d85f8ed2a1a9e0eeece3443b3e8f838d002cc1d9f32115d8e93db920e2957adfedc57501d44741211538f3108b742cdeada87d5bfae796c53da1f90a3cd61
sx_provision_url: connect.smartsales.dev/api #connect.smartsales.dev/api #connect.smartsales.asia/api #provision.zsai.ws/api
server_mode: application
server_mode: cloud
cipher_type: AES-256-CBC
sx_key: Wh@t1$C2L