remove comment in action controller

This commit is contained in:
phyusin
2018-03-07 15:55:55 +06:30
parent 2942ceab71
commit 5d8ba3c416
2 changed files with 182 additions and 187 deletions

View File

@@ -408,7 +408,7 @@
<div class="row p-r-20">
<% if ENV["SERVER_MODE"] != 'cloud' %>
<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>
<% end %>
<div class="col-md-5">
@@ -421,7 +421,7 @@
</div>
</div>
<script>
<script type="text/javascript">
var cashier_type = "<%= @cashier_type %>";
$(document).ready(function(){
/* start check first bill or not*/
@@ -471,152 +471,7 @@ var cashier_type = "<%= @cashier_type %>";
$('#cash').text(localStorage.getItem("cash"));
}
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
$(".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(){
var cash = $('#cash').text();
var credit = $('#credit').text();
@@ -891,42 +888,40 @@ var cashier_type = "<%= @cashier_type %>";
}
}
$('#print_pdf').off('click');
//print pdf function
$(document).on('ready page:load',function(){
$(document).on('click', "button#print_pdf",function(){
// $('#print_pdf').click(function(){
var filename = $("#filename").val();
var printer_name = $("#printer_name").val();
var receipt_no = $("#sale_receipt_no").val();
var print_copies = $("#print_copies").val();
var params = { turbolinks: false, remote : true, 'filename':filename, 'receipt_no':receipt_no, 'print_copies':print_copies, 'printer_name':printer_name };
// swal({
// title: "Alert",
// text: "Are you sure want to print?",
// type: "warning",
// showCancelButton: true,
// confirmButtonColor: "#DD6B55",
// confirmButtonText: "Print",
// closeOnConfirm: false
// }, function (isConfirm) {
// if (isConfirm) {
$.ajax({
type: "POST",
url: "<%= origami_payment_print_path %>",
data: params,
success:function(result){
console.log(result);
// if (cashier_type=="cashier") {
// window.location.href = '/origami';
// }else{
// window.location.href = '/origami/quick_service';
// }
}
});
// }
// });
});
$("#print_pdf").on('click',function(){
var filename = $("#filename").val();
var printer_name = $("#printer_name").val();
var receipt_no = $("#sale_receipt_no").val();
var print_copies = $("#print_copies").val();
var params = { turbolinks: false, remote : true, 'filename':filename, 'receipt_no':receipt_no, 'print_copies':print_copies, 'printer_name':printer_name };
// swal({
// title: "Alert",
// text: "Are you sure want to print?",
// type: "warning",
// showCancelButton: true,
// confirmButtonColor: "#DD6B55",
// confirmButtonText: "Print",
// closeOnConfirm: false
// }, function (isConfirm) {
// if (isConfirm) {
$.ajax({
type: "POST",
url: "<%= origami_payment_print_path %>",
data: params,
success:function(result){
console.log(result);
// if (cashier_type=="cashier") {
// window.location.href = '/origami';
// }else{
// window.location.href = '/origami/quick_service';
// }
}
});
// }
// });
});

View File

@@ -20,11 +20,11 @@ class ActionController::Base
end
else
# check for license file
# if check_license
# current_license(ENV["SX_PROVISION_URL"])
# else
# redirect_to activate_path
# end
if check_license
current_license(ENV["SX_PROVISION_URL"])
else
redirect_to activate_path
end
end
end