77 lines
1.1 KiB
Ruby
77 lines
1.1 KiB
Ruby
# -*- encoding : utf-8 -*-
|
|
|
|
class Admin::PShipBillsController < ApplicationController
|
|
layout "admin"
|
|
before_filter :auth_admin
|
|
|
|
before_filter :admin_space
|
|
|
|
def admin_space
|
|
@admin_space = "stocks"
|
|
end
|
|
|
|
def index
|
|
@p_ship_bills = PShipBill.order("bill_at DESC").all
|
|
|
|
|
|
end
|
|
|
|
def show
|
|
@p_ship_bill = PShipBill.find(params[:id])
|
|
|
|
end
|
|
|
|
def new
|
|
|
|
|
|
@p_ship_bill = PShipBill.new(:bill_at => Time.now)
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
def edit
|
|
|
|
|
|
@p_ship_bill = PShipBill.find(params[:id])
|
|
end
|
|
|
|
def create
|
|
@p_ship_bill = PShipBill.new(params.require(:p_ship_bill).permit!)
|
|
|
|
|
|
if @p_ship_bill.save
|
|
@p_ship_bills = PShipBill.order("bill_at DESC").all
|
|
|
|
else
|
|
render action: "new"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
def update
|
|
@p_ship_bill = PShipBill.find(params[:id])
|
|
|
|
|
|
if @p_ship_bill.update_attributes(params.require(:p_ship_bill).permit!)
|
|
|
|
@p_ship_bills = PShipBill.order("bill_at DESC").all
|
|
else
|
|
render action: "edit"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
def destroy
|
|
@p_ship_bill = PShipBill.find(params[:id])
|
|
@p_ship_bill.destroy
|
|
|
|
|
|
end
|
|
end
|