comee_core 0.2.14 → 0.2.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/comee/core/sales_order_items_controller.rb +3 -2
- data/app/controllers/comee/core/sales_orders_controller.rb +11 -3
- data/app/models/comee/core/user.rb +1 -1
- data/app/services/comee/core/customer_order_service.rb +2 -2
- data/lib/comee/core/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 406c93dca731f87dea5f764260975fb10ea432aa054d6b619faaf0a4430af097
|
4
|
+
data.tar.gz: ca8d491fc263c2cd7abc3618f8dc1a54ff544137674936527ed3e2511c299033
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d77f8b9c8ab3e2dcf258faf3312a7f44698f608a7c59a7a024c3a361261b348f17c1868f7685579ffef5db0d63c1a76e95b2d81f8f1eca4c3cd2ef7216bbd37
|
7
|
+
data.tar.gz: c0ac3ee94586168c23566ca9ef133c4b092d66cf6ac764d152e1a5c8fb37f4ae051db50eaa4ab14f42efb7a4bb0198648a4e6d6a99c2f9fb60ce785f2f2b02c6
|
@@ -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], suggest_params[:
|
20
|
+
result = service.suggest_values(params[:id], suggest_params[:unit_id])
|
20
21
|
render json: {success: true, data: result}
|
21
22
|
end
|
22
23
|
|
@@ -34,7 +35,7 @@ module Comee
|
|
34
35
|
private
|
35
36
|
|
36
37
|
def suggest_params
|
37
|
-
params.
|
38
|
+
params.permit(:unit_id, :quantity)
|
38
39
|
end
|
39
40
|
|
40
41
|
def model_params
|
@@ -6,7 +6,7 @@ module Comee
|
|
6
6
|
|
7
7
|
def index
|
8
8
|
super do
|
9
|
-
data = SalesOrder.includes(:customer_order, :
|
9
|
+
data = SalesOrder.includes(:customer_order, :client, sales_order_items: :unit).order(created_at: :desc)
|
10
10
|
[
|
11
11
|
data,
|
12
12
|
fields: ["client", "customer_order", "sales_order_items", "sales_order_items.product", "sales_order_items.unit"]
|
@@ -14,12 +14,20 @@ module Comee
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
+
def show
|
18
|
+
super do
|
19
|
+
[
|
20
|
+
SalesOrder.includes(:customer_order, :client, sales_order_items: :unit).find(params[:id]),
|
21
|
+
fields: ["client", "customer_order", "sales_order_items", "sales_order_items.product", "sales_order_items.unit"]
|
22
|
+
]
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
17
26
|
def filter
|
18
27
|
data = SalesOrder.includes(
|
19
28
|
:customer_order,
|
20
29
|
:client,
|
21
|
-
:
|
22
|
-
:sales_order_items
|
30
|
+
sales_order_items: :unit
|
23
31
|
).ransack(params[:q]).result
|
24
32
|
render_content(data)
|
25
33
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Comee
|
2
2
|
module Core
|
3
3
|
class User < ApplicationRecord
|
4
|
-
enum :user_type, {supplier: 0, admin: 1, client: 2,
|
4
|
+
enum :user_type, {supplier: 0, admin: 1, client: 2, clerk: 3, order_manager: 4}
|
5
5
|
|
6
6
|
has_secure_password
|
7
7
|
has_many :notifications, as: :recipient, dependent: :destroy
|
@@ -71,11 +71,11 @@ module Comee
|
|
71
71
|
(quantity / conversion.factor).round
|
72
72
|
end
|
73
73
|
|
74
|
-
def suggest_values(item_id,
|
74
|
+
def suggest_values(item_id, new_unit_id)
|
75
75
|
item = CustomerOrderItem.includes(:customer_order).find_by(id: item_id)
|
76
76
|
raise(StandardError, "Order item with id `#{item_id}` not found.") unless item
|
77
77
|
|
78
|
-
quantity = convert_quantity(
|
78
|
+
quantity = convert_quantity(item.quantity, item.unit_id, new_unit_id)
|
79
79
|
client = Client.find(item.customer_order.client_id)
|
80
80
|
client_id = client.parent_id || client.id
|
81
81
|
client_price = ClientPrice.find_by(product_id: item.product_id, client_id: client_id)
|
data/lib/comee/core/version.rb
CHANGED
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.
|
4
|
+
version: 0.2.16
|
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-
|
11
|
+
date: 2024-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_model_serializers
|