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