cats_core 1.1.30 → 1.1.34
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/access_controller.rb +1 -1
- data/app/models/cats/core/hrp.rb +3 -1
- data/app/models/cats/core/stack.rb +1 -1
- data/app/notifications/cats/core/allocation_notification.rb +29 -0
- data/app/notifications/cats/core/dispatch_notification.rb +3 -2
- data/lib/cats/core/version.rb +1 -1
- 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: 04aa5725df06bf149cf057515dd11ef721dc9511b9aa9555cd2dd311ad9e96ff
|
4
|
+
data.tar.gz: ec1393337a6276fec08d3897618bb2ed345f66dd027a8a07efc59544bcd326d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5b97bdff8990988dd0bebeba15e24fadc28328970e1343f36617c3ee93a149af2470320ad8b7adafca36dcfddcb927acbed34e67b325dbb3828e2941ab5f9cc
|
7
|
+
data.tar.gz: ec0011655502fd35e6313bd4e5f079557cc58de783d093d640e122fbcd894bbcca459225ebafdc83f7c4c2770a116477dd4f09061ee33c5fadeee0e32790445d
|
@@ -20,7 +20,7 @@ module Cats
|
|
20
20
|
jwt = Cats::Core::TokenAuthService.issue(payload)
|
21
21
|
render json: { token: jwt, user: payload }
|
22
22
|
else
|
23
|
-
|
23
|
+
render json: { error: 'Invalid username or password.' }, status: 400
|
24
24
|
end
|
25
25
|
else
|
26
26
|
render json: { error: 'User does not exist.' }, status: 400
|
data/app/models/cats/core/hrp.rb
CHANGED
@@ -3,7 +3,9 @@ module Cats
|
|
3
3
|
class Hrp < ApplicationRecord
|
4
4
|
DRAFT = 'Draft'.freeze
|
5
5
|
APPROVED = 'Approved'.freeze
|
6
|
-
|
6
|
+
NEEDS_APPROVED = 'Needs Approved'.freeze
|
7
|
+
|
8
|
+
STATUSES = [DRAFT, APPROVED, NEEDS_APPROVED].freeze
|
7
9
|
|
8
10
|
BELG = 'Belg'.freeze
|
9
11
|
MEHER = 'Meher'.freeze
|
@@ -20,7 +20,7 @@ module Cats
|
|
20
20
|
validates :commodity_status, inclusion: { in: Cats::Core::Commodity::COMMODITY_STATUSES }
|
21
21
|
validates :stack_status, inclusion: { in: STACK_STATUSES }
|
22
22
|
validate :validate_coordinates, :validate_dimensions, :validate_distance_from_wall, :validate_overlap,
|
23
|
-
:validate_space_between_stack
|
23
|
+
:validate_space_between_stack, unless: -> { store && store.code == 'SUP-STORE' }
|
24
24
|
|
25
25
|
after_save :update_store_space
|
26
26
|
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# To deliver this notification:
|
2
|
+
#
|
3
|
+
# AllocationNotification.with(post: @post).deliver_later(current_user)
|
4
|
+
# AllocationNotification.with(post: @post).deliver(current_user)
|
5
|
+
|
6
|
+
module Cats
|
7
|
+
module Core
|
8
|
+
class AllocationNotification < Noticed::Base
|
9
|
+
deliver_by :database
|
10
|
+
|
11
|
+
param :allocation_item
|
12
|
+
|
13
|
+
def message
|
14
|
+
allocation_item = params[:allocation_item]
|
15
|
+
commodity = allocation_item.allocation.commodity.name
|
16
|
+
title = "Allocation Notification - #{commodity}"
|
17
|
+
date = Date.today
|
18
|
+
body = <<~BODY
|
19
|
+
Commodity with the following specification has been allocated to you:
|
20
|
+
Batch No. = #{allocation_item.allocation.commodity.batch_no}
|
21
|
+
Commodity = #{commodity}
|
22
|
+
Quantity = #{allocation_item.quantity}
|
23
|
+
The commodity is expected to be delivered from #{allocation_item.from} to #{allocation_item.to}
|
24
|
+
BODY
|
25
|
+
{ title: title, date: date, body: body }
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -7,13 +7,14 @@ module Cats
|
|
7
7
|
|
8
8
|
def message
|
9
9
|
dispatch = params[:dispatch]
|
10
|
-
|
10
|
+
commodity = dispatch.allocation_item.allocation.commodity.name
|
11
|
+
title = "Dispatch Notification - #{commodity}"
|
11
12
|
date = Date.today
|
12
13
|
body = <<~BODY
|
13
14
|
Commodity with the following details has been dispatched to you:
|
14
15
|
Dispatch Ref. = #{dispatch.reference_no}
|
15
16
|
Batch No. = #{dispatch.allocation_item.allocation.commodity.batch_no}
|
16
|
-
Commodity = #{
|
17
|
+
Commodity = #{commodity}
|
17
18
|
Allocated Quantity = #{dispatch.allocation_item.quantity}
|
18
19
|
Quantity = #{dispatch.quantity}
|
19
20
|
Truck Plate No. = #{dispatch.plate_no}
|
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.34
|
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-10-
|
11
|
+
date: 2021-10-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_model_serializers
|
@@ -286,6 +286,7 @@ files:
|
|
286
286
|
- app/models/cats/core/transporter.rb
|
287
287
|
- app/models/cats/core/unit_of_measure.rb
|
288
288
|
- app/models/cats/core/user.rb
|
289
|
+
- app/notifications/cats/core/allocation_notification.rb
|
289
290
|
- app/notifications/cats/core/dispatch_notification.rb
|
290
291
|
- app/notifications/cats/core/simple_notification.rb
|
291
292
|
- app/serializers/cats/core/commodity_category_serializer.rb
|