74 lines
2.2 KiB
Ruby
Executable File
74 lines
2.2 KiB
Ruby
Executable File
class Inventory::StockCheckItemsController < BaseInventoryController
|
|
before_action :set_stock_check_item, only: [:show, :edit, :update, :destroy]
|
|
|
|
# GET /stock_check_items
|
|
# GET /stock_check_items.json
|
|
def index
|
|
@stock_check_items = StockCheckItem.all
|
|
end
|
|
|
|
# GET /stock_check_items/1
|
|
# GET /stock_check_items/1.json
|
|
def show
|
|
end
|
|
|
|
# GET /stock_check_items/new
|
|
def new
|
|
@stock_check_item = StockCheckItem.new
|
|
end
|
|
|
|
# GET /stock_check_items/1/edit
|
|
def edit
|
|
end
|
|
|
|
# POST /stock_check_items
|
|
# POST /stock_check_items.json
|
|
def create
|
|
@stock_check_item = StockCheckItem.new(stock_check_item_params)
|
|
respond_to do |format|
|
|
if @stock_check_item.save
|
|
format.html { redirect_to inventory_stock_checks_path, notice: 'Stock check item was successfully created.' }
|
|
format.json { render :show, status: :created, location: @stock_check_item }
|
|
else
|
|
format.html { render :new }
|
|
format.json { render json: @stock_check_item.errors, status: :unprocessable_entity }
|
|
end
|
|
end
|
|
end
|
|
|
|
# PATCH/PUT /stock_check_items/1
|
|
# PATCH/PUT /stock_check_items/1.json
|
|
def update
|
|
respond_to do |format|
|
|
if @stock_check_item.update(stock_check_item_params)
|
|
format.html { redirect_to @stock_check_item, notice: 'Stock check item was successfully updated.' }
|
|
format.json { render :show, status: :ok, location: @stock_check_item }
|
|
else
|
|
format.html { render :edit }
|
|
format.json { render json: @stock_check_item.errors, status: :unprocessable_entity }
|
|
end
|
|
end
|
|
end
|
|
|
|
# DELETE /stock_check_items/1
|
|
# DELETE /stock_check_items/1.json
|
|
def destroy
|
|
@stock_check_item.destroy
|
|
respond_to do |format|
|
|
format.html { redirect_to stock_check_items_url, notice: 'Stock check item was successfully destroyed.' }
|
|
format.json { head :no_content }
|
|
end
|
|
end
|
|
|
|
private
|
|
# Use callbacks to share common setup or constraints between actions.
|
|
def set_stock_check_item
|
|
@stock_check_item = StockCheckItem.find(params[:id])
|
|
end
|
|
|
|
# Never trust parameters from the scary internet, only allow the white list through.
|
|
def stock_check_item_params
|
|
params.require(:stock_check_item).permit(:item_code, :stock_count)
|
|
end
|
|
end
|