Class: Comee::Core::QuotationRequestsController
Instance Method Summary
collapse
Methods included from Common
#create, #show, #update
Methods included from Pagination
#default_per_page, #order_by, #order_direction, #page_no, #paginate, #paginate_offset, #per_page
#application_code, #authenticate, #current_application, #current_user, #render_content, #render_error, #skip_bullet
Instance Method Details
#confirm ⇒ Object
48
49
50
51
52
53
54
|
# File 'app/controllers/comee/core/quotation_requests_controller.rb', line 48
def confirm
service = QuotationRequestService.new
rfq = service.confirm(params[:id])
render_content(rfq)
rescue StandardError => e
render json: {success: false, error: e.message}
end
|
#convert ⇒ Object
56
57
58
59
60
61
62
|
# File 'app/controllers/comee/core/quotation_requests_controller.rb', line 56
def convert
service = QuotationRequestService.new
order = service.convert_to_order(params[:id])
render_content(order)
rescue StandardError => e
render json: {success: false, error: e.message}
end
|
#create_request_with_items ⇒ Object
25
26
27
28
29
30
|
# File 'app/controllers/comee/core/quotation_requests_controller.rb', line 25
def create_request_with_items
service = QuotationRequestService.new
parameters = rfq_params.to_h.deep_symbolize_keys
result = service.create_request_with_items(parameters)
render_content(result)
end
|
#filter ⇒ Object
12
13
14
15
|
# File 'app/controllers/comee/core/quotation_requests_controller.rb', line 12
def filter
data = QuotationRequest.includes(:client).ransack(params[:q]).result
render_content(data)
end
|
#index ⇒ Object
6
7
8
9
10
|
# File 'app/controllers/comee/core/quotation_requests_controller.rb', line 6
def index
super do
QuotationRequest.includes(:client).all
end
end
|
#rfq_products_for_client ⇒ Object
17
18
19
20
21
22
23
|
# File 'app/controllers/comee/core/quotation_requests_controller.rb', line 17
def rfq_products_for_client
client_products = ClientPrice.includes(:product).where(client_id: params[:id]).map(&:product_id)
root = Product.roots.first
ids = root.indirect_ids - client_products
products = Product.where(id: ids)
render_content(products)
end
|
#submit ⇒ Object
32
33
34
35
36
37
38
|
# File 'app/controllers/comee/core/quotation_requests_controller.rb', line 32
def submit
service = QuotationRequestService.new
rfq = service.submit(params[:id])
render_content(rfq)
rescue StandardError => e
render json: {success: false, error: e.message}
end
|
#submit_for_confirmation ⇒ Object
40
41
42
43
44
45
46
|
# File 'app/controllers/comee/core/quotation_requests_controller.rb', line 40
def submit_for_confirmation
service = QuotationRequestService.new
rfq = service.submit_for_confirmation(params[:id])
render_content(rfq)
rescue StandardError => e
render json: {success: false, error: e.message}
end
|