Pull from master

This commit is contained in:
San Wai Lwin
2018-05-25 16:22:30 +06:30
parent f906134fbf
commit 578c14ccc3
26 changed files with 536 additions and 358 deletions

View File

@@ -101,7 +101,7 @@
<div class="card">
<div class="card-block" style="">
<div class="card-text" id="custom-slimscroll">
<div class="card-columns custom-card-columns menu_items_list" style="column-gap: 0.5rem;">
<div class="row menu_items_list" style="margin:0px 1px 0px 1px ;">
<!-- append data -->
<% @menu.each do |menu| %>
<% if !menu.valid_time.nil? %>
@@ -255,9 +255,9 @@
<table class="table" id="order-charges-table" border="0">
<tr>
<td style="padding:2px;" width="5%"></td>
<td style="padding:2px;" width="15%"></td>
<td style="padding:2px; text-align:" class="charges-name" width="25%"><strong>Total:</strong></td>
<td colspan="2" style="padding:2px; text-align:" class="charges-name" width="25%"><strong>Total:</strong></td>
<td style="padding:2px;" width="15%"><strong id="total_qty">0</strong></td>
<td style="padding:2px; text-align:" width="25%" class="item-attr"><strong id="sub_total">0.00</strong></td>
</tr>
</table>

View File

@@ -6,11 +6,12 @@ json.valid_time_to menu.valid_time_to.strftime("%H:%M")
if (menu.menu_categories)
order_by = Lookup.find_by_lookup_type("order_by")
if !order_by.nil? && order_by.value == "name"
categories = MenuCategory.unscoped.where("menu_id ='#{menu.id}'").order("name asc")
else
categories = menu.menu_categories
end
# if !order_by.nil? && order_by.value == "name"
# categories = MenuCategory.unscoped.where("menu_id ='#{menu.id}'").order("name asc")
# else
# categories = menu.menu_categories
# end
categories = menu.menu_categories
json.categories categories do |category|
menu_category = MenuCategory.find_by_menu_category_id(category.id)

View File

@@ -1,4 +1,4 @@
`<div class="container-fluid">
<div class="container-fluid">
<div id="loading_wrapper" style="display:none;">
<div id="loading"></div>
</div>
@@ -97,16 +97,23 @@
<td class="item-attr"><strong><span>(<%= number_with_precision(@sale_data.total_discount, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i ) %>)</span></strong></td>
</tr>
<tr>
<td class="charges-name"><strong>Tax
(<% @i = 0
@account_arr.each do |ct| %>
<%=ct.name%>
<% if @account_arr.count != @i+1%>
+ <% @i =+1 %>
<%end%>
<%end %>)
</strong></td>
<td class="item-attr"><strong><span><%= number_with_precision(@sale_data.total_tax, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i )%></span></strong></td>
<td class="charges-name">
<strong>
<% if !@account_arr.empty? %>
Tax
(<% @i = 0
@account_arr.each do |ct| %>
<%=ct.tax_name%>
<% if @account_arr.count != @i+1%>
+ <% @i =+1 %>
<%end%>
<%end %>)
<% else %>
No Tax
<% end %></strong><br>
<button class="btn btn-link waves-effect bg-info change_tax">Change Tax</button>
</td>
<td class="item-attr"><strong><span id="total_tax"><%= number_with_precision(@sale_data.total_tax, precision: precision.to_i ) rescue number_with_precision(0, precision: precision.to_i )%></span></strong></td>
</tr>
<tr>
<td class="charges-name"><strong>Rounding Adj:</strong></td>
@@ -536,6 +543,61 @@
</div>
</div>
<!-- change tax modal -->
<div class="modal fade" id="change_taxModal" tabindex="-1" role="dialog">
<div class="modal-dialog modal-md" role="document">
<div class="modal-content">
<div class="modal-header">
<h1 class="modal-title" id="change_taxModalLabel">TAX</h1>
<button type="button" class="close" id="close" data-dismiss="modal" aria-hidden="true" style="font-size: 20px;color:#111;">&times;</button>
</div>
<div class="modal-body">
<% if !@tax_arr.empty? %>
<% if @tax_arr.count > 1 %>
<div class="row text-center">
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
<button type="button" class="btn btn-lg tax-btn-box btn-link bg-primary waves-effect" name="tax_type" data-value="all">
<% @i = 0
@tax_arr.each do |tax| %>
<%= tax %>
<% if @tax_arr.count != @i+1%>
+ <% @i =+1 %><br>
<%end%>
<% end %>
</button>
</div>
<% @tax_arr.each_with_index do |tax, tax_index| %>
<% if (tax_index+1)%2 == 0 %>
<div class="row clearfix"></div>
<% end %>
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
<button type="button" class="btn btn-lg tax-btn-box btn-link bg-primary waves-effect" name="tax_type" data-value="<%= tax %>">
<%= tax %>
</button>
</div>
<% end %>
<% else %>
<div class="row clearfix"></div>
<div class="row text-center">
<% @tax_arr.each do |tax| %>
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
<button type="button" class="btn btn-lg tax-btn-box btn-link bg-primary waves-effect" name="tax_type" data-value="<%= tax %>"><%= tax %></button>
</div>
<% end %>
<% end %>
<% end %>
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">
<button type="button" class="btn btn-lg tax-btn-box btn-link bg-primary waves-effect" name="tax_type" data-value="no_tax">No Tax</button>
</div>
</div>
</div>
</div>
<div class="modal-footer"></div>
</div>
</div>
</div>
<div id="sxModal">
<div id="sxModal-Content">
<h3>Card Tap</h3>
@@ -681,6 +743,8 @@ var customer_name = "<%= @customer.name %>";
var credit = $('#credit').text();
var card = $('#card').text();
var tax_type = $("input:radio[name=tax_type]:checked").val();
if (credit <= 0) {
calculate_member_discount(sale_id);
}
@@ -689,7 +753,7 @@ var customer_name = "<%= @customer.name %>";
$('#pdfModal').focus() }).modal({show : true, backdrop : false, keyboard : false});
$.ajax({type: "POST",
url: "<%= origami_payment_cash_path %>",
data: "cash="+ cash + "&sale_id=" + sale_id + "&type=" + cashier_type,
data: "cash="+ cash + "&sale_id=" + sale_id + "&type=" + cashier_type + "&tax_type=" + tax_type,
success:function(result){
/* start delete receipt no in first bill*/
if(($("#receipt_no").html()!=undefined) && ($("#receipt_no").html()!="")){
@@ -1346,4 +1410,41 @@ var customer_name = "<%= @customer.name %>";
}
});
}
/* Start function for tax changable */
$(".change_tax").on("click",function(){
$("#change_taxModal").modal({show: true, backdrop: false, keyboard: false});
});
$("button[name=tax_type]").on("click", function(){
var type = $(this).attr("data-value");
var cashier_type = '<%= @cashier_type %>';
var sale_id = $('#sale_id').text();
console.log(type);
swal({
title: "Alert",
text: "Are you sure want to change tax?",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes, change it!",
closeOnConfirm: false
}, function (isConfirm) {
if (isConfirm) {
$.ajax({
type: "POST",
url: "/origami/payment/"+cashier_type+"/change_tax",
data: {sale_id: sale_id, cashier_type: cashier_type, tax_type: type},
success:function(data){
if(data.status){
window.location.href = '/origami/sale/'+sale_id+'/'+cashier_type+'/payment';
}
}
});
}else{
swal.close();
}
});
});
/* End function for tax changable */
</script>

View File

@@ -126,7 +126,9 @@
$('.sale_item').on('click', function () {
$('#order-items-table tr').siblings().css( "background-color", "white" );
this.style.backgroundColor = 'lightgray';
$('#order-items-table tr').siblings().css( "color", "black" );
this.style.backgroundColor = 'blue';
this.style.color = 'white';
var sale_item_id = this.getAttribute('data-sale-item');
var ajax_url = "/origami/select_sale_item";
selected_sale_item = sale_item_id;
@@ -179,11 +181,17 @@
url: ajax_url,
data: param_data,
success: function (result) {
console.log(selected_sale_item + "," +commissioner_id);
console.log(result);
if(result.deselect == true){
$(commissioner).removeClass("blue").addClass("green");
$("tr[data-sale-item=" + selected_sale_item + "] td.commissioner").text('-');
}
if(result.status == true){
swal("Information",result.message,"success");
}else{
$("tr[data-sale-item=" + selected_sale_item + "] td.commissioner").text('-');
swal("Opps",result.message,"warning");
}
}
});
};