cats_core 1.4.44 → 1.4.45

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: fba88be856ad7a27b81c7eca20c2867775d1bd9963b84d6fa4b48ddaa688008f
4
- data.tar.gz: 50ed67dd7ae4dca66b27205764d13c9a72b53d4088158c09b0165c45f4bd12e2
3
+ metadata.gz: 710ffdc5b10d0f97aa5f40aaa8e67a99eaea21120c0b96894d46f86a47b10312
4
+ data.tar.gz: 3c1b7594b8717c668bb9f38d481afa54057005f524171bd3c088fdf6047344b2
5
5
  SHA512:
6
- metadata.gz: 2ed1ee00dbfc76d8bee529ac9e2788b83183159c8f27059b5c14fafab2129ba60b04d83bf503e5efd1e45581391f9a033d18c00ba24bdc6ca15aee3155f5706e
7
- data.tar.gz: 2ed989fb152cf0488ce958c373b66b0e1dca324453d82d1ffe3139e4abca362c9926373bc6eb60e85ddb9a7901b466f07711766b682f90de3f020f01df2764df
6
+ metadata.gz: 4b522fa9d586d12f3255b0a9044caff4c8b694e336e3b284a657bc14d2f10a0e10ad3fce4d082784b65435bd73c396b8a593c6c7630bc90b9ac1388bf6f51915
7
+ data.tar.gz: 46fbc7ca6360f71e4f6cc992f03a3711b302f2f351c7dca8996999cee8c8eaf196321324bf9ed3f6bf16940c04f5224c72bd5124147663a7b4533aeddd9f27bd
@@ -61,7 +61,7 @@ module Cats
61
61
  :dispatchable_type,
62
62
  items: %i[
63
63
  reference_no region zone woreda fdp commodity_category unit_id unit quantity source_id destination_id
64
- commodity_id
64
+ commodity_id commodity_status
65
65
  ]
66
66
  )
67
67
  end
@@ -29,6 +29,11 @@ module Cats
29
29
  end
30
30
  end
31
31
 
32
+ def filter
33
+ query = DispatchTransaction.ransack(params[:q])
34
+ render json: { success: true, data: serialize(query.result) }
35
+ end
36
+
32
37
  private
33
38
 
34
39
  def model_params
@@ -12,8 +12,8 @@ module Cats
12
12
  private
13
13
 
14
14
  def model_params
15
- params.require(:payload).permit(:reference_no, :lender, :agreement_date, :repayment_date, :quantity, :unit_id,
16
- :commodity_category_id)
15
+ params.require(:payload).permit(:reference_no, :description, :lender, :agreement_date, :repayment_date,
16
+ :quantity, :unit_id, :commodity_category_id)
17
17
  end
18
18
  end
19
19
  end
@@ -17,7 +17,7 @@ module Cats
17
17
  def model_params
18
18
  params.require(:payload).permit(:reference_no, :order_date, :requisition_no, :supplier, :cash_donation_id,
19
19
  :commodity_category_id, :quantity, :purchase_type, :unit_id, :price,
20
- :currency_id)
20
+ :currency_id, :description)
21
21
  end
22
22
  end
23
23
  end
@@ -10,6 +10,11 @@ module Cats
10
10
  end
11
11
  end
12
12
 
13
+ def filter
14
+ query = ReceiptTransaction.ransack(params[:q])
15
+ render json: { success: true, data: serialize(query.result) }
16
+ end
17
+
13
18
  private
14
19
 
15
20
  def model_params
@@ -12,9 +12,9 @@ module Cats
12
12
  private
13
13
 
14
14
  def model_params
15
- params.require(:payload).permit(:reference_no, :swapper, :agreement_date, :issued_commodity_id,
16
- :issued_quantity, :received_commodity_id, :received_quantity,
17
- :issued_unit_id, :received_unit_id)
15
+ params.require(:payload).permit(:reference_no, :swapper, :agreement_date, :issued_commodity_id, :description,
16
+ :issued_quantity, :received_commodity_id, :received_quantity, :issued_unit_id,
17
+ :received_unit_id)
18
18
  end
19
19
  end
20
20
  end
@@ -10,6 +10,10 @@ module Cats
10
10
  delegate(:reference_no, to: :plan, prefix: true, allow_nil: true)
11
11
  delegate(:name, to: :commodity_category, prefix: true)
12
12
  delegate(:abbreviation, to: :unit, prefix: true)
13
+
14
+ def commodity_name
15
+ commodity_category.name
16
+ end
13
17
  end
14
18
  end
15
19
  end
@@ -10,6 +10,10 @@ module Cats
10
10
 
11
11
  delegate(:name, to: :commodity_category, prefix: true)
12
12
  delegate(:abbreviation, to: :unit, prefix: true)
13
+
14
+ def commodity_name
15
+ commodity_category.name
16
+ end
13
17
  end
14
18
  end
15
19
  end
@@ -18,6 +18,10 @@ module Cats
18
18
  delegate(:name, to: :commodity_category, prefix: true)
19
19
  delegate(:name, to: :unit, prefix: true)
20
20
  delegate(:code, to: :currency, prefix: true)
21
+
22
+ def commodity_name
23
+ commodity_category.name
24
+ end
21
25
  end
22
26
  end
23
27
  end
@@ -14,6 +14,10 @@ module Cats
14
14
  delegate(:name, to: :received_commodity, prefix: true)
15
15
  delegate(:abbreviation, to: :issued_unit, prefix: true)
16
16
  delegate(:abbreviation, to: :received_unit, prefix: true)
17
+
18
+ def commodity_name
19
+ received_commodity.name
20
+ end
17
21
  end
18
22
  end
19
23
  end
@@ -43,6 +43,23 @@ module Cats
43
43
  authorization.dispatch.stack
44
44
  authorization
45
45
  end
46
+
47
+ def receipt_authorization(id)
48
+ item = DispatchPlanItem.find(id).includes(
49
+ :destination,
50
+ :unit,
51
+ commodity: { project: :source }
52
+ )
53
+ {
54
+ date: Date.today,
55
+ reference_no: item.reference_no,
56
+ destination: item.destination.name,
57
+ source: item.commodity.project.source.description,
58
+ commodity: "#{item.commodity.project.source.commodity_name} (#{item.commodity.batch_no})",
59
+ unit: item.unit.abbreviation,
60
+ quantity: item.quantity
61
+ }
62
+ end
46
63
  end
47
64
  end
48
65
  end
data/config/routes.rb CHANGED
@@ -167,7 +167,9 @@ Cats::Core::Engine.routes.draw do
167
167
  action: :create_allocation,
168
168
  as: :allocation_transaction
169
169
  )
170
+ post '/dispatch_transactions/filter', controller: :dispatch_transactions, action: :filter
170
171
  resources :dispatch_transactions, except: %i[index new edit destroy]
172
+ post '/receipt_transactions/filter', controller: :receipt_transactions, action: :filter
171
173
  resources :receipt_transactions, except: %i[index new edit destroy]
172
174
  resources :lost_commodities, except: %i[index destroy]
173
175
  get '/plans/:id/round_plans', controller: :round_plans, action: :index, as: :round_plans_plan
@@ -2,6 +2,7 @@ class CreateCatsCorePurchaseOrders < ActiveRecord::Migration[6.1]
2
2
  def change
3
3
  create_table :cats_core_purchase_orders do |t|
4
4
  t.string :reference_no, unique: true
5
+ t.string :description
5
6
  t.date :order_date, null: false
6
7
  t.string :requisition_no
7
8
  t.string :supplier, null: false
@@ -2,6 +2,7 @@ class CreateCatsCoreLoans < ActiveRecord::Migration[7.0]
2
2
  def change
3
3
  create_table :cats_core_loans do |t|
4
4
  t.string :reference_no, unique: true
5
+ t.string :description
5
6
  t.string :lender, null: false
6
7
  t.date :agreement_date, null: false
7
8
  t.date :repayment_date
@@ -2,6 +2,7 @@ class CreateCatsCoreSwaps < ActiveRecord::Migration[7.0]
2
2
  def change
3
3
  create_table :cats_core_swaps do |t|
4
4
  t.string :reference_no, unique: true
5
+ t.string :description
5
6
  t.string :swapper, null: false
6
7
  t.date :agreement_date, null: false
7
8
  t.float :issued_quantity, null: false
@@ -1,5 +1,5 @@
1
1
  module Cats
2
2
  module Core
3
- VERSION = '1.4.44'.freeze
3
+ VERSION = '1.4.45'.freeze
4
4
  end
5
5
  end
@@ -1,6 +1,7 @@
1
1
  FactoryBot.define do
2
2
  factory :loan, class: 'Cats::Core::Loan' do
3
3
  reference_no { FFaker::Name.name }
4
+ description { FFaker::Name.name }
4
5
  lender { FFaker::Name.name }
5
6
  agreement_date { Date.today }
6
7
  repayment_date { agreement_date.next_month }
@@ -1,6 +1,7 @@
1
1
  FactoryBot.define do
2
2
  factory :purchase_order, class: 'Cats::Core::PurchaseOrder' do
3
3
  reference_no { FFaker::Name.name }
4
+ description { FFaker::Name.name }
4
5
  order_date { Date.today }
5
6
  requisition_no { FFaker::Name.name }
6
7
  supplier { FFaker::Name.name }
@@ -1,6 +1,7 @@
1
1
  FactoryBot.define do
2
2
  factory :swap, class: 'Cats::Core::Swap' do
3
3
  reference_no { FFaker::Name.name }
4
+ description { FFaker::Name.name }
4
5
  swapper { FFaker::Name.name }
5
6
  agreement_date { Date.yesterday }
6
7
  issued_commodity factory: :commodity_category
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.4.44
4
+ version: 1.4.45
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henock L.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-26 00:00:00.000000000 Z
11
+ date: 2022-06-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_model_serializers