comee_core 0.1.19 → 0.1.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/comee/core/client_prices_controller.rb +18 -0
- data/app/models/comee/core/back_order.rb +15 -0
- data/app/serializers/comee/core/client_price_serializer.rb +7 -0
- data/config/routes.rb +2 -0
- data/db/migrate/20230728123928_create_comee_core_back_orders.rb +1 -0
- data/lib/comee/core/version.rb +1 -1
- data/spec/factories/comee/core/back_orders.rb +1 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4110e9f1c5556d8d519e9c4853886b4bdc836aee47a8e01f990f7d640f5a7144
|
4
|
+
data.tar.gz: bd9a6c43ddd0d57a46cf57518fa21afe77430844a29923b0815d34de8ad9f80b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f9c11ca22065eff7004b72ca5494381469256775c2b4d3d391fc5d35640fe1a7e1fc64ef7a51f9d5f94f78281b350dd9fe21f62753a93fa648ca5e235f1d796
|
7
|
+
data.tar.gz: 482433b0bf10ee4450ad5e93e811ae5c2db81461a991abd3c34a8bc49e0f57a8112a1e8294110d7bb695528d16376d2ade64ecef8e9bfd8e416f59727b937a5e
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Comee
|
2
|
+
module Core
|
3
|
+
class ClientPricesController < ApplicationController
|
4
|
+
include Comee::Core::Common
|
5
|
+
|
6
|
+
def filter
|
7
|
+
@client_prices = Comee::Core::ClientPrice.ransack(params[:q]).result
|
8
|
+
render json: {success: true, data: serialize(@client_prices)}
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def model_params
|
14
|
+
params.require(:payload).permit(:valid_from, :valid_to, :price, :status, :product_id, :discount, :client_id, :previous_price)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -23,6 +23,21 @@ module Comee
|
|
23
23
|
[]
|
24
24
|
end
|
25
25
|
|
26
|
+
def confirm
|
27
|
+
raise "Order already confirmed." if BackOrder.statuses[status] == BackOrder.statuses[:confirmed]
|
28
|
+
|
29
|
+
raise "Order should be in submitted state first." if BackOrder.statuses[status] != BackOrder.statuses[:submitted]
|
30
|
+
|
31
|
+
self.status = BackOrder.statuses[:confirmed]
|
32
|
+
back_order_items.each do |item|
|
33
|
+
if item.supplier_unit_price == item.requested_unit_price
|
34
|
+
self.price_changed = true
|
35
|
+
break
|
36
|
+
end
|
37
|
+
end
|
38
|
+
save!
|
39
|
+
end
|
40
|
+
|
26
41
|
private
|
27
42
|
|
28
43
|
def notify_supplier
|
data/config/routes.rb
CHANGED
@@ -12,6 +12,7 @@ class CreateComeeCoreBackOrders < ActiveRecord::Migration[7.0]
|
|
12
12
|
t.string :delivery_address, null: false
|
13
13
|
t.string :invoice_address, null: false
|
14
14
|
t.integer :status, null: false, default: 0
|
15
|
+
t.boolean :price_changed, null: false, default: false
|
15
16
|
t.string :remark
|
16
17
|
|
17
18
|
t.timestamps
|
data/lib/comee/core/version.rb
CHANGED
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.
|
4
|
+
version: 0.1.21
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henock L.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-10-
|
11
|
+
date: 2023-10-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_model_serializers
|
@@ -232,6 +232,7 @@ files:
|
|
232
232
|
- Rakefile
|
233
233
|
- app/controllers/comee/core/access_controller.rb
|
234
234
|
- app/controllers/comee/core/application_controller.rb
|
235
|
+
- app/controllers/comee/core/client_prices_controller.rb
|
235
236
|
- app/controllers/comee/core/clients_controller.rb
|
236
237
|
- app/controllers/comee/core/currencies_controller.rb
|
237
238
|
- app/controllers/comee/core/notifications_controller.rb
|
@@ -266,6 +267,7 @@ files:
|
|
266
267
|
- app/models/comee/core/unit.rb
|
267
268
|
- app/models/comee/core/user.rb
|
268
269
|
- app/notifications/comee/core/new_order_notification.rb
|
270
|
+
- app/serializers/comee/core/client_price_serializer.rb
|
269
271
|
- app/serializers/comee/core/client_serializer.rb
|
270
272
|
- app/serializers/comee/core/currency_serializer.rb
|
271
273
|
- app/serializers/comee/core/product_serializer.rb
|