merge with master

This commit is contained in:
Yan
2017-06-12 18:24:57 +06:30
45 changed files with 1177 additions and 265 deletions

View File

@@ -12,7 +12,7 @@ gem 'rails', '~> 5.1.0'
gem 'mysql2', '>= 0.3.18', '< 0.5' gem 'mysql2', '>= 0.3.18', '< 0.5'
#Use PosgreSQL #Use PosgreSQL
gem 'pg' # gem 'pg'
# redis server for cable # redis server for cable
# gem 'redis', '~> 3.0' # gem 'redis', '~> 3.0'

View File

@@ -110,7 +110,6 @@ GEM
nokogiri (1.7.2) nokogiri (1.7.2)
mini_portile2 (~> 2.1.0) mini_portile2 (~> 2.1.0)
pdf-core (0.7.0) pdf-core (0.7.0)
pg (0.20.0)
prawn (2.2.2) prawn (2.2.2)
pdf-core (~> 0.7.0) pdf-core (~> 0.7.0)
ttfunk (~> 1.5) ttfunk (~> 1.5)
@@ -247,7 +246,6 @@ DEPENDENCIES
kaminari (~> 0.16.3) kaminari (~> 0.16.3)
listen (~> 3.0.5) listen (~> 3.0.5)
mysql2 (>= 0.3.18, < 0.5) mysql2 (>= 0.3.18, < 0.5)
pg
prawn prawn
prawn-table prawn-table
puma (~> 3.0) puma (~> 3.0)

View File

@@ -37,11 +37,8 @@ $(document).ready(function(){
control_button(order_status); control_button(order_status);
//for customer button //for customer button
if(unique_id.charAt(0) == 'S'){
$("#customer").removeAttr('disabled'); $("#customer").removeAttr('disabled');
}else{
$("#customer").attr('disabled','disabled');
}
var customer_id=$(this).find(".customer-id").text(); var customer_id=$(this).find(".customer-id").text();
show_customer_details(customer_id); show_customer_details(customer_id);
@@ -178,26 +175,44 @@ $(document).ready(function(){
}); });
$('#customer').click(function() { $('#customer').click(function() {
var sale_id=$(".selected-item").find(".orders-id").text(); var sale = $(".selected-item").find(".orders-id").text();
if (sale.substring(0, 3)=="SAL") {
var sale_id = sale
}else{
var sale_id = $(".selected-item").find(".order-cid").text();
}
window.location.href = '/origami/'+ sale_id + "/add_customer" window.location.href = '/origami/'+ sale_id + "/add_customer"
return false; return false;
}); });
function show_customer_details(customer_id){ function show_customer_details(customer_id){
$('.customer_detail').removeClass('hide'); $('.customer_detail').removeClass('hide');
//Start Ajax //Start Ajax
$.ajax({ $.ajax({
type: "GET", type: "GET",
url: "origami/"+customer_id+"/get_customer/", url: "origami/"+customer_id+"/get_customer/",
data: {}, data: {},
dataType: "json", dataType: "json",
success: function(data) { success: function(data) {
$("#customer_name").text(data.name); $("#customer_name").text(data["customer"].name);
$("#customer_name").text(data.name); $.each(data["response_data"]["data"], function (i) {
} if(data["response_data"]["data"][i]["accountable_type"] == "RebateAccount"){
}); var balance = data["response_data"]["data"][i]["balance"];
//End Ajax console.log(balance);
if (balance) {
$("#customer_amount").text(balance);
}else{
$("#customer_amount").text('00');
}
}
});
}
});
//End Ajax
} }
/* For Receipt - Calculate discount or tax */ /* For Receipt - Calculate discount or tax */

View File

@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/

View File

@@ -0,0 +1,3 @@
// Place all the styles related to the settings/orders controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/

View File

@@ -14,9 +14,9 @@ class Crm::CustomersController < BaseCrmController
end end
#@crm_customers = Customer.all #@crm_customers = Customer.all
@crm_customer = Customer.new @crm_customer = Customer.new
@crm_customer.valid? if @crm_customer.valid?
@crm_customer.errors.messages
end
# @membership = Customer.get_member_group # @membership = Customer.get_member_group
# if @membership["status"] == true # if @membership["status"] == true
# @member_group = @membership["data"] # @member_group = @membership["data"]
@@ -30,6 +30,15 @@ class Crm::CustomersController < BaseCrmController
# GET /crm/customers/1 # GET /crm/customers/1
# GET /crm/customers/1.json # GET /crm/customers/1.json
def show def show
@orders = Order.where("customer_id=?", params[:id])
if @orders
@order_items = []
@orders.each do |bo|
@order_items = @order_items + bo.order_items
end
end
end end
# GET /crm/customers/new # GET /crm/customers/new
@@ -45,7 +54,7 @@ class Crm::CustomersController < BaseCrmController
# POST /crm/customers # POST /crm/customers
# POST /crm/customers.json # POST /crm/customers.json
def create def create
@crm_customers = Customer.new(customer_params) @crm_customers = Customer.new(customer_params)
@@ -55,16 +64,16 @@ class Crm::CustomersController < BaseCrmController
phone = customer_params[:contact_no] phone = customer_params[:contact_no]
email = customer_params[:email] email = customer_params[:email]
date_of_birth = customer_params[:date_of_birth] date_of_birth = customer_params[:date_of_birth]
membership_id = params[:membership_id] member_group_id = params[:member_group_id]
membership = MembershipSetting.find_by_membership_type("paypar_url") membership = MembershipSetting.find_by_membership_type("paypar_url")
memberaction = MembershipAction.find_by_membership_type("create_membership_customer") memberaction = MembershipAction.find_by_membership_type("create_membership_customer")
app_token = membership.auth_token.to_s merchant_uid = memberaction.merchant_account_id.to_s
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
response = HTTParty.post(url, :body => { name: name,phone: phone,email: email, response = HTTParty.post(url, :body => { name: name,phone: phone,email: email,
date_of_birth: date_of_birth, date_of_birth: date_of_birth,
membership_id: membership_id}.to_json, member_group_id: member_group_id,merchant_uid:merchant_uid}.to_json,
:headers => { :headers => {
'Content-Type' => 'application/json', 'Content-Type' => 'application/json',
'Accept' => 'application/json' 'Accept' => 'application/json'
@@ -72,39 +81,37 @@ class Crm::CustomersController < BaseCrmController
) )
if response["status"] == true if response["status"] == true
customer = Customer.find(@crm_customers.customer_id) customer = Customer.find(@crm_customers.customer_id)
status = customer.update_attributes(membership_id: response["customer_datas"]["id"]) status = customer.update_attributes(membership_id: response["customer_datas"]["id"])
if params[:sale_id].nil? if params[:sale_id]
format.html { redirect_to '/origami/'+params[:sale_id]+'/add_customer', notice: 'Customer was successfully created.' }
format.html { redirect_to '/origami/'+params[:sale_id]+'/add_customer', notice: 'Customer was successfully created.' } else
else format.html { redirect_to crm_customers_path, notice: 'Customer was successfully created'}
format.html { redirect_to crm_customers_path, notice: 'Customer was successfully created.' } end
end
# format.json { render :index, status: :created, location: @crm_customers } # format.json { render :index, status: :created, location: @crm_customers }
else else
@crm_customers.destroy @crm_customers.destroy
if params[:sale_id].nil? if params[:sale_id]
format.html { redirect_to '/origami/'+params[:sale_id]+'/add_customer'} format.html { redirect_to '/origami/'+params[:sale_id]+'/add_customer'}
else else
format.html { redirect_to crm_customers_path, notice: response["message"] } format.html { redirect_to crm_customers_path, notice: response["message"] }
end end
end end
# format.json { render :index, status: :created, location: @crm_customers }
else else
if params[:sale_id].nil? if params[:sale_id]
format.html { redirect_to '/origami/'+params[:sale_id]+'/add_customer'} format.html { redirect_to '/origami/'+params[:sale_id]+'/add_customer'}
else else
format.html { redirect_to crm_customers_path} format.html { redirect_to crm_customers_path}
format.json { render json: @crm_customers.errors, status: :unprocessable_entity } format.json { render json: @crm_customers.errors, status: :unprocessable_entity }
end end
end end
end
end end
end
# PATCH/PUT /crm/customers/1 # PATCH/PUT /crm/customers/1
# PATCH/PUT /crm/customers/1.json # PATCH/PUT /crm/customers/1.json
@@ -118,15 +125,16 @@ class Crm::CustomersController < BaseCrmController
email = customer_params[:email] email = customer_params[:email]
date_of_birth = customer_params[:date_of_birth] date_of_birth = customer_params[:date_of_birth]
id = customer_params[:membership_id] id = customer_params[:membership_id]
member_group_id = params[:member_group_id]
membership = MembershipSetting.find_by_membership_type("paypar_url") membership = MembershipSetting.find_by_membership_type("paypar_url")
memberaction = MembershipAction.find_by_membership_type("update_membership_customer") memberaction = MembershipAction.find_by_membership_type("update_membership_customer")
app_token = membership.auth_token.to_s merchant_uid = memberaction.merchant_account_id.to_s
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
response = HTTParty.post(url, :body => { name: name,phone: phone,email: email, response = HTTParty.post(url, :body => { name: name,phone: phone,email: email,
date_of_birth: date_of_birth, date_of_birth: date_of_birth,
id: id}.to_json, id: id,member_group_id:member_group_id,merchant_uid:merchant_uid}.to_json,
:headers => { :headers => {
'Content-Type' => 'application/json', 'Content-Type' => 'application/json',
'Accept' => 'application/json' 'Accept' => 'application/json'
@@ -155,22 +163,6 @@ class Crm::CustomersController < BaseCrmController
end end
end end
# DELETE /crm/customers/1
# DELETE /crm/customers/1.json
def get_sale_id
@sale_id = params[:sale_id]
@crm_customers = Customer.all
@crm_customer = Customer.new
@membership = Customer.get_member_group
if @membership["status"] == true
@member_group = @membership["data"]
end
respond_to do |format|
format.html { render action: "index"}
format.json { render json: @crm_customers }
end
end
private private
# Use callbacks to share common setup or constraints between actions. # Use callbacks to share common setup or constraints between actions.
def set_crm_customer def set_crm_customer

View File

@@ -18,15 +18,20 @@ class Origami::CustomersController < BaseOrigamiController
filter = params[:filter] filter = params[:filter]
if filter.nil? if filter.nil?
@crm_customers = Customer.order("name").page(params[:page]) @crm_customers = Customer.order("name").page params[:page]
else else
@crm_customers = Customer.where("name LIKE ?", "%#{filter}%").order("name").page(params[:page]) @crm_customers = Customer.where("name LIKE ?", "%#{filter}%").order("name").page params[:page]
end end
# @crm_customers = Kaminari.paginate_array(@crm_customers).page(params[:page]).per(2)
@crm_customer = Customer.new @crm_customer = Customer.new
@membership = Customer.get_member_group # @membership = Customer.get_member_group
if @membership["status"] == true # if @membership["status"] == true
@member_group = @membership["data"] # @member_group = @membership["data"]
end # end
puts "Errrrrrrrrrrrrrrrrr"
puts @crm_customer.new_record?
respond_to do |format| respond_to do |format|
# format.html { render :template => "crm/customers/index" } # format.html { render :template => "crm/customers/index" }
format.html { render action: "index"} format.html { render action: "index"}

View File

@@ -49,20 +49,47 @@ class Origami::HomeController < BaseOrigamiController
def update_sale_by_customer def update_sale_by_customer
sale = Sale.find(params[:sale_id]) id = params[:sale_id][0,3]
status = sale.update_attributes(customer_id: params[:customer_id]) if(id == "SAL")
sale = Sale.find(params[:sale_id])
else
sale = Order.find(params[:sale_id])
end
if status == true status = sale.update_attributes(customer_id: params[:customer_id])
if status == true
render json: JSON.generate({:status => true}) render json: JSON.generate({:status => true})
else else
render json: JSON.generate({:status => false, :error_message => "Record not found"}) render json: JSON.generate({:status => false, :error_message => "Record not found"})
end end
end end
def get_customer def get_customer
@customer = Customer.find(params[:customer_id])
render :json => @customer.to_json @customer = Customer.find(params[:customer_id])
membership = MembershipSetting.find_by_membership_type("paypar_url")
memberaction = MembershipAction.find_by_membership_type("get_all_member_account")
merchant_uid = memberaction.merchant_account_id.to_s
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
response = HTTParty.get(url, :body => { membership_id: @customer.membership_id,merchant_uid:merchant_uid}.to_json,
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json'
}
)
respond_to do |format|
format.js do
render :json => {
:response_data => response.as_json,
:customer => @customer}
end
end
end end
end end

View File

@@ -16,7 +16,8 @@ class Origami::RedeemPaymentsController < BaseOrigamiController
if member_actions.gateway_url if member_actions.gateway_url
@campaign_type_id = member_actions.additional_parameter["campaign_type_id"] @campaign_type_id = member_actions.additional_parameter["campaign_type_id"]
url = membership_setting.gateway_url.to_s + member_actions.gateway_url.to_s url = membership_setting.gateway_url.to_s + member_actions.gateway_url.to_s
membership_data = SalePayment.get_paypar_account(url,membership_setting.auth_token,@membership_id,@campaign_type_id) merchant_uid= member_actions.merchant_account_id
membership_data = SalePayment.get_paypar_account(url,membership_setting.auth_token,@membership_id,@campaign_type_id,merchant_uid)
if membership_data["status"]==true if membership_data["status"]==true
@membership_rebate_balance=membership_data["balance"] @membership_rebate_balance=membership_data["balance"]
@out = true, @membership_rebate_balance,@membership_id @out = true, @membership_rebate_balance,@membership_id

View File

@@ -0,0 +1,32 @@
class Settings::OrdersController < ApplicationController
def index
filter = params[:filter]
if filter.nil?
orders = Order.order("order_id desc").limit(1000)
else
order = Order.where("order_id LIKE ?", "%#{filter}%").order("order_id desc").limit(1000).page(params[:page])
if order.count > 0
orders = order
else
orders = Order.order("order_id desc").limit(1000)
flash[:notice] = "There is no data."
end
end
@orders = Kaminari.paginate_array(orders).page(params[:page]).per(50)
respond_to do |format|
format.html # index.html.erb
format.json { render json: @orders }
end
end
def show
@order = Order.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @order }
end
end
end

View File

@@ -0,0 +1,42 @@
class Settings::SalesController < ApplicationController
def index
search_date = params[:date]
receipt_no = params[:receipt_no]
today = Date.today
if receipt_no.nil? && search_date.nil?
@sales = Sale.where("NOT sale_status = 'void'" ).order("sale_id desc").limit(500)
else
if !search_date.blank? && receipt_no.blank?
sale = Sale.where("DATE_FORMAT(receipt_date,'%Y-%b-%d') = ?", search_date).order("sale_id desc").limit(500).page(params[:page])
elsif !search_date.blank? && !receipt_no.blank?
sale = Sale.where("receipt_no LIKE ? or DATE_FORMAT(receipt_date,'%Y-%b-%d') = ?", "%#{receipt_no}%", search_date).order("sale_id desc").limit(500).page(params[:page])
else
sale = Sale.where("receipt_no LIKE ?", receipt_no).order("sale_id desc").limit(500).page(params[:page])
end
if sale.count > 0
@sales = sale
else
@sales = Sale.where("NOT sale_status = 'void'").order("sale_id desc").limit(500)
end
end
@sales = Kaminari.paginate_array(@sales).page(params[:page]).per(50)
respond_to do |format|
format.html # index.html.erb
format.json { render json: @sales }
end
end
def show
@sale = Sale.find(params[:id])
# @sale_receivables = SaleReceivable.where('sale_id = ?', @sale.id)
respond_to do |format|
format.html # show.html.erb
format.json { render json: @sale }
end
end
end

View File

@@ -0,0 +1,2 @@
module Settings::OrdersHelper
end

View File

@@ -14,9 +14,9 @@ class Customer < ApplicationRecord
def self.get_member_group def self.get_member_group
membership = MembershipSetting.find_by_membership_type("paypar_url") membership = MembershipSetting.find_by_membership_type("paypar_url")
memberaction = MembershipAction.find_by_membership_type("get_all_member_group") memberaction = MembershipAction.find_by_membership_type("get_all_member_group")
app_token = membership.auth_token.to_s app_token = membership.auth_token.to_s
url = membership.gateway_url.to_s + memberaction.gateway_url.to_s url = membership.gateway_url.to_s + memberaction.gateway_url.to_s
response = HTTParty.get(url, response = HTTParty.get(url,

View File

@@ -1,3 +1,2 @@
class DiningQueue < ApplicationRecord class DiningQueue < ApplicationRecord
end end

View File

@@ -17,6 +17,10 @@ class Lookup < ApplicationRecord
"Gateway Communication Type" => "gateway_communication_type"} "Gateway Communication Type" => "gateway_communication_type"}
end end
# def self.get_by_type( lookup_type)
# Lookup.select("value, name").where("lookup_type = ?", lookup_type ).order("name asc").map { |r| [r.name, r.value] }
# end
def self.collection_of(type) def self.collection_of(type)
Lookup.select("name, value").where("lookup_type" => type ).map { |l| [l.name, l.value] } Lookup.select("name, value").where("lookup_type" => type ).map { |l| [l.name, l.value] }

View File

@@ -33,10 +33,7 @@ class Order < ApplicationRecord
table.status = "occupied" table.status = "occupied"
table.save table.save
else else
puts "b" booking = Booking.find(self.booking_id)
booking = Booking.find(self.booking_id)
end end
booking.save! booking.save!
@@ -226,26 +223,28 @@ class Order < ApplicationRecord
#Origami: Cashier : to view booking order Table #Origami: Cashier : to view booking order Table
def self.get_booking_order_table def self.get_booking_order_table
booking_orders = Booking.select("sales.receipt_no,orders.status as order_status,orders.customer_id as customer_id, booking_orders = Booking.select("sales.receipt_no,orders.status as order_status,
orders.order_id as order_id,sales.customer_id as sale_customer_id,orders.customer_id as order_customer_id,
bookings.booking_id,sales.sale_id as sale_id,dining_facilities.name as table_name") bookings.booking_id,sales.sale_id as sale_id,dining_facilities.name as table_name")
.joins("left join booking_orders on booking_orders.booking_id = bookings.booking_id") .joins("left join booking_orders on booking_orders.booking_id = bookings.booking_id")
.joins("left join dining_facilities on dining_facilities.id = bookings.dining_facility_id") .joins("left join dining_facilities on dining_facilities.id = bookings.dining_facility_id")
.joins("left join orders on orders.order_id = booking_orders.order_id") .joins("left join orders on orders.order_id = booking_orders.order_id")
.joins("left join sales on sales.sale_id = bookings.sale_id") .joins("left join sales on sales.sale_id = bookings.sale_id")
.where("booking_orders.order_id IS NOT NULL and dining_facilities.type=? and dining_facilities.is_active=?",DiningFacility::TABLE_TYPE,true) .where("booking_orders.order_id IS NOT NULL and dining_facilities.type=? and dining_facilities.is_active=?",DiningFacility::TABLE_TYPE,true)
.group("bookings.booking_id,sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.status") .group("bookings.booking_id,sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.status,orders.order_id")
end end
#Origami: Cashier : to view booking order Table #Origami: Cashier : to view booking order Table
def self.get_completed_order def self.get_completed_order
completed_orders = Booking.select("sales.receipt_no,orders.status as order_status, completed_orders = Booking.select("sales.receipt_no,orders.status as order_status,orders.order_id,
bookings.booking_id,sales.sale_id as sale_id,dining_facilities.name as table_name") bookings.booking_id,sales.sale_id as sale_id,dining_facilities.name as table_name,sales.customer_id as sale_customer_id,orders.customer_id as order_customer_id")
.joins("left join booking_orders on booking_orders.booking_id = bookings.booking_id") .joins("left join booking_orders on booking_orders.booking_id = bookings.booking_id")
.joins("left join dining_facilities on dining_facilities.id = bookings.dining_facility_id") .joins("left join dining_facilities on dining_facilities.id = bookings.dining_facility_id")
.joins("left join orders on orders.order_id = booking_orders.order_id") .joins("left join orders on orders.order_id = booking_orders.order_id")
.joins("left join sales on sales.sale_id = bookings.sale_id") .joins("left join sales on sales.sale_id = bookings.sale_id")
.where("sales.sale_status='completed'") .where("sales.sale_status='completed'")
<<<<<<< HEAD
.group("bookings.booking_id,sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.status") .group("bookings.booking_id,sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.status")
end end
@@ -258,13 +257,14 @@ class Order < ApplicationRecord
.joins("left join orders on orders.order_id = booking_orders.order_id") .joins("left join orders on orders.order_id = booking_orders.order_id")
.joins("left join sales on sales.sale_id = bookings.sale_id") .joins("left join sales on sales.sale_id = bookings.sale_id")
.where("sales.sale_status<>'completed' and booking_orders.order_id IS NOT NULL and dining_facilities.type=? and dining_facilities.is_active=?",DiningFacility::TABLE_TYPE,true) .where("sales.sale_status<>'completed' and booking_orders.order_id IS NOT NULL and dining_facilities.type=? and dining_facilities.is_active=?",DiningFacility::TABLE_TYPE,true)
.group("bookings.booking_id,sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.status") .group("bookings.booking_id,sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.status,orders.customer_id,sales.customer_id,orders.order_id")
end end
#Origami: Cashier : to view order type Room #Origami: Cashier : to view order type Room
def self.get_booking_order_rooms def self.get_booking_order_rooms
booking_rooms = Booking.select("sales.receipt_no,orders.status as order_status,bookings.booking_id,orders.customer_id as customer_id, booking_rooms = Booking.select("sales.receipt_no,orders.status as order_status,
orders.order_id as order_id,sales.customer_id as sale_customer_id,orders.customer_id as order_customer_id,
bookings.booking_id,orders.customer_id as customer_id,
sales.sale_id as sale_id,dining_facilities.name as room_name") sales.sale_id as sale_id,dining_facilities.name as room_name")
.joins("left join booking_orders on booking_orders.booking_id = bookings.booking_id") .joins("left join booking_orders on booking_orders.booking_id = bookings.booking_id")
.joins("left join dining_facilities on dining_facilities.id = bookings.dining_facility_id") .joins("left join dining_facilities on dining_facilities.id = bookings.dining_facility_id")
@@ -273,7 +273,6 @@ class Order < ApplicationRecord
.joins("left join sales on sales.sale_id = sale_orders.sale_id") .joins("left join sales on sales.sale_id = sale_orders.sale_id")
.where("sales.sale_status<>'completed' and sales.sale_status<>'complete' and booking_orders.order_id IS NOT NULL and dining_facilities.type=? and dining_facilities.is_active=?",DiningFacility::ROOM_TYPE,true) .where("sales.sale_status<>'completed' and sales.sale_status<>'complete' and booking_orders.order_id IS NOT NULL and dining_facilities.type=? and dining_facilities.is_active=?",DiningFacility::ROOM_TYPE,true)
.group("bookings.booking_id,sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.customer_id") .group("bookings.booking_id,sales.receipt_no,orders.status,sales.sale_id,dining_facilities.name,orders.customer_id")
end end
#Origami: Cashier : to view order type Room #Origami: Cashier : to view order type Room
@@ -294,7 +293,8 @@ class Order < ApplicationRecord
from = Time.now.beginning_of_day.utc from = Time.now.beginning_of_day.utc
to = Time.now.end_of_day.utc to = Time.now.end_of_day.utc
orders = Order.select("orders.order_id as order_id,sales.receipt_no,orders.status as order_status, orders = Order.select("orders.order_id as order_id,sales.receipt_no,orders.status as order_status,
orders.customer_id as customer_id,bookings.booking_id,sales.sale_id as sale_id,dining_facilities.name as table_name") orders.order_id as order_id,sales.customer_id as sale_customer_id,orders.customer_id as order_customer_id
,bookings.booking_id,sales.sale_id as sale_id,dining_facilities.name as table_name")
.joins("left join booking_orders on booking_orders.order_id = orders.order_id .joins("left join booking_orders on booking_orders.order_id = orders.order_id
left join bookings on bookings.booking_id = booking_orders.order_id left join bookings on bookings.booking_id = booking_orders.order_id
left join dining_facilities on dining_facilities.id = bookings.dining_facility_id left join dining_facilities on dining_facilities.id = bookings.dining_facility_id

View File

@@ -12,7 +12,7 @@ class SaleItem < ApplicationRecord
def self.get_order_items_details(sale_id) def self.get_order_items_details(sale_id)
order_details = SaleItem.select("sales.total_tax as tax_amount, sales.grand_total as grand_total_amount , sales.total_discount as discount_amount,DATE_FORMAT(sales.receipt_date,'%Y-%m-%d %h:%m') as receipt_date, order_details = SaleItem.select("sales.total_tax as tax_amount, sales.grand_total as grand_total_amount , sales.total_discount as discount_amount,sales.receipt_date as receipt_date,
sales.cashier_name,sales.receipt_no,sale_items.product_name as item_name,sale_items.qty,sale_items.price,sale_items.unit_price as total_price") sales.cashier_name,sales.receipt_no,sale_items.product_name as item_name,sale_items.qty,sale_items.price,sale_items.unit_price as total_price")
.joins("left join sales on sales.sale_id = sale_items.sale_id") .joins("left join sales on sales.sale_id = sale_items.sale_id")
.where("sale_items.sale_id=?",sale_id) .where("sale_items.sale_id=?",sale_id)
@@ -36,6 +36,7 @@ class SaleItem < ApplicationRecord
sale_items.each do |si| sale_items.each do |si|
food_price, beverage_price = self.get_price(si.sale_item_id) food_price, beverage_price = self.get_price(si.sale_item_id)
food_prices = food_prices + food_price food_prices = food_prices + food_price
beverage_prices = beverage_prices + beverage_price beverage_prices = beverage_prices + beverage_price
end end

View File

@@ -66,9 +66,9 @@ class SalePayment < ApplicationRecord
end end
def self.get_paypar_account(url,token,membership_id,campaign_type_id) def self.get_paypar_account(url,token,membership_id,campaign_type_id,merchant_uid)
response = HTTParty.get(url, response = HTTParty.get(url,
:body => { app_token: token,membership_id:membership_id,campaign_type_id:campaign_type_id}.to_json, :body => { app_token: token,membership_id:membership_id,campaign_type_id:campaign_type_id,merchant_uid:merchant_uid}.to_json,
:headers => { :headers => {
'Content-Type' => 'application/json', 'Content-Type' => 'application/json',
'Accept' => 'application/json' 'Accept' => 'application/json'
@@ -82,9 +82,10 @@ class SalePayment < ApplicationRecord
membership_actions_data = MembershipAction.find_by_membership_type("redeem"); membership_actions_data = MembershipAction.find_by_membership_type("redeem");
if !membership_actions_data.nil? if !membership_actions_data.nil?
url = paypar_url.to_s + membership_actions_data.gateway_url.to_s url = paypar_url.to_s + membership_actions_data.gateway_url.to_s
campaign_type_id = membership_actions_data.additional_parameter["campaign_type_id"] merchant_uid = membership_actions_data.merchant_account_id
campaign_type_id = membership_actions_data.additional_parameter["campaign_type_id"]
response = HTTParty.post(url, response = HTTParty.post(url,
:body => { generic_customer_id:membership_id,total_amount:received_amount,receipet_no:sale_id,campaign_type_id:campaign_type_id,account_no:""}.to_json, :body => { generic_customer_id:membership_id,redeem_amount:received_amount,receipet_no:sale_id,campaign_type_id:campaign_type_id,account_no:"",merchant_uid:merchant_uid}.to_json,
:headers => { :headers => {
'Content-Type' => 'application/json', 'Content-Type' => 'application/json',
'Accept' => 'application/json' 'Accept' => 'application/json'
@@ -215,12 +216,23 @@ class SalePayment < ApplicationRecord
self.sale.payment_status = "paid" self.sale.payment_status = "paid"
self.sale.sale_status = "completed" self.sale.sale_status = "completed"
self.sale.save! self.sale.save!
#TODO: table status table_update_status(sObj)
rebat() rebat()
end end
end end
def table_update_status(sale_obj)
booking = Booking.find_by_sale_id(sale_obj.id)
if booking
table = DiningFacility.find(booking.dining_facility_id)
if table
table.status = "available"
table.save
end
end
end
def rebat def rebat
end end

View File

@@ -0,0 +1,9 @@
<div class="form-group">
<select class="selectpicker form-control col-md-12" name="membership_id">
<option>Select Member Group</option>
<% @member_group.each do |member| %>
<option value="<%= member["id"] %>">
<%= member["name"] %></option>
<%end %>
</select>
</div>

View File

@@ -51,7 +51,7 @@
<td><%= crm_customer.contact_no %></td> <td><%= crm_customer.contact_no %></td>
<td><%= crm_customer.email %></td> <td><%= crm_customer.email %></td>
<td> <td>
<%= link_to 'Destroy', crm_customer_path(crm_customer), method: :delete, data: { confirm: 'Are you sure?' } %> <%= link_to 'Show', crm_customer_path(crm_customer) %>
</td> </td>
@@ -71,7 +71,6 @@
<%= simple_form_for @crm_customer,:url => crm_customers_path, :method => :post do |f| %> <%= simple_form_for @crm_customer,:url => crm_customers_path, :method => :post do |f| %>
<span class="patch_method"></span> <span class="patch_method"></span>
<input type="hidden" id="sale_id" name="sale_id" value="<%= @sale_id %>" />
<%= 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 " %>
@@ -94,17 +93,20 @@
<div class="form-group"> <div class="form-group">
<label>Date Of Birth</label> <label>Date Of Birth</label>
<%= f.text_field :date_of_birth,:class=>"form-control date_of_birth datepicker"%> <%= f.text_field :date_of_birth,:class => "form-control datepicker date_of_birth "%>
</div> </div>
<div class="form-group">
<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| %>
<option value="<%= member.value %>">
<%= member.name %></option>
<%end %>
</select>
</div>
<!-- <div class="form-group">
<%= f.input :membership_type, :class => "form-control col-md-6 membership_type" %>
</div>
<div class="form-group">
<%= f.input :membership_authentication_code, :class => "form-control col-md-6 membership_authentication_code" %>
</div>
-->
<div class="form-group"> <div class="form-group">
<%= f.button :submit, "Submit",:class => 'btn btn-primary ', :id => 'submit_customer' %> <%= f.button :submit, "Submit",:class => 'btn btn-primary ', :id => 'submit_customer' %>
<%= f.button :submit, "Update",:class => 'btn btn-primary ', :disabled =>'', :id => 'update_customer' %> <%= f.button :submit, "Update",:class => 'btn btn-primary ', :disabled =>'', :id => 'update_customer' %>

View File

@@ -1,40 +1,84 @@
<p id="notice"><%= notice %></p> <div class="row">
<div class="col-lg-12">
<p> <ol class="breadcrumb">
<strong>Name:</strong> <li><a href="<%= crm_root_path %>">Home</a></li>
<%= @crm_customer.name %> <li class="active">
</p> <a href="<%= crm_customers_path %>">Customer</a>
</li>
<p> <li class="active">Details
<strong>Company:</strong> </li>
<%= @crm_customer.company %> </ol>
</p> </div>
</div>
<p>
<strong>Contact no:</strong>
<%= @crm_customer.contact_no %> <div class="row">
</p> <div class="col-lg-12">
<p> <div class="main-box-body clearfix">
<strong>Email:</strong> <div class="table-responsive">
<%= @crm_customer.email %> <hr>
</p> <table class="table table-striped">
<thead>
<p> <tr>
<strong>Date of birth:</strong> <th>Name</th>
<%= @crm_customer.date_of_birth %> <th>Email</th>
</p> <th>Contact no</th>
<th>Company</th>
<th>Date Of Birth</th>
</tr>
</thead>
<tbody>
<tr>
<td><%= @crm_customer.name %></td>
<td><%= @crm_customer.email %></td>
<td><%= @crm_customer.contact_no %></td>
<td><%= @crm_customer.company %></td>
<td><%= @crm_customer.date_of_birth %> </td>
</tr>
</tbody>
</table>
<br>
<h3>Order Details</h3>
<table class="table table-striped">
<thead>
<tr>
<th>Created at </th>
<th>Menu Item</th>
<th>QTY</th>
<th>Unit Price </th>
<th>Option</th>
<th>Status</th>
<th>Waiter</th>
</tr>
</thead>
<tbody>
<% @order_items.each do |order_item| %>
<tr>
<td><%= order_item.created_at %></td>
<td><%= order_item.item_name %></td>
<td><%= order_item.qty %></td>
<td><%= order_item.price %></td>
<td><%= order_item.options %></td>
<td><%= order_item.order_item_status %></td>
<td><%= order_item.item_order_by %> </td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<p>
<strong>Membership type:</strong>
<%= @crm_customer.membership_type %>
</p>
<p>
<strong>Membership authentication code:</strong>
<%= @crm_customer.membership_authentication_code %>
</p>
<%= link_to 'Edit', edit_crm_customer_path(@crm_customer) %> |
<%= link_to 'Back', crm_customers_path %>

View File

@@ -0,0 +1,11 @@
<%# Link to the "First" page
- available local variables
url: url to the first page
current_page: a page object for the currently displayed page
total_pages: total number of pages
per_page: number of items to fetch per page
remote: data-remote
-%>
<span class="first">
<%= link_to_unless current_page.first?, t('views.pagination.first').html_safe, url, :remote => remote %>
</span>

View File

@@ -0,0 +1,8 @@
<%# Non-link tag that stands for skipped pages...
- available local variables
current_page: a page object for the currently displayed page
total_pages: total number of pages
per_page: number of items to fetch per page
remote: data-remote
-%>
<span class="page gap"><%= t('views.pagination.truncate').html_safe %></span>

View File

@@ -0,0 +1,11 @@
<%# Link to the "Last" page
- available local variables
url: url to the last page
current_page: a page object for the currently displayed page
total_pages: total number of pages
per_page: number of items to fetch per page
remote: data-remote
-%>
<span class="last">
<%= link_to_unless current_page.last?, t('views.pagination.last').html_safe, url, :remote => remote %>
</span>

View File

@@ -0,0 +1,11 @@
<%# Link to the "Next" page
- available local variables
url: url to the next page
current_page: a page object for the currently displayed page
total_pages: total number of pages
per_page: number of items to fetch per page
remote: data-remote
-%>
<span class="next">
<%= link_to_unless current_page.last?, t('views.pagination.next').html_safe, url, :rel => 'next', :remote => remote %>
</span>

View File

@@ -0,0 +1,12 @@
<%# Link showing page number
- available local variables
page: a page object for "this" page
url: url to this page
current_page: a page object for the currently displayed page
total_pages: total number of pages
per_page: number of items to fetch per page
remote: data-remote
-%>
<span class="page<%= ' current' if page.current? %>">
<%= link_to_unless page.current?, page, url, {:remote => remote, :rel => page.next? ? 'next' : page.prev? ? 'prev' : nil} %>
</span>

View File

@@ -0,0 +1,23 @@
<%# The container tag
- available local variables
current_page: a page object for the currently displayed page
total_pages: total number of pages
per_page: number of items to fetch per page
remote: data-remote
paginator: the paginator that renders the pagination tags inside
-%>
<%= paginator.render do -%>
<nav class="pagination">
<%= first_page_tag unless current_page.first? %>
<%= prev_page_tag unless current_page.first? %>
<% each_page do |page| -%>
<% if page.left_outer? || page.right_outer? || page.inside_window? -%>
<%= page_tag page %>
<% elsif !page.was_truncated? -%>
<%= gap_tag %>
<% end -%>
<% end -%>
<%= next_page_tag unless current_page.last? %>
<%= last_page_tag unless current_page.last? %>
</nav>
<% end -%>

View File

@@ -0,0 +1,11 @@
<%# Link to the "Previous" page
- available local variables
url: url to the previous page
current_page: a page object for the currently displayed page
total_pages: total number of pages
per_page: number of items to fetch per page
remote: data-remote
-%>
<span class="prev">
<%= link_to_unless current_page.first?, t('views.pagination.previous').html_safe, url, :rel => 'prev', :remote => remote %>
</span>

View File

@@ -0,0 +1,233 @@
<div class="row">
<div class="col-lg-12">
<ol class="breadcrumb">
<li><a href="<%= crm_root_path %>">Home</a></li>
<li class="active">
<a href="<%= crm_customers_path %>">Customer</a>
</li>
<!-- <a href="<%= new_crm_customer_path%>" class="btn btn-primary pull-right">
<i class="fa fa-plus-circle fa-lg"></i> Add Customer
</a> -->
</ol>
</div>
</div>
<div class="row">
<div class="col-lg-8">
<div class="main-box-body clearfix">
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<td colspan="6">
<%= form_tag crm_customers_path, :method => :get do %>
<div class="input-append form-group pull-left">
<input type="text" name="filter" placeholder="Search" class="form-control input-sm col-md-8">
<button type="submit" class="btn btn-primary btn-sm">Search</button>
</div>
<% end %>
</td>
</tr>
<tr>
<th>Select</th>
<th>Name</th>
<th>Company</th>
<th>Contact no</th>
<th>Email</th>
</tr>
</thead>
<tbody>
<% @crm_customers.each do |crm_customer| %>
<tr>
<td>
<input type="radio" style="width:20px;" value="<%= crm_customer.customer_id %>" name="checkbox" class="checkbox_check" ></td>
<td><%= crm_customer.name %></td>
<td><%= crm_customer.company %></td>
<td><%= crm_customer.contact_no %></td>
<td><%= crm_customer.email %></td>
<td>
<%= link_to 'Destroy', crm_customer_path(crm_customer), method: :delete, data: { confirm: 'Are you sure?' } %>
</td>
</tr>
<% end %>
</tbody>
</table>
<br>
<%= paginate @crm_customers %>
</div>
</div>
</div>
<div class="col-lg-4">
<%= simple_form_for @crm_customer,:url => crm_customers_path, :method => :post do |f| %>
<span class="patch_method"></span>
<input type="hidden" id="sale_id" name="sale_id" value="<%= @sale_id %>" />
<%= f.error_notification %>
<%= f.hidden_field :id, :class => "form-control col-md-6 " %>
<div class="form-group">
<%= f.input :name, :class => "form-control col-md-6 name" %>
</div>
<div class="form-group">
<%= f.input :company, :class => "form-control col-md-6 company" %>
</div>
<div class="form-group">
<%= f.input :contact_no, :class => "form-control col-md-6 contact_no" %>
</div>
<div class="form-group">
<%= f.input :email, :class => "form-control col-md-6 email" %>
</div>
<div class="form-group">
<label>Date Of Birth</label>
<%= f.text_field :date_of_birth,:class=>"form-control date_of_birth datepicker"%>
</div>
<div class="form-group">
<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| %>
<option value="<%= member.value %>">
<%= member.name %></option>
<%end %>
</select>
</div>
<!-- <div class="form-group">
<%= f.input :membership_type, :class => "form-control col-md-6 membership_type" %>
</div>
<div class="form-group">
<%= f.input :membership_authentication_code, :class => "form-control col-md-6 membership_authentication_code" %>
</div> -->
<div class="form-group">
<%= f.button :submit, "Submit",:class => 'btn btn-primary ', :id => 'submit_customer' %>
<%= f.button :submit, "Update",:class => 'btn btn-primary ', :disabled =>'', :id => 'update_customer' %>
</div>
<%end%>
</div>
</div>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jquery-confirm/3.2.0/jquery-confirm.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-confirm/3.2.0/jquery-confirm.min.js"></script>
<script type="text/javascript">
$(function () {
if (jQuery().datepicker) {
$('.datepicker').datepicker({
format : 'dd-mm-yyyy',
autoclose: true
});
$('.datepicker').attr('ReadOnly','true');
$('.datepicker').css('cursor','pointer');
}
});
$(document).on('click',".checkbox_check",function(){
if(this.checked){
var sale_id = $("#sale_id").val() || 0;
var customer_id = $(this).val();
if(sale_id != 0){
// var url = "/"+customer_id;
update_sale(customer_id,sale_id);
}else{
var url = "customers/"+customer_id;
}
$.ajax({
type: "GET",
url: url,
data: {},
dataType: "json",
success: function(data) {
$('#customer_id').val(data.id);
$('#customer_name').val(data.name);
$('#customer_company').val(data.company);
$('#customer_contact_no').val(data.contact_no);
$('#customer_email').val(data.email);
$('#customer_date_of_birth').val(data.date_of_birth);
$('#customer_membership_type').val(data.membership_type);
$('.select > option[value="'+data.membership_id+'"]').attr('selected','selected');
$('.membership_authentication_code').val(data.membership_authentication_code);
$('#update_customer').removeAttr('disabled').val('');
$('#update_customer').attr('value', 'Update');
$('#submit_customer').attr('disabled','disabled');
$("#new_customer").attr('class', 'simple_form edit_customer');
var id = "edit_customer_"+$('#customer_id').val();
$("#new_customer").attr('id', id);
$(".edit_customer").attr('action', '/crm/customers/' + $('#customer_id').val());
$(".edit_customer").attr('action', '/crm/customers/' + $('#customer_id').val());
$(".patch_method").append('<input type="hidden" name="_method" value="patch">');
//$(".edit_customer").attr('method', 'PATCH');
}
});
}else{
}
})
function update_sale(customer_id,sale_id) {
$.confirm({
title: 'Confirm!',
content: 'Are You Sure to assign this customer!',
buttons: {
cancel: function () {
},
confirm: {
text: 'Confirm',
btnClass: 'btn-green',
keys: ['enter', 'shift'],
action: function(){
$.ajax({
type: "POST",
url: "update_sale" ,
data: {customer_id:customer_id,sale_id:sale_id},
dataType: "json",
success: function(data) {
if(data.status == true)
{
alert('Customer has assigned');
window.location.href = '/origami'
}else{
alert('Record not found!');
location.reload();
}
}
});
}
}
}
});
}
</script>

View File

@@ -27,11 +27,15 @@
@completed_orders.each do |cpo| @completed_orders.each do |cpo|
# ToDo no need check new # ToDo no need check new
# Assigned Id for new Order? Sale? # Assigned Id for new Order? Sale?
unique_id="" unique_id = ""
customer_id = ""
# For CSS- Class for Order? Sale? # For CSS- Class for Order? Sale?
sale_status="" sale_status=""
if cpo.order_status == 'new' if cpo.order_status == 'new'
unique_id=cpo.booking_id unique_id=cpo.booking_id
customer_id=cpo.order_customer_id
# check selected item and assign # check selected item and assign
if @selected_item != nil if @selected_item != nil
if cpo.order_id == @selected_item.order_id if cpo.order_id == @selected_item.order_id
@@ -40,6 +44,7 @@
end end
else else
unique_id=cpo.sale_id unique_id=cpo.sale_id
customer_id=cpo.sale_customer_id
sale_status="paid" sale_status="paid"
# check selected item and assign # check selected item and assign
if @selected_item != nil if @selected_item != nil
@@ -51,8 +56,10 @@
%> %>
<div class="card orders <%= sale_status %>"> <div class="card orders <%= sale_status %>">
<div class="card-block"> <div class="card-block">
<p class="hidden orders-id"><%= unique_id %></p> <p class="hidden orders-id"><%= unique_id %></p>
<p class="hidden customer-id"><%= bko.customer_id %></p> <p class="hidden customer-id"><%= customer_id %></p>
<p class="hidden order-cid"><%= cpo.order_id %></p>
<h4 class="card-title orders-table"><%= cpo.table_name %></h4> <h4 class="card-title orders-table"><%= cpo.table_name %></h4>
<p class="card-text"> <p class="card-text">
Receipt No : Receipt No :
@@ -82,10 +89,12 @@
@booking_orders.each do |bko| @booking_orders.each do |bko|
# Assigned Id for new Order? Sale? # Assigned Id for new Order? Sale?
unique_id="" unique_id=""
customer_id=""
# For CSS- Class for Order? Sale? # For CSS- Class for Order? Sale?
sale_status="" sale_status=""
if bko.order_status == 'new' if bko.order_status == 'new'
unique_id=bko.booking_id unique_id=bko.booking_id
customer_id=bko.order_customer_id
# check selected item and assign # check selected item and assign
if @selected_item != nil if @selected_item != nil
if bko.order_id == @selected_item.order_id if bko.order_id == @selected_item.order_id
@@ -94,6 +103,7 @@
end end
else else
unique_id=bko.sale_id unique_id=bko.sale_id
customer_id=bko.sale_customer_id
sale_status="sold" sale_status="sold"
# check selected item and assign # check selected item and assign
if @selected_item != nil if @selected_item != nil
@@ -106,6 +116,8 @@
<div class="card orders <%= sale_status %>"> <div class="card orders <%= sale_status %>">
<div class="card-block"> <div class="card-block">
<p class="hidden orders-id"><%= unique_id %></p> <p class="hidden orders-id"><%= unique_id %></p>
<p class="hidden customer-id"><%= customer_id %></p>
<p class="hidden order-cid"><%= bko.order_id %></p>
<h4 class="card-title orders-table"><%= bko.table_name %></h4> <h4 class="card-title orders-table"><%= bko.table_name %></h4>
<p class="card-text"> <p class="card-text">
Receipt No : Receipt No :
@@ -135,11 +147,13 @@
@booking_rooms.each do |rmo| @booking_rooms.each do |rmo|
# Assigned Id for new Order? Sale? # Assigned Id for new Order? Sale?
unique_id="" unique_id=""
customer_id=""
# For CSS- Class for Order? Sale? # For CSS- Class for Order? Sale?
sale_status="" sale_status=""
if rmo.order_status == 'new' if rmo.order_status == 'new'
unique_id=rmo.booking_id unique_id=rmo.booking_id
customer_id=rmo.order_customer_id
# check selected item and assign # check selected item and assign
if @selected_item != nil if @selected_item != nil
if rmo.order_id == @selected_item.order_id if rmo.order_id == @selected_item.order_id
@@ -148,6 +162,7 @@
end end
else else
unique_id=rmo.sale_id unique_id=rmo.sale_id
customer_id=rmo.sale_customer_id
sale_status="sold" sale_status="sold"
# check selected item and assign # check selected item and assign
if @selected_item != nil if @selected_item != nil
@@ -160,9 +175,9 @@
<div class="card orders <%= sale_status %>"> <div class="card orders <%= sale_status %>">
<div class="card-block"> <div class="card-block">
<p class="hidden orders-id"><%= unique_id %></p> <p class="hidden orders-id"><%= unique_id %></p>
<p class="hidden customer-id"><%= rmo.customer_id %></p> <p class="hidden customer-id"><%= customer_id %></p>
<p class="hidden order-cid"><%= rmo.order_id %></p>
<h4 class="card-title orders-table"><%= rmo.room_name %></h4> <h4 class="card-title orders-table"><%= rmo.room_name %></h4>
<p class="card-text"> <p class="card-text">
Receipt No : Receipt No :
<span class="orders-receipt-no"> <span class="orders-receipt-no">
@@ -191,12 +206,13 @@
@orders.each do |odr| @orders.each do |odr|
# Assigned Id for new Order? Sale? # Assigned Id for new Order? Sale?
unique_id="" unique_id=""
customer_id=""
# For CSS- Class for Order? Sale? # For CSS- Class for Order? Sale?
sale_status="" sale_status=""
if odr.order_status == 'new' if odr.order_status == 'new'
unique_id=odr.booking_id unique_id=odr.booking_id
# check selected item and assign customer_id = odr.order_customer_id
if @selected_item != nil if @selected_item != nil
if odr.order_id == @selected_item.order_id if odr.order_id == @selected_item.order_id
sale_status = sale_status + " selected-item" sale_status = sale_status + " selected-item"
@@ -204,6 +220,7 @@
end end
else else
unique_id=odr.sale_id unique_id=odr.sale_id
customer_id = odr.sale_customer_id
sale_status="sold" sale_status="sold"
# check selected item and assign # check selected item and assign
if @selected_item != nil if @selected_item != nil
@@ -215,11 +232,11 @@
%> %>
<div class="card orders <%= sale_status %>"> <div class="card orders <%= sale_status %>">
<div class="card-block"> <div class="card-block">
<p class="hidden orders-id"><%= unique_id %></p> <p class="hidden orders-id"><%= unique_id %></p>
<p class="hidden customer-id"><%= odr.customer_id %></p> <p class="hidden customer-id"><%= customer_id %></p>
<h4 class="card-title orders-table"><%= odr.table_name %></h4> <p class="hidden order-cid"><%= odr.order_id %></p>
<h4 class="card-title orders-table"><%= odr.table_name %></h4
<p class="card-text"> <p class="card-text">
Receipt No : Receipt No :
<span class="orders-receipt-no"> <span class="orders-receipt-no">
<%= odr.receipt_no %> <%= odr.receipt_no %>
@@ -354,7 +371,8 @@
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Add Order</button> <button type="button" class="btn btn-primary btn-lg btn-block" disabled>Add Order</button>
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Edit</button> <button type="button" class="btn btn-primary btn-lg btn-block" disabled>Edit</button>
<button type="button" class="btn btn-primary btn-lg btn-block" disabled>Move</button> <button type="button" class="btn btn-primary btn-lg btn-block" disabled>Move</button>
<button type="button" class="btn btn-primary btn-lg btn-block" id="customer" disabled>Customer</button> <button type="button" id="customer" class="btn btn-primary btn-lg btn-block" disabled>Customer</button>
<button type="button" id="request_bills" class="btn btn-primary btn-lg btn-block" disabled>Req.Bill</button>
<button type="button" id="request_bills" class="btn btn-primary btn-lg btn-block" disabled>Req.Bill</button> <button type="button" id="request_bills" class="btn btn-primary btn-lg btn-block" disabled>Req.Bill</button>
<!-- Cashier Buttons --> <!-- Cashier Buttons -->
<button type="button" id="discount" class="btn btn-primary btn-lg btn-block" disabled>Discount</button> <button type="button" id="discount" class="btn btn-primary btn-lg btn-block" disabled>Discount</button>

View File

@@ -13,7 +13,7 @@ Amount :
var sale_id = "<%= @sale_id %>"; var sale_id = "<%= @sale_id %>";
$.ajax({type: "POST", $.ajax({type: "POST",
url: "<%= origami_create_mpu_payment_path %>", url: "<%= origami_payment_mpu_path %>",
data: "amount="+ amount + "&sale_id="+ sale_id, data: "amount="+ amount + "&sale_id="+ sale_id,
success:function(result){ success:function(result){
if(result){ if(result){

View File

@@ -6,8 +6,8 @@
<div id="order-title"> <div id="order-title">
<table> <table>
<tr> <tr>
<td style="width:60%;"><strong>Receipt No : <%=@sale_data.receipt_no rescue ' '%></strong></td> <td style="width:55%;"><strong>Receipt No : <%=@sale_data.receipt_no rescue ' '%></strong></td>
<td style="width:40%;"><strong>Receipt Date : <%=@sale_data.receipt_date.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></strong></td> <td style="width:45%;"><strong>Receipt Date : <%=@sale_data.receipt_date.utc.getlocal.strftime("%d/%m/%Y - %I:%M %p") rescue '-'%></strong></td>
</tr> </tr>
<tr> <tr>
<td><strong>Table No</strong> <% if @sale_data%>- <%=@sale_data.receipt_no%><% end %></td> <td><strong>Table No</strong> <% if @sale_data%>- <%=@sale_data.receipt_no%><% end %></td>
@@ -229,11 +229,16 @@ $( document ).ready(function() {
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_process_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){
alert("Thank you") if($('#balance').text() < 0){
// window.location.href = '/origami'; alert("Changed amount " + $('#balance').text() * (-1) )
}else{
alert("Thank you")
}
window.location.href = '/origami';
} }
}); });
} }

View File

@@ -1,7 +1,7 @@
<div class="row"> <div class="row">
<div class="col-lg-5 col-md-5 col-sm-3"> <div class="col-lg-5 col-md-5 col-sm-3">
<div class="card"> <div class="card" style="margin-top:10px;padding-top:20px;">
<div class="rebate-form"> <div class="rebate-form">
<div class="row"> <div class="row">
<div class="form-group col-lg-12 col-md-12 col-sm-12"> <div class="form-group col-lg-12 col-md-12 col-sm-12">
@@ -23,14 +23,14 @@
<div class="col-lg-7 col-md-7 col-sm-7"> <div class="col-lg-7 col-md-7 col-sm-7">
<div class="row"> <div class="row" style="margin-top:10px;">
<div class="col-md-12"> <div class="col-md-12">
<div class="row"> <div class="row">
<div class="col-md-7"> <div class="col-md-7">
<div class="row"> <div class="row bottom">
<div class="col-md-3 cashier_number" data-value="1" data-type="num">1</div> <div class="col-md-3 cashier_number" data-value="1" data-type="num">1</div>
<div class="col-md-3 cashier_number" data-value="2" data-type="num">2</div> <div class="col-md-3 left cashier_number" data-value="2" data-type="num">2</div>
<div class="col-md-3 cashier_number" data-value="3" data-type="num">3</div> <div class="col-md-3 left cashier_number" data-value="3" data-type="num">3</div>
</div> </div>
</div> </div>
<div class="col-md-5"> <div class="col-md-5">
@@ -39,10 +39,10 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-7"> <div class="col-md-7">
<div class="row"> <div class="row bottom">
<div class="col-md-3 cashier_number" data-value="4" data-type="num">4</div> <div class="col-md-3 cashier_number" data-value="4" data-type="num">4</div>
<div class="col-md-3 cashier_number" data-value="5" data-type="num">5</div> <div class="col-md-3 left cashier_number" data-value="5" data-type="num">5</div>
<div class="col-md-3 cashier_number" data-value="6" data-type="num">6</div> <div class="col-md-3 left cashier_number" data-value="6" data-type="num">6</div>
</div> </div>
</div> </div>
<div class="col-md-5"> <div class="col-md-5">
@@ -51,10 +51,10 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-7"> <div class="col-md-7">
<div class="row"> <div class="row bottom">
<div class="col-md-3 cashier_number" data-value="7" data-type="num">7</div> <div class="col-md-3 cashier_number" data-value="7" data-type="num">7</div>
<div class="col-md-3 cashier_number" data-value="8" data-type="num">8</div> <div class="col-md-3 left cashier_number" data-value="8" data-type="num">8</div>
<div class="col-md-3 cashier_number" data-value="9" data-type="num">9</div> <div class="col-md-3 left cashier_number" data-value="9" data-type="num">9</div>
</div> </div>
</div> </div>
<div class="col-md-5"> <div class="col-md-5">
@@ -63,10 +63,10 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-7"> <div class="col-md-7">
<div class="row"> <div class="row bottom">
<div class="col-md-3 cashier_number" data-value="0" data-type="num">0</div> <div class="col-md-3 cashier_number" data-value="0" data-type="num">0</div>
<div class="col-md-3 cashier_number" data-value="." data-type="num">.</div> <div class="col-md-3 left cashier_number" data-value="." data-type="num">.</div>
<div class="col-md-3 cashier_number" data-value="00" data-type="num">00</div> <div class="col-md-3 left cashier_number" data-value="00" data-type="num">00</div>
</div> </div>
</div> </div>
<div class="col-md-5"> <div class="col-md-5">
@@ -75,10 +75,10 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col-md-7"> <div class="col-md-7">
<div class="row"> <div class="row bottom">
<div class="col-md-3 cashier_number"></div> <div class="col-md-3 cashier_number"></div>
<div class="col-md-3 cashier_number red" data-type="del">DEL</div> <div class="col-md-3 left cashier_number red" data-type="del">DEL</div>
<div class="col-md-3 cashier_number green" data-type="clr">CLR</div> <div class="col-md-3 left cashier_number green" data-type="clr">CLR</div>
</div> </div>
</div> </div>
<div class="col-md-5"> <div class="col-md-5">
@@ -140,13 +140,14 @@ $("#redeem").click(function(){
membership_id = $("#valid_amount").attr('data-member-value'); membership_id = $("#valid_amount").attr('data-member-value');
redeem_amount = parseInt($("#used_amount").text()); redeem_amount = parseInt($("#used_amount").text());
if(redeem_amount<=0 ){ if(redeem_amount<=0 ){
alert(" Insufficient Amount!")
}else if(valid_amount< redeem_amount || redeem_amount == ""){
alert("Please type valid amount"); alert("Please type valid amount");
}else if(valid_amount< redeem_amount){
alert(" Insufficient Amount!")
}else{ }else{
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: "<%=origami_paypar_payment_process_path%>", url: "<%=origami_payment_paypar_path%>",
data: {redeem_amount:redeem_amount,membership_id:membership_id,sale_id:sale_id}, data: {redeem_amount:redeem_amount,membership_id:membership_id,sale_id:sale_id},
success: function(result){ success: function(result){
if(result.status == true){ if(result.status == true){

View File

@@ -0,0 +1,68 @@
<div class="row">
<div class="col-lg-12">
<ol class="breadcrumb">
<li><a href="<%= crm_root_path %>">Home</a></li>
<li class="active">
<a href="<%= settings_orders_path %>">Order</a>
</li>
</ol>
</div>
</div>
<hr>
<div class="row">
<div class="col-lg-12">
<div class="main-box-body clearfix">
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<td colspan="6">
<%= form_tag settings_orders_path, :method => :get do %>
<div class="input-append form-group pull-right">
<input type="text" name="filter" placeholder="Order ID" class="form-control input-sm col-md-8">
<button type="submit" class="btn btn-primary btn-sm">Search</button>
</div>
<% end %>
</td>
</tr>
<tr>
<th>Order ID </th>
<th>Type</th>
<th>Customer</th>
<th>Order status</th>
<th>Order date</th>
<th>Items Count</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<% @orders.each do |order| %>
<tr>
<td><%= order.order_id %></td>
<td><%= order.order_type %></td>
<td><%= order.customer.name rescue '-' %></td>
<td><%= order.status %></td>
<td> <%= order.date.strftime("%d-%m-%Y") %> </td>
<td> <%= order.item_count %> </td>
<td><%= link_to 'Show', settings_order_path(order) %></td>
</tr>
<% end %>
</tbody>
</table>
<br>
<%= paginate @orders %>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,85 @@
<div class="row">
<div class="col-lg-12">
<ol class="breadcrumb">
<li><a href="<%= crm_root_path %>">Home</a></li>
<li class="active">
<a href="<%= settings_orders_path %>">Order</a>
</li>
<li class="active">
<a href="<%= settings_orders_path %>"><%= @order.order_id %></a>
</li>
</ol>
</div>
</div>
<hr>
<div class="row">
<div class="col-lg-12">
<div class="main-box-body clearfix">
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Type</th>
<th>Customer</th>
<th>Order status</th>
<th>Order date</th>
<th>Order By</th>
</tr>
</thead>
<tbody>
<tr>
<td><%= @order.order_type %></td>
<td><%= @order.customer.name rescue '-' %></td>
<td><%= @order.status %></td>
<td> <%= @order.date.strftime("%d-%m-%Y") %> </td>
<td> <%= @order.waiter rescue '-' %> </td>
</tr>
</tbody>
</table>
<h3>Order Items</h3>
<table class="table table-striped">
<thead>
<tr>
<th>Item Name</th>
<th>Qty</th>
<th> Unit Price</th>
<th>Total Price</th>
<th>Option</th>
<th>Status</th>
<th>Order By</th>
<th>Created at</th>
</tr>
</thead>
<tbody>
<% @order.order_items.each do |order| %>
<tr>
<td><%= order.item_name %></td>
<td><%= order.qty %></td>
<td><%= order.price %></td>
<td><%= order.qty * order.price %></td>
<td> <%= order.options %> </td>
<td> <%= order.order_item_status %> </td>
<td> <%= order.item_order_by %> </td>
<td> <%= order.created_at.strftime("%d-%m-%Y") %> </td>
</tr>
<% end %>
</tbody>
</table>
<a href="<%= settings_orders_path%>" class="btn btn-primary pull-left">
<i class="fa fa-arrow-left fa-xs"></i> Back
</a>
</div>
</div>
</div>
</div>

View File

@@ -0,0 +1,85 @@
<div class="row">
<div class="col-lg-12">
<ol class="breadcrumb">
<li><a href="<%= crm_root_path %>">Home</a></li>
<li class="active">
<a href="<%= settings_sales_path %>">Sale</a>
</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div class="main-box-body clearfix">
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<td colspan="8">
<%= form_tag settings_sales_path, :method => :get do %>
<div class="input-append form-group pull-right">
<input data-behaviour='datepicker' class="datepicker col-md-3 form-control" name="date" id="date" type="text" placeholder="Search by date" style="margin-right: 10px">
<input type="text" name="receipt_no" class="col-md-4 form-control" placeholder="Receipt No" style="margin-right: 10px">
<button type="submit" class="btn btn-primary btn">Search</button>
</div>
<% end %>
</td>
</tr>
<tr>
<th>Sale Id </th>
<th>Receipt no </th>
<th>Grand total</th>
<th>Tax amount</th>
<th>Cashier</th>
<th>Sales status</th>
<th>Receipt Date</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<% @sales.each do |sale| %>
<tr>
<td><%= sale.sale_id %></td>
<td><%= sale.receipt_no %></td>
<td><%= sale.grand_total rescue '-' %></td>
<td><%= sale.total_tax %></td>
<td><%= sale.cashier_name rescue '-' %></td>
<td> <%= sale.sale_status %> </td>
<td> <%= sale.receipt_date.strftime("%d-%m-%Y") %> </td>
<td><%= link_to 'Show', settings_sale_path(sale) %></td>
</tr>
<% end %>
</tbody>
</table>
<br>
<%= paginate @sales %>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$(function () {
if (jQuery().datepicker) {
$('.datepicker').datepicker({
format : 'dd-mm-yyyy',
autoclose: true
});
$('.datepicker').attr('ReadOnly','true');
$('.datepicker').css('cursor','pointer');
}
});
</script>

View File

@@ -0,0 +1,103 @@
<div class="row">
<div class="col-lg-12">
<ol class="breadcrumb">
<li><a href="<%= crm_root_path %>">Home</a></li>
<li class="active">
<a href="<%= settings_sales_path %>">Sale</a>
</li>
<li class="active">
<a href="<%= settings_sales_path %>"><%= @sale.sale_id %></a>
</li>
</ol>
</div>
</div>
<hr>
<div class="row">
<div class="col-lg-12">
<div class="main-box-body clearfix">
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Receipt Date </th>
<th>Receipt no</th>
<th>Cashier</th>
<th>OSales status</th>
<th>Receipt generated at</th>
</tr>
</thead>
<tbody>
<tr>
<td><%= @sale.receipt_date.strftime("%d-%M-%Y") %></td>
<td><%= @sale.receipt_no %></td>
<td><%= @sale.cashier rescue '-' %></td>
<td> <%= @sale.sale_status %> </td>
<td> <%= @sale.requested_at.strftime("%d-%m-%Y") %> </td>
</tr>
<tr style="border-top:2px solid #000">
<th>Sale item name</th>
<th> Qty</th>
<th>Unit price</th>
<th>Total pirce </th>
<th>Created at</th>
</tr>
<% @sale.sale_items.each do |s| %>
<tr>
<td><%=s.product_name rescue ' '%></td>
<td><%=s.qty rescue ' '%></td>
<td><%= number_with_precision(s.price, :precision => 2, :delimiter => ',') rescue ' '%></td>
<td><%= number_with_precision(s.qty * s.price, :precision => 2, :delimiter => ',') rescue ' '%></td>
<td><%=l s.created_at.utc.getlocal , :format => :short rescue ' ' %></td>
</tr>
<% end %>
<tr style="border-top:2px solid #000">
<td colspan=2 style="text-align:center"></td>
<td>Total</td>
<td colspan="2"><%= number_with_precision(@sale.total_amount, :precision => 2, :delimiter => ',') rescue ' '%></td>
</tr>
<tr>
<td colspan=2 style="text-align:center"></td>
<td>Tax</td>
<td colspan="2"><%= number_with_precision(@sale.total_tax, :precision => 2, :delimiter => ',') rescue ' '%></td>
</tr>
<tr>
<td colspan=2 style="text-align:center"></td>
<td>Discount</td>
<td colspan="2"><%= number_with_precision(@sale.total_discount, :precision => 2, :delimiter => ',') rescue ' '%></td>
</tr>
<tr>
<td colspan=2 style="text-align:center"></td>
<td>Grand Total</td>
<td colspan="2"><%= number_with_precision(@sale.grand_total, :precision => 2, :delimiter => ',') rescue ' '%></td>
</tr>
<tr><td>&nbsp;<td></tr>
<tr>
<td colspan=2 style="text-align:center"></td>
<td>Pay Amount</td>
<td colspan="2"><%= number_with_precision(@sale.amount_received, :precision => 2, :delimiter => ',') rescue ' '%></td>
</tr>
<tr>
<td colspan=2 style="text-align:center"></td>
<td>Change</td>
<td colspan="2"><%= number_with_precision(@sale.amount_changed, :precision => 2, :delimiter => ',') rescue ' '%></td>
</tr>
</tbody>
</table>
<a href="<%= settings_sales_path%>" class="btn btn-primary pull-left">
<i class="fa fa-arrow-left fa-xs"></i> Back
</a>
</div>
</div>
</div>
</div>

View File

@@ -1,5 +1,5 @@
Kaminari.configure do |config| Kaminari.configure do |config|
# config.default_per_page = 25 config.default_per_page = 2
# config.max_per_page = nil # config.max_per_page = nil
# config.window = 4 # config.window = 4
# config.outer_window = 0 # config.outer_window = 0

View File

@@ -86,13 +86,15 @@ Rails.application.routes.draw do
#--------- Payment ------------# #--------- Payment ------------#
get 'sale/:sale_id/payment' => 'payments#show' get 'sale/:sale_id/payment' => 'payments#show'
post 'payment_process' => 'payments#create' post 'payment/cash' => 'payments#create'
post 'paypar_payment_process' => 'paypar_payments#create' post 'payment/paypar' => 'paypar_payments#create'
get 'sale/:sale_id/payment/credit_payment' => "credit_payments#index" get 'sale/:sale_id/payment/credit_payment' => "credit_payments#index"
get 'sale/:sale_id/payment/others_payment' => "others_payments#index" get 'sale/:sale_id/payment/others_payment' => "others_payments#index"
# get 'sale/:sale_id/payment/others_payment/:payment_method' => "redeem_payments#index" # get 'sale/:sale_id/payment/others_payment/:payment_method' => "redeem_payments#index"
get 'sale/:sale_id/payment/others_payment/MPU' => "mpu#index" get 'sale/:sale_id/payment/others_payment/MPU' => "mpu#index"
post 'create_mpu_payment' => "mpu#create" post 'payment/mpu' => "mpu#create"
get 'sale/:sale_id/payment/others_payment/REDEEMREBATE' => "redeem_payments#index" get 'sale/:sale_id/payment/others_payment/REDEEMREBATE' => "redeem_payments#index"
#---------Add Customer --------------# #---------Add Customer --------------#
@@ -100,7 +102,6 @@ Rails.application.routes.draw do
get '/:sale_id/add_customer', to: "customers#add_customer" get '/:sale_id/add_customer', to: "customers#add_customer"
get '/:customer_id/get_customer' => 'home#get_customer' get '/:customer_id/get_customer' => 'home#get_customer'
post '/:sale_id/update_sale' , to: "home#update_sale_by_customer"#update customer id in sale table post '/:sale_id/update_sale' , to: "home#update_sale_by_customer"#update customer id in sale table
end end
#--------- Waiter/Ordering Station ------------# #--------- Waiter/Ordering Station ------------#
@@ -169,6 +170,8 @@ Rails.application.routes.draw do
resources :lookups resources :lookups
#orders #orders
resources :orders resources :orders
#sales
resources :sales
#cashier_terminals #cashier_terminals
resources :cashier_terminals resources :cashier_terminals
#order_job_stations #order_job_stations

View File

@@ -51,6 +51,10 @@ menu_item_type = Lookup.create([{lookup_type:'menu_item_type', name: 'SIMPLE', v
{lookup_type:'menu_item_type', name: 'Set Menu', value: 'setMenu'}, {lookup_type:'menu_item_type', name: 'Set Menu', value: 'setMenu'},
{lookup_type:'menu_item_type', name: 'DIY', value: 'diy'}]) {lookup_type:'menu_item_type', name: 'DIY', value: 'diy'}])
member_group_type = Lookup.create([{lookup_type:'member_group_type', name: 'Platinum', value: '1'},
{lookup_type:'member_group_type', name: 'Silver', value: '2'}
])
#menu_item_attribute:[size|] #menu_item_attribute:[size|]
menu_item_attribute_type = Lookup.create([{lookup_type:'menu_item_attribute_type', name: 'Size', value: 'size'}]) menu_item_attribute_type = Lookup.create([{lookup_type:'menu_item_attribute_type', name: 'Size', value: 'size'}])
# {lookup_type:'menu_item_attribute_type', name: 'Spicy', value: 'spicy'}, # {lookup_type:'menu_item_attribute_type', name: 'Spicy', value: 'spicy'},
@@ -141,20 +145,24 @@ order_station2=PrintSetting.create({name: "Order Summary", unique_code: "OrderSu
request_bill_printer=PrintSetting.create({name: "Receipt Bill", unique_code: "ReceiptBillPdf", printer_name: "EPSON-TM-T82-S-A"}) request_bill_printer=PrintSetting.create({name: "Receipt Bill", unique_code: "ReceiptBillPdf", printer_name: "EPSON-TM-T82-S-A"})
crm_order_printer=PrintSetting.create({name: "CRM Order", unique_code: "CrmOrderPdf", printer_name: "EPSON-TM-T82-S-A"}) crm_order_printer=PrintSetting.create({name: "CRM Order", unique_code: "CrmOrderPdf", printer_name: "EPSON-TM-T82-S-A"})
member_setting = MembershipSetting.create({membership_type:"paypar_url",gateway_url: "192.168.1."}) member_setting = MembershipSetting.create({membership_type:"paypar_url",gateway_url: "http://192.168.1.47:3006",merchant_account_id:"vWSsseoZCzxd6xcNf_uS"})
member_actions= MembershipAction.create([{membership_type:"get_account_balance",gateway_url:"/api/membership_campaigns/get_correspond_account_data",additional_parameter:{campaign_type_id:1}}, member_actions= MembershipAction.create([{membership_type:"get_account_balance",gateway_url:"/api/membership_campaigns/get_correspond_account_data",additional_parameter:{campaign_type_id:1},merchant_account_id:"vWSsseoZCzxd6xcNf_uS"},
{membership_type:"redeem",gateway_url:"/api/membership_campaigns/redeem",additional_parameter:{campaign_type_id:1}}, {membership_type:"redeem",gateway_url:"/api/membership_campaigns/redeem",additional_parameter:{campaign_type_id:1},merchant_account_id:"vWSsseoZCzxd6xcNf_uS"},
{membership_type:"create_membership_customer",gateway_url:"/api/generic_customer/create_membership_customer"}, {membership_type:"create_membership_customer",gateway_url:"/api/generic_customer/create_membership_customer",merchant_account_id:"vWSsseoZCzxd6xcNf_uS"},
{membership_type:"update_membership_customer",gateway_url:"/api/generic_customer/update_membership_customer"}, {membership_type:"update_membership_customer",gateway_url:"/api/generic_customer/update_membership_customer",merchant_account_id:"vWSsseoZCzxd6xcNf_uS"},
{membership_type:"get_all_member_group",gateway_url:"/api/member_group/get_all_member_group"}, {membership_type:"get_all_member_group",gateway_url:"/api/member_group/get_all_member_group",merchant_account_id:"vWSsseoZCzxd6xcNf_uS"},
{membership_type:"rebate",gateway_url:"/api/membership_campaigns/rebate",additional_parameter:{campaign_type_id:1}}, {membership_type:"rebate",gateway_url:"/api/membership_campaigns/rebate",additional_parameter:{campaign_type_id:1},merchant_account_id:"vWSsseoZCzxd6xcNf_uS"},
{membership_type:"get_all_member_account",gateway_url:"/api/generic_customer/get_membership_data"} {membership_type:"get_all_member_account",gateway_url:"/api/generic_customer/get_membership_data",merchant_account_id:"vWSsseoZCzxd6xcNf_uS"}
]) ])
payment_methods = PaymentMethodSetting.create({payment_method:"MPU",gateway_url: "http//192.168.1.47:3006"})
payment_methods = PaymentMethodSetting.create({payment_method:"JCB",gateway_url: "http//192.168.1.47:3006"})
payment_methods = PaymentMethodSetting.create({payment_method:"REDEEMREBATE",gateway_url: "http://192.168.1.47:3006",merchant_account_id:"vWSsseoZCzxd6xcNf_uS"})
# shop = Shop.create( # shop = Shop.create(
# {name: "Beauty In The Pot", address: "address", township: "Yangon", city: "Yangon", state: "Yangon", # {name: "Beauty In The Pot", address: "address", township: "Yangon", city: "Yangon", state: "Yangon",
# country: "Myanmar", phone_no: "09123456789", reservation_no: "bip000001", license: "license", # country: "Myanmar", phone_no: "09123456789", reservation_no: "bip000001", license: "license",
# activated_at: "2017-06-06", license_data: "license_data", base_currency: "Ks", id_prefix: "abc"} # activated_at: "2017-06-06", license_data: "license_data", base_currency: "Ks", id_prefix: "abc"}
# ) # )

BIN
dump.rdb

Binary file not shown.

View File

@@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe Settings::OrdersController, type: :controller do
end

View File

@@ -0,0 +1,15 @@
require 'rails_helper'
# Specs in this file have access to a helper object that includes
# the Settings::OrdersHelper. For example:
#
# describe Settings::OrdersHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.concat_strings("this","that")).to eq("this that")
# end
# end
# end
RSpec.describe Settings::OrdersHelper, type: :helper do
pending "add some examples to (or delete) #{__FILE__}"
end

View File

@@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe DiningQueue, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
end