conflict file

This commit is contained in:
Aung Myo
2017-06-06 14:49:25 +06:30
10 changed files with 48 additions and 16 deletions

View File

@@ -17,3 +17,4 @@
//= require turbolinks
//= require cable
//= require settings/processing_items
//= require bootstrap-datepicker

View File

@@ -2,6 +2,7 @@
@import "bootstrap";
@import "font-awesome";
@import "theme";
@import "bootstrap-datepicker3";
/* Show it is fixed to the top */
// body {

View File

@@ -5,6 +5,13 @@ class Crm::CustomersController < ApplicationController
# GET /crm/customers.json
def index
@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
# GET /crm/customers/1
@@ -15,7 +22,8 @@ class Crm::CustomersController < ApplicationController
# GET /crm/customers/new
def new
@crm_customer = Customer.new
@membership = Customer.get_member_group
@membership = Customer.get_member_group()
end
# GET /crm/customers/1/edit
@@ -25,7 +33,7 @@ class Crm::CustomersController < ApplicationController
# POST /crm/customers
# POST /crm/customers.json
def create
@crm_customer = Customer.new(crm_customer_params)
@crm_customer = Customer.new(customer_params)
respond_to do |format|
if @crm_customer.save
@@ -42,7 +50,7 @@ class Crm::CustomersController < ApplicationController
# PATCH/PUT /crm/customers/1.json
def update
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.json { render :show, status: :ok, location: @crm_customer }
else
@@ -69,7 +77,7 @@ class Crm::CustomersController < ApplicationController
end
# Never trust parameters from the scary internet, only allow the white list through.
def crm_customer_params
params.require(:crm_customer).permit(:name, :company, :contact_no, :email, :date_of_birth, :membership_id, :membership_type, :membership_authentication_code)
def customer_params
params.require(:customer).permit(:name, :company, :contact_no, :email, :date_of_birth, :membership_id, :membership_type, :membership_authentication_code)
end
end

View File

@@ -1,12 +1,29 @@
class Customer < ApplicationRecord
self.primary_key = "customer_id"
#self.primary_key = :customer_id
before_create :generate_custom_id
has_many :orders
has_many :sales
validates_presence_of :name, :contact_no
validates_presence_of :name, :contact_no, :email
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
sales.where(:customer_id => self.id).order("created_at desc").limit(5)

View File

@@ -211,16 +211,17 @@ class Order < ApplicationRecord
#Origami: Cashier : to view order type 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_items.id as order_items_id,dining_facilities.name as table_name")
.joins("left join booking_orders on booking_orders.order_id = orders.id
left join bookings on bookings.id = booking_orders.id
order_table = Order.select("orders.order_id as order_id,sum(order_items.qty*order_items.price) as total_price,
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.order_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 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)
.group("orders.order_id, order_items.order_items_id,dining_facilities.name")
end
def self.get_booking_order_table
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")

View File

@@ -13,7 +13,6 @@ if (@booking)
@total_amount = 0.00
@total_tax = 0.00
@booking_orders = BookingOrder.where("booking_id = #{@booking.booking_id}").all;
if @booking.booking_orders
order_items = []
@booking.booking_orders.each do |bo|

View File

@@ -8,7 +8,7 @@
<%= f.input :contact_no %>
<%= f.input :email %>
<%= f.input :date_of_birth %>
<%= f.input :membership_id, :collection => @membership %>
<%= f.input :membership_type %>
<%= f.input :membership_authentication_code %>
</div>

View File

@@ -71,6 +71,7 @@
<div class="form-group">
<%= f.select :membership_id, options_for_select(@membership.collect { |member|
[member["name"], member["id"]] }, 1), {}, { id: 'countries_select' } %>
<select class="selectpicker form-control col-md-6" name="membership_id">
<option>Select Member Group</option>
<% @membership.each do |member| %>