Pull from master

This commit is contained in:
San Wai Lwin
2018-07-09 09:27:52 +06:30
35 changed files with 167 additions and 102 deletions

View File

@@ -11,6 +11,7 @@
</div>
<input type="hidden" name="type" id="role" value="<%= current_user.role%>">
<input type="hidden" name="cashier_type" id="cashier_type" value="<%= type%>">
<input type="hidden" name="display_type" id="display_type" value="<%= @display_type%>">
<div class="row m-t--20">
<div class="col-lg-2 col-md-2 col-sm-2 hidden" id="menu_data">
<li class="list-menu">

View File

@@ -298,7 +298,7 @@
sub_total = sub_total + (order_item.price * order_item.qty)
# unless order_item.price == 0 %>
<tr class="edit_order" data-id='<%= order_item.order_items_id %>'>
<tr class="<%= @edit_order_origami==true ? 'edit_order' : '' %>" data-id='<%= order_item.order_items_id %>'>
<td><%= count %></td>
<td class='item-name'>
<%= order_item.item_name %>
@@ -402,7 +402,7 @@
set_item_prices = 0
count += 1
%>
<tr class="edit_order" data-id='<%= order_item.order_items_id %>'>
<tr class="<%= @edit_order_origami==true ? 'edit_order' : '' %>" data-id='<%= order_item.order_items_id %>'>
<td><%= count %>
<td class='item-name'>
<%= order_item.item_name %>
@@ -699,7 +699,7 @@
<script>
var cashier_type = "cashier";
$(document).ready(function () {
localStorage.removeItem("tax_type");
// localStorage.removeItem("tax_type");
/* check webview loaded*/
var webview = <%= @webview %>;
showHideNavbar(webview);
@@ -894,12 +894,14 @@
var sale_id = $('#sale_id').val();
// type = $('.payment_method').val();
type = get_selected_attributes('selected-payment');
var tax_type = localStorage.getItem("tax_type") ? localStorage.getItem("tax_type") : 'all';
if(parseInt(jQuery.inArray("Credit", type)) == -1){
if (parseInt(jQuery.inArray("MPU", type)) != -1 || parseInt(jQuery.inArray("VISA", type)) != -1 || parseInt(jQuery.inArray("JCB", type)) != -1 || parseInt(jQuery.inArray("Master", type)) != -1 || parseInt(jQuery.inArray("UNIONPAY", type)) != -1 || parseInt(jQuery.inArray("Redeem", type)) != -1 || parseInt(jQuery.inArray("PAYMAL",type))!= -1) {
calculate_member_discount(sale_id,"Card");
calculate_member_discount(sale_id,"Card",tax_type);
}else{
calculate_member_discount(sale_id,"Cash");
calculate_member_discount(sale_id,"Cash",tax_type);
}
}
var ajax_url = "/origami/sale/" + sale_id + "/first_bill";
@@ -920,7 +922,7 @@
});
});
function calculate_member_discount(sale_id,type) {
function calculate_member_discount(sale_id,type,tax_type) {
var sub_total = $('#sub-total').text();
if (type == "Cash") {
is_card = false
@@ -930,7 +932,7 @@
$.ajax({
type: "POST",
url: "/origami/" + sale_id + "/member_discount",
data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':is_card,'cashier_type':'cashier' },
data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':is_card,'cashier_type':'cashier','tax_type':tax_type },
async: false,
success:function(result){
}
@@ -1251,7 +1253,7 @@
});
$("button[name=tax_type]").on("click", function(){
var type = $(this).attr("data-value");
var tax_type = $(this).attr("data-value");
var cashier_type = 'cashier';
var sale_id = $('#sale_id').text();
var dining_id = "<%= @dining.id rescue "" %> ";
@@ -1270,11 +1272,12 @@
$.ajax({
type: "POST",
url: "/origami/payment/"+cashier_type+"/change_tax",
data: {sale_id: sale_id, cashier_type: cashier_type, tax_type: type},
data: {sale_id: sale_id, cashier_type: cashier_type, tax_type: tax_type},
success:function(data){
if(data.status){
// console.log(type);
localStorage.setItem("tax_type", type);
alert(tax_type);
localStorage.setItem("tax_type", tax_type);
alert(localStorage.getItem("tax_type"));
window.location.href = '/origami/table/'+dining_id;
}
}

View File

@@ -652,7 +652,7 @@ var pdf_view = '<%=@pdf_view%>';
payment_type = '';
if ($("#server_mode").val() != "cloud") { // first bill not used in cloud
// if ($("#server_mode").val() != "cloud") { // first bill not used in cloud
payment_type = checkReceiptNoInFirstBillData(receipt_no,"payment");
// console.log(payment_type)
// console.log(parseInt(jQuery.inArray("MPU", payment_type)))
@@ -678,7 +678,7 @@ var pdf_view = '<%=@pdf_view%>';
$("#card_payment").hide();
}
}
}
// }
/* end check first bill or not*/
var dining_id = "<%= @sale_data.bookings[0].dining_facility_id %>";
@@ -770,8 +770,7 @@ var pdf_view = '<%=@pdf_view%>';
var credit = $('#credit').text();
var card = $('#card').text();
var tax_type = localStorage.getItem("tax_type") ? localStorage.getItem("tax_type") : '';
var tax_type = localStorage.getItem("tax_type") ? localStorage.getItem("tax_type") : 'all';
if (credit <= 0) {
calculate_member_discount(sale_id,tax_type);
}
@@ -1037,7 +1036,6 @@ var pdf_view = '<%=@pdf_view%>';
var member_id = $('#membership_id').text();
var member_discount = $('#member_discount').text();
var item_row = $('.is_card');
if (member_id && member_discount) {
if (item_row.length < 1) {
is_card = false

View File

@@ -287,7 +287,7 @@
sub_total = sub_total + (order_item.price * order_item.qty)
# unless order_item.price == 0 %>
<tr class="edit_order" data-id='<%= order_item.order_items_id %>'>
<tr class="<%= @edit_order_origami== true ? 'edit_order' : ''%>" data-id='<%= order_item.order_items_id %>'>
<td><%= count %></td>
<td class='item-name'>
<%= order_item.item_name %>
@@ -391,7 +391,7 @@
set_item_prices = 0
count += 1
%>
<tr class="edit_order" data-id='<%= order_item.order_items_id %>'>
<tr class="<%= @edit_order_origami== true ? 'edit_order' : ''%>" data-id='<%= order_item.order_items_id %>'>
<td><%= count %>
<td class='item-name'>
<%= order_item.item_name %>
@@ -694,7 +694,7 @@
<script>
var cashier_type = "cashier";
$(document).ready(function(){
localStorage.removeItem("tax_type");
// localStorage.removeItem("tax_type");
/* check webview loaded*/
var webview = <%= @webview %>;
showHideNavbar(webview);
@@ -913,14 +913,14 @@ $(".choose_payment").on('click', function () {
$( "#loading_wrapper").show();
var sale_id = $('#sale_id').val();
type = get_selected_attributes('selected-payment');
var tax_type = localStorage.getItem("tax_type") ? localStorage.getItem("tax_type") : 'all';
// type = $('.payment_method').val();
if(parseInt(jQuery.inArray("Credit", type)) == -1){
if (parseInt(jQuery.inArray("MPU", type)) != -1 || parseInt(jQuery.inArray("VISA", type)) != -1 || parseInt(jQuery.inArray("JCB", type)) != -1 || parseInt(jQuery.inArray("Master", type)) != -1 || parseInt(jQuery.inArray("UNIONPAY", type)) != -1 || parseInt(jQuery.inArray("Redeem", type)) != -1 || parseInt(jQuery.inArray("PAYMAL", type)) != -1) {
calculate_member_discount(sale_id,"Card");
calculate_member_discount(sale_id,"Card",tax_type);
}else{
calculate_member_discount(sale_id,"Cash");
calculate_member_discount(sale_id,"Cash",tax_type);
}
}
var ajax_url = "/origami/sale/" + sale_id + "/first_bill";
@@ -942,7 +942,7 @@ $(".choose_payment").on('click', function () {
}
});
});
function calculate_member_discount(sale_id,type) {
function calculate_member_discount(sale_id,type,tax_type) {
var sub_total = $('#sub-total').text();
if (type == "Cash") {
is_card = false
@@ -952,12 +952,11 @@ function calculate_member_discount(sale_id,type) {
$.ajax({
type: "POST",
url: "/origami/" + sale_id + "/member_discount",
data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':is_card },
data: {'sale_id':sale_id, 'sub_total':sub_total,'is_card':is_card,'cashier_type':'cashier','tax_type':tax_type },
async: false,
success:function(result){
}
});
}
$('#pay').on('click',function() {
@@ -1319,7 +1318,7 @@ $('#add_invoice').on('click',function(){
});
$("button[name=tax_type]").on("click", function(){
var type = $(this).attr("data-value");
var tax_type = $(this).attr("data-value");
var cashier_type = 'cashier';
var sale_id = $('#sale_id').text();
var dining_id = "<%= @room.id rescue "" %> ";
@@ -1338,11 +1337,11 @@ $('#add_invoice').on('click',function(){
$.ajax({
type: "POST",
url: "/origami/payment/"+cashier_type+"/change_tax",
data: {sale_id: sale_id, cashier_type: cashier_type, tax_type: type},
data: {sale_id: sale_id, cashier_type: cashier_type, tax_type: tax_type},
success:function(data){
if(data.status){
// console.log(type);
localStorage.setItem("tax_type", type);
// console.log(tax_type);
localStorage.setItem("tax_type", tax_type);
window.location.href = '/origami/room/'+dining_id;
}
}