comee_core 0.2.12 → 0.2.13

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: 854004edc559daff1dd6605fc7b95b1f83602629d2e59771a487226c95833350
4
- data.tar.gz: 48fe39dcd8d5867fb4abff691bd615f1eb434b7e01cc31771bb0a1a57765af09
3
+ metadata.gz: 5a4ecd52efb335b2688fb0fd381163d594b81de592ed48dcd5701ee28c00d10f
4
+ data.tar.gz: 53ef139383420c858b4ce5afcb52974af1051cdb2086a83bcd28256311724a76
5
5
  SHA512:
6
- metadata.gz: d47550e712d840c8b1d62fd3b0a7b5a34b5bd8aaf71e6fbbc48cede293d9192d0a2d6801f9176c5d09d5d42b688c28cbb7b468ea035253131f4bb049d55ffb03
7
- data.tar.gz: 743df5145f4670590dbeeb08c36d32a9fea41a465ae05e8594230c554e76abb9e540122c57455a1744a8f7fd575b08ee93802c695f336188cba9dc1b773d9daf
6
+ metadata.gz: aea590ef7c2567f4f8014bd7d18f4e77e81b735afb9fb64444d680b419d0548d20edbf62308d7f3bd5904fa4a225cabaf5b47649955934976183e6ffcb9a63e2
7
+ data.tar.gz: 1a44e91626c5e3c1b3d5d37574bea1ab19fbf10c2993a31436bede678660d96862f6029735b70988eebbb39107039fb843b0a1c58f29045b983a733eee4c4386
@@ -8,7 +8,16 @@ module Comee
8
8
  def index
9
9
  super do
10
10
  [
11
- CustomerOrder.includes(:client, :customer_order_items).all,
11
+ CustomerOrder.includes(:client, customer_order_items: :unit).order(:created_at),
12
+ fields: ["client", "customer_order_items.unit"]
13
+ ]
14
+ end
15
+ end
16
+
17
+ def show
18
+ super do
19
+ [
20
+ CustomerOrder.includes(:client, customer_order_items: :unit).find(params[:id]),
12
21
  fields: ["client", "customer_order_items.unit"]
13
22
  ]
14
23
  end
@@ -20,6 +20,12 @@ module Comee
20
20
  render json: {success: true, data: result}
21
21
  end
22
22
 
23
+ def cancel
24
+ item = set_object
25
+ item.update(canceled: true)
26
+ render_content(item)
27
+ end
28
+
23
29
  def destroy
24
30
  Comee::Core::SalesOrderItem.destroy(params[:id])
25
31
  render json: {success: true}
@@ -60,7 +60,7 @@ module Comee
60
60
  def model_params
61
61
  params.require(:payload).permit(:order_number, :order_date, :customer_order_id, :fulfillment_center_id, :client_id,
62
62
  :order_terms, :shipment_address, :delivery_address, :invoice_address, :destination,
63
- :handover_date, :shipping_date, :delivery_date, :consignee, :payment_term, :deivery_term,
63
+ :handover_date, :shipping_date, :delivery_date, :consignee, :payment_term, :delivery_term,
64
64
  :payment_penalty, :status, :total_price, :amount_paid, :pallete_note, :remark,
65
65
  files: [])
66
66
  end
@@ -1,7 +1,7 @@
1
1
  module Comee
2
2
  module Core
3
3
  class CustomerOrderItem < ApplicationRecord
4
- before_save :calculate_total_price, unless: proc { |item| item.total_price }
4
+ before_save :calculate_total_price
5
5
 
6
6
  belongs_to :customer_order
7
7
  belongs_to :product
@@ -2,7 +2,7 @@ module Comee
2
2
  module Core
3
3
  class SalesOrderItemSerializer < ActiveModel::Serializer
4
4
  attributes :id, :customer_item_no, :customer_item_description, :quantity, :quantity_delivered, :price, :handover_date,
5
- :delivery_date, :eb_number, :lead_time, :comment, :action_note, :po_reference, :total_price
5
+ :delivery_date, :eb_number, :lead_time, :comment, :action_note, :po_reference, :total_price, :canceled
6
6
 
7
7
  belongs_to :sales_order
8
8
  belongs_to :customer_order_item
data/config/routes.rb CHANGED
@@ -113,6 +113,7 @@ Comee::Core::Engine.routes.draw do
113
113
  resources :sales_order_items, except: [:index] do
114
114
  member do
115
115
  get "suggest", controller: :sales_order_items, action: :suggest_values
116
+ post "cancel"
116
117
  end
117
118
  end
118
119
  resources :shipment_items do
@@ -1,5 +1,5 @@
1
1
  module Comee
2
2
  module Core
3
- VERSION = "0.2.12".freeze
3
+ VERSION = "0.2.13".freeze
4
4
  end
5
5
  end
@@ -18,5 +18,6 @@ FactoryBot.define do
18
18
  comment { Faker::Lorem.sentence }
19
19
  action_note { Faker::Lorem.sentence }
20
20
  po_reference { Faker::Alphanumeric.alpha(number: 10) }
21
+ canceled { false }
21
22
  end
22
23
  end
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.2.12
4
+ version: 0.2.13
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-02-06 00:00:00.000000000 Z
11
+ date: 2024-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_model_serializers