Sha256: 862bc7bec21f574bd01244d94fb8810becd699a4fb5fea91649bff51d473a94e
Contents?: true
Size: 1.48 KB
Versions: 28
Compression:
Stored size: 1.48 KB
Contents
module Comee module Core class CustomerOrderItemsController < ApplicationController include Common def index super do [ CustomerOrderItem.includes(:product, :unit).all, include: ["unit"] ] end end def cancel CustomerOrderItem.where(id: params[:ids]).update_all(canceled: true) render json: {success: true} end def filter data = CustomerOrderItem.includes(:product, :unit) .ransack(params[:q]) .result render_content(data, {include: ["unit"]}) end def destroy item = CustomerOrderItem.find(params[:id]) if item.customer_order.draft? item.destroy render json: {success: true} else render json: {success: false, error: "Customer order should be in draft state."}, status: :forbidden end end private def model_params params.require(:payload) .permit( :serial_no, :customer_item_no, :customer_item_description, :customer_item_alias, :quantity, :price, :total_price, :delivery_date, :canceled, :product_id, :customer_order_id, :unit_id, :use_alias ) end end end end
Version data entries
28 entries across 28 versions & 1 rubygems