class Admins::ShixunRecyclesController < Admins::BaseController

  def index
    sort_by = params[:sort_by].presence || 'created_at'
    sort_direction = params[:sort_direction].presence || 'desc'
    search = params[:search].to_s.strip
    shixuns = Shixun.where(status: -1).where("name like ?", "%#{search}%").order("#{sort_by} #{sort_direction}")
    @shixuns = paginate shixuns.preload(:user, :laboratory)
  end

  def destroy
    Shixun.find(params[:id]).destroy!

    render_delete_success
  end

  def resume
    Shixun.find(params[:id]).update!(status: 0)
    render_delete_success
  end

end