Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant

This commit is contained in:
Yan
2018-01-17 12:06:29 +06:30
30 changed files with 450 additions and 247 deletions

View File

@@ -43,12 +43,14 @@
</a>
</li>
<% end %>
<% if can? :index, :home %>
<li>
<a href="<%= origami_root_path %>">
<i class="material-icons">monetization_on</i>
<span><%= t :origami %></span>
</a>
</li>
<% end %>
<% if can? :menage, Customer %>
<li>
<a href="javascript:void(0);" class="menu-toggle">
@@ -106,6 +108,7 @@
<% end %>
</ul>
</li>
<% if can? :index, :dailysale %>
<li>
<a href="javascript:void(0);" class="menu-toggle">
<i class="material-icons">assessment</i>
@@ -141,6 +144,7 @@
</li>
</ul>
</li>
<%end%>
<li class="header"><%= t :settings %></li>
<% if can? :menage, Zone %>
<li>

View File

@@ -168,8 +168,10 @@
<div class="col-lg-1 col-md-1 col-sm-1">
<!-- OQS Buttons -->
<a href="<%= dashboard_path %>" class="btn btn-sm btn-block btn-default waves-effect" role="button" aria-haspopup="true"><i class="material-icons">reply</i> Back </a>
<!-- <button type="button" title="Print Order Item" id="print_order_item" class="btn bg-blue btn-block btn-lg waves-effect">Print</a>
<button type="button" class="btn bg-blue btn-block btn-lg waves-effect" id="print_order_summary">Print <br/>Order<br/>Summary</button> -->
<% if ENV["SERVER_MODE"] != "cloud" %>
<button type="button" title="Print Order Item" id="print_order_item" class="btn bg-blue btn-block btn-lg waves-effect">Print</a>
<button type="button" class="btn bg-blue btn-block btn-lg waves-effect" id="print_order_summary">Print <br/>Order<br/>Summary</button>
<%end%>
</div>
</div>

View File

@@ -576,7 +576,7 @@
swal ( "Oops" , "Please select an table!" , "warning" );
}
}else{
swal("Opps","You are not authorized for void","warning")
swal("Opps","You are not authorized for Discount","warning")
}
return false;
});
@@ -605,7 +605,7 @@
var sale_id = $('#sale_id').val();
type = $('.payment_method').val();
if(parseInt(jQuery.inArray("Credit", type)) == -1){
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) {
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) {
calculate_member_discount(sale_id,"Card");
}else{

View File

@@ -94,11 +94,13 @@
<% else %>
<div id="save_order_id" data-order="">
<% end %>
<strong id="order-title">ORDER DETAILS </strong> | Table <%= @dining.name rescue "" %>
<% if @booking.checkout_by.nil? && !@booking.reserved_by.nil? %>
<span class="float-right"><%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> - <%= @booking.checkout_at.utc.getlocal.strftime("%I:%M %p") %></span>
<% else %>
<span class="float-right">Checkin Time : <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span>
<% if !@booking.nil? %>
<strong id="order-title">ORDER DETAILS </strong> | Table <%= @dining.name rescue "" %>
<% if @booking.checkout_by.nil? && !@booking.reserved_by.nil? %>
<span class="float-right"><%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %> - <%= @booking.checkout_at.utc.getlocal.strftime("%I:%M %p") %></span>
<% else %>
<span class="float-right">Checkin Time : <%= @booking.checkin_at.utc.getlocal.strftime("%I:%M %p") %></span>
<% end %>
<% end %>
</div>
<% elsif @status_sale == 'sale' %>
@@ -149,10 +151,10 @@
<div class="row p-l-5 p-r-5">
<div class="col-lg-6 col-md-6 col-sm-6">
<% if @status_sale == 'sale' %>
<% if @status_sale == 'sale' && !@sale_array.empty? %>
<p class="hidden customer-id"><%= @sale_array[0].customer_id rescue '' %></p>
&nbsp; Customer : <%= @sale_array[0].customer.name rescue '' %>
<% elsif @status_order == 'order'
<% elsif @status_order == 'order' && !@customer.nil?
%>
<p class="hidden customer-id"><%= @customer.customer_id rescue "" %></p>
&nbsp; Customer : <%= @customer.name rescue "" %>

View File

@@ -312,18 +312,20 @@
receipt_no = ($("#receipt_no").html()).trim();
}
payment_type = checkReceiptNoInFirstBillData(receipt_no,"payment")
console.log(payment_type)
payment_type = '';
if ($("#server_mode").val() != "cloud") { // first bill not used in cloud
payment_type = checkReceiptNoInFirstBillData(receipt_no,"payment")
if (member_id && member_discount) {
if(parseInt(jQuery.inArray("Credit", payment_type)) == -1){
$("#credit_payment").hide();
} else{
$("#credit_payment").show();
}
if(parseInt(jQuery.inArray("MPU", payment_type)) > 0 || parseInt(jQuery.inArray("VISA", payment_type)) > 0 || parseInt(jQuery.inArray("JCB", payment_type)) > 0 || parseInt(jQuery.inArray("Master", payment_type)) > 0 || parseInt(jQuery.inArray("UNIONPAY", payment_type)) > 0 || parseInt(jQuery.inArray("Redeem", payment_type)) > 0){
$("#card_payment").show();
if(parseInt(jQuery.inArray("MPU", payment_type)) !=-1 || parseInt(jQuery.inArray("VISA", payment_type)) !=-1 || parseInt(jQuery.inArray("JCB", payment_type)) !=-1 || parseInt(jQuery.inArray("Master", payment_type)) !=-1 || parseInt(jQuery.inArray("UNIONPAY", payment_type)) !=-1 || parseInt(jQuery.inArray("Redeem", payment_type)) !=-1){
$("#card_payment").show();
} else{
$("#card_payment").hide();
}
@@ -457,9 +459,9 @@
var credit = $('#credit').text();
var card = $('#card').text();
if (credit <= 0) {
calculate_member_discount(sale_id);
}
if (credit <= 0) {
calculate_member_discount(sale_id);
}
$.ajax({type: "POST",
url: "<%= origami_payment_cash_path %>",

View File

@@ -367,17 +367,21 @@
<!-- <button type="button" class="btn bg-blue btn-block" disabled>Add Order</button> -->
<button type="button" id="customer" class="btn bg-blue btn-block" >Customer</button>
<button type="button" class="btn bg-blue btn-block" id='edit'>Edit</button>
<button type="button" id="discount" class="btn bg-blue btn-block" >Discount</button>
<button type="button" id="discount" class="btn bg-blue btn-block" active="<%= can? :index, :discount %>" >Discount</button>
<button type="button" id="other-charges" class="btn bg-blue btn-block" >Charges</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" 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> -->
<!-- first bill not used in cloud -->
<% if ENV["SERVER_MODE"] != "cloud" %>
<button type="button" id="first_bill" class="btn btn-block bg-blue waves-effect">First Bill</button>
<% end %>
<% if ENV["SERVER_MODE"] == "cloud" %>
<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%>
<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 %>
@@ -393,6 +397,7 @@
<div class="modal-body">
<select class="form-control show-tick payment_method" multiple="true" id="payment_method" >
<option value="Cash">Cash</option>
<option value="Credit">Credit</option>
<% @payment_methods.each do |pay| %>
<option value="<%= pay.payment_method %>">
<%= pay.payment_method %>
@@ -535,25 +540,29 @@ $(document).ready(function(){
return false;
});
// Discount for Payment
$('#discount').click(function() {
var sale = $('#sale_id').val();
if (sale!="") {
var sale_id = sale
$('#discount').click(function () {
if ($(this).attr('active')=== "true") {
var sale = $('#sale_id').val();
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 + '/discount'
}
else {
swal ( "Oops" , "Please select an table!" , "warning" );
}
}else{
var sale_id = $('#save_order_id').attr('data-order');
swal("Opps","You are not authorized for Discount","warning")
}
if(sale_id!=""){
window.location.href = '/origami/' + sale_id + '/discount'
}
else {
swal ( "Oops" , "Please select an table!" , "warning" );
}
return false;
});
// Discount for Payment
// Add Other Charges
$('#other-charges').click(function() {
@@ -595,11 +604,17 @@ $("#first_bill").on('click', function(){
$(".choose_payment").on('click', function () {
$( "#loading_wrapper").show();
var sale_id = $('#sale_id').val();
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) {
calculate_member_discount(sale_id,"Card");
calculate_member_discount(sale_id,type);
}else{
calculate_member_discount(sale_id,"Cash");
}
}
var ajax_url = "/origami/sale/" + sale_id + "/first_bill";
$.ajax({
type: "GET",
@@ -609,7 +624,6 @@ $(".choose_payment").on('click', function () {
receipt_no = ($("#receipt_no").html()).trim();
if((receipt_no!=undefined) && (receipt_no!=""))
createReceiptNoInFirstBillData(receipt_no,type);
location.reload();
}
});

View File

@@ -11,7 +11,7 @@
<%= f.input :unique_code %>
<%= f.input :template %>
<%= f.input :font %>
<%= f.input :printer_name %>
<%= f.input :printer_name, :as => :select, :collection => Printer::PrinterWorker.printers, include_blank: false %>
<%= f.input :api_settings %>
<%= f.input :page_width %>
<%= f.input :page_height %>

View File

@@ -12,7 +12,7 @@
<%= f.input :auto_print_receipt %>
<%= f.label "Select Zones", :class => 'control-label' %>
<%= f.collection_check_boxes :zone_ids , Zone.all, :id, :name , :class => 'checkbox form-group'%>
<%= f.input :printer_name %>
<%= f.input :printer_name, :as => :select, :collection => Printer::PrinterWorker.printers, include_blank: false %>
<%= f.input :font %>
<%= f.input :font_size %>
<%= f.input :show_tax %>

View File

@@ -16,7 +16,7 @@ div.form-inputs span{
<%= f.input :station_name %>
<%= f.input :is_active %>
<%= f.input :printer_name %>
<%= f.input :printer_name, :as => :select, :collection => Printer::PrinterWorker.printers, include_blank: false %>
<!-- <%= f.input :font_size %> -->
<%= f.input :print_copy %>
<%= f.hidden_field :processing_items %>