remove comment in action controller
This commit is contained in:
@@ -408,7 +408,7 @@
|
|||||||
<div class="row p-r-20">
|
<div class="row p-r-20">
|
||||||
<% if ENV["SERVER_MODE"] != 'cloud' %>
|
<% if ENV["SERVER_MODE"] != 'cloud' %>
|
||||||
<div class="col-md-5">
|
<div class="col-md-5">
|
||||||
<button type="button" class="btn btn-link bg-red waves-effect" id="print_pdf">Print</button>
|
<button type="button" class="btn btn-link bg-red waves-effect" id="print_pdf" data-turbolinks="false" remote="true">Print</button>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<div class="col-md-5">
|
<div class="col-md-5">
|
||||||
@@ -421,7 +421,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script type="text/javascript">
|
||||||
var cashier_type = "<%= @cashier_type %>";
|
var cashier_type = "<%= @cashier_type %>";
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
/* start check first bill or not*/
|
/* start check first bill or not*/
|
||||||
@@ -471,151 +471,6 @@ var cashier_type = "<%= @cashier_type %>";
|
|||||||
$('#cash').text(localStorage.getItem("cash"));
|
$('#cash').text(localStorage.getItem("cash"));
|
||||||
}
|
}
|
||||||
update_balance();
|
update_balance();
|
||||||
});
|
|
||||||
|
|
||||||
// bind survey to order or sale
|
|
||||||
$("#survey").on('click', function () {
|
|
||||||
var sale = $('#sale_id').text();
|
|
||||||
if (sale) {
|
|
||||||
var sale_id = sale
|
|
||||||
} else {
|
|
||||||
var sale_id = $('#dining').text();
|
|
||||||
}
|
|
||||||
//var table_id = $('.tables').attr("data-id");
|
|
||||||
window.location.href = '/origami/' + sale_id +"/"+ cashier_type + "/surveys"
|
|
||||||
});
|
|
||||||
|
|
||||||
// bind customer to order or sale
|
|
||||||
$("#customer").on('click', function () {
|
|
||||||
var sale = $('#sale_id').text();
|
|
||||||
if (sale) {
|
|
||||||
var sale_id = sale
|
|
||||||
} else {
|
|
||||||
var sale_id = $('#save_order_id').attr('data-order');
|
|
||||||
}
|
|
||||||
var table_id = $('.tables').attr("data-id");
|
|
||||||
window.location.href = '/origami/' + sale_id + "/"+cashier_type+"/customers"
|
|
||||||
});
|
|
||||||
|
|
||||||
// Add Other Charges
|
|
||||||
$('#other-charges').click(function () {
|
|
||||||
var sale = $('#sale_id').text();
|
|
||||||
if (sale != "") {
|
|
||||||
var sale_id = sale
|
|
||||||
} else {
|
|
||||||
var sale_id = $('#save_order_id').attr('data-order');
|
|
||||||
}
|
|
||||||
if (sale_id != "") {
|
|
||||||
window.location.href = '/origami/' + sale_id +"/"+cashier_type+ '/other_charges'
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
swal ( "Oops" , "Please select an table!" , "warning" );
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
// Discount for Payment
|
|
||||||
$('#discount').click(function () {
|
|
||||||
if ($(this).attr('active')=== "true") {
|
|
||||||
var sale = $('#sale_id').text();
|
|
||||||
if (sale != "") {
|
|
||||||
var sale_id = sale
|
|
||||||
} else {
|
|
||||||
var sale_id = $('#save_order_id').attr('data-order');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sale_id != "") {
|
|
||||||
window.location.href = '/origami/' + sale_id + "/"+cashier_type+'/discount'
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
swal ( "Oops" , "Please select an table!" , "warning" );
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
swal("Oops","You are not authorized for Discount","warning")
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#edit').on('click', function () {
|
|
||||||
var dining_id = $('#dining').text();
|
|
||||||
var sale_id = $('#sale_id').text();
|
|
||||||
if ($(this).attr('active')=== "true") {
|
|
||||||
if (dining_id) {
|
|
||||||
window.location.href = '/origami/table/' + dining_id + "/sale/" + sale_id + "/"+cashier_type+"/edit";
|
|
||||||
}else{
|
|
||||||
window.location.href = "/origami/table/sale/" + sale_id + "/"+cashier_type+"/edit";
|
|
||||||
}
|
|
||||||
|
|
||||||
}else{
|
|
||||||
swal("Oops","You are not authorized for void","warning")
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$(document).on('click', '.cashier_number', function(event){
|
|
||||||
if(event.handled !== true) {
|
|
||||||
var original_value;
|
|
||||||
original_value = $('#cash').text();
|
|
||||||
|
|
||||||
var input_type = $(this).attr("data-type");
|
|
||||||
|
|
||||||
switch (input_type) {
|
|
||||||
case 'num':
|
|
||||||
var input_value = $(this).attr("data-value");
|
|
||||||
if (original_value == "0.0"){
|
|
||||||
$('#cash').text(input_value);
|
|
||||||
update_balance();
|
|
||||||
}else{
|
|
||||||
if($('#cash').text() == '0'){
|
|
||||||
$('#cash').text("");
|
|
||||||
}
|
|
||||||
$('#cash').append(input_value);
|
|
||||||
update_balance();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'add':
|
|
||||||
var input_value = $(this).attr("data-value");
|
|
||||||
amount = parseInt(input_value) + parseInt(original_value);
|
|
||||||
$('#cash').text(amount);
|
|
||||||
update_balance();
|
|
||||||
break;
|
|
||||||
case 'del' :
|
|
||||||
var cash=$('#cash').text();
|
|
||||||
if(cash.length == 1)
|
|
||||||
$('#cash').text("0.0");
|
|
||||||
else
|
|
||||||
$('#cash').text(cash.substr(0,cash.length-1));
|
|
||||||
update_balance();
|
|
||||||
break;
|
|
||||||
case 'clr':
|
|
||||||
$('#cash').text("0.0");
|
|
||||||
update_balance();
|
|
||||||
break;
|
|
||||||
case 'nett':
|
|
||||||
var credit1 = $('#credit').text();
|
|
||||||
var card1 = $('#others').text();
|
|
||||||
var paypar1 = $('#ppamount').text();
|
|
||||||
var visa1 = $('#visacount').text();
|
|
||||||
var jcb1 = $('#jcbcount').text();
|
|
||||||
var master1 = $('#mastercount').text();
|
|
||||||
var unionpay1 = $('#unionpaycount').text();
|
|
||||||
var othertotal = parseFloat(credit1) + parseFloat(card1) + parseFloat(paypar1) + parseFloat(visa1) + parseFloat(jcb1) + parseFloat(master1) + parseFloat(unionpay1);
|
|
||||||
var total = $('#amount_due').text();
|
|
||||||
var amt = 0;
|
|
||||||
<% if precision.to_i > 0 %>;
|
|
||||||
amt = parseFloat(parseFloat(total) - parseFloat(othertotal)).toFixed(<%= precision %>);
|
|
||||||
<% else %>
|
|
||||||
amt = parseFloat(parseFloat(total) - parseFloat(othertotal));
|
|
||||||
<% end %>
|
|
||||||
$('#cash').text(amt);
|
|
||||||
update_balance();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
event.handled = true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$( document ).ready(function() {
|
|
||||||
|
|
||||||
// Disable click event cash to prevent
|
// Disable click event cash to prevent
|
||||||
$(".payment .cash-color").off('click');
|
$(".payment .cash-color").off('click');
|
||||||
@@ -802,6 +657,148 @@ var cashier_type = "<%= @cashier_type %>";
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// bind survey to order or sale
|
||||||
|
$("#survey").on('click', function () {
|
||||||
|
var sale = $('#sale_id').text();
|
||||||
|
if (sale) {
|
||||||
|
var sale_id = sale
|
||||||
|
} else {
|
||||||
|
var sale_id = $('#dining').text();
|
||||||
|
}
|
||||||
|
//var table_id = $('.tables').attr("data-id");
|
||||||
|
window.location.href = '/origami/' + sale_id +"/"+ cashier_type + "/surveys"
|
||||||
|
});
|
||||||
|
|
||||||
|
// bind customer to order or sale
|
||||||
|
$("#customer").on('click', function () {
|
||||||
|
var sale = $('#sale_id').text();
|
||||||
|
if (sale) {
|
||||||
|
var sale_id = sale
|
||||||
|
} else {
|
||||||
|
var sale_id = $('#save_order_id').attr('data-order');
|
||||||
|
}
|
||||||
|
var table_id = $('.tables').attr("data-id");
|
||||||
|
window.location.href = '/origami/' + sale_id + "/"+cashier_type+"/customers"
|
||||||
|
});
|
||||||
|
|
||||||
|
// Add Other Charges
|
||||||
|
$('#other-charges').click(function () {
|
||||||
|
var sale = $('#sale_id').text();
|
||||||
|
if (sale != "") {
|
||||||
|
var sale_id = sale
|
||||||
|
} else {
|
||||||
|
var sale_id = $('#save_order_id').attr('data-order');
|
||||||
|
}
|
||||||
|
if (sale_id != "") {
|
||||||
|
window.location.href = '/origami/' + sale_id +"/"+cashier_type+ '/other_charges'
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
swal ( "Oops" , "Please select an table!" , "warning" );
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
// Discount for Payment
|
||||||
|
$('#discount').click(function () {
|
||||||
|
if ($(this).attr('active')=== "true") {
|
||||||
|
var sale = $('#sale_id').text();
|
||||||
|
if (sale != "") {
|
||||||
|
var sale_id = sale
|
||||||
|
} else {
|
||||||
|
var sale_id = $('#save_order_id').attr('data-order');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sale_id != "") {
|
||||||
|
window.location.href = '/origami/' + sale_id + "/"+cashier_type+'/discount'
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
swal ( "Oops" , "Please select an table!" , "warning" );
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
swal("Oops","You are not authorized for Discount","warning")
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#edit').on('click', function () {
|
||||||
|
var dining_id = $('#dining').text();
|
||||||
|
var sale_id = $('#sale_id').text();
|
||||||
|
if ($(this).attr('active')=== "true") {
|
||||||
|
if (dining_id) {
|
||||||
|
window.location.href = '/origami/table/' + dining_id + "/sale/" + sale_id + "/"+cashier_type+"/edit";
|
||||||
|
}else{
|
||||||
|
window.location.href = "/origami/table/sale/" + sale_id + "/"+cashier_type+"/edit";
|
||||||
|
}
|
||||||
|
|
||||||
|
}else{
|
||||||
|
swal("Oops","You are not authorized for void","warning")
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).on('click', '.cashier_number', function(event){
|
||||||
|
if(event.handled !== true) {
|
||||||
|
var original_value;
|
||||||
|
original_value = $('#cash').text();
|
||||||
|
|
||||||
|
var input_type = $(this).attr("data-type");
|
||||||
|
|
||||||
|
switch (input_type) {
|
||||||
|
case 'num':
|
||||||
|
var input_value = $(this).attr("data-value");
|
||||||
|
if (original_value == "0.0"){
|
||||||
|
$('#cash').text(input_value);
|
||||||
|
update_balance();
|
||||||
|
}else{
|
||||||
|
if($('#cash').text() == '0'){
|
||||||
|
$('#cash').text("");
|
||||||
|
}
|
||||||
|
$('#cash').append(input_value);
|
||||||
|
update_balance();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'add':
|
||||||
|
var input_value = $(this).attr("data-value");
|
||||||
|
amount = parseInt(input_value) + parseInt(original_value);
|
||||||
|
$('#cash').text(amount);
|
||||||
|
update_balance();
|
||||||
|
break;
|
||||||
|
case 'del' :
|
||||||
|
var cash=$('#cash').text();
|
||||||
|
if(cash.length == 1)
|
||||||
|
$('#cash').text("0.0");
|
||||||
|
else
|
||||||
|
$('#cash').text(cash.substr(0,cash.length-1));
|
||||||
|
update_balance();
|
||||||
|
break;
|
||||||
|
case 'clr':
|
||||||
|
$('#cash').text("0.0");
|
||||||
|
update_balance();
|
||||||
|
break;
|
||||||
|
case 'nett':
|
||||||
|
var credit1 = $('#credit').text();
|
||||||
|
var card1 = $('#others').text();
|
||||||
|
var paypar1 = $('#ppamount').text();
|
||||||
|
var visa1 = $('#visacount').text();
|
||||||
|
var jcb1 = $('#jcbcount').text();
|
||||||
|
var master1 = $('#mastercount').text();
|
||||||
|
var unionpay1 = $('#unionpaycount').text();
|
||||||
|
var othertotal = parseFloat(credit1) + parseFloat(card1) + parseFloat(paypar1) + parseFloat(visa1) + parseFloat(jcb1) + parseFloat(master1) + parseFloat(unionpay1);
|
||||||
|
var total = $('#amount_due').text();
|
||||||
|
var amt = 0;
|
||||||
|
<% if precision.to_i > 0 %>;
|
||||||
|
amt = parseFloat(parseFloat(total) - parseFloat(othertotal)).toFixed(<%= precision %>);
|
||||||
|
<% else %>
|
||||||
|
amt = parseFloat(parseFloat(total) - parseFloat(othertotal));
|
||||||
|
<% end %>
|
||||||
|
$('#cash').text(amt);
|
||||||
|
update_balance();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
event.handled = true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
function update_balance(){
|
function update_balance(){
|
||||||
var cash = $('#cash').text();
|
var cash = $('#cash').text();
|
||||||
var credit = $('#credit').text();
|
var credit = $('#credit').text();
|
||||||
@@ -891,42 +888,40 @@ var cashier_type = "<%= @cashier_type %>";
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$('#print_pdf').off('click');
|
||||||
//print pdf function
|
//print pdf function
|
||||||
$(document).on('ready page:load',function(){
|
$("#print_pdf").on('click',function(){
|
||||||
$(document).on('click', "button#print_pdf",function(){
|
var filename = $("#filename").val();
|
||||||
// $('#print_pdf').click(function(){
|
var printer_name = $("#printer_name").val();
|
||||||
var filename = $("#filename").val();
|
var receipt_no = $("#sale_receipt_no").val();
|
||||||
var printer_name = $("#printer_name").val();
|
var print_copies = $("#print_copies").val();
|
||||||
var receipt_no = $("#sale_receipt_no").val();
|
var params = { turbolinks: false, remote : true, 'filename':filename, 'receipt_no':receipt_no, 'print_copies':print_copies, 'printer_name':printer_name };
|
||||||
var print_copies = $("#print_copies").val();
|
// swal({
|
||||||
var params = { turbolinks: false, remote : true, 'filename':filename, 'receipt_no':receipt_no, 'print_copies':print_copies, 'printer_name':printer_name };
|
// title: "Alert",
|
||||||
// swal({
|
// text: "Are you sure want to print?",
|
||||||
// title: "Alert",
|
// type: "warning",
|
||||||
// text: "Are you sure want to print?",
|
// showCancelButton: true,
|
||||||
// type: "warning",
|
// confirmButtonColor: "#DD6B55",
|
||||||
// showCancelButton: true,
|
// confirmButtonText: "Print",
|
||||||
// confirmButtonColor: "#DD6B55",
|
// closeOnConfirm: false
|
||||||
// confirmButtonText: "Print",
|
// }, function (isConfirm) {
|
||||||
// closeOnConfirm: false
|
// if (isConfirm) {
|
||||||
// }, function (isConfirm) {
|
$.ajax({
|
||||||
// if (isConfirm) {
|
type: "POST",
|
||||||
$.ajax({
|
url: "<%= origami_payment_print_path %>",
|
||||||
type: "POST",
|
data: params,
|
||||||
url: "<%= origami_payment_print_path %>",
|
success:function(result){
|
||||||
data: params,
|
console.log(result);
|
||||||
success:function(result){
|
// if (cashier_type=="cashier") {
|
||||||
console.log(result);
|
// window.location.href = '/origami';
|
||||||
// if (cashier_type=="cashier") {
|
// }else{
|
||||||
// window.location.href = '/origami';
|
// window.location.href = '/origami/quick_service';
|
||||||
// }else{
|
// }
|
||||||
// window.location.href = '/origami/quick_service';
|
}
|
||||||
// }
|
});
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
// }
|
|
||||||
// });
|
|
||||||
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -20,11 +20,11 @@ class ActionController::Base
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
# check for license file
|
# check for license file
|
||||||
# if check_license
|
if check_license
|
||||||
# current_license(ENV["SX_PROVISION_URL"])
|
current_license(ENV["SX_PROVISION_URL"])
|
||||||
# else
|
else
|
||||||
# redirect_to activate_path
|
redirect_to activate_path
|
||||||
# end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user