Class: Logistics::Core::AirWeighBillsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Logistics::Core::AirWeighBillsController
- Defined in:
- app/controllers/logistics/core/air_weigh_bills_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /air_weigh_bills POST /air_weigh_bills.json.
-
#index ⇒ Object
GET /air_weigh_bills GET /air_weigh_bills.json.
-
#update ⇒ Object
PATCH/PUT /air_weigh_bills/1 PATCH/PUT /air_weigh_bills/1.json.
Instance Method Details
#create ⇒ Object
POST /air_weigh_bills POST /air_weigh_bills.json
26 27 28 29 30 31 |
# File 'app/controllers/logistics/core/air_weigh_bills_controller.rb', line 26 def create effective_date = params[:effective_date] AirwayBillRate.generate_rate_for_air_weigh_bill_services(effective_date) @response = {:success => true, :message => 'Rate table generated successfully', :data => []} render json: @response end |
#index ⇒ Object
GET /air_weigh_bills GET /air_weigh_bills.json
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/controllers/logistics/core/air_weigh_bills_controller.rb', line 7 def index @air_weigh_bill_rates = AirwayBillRate.all air_weigh_bill_rates_array =[] @air_weigh_bill_rates.each { |awb| air_weigh_bill_rates_array.push({:id => awb.id, :high => awb.high, :low => awb.low, :medium => awb.medium, :margin => awb.margin, :effective_date => awb.effective_date, :service_delivery_unit_name => awb.chargeable_service_unit_of_charge.service_delivery_unit.name, :service_delivery_unit_id => awb.chargeable_service_unit_of_charge.service_delivery_unit.id, :transaction_type_id => awb.transaction_type_id, :transaction_type_name => awb.transaction_type.name, :chargeable_service_id => awb.chargeable_service_unit_of_charge.chargeable_service_id, :chargeable_service_name => awb.chargeable_service_unit_of_charge.chargeable_service.name}) } @response = {:success => true, :message => '', :data => air_weigh_bill_rates_array} render json: @response end |
#update ⇒ Object
PATCH/PUT /air_weigh_bills/1 PATCH/PUT /air_weigh_bills/1.json
35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'app/controllers/logistics/core/air_weigh_bills_controller.rb', line 35 def update service_rates = params[:updated_service_rates] service_rates.each { |service_rate| old_service_rate = AirwayBillRate.find(service_rate['id']) old_service_rate.low = service_rate['low'] old_service_rate.medium = service_rate['medium'] old_service_rate.high = service_rate['high'] old_service_rate.margin = service_rate['margin'] old_service_rate.effective_date = service_rate['effective_date'] old_service_rate.save } @response = {:success => true, :message => 'Rate table updated successfully', :data => service_rates} render json: @response end |