comee_core 0.2.67 → 0.2.69

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: 42a4484f045bd64b57ff6277774d9629f31057f41a16c12026c9bfdf8efc4098
4
- data.tar.gz: ea1ea191cee2d8a56c65923494b5929df440464d183af5f3cb549cb6ff23134d
3
+ metadata.gz: 74921123f91d339e91741022299541c1107ff0274dcb7938dee8695d439a313b
4
+ data.tar.gz: b1171966b657b2c7fd7599850d82c45c7889d1ed94bec88198782ab5c804ede5
5
5
  SHA512:
6
- metadata.gz: 44d299831b095bd8814997d9e51460c114a766754257e78ec9d2cee0577a676cc1a252512a74ff2f38d33eeb6b59fda695cff8b6bedcacc8521f70c9e8844080
7
- data.tar.gz: b097d47b965827a678d8ba76e0f6162a270d679831ea7f74ff81a5e9903f76738a4313408e97d3652be9b6aa9d64f972d66bc924dc16ebe8caa01e3c340f0654
6
+ metadata.gz: 94dc79dc40f09727f75082e96a1fc911a764e1c8f6487ed8a5e945d225bed195667d30bc787bc537590041e01d2a385d2c5664e58cde3a0271ede531c55ed7b4
7
+ data.tar.gz: ca6aed0196dd4719be4c7a009908a1ae30cc8923b235e7dc037fb7dfad6560f39ae2ad3e802aa53da47c59b996ce76117175b96df1b4ba1d882a9eee532bb9e1
@@ -0,0 +1,13 @@
1
+ module Comee
2
+ module Core
3
+ class ApplicationModulesController < ApplicationController
4
+ include Common
5
+
6
+ private
7
+
8
+ def model_params
9
+ params.require(:payload).permit(:code, :name)
10
+ end
11
+ end
12
+ end
13
+ end
@@ -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
@@ -3,6 +3,11 @@ module Comee
3
3
  class LookupsController < ApplicationController
4
4
  include Common
5
5
 
6
+ def filter
7
+ lookups = Lookup.ransack(params[:q]).result
8
+ render_content(lookups)
9
+ end
10
+
6
11
  private
7
12
 
8
13
  def model_params
@@ -0,0 +1,13 @@
1
+ module Comee
2
+ module Core
3
+ class RolesController < ApplicationController
4
+ include Common
5
+
6
+ private
7
+
8
+ def model_params
9
+ params.require(:payload).permit(:code, :name, :application_module_id)
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ module Comee
2
+ module Core
3
+ class UserApplicationRolesController < ApplicationController
4
+ include Common
5
+
6
+ private
7
+
8
+ def model_params
9
+ params.require(:payload).permit(:user_id, :application_module_id, :role_id)
10
+ end
11
+ end
12
+ end
13
+ end
@@ -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
@@ -0,0 +1,7 @@
1
+ module Comee
2
+ module Core
3
+ class ApplicationModuleSerializer < ActiveModel::Serializer
4
+ attributes :id, :code, :name
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,10 @@
1
+ module Comee
2
+ module Core
3
+ class ClientAddressSerializer < ActiveModel::Serializer
4
+ attributes :id, :address_line1, :street, :city, :state, :country_id, :postal_code, :address_type, :client_id
5
+
6
+ belongs_to :client
7
+ belongs_to :country
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,8 @@
1
+ module Comee
2
+ module Core
3
+ class RoleSerializer < ActiveModel::Serializer
4
+ attributes :id, :code, :name
5
+ belongs_to :application_module
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ module Comee
2
+ module Core
3
+ class UserApplicationRoleSerializer < ActiveModel::Serializer
4
+ attributes :id, :application_module, :role
5
+ belongs_to :user
6
+ end
7
+ end
8
+ end
@@ -2,6 +2,7 @@ module Comee
2
2
  module Core
3
3
  class UserSerializer < ActiveModel::Serializer
4
4
  attributes :id, :name, :email, :active
5
+ has_many :user_application_roles
5
6
  end
6
7
  end
7
8
  end
@@ -190,6 +190,7 @@ module Comee
190
190
  price: price,
191
191
  total_price: quantity * price,
192
192
  delivery_date: item.delivery_date,
193
+ handover_date: order.handover_date,
193
194
  lead_time: master_price&.lead_time
194
195
  }
195
196
  end
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
@@ -149,4 +155,10 @@ Comee::Core::Engine.routes.draw do
149
155
  resources :fulfillment_centers
150
156
 
151
157
  resources :client_warehouses
158
+
159
+ resources :roles
160
+
161
+ resources :application_modules
162
+
163
+ resources :user_application_roles
152
164
  end
@@ -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
@@ -1,5 +1,5 @@
1
1
  module Comee
2
2
  module Core
3
- VERSION = "0.2.67".freeze
3
+ VERSION = "0.2.69".freeze
4
4
  end
5
5
  end
@@ -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
@@ -4,4 +4,8 @@ FactoryBot.define do
4
4
  name { Faker::Lorem.word }
5
5
  lookup_type { Faker::Alphanumeric.alpha(number: 8) }
6
6
  end
7
+
8
+ factory :country, parent: :lookup do
9
+ lookup_type { :country }
10
+ end
7
11
  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.67
4
+ version: 0.2.69
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-02 00:00:00.000000000 Z
11
+ date: 2024-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_model_serializers
@@ -267,7 +267,9 @@ files:
267
267
  - app/controllers/comee/core/access_controller.rb
268
268
  - app/controllers/comee/core/agents_controller.rb
269
269
  - app/controllers/comee/core/application_controller.rb
270
+ - app/controllers/comee/core/application_modules_controller.rb
270
271
  - app/controllers/comee/core/back_orders_controller.rb
272
+ - app/controllers/comee/core/client_addresses_controller.rb
271
273
  - app/controllers/comee/core/client_prices_controller.rb
272
274
  - app/controllers/comee/core/client_warehouses_controller.rb
273
275
  - app/controllers/comee/core/clients_controller.rb
@@ -285,12 +287,14 @@ files:
285
287
  - app/controllers/comee/core/products_controller.rb
286
288
  - app/controllers/comee/core/quotation_request_items_controller.rb
287
289
  - app/controllers/comee/core/quotation_requests_controller.rb
290
+ - app/controllers/comee/core/roles_controller.rb
288
291
  - app/controllers/comee/core/sales_order_items_controller.rb
289
292
  - app/controllers/comee/core/sales_orders_controller.rb
290
293
  - app/controllers/comee/core/shipment_items_controller.rb
291
294
  - app/controllers/comee/core/suppliers_controller.rb
292
295
  - app/controllers/comee/core/unit_conversions_controller.rb
293
296
  - app/controllers/comee/core/units_controller.rb
297
+ - app/controllers/comee/core/user_application_roles_controller.rb
294
298
  - app/controllers/comee/core/users_controller.rb
295
299
  - app/controllers/concerns/comee/core/common.rb
296
300
  - app/controllers/concerns/comee/core/pagination.rb
@@ -305,6 +309,7 @@ files:
305
309
  - app/models/comee/core/back_order.rb
306
310
  - app/models/comee/core/back_order_item.rb
307
311
  - app/models/comee/core/client.rb
312
+ - app/models/comee/core/client_address.rb
308
313
  - app/models/comee/core/client_order.rb
309
314
  - app/models/comee/core/client_price.rb
310
315
  - app/models/comee/core/client_warehouse.rb
@@ -358,6 +363,8 @@ files:
358
363
  - app/models/comee/core/user_application_role.rb
359
364
  - app/notifications/comee/core/back_order_notification.rb
360
365
  - app/serializers/comee/core/agent_serializer.rb
366
+ - app/serializers/comee/core/application_module_serializer.rb
367
+ - app/serializers/comee/core/client_address_serializer.rb
361
368
  - app/serializers/comee/core/client_price_serializer.rb
362
369
  - app/serializers/comee/core/client_serializer.rb
363
370
  - app/serializers/comee/core/client_warehouse_serializer.rb
@@ -378,6 +385,7 @@ files:
378
385
  - app/serializers/comee/core/purchase_order_serializer.rb
379
386
  - app/serializers/comee/core/quotation_request_item_serializer.rb
380
387
  - app/serializers/comee/core/quotation_request_serializer.rb
388
+ - app/serializers/comee/core/role_serializer.rb
381
389
  - app/serializers/comee/core/sales_order_item_detail_serializer.rb
382
390
  - app/serializers/comee/core/sales_order_item_serializer.rb
383
391
  - app/serializers/comee/core/sales_order_serializer.rb
@@ -386,6 +394,7 @@ files:
386
394
  - app/serializers/comee/core/supplier_serializer.rb
387
395
  - app/serializers/comee/core/unit_conversion_serializer.rb
388
396
  - app/serializers/comee/core/unit_serializer.rb
397
+ - app/serializers/comee/core/user_application_role_serializer.rb
389
398
  - app/serializers/comee/core/user_serializer.rb
390
399
  - app/services/comee/core/customer_order_service.rb
391
400
  - app/services/comee/core/product_lookup_service.rb
@@ -459,6 +468,7 @@ files:
459
468
  - db/migrate/20240328132921_create_comee_core_supplier_payments.rb
460
469
  - db/migrate/20240407083617_create_comee_core_email_settings.rb
461
470
  - db/migrate/20240425121701_add_purchase_status_to_sales_order_and_purchase_requisition.rb
471
+ - db/migrate/20240503040722_create_comee_core_client_addresses.rb
462
472
  - lib/comee/core.rb
463
473
  - lib/comee/core/engine.rb
464
474
  - lib/comee/core/version.rb
@@ -469,6 +479,7 @@ files:
469
479
  - spec/factories/comee/core/application_modules.rb
470
480
  - spec/factories/comee/core/back_order_items.rb
471
481
  - spec/factories/comee/core/back_orders.rb
482
+ - spec/factories/comee/core/client_addresses.rb
472
483
  - spec/factories/comee/core/client_orders.rb
473
484
  - spec/factories/comee/core/client_prices.rb
474
485
  - spec/factories/comee/core/client_warehouses.rb