cats_core 1.1.4 → 1.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/cats/core/dispatches_controller.rb +6 -1
- data/app/controllers/cats/core/receipts_controller.rb +2 -2
- data/app/models/cats/core/gift_certificate.rb +10 -0
- data/app/models/cats/core/purchase_order.rb +10 -0
- data/app/serializers/cats/core/commodity_serializer.rb +9 -0
- data/app/serializers/cats/core/location_serializer.rb +1 -1
- data/app/services/cats/core/receipt_service.rb +1 -1
- data/config/routes.rb +2 -1
- data/db/migrate/20210717032330_create_cats_core_donations.rb +1 -0
- data/lib/cats/core/version.rb +1 -1
- data/spec/factories/cats/core/donations.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e88cccfc4e2d6d554ec178e2f7e981462ace4db4fa8e43fb142b617550eadde7
|
4
|
+
data.tar.gz: cb8b5bfe4186b7e2394ca8ed765d6a1c5c7c2694f503a031d42f64fce0d3b4c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49cb848b9e249982677944e85e91305ebb7997237a570ce9f91cfecfedc058ea7f02052e8e8aea79ae7020ee8618998a48f1d97e26886415b807d619c25dcf73
|
7
|
+
data.tar.gz: 6959a9bdb0a8474785fb1a63b6282d0f1030fcf0ed0f182246e310d73681eff892f38f64eb72c24e1d43c47541912f8292694a717676aa56916184fea63c3f47
|
@@ -4,7 +4,7 @@ module Cats
|
|
4
4
|
include Common
|
5
5
|
|
6
6
|
before_action :set_service, only: %i[create_receipt_authorization approve start search confirm]
|
7
|
-
before_action :set_dispatch, only: %i[approve start confirm]
|
7
|
+
before_action :set_dispatch, only: %i[approve start confirm commodity]
|
8
8
|
|
9
9
|
def index
|
10
10
|
dispatches = Cats::Core::Dispatch.where(allocation_item_id: params[:id])
|
@@ -56,6 +56,11 @@ module Cats
|
|
56
56
|
render json: { success: true, data: serialize(data) }
|
57
57
|
end
|
58
58
|
|
59
|
+
def commodity
|
60
|
+
data = @dispatch.allocation_item.allocation.commodity
|
61
|
+
render json: { success: true, data: serialize(data) }
|
62
|
+
end
|
63
|
+
|
59
64
|
private
|
60
65
|
|
61
66
|
def set_service
|
@@ -17,10 +17,10 @@ module Cats
|
|
17
17
|
render json: { success: false, error: e.message }
|
18
18
|
end
|
19
19
|
|
20
|
-
def
|
20
|
+
def finish_stacking
|
21
21
|
receipt = Cats::Core::Receipt.find(params[:id])
|
22
22
|
service = ReceiptService.new
|
23
|
-
result = service.
|
23
|
+
result = service.finish_stacking(receipt)
|
24
24
|
render json: { success: true, data: serialize(result) }
|
25
25
|
rescue StandardError => e
|
26
26
|
render json: { success: false, error: e.message }
|
@@ -5,6 +5,16 @@ module Cats
|
|
5
5
|
|
6
6
|
validates :reference_no, presence: true, uniqueness: true
|
7
7
|
validates :gift_date, presence: true
|
8
|
+
|
9
|
+
after_create :update_donation
|
10
|
+
|
11
|
+
def update_donation
|
12
|
+
donation = self.donation
|
13
|
+
return if donation.active
|
14
|
+
|
15
|
+
donation.active = true
|
16
|
+
donation.save!
|
17
|
+
end
|
8
18
|
end
|
9
19
|
end
|
10
20
|
end
|
@@ -8,6 +8,16 @@ module Cats
|
|
8
8
|
validates :reference_no, uniqueness: true
|
9
9
|
|
10
10
|
delegate(:name, to: :commodity_category, prefix: true)
|
11
|
+
|
12
|
+
after_create :update_donation
|
13
|
+
|
14
|
+
def update_donation
|
15
|
+
donation = self.donation
|
16
|
+
return if donation.active
|
17
|
+
|
18
|
+
donation.active = true
|
19
|
+
donation.save!
|
20
|
+
end
|
11
21
|
end
|
12
22
|
end
|
13
23
|
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
module Cats
|
2
|
+
module Core
|
3
|
+
class CommoditySerializer < ActiveModel::Serializer
|
4
|
+
attributes :id, :batch_no, :description, :unit_of_measure_id, :unit_of_measure_abbreviation, :source_id,
|
5
|
+
:source_type, :source_reference_no, :quantity, :best_use_before, :volume_per_metric_ton,
|
6
|
+
:commodity_category_id, :commodity_category_name, :arrival_status, :approved
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
data/config/routes.rb
CHANGED
@@ -60,6 +60,7 @@ Cats::Core::Engine.routes.draw do
|
|
60
60
|
resources :dispatches, except: %i[index destroy] do
|
61
61
|
member do
|
62
62
|
get 'receipts', controller: :receipts, action: :index
|
63
|
+
get 'commodity'
|
63
64
|
post 'approve'
|
64
65
|
post 'start'
|
65
66
|
post 'confirm'
|
@@ -69,7 +70,7 @@ Cats::Core::Engine.routes.draw do
|
|
69
70
|
resources :receipts, except: %i[index new edit destroy] do
|
70
71
|
member do
|
71
72
|
post 'start_stacking'
|
72
|
-
post '
|
73
|
+
post 'finish_stacking'
|
73
74
|
end
|
74
75
|
end
|
75
76
|
resources :receipt_transactions, except: %i[new edit destroy]
|
data/lib/cats/core/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cats_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henock L.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-09-
|
11
|
+
date: 2021-09-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_model_serializers
|
@@ -273,6 +273,7 @@ files:
|
|
273
273
|
- app/models/cats/core/user.rb
|
274
274
|
- app/notifications/cats/core/simple_notification.rb
|
275
275
|
- app/serializers/cats/core/commodity_category_serializer.rb
|
276
|
+
- app/serializers/cats/core/commodity_serializer.rb
|
276
277
|
- app/serializers/cats/core/currency_serializer.rb
|
277
278
|
- app/serializers/cats/core/dispatch_serializer.rb
|
278
279
|
- app/serializers/cats/core/dispatch_transaction_serializer.rb
|