fix conflit
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user