dscf-marketplace 0.2.98 → 0.2.99
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/controllers/dscf/marketplace/delivery_orders_controller.rb +39 -2
- data/app/controllers/dscf/marketplace/orders_controller.rb +14 -0
- data/app/controllers/dscf/marketplace/quotations_controller.rb +14 -0
- data/app/controllers/dscf/marketplace/request_for_quotations_controller.rb +14 -0
- data/app/models/dscf/marketplace/delivery_order.rb +23 -2
- data/lib/dscf/marketplace/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f3149c8bf4129b29d6b05fe56bd6e05517db77cb8ca06eef00ec7fae37cc5d64
|
4
|
+
data.tar.gz: 9c5e3d3f97ceb0503d07e0e35643ca81e7eb7fa6ea8a13ed5b5e85627c996ab7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32a35f9601525853e8b2f8ec0d4d0a5fdb3bb8b40d0c6caddd88c7565057efcbb02fe544b877b25618634332c8d5468b32a16dec6709e49c13798f66fed5ed6f
|
7
|
+
data.tar.gz: 8d744415e4936f1aeb6a0916e46ebdcf8786437735b05d0797d3ed2dbd0e49ddf4542ce758960cd84e75bb92c2cbe1d2227ee2b96df31ed91b65ba3e511c8aca
|
@@ -4,8 +4,45 @@ module Dscf
|
|
4
4
|
include Dscf::Core::Common
|
5
5
|
|
6
6
|
def index
|
7
|
-
|
8
|
-
|
7
|
+
# Custom implementation to avoid JSON field issues
|
8
|
+
delivery_orders = @clazz.all
|
9
|
+
|
10
|
+
# Apply Ransack filtering if q params present
|
11
|
+
if params[:q].present?
|
12
|
+
# Filter out any parameters that might reference JSON fields
|
13
|
+
filtered_params = params[:q].reject { |key, _| key.to_s.include?("optimized_route") }
|
14
|
+
if filtered_params.present?
|
15
|
+
delivery_orders = delivery_orders.ransack(filtered_params).result
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
# Apply eager loading if defined
|
20
|
+
delivery_orders = delivery_orders.includes(eager_loaded_associations) if eager_loaded_associations.present?
|
21
|
+
|
22
|
+
# Apply pagination if requested
|
23
|
+
if params[:page]
|
24
|
+
total_count = delivery_orders.count
|
25
|
+
delivery_orders = delivery_orders.then(&paginate)
|
26
|
+
total_pages = (total_count.to_f / per_page).ceil
|
27
|
+
count = delivery_orders.is_a?(Array) ? delivery_orders.length : delivery_orders.count
|
28
|
+
|
29
|
+
pagination_meta = {
|
30
|
+
current_page: page_no,
|
31
|
+
per_page: per_page,
|
32
|
+
count: count,
|
33
|
+
total_count: total_count,
|
34
|
+
total_pages: total_pages,
|
35
|
+
links: pagination_links(total_pages)
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
# Add serializer includes
|
40
|
+
includes = serializer_includes_for_action(:index)
|
41
|
+
options = {}
|
42
|
+
options[:include] = includes if includes.present?
|
43
|
+
options[:pagination] = pagination_meta if params[:page]
|
44
|
+
|
45
|
+
render_success(data: delivery_orders, serializer_options: options)
|
9
46
|
end
|
10
47
|
|
11
48
|
def pickup
|
@@ -3,6 +3,20 @@ module Dscf
|
|
3
3
|
class OrdersController < ApplicationController
|
4
4
|
include Dscf::Core::Common
|
5
5
|
|
6
|
+
def index
|
7
|
+
super do
|
8
|
+
# Get base query with proper filtering
|
9
|
+
orders = @clazz.all
|
10
|
+
|
11
|
+
# Apply Ransack filtering if q params present
|
12
|
+
if params[:q].present?
|
13
|
+
orders = orders.ransack(params[:q]).result
|
14
|
+
end
|
15
|
+
|
16
|
+
orders
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
6
20
|
def confirm
|
7
21
|
@obj = find_record
|
8
22
|
if @obj.confirm!
|
@@ -3,6 +3,20 @@ module Dscf
|
|
3
3
|
class QuotationsController < ApplicationController
|
4
4
|
include Dscf::Core::Common
|
5
5
|
|
6
|
+
def index
|
7
|
+
super do
|
8
|
+
# Get base query with proper filtering
|
9
|
+
quotations = @clazz.all
|
10
|
+
|
11
|
+
# Apply Ransack filtering if q params present
|
12
|
+
if params[:q].present?
|
13
|
+
quotations = quotations.ransack(params[:q]).result
|
14
|
+
end
|
15
|
+
|
16
|
+
quotations
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
6
20
|
def accept
|
7
21
|
@obj = find_record
|
8
22
|
if @obj.accept!
|
@@ -3,6 +3,20 @@ module Dscf
|
|
3
3
|
class RequestForQuotationsController < ApplicationController
|
4
4
|
include Dscf::Core::Common
|
5
5
|
|
6
|
+
def index
|
7
|
+
super do
|
8
|
+
# Get base query with proper filtering
|
9
|
+
rfqs = @clazz.all
|
10
|
+
|
11
|
+
# Apply Ransack filtering if q params present
|
12
|
+
if params[:q].present?
|
13
|
+
rfqs = rfqs.ransack(params[:q]).result
|
14
|
+
end
|
15
|
+
|
16
|
+
rfqs
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
6
20
|
def create
|
7
21
|
obj = @clazz.new(model_params)
|
8
22
|
if obj.save
|
@@ -23,10 +23,31 @@ module Dscf::Marketplace
|
|
23
23
|
%w[id driver_id pickup_address_id delivery_vehicle_id status vehicle_type estimated_delivery_price actual_delivery_price estimated_delivery_time actual_delivery_time delivery_notes created_at updated_at]
|
24
24
|
end
|
25
25
|
|
26
|
-
# Override ransack to handle JSON fields
|
26
|
+
# Override ransack to handle JSON fields and filtering
|
27
27
|
def self.ransack(params = {}, options = {})
|
28
28
|
params ||= {}
|
29
|
-
|
29
|
+
|
30
|
+
# Remove JSON fields that can't be filtered
|
31
|
+
filtered_params = params.except("optimized_route")
|
32
|
+
|
33
|
+
# Also remove any q parameters that reference JSON fields
|
34
|
+
if filtered_params["q"].present?
|
35
|
+
q_params = filtered_params["q"]
|
36
|
+
# Remove any predicates that reference the optimized_route field
|
37
|
+
q_params = q_params.reject { |key, _| key.to_s.include?("optimized_route") }
|
38
|
+
filtered_params["q"] = q_params
|
39
|
+
end
|
40
|
+
|
41
|
+
# Call super with filtered params
|
42
|
+
result = super(filtered_params, options)
|
43
|
+
|
44
|
+
# If result is a relation, ensure we don't select JSON fields that might cause issues
|
45
|
+
if result.is_a?(ActiveRecord::Relation)
|
46
|
+
# Force selection of only the columns we want to avoid JSON field issues
|
47
|
+
result = result.select(column_names - [ "optimized_route" ])
|
48
|
+
end
|
49
|
+
|
50
|
+
result
|
30
51
|
end
|
31
52
|
|
32
53
|
def self.ransackable_associations(_auth_object = nil)
|