comee_core 0.1.88 → 0.1.90

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: 756042163169e327bbf9e028c6666dbec6f9c52e907cf5d35b210ca37b310533
4
+ data.tar.gz: 9c3f9bee0f3b28e6988c490babdb6e56329fe546300920d1d287eb917fca1554
5
5
  SHA512:
6
- metadata.gz: fab7383b8a87484ea330c21efe291089625d6c1cf4271200bfff9451e0ab29d8d041332f31575ac2bfa92bb387df97bbf4e6f1512203f8c4ac3f4afb36b89f85
7
- data.tar.gz: 613a9df5c11b6f9ad4fae560d8e87fbe9bbc01ff2397741cd79c061235fc060d9571c46a8b78df3b0d613c79d77dfb0ff7b1ab0bac3494086ffb87c9353519c1
6
+ metadata.gz: 757759703fb6cf5f2dac0e7c9dadb29a7c7317c53f788d9a6993cd2ea49cad72c80727ec7d643c2259f5acc21a90aad0e12ce4d27292209429b202af3dbf23db
7
+ data.tar.gz: 95a9135eb3ad74e2a8666cbcbd8c151f2a19dc801f9249110f01bd1137e664a138958bad4038a309130428296742930f2f73efd4b46369fbded65bd7e280f006
@@ -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
@@ -6,6 +6,10 @@ module Comee
6
6
  belongs_to :pod
7
7
  belongs_to :time_slot
8
8
  validates :status, presence: true
9
+
10
+ def self.ransackable_attributes(_auth_object = nil)
11
+ %w[driver_license_no plate_no pod_id status time_slot_id truck_no]
12
+ end
9
13
  end
10
14
  end
11
15
  end
@@ -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.90".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.90
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-14 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