Class: EducodeSales::IdeaRecyclesController
Instance Method Summary
collapse
#authenticate_admin, #authenticate_request, #current_user, #filter, #is_commissioner_above?, #paginate, #render_failure, #render_success, #subject_members, #subject_staffs, #subject_url
#add_businesses_score, #base_url, #collection_amount_score, #completion_rate, #current?, #disk_filename, #get_businesses_chart, #handled_data, #handled_time_data, #handled_time_data_accurate, #relative_path, #signed_amount_score, #storage_path, #url_to_avatar, #visits_score
Instance Method Details
#create ⇒ Object
64
65
|
# File 'app/controllers/educode_sales/idea_recycles_controller.rb', line 64
def create
end
|
#destroy ⇒ Object
78
79
80
81
|
# File 'app/controllers/educode_sales/idea_recycles_controller.rb', line 78
def destroy
@idea.recycle
render_success
end
|
#detail ⇒ Object
67
68
69
|
# File 'app/controllers/educode_sales/idea_recycles_controller.rb', line 67
def detail
render layout: false
end
|
#edit ⇒ Object
83
84
|
# File 'app/controllers/educode_sales/idea_recycles_controller.rb', line 83
def edit
end
|
#history ⇒ Object
71
72
73
|
# File 'app/controllers/educode_sales/idea_recycles_controller.rb', line 71
def history
render layout: false
end
|
#index ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
# File 'app/controllers/educode_sales/idea_recycles_controller.rb', line 8
def index
respond_to do |format|
format.html do
staff_ids = EducodeSales::Idea.all.pluck(:staff_id)
creator_ids = EducodeSales::Idea.all.pluck(:creator_id)
@creator_arr = EducodeSales::Staff.joins(:user).where(id: creator_ids).pluck("concat(users.lastname,users.firstname)", :id)
@staff_arr = EducodeSales::Staff.joins(:user).where(id: staff_ids).pluck("concat(users.lastname,users.firstname)", :id)
end
format.json do
@ideas = Idea.deleted
if params[:q] && params[:q][:created_at].present?
date = params[:q][:created_at].split(" - ")
@ideas = @ideas.where("educode_sales_ideas.created_at >= ? AND educode_sales_ideas.created_at <= ?", date[0] + " 00:00:00", date[1] + " 23:59:59")
end
if params[:q].present? && params[:q][:name].present?
@ideas = @ideas.where("educode_sales_ideas.name like ?", "%#{params[:q][:name]}%")
end
if params[:q].present? && params[:q][:school].present?
@ideas = @ideas.left_joins(:school).where("schools.name like ?", "%#{params[:q][:school]}%")
end
if params[:q].present? && params[:q][:creator_id].present?
@ideas = @ideas.where("educode_sales_ideas.creator_id = ?", params[:q][:creator_id].to_i)
end
if params[:q].present? && params[:q][:staff_id].present?
@ideas = @ideas.where("educode_sales_ideas.staff_id = ?", params[:q][:staff_id].to_i)
end
if params[:q].present? && params[:q][:status].present?
@ideas = @ideas.where(status: params[:q][:status])
end
if params[:q].present? && params[:q][:types].present?
@ideas = @ideas.where(types: params[:q][:types])
end
if params[:q].present? && params[:q][:model].present?
@ideas = @ideas.where(model: params[:q][:model])
end
if params[:q].present? && params[:q][:history_type].present?
if params[:q][:history_type].to_i == 0
@ideas = @ideas.where("educode_sales_ideas.history_type=#{params[:q][:history_type]} or educode_sales_ideas.history_type is null ")
else
@ideas = @ideas.where(history_type: params[:q][:history_type])
end
end
if params[:q].present? && params[:q][:level].present?
@ideas = @ideas.where(level: params[:q][:level])
end
@ideas = @ideas.page(params[:page]).per(params[:limit])
end
end
end
|
#new ⇒ Object
60
61
62
|
# File 'app/controllers/educode_sales/idea_recycles_controller.rb', line 60
def new
render layout: false
end
|
#update ⇒ Object
75
76
|
# File 'app/controllers/educode_sales/idea_recycles_controller.rb', line 75
def update
end
|