comee_core 0.2.66 → 0.2.68
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/client_addresses_controller.rb +19 -0
- data/app/controllers/comee/core/lookups_controller.rb +5 -0
- data/app/controllers/comee/core/sales_orders_controller.rb +1 -1
- data/app/models/comee/core/client.rb +0 -2
- data/app/models/comee/core/client_address.rb +17 -0
- data/app/models/comee/core/lookup.rb +13 -0
- data/app/models/comee/core/sales_order_item.rb +7 -0
- data/app/serializers/comee/core/client_address_serializer.rb +10 -0
- data/app/serializers/comee/core/sales_order_serializer.rb +2 -2
- data/app/services/comee/core/customer_order_service.rb +1 -0
- data/config/routes.rb +7 -1
- data/db/migrate/20240503040722_create_comee_core_client_addresses.rb +22 -0
- data/lib/comee/core/version.rb +1 -1
- data/spec/factories/comee/core/client_addresses.rb +12 -0
- data/spec/factories/comee/core/lookups.rb +4 -0
- data/spec/factories/comee/core/purchase_requisitions.rb +1 -0
- data/spec/factories/comee/core/sales_orders.rb +1 -0
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab2d82a34a3aad80165cbc56181be22e2715c189f1d6aecf3c474ca6110f458c
|
4
|
+
data.tar.gz: 4e0afeec82d9fb90448af1f50549ba94ea61c9dd6dc00484a55ab298f0194a0c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b77c2dcbf7768677a83f38fc8008b4f85a3d7bab5491c78bfdffcfe3656adc6979c23ac1dd9700f96200832d52ed9991699f77a87f86da7af0396cb285764732
|
7
|
+
data.tar.gz: 4114959e1d7f60e86bd0abe1285448ba97f75e341185ba5db66cd4a26d405092afbe65815cb480205d718d5f05c209381e282d4167060168c448a59a8e39e4ac
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Comee
|
2
|
+
module Core
|
3
|
+
class ClientAddressesController < ApplicationController
|
4
|
+
include Common
|
5
|
+
|
6
|
+
def index
|
7
|
+
super do
|
8
|
+
ClientAddress.where(client_id: params[:id])
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def model_params
|
15
|
+
params.require(:payload).permit(:client_id, :address_line1, :street, :city, :state, :country_id, :postal_code, :address_type)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -123,7 +123,7 @@ module Comee
|
|
123
123
|
params.require(:payload).permit(:order_number, :order_date, :customer_order_id, :fulfillment_center_id, :client_id,
|
124
124
|
:order_terms, :shipment_address, :delivery_address, :invoice_address, :destination,
|
125
125
|
:handover_date, :shipping_date, :delivery_date, :consignee, :payment_term, :delivery_term,
|
126
|
-
:payment_penalty, :status, :total_price, :amount_paid, :pallete_note, :remark,
|
126
|
+
:payment_penalty, :status, :purchase_status, :total_price, :amount_paid, :pallete_note, :remark,
|
127
127
|
files: [])
|
128
128
|
end
|
129
129
|
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Comee
|
2
|
+
module Core
|
3
|
+
class ClientAddress < ApplicationRecord
|
4
|
+
SHIPPING_ADDRESS = "Shipping Address".freeze
|
5
|
+
DELIVERY_ADDRESS = "Delivery Address".freeze
|
6
|
+
INVOICING_ADDRESS = "Invoicing Address".freeze
|
7
|
+
|
8
|
+
ADDRESS_TYPES = [SHIPPING_ADDRESS, DELIVERY_ADDRESS, INVOICING_ADDRESS].freeze
|
9
|
+
|
10
|
+
belongs_to :client
|
11
|
+
belongs_to :country, -> { where(lookup_type: :country) }, class_name: "Comee::Core::Lookup"
|
12
|
+
|
13
|
+
validates :address_line1, :address_type, presence: true
|
14
|
+
validates :address_type, inclusion: {in: ADDRESS_TYPES}
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -3,6 +3,19 @@ module Comee
|
|
3
3
|
class Lookup < ApplicationRecord
|
4
4
|
validates :code, :name, :lookup_type, presence: true
|
5
5
|
validates :code, uniqueness: {scope: :lookup_type}
|
6
|
+
|
7
|
+
def self.ransackable_attributes(_auth_object = nil)
|
8
|
+
%w[
|
9
|
+
id
|
10
|
+
code
|
11
|
+
name
|
12
|
+
lookup_type
|
13
|
+
]
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.ransackable_associations(_auth_object = nil)
|
17
|
+
[]
|
18
|
+
end
|
6
19
|
end
|
7
20
|
end
|
8
21
|
end
|
@@ -2,6 +2,7 @@ module Comee
|
|
2
2
|
module Core
|
3
3
|
class SalesOrderItem < ApplicationRecord
|
4
4
|
before_save :calculate_total_price
|
5
|
+
before_save :calculate_handover_date
|
5
6
|
after_save :update_sales_order_purchase_status, if: proc { |item| item.fully_processed? }
|
6
7
|
|
7
8
|
enum processing_status: {unprocessed: 0, partially_processed: 1, fully_processed: 2}
|
@@ -20,6 +21,12 @@ module Comee
|
|
20
21
|
|
21
22
|
delegate(:po_number, to: :purchase_order_item, prefix: false, allow_nil: true)
|
22
23
|
|
24
|
+
def calculate_handover_date
|
25
|
+
return if handover_date
|
26
|
+
|
27
|
+
self.handover_date = sales_order.handover_date
|
28
|
+
end
|
29
|
+
|
23
30
|
def calculate_total_price
|
24
31
|
self.total_price = price * quantity
|
25
32
|
end
|
@@ -3,8 +3,8 @@ module Comee
|
|
3
3
|
class SalesOrderSerializer < ActiveModel::Serializer
|
4
4
|
attributes :id, :order_number, :order_date, :order_terms, :shipment_address, :delivery_address, :invoice_address,
|
5
5
|
:destination, :handover_date, :shipping_date, :delivery_date, :consignee, :parent_client_name, :payment_term,
|
6
|
-
:delivery_term, :payment_penalty, :status, :total_price, :amount_paid, :pallete_note,
|
7
|
-
:files_url
|
6
|
+
:delivery_term, :payment_penalty, :status, :purchase_status, :total_price, :amount_paid, :pallete_note,
|
7
|
+
:remark, :created_by, :files_url
|
8
8
|
belongs_to :customer_order
|
9
9
|
belongs_to :client
|
10
10
|
belongs_to :fulfillment_center
|
data/config/routes.rb
CHANGED
@@ -31,7 +31,11 @@ Comee::Core::Engine.routes.draw do
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
-
resources :lookups
|
34
|
+
resources :lookups do
|
35
|
+
collection do
|
36
|
+
post "filter"
|
37
|
+
end
|
38
|
+
end
|
35
39
|
resources :quotation_requests do
|
36
40
|
collection do
|
37
41
|
post "filter"
|
@@ -77,6 +81,7 @@ Comee::Core::Engine.routes.draw do
|
|
77
81
|
end
|
78
82
|
resources :unit_conversions
|
79
83
|
resources :users
|
84
|
+
resources :client_addresses
|
80
85
|
resources :clients do
|
81
86
|
member do
|
82
87
|
get "rfq_products", controller: :quotation_requests, action: :rfq_products_for_client
|
@@ -84,6 +89,7 @@ Comee::Core::Engine.routes.draw do
|
|
84
89
|
get "consignees"
|
85
90
|
get "agents"
|
86
91
|
get "shipment_items", controller: :shipment_items, action: :filter_for_client
|
92
|
+
get "addresses", controller: :client_addresses, action: :index
|
87
93
|
post "create_agent"
|
88
94
|
post "create_contact"
|
89
95
|
post "price", controller: :client_prices, action: :fetch_one
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class CreateComeeCoreClientAddresses < ActiveRecord::Migration[7.1]
|
2
|
+
def change
|
3
|
+
create_table :comee_core_client_addresses do |t|
|
4
|
+
t.references :client,
|
5
|
+
null: false,
|
6
|
+
index: {name: "cl_on_ccca_indx"},
|
7
|
+
foreign_key: {to_table: :comee_core_clients}
|
8
|
+
t.string :address_line1, null: false
|
9
|
+
t.string :street
|
10
|
+
t.string :city
|
11
|
+
t.string :state
|
12
|
+
t.references :country,
|
13
|
+
null: false,
|
14
|
+
index: {name: "country_on_ccca_indx"},
|
15
|
+
foreign_key: {to_table: :comee_core_lookups}
|
16
|
+
t.string :postal_code
|
17
|
+
t.string :address_type, null: false
|
18
|
+
|
19
|
+
t.timestamps
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/lib/comee/core/version.rb
CHANGED
@@ -0,0 +1,12 @@
|
|
1
|
+
FactoryBot.define do
|
2
|
+
factory :client_address, class: "Comee::Core::ClientAddress" do
|
3
|
+
client
|
4
|
+
address_line1 { Faker::Address.street_address }
|
5
|
+
street { Faker::Address.street_name }
|
6
|
+
city { Faker::Address.city }
|
7
|
+
state { Faker::Address.state }
|
8
|
+
country
|
9
|
+
postal_code { Faker::Address.postcode }
|
10
|
+
address_type { Comee::Core::ClientAddress::SHIPPING_ADDRESS }
|
11
|
+
end
|
12
|
+
end
|
@@ -19,6 +19,7 @@ FactoryBot.define do
|
|
19
19
|
delivery_term { Faker::Lorem.sentence }
|
20
20
|
payment_penalty { 0 }
|
21
21
|
status { Comee::Core::SalesOrder.statuses[:draft] }
|
22
|
+
purchase_status { Comee::Core::SalesOrder.purchase_statuses[:unprocessed] }
|
22
23
|
total_price { 0 }
|
23
24
|
amount_paid { 0 }
|
24
25
|
pallete_note { Faker::Lorem.sentence }
|
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.68
|
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-05-
|
11
|
+
date: 2024-05-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_model_serializers
|
@@ -268,6 +268,7 @@ files:
|
|
268
268
|
- app/controllers/comee/core/agents_controller.rb
|
269
269
|
- app/controllers/comee/core/application_controller.rb
|
270
270
|
- app/controllers/comee/core/back_orders_controller.rb
|
271
|
+
- app/controllers/comee/core/client_addresses_controller.rb
|
271
272
|
- app/controllers/comee/core/client_prices_controller.rb
|
272
273
|
- app/controllers/comee/core/client_warehouses_controller.rb
|
273
274
|
- app/controllers/comee/core/clients_controller.rb
|
@@ -305,6 +306,7 @@ files:
|
|
305
306
|
- app/models/comee/core/back_order.rb
|
306
307
|
- app/models/comee/core/back_order_item.rb
|
307
308
|
- app/models/comee/core/client.rb
|
309
|
+
- app/models/comee/core/client_address.rb
|
308
310
|
- app/models/comee/core/client_order.rb
|
309
311
|
- app/models/comee/core/client_price.rb
|
310
312
|
- app/models/comee/core/client_warehouse.rb
|
@@ -358,6 +360,7 @@ files:
|
|
358
360
|
- app/models/comee/core/user_application_role.rb
|
359
361
|
- app/notifications/comee/core/back_order_notification.rb
|
360
362
|
- app/serializers/comee/core/agent_serializer.rb
|
363
|
+
- app/serializers/comee/core/client_address_serializer.rb
|
361
364
|
- app/serializers/comee/core/client_price_serializer.rb
|
362
365
|
- app/serializers/comee/core/client_serializer.rb
|
363
366
|
- app/serializers/comee/core/client_warehouse_serializer.rb
|
@@ -459,6 +462,7 @@ files:
|
|
459
462
|
- db/migrate/20240328132921_create_comee_core_supplier_payments.rb
|
460
463
|
- db/migrate/20240407083617_create_comee_core_email_settings.rb
|
461
464
|
- db/migrate/20240425121701_add_purchase_status_to_sales_order_and_purchase_requisition.rb
|
465
|
+
- db/migrate/20240503040722_create_comee_core_client_addresses.rb
|
462
466
|
- lib/comee/core.rb
|
463
467
|
- lib/comee/core/engine.rb
|
464
468
|
- lib/comee/core/version.rb
|
@@ -469,6 +473,7 @@ files:
|
|
469
473
|
- spec/factories/comee/core/application_modules.rb
|
470
474
|
- spec/factories/comee/core/back_order_items.rb
|
471
475
|
- spec/factories/comee/core/back_orders.rb
|
476
|
+
- spec/factories/comee/core/client_addresses.rb
|
472
477
|
- spec/factories/comee/core/client_orders.rb
|
473
478
|
- spec/factories/comee/core/client_prices.rb
|
474
479
|
- spec/factories/comee/core/client_warehouses.rb
|