fix conflit

This commit is contained in:
Zin Lin Phyo
2017-08-28 18:22:32 +06:30
26 changed files with 644 additions and 253 deletions

View File

@@ -4,8 +4,25 @@ class Api::Restaurant::MenuController < Api::ApiController
# Pull the default menu details and also other available (active) menus
# Input Params - order_id
def index
@menus = Menu.all
# @current_menu = Menu.current_menu
param_checksum = params[:checksum]
# checksum = File.readlines("public/checksums/menu_json.txt").pop.chomp
all_menu = Menu.all
# to hash
menu_array = []
all_menu.each do |m|
menu_array.push(m.to_json(:include => {:menu_categories => { :include => { :menu_items => { :include => [:menu_item_sets, :menu_item_instances => {:include => :menu_instance_item_sets}]} } }}))
end
#export Checksum file generate by md5
menu_checksum = Digest::MD5.hexdigest(menu_array.to_json)
if menu_checksum != param_checksum
response.headers['CHECKSUM'] = menu_checksum
@menus = all_menu
end
# @current_menu = Menu.current_menu
end
#Description

View File

@@ -6,13 +6,33 @@ class Crm::CustomersController < BaseCrmController
# GET /crm/customers.json
def index
filter = params[:filter]
type = params[:type]
if filter.nil?
@crm_customers = Customer.all
else
@crm_customers = Customer.search(filter)
# search account no from paypar
if !@crm_customers.present? && type == "card"
response = Customer.search_paypar_account_no(filter)
if response["status"] == true
@crm_customers = Customer.new
@crm_customers.name = response["customer_data"]["name"]
@crm_customers.contact_no = response["customer_data"]["phone"]
@crm_customers.email = response["customer_data"]["email"]
@crm_customers.date_of_birth = response["customer_data"]["DOB"]
@crm_customers.nrc_no = response["customer_data"]["NRC"]
@crm_customers.address = response["customer_data"]["address"]
@crm_customers.card_no = response["customer_data"]["customer_card_no"]
@crm_customers.paypar_account_no = filter
@crm_customers.membership_id = response["customer_data"]["id"]
@crm_customers.membership_type = response["customer_data"]["member_group_id"]
@crm_customers.customer_type = "Dinein"
@crm_customers.tax_profiles = ["1", "2"]
@crm_customers.save
@crm_customers = Customer.search(filter)
end
end
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

View File

@@ -9,13 +9,40 @@ class Origami::CustomersController < BaseOrigamiController
end
def get_customer
filter = params[:filter]
type = params[:type]
if filter.nil?
@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)
# search account no from paypar
if !@crm_customers.present? && type == "card"
response = Customer.search_paypar_account_no(filter)
if response["status"] == true
@crm_customers = Customer.new
@crm_customers.name = response["customer_data"]["name"]
@crm_customers.contact_no = response["customer_data"]["phone"]
@crm_customers.email = response["customer_data"]["email"]
@crm_customers.date_of_birth = response["customer_data"]["DOB"]
@crm_customers.nrc_no = response["customer_data"]["NRC"]
@crm_customers.address = response["customer_data"]["address"]
@crm_customers.card_no = response["customer_data"]["customer_card_no"]
@crm_customers.paypar_account_no = filter
@crm_customers.membership_id = response["customer_data"]["id"]
@crm_customers.membership_type = response["customer_data"]["member_group_id"]
@crm_customers.customer_type = "Dinein"
@crm_customers.tax_profiles = ["1", "2"]
@crm_customers.save
@crm_customers = Customer.search(filter)
else
@crm_customers = [{"customer_id": response["status"],"message": response["message"] }]
end
end
end
render :json => @crm_customers.to_json
end

View File

@@ -8,9 +8,10 @@ class Origami::InJutiesController < BaseOrigamiController
end
def index_in_juty
@juties_in= InJuty.where("dinning_id=?",params[:table_id])
@juty_in= InJuty.where("dinning_id=?",params[:table_id])
@table = DiningFacility.find(params[:table_id])
@in_juty = InJuty.new
@juties_in = Kaminari.paginate_array(@juty_in).page(params[:page]).per(10)
end
# GET /in_juties/1
@@ -31,6 +32,9 @@ class Origami::InJutiesController < BaseOrigamiController
def edit_in_juty
@in_juty = InJuty.find(params[:id])
@table = DiningFacility.find(params[:table_id])
@commissioner = @in_juty.commissioner
render json: {in_juty: @in_juty, commissioner: @commissioner}
end
def assign_in_juty
@@ -89,12 +93,19 @@ class Origami::InJutiesController < BaseOrigamiController
end
def update_for_in_juty
@in_juty.dinning_id = params[:dining_id]
@in_juty.commissioner_ids = params[:commissioner_ids]
@in_juty.in_time = params[:in_time]
@in_juty.out_time = params[:out_time]
@in_juty.save
def update_for_in_juty
@in_juty.commissioner_ids = in_juty_params[:commissioner_ids]
@in_juty.in_time = in_juty_params[:in_time]
@in_juty.out_time = in_juty_params[:out_time]
respond_to do |format|
if @in_juty.save
format.html { redirect_to origami_index_in_juty_path(in_juty_params[:dinning_id]), notice: 'In juty was successfully updated.' }
format.json { render :show, status: :ok, location: @in_juty }
else
format.html { render :edit }
format.json { render json: @in_juty.errors, status: :unprocessable_entity }
end
end
end
# DELETE /in_juties/1
@@ -125,6 +136,6 @@ class Origami::InJutiesController < BaseOrigamiController
# Never trust parameters from the scary internet, only allow the white list through.
def in_juty_params
params.require(:in_juty).permit(:dinning_id,:commissioner_ids,:in_time,:out_time)
params.require(:in_juty).permit(:id,:dinning_id,:commissioner_ids,:in_time,:out_time)
end
end

View File

@@ -79,7 +79,7 @@ class Settings::SimpleMenuItemsController < ApplicationController
respond_to do |format|
if @settings_menu_item.save
menu_item = MenuItem.find(@settings_menu_item.id)
menu_item.update_attributes(item_options: params[:simple_menu_item][:item_options])
menu_item.update_attributes(item_attributes: params[:simple_menu_item][:item_attributes], item_options: params[:simple_menu_item][:item_options])
format.html { redirect_to settings_menu_category_simple_menu_items_path, notice: 'Menu item was successfully created.' }
format.json { render :show, status: :created, location: @settings_menu_item }