comee_core 0.1.85 → 0.1.87

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: 65a6f4cc76af66361e5d6d21999a8a38a0c2598f83980632783f7b1add6488ca
4
- data.tar.gz: 554dc63474d64f44982cb4aea62040ab41f65c4c93fa517afd7a08d1e04d09d1
3
+ metadata.gz: fcd01686f33365c1ac6f9b6a0263da7df0d5952a4b7aa6a65f330d57fed4d6c3
4
+ data.tar.gz: eb7d575093c1faf0a60d3a16eff3d00049d23c689ac5701c0a019599b5397fbb
5
5
  SHA512:
6
- metadata.gz: fac12797a1ebd3ae197a2622ea494cbbce2af911c0d3862510e742aa7b9a9aa1f01a37d336d5b551b80bf4440146a5541e72029a67599fda1aa733e3e7ce225e
7
- data.tar.gz: 6c2e2ddda7b6921cb9a8c39c9138fd2d9dd8c2e8573a2bfee18191f671bf64e5b1a7dea57116a5d9b8d36d1744e5bb0cded3727c86175a5944d454fae7a1d611
6
+ metadata.gz: 5deb9e48f2e06484c6a695d4395cb0b0053925657d92854f9194aafb63ca5c7504871689a6c22a7bf71841eb04901d897a0ab7da0b235ccf4ef655d56f934117
7
+ data.tar.gz: 0bce465e2462ad3c330a7ca0c80f2bd17166d58373abd6d9552dda3df5101885f787696fa03c9228748403b3220582e7ef0b0f11180e6bd87ddef70309820af4
@@ -18,7 +18,8 @@ module Comee
18
18
  end
19
19
 
20
20
  def master_prices
21
- data = MasterPrice.where(product_id: price_params[:product_ids])
21
+ data = MasterPrice.includes(:product_lookup, :supplier, :product)
22
+ .where(product_id: price_params[:product_ids])
22
23
  render json: {success: true, data: serialize(data)}
23
24
  end
24
25
 
@@ -8,7 +8,7 @@ module Comee
8
8
  super do
9
9
  [
10
10
  Comee::Core::SalesOrder.includes(:customer_order, :fulfillment_center, :sales_order_items).all,
11
- include: ["sales_order_items", "sales_order_items.product", "sales_order_items.unit"]
11
+ include: ["customer_order", "sales_order_items", "sales_order_items.product", "sales_order_items.unit"]
12
12
  ]
13
13
  end
14
14
  end
@@ -21,11 +21,7 @@ module Comee
21
21
  else
22
22
  data = @clazz.all
23
23
  end
24
- # data, options = if block_given?
25
- # yield
26
- # else
27
- # [@clazz.all, {}]
28
- # end
24
+
29
25
  page = params[:page]
30
26
  if page
31
27
  render json: {success: true, data: serialize(data, options), page: page, total: @clazz.count}
@@ -0,0 +1,11 @@
1
+ module Comee
2
+ module Core
3
+ class PickupSchedule < ApplicationRecord
4
+ enum :status, {draft: 0, confirmed: 1}
5
+
6
+ belongs_to :pod
7
+ belongs_to :time_slot
8
+ validates :status, presence: true
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,9 @@
1
+ module Comee
2
+ module Core
3
+ class Pod < ApplicationRecord
4
+ enum :status, {draft: 0, confirmed: 1, signed: 2}
5
+
6
+ validates :reference_no, :status, presence: true
7
+ end
8
+ end
9
+ end
@@ -4,6 +4,7 @@ module Comee
4
4
  belongs_to :shipment_instruction
5
5
  belongs_to :shipment_item
6
6
  belongs_to :unit
7
+ belongs_to :pod, optional: true
7
8
 
8
9
  validates :delivery_note_no, :pallet_no, :goods_issue_date, presence: true
9
10
  validates :length, :width, :height, :weight, :quantity, :price, presence: true, numericality: {greater_than: 0}
@@ -138,7 +138,12 @@ module Comee
138
138
  status: SalesOrder.statuses[:draft]
139
139
  )
140
140
  order_items = order.customer_order_items.includes(:product, :unit)
141
- client_prices = ClientPrice.where(client: order.client, product_id: order_items.map(&:product_id))
141
+ client_id = order.client.parent_id || order.client_id
142
+ client_prices = ClientPrice.where(
143
+ client_id: client_id,
144
+ product_id: order_items.map(&:product_id),
145
+ status: ClientPrice.statuses[:current]
146
+ )
142
147
  master_prices = MasterPrice.where(primary: true, status: Price.statuses[:current], product: order_items.map(&:product))
143
148
  items = order_items.each_with_object([]) do |item, res|
144
149
  next if item.canceled?
@@ -0,0 +1,10 @@
1
+ class CreateComeeCorePods < ActiveRecord::Migration[7.1]
2
+ def change
3
+ create_table :comee_core_pods do |t|
4
+ t.string :reference_no, null: false
5
+ t.integer :status, null: false, default: 0
6
+
7
+ t.timestamps
8
+ end
9
+ end
10
+ end
@@ -22,6 +22,10 @@ class CreateComeeCoreShipmentInstructionItems < ActiveRecord::Migration[7.1]
22
22
  index: {name: "unit_on_ccsii_indx"},
23
23
  foreign_key: {to_table: :comee_core_units}
24
24
  t.float :price, null: false
25
+ t.references :pod,
26
+ null: true,
27
+ index: {name: "pod_on_ccsii_indx"},
28
+ foreign_key: {to_table: :comee_core_pods}
25
29
 
26
30
  t.timestamps
27
31
  end
@@ -0,0 +1,20 @@
1
+ class CreateComeeCorePickupSchedules < ActiveRecord::Migration[7.1]
2
+ def change
3
+ create_table :comee_core_pickup_schedules do |t|
4
+ t.references :pod,
5
+ null: false,
6
+ index: {name: "pod_on_ccps_indx"},
7
+ foreign_key: {to_table: :comee_core_pods}
8
+ t.references :time_slot,
9
+ null: false,
10
+ index: {name: "ts_on_ccps_indx"},
11
+ foreign_key: {to_table: :comee_core_time_slots}
12
+ t.integer :status, null: false, default: 0
13
+ t.string :truck_no
14
+ t.string :driver_license_no
15
+ t.string :plate_no
16
+
17
+ t.timestamps
18
+ end
19
+ end
20
+ end
@@ -1,5 +1,5 @@
1
1
  module Comee
2
2
  module Core
3
- VERSION = "0.1.85".freeze
3
+ VERSION = "0.1.87".freeze
4
4
  end
5
5
  end
@@ -0,0 +1,10 @@
1
+ FactoryBot.define do
2
+ factory :pickup_schedule, class: "Comee::Core::PickupSchedule" do
3
+ pod
4
+ time_slot
5
+ status { Comee::Core::PickupSchedule.statuses[:draft] }
6
+ truck_no { Faker::Alphanumeric.alpha(number: 10) }
7
+ driver_license_no { Faker::Alphanumeric.alpha(number: 10) }
8
+ plate_no { Faker::Alphanumeric.alpha(number: 10) }
9
+ end
10
+ end
@@ -0,0 +1,6 @@
1
+ FactoryBot.define do
2
+ factory :pod, class: "Comee::Core::Pod" do
3
+ reference_no { Faker::Alphanumeric.alpha(number: 10) }
4
+ status { Comee::Core::Pod.statuses[:draft] }
5
+ end
6
+ end
@@ -2,6 +2,7 @@ FactoryBot.define do
2
2
  factory :shipment_instruction_item, class: "Comee::Core::ShipmentInstructionItem" do
3
3
  shipment_instruction
4
4
  shipment_item
5
+ pod { nil }
5
6
  delivery_note_no { Faker::Alphanumeric.alpha(number: 10) }
6
7
  pallet_no { Faker::Alphanumeric.alpha(number: 10) }
7
8
  goods_issue_date { Date.current.advance(days: 3) }
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.85
4
+ version: 0.1.87
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-10 00:00:00.000000000 Z
11
+ date: 2024-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_model_serializers
@@ -331,6 +331,8 @@ files:
331
331
  - app/models/comee/core/master_price.rb
332
332
  - app/models/comee/core/notification.rb
333
333
  - app/models/comee/core/order_source.rb
334
+ - app/models/comee/core/pickup_schedule.rb
335
+ - app/models/comee/core/pod.rb
334
336
  - app/models/comee/core/price.rb
335
337
  - app/models/comee/core/product.rb
336
338
  - app/models/comee/core/product_lookup.rb
@@ -427,10 +429,12 @@ files:
427
429
  - db/migrate/20231206082503_create_comee_core_unit_conversions.rb
428
430
  - db/migrate/20231207153420_create_comee_core_shipment_items.rb
429
431
  - db/migrate/20231207235542_create_comee_core_item_statuses.rb
432
+ - db/migrate/20240103074619_create_comee_core_pods.rb
430
433
  - db/migrate/20240104131607_create_comee_core_shipment_instructions.rb
431
434
  - db/migrate/20240104143246_create_comee_core_shipment_instruction_items.rb
432
435
  - db/migrate/20240109185749_create_comee_core_transport_availability.rb
433
436
  - db/migrate/20240109185931_create_comee_core_time_slots.rb
437
+ - db/migrate/20240111112140_create_comee_core_pickup_schedules.rb
434
438
  - lib/comee/core.rb
435
439
  - lib/comee/core/engine.rb
436
440
  - lib/comee/core/version.rb
@@ -456,6 +460,8 @@ files:
456
460
  - spec/factories/comee/core/master_prices.rb
457
461
  - spec/factories/comee/core/notifications.rb
458
462
  - spec/factories/comee/core/order_sources.rb
463
+ - spec/factories/comee/core/pickup_schedules.rb
464
+ - spec/factories/comee/core/pods.rb
459
465
  - spec/factories/comee/core/product_lookups.rb
460
466
  - spec/factories/comee/core/products.rb
461
467
  - spec/factories/comee/core/purchase_order_items.rb