move javascript on purchases#index