comee_core 0.1.88 → 0.1.89

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: 01c398f40ebb3c1eacff4a3566d4707168d4e121b95442e0f59361c2e5a6520a
4
- data.tar.gz: 3059c69cb31e958457aadaf294cf2f9925862d08890633e0d9451240c221614d
3
+ metadata.gz: d2215fbbb3c1a9e0c836eb20902ea9c9871e473d08bb17c0659ca6c20236daeb
4
+ data.tar.gz: a546d3c21ef0b354c9ff61159309919145de3335e16639d9674a6ae1f2414824
5
5
  SHA512:
6
- metadata.gz: fab7383b8a87484ea330c21efe291089625d6c1cf4271200bfff9451e0ab29d8d041332f31575ac2bfa92bb387df97bbf4e6f1512203f8c4ac3f4afb36b89f85
7
- data.tar.gz: 613a9df5c11b6f9ad4fae560d8e87fbe9bbc01ff2397741cd79c061235fc060d9571c46a8b78df3b0d613c79d77dfb0ff7b1ab0bac3494086ffb87c9353519c1
6
+ metadata.gz: e00d19d0c5d47518505c4a4b5f7ef3a336807966795d933cff8ce7f133dfe32aebc50d76cb2d8dbd78b1010e89d271be9cf3dd6d1b30175b1405f50024108559
7
+ data.tar.gz: 5a9d63dd29c4ec4ed87b555dc7cb7b316d1fb69f97dbbc59f14dbc6cc638fd34ca0291103cb355078903276963911bd7953be094daeb3be86fd91157c7fc4039
@@ -25,39 +25,12 @@ module Comee
25
25
  render json: {success: true}
26
26
  end
27
27
 
28
- # def filter_with_status
29
- # items = SalesOrderItem.includes(:sales_order, :product, :unit)
30
- # .ransack(params[:q]).result
31
- # statuses = ItemStatus.where(sales_order_item_id: items.map(&:id))
32
- # .select("MAX(id) AS max_id, sales_order_item_id")
33
- # .group(:sales_order_item_id)
34
- # .all
35
- # ids = statuses.map(&:max_id)
36
- # statuses = ItemStatus.where(id: ids).each_with_object({}) { |status, res| res[status.sales_order_item_id] = status }
37
- # result = items.each_with_object([]) do |item, res|
38
- # status = statuses[item.id]
39
- # data = {
40
- # sales_order_no: item.sales_order.order_number,
41
- # customer_item_no: item.customer_item_no,
42
- # product_code: item.product.code,
43
- # unit: item.unit.code,
44
- # quantity: item.quantity,
45
- # delivery_date: item.delivery_date,
46
- # handover_date: item.sales_order.handover_date,
47
- # po_reference: item.po_reference,
48
- # status: status&.status
49
- # }
50
- # res << data.merge(status&.details)
51
- # end
52
- # render json: {success: true, data: result}
53
- # end
54
-
55
28
  private
56
29
 
57
30
  def model_params
58
31
  params.require(:payload).permit(:sales_order_id, :customer_order_item_id, :product_id, :unit_id, :quantity, :quantity_delivered,
59
- :customer_item_no, :price, :delivery_date, :eb_number, :lead_time, :comment, :action_note,
60
- :po_reference, :pallet_no, :source_id)
32
+ :customer_item_no, :price, :handover_date, :delivery_date, :eb_number, :lead_time, :comment,
33
+ :action_note, :po_reference, :pallet_no, :source_id)
61
34
  end
62
35
  end
63
36
  end
@@ -3,6 +3,11 @@ module Comee
3
3
  class UnitsController < ApplicationController
4
4
  include Common
5
5
 
6
+ def filter
7
+ units = Unit.ransack(params[:q]).result
8
+ render json: {success: true, data: serialize(units)}
9
+ end
10
+
6
11
  private
7
12
 
8
13
  def model_params
@@ -2,6 +2,7 @@ module Comee
2
2
  module Core
3
3
  class Pod < ApplicationRecord
4
4
  enum :status, {draft: 0, confirmed: 1, signed: 2}
5
+ has_many :shipment_instruction_items
5
6
 
6
7
  validates :reference_no, :status, presence: true
7
8
  end
@@ -11,6 +11,10 @@ module Comee
11
11
  self.weekday = availability_date.strftime("%A")
12
12
  self.weekday_short = availability_date.strftime("%a")
13
13
  end
14
+
15
+ def self.ransackable_attributes(_auth_object = nil)
16
+ %w[availability_date weekday weekday_short]
17
+ end
14
18
  end
15
19
  end
16
20
  end
@@ -13,6 +13,10 @@ module Comee
13
13
 
14
14
  aliases.map(&:downcase!)
15
15
  end
16
+
17
+ def self.ransackable_attributes(_auth_object = nil)
18
+ %w[code name unit_type]
19
+ end
16
20
  end
17
21
  end
18
22
  end
@@ -1,8 +1,8 @@
1
1
  module Comee
2
2
  module Core
3
3
  class SalesOrderItemSerializer < ActiveModel::Serializer
4
- attributes :id, :customer_item_no, :quantity, :quantity_delivered, :price, :delivery_date, :eb_number, :lead_time, :comment,
5
- :action_note, :po_reference
4
+ attributes :id, :customer_item_no, :quantity, :quantity_delivered, :price, :handover_date, :delivery_date, :eb_number,
5
+ :lead_time, :comment, :action_note, :po_reference
6
6
 
7
7
  belongs_to :sales_order
8
8
  belongs_to :customer_order_item
data/config/routes.rb CHANGED
@@ -66,7 +66,11 @@ Comee::Core::Engine.routes.draw do
66
66
  end
67
67
  end
68
68
  resources :currencies
69
- resources :units
69
+ resources :units do
70
+ collection do
71
+ post "filter"
72
+ end
73
+ end
70
74
  resources :unit_conversions
71
75
  resources :users
72
76
  post "/purchase_orders/filter", controller: :purchase_orders, action: :filter
data/config/spring.rb CHANGED
@@ -1 +1 @@
1
- Spring.application_root = "spec/dummy"
1
+ Spring.application_root = "./spec/dummy"
@@ -1,5 +1,5 @@
1
1
  module Comee
2
2
  module Core
3
- VERSION = "0.1.88".freeze
3
+ VERSION = "0.1.89".freeze
4
4
  end
5
5
  end
@@ -1,7 +1,7 @@
1
1
  FactoryBot.define do
2
2
  factory :transport_availability, class: "Comee::Core::TransportAvailability" do
3
3
  availability_date do
4
- d = Date.current
4
+ d = Faker::Date.between(from: Date.current, to: Date.current.advance(months: 6))
5
5
  d.advance(days: 1) if d.wday == 7
6
6
  d.advance(days: 2) if d.wday == 6
7
7
  d
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.88
4
+ version: 0.1.89
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-12 00:00:00.000000000 Z
11
+ date: 2024-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_model_serializers