Merge branch 'adminbsb_material_ui' of bitbucket.org:code2lab/sxrestaurant
This commit is contained in:
@@ -23,9 +23,8 @@ class Origami::HomeController < BaseOrigamiController
|
||||
@sale_array = Array.new
|
||||
|
||||
@shop = Shop::ShopDetail
|
||||
@membership = MembershipSetting.find_by_discount(1)
|
||||
@membership = MembershipSetting::MembershipSetting
|
||||
@payment_methods = PaymentMethodSetting.all
|
||||
|
||||
@dining.bookings.active.each do |booking|
|
||||
if booking.sale_id.nil? && booking.booking_status != 'moved'
|
||||
@order_items = Array.new
|
||||
|
||||
@@ -296,8 +296,8 @@ class Origami::PaymentsController < BaseOrigamiController
|
||||
@shop = Shop.find_by_id(1)
|
||||
|
||||
if @shop.is_rounding_adj
|
||||
a = saleObj.grand_total % 25
|
||||
b = saleObj.grand_total / 25
|
||||
a = saleObj.grand_total % 25 #
|
||||
b = saleObj.grand_total / 25 #
|
||||
if (a != 0.0 && b%2 != 0.0) || (a==0.0 && b%2 !=0)
|
||||
new_total = Sale.get_rounding_adjustment(saleObj.grand_total)
|
||||
rounding_adj = new_total-saleObj.grand_total
|
||||
|
||||
@@ -19,6 +19,9 @@ class Origami::RoomsController < BaseOrigamiController
|
||||
@status_sale = ""
|
||||
@sale_array = Array.new
|
||||
|
||||
@shop = Shop::ShopDetail
|
||||
@membership = MembershipSetting::MembershipSetting
|
||||
@payment_methods = PaymentMethodSetting.all
|
||||
@room.bookings.active.each do |booking|
|
||||
if booking.sale_id.nil? && booking.booking_status != 'moved'
|
||||
@order_items = Array.new
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
class MembershipSetting < ApplicationRecord
|
||||
MembershipSetting = MembershipSetting.find_by_id(1)
|
||||
end
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<div class="container-fluid">
|
||||
<div id="loading_wrapper" style="display:none;">
|
||||
<div id="loading"></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<!-- Column One -->
|
||||
<div class="col-lg-6 col-md-6 col-sm-6">
|
||||
@@ -260,7 +263,7 @@
|
||||
<table class="table" id="order-charges-table" border="0">
|
||||
<tr>
|
||||
<td class="charges-name"><strong>Sub Total:</strong></td>
|
||||
<td class="item-attr"><strong id="order-sub-total"><%= sub_total %></strong></td>
|
||||
<td class="item-attr"><strong id="sub-total"><%= sub_total %></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<%if @obj_sale != nil && @obj_sale.discount_type == 'member_discount'%>
|
||||
@@ -369,10 +372,43 @@
|
||||
<button type="button" id="in_duties" class="btn btn-block bg-blue waves-effect">In Duties</button>
|
||||
<!-- <button type="button" class="btn bg-blue btn-block" id='move' disabled="">Move</button> -->
|
||||
<!-- <button type="button" id="request_bills" class="btn bg-blue btn-block" disabled> Req.Bill</button> -->
|
||||
<button type="button" id="first_bill" class="btn bg-blue btn-block">First Bill</button>
|
||||
<%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%>
|
||||
<button type="button" id="pay" class="btn bg-blue btn-block">Pay</button>
|
||||
<button type="button" id="void" class="btn bg-blue btn-block" > Void </button>
|
||||
<% end %>
|
||||
|
||||
|
||||
<span class="hidden" id="member_discount"><%= @membership.discount%></span>
|
||||
<span class="hidden" id="membership_id"><%= @obj_sale.customer.membership_id rescue 0%></span>
|
||||
<div class="modal fade" id="paymentModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="paymentModalLabel">Choose Payment</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<select class="form-control show-tick payment_method" id="payment_method" >
|
||||
<option value="Cash">Cash</option>
|
||||
<% @payment_methods.each do |pay| %>
|
||||
<option value="<%= pay.payment_method %>">
|
||||
<%= pay.payment_method %>
|
||||
</option>
|
||||
<%end %>
|
||||
|
||||
</select>
|
||||
</div>
|
||||
<div class="modal-footer p-r-30">
|
||||
<button type="button" class="btn btn-link btn-danger waves-effect" data-dismiss="modal">CLOSE</button>
|
||||
|
||||
<button type="button" class="btn btn-link bg-blue waves-effect choose_payment">SAVE</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Cashier Buttons -->
|
||||
|
||||
<!-- <button type="button" id="re-print" class="btn bg-blue btn-block" >Re.Print</button> -->
|
||||
@@ -538,6 +574,41 @@ $("#first_bill").on('click', function(){
|
||||
});
|
||||
});
|
||||
|
||||
$(".choose_payment").on('click', function () {
|
||||
$( "#loading_wrapper").show();
|
||||
var sale_id = $('#sale_id').val();
|
||||
type = $('.payment_method').val();
|
||||
|
||||
calculate_member_discount(sale_id,type);
|
||||
|
||||
var ajax_url = "/origami/sale/" + sale_id + "/first_bill";
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: ajax_url,
|
||||
success: function (result) {
|
||||
$( "#loading_wrapper" ).hide();
|
||||
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() {
|
||||
var sale_id = $('#sale_id').val();
|
||||
var url = '/origami/sale/'+ sale_id + "/rounding_adj" ;
|
||||
|
||||
Reference in New Issue
Block a user