Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant
This commit is contained in:
@@ -28,10 +28,9 @@ class Origami::CustomersController < BaseOrigamiController
|
|||||||
@crm_customers = Kaminari.paginate_array(@crm_customers).page(params[:page]).per(50)
|
@crm_customers = Kaminari.paginate_array(@crm_customers).page(params[:page]).per(50)
|
||||||
@crm_customer = Customer.new
|
@crm_customer = Customer.new
|
||||||
|
|
||||||
if flash["errors"]
|
# if flash["errors"]
|
||||||
@crm_customer.valid?
|
# @crm_customer.valid?
|
||||||
end
|
# end
|
||||||
|
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
# format.html { render :template => "crm/customers/index" }
|
# format.html { render :template => "crm/customers/index" }
|
||||||
|
|||||||
@@ -104,7 +104,19 @@ class Transactions::SalesController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def manual_void_sale
|
def manual_void_sale
|
||||||
sale_id = params[:sale_id]
|
|
||||||
|
sale_id = params[:sale_id]
|
||||||
|
reason = params[:reason]
|
||||||
|
sale = Sale.find(sale_id)
|
||||||
|
sale.sales_status = 'void'
|
||||||
|
sale.remarks = reason
|
||||||
|
sale.void_by = current_user.id
|
||||||
|
if sale.save
|
||||||
|
sale =SaleAudit.record_audit_void(sale_id, current_user.id, current_user.id, reason)
|
||||||
|
end
|
||||||
|
respond_to do |format|
|
||||||
|
format.html { redirect_to transactions_sales_url, notice: 'Sale was successfully void.' }
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -44,6 +44,7 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
<% if @crm_customers.count > 0 %>
|
<% if @crm_customers.count > 0 %>
|
||||||
<% @crm_customers.each do |crm_customer| %>
|
<% @crm_customers.each do |crm_customer| %>
|
||||||
|
|
||||||
<tr class="customer_tr" data-ref="<%= crm_customer.customer_id %>">
|
<tr class="customer_tr" data-ref="<%= crm_customer.customer_id %>">
|
||||||
<td>
|
<td>
|
||||||
<input type="radio" style="width:20px;" name="checkbox" class="checkbox_check" ></td>
|
<input type="radio" style="width:20px;" name="checkbox" class="checkbox_check" ></td>
|
||||||
@@ -54,6 +55,7 @@
|
|||||||
<td><%= link_to 'Show', crm_customer_path(crm_customer) %></td>
|
<td><%= link_to 'Show', crm_customer_path(crm_customer) %></td>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
<%else%>
|
<%else%>
|
||||||
<tr><td colspan="5"><p style="text-align:center"><strong>There are no record for your search</strong></p></td></tr>
|
<tr><td colspan="5"><p style="text-align:center"><strong>There are no record for your search</strong></p></td></tr>
|
||||||
@@ -107,7 +109,6 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Select Member Group</label>
|
<label>Select Member Group</label>
|
||||||
<select class="selectpicker form-control col-md-12" name="member_group_id" >
|
<select class="selectpicker form-control col-md-12" name="member_group_id" >
|
||||||
<option>Select Member Group</option>
|
|
||||||
<% Lookup.where("lookup_type = ?", "member_group_type" ).each do |member| %>
|
<% Lookup.where("lookup_type = ?", "member_group_type" ).each do |member| %>
|
||||||
<option value="<%= member.value %>">
|
<option value="<%= member.value %>">
|
||||||
<%= member.name %></option>
|
<%= member.name %></option>
|
||||||
|
|||||||
@@ -45,6 +45,7 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
<% if @crm_customers.count > 0 %>
|
<% if @crm_customers.count > 0 %>
|
||||||
<% @crm_customers.each do |crm_customer| %>
|
<% @crm_customers.each do |crm_customer| %>
|
||||||
|
|
||||||
<tr class="customer_tr" data-ref="<%= crm_customer.customer_id %>">
|
<tr class="customer_tr" data-ref="<%= crm_customer.customer_id %>">
|
||||||
<td>
|
<td>
|
||||||
<input type="radio" style="width:20px;" name="checkbox" class="checkbox_check" ></td>
|
<input type="radio" style="width:20px;" name="checkbox" class="checkbox_check" ></td>
|
||||||
@@ -55,6 +56,7 @@
|
|||||||
|
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
<%else%>
|
<%else%>
|
||||||
<tr><td colspan="5"><p style="text-align:center"><strong>There are no record for your search</strong></p></td></tr>
|
<tr><td colspan="5"><p style="text-align:center"><strong>There are no record for your search</strong></p></td></tr>
|
||||||
@@ -77,19 +79,29 @@
|
|||||||
<%= f.error_notification %>
|
<%= f.error_notification %>
|
||||||
<%= f.hidden_field :id, :class => "form-control col-md-6 " %>
|
<%= f.hidden_field :id, :class => "form-control col-md-6 " %>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
|
||||||
<%= f.input :name, :class => "form-control col-md-6 name" %>
|
<%= f.input :name, :class => "form-control col-md-6 name" %>
|
||||||
|
<% flash.each do |name, msg| %>
|
||||||
|
<span class="help-block"><%= msg['name'] %></span>
|
||||||
|
<% end -%>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<%= f.input :company, :class => "form-control col-md-6 company" %>
|
<%= f.input :company, :class => "form-control col-md-6 company" %>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
|
||||||
<%= f.input :contact_no, :class => "form-control col-md-6 contact_no" %>
|
<%= f.input :contact_no, :class => "form-control col-md-6 contact_no" %>
|
||||||
|
<% flash.each do |name, msg| %>
|
||||||
|
<span class="help-block"><%= msg['contact_no'] %></span>
|
||||||
|
<% end -%>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group <%= (flash["errors"]) ? "has-error" : "" %>">
|
||||||
<%= f.input :email, :class => "form-control col-md-6 email" %>
|
<%= f.input :email, :class => "form-control col-md-6 email" %>
|
||||||
|
|
||||||
|
<% flash.each do |name, msg| %>
|
||||||
|
<span class="help-block"><%= msg['email'] %></span>
|
||||||
|
<% end -%>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
@@ -100,7 +112,6 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Select Member Group</label>
|
<label>Select Member Group</label>
|
||||||
<select class="selectpicker form-control col-md-12" name="member_group_id">
|
<select class="selectpicker form-control col-md-12" name="member_group_id">
|
||||||
<option>Select Member Group</option>
|
|
||||||
<% Lookup.where("lookup_type = ?", "member_group_type" ).each do |member| %>
|
<% Lookup.where("lookup_type = ?", "member_group_type" ).each do |member| %>
|
||||||
<option value="<%= member.value %>">
|
<option value="<%= member.value %>">
|
||||||
<%= member.name %></option>
|
<%= member.name %></option>
|
||||||
@@ -127,9 +138,10 @@
|
|||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function() {
|
$(function() {
|
||||||
$('.datepicker').datepicker({
|
$('.datepicker').datepicker({
|
||||||
format : 'dd-mm-yyyy',
|
setDate: '12-12-1999',
|
||||||
autoclose: true
|
format : 'dd-mm-yyyy',
|
||||||
});
|
autoclose: true
|
||||||
|
});
|
||||||
$('.datepicker').attr('ReadOnly','true');
|
$('.datepicker').attr('ReadOnly','true');
|
||||||
$('.datepicker').css('cursor','pointer');
|
$('.datepicker').css('cursor','pointer');
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -237,12 +237,16 @@
|
|||||||
<!-- Waiter Buttons -->
|
<!-- Waiter Buttons -->
|
||||||
<button type="button" class="btn btn-primary btn-lg btn-block"> Foc </button>
|
<button type="button" class="btn btn-primary btn-lg btn-block"> Foc </button>
|
||||||
<button type="button" class="btn btn-primary btn-lg btn-block"> Void </button>
|
<button type="button" class="btn btn-primary btn-lg btn-block"> Void </button>
|
||||||
<button type="button" class="btn btn-primary btn-lg btn-block" onclick="window.location.href = '/origami';"> Back </button>
|
<button type="button" class="btn btn-primary btn-lg btn-block" onclick="localStorage.removeItem('cash');window.location.href = '/origami';"> Back </button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
|
if(localStorage.getItem("cash") == null || localStorage.getItem("cash") == 'null'){}
|
||||||
|
else {
|
||||||
|
$('#cash').text(localStorage.getItem("cash"));
|
||||||
|
}
|
||||||
update_balance();
|
update_balance();
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -301,6 +305,7 @@ $( document ).ready(function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$('#card_payment').click(function() {
|
$('#card_payment').click(function() {
|
||||||
|
localStorage.setItem("cash",$('#cash').text() );
|
||||||
var sale_id = $('#sale_id').text();
|
var sale_id = $('#sale_id').text();
|
||||||
window.location.href = '/origami/sale/'+ sale_id + "/payment/others_payment"
|
window.location.href = '/origami/sale/'+ sale_id + "/payment/others_payment"
|
||||||
return false;
|
return false;
|
||||||
@@ -315,10 +320,12 @@ $( document ).ready(function() {
|
|||||||
var credit = $('#credit').text();
|
var credit = $('#credit').text();
|
||||||
var card = $('#card').text();
|
var card = $('#card').text();
|
||||||
var sale_id = $('#sale_id').text();
|
var sale_id = $('#sale_id').text();
|
||||||
|
|
||||||
$.ajax({type: "POST",
|
$.ajax({type: "POST",
|
||||||
url: "<%= origami_payment_cash_path %>",
|
url: "<%= origami_payment_cash_path %>",
|
||||||
data: "cash="+ cash + "&sale_id=" + sale_id,
|
data: "cash="+ cash + "&sale_id=" + sale_id,
|
||||||
success:function(result){
|
success:function(result){
|
||||||
|
localStorage.removeItem("cash");
|
||||||
if($('#balance').text() < 0){
|
if($('#balance').text() < 0){
|
||||||
alert("Changed amount " + $('#balance').text() * (-1) )
|
alert("Changed amount " + $('#balance').text() * (-1) )
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
@@ -51,7 +51,7 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td><%= @sale.receipt_date.strftime("%d-%M-%Y") %></td>
|
<td><%= @sale.receipt_date.strftime("%d-%M-%Y") %></td>
|
||||||
<td><%= @sale.receipt_no %></td>
|
<td><%= @sale.receipt_no %></td>
|
||||||
<td><%= @sale.cashier rescue '-' %></td>
|
<td><%= @sale.cashier_name rescue '-' %></td>
|
||||||
<td> <%= @sale.sale_status %> </td>
|
<td> <%= @sale.sale_status %> </td>
|
||||||
<td> <%= @sale.requested_at.strftime("%d-%m-%Y") %> </td>
|
<td> <%= @sale.requested_at.strftime("%d-%m-%Y") %> </td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -175,7 +175,7 @@
|
|||||||
|
|
||||||
<i class="fa fa-trash fa-lg"></i> Void Sale
|
<i class="fa fa-trash fa-lg"></i> Void Sale
|
||||||
</a>
|
</a>
|
||||||
<a href="<%= transactions_manual_void_sale_path(@sale)%>" style="margin-top: 10px " class="btn btn-primary pull-right btn-lg">
|
<a href="<%= %>" style="margin-top: 10px " class="btn btn-primary pull-right btn-lg">
|
||||||
<i class="fa fa-invoice fa-lg"></i> Complete Sale
|
<i class="fa fa-invoice fa-lg"></i> Complete Sale
|
||||||
</a> -->
|
</a> -->
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,89 +0,0 @@
|
|||||||
<p id="notice"><%= notice %></p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<strong>Cashier:</strong>
|
|
||||||
<%= @transactions_sale.cashier %>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<strong>Cashier name:</strong>
|
|
||||||
<%= @transactions_sale.cashier_name %>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<strong>Requested by:</strong>
|
|
||||||
<%= @transactions_sale.requested_by %>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<strong>Requested at:</strong>
|
|
||||||
<%= @transactions_sale.requested_at %>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<strong>Receipt no:</strong>
|
|
||||||
<%= @transactions_sale.receipt_no %>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<strong>Receipt date:</strong>
|
|
||||||
<%= @transactions_sale.receipt_date %>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<strong>Customer:</strong>
|
|
||||||
<%= @transactions_sale.customer %>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<strong>Payment status:</strong>
|
|
||||||
<%= @transactions_sale.payment_status %>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<strong>Sale status:</strong>
|
|
||||||
<%= @transactions_sale.sale_status %>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<strong>Total amount:</strong>
|
|
||||||
<%= @transactions_sale.total_amount %>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<strong>Total discount:</strong>
|
|
||||||
<%= @transactions_sale.total_discount %>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<strong>Total tax:</strong>
|
|
||||||
<%= @transactions_sale.total_tax %>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<strong>Tax type:</strong>
|
|
||||||
<%= @transactions_sale.tax_type %>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<strong>Grand total:</strong>
|
|
||||||
<%= @transactions_sale.grand_total %>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<strong>Rounding adjustment:</strong>
|
|
||||||
<%= @transactions_sale.rounding_adjustment %>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<strong>Amount received:</strong>
|
|
||||||
<%= @transactions_sale.amount_received %>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<strong>Amount changed:</strong>
|
|
||||||
<%= @transactions_sale.amount_changed %>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<%= link_to 'Edit', edit_transactions_sale_path(@transactions_sale) %> |
|
|
||||||
<%= link_to 'Back', transactions_sales_path %>
|
|
||||||
@@ -15,12 +15,16 @@
|
|||||||
|
|
||||||
<div class="col-lg-10 col-md-10 col-sm-10">
|
<div class="col-lg-10 col-md-10 col-sm-10">
|
||||||
<div class="tab-pane active" id="queue" role="tabpanel" style="min-height:670px; max-height:670px; overflow-y:">
|
<div class="tab-pane active" id="queue" role="tabpanel" style="min-height:670px; max-height:670px; overflow-y:">
|
||||||
<h3>Choose your reason</h3>
|
<h3>Choose Reason For Void</h3>
|
||||||
<table>
|
<br>
|
||||||
|
<p class="hidden sale-id"><%= @sale %></p>
|
||||||
|
<table class="table table-striped">
|
||||||
<% @reason.each do |r| %>
|
<% @reason.each do |r| %>
|
||||||
<tr>
|
<tr class="customer_tr">
|
||||||
|
<td></td>
|
||||||
<td>
|
<td>
|
||||||
<%= check_box_tag "reason", "#{r.name}" rescue '-' %>
|
<input type="radio" style="width:20px;" name="reason" value="<%=r.name%>" class="checkbox_check" >
|
||||||
|
<!-- <%= check_box_tag "reason", "#{r.name}",:class => 'checkbox_check' rescue '-' %> -->
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td><%= label_tag "reasons[#{r.id}]", r.name, :style=>'font-weight:bold;font-size:18px;' rescue '-' %></td>
|
<td><%= label_tag "reasons[#{r.id}]", r.name, :style=>'font-weight:bold;font-size:18px;' rescue '-' %></td>
|
||||||
@@ -29,10 +33,13 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-2 col-md-2 col-sm-2">
|
<div class="col-lg-2 col-md-2 col-sm-2">
|
||||||
<a href="<%= transactions_sale_path(@sale)%>" style="margin-top: 10px " class="btn btn-primary pull-right btn-lg"><i class="fa fa-arrow-left fa-lg"></i> Back
|
<br><br><br>
|
||||||
|
<a href="<%= transactions_sale_path(@sale)%>" style="margin-top: 10px " class="btn btn-primary pull-right btn-lg"><i class="fa fa-arrow-left fa-lg"></i> Cancel
|
||||||
</a>
|
</a>
|
||||||
</div>
|
<button type="button" style="margin-top: 10px " class="btn btn-danger pull-right btn-lg" id="void" disabled><i class="fa fa-trash fa-lg"></i> Void
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<style>
|
<style>
|
||||||
@@ -42,6 +49,35 @@
|
|||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(function() {
|
||||||
|
$(document).on('click',".customer_tr",function(){
|
||||||
|
$(this).closest('tr').find('.checkbox_check').prop( "checked", true );
|
||||||
|
$('#void').removeAttr('disabled')
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#void").click(function() {
|
||||||
|
|
||||||
|
var reason = $('input[type="radio"]:checked').val();
|
||||||
|
console.log(reason)
|
||||||
|
|
||||||
|
var url = '<% transactions_manual_void_sale_path()%>';
|
||||||
|
var sale_id = $(this).find(".customer-id").text();
|
||||||
|
$.ajax({
|
||||||
|
type: 'POST',
|
||||||
|
url: 'sales/manual_void_sale',
|
||||||
|
data: {reason: reason, sale_id: sale_id},
|
||||||
|
success: function(data){
|
||||||
|
window.location.href = "transactions/sales"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
9
config/puma.rb.production
Normal file
9
config/puma.rb.production
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
application_path = '/home/superuser/Application/production/sxrestaurant'
|
||||||
|
directory application_path
|
||||||
|
environment 'production'
|
||||||
|
daemonize true
|
||||||
|
pidfile "#{application_path}/tmp/pids/puma.pid"
|
||||||
|
state_path "#{application_path}/tmp/pids/puma.state"
|
||||||
|
stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log"
|
||||||
|
bind 'tcp://0.0.0.0:9292'
|
||||||
|
workers 2
|
||||||
Reference in New Issue
Block a user