comee_core 0.1.89 → 0.1.91
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/clients_controller.rb +8 -1
- data/app/controllers/comee/core/customer_orders_controller.rb +11 -4
- data/app/controllers/comee/core/sales_orders_controller.rb +1 -1
- data/app/controllers/comee/core/shipment_items_controller.rb +12 -0
- data/app/models/comee/core/back_order.rb +1 -1
- data/app/models/comee/core/client.rb +1 -0
- data/app/models/comee/core/client_price.rb +1 -0
- data/app/models/comee/core/customer_order.rb +1 -1
- data/app/models/comee/core/customer_order_item.rb +1 -1
- data/app/models/comee/core/invoice.rb +1 -0
- data/app/models/comee/core/item_status.rb +1 -1
- data/app/models/comee/core/master_price.rb +1 -0
- data/app/models/comee/core/pickup_schedule.rb +4 -0
- data/app/models/comee/core/product.rb +1 -1
- data/app/models/comee/core/product_lookup.rb +1 -1
- data/app/models/comee/core/purchase_order.rb +1 -0
- data/app/models/comee/core/purchase_order_item.rb +1 -0
- data/app/models/comee/core/quotation_request.rb +1 -1
- data/app/models/comee/core/quotation_request_item.rb +1 -1
- data/app/models/comee/core/sales_order.rb +2 -0
- data/app/models/comee/core/sales_order_item.rb +5 -0
- data/app/models/comee/core/shipment_instruction.rb +1 -1
- data/app/models/comee/core/shipment_item.rb +1 -1
- data/app/models/comee/core/supplier.rb +1 -1
- data/app/models/comee/core/transport_availability.rb +1 -1
- data/app/models/comee/core/unit.rb +1 -1
- data/app/models/comee/core/warehouse_shipment.rb +1 -1
- data/app/serializers/comee/core/client_serializer.rb +1 -1
- data/app/serializers/comee/core/customer_order_serializer.rb +4 -1
- data/app/serializers/comee/core/sales_order_serializer.rb +1 -0
- data/app/services/comee/core/customer_order_service.rb +2 -1
- data/config/routes.rb +2 -0
- data/db/migrate/20230728123039_create_comee_core_clients.rb +1 -0
- data/db/migrate/20230811083239_create_comee_core_customer_orders.rb +5 -0
- data/db/migrate/20230812190652_create_comee_core_sales_orders.rb +4 -0
- data/lib/comee/core/version.rb +1 -1
- data/spec/factories/comee/core/clients.rb +1 -0
- data/spec/factories/comee/core/customer_orders.rb +5 -0
- data/spec/factories/comee/core/sales_orders.rb +1 -0
- metadata +2 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 14e262013c470d553126a6ecad9eb449dc01732b39cf3b683b4b7e6089f6cea4
|
4
|
+
data.tar.gz: bf5cca3975a004dbea56eab907497cc6d1006a7ae941ff0a9d7e4bd5578f8e79
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49c812d17aaee3068d9b677f814cc1b3d5b8da0f6e5313e6289a7942f6ea040a8a012d477fc9ed9d540aead752c3bfe650a29b110c2af30b7c6ea0fcf3cf5e0e
|
7
|
+
data.tar.gz: 5886c9b99451ba968ac667d77d130ea25740c57149edc9b28a3591eb8d2841bc963a97aa118257013e4a954ef608431c53a4b67e530173e19e63afab706300ff
|
@@ -8,10 +8,17 @@ module Comee
|
|
8
8
|
render json: {success: true, data: serialize(@clients)}
|
9
9
|
end
|
10
10
|
|
11
|
+
def consignees
|
12
|
+
client = Comee::Core::Client.find(params[:id])
|
13
|
+
render json: {success: true, data: client.consignees}
|
14
|
+
rescue StandardError => e
|
15
|
+
render json: {success: false, error: e.message}
|
16
|
+
end
|
17
|
+
|
11
18
|
private
|
12
19
|
|
13
20
|
def model_params
|
14
|
-
params.require(:payload).permit(:code, :name, :address, :locale, :user_id, :parent_id)
|
21
|
+
params.require(:payload).permit(:code, :name, :address, :locale, :user_id, :parent_id, consignees: [])
|
15
22
|
end
|
16
23
|
end
|
17
24
|
end
|
@@ -46,13 +46,20 @@ module Comee
|
|
46
46
|
private
|
47
47
|
|
48
48
|
def model_params
|
49
|
-
params.require(:payload)
|
50
|
-
|
49
|
+
params.require(:payload)
|
50
|
+
.permit(
|
51
|
+
:order_number, :order_date, :order_terms, :consignee, :final_destination, :final_delivery_date, :handover_date,
|
52
|
+
:shipping_date, :delivery_address, :invoice_address, :status, :client_id, :file
|
53
|
+
)
|
51
54
|
end
|
52
55
|
|
53
56
|
def create_with_item_params
|
54
|
-
params.require(:payload)
|
55
|
-
|
57
|
+
params.require(:payload)
|
58
|
+
.permit(
|
59
|
+
:order_number, :order_date, :order_terms, :consignee, :final_destination, :final_delivery_date, :handover_date,
|
60
|
+
:shipping_date, :delivery_address, :invoice_address, :status, :client_id,
|
61
|
+
items: %i[customer_item_no product_id quantity price unit_id delivery_date]
|
62
|
+
)
|
56
63
|
end
|
57
64
|
|
58
65
|
def set_service
|
@@ -54,7 +54,7 @@ module Comee
|
|
54
54
|
def model_params
|
55
55
|
params.require(:payload).permit(:order_number, :customer_order_id, :payment_penalty, :payment_term, :delivery_term, :status,
|
56
56
|
:fulfillment_center_id, :total_price, :amount_paid, :pallete_note, :handover_date, :remark,
|
57
|
-
files: [])
|
57
|
+
:client_id, files: [])
|
58
58
|
end
|
59
59
|
|
60
60
|
def back_order_params
|
@@ -8,6 +8,18 @@ module Comee
|
|
8
8
|
render json: {success: true, data: serialize(@shipment_item)}
|
9
9
|
end
|
10
10
|
|
11
|
+
def filter_for_client
|
12
|
+
shipment_items = Comee::Core::ShipmentItem.joins(sales_order_item: :sales_order)
|
13
|
+
.where(
|
14
|
+
comee_core_sales_order_items: {
|
15
|
+
comee_core_sales_orders: {
|
16
|
+
client_id: params[:id]
|
17
|
+
}
|
18
|
+
}
|
19
|
+
)
|
20
|
+
render json: {success: true, data: serialize(shipment_items)}
|
21
|
+
end
|
22
|
+
|
11
23
|
def filter_with_status
|
12
24
|
items = ShipmentItem.includes(sales_order_item: %i[sales_order product unit])
|
13
25
|
.ransack(params[:q]).result
|
@@ -14,7 +14,7 @@ module Comee
|
|
14
14
|
delegate(:name, to: :supplier, prefix: true)
|
15
15
|
|
16
16
|
def self.ransackable_attributes(_auth_object = nil)
|
17
|
-
%w[delivery_address delivery_date invoice_address order_date order_number status supplier_id]
|
17
|
+
%w[id delivery_address delivery_date invoice_address order_date order_number status supplier_id]
|
18
18
|
end
|
19
19
|
|
20
20
|
def self.ransackable_associations(_auth_object = nil)
|
@@ -10,7 +10,7 @@ module Comee
|
|
10
10
|
validates :order_number, :order_date, :delivery_address, :invoice_address, :status, presence: true
|
11
11
|
|
12
12
|
def self.ransackable_attributes(_auth_object = nil)
|
13
|
-
%w[client_id delivery_address invoice_address order_number status]
|
13
|
+
%w[id client_id delivery_address invoice_address order_number status]
|
14
14
|
end
|
15
15
|
|
16
16
|
def self.ransackable_associations(_auth_object = nil)
|
@@ -8,7 +8,7 @@ module Comee
|
|
8
8
|
validates :customer_item_no, :quantity, :price, :delivery_date, presence: true
|
9
9
|
|
10
10
|
def self.ransackable_attributes(_auth_object = nil)
|
11
|
-
%w[customer_order_id product_id unit_id]
|
11
|
+
%w[id customer_order_id product_id unit_id]
|
12
12
|
end
|
13
13
|
|
14
14
|
def self.ransackable_associations(_auth_object = nil)
|
@@ -14,7 +14,7 @@ module Comee
|
|
14
14
|
validates :status, inclusion: {in: STATUSES}
|
15
15
|
|
16
16
|
def self.ransackable_attributes(_auth_object = nil)
|
17
|
-
%w[hash_code status status_date sales_order_item_id]
|
17
|
+
%w[id hash_code status status_date sales_order_item_id]
|
18
18
|
end
|
19
19
|
|
20
20
|
def self.ransackable_associations(_auth_object = nil)
|
@@ -7,7 +7,7 @@ module Comee
|
|
7
7
|
validates :code, :item_description, presence: true
|
8
8
|
|
9
9
|
def self.ransackable_attributes(_auth_object = nil)
|
10
|
-
%w[code item_description itemable_id itemable_type product_id]
|
10
|
+
%w[id code item_description itemable_id itemable_type product_id]
|
11
11
|
end
|
12
12
|
|
13
13
|
def self.ransackable_associations(_auth_object = nil)
|
@@ -11,7 +11,7 @@ module Comee
|
|
11
11
|
validates :margin, presence: true, numericality: {greater_than_or_equal_to: 0, less_than_or_equal_to: 100}
|
12
12
|
|
13
13
|
def self.ransackable_attributes(_auth_object = nil)
|
14
|
-
%w[quotation_request_id product_id unit_id quantity price margin margin_type expected_delivery_date]
|
14
|
+
%w[id quotation_request_id product_id unit_id quantity price margin margin_type expected_delivery_date]
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
@@ -5,6 +5,7 @@ module Comee
|
|
5
5
|
|
6
6
|
belongs_to :customer_order
|
7
7
|
belongs_to :fulfillment_center, optional: true
|
8
|
+
belongs_to :client
|
8
9
|
has_many :sales_order_items
|
9
10
|
has_many_attached :files
|
10
11
|
has_one :customs_detail
|
@@ -30,6 +31,7 @@ module Comee
|
|
30
31
|
|
31
32
|
def self.ransackable_attributes(_auth_object = nil)
|
32
33
|
%w[
|
34
|
+
id
|
33
35
|
order_number
|
34
36
|
status
|
35
37
|
customer_order_id
|
@@ -15,6 +15,7 @@ module Comee
|
|
15
15
|
|
16
16
|
def self.ransackable_attributes(_auth_object = nil)
|
17
17
|
%w[
|
18
|
+
id
|
18
19
|
customer_item_no
|
19
20
|
customer_order_item_id
|
20
21
|
delivery_date
|
@@ -28,6 +29,10 @@ module Comee
|
|
28
29
|
unit_id
|
29
30
|
]
|
30
31
|
end
|
32
|
+
|
33
|
+
def self.ransackable_associations(_auth_object = nil)
|
34
|
+
%w[customer_order_item product sales_order source unit]
|
35
|
+
end
|
31
36
|
end
|
32
37
|
end
|
33
38
|
end
|
@@ -10,7 +10,7 @@ module Comee
|
|
10
10
|
validates :quantity, presence: true, numericality: {greater_than: 0}
|
11
11
|
|
12
12
|
def self.ransackable_attributes(_auth_object = nil)
|
13
|
-
%w[delivery_date handover_date pallet_no quantity sales_order_item_id shipment_status]
|
13
|
+
%w[id delivery_date handover_date pallet_no quantity sales_order_item_id shipment_status]
|
14
14
|
end
|
15
15
|
|
16
16
|
def self.ransackable_associations(_auth_object = nil)
|
@@ -10,7 +10,7 @@ module Comee
|
|
10
10
|
validates :destination, :delivery_date, :status, presence: true
|
11
11
|
|
12
12
|
def self.ransackable_attributes(_auth_object = nil)
|
13
|
-
%w[client_id delivery_date destination id reference_number status]
|
13
|
+
%w[id client_id delivery_date destination id reference_number status]
|
14
14
|
end
|
15
15
|
|
16
16
|
def self.ransackable_associations(_auth_object = nil)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Comee
|
2
2
|
module Core
|
3
3
|
class ClientSerializer < ActiveModel::Serializer
|
4
|
-
attributes :id, :code, :name, :address, :locale, :user_id, :user_name, :parent_id
|
4
|
+
attributes :id, :code, :name, :address, :locale, :user_id, :user_name, :parent_id, :consignees
|
5
5
|
end
|
6
6
|
end
|
7
7
|
end
|
@@ -1,7 +1,10 @@
|
|
1
1
|
module Comee
|
2
2
|
module Core
|
3
3
|
class CustomerOrderSerializer < ActiveModel::Serializer
|
4
|
-
attributes :id, :order_number, :order_date, :order_terms, :
|
4
|
+
attributes :id, :order_number, :order_date, :order_terms, :consignee, :final_destination, :final_delivery_date, :handover_date,
|
5
|
+
:shipping_date, :delivery_address, :invoice_address, :status, :file_url
|
6
|
+
|
7
|
+
belongs_to :client
|
5
8
|
has_many :customer_order_items
|
6
9
|
end
|
7
10
|
end
|
@@ -4,6 +4,7 @@ module Comee
|
|
4
4
|
attributes :id, :order_number, :payment_penalty, :status, :total_price, :payment_term, :delivery_term, :amount_paid, :pallete_note,
|
5
5
|
:handover_date, :remark, :files_url, :customs_detail
|
6
6
|
belongs_to :customer_order
|
7
|
+
belongs_to :client
|
7
8
|
belongs_to :fulfillment_center
|
8
9
|
has_many :sales_order_items
|
9
10
|
end
|
@@ -135,7 +135,8 @@ module Comee
|
|
135
135
|
sales_order = SalesOrder.create!(
|
136
136
|
order_number: order.order_number,
|
137
137
|
customer_order: order,
|
138
|
-
status: SalesOrder.statuses[:draft]
|
138
|
+
status: SalesOrder.statuses[:draft],
|
139
|
+
client: order.client
|
139
140
|
)
|
140
141
|
order_items = order.customer_order_items.includes(:product, :unit)
|
141
142
|
client_id = order.client.parent_id || order.client_id
|
data/config/routes.rb
CHANGED
@@ -81,6 +81,8 @@ Comee::Core::Engine.routes.draw do
|
|
81
81
|
member do
|
82
82
|
get "rfq_products", controller: :quotation_requests, action: :rfq_products_for_client
|
83
83
|
get "prices", controller: :client_prices, action: :fetch_for_client
|
84
|
+
get "consignees"
|
85
|
+
get "shipment_items", controller: :shipment_items, action: :filter_for_client
|
84
86
|
end
|
85
87
|
collection do
|
86
88
|
post "filter"
|
@@ -8,6 +8,11 @@ class CreateComeeCoreCustomerOrders < ActiveRecord::Migration[7.1]
|
|
8
8
|
index: {name: "client_on_cccuo_indx"},
|
9
9
|
foreign_key: {to_table: :comee_core_clients}
|
10
10
|
t.string :order_terms
|
11
|
+
t.string :consignee
|
12
|
+
t.string :final_destination
|
13
|
+
t.date :final_delivery_date
|
14
|
+
t.date :handover_date
|
15
|
+
t.date :shipping_date
|
11
16
|
t.string :delivery_address, null: false
|
12
17
|
t.string :invoice_address, null: false
|
13
18
|
t.integer :status, null: false, default: 0
|
@@ -10,6 +10,10 @@ class CreateComeeCoreSalesOrders < ActiveRecord::Migration[7.0]
|
|
10
10
|
null: true,
|
11
11
|
index: {name: "fc_on_ccso_indx"},
|
12
12
|
foreign_key: {to_table: :comee_core_fulfillment_centers}
|
13
|
+
t.references :client,
|
14
|
+
null: false,
|
15
|
+
index: {name: "client_on_ccso_indx"},
|
16
|
+
foreign_key: {to_table: :comee_core_clients}
|
13
17
|
t.string :payment_term
|
14
18
|
t.string :delivery_term
|
15
19
|
t.float :payment_penalty, null: false, default: 0.0
|
data/lib/comee/core/version.rb
CHANGED
@@ -4,6 +4,11 @@ FactoryBot.define do
|
|
4
4
|
order_date { Date.current }
|
5
5
|
client
|
6
6
|
order_terms { Faker::Lorem.sentence }
|
7
|
+
consignee { Faker::Name.name }
|
8
|
+
final_destination { Faker::Address.full_address }
|
9
|
+
final_delivery_date { Faker::Date.between(from: Date.current.advance(days: 20), to: Date.current.advance(months: 2)) }
|
10
|
+
handover_date { final_delivery_date.advance(days: -10) }
|
11
|
+
shipping_date { handover_date.advance(days: 10) }
|
7
12
|
delivery_address { Faker::Address.full_address }
|
8
13
|
invoice_address { Faker::Address.full_address }
|
9
14
|
status { 0 }
|
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.1.
|
4
|
+
version: 0.1.91
|
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-01-
|
11
|
+
date: 2024-01-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_model_serializers
|
@@ -240,34 +240,6 @@ dependencies:
|
|
240
240
|
- - ">="
|
241
241
|
- !ruby/object:Gem::Version
|
242
242
|
version: '0'
|
243
|
-
- !ruby/object:Gem::Dependency
|
244
|
-
name: spring
|
245
|
-
requirement: !ruby/object:Gem::Requirement
|
246
|
-
requirements:
|
247
|
-
- - ">="
|
248
|
-
- !ruby/object:Gem::Version
|
249
|
-
version: '0'
|
250
|
-
type: :development
|
251
|
-
prerelease: false
|
252
|
-
version_requirements: !ruby/object:Gem::Requirement
|
253
|
-
requirements:
|
254
|
-
- - ">="
|
255
|
-
- !ruby/object:Gem::Version
|
256
|
-
version: '0'
|
257
|
-
- !ruby/object:Gem::Dependency
|
258
|
-
name: spring-commands-rspec
|
259
|
-
requirement: !ruby/object:Gem::Requirement
|
260
|
-
requirements:
|
261
|
-
- - ">="
|
262
|
-
- !ruby/object:Gem::Version
|
263
|
-
version: '0'
|
264
|
-
type: :development
|
265
|
-
prerelease: false
|
266
|
-
version_requirements: !ruby/object:Gem::Requirement
|
267
|
-
requirements:
|
268
|
-
- - ">="
|
269
|
-
- !ruby/object:Gem::Version
|
270
|
-
version: '0'
|
271
243
|
description: An engine which contains core models and end-points for the COMee ERP.
|
272
244
|
email:
|
273
245
|
- henockl@live.com
|