comee_core 0.2.13 → 0.2.15

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5a4ecd52efb335b2688fb0fd381163d594b81de592ed48dcd5701ee28c00d10f
4
- data.tar.gz: 53ef139383420c858b4ce5afcb52974af1051cdb2086a83bcd28256311724a76
3
+ metadata.gz: a835077ddca4d1e18a7323eb5b5c4931e6c4291b579ab478a06793f7d060dfa6
4
+ data.tar.gz: e7b43c8a64d10355d66d72300f372174af183236b06c8b47dc8a420006716e8f
5
5
  SHA512:
6
- metadata.gz: aea590ef7c2567f4f8014bd7d18f4e77e81b735afb9fb64444d680b419d0548d20edbf62308d7f3bd5904fa4a225cabaf5b47649955934976183e6ffcb9a63e2
7
- data.tar.gz: 1a44e91626c5e3c1b3d5d37574bea1ab19fbf10c2993a31436bede678660d96862f6029735b70988eebbb39107039fb843b0a1c58f29045b983a733eee4c4386
6
+ metadata.gz: d87b04dd5d821f3db3c2b8612ea66616ecc5f538ee5aefc6bb12fc667b6851d383c0deb97576fc96a8cc72a54e83d239db4a66536d74abd68e6ec6c115689f6f
7
+ data.tar.gz: e4175296aa08b7b02481dfe0e88351d8102595a5c5c238c5fc78d8b0056c62255b607c80653d944d66b825b88a1b392d3d1ced614462bc1d13a603c8b58f021b
@@ -9,6 +9,7 @@ module Comee
9
9
  :sales_order,
10
10
  :customer_order_item,
11
11
  :source,
12
+ :product,
12
13
  :unit
13
14
  ).where(sales_order_id: params[:id])
14
15
  end
@@ -16,7 +17,7 @@ module Comee
16
17
 
17
18
  def suggest_values
18
19
  service = CustomerOrderService.new
19
- result = service.suggest_values(params[:id], params[:unit_id])
20
+ result = service.suggest_values(params[:id], suggest_params[:unit_id])
20
21
  render json: {success: true, data: result}
21
22
  end
22
23
 
@@ -33,6 +34,10 @@ module Comee
33
34
 
34
35
  private
35
36
 
37
+ def suggest_params
38
+ params.permit(:unit_id, :quantity)
39
+ end
40
+
36
41
  def model_params
37
42
  params.require(:payload).permit(:sales_order_id, :customer_order_item_id, :product_id, :unit_id, :quantity, :quantity_delivered,
38
43
  :customer_item_no, :customer_item_description, :price, :handover_date, :delivery_date,
@@ -6,7 +6,7 @@ module Comee
6
6
 
7
7
  def index
8
8
  super do
9
- data = SalesOrder.includes(:customer_order, :fulfillment_center, :sales_order_items, :client).all
9
+ data = SalesOrder.includes(:customer_order, :client, sales_order_items: :unit).all
10
10
  [
11
11
  data,
12
12
  fields: ["client", "customer_order", "sales_order_items", "sales_order_items.product", "sales_order_items.unit"]
@@ -18,8 +18,7 @@ module Comee
18
18
  data = SalesOrder.includes(
19
19
  :customer_order,
20
20
  :client,
21
- :fulfillment_center,
22
- :sales_order_items
21
+ sales_order_items: :unit
23
22
  ).ransack(params[:q]).result
24
23
  render_content(data)
25
24
  end
@@ -76,7 +76,9 @@ module Comee
76
76
  raise(StandardError, "Order item with id `#{item_id}` not found.") unless item
77
77
 
78
78
  quantity = convert_quantity(item.quantity, item.unit_id, new_unit_id)
79
- client_price = ClientPrice.find_by(product_id: item.product_id, client_id: item.customer_order.client_id)
79
+ client = Client.find(item.customer_order.client_id)
80
+ client_id = client.parent_id || client.id
81
+ client_price = ClientPrice.find_by(product_id: item.product_id, client_id: client_id)
80
82
  if client_price
81
83
  price = convert_price(client_price.price, client_price.unit_id, new_unit_id)
82
84
  else
data/config/routes.rb CHANGED
@@ -112,7 +112,7 @@ Comee::Core::Engine.routes.draw do
112
112
  end
113
113
  resources :sales_order_items, except: [:index] do
114
114
  member do
115
- get "suggest", controller: :sales_order_items, action: :suggest_values
115
+ post "suggest", controller: :sales_order_items, action: :suggest_values
116
116
  post "cancel"
117
117
  end
118
118
  end
@@ -1,5 +1,5 @@
1
1
  module Comee
2
2
  module Core
3
- VERSION = "0.2.13".freeze
3
+ VERSION = "0.2.15".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: comee_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.13
4
+ version: 0.2.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henock L.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-02-09 00:00:00.000000000 Z
11
+ date: 2024-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_model_serializers