update oqs

This commit is contained in:
Aung Myo
2017-08-11 12:15:30 +06:30
23 changed files with 345 additions and 303 deletions

View File

@@ -65,6 +65,7 @@ class Crm::CustomersController < BaseCrmController
# GET /crm/customers/1/edit
def edit
@customer = Customer.find(params[:id])
end
# POST /crm/customers
@@ -78,7 +79,7 @@ class Crm::CustomersController < BaseCrmController
if @crm_customers.save
# update tax profile
customer = Customer.find(@crm_customers.customer_id)
customer.update_attributes(tax_profiles: params[:customer][:tax_profiles].to_json)
customer.update_attributes(tax_profiles: params[:customer][:tax_profiles])
name = customer_params[:name]
phone = customer_params[:contact_no]
email = customer_params[:email]
@@ -195,10 +196,12 @@ end
# PATCH/PUT /crm/customers/1
# PATCH/PUT /crm/customers/1.json
def update
# Remove "" default first
params[:customer][:tax_profiles].delete_at(0)
respond_to do |format|
if @crm_customer.update(customer_params)
# update tax profile
@crm_customer.update_attributes(tax_profiles: params[:customer][:tax_profiles])
name = customer_params[:name]
phone = customer_params[:contact_no]
email = customer_params[:email]

View File

@@ -98,7 +98,7 @@ class Oqs::HomeController < BaseOqsController
left join booking_orders as bo on bo.order_id = assigned_order_items.order_id
left join bookings as bk on bk.booking_id = bo.booking_id
left join dining_facilities as df on df.id = bk.dining_facility_id")
.where("assigned_order_items.delivery_status = #{status} AND odt.price <> 0 AND assigned_order_items.created_at >= '#{Time.now.beginning_of_day.utc}'")
.where("assigned_order_items.delivery_status = 0 AND odt.price <> 0 AND assigned_order_items.created_at >= '#{Time.now.beginning_of_day.utc}'")
.group("assigned_order_items.assigned_order_item_id")
.order("assigned_order_items.created_at")
end

View File

@@ -101,9 +101,9 @@ class Oqs::HomeController < BaseOqsController
if oqs_id == nil
oqs = ''
else
oqs = " and assigned_order_items.order_queue_station_id = '#{oqs_id}' "
oqs = "and assigned_order_items.order_queue_station_id = '#{oqs_id}' "
end
AssignedOrderItem.select("assigned_order_items.assigned_order_item_id, oqs.id as station_id, oqs.station_name, oqs.is_active, oqpz.zone_id, df.name as zone, df.type, odt.order_id, odt.item_code, odt.item_name, odt.price, odt.qty, odt.item_order_by, odt.options, cus.name as customer_name, odt.created_at")
AssignedOrderItem.select("assigned_order_items.assigned_order_item_id, oqs.id as station_id, oqs.station_name, oqs.is_active, oqpz.zone_id, df.name as zone, df.type as type, odt.order_id, odt.item_code, odt.item_name, odt.price, odt.qty, odt.item_order_by, odt.options, cus.name as customer_name, odt.created_at")
.joins(" left join order_queue_stations as oqs on oqs.id = assigned_order_items.order_queue_station_id
left join order_queue_process_by_zones as oqpz on oqpz.order_queue_station_id = oqs.id
left join orders as od ON od.order_id = assigned_order_items.order_id
@@ -112,8 +112,10 @@ class Oqs::HomeController < BaseOqsController
left join booking_orders as bo on bo.order_id = assigned_order_items.order_id
left join bookings as bk on bk.booking_id = bo.booking_id
left join dining_facilities as df on df.id = bk.dining_facility_id")
.where("assigned_order_items.delivery_status = #{status} AND odt.price <> 0 AND assigned_order_items.created_at >= '#{Time.now.beginning_of_day.utc}'#{oqs}")
.where("assigned_order_items.delivery_status = #{status} AND odt.price <> 0 AND assigned_order_items.created_at >= '#{Time.now.beginning_of_day.utc}' #{oqs}")
.group("assigned_order_items.assigned_order_item_id")
.order("assigned_order_items.created_at")
end
# Completed Order

View File

@@ -37,14 +37,14 @@ class Origami::CustomersController < BaseOrigamiController
@crm_customers = Customer.order("customer_id").page(params[:page])
#@products = Product.order("name").page(params[:page]).per(5)
else
@crm_customers = Customer.search(filter)
@crm_customers = Customer.search(filter)
end
#@crm_customers = Customer.all
@crm_customers = Kaminari.paginate_array(@crm_customers).page(params[:page]).per(50)
@crm_customer = Customer.new
@count_customer = Customer.count_customer
@taxes = TaxProfile.all.order("order_by asc")
# if flash["errors"]
# @crm_customer.valid?
# end