Sha256: cec8cd5c089fe6c544d6352103767911f2dbe85fd895a8c012ee3589b6197ee8

Contents?: true

Size: 1.07 KB

Versions: 76

Compression:

Stored size: 1.07 KB

Contents

module Comee
  module Core
    class BackOrdersController < ApplicationController
      include Common
      before_action :set_object, only: %i[show update submit]

      def index
        super do
          Comee::Core::BackOrder.includes(:back_order_items, :supplier)
        end
      end

      def submit
        ActiveRecord::Base.transaction do
          @obj.submit
          Comee::Core::BackOrderNotification.with(back_order: @obj).deliver(@obj.supplier.user)
          render json: {success: true, data: serialize(@obj.reload)}
        end
      rescue StandardError => e
        render json: {success: false, error: e.message}
      end

      def filter
        query = Comee::Core::BackOrder.ransack(params[:q])
        render json: {success: true, data: serialize(query.result.includes(:back_order_items, :supplier))}
      end

      def model_params
        params.require(:payload).permit(:order_number, :order_date, :delivery_date, :supplier_id, :terms,
                                        :delivery_address, :invoice_address, :status, :remark)
      end
    end
  end
end

Version data entries

76 entries across 76 versions & 1 rubygems

Version Path
comee_core-0.1.96 app/controllers/comee/core/back_orders_controller.rb
comee_core-0.1.95 app/controllers/comee/core/back_orders_controller.rb
comee_core-0.1.94 app/controllers/comee/core/back_orders_controller.rb
comee_core-0.1.93 app/controllers/comee/core/back_orders_controller.rb
comee_core-0.1.92 app/controllers/comee/core/back_orders_controller.rb
comee_core-0.1.91 app/controllers/comee/core/back_orders_controller.rb
comee_core-0.1.90 app/controllers/comee/core/back_orders_controller.rb
comee_core-0.1.89 app/controllers/comee/core/back_orders_controller.rb
comee_core-0.1.88 app/controllers/comee/core/back_orders_controller.rb
comee_core-0.1.87 app/controllers/comee/core/back_orders_controller.rb
comee_core-0.1.86 app/controllers/comee/core/back_orders_controller.rb
comee_core-0.1.85 app/controllers/comee/core/back_orders_controller.rb
comee_core-0.1.84 app/controllers/comee/core/back_orders_controller.rb
comee_core-0.1.83 app/controllers/comee/core/back_orders_controller.rb
comee_core-0.1.82 app/controllers/comee/core/back_orders_controller.rb
comee_core-0.1.81 app/controllers/comee/core/back_orders_controller.rb
comee_core-0.1.80 app/controllers/comee/core/back_orders_controller.rb
comee_core-0.1.79 app/controllers/comee/core/back_orders_controller.rb
comee_core-0.1.78 app/controllers/comee/core/back_orders_controller.rb
comee_core-0.1.77 app/controllers/comee/core/back_orders_controller.rb