class Admin::WishesController < ApplicationController
  layout "admin"
  before_filter :auth_admin


  def index
    @need = Need.find(params[:need_id])
    @wishes = @need.wishes.order(created_at: :desc).page params[:page]

  end

  def destroy
    @wish = Wish.find(params[:id])
    if(@wish.destroy)
      flash[:notice] = "Intérêt supprimé avec succès."
    end
    redirect_to :back
  end

  def download_devis

    @wish = Wish.find(params[:id])
    @need = @wish.need

    send_file @wish.devis.file.path, filename: "devis-need-#{@need.id}.#{@wish.devis.file.extension}"
  end





end
