Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant
This commit is contained in:
1
.code2lab.env
Normal file
1
.code2lab.env
Normal file
@@ -0,0 +1 @@
|
|||||||
|
RAILS_ENV=production
|
||||||
2
.dockerignore
Normal file
2
.dockerignore
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
.git
|
||||||
|
.dockerignore
|
||||||
12
Dockerfile
Normal file
12
Dockerfile
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
FROM ruby:2.4.1
|
||||||
|
RUN apt-get update -qq && apt-get install -y build-essential libmysqlclient-dev libcups2-dev libpq-dev nodejs
|
||||||
|
RUN mkdir /sxrestaurant
|
||||||
|
RUN mkdir -p /sxrestaurant/tmp/puma
|
||||||
|
ENV RAILS_ENV production
|
||||||
|
WORKDIR /sxrestaurant
|
||||||
|
COPY Gemfile /sxrestaurant/Gemfile
|
||||||
|
COPY Gemfile.lock /sxrestaurant/Gemfile.lock
|
||||||
|
RUN bundle install --without development test
|
||||||
|
RUN bundle exec rails assets:precompile
|
||||||
|
COPY . /sxrestaurant
|
||||||
|
|
||||||
@@ -2,7 +2,7 @@ class Api::OrderReserve::OrderReservationController < Api::ApiController
|
|||||||
# skip_before_action :authenticate
|
# skip_before_action :authenticate
|
||||||
ORDER = "order"
|
ORDER = "order"
|
||||||
RESERVATION = "reservation"
|
RESERVATION = "reservation"
|
||||||
ORDER_RESERVATION = "order and reservation"
|
ORDER_RESERVATION = "order_and_reservation"
|
||||||
|
|
||||||
def check_customer
|
def check_customer
|
||||||
customer_id = 0
|
customer_id = 0
|
||||||
@@ -42,6 +42,8 @@ class Api::OrderReserve::OrderReservationController < Api::ApiController
|
|||||||
else
|
else
|
||||||
status = true
|
status = true
|
||||||
end
|
end
|
||||||
|
elsif !params[:callback_url]
|
||||||
|
render :json => { :status => false, :message => "callback_url is required!" }
|
||||||
end
|
end
|
||||||
|
|
||||||
if status == true
|
if status == true
|
||||||
|
|||||||
@@ -71,8 +71,10 @@ class Origami::MovetableController < BaseOrigamiController
|
|||||||
|
|
||||||
booking.booking_orders.each do |booking_order|
|
booking.booking_orders.each do |booking_order|
|
||||||
order = Order.find(booking_order.order_id)
|
order = Order.find(booking_order.order_id)
|
||||||
order.order_items.each do |order_item|
|
if order.status == 'new'
|
||||||
order_items.push(order_item)
|
order.order_items.each do |order_item|
|
||||||
|
order_items.push(order_item)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -360,7 +360,7 @@ class Customer < ApplicationRecord
|
|||||||
customer.contact_no = params[:contact_no]
|
customer.contact_no = params[:contact_no]
|
||||||
customer.gender = params[:gender]
|
customer.gender = params[:gender]
|
||||||
customer.address = params[:address]
|
customer.address = params[:address]
|
||||||
customer.date_of_birth = Time.parse(params[:date_of_birth]).strftime("%Y-%m-%d")
|
customer.date_of_birth = params[:date_of_birth] ? Time.parse(params[:date_of_birth]).strftime("%Y-%m-%d") : ''
|
||||||
customer.membership_id = params[:membership_id]
|
customer.membership_id = params[:membership_id]
|
||||||
customer.customer_type = "Takeaway"
|
customer.customer_type = "Takeaway"
|
||||||
customer.tax_profiles = ["2"]
|
customer.tax_profiles = ["2"]
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ class OrderReservation < ApplicationRecord
|
|||||||
order_reservation.customer_id = params[:cus_info]
|
order_reservation.customer_id = params[:cus_info]
|
||||||
order_reservation.requested_time = Time.parse(params[:requested_time]).utc.strftime("%Y-%m-%d %H:%M:%S")
|
order_reservation.requested_time = Time.parse(params[:requested_time]).utc.strftime("%Y-%m-%d %H:%M:%S")
|
||||||
if params[:order_info]
|
if params[:order_info]
|
||||||
|
order_reservation.callback_url = params[:order_info][:callback_url]
|
||||||
order_reservation.item_count = params[:order_info][:items].count
|
order_reservation.item_count = params[:order_info][:items].count
|
||||||
order_reservation.payment_type = params[:payment_info][:payment_type]
|
order_reservation.payment_type = params[:payment_info][:payment_type]
|
||||||
order_reservation.payment_status = params[:payment_info][:payment_status]
|
order_reservation.payment_status = params[:payment_info][:payment_status]
|
||||||
@@ -21,7 +22,7 @@ class OrderReservation < ApplicationRecord
|
|||||||
order_reservation.total_tax = params[:payment_info][:total_tax]
|
order_reservation.total_tax = params[:payment_info][:total_tax]
|
||||||
order_reservation.discount_amount = params[:payment_info][:discount_amount]
|
order_reservation.discount_amount = params[:payment_info][:discount_amount]
|
||||||
order_reservation.grand_total = params[:payment_info][:grand_total]
|
order_reservation.grand_total = params[:payment_info][:grand_total]
|
||||||
order_reservation.order_remark = params[:payment_info][:order_remark]
|
order_reservation.order_remark = params[:order_info][:order_remark]
|
||||||
end
|
end
|
||||||
if params[:reservation_info]
|
if params[:reservation_info]
|
||||||
order_reservation.total_customer = params[:reservation_info][:total_user]
|
order_reservation.total_customer = params[:reservation_info][:total_user]
|
||||||
|
|||||||
@@ -1133,15 +1133,39 @@ var customer_name = "<%= @customer.name %>";
|
|||||||
$(".btn_qr_code").on('click', function(e){
|
$(".btn_qr_code").on('click', function(e){
|
||||||
$("#is_memberModal").hide();
|
$("#is_memberModal").hide();
|
||||||
var code = "";
|
var code = "";
|
||||||
|
var customer_id = '';
|
||||||
|
var customer_name = '';
|
||||||
|
var membership_id = '';
|
||||||
|
var membership_type = '';
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
code=getQRCode();
|
code=getQRCode();
|
||||||
$("#qr_code").val(code);
|
if(sale_id != 0 && code != ""){
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: "/origami/"+sale_id+"/get_customer" ,
|
||||||
|
data: { filter : code ,type :"card"},
|
||||||
|
dataType: "json",
|
||||||
|
success: function(data) {
|
||||||
|
if (data[0].customer_id == false) {
|
||||||
|
swal("Alert!", data[0].message, "error");
|
||||||
|
}else{
|
||||||
|
customer_id = data[0].customer_id;
|
||||||
|
customer_name = data[0].name;
|
||||||
|
membership_id = data[0].membership_id;
|
||||||
|
membership_type = data[0].membership_type;
|
||||||
|
update_sale(membership_id, customer_id, customer_name,sale_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
},100);
|
},100);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Read qrcode from java
|
// Read qrcode from java
|
||||||
function getQRCode(){
|
function getQRCode(){
|
||||||
return code2lab.readQRCode();
|
return code2lab.readQRCode();
|
||||||
|
$("#qr_code").val(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
function update_sale(membership_id, customer_id, customer_name, sale_id) {
|
function update_sale(membership_id, customer_id, customer_name, sale_id) {
|
||||||
|
|||||||
@@ -107,7 +107,7 @@
|
|||||||
<%end%>
|
<%end%>
|
||||||
|
|
||||||
<td><%= number_with_precision(result.grand_total, precision: precision.to_i ,delimiter: delimiter) %></td>
|
<td><%= number_with_precision(result.grand_total, precision: precision.to_i ,delimiter: delimiter) %></td>
|
||||||
<td><%= number_with_precision(result.rounding_adjustment.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
<td><%= result.rounding_adjustment.to_f rescue '-' %></td>
|
||||||
<td><%= number_with_precision(result.grand_total_after_rounding(), precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
<td><%= number_with_precision(result.grand_total_after_rounding(), precision: precision.to_i ,delimiter: delimiter) rescue '-' %></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
@@ -120,7 +120,7 @@
|
|||||||
<td><b><%= number_with_precision(tax.st_amount, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
|
<td><b><%= number_with_precision(tax.st_amount, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
|
||||||
<% end %>
|
<% end %>
|
||||||
<td><b><%= number_with_precision(grand_total.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
|
<td><b><%= number_with_precision(grand_total.to_f, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
|
||||||
<td><b><%= number_with_precision(rounding_adj, precision: precision.to_i ,delimiter: delimiter) rescue '-' %></b></td>
|
<td><b><%= rounding_adj.to_f rescue '-' %></b></td>
|
||||||
<td><b><%= number_with_precision(grand_total.to_f.round + rounding_adj, precision: precision.to_i ,delimiter: delimiter) %></b></td>
|
<td><b><%= number_with_precision(grand_total.to_f.round + rounding_adj, precision: precision.to_i ,delimiter: delimiter) %></b></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ require_relative 'boot'
|
|||||||
require 'csv'
|
require 'csv'
|
||||||
require 'rails/all'
|
require 'rails/all'
|
||||||
# require 'iconv'
|
# require 'iconv'
|
||||||
|
require 'openssl'
|
||||||
|
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
|
||||||
|
|
||||||
# Require the gems listed in Gemfile, including any gems
|
# Require the gems listed in Gemfile, including any gems
|
||||||
# you've limited to :test, :development, or :production.
|
# you've limited to :test, :development, or :production.
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
application_path = '/home/superuser/Application/sxrestaurant'
|
application_path="#{File.expand_path("../..", __FILE__)}"
|
||||||
directory application_path
|
directory application_path
|
||||||
environment ENV.fetch("RAILS_ENV") { "production" }
|
#environment ENV.fetch("RAILS_ENV") { "production" }
|
||||||
|
environment "production"
|
||||||
pidfile "#{application_path}/tmp/puma/pid"
|
pidfile "#{application_path}/tmp/puma/pid"
|
||||||
state_path "#{application_path}/tmp/puma/state"
|
state_path "#{application_path}/tmp/puma/state"
|
||||||
stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log"
|
stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log"
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class CreateShiftSales < ActiveRecord::Migration[5.1]
|
|||||||
t.integer :dining_count, :default => 0
|
t.integer :dining_count, :default => 0
|
||||||
t.integer :takeaway_count, :default => 0
|
t.integer :takeaway_count, :default => 0
|
||||||
t.integer :member_count, :default => 0
|
t.integer :member_count, :default => 0
|
||||||
t.integer :total_rounding, :default => 0
|
t.decimal :total_rounding,, :precision => 10, :scale => 2, :null => false, :default => 0.00
|
||||||
t.integer :total_receipt, :default => 0
|
t.integer :total_receipt, :default => 0
|
||||||
t.decimal :total_void, :default => 0
|
t.decimal :total_void, :default => 0
|
||||||
t.timestamps
|
t.timestamps
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ class CreateOrderReservations < ActiveRecord::Migration[5.1]
|
|||||||
t.string :order_reservation_type, :null => false
|
t.string :order_reservation_type, :null => false
|
||||||
t.string :customer_id, :null => false
|
t.string :customer_id, :null => false
|
||||||
t.datetime :requested_time, :null => false
|
t.datetime :requested_time, :null => false
|
||||||
|
t.string :callback_url, :null => false
|
||||||
t.integer :item_count, :null => false, :default => 0
|
t.integer :item_count, :null => false, :default => 0
|
||||||
t.integer :total_customer
|
t.integer :total_customer
|
||||||
t.string :payment_type
|
t.string :payment_type
|
||||||
|
|||||||
31
docker-compose.yml
Normal file
31
docker-compose.yml
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
version: '3'
|
||||||
|
services:
|
||||||
|
code2lab:
|
||||||
|
build: .
|
||||||
|
links:
|
||||||
|
- redis
|
||||||
|
command: bundle exec puma -C config/puma.rb
|
||||||
|
volumes:
|
||||||
|
- .:/sxrestaurant
|
||||||
|
env_file:
|
||||||
|
- .code2lab.env
|
||||||
|
ports:
|
||||||
|
- '8081:62158'
|
||||||
|
environment:
|
||||||
|
- REDIS_URL=redis://redis:6379/0
|
||||||
|
sidekiq:
|
||||||
|
build: .
|
||||||
|
command: bundle exec sidekiq -C config/sidekiq.yml
|
||||||
|
links:
|
||||||
|
- redis
|
||||||
|
volumes:
|
||||||
|
- .:/sxrestaurant
|
||||||
|
environment:
|
||||||
|
- REDIS_URL=redis://redis:6379/0
|
||||||
|
|
||||||
|
redis:
|
||||||
|
image: redis
|
||||||
|
ports:
|
||||||
|
- '6379:6379'
|
||||||
|
volumes:
|
||||||
|
- ../data/redis:/data
|
||||||
Reference in New Issue
Block a user