update cloud and master
This commit is contained in:
@@ -163,7 +163,7 @@ function checkReceiptNoInFirstBillData(receipt_no,payment) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (payment) {
|
if (payment) {
|
||||||
return status; //json_data[0]["payment"];
|
return json_data[0]["payment"];
|
||||||
}else{
|
}else{
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -225,6 +225,8 @@ class Origami::DiscountsController < BaseOrigamiController
|
|||||||
end
|
end
|
||||||
Rails.logger.debug "-------------- Member Discount Osaka ---------"
|
Rails.logger.debug "-------------- Member Discount Osaka ---------"
|
||||||
Rails.logger.debug response.to_json
|
Rails.logger.debug response.to_json
|
||||||
|
puts "-------------- Member Discount Osaka ---------"
|
||||||
|
puts response.to_json
|
||||||
# Re-calc All Amount in Sale
|
# Re-calc All Amount in Sale
|
||||||
if response["status"] == true
|
if response["status"] == true
|
||||||
discount_amount = response["discount_earned"]
|
discount_amount = response["discount_earned"]
|
||||||
|
|||||||
@@ -396,8 +396,14 @@
|
|||||||
<button type="button" id="commissions" class="btn btn-block bg-blue waves-effect">Commissions</button>
|
<button type="button" id="commissions" class="btn btn-block bg-blue waves-effect">Commissions</button>
|
||||||
<button type="button" id="in_duties" class="btn btn-block bg-blue waves-effect">In Duties</button>
|
<button type="button" id="in_duties" class="btn btn-block bg-blue waves-effect">In Duties</button>
|
||||||
<!-- first bill not used in cloud -->
|
<!-- first bill not used in cloud -->
|
||||||
<% if ENV["SERVER_MODE"] != "cloud" %>
|
<% if ENV["SERVER_MODE"] == "cloud" %>
|
||||||
<button type="button" id="first_bill" class="btn btn-block bg-blue waves-effect">First Bill</button>
|
<button type="button" id="first_bill" class="btn btn-block bg-blue waves-effect">First Bill</button>
|
||||||
|
<% else %>
|
||||||
|
<%if @membership.discount && @obj_sale.customer.membership_id %>
|
||||||
|
<button type="button" class="btn btn-block bg-blue waves-effect" data-toggle="modal" data-target="#paymentModal">First Bill</button>
|
||||||
|
<%else%>
|
||||||
|
<button type="button" id="first_bill" class="btn btn-block bg-blue waves-effect">First Bill</button>
|
||||||
|
<%end%>
|
||||||
<% end %>
|
<% end %>
|
||||||
<button type="button" id="pay" class="btn btn-block bg-blue waves-effect">Pay</button>
|
<button type="button" id="pay" class="btn btn-block bg-blue waves-effect">Pay</button>
|
||||||
<button type="button" id="void" class="btn btn-block bg-blue waves-effect" active="<%= can? :overall_void, :void %>"> Void</button>
|
<button type="button" id="void" class="btn btn-block bg-blue waves-effect" active="<%= can? :overall_void, :void %>"> Void</button>
|
||||||
@@ -584,22 +590,60 @@
|
|||||||
type: "GET",
|
type: "GET",
|
||||||
url: ajax_url,
|
url: ajax_url,
|
||||||
success: function (result) {
|
success: function (result) {
|
||||||
|
receipt_no = ($("#receipt_no").html()).trim();
|
||||||
|
if((receipt_no!=undefined) && (receipt_no!=""))
|
||||||
|
createReceiptNoInFirstBillData(receipt_no,"");
|
||||||
|
|
||||||
location.reload();
|
location.reload();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// $('#pay').on('click', function () {
|
$(".choose_payment").on('click', function () {
|
||||||
// var sale_id = $('#sale_id').val();
|
$( "#loading_wrapper").show();
|
||||||
// var url = '/origami/sale/' + sale_id + "/rounding_adj";
|
|
||||||
// $.ajax({
|
var sale_id = $('#sale_id').val();
|
||||||
// type: "POST",
|
type = $('.payment_method').val();
|
||||||
// url: '/origami/sale/' + sale_id + "/rounding_adj",
|
if(parseInt(jQuery.inArray("Credit", type)) == -1){
|
||||||
// success: function (result) {
|
if (parseInt(jQuery.inArray("MPU", type)) > 0 || parseInt(jQuery.inArray("VISA", type)) > 0 || parseInt(jQuery.inArray("JCB", type)) > 0 || parseInt(jQuery.inArray("Master", type)) > 0 || parseInt(jQuery.inArray("UNIONPAY", type)) > 0 || parseInt(jQuery.inArray("Redeem", type)) > 0) {
|
||||||
// window.location.href = '/origami/sale/' + sale_id + "/payment";
|
calculate_member_discount(sale_id,"Card");
|
||||||
// }
|
|
||||||
// });
|
}else{
|
||||||
// });
|
calculate_member_discount(sale_id,"Cash");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var ajax_url = "/origami/sale/" + sale_id + "/first_bill";
|
||||||
|
$.ajax({
|
||||||
|
type: "GET",
|
||||||
|
url: ajax_url,
|
||||||
|
success: function (result) {
|
||||||
|
$( "#loading_wrapper" ).hide();
|
||||||
|
receipt_no = ($("#receipt_no").html()).trim();
|
||||||
|
if((receipt_no!=undefined) && (receipt_no!=""))
|
||||||
|
createReceiptNoInFirstBillData(receipt_no,type);
|
||||||
|
location.reload();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
function calculate_member_discount(sale_id,type) {
|
||||||
|
var sub_total = $('#sub-total').text();
|
||||||
|
if (type == "Cash") {
|
||||||
|
is_card = false
|
||||||
|
}else{
|
||||||
|
is_card = true
|
||||||
|
}
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: "/origami/" + sale_id + "/member_discount",
|
||||||
|
data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':is_card },
|
||||||
|
async: false,
|
||||||
|
success:function(result){
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
$('#pay').on('click', function () {
|
$('#pay').on('click', function () {
|
||||||
var sale_id = $('#sale_id').val();
|
var sale_id = $('#sale_id').val();
|
||||||
window.location.href = '/origami/sale/' + sale_id + "/payment";
|
window.location.href = '/origami/sale/' + sale_id + "/payment";
|
||||||
|
|||||||
@@ -305,14 +305,17 @@
|
|||||||
<script>
|
<script>
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
/* start check first bill or not*/
|
/* start check first bill or not*/
|
||||||
|
var member_id = $('#membership_id').text();
|
||||||
|
var member_discount = $('#member_discount').text();
|
||||||
var receipt_no = "";
|
var receipt_no = "";
|
||||||
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
|
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
|
||||||
receipt_no = ($("#receipt_no").html()).trim();
|
receipt_no = ($("#receipt_no").html()).trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($("#server_mode").val() != "cloud") { // first bill not used in cloud
|
|
||||||
payment_type = checkReceiptNoInFirstBillData(receipt_no,"payment")
|
payment_type = checkReceiptNoInFirstBillData(receipt_no,"payment")
|
||||||
|
console.log(payment_type)
|
||||||
|
if ($("#server_mode").val() != "cloud") { // first bill not used in cloud
|
||||||
|
if (member_id && member_discount) {
|
||||||
if(parseInt(jQuery.inArray("Credit", payment_type)) == -1){
|
if(parseInt(jQuery.inArray("Credit", payment_type)) == -1){
|
||||||
$("#credit_payment").hide();
|
$("#credit_payment").hide();
|
||||||
} else{
|
} else{
|
||||||
@@ -325,6 +328,7 @@
|
|||||||
$("#card_payment").hide();
|
$("#card_payment").hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/* end check first bill or not*/
|
/* end check first bill or not*/
|
||||||
|
|
||||||
var dining_id = "<%= @sale_data.bookings[0].dining_facility_id %>";
|
var dining_id = "<%= @sale_data.bookings[0].dining_facility_id %>";
|
||||||
|
|||||||
Reference in New Issue
Block a user