conflict file
This commit is contained in:
5
Gemfile
5
Gemfile
@@ -13,7 +13,6 @@ 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'
|
|
||||||
|
|
||||||
# redis server for cable
|
# redis server for cable
|
||||||
# gem 'redis', '~> 3.0'
|
# gem 'redis', '~> 3.0'
|
||||||
@@ -92,4 +91,6 @@ end
|
|||||||
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
|
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
|
||||||
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
|
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
|
||||||
|
|
||||||
gem 'httparty', '~> 0.15.5'
|
gem 'httparty', '~> 0.15.5'
|
||||||
|
|
||||||
|
gem 'bootstrap-datepicker-rails'
|
||||||
@@ -64,6 +64,8 @@ GEM
|
|||||||
bootstrap (4.0.0.alpha6)
|
bootstrap (4.0.0.alpha6)
|
||||||
autoprefixer-rails (>= 6.0.3)
|
autoprefixer-rails (>= 6.0.3)
|
||||||
sass (>= 3.4.19)
|
sass (>= 3.4.19)
|
||||||
|
bootstrap-datepicker-rails (1.6.4.1)
|
||||||
|
railties (>= 3.0)
|
||||||
builder (3.2.3)
|
builder (3.2.3)
|
||||||
byebug (9.0.6)
|
byebug (9.0.6)
|
||||||
coffee-rails (4.2.2)
|
coffee-rails (4.2.2)
|
||||||
@@ -244,6 +246,7 @@ PLATFORMS
|
|||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
bcrypt (~> 3.1.7)
|
bcrypt (~> 3.1.7)
|
||||||
bootstrap (~> 4.0.0.alpha3)
|
bootstrap (~> 4.0.0.alpha3)
|
||||||
|
bootstrap-datepicker-rails
|
||||||
byebug
|
byebug
|
||||||
coffee-rails (~> 4.2)
|
coffee-rails (~> 4.2)
|
||||||
cups (~> 0.0.7)
|
cups (~> 0.0.7)
|
||||||
|
|||||||
@@ -17,3 +17,4 @@
|
|||||||
//= require turbolinks
|
//= require turbolinks
|
||||||
//= require cable
|
//= require cable
|
||||||
//= require settings/processing_items
|
//= require settings/processing_items
|
||||||
|
//= require bootstrap-datepicker
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
@import "bootstrap";
|
@import "bootstrap";
|
||||||
@import "font-awesome";
|
@import "font-awesome";
|
||||||
@import "theme";
|
@import "theme";
|
||||||
|
@import "bootstrap-datepicker3";
|
||||||
|
|
||||||
/* Show it is fixed to the top */
|
/* Show it is fixed to the top */
|
||||||
// body {
|
// body {
|
||||||
|
|||||||
@@ -5,6 +5,13 @@ class Crm::CustomersController < ApplicationController
|
|||||||
# GET /crm/customers.json
|
# GET /crm/customers.json
|
||||||
def index
|
def index
|
||||||
@crm_customers = Customer.all
|
@crm_customers = Customer.all
|
||||||
|
@customers = Customer.new
|
||||||
|
@membership = Customer.get_member_group
|
||||||
|
|
||||||
|
respond_to do |format|
|
||||||
|
format.html # index.html.erb
|
||||||
|
format.json { render json: @crm_customers }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# GET /crm/customers/1
|
# GET /crm/customers/1
|
||||||
@@ -15,7 +22,8 @@ class Crm::CustomersController < ApplicationController
|
|||||||
# GET /crm/customers/new
|
# GET /crm/customers/new
|
||||||
def new
|
def new
|
||||||
@crm_customer = Customer.new
|
@crm_customer = Customer.new
|
||||||
@membership = Customer.get_member_group
|
@membership = Customer.get_member_group()
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# GET /crm/customers/1/edit
|
# GET /crm/customers/1/edit
|
||||||
@@ -25,7 +33,7 @@ class Crm::CustomersController < ApplicationController
|
|||||||
# POST /crm/customers
|
# POST /crm/customers
|
||||||
# POST /crm/customers.json
|
# POST /crm/customers.json
|
||||||
def create
|
def create
|
||||||
@crm_customer = Customer.new(crm_customer_params)
|
@crm_customer = Customer.new(customer_params)
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @crm_customer.save
|
if @crm_customer.save
|
||||||
@@ -42,7 +50,7 @@ class Crm::CustomersController < ApplicationController
|
|||||||
# PATCH/PUT /crm/customers/1.json
|
# PATCH/PUT /crm/customers/1.json
|
||||||
def update
|
def update
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @crm_customer.update(crm_customer_params)
|
if @crm_customer.update(customer_params)
|
||||||
format.html { redirect_to @crm_customer, notice: 'Customer was successfully updated.' }
|
format.html { redirect_to @crm_customer, notice: 'Customer was successfully updated.' }
|
||||||
format.json { render :show, status: :ok, location: @crm_customer }
|
format.json { render :show, status: :ok, location: @crm_customer }
|
||||||
else
|
else
|
||||||
@@ -69,7 +77,7 @@ class Crm::CustomersController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Never trust parameters from the scary internet, only allow the white list through.
|
# Never trust parameters from the scary internet, only allow the white list through.
|
||||||
def crm_customer_params
|
def customer_params
|
||||||
params.require(:crm_customer).permit(:name, :company, :contact_no, :email, :date_of_birth, :membership_id, :membership_type, :membership_authentication_code)
|
params.require(:customer).permit(:name, :company, :contact_no, :email, :date_of_birth, :membership_id, :membership_type, :membership_authentication_code)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,12 +1,29 @@
|
|||||||
class Customer < ApplicationRecord
|
class Customer < ApplicationRecord
|
||||||
self.primary_key = "customer_id"
|
|
||||||
|
#self.primary_key = :customer_id
|
||||||
|
|
||||||
before_create :generate_custom_id
|
before_create :generate_custom_id
|
||||||
has_many :orders
|
has_many :orders
|
||||||
has_many :sales
|
has_many :sales
|
||||||
|
|
||||||
validates_presence_of :name, :contact_no
|
validates_presence_of :name, :contact_no, :email
|
||||||
validates :contact_no, uniqueness: true
|
validates :contact_no, uniqueness: true
|
||||||
|
validates :email, uniqueness: true
|
||||||
|
|
||||||
|
def self.get_member_group
|
||||||
|
|
||||||
|
gateway_url = MembershipSetting.find_by_membership_type("smartpay_url")
|
||||||
|
url = gateway_url.gateway_url.to_s + "/api/get_all_member_group".to_s
|
||||||
|
response = HTTParty.get(url)
|
||||||
|
puts response.body, response.code, response.message, response.headers.inspect
|
||||||
|
|
||||||
|
return response;
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
# http://192.168.1.47:3006/api/create_membership_customer
|
||||||
|
#get_all_member_group
|
||||||
|
|
||||||
|
|
||||||
def lastest_invoices
|
def lastest_invoices
|
||||||
sales.where(:customer_id => self.id).order("created_at desc").limit(5)
|
sales.where(:customer_id => self.id).order("created_at desc").limit(5)
|
||||||
|
|||||||
@@ -211,16 +211,17 @@ class Order < ApplicationRecord
|
|||||||
#Origami: Cashier : to view order type Table
|
#Origami: Cashier : to view order type Table
|
||||||
|
|
||||||
def self.get_order_table
|
def self.get_order_table
|
||||||
order_table = Order.select("orders.id as order_id,sum(order_items.qty*order_items.price) as total_price,
|
order_table = Order.select("orders.order_id as order_id,sum(order_items.qty*order_items.price) as total_price,
|
||||||
order_items.id as order_items_id,dining_facilities.name as table_name")
|
order_items.order_items_id as order_items_id,dining_facilities.name as table_name")
|
||||||
.joins("left join booking_orders on booking_orders.order_id = orders.id
|
.joins("left join booking_orders on booking_orders.order_id = orders.order_id
|
||||||
left join bookings on bookings.id = booking_orders.id
|
left join bookings on bookings.booking_id = booking_orders.booking_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
|
||||||
left join order_items on order_items.order_id = orders.id")
|
left join order_items on order_items.order_id = orders.order_id")
|
||||||
.where("dining_facilities.type=? and orders.order_type=? and dining_facilities.is_active=?",DiningFacility::TABLE_TYPE,"dine_in",true)
|
.where("dining_facilities.type=? and orders.order_type=? and dining_facilities.is_active=?",DiningFacility::TABLE_TYPE,"dine_in",true)
|
||||||
.group("orders.order_id, order_items.order_items_id,dining_facilities.name")
|
.group("orders.order_id, order_items.order_items_id,dining_facilities.name")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
def self.get_booking_order_table
|
def self.get_booking_order_table
|
||||||
booking_orders = Booking.select("sales.receipt_no,orders.status as order_status,
|
booking_orders = Booking.select("sales.receipt_no,orders.status as order_status,
|
||||||
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")
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ if (@booking)
|
|||||||
@total_amount = 0.00
|
@total_amount = 0.00
|
||||||
@total_tax = 0.00
|
@total_tax = 0.00
|
||||||
|
|
||||||
@booking_orders = BookingOrder.where("booking_id = #{@booking.booking_id}").all;
|
|
||||||
if @booking.booking_orders
|
if @booking.booking_orders
|
||||||
order_items = []
|
order_items = []
|
||||||
@booking.booking_orders.each do |bo|
|
@booking.booking_orders.each do |bo|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<%= f.input :contact_no %>
|
<%= f.input :contact_no %>
|
||||||
<%= f.input :email %>
|
<%= f.input :email %>
|
||||||
<%= f.input :date_of_birth %>
|
<%= f.input :date_of_birth %>
|
||||||
|
<%= f.input :membership_id, :collection => @membership %>
|
||||||
<%= f.input :membership_type %>
|
<%= f.input :membership_type %>
|
||||||
<%= f.input :membership_authentication_code %>
|
<%= f.input :membership_authentication_code %>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -71,6 +71,7 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<%= f.select :membership_id, options_for_select(@membership.collect { |member|
|
<%= f.select :membership_id, options_for_select(@membership.collect { |member|
|
||||||
[member["name"], member["id"]] }, 1), {}, { id: 'countries_select' } %>
|
[member["name"], member["id"]] }, 1), {}, { id: 'countries_select' } %>
|
||||||
|
|
||||||
<select class="selectpicker form-control col-md-6" name="membership_id">
|
<select class="selectpicker form-control col-md-6" name="membership_id">
|
||||||
<option>Select Member Group</option>
|
<option>Select Member Group</option>
|
||||||
<% @membership.each do |member| %>
|
<% @membership.each do |member| %>
|
||||||
|
|||||||
Reference in New Issue
Block a user