add pdf viewer and test doemal

This commit is contained in:
Yan
2018-04-18 14:17:37 +06:30
parent 6889c879ec
commit c22fc3e86e
7 changed files with 26 additions and 7 deletions

View File

@@ -1,7 +1,7 @@
class Api::ApiController < ActionController::API
include TokenVerification
before_action :lookup_domain
# before_action :lookup_domain
helper_method :current_token, :current_login_employee, :get_cashier
private

View File

@@ -13,12 +13,12 @@ module TokenVerification
authenticate_token || render_unauthorized
end
def authenticate_token
def authenticate_token
authenticate_with_http_token do |token, options|
# Rails.logger.debug "token - " + token.to_s
if(options.length !=0 && options["from"] == "DOEMAL")
if(ENV["SERVER_MODE"] === "cloud")
from = request.subdomain.downcase + "." + request.domain.downcase
from = "local" #request.subdomain.downcase + "." + request.domain.downcase
aes = MyAesCrypt.new
return aes.checkKeyForAuth(from, token)
end

View File

@@ -631,6 +631,8 @@ var customer_name = "<%= @customer.name %>";
if (credit <= 0) {
calculate_member_discount(sale_id);
}
$("#pdfModal").modal({show : true, backdrop : false, keyboard : false});
$.ajax({type: "POST",
url: "<%= origami_payment_cash_path %>",
@@ -651,13 +653,14 @@ var customer_name = "<%= @customer.name %>";
var msg = '';
}
$("#loading_wrapper" ).hide();
$("#loading_wrapper" ).hide();
//PDF lightbox data
var pdfPath = "/en/pdfjs/minimal?file=" + result.filename.substring(6);
$("#sale_receipt_no").val(result.receipt_no);
$("#filename").val(result.filename);
$("#printer_name").val(result.printer_name);
$("#receipt_pdf").attr("src", result.filename.substring(6));
$("#receipt_pdf").attr("src", pdfPath);
$("#pdfModal").modal({show : true, backdrop : false, keyboard : false});
$("#pdfModalLabel").text("Sale Completed");
$("#changed_amount").text("");