             # Need to have suppliers before we get products so we can match suppliers to product.supplier
             dataFetcher("/api/products/managed?template=bulk_index;page=1;per_page=500").then (data) ->
               $scope.resetProducts data
-
-
         else if authorise_api_reponse.hasOwnProperty("error")
           $scope.api_error_msg = authorise_api_reponse("error")
         else

          $scope.setMessage model, "", {}, false
        , timeout, true)

    $scope.displayUpdating = ->
      $scope.setMessage $scope.updateStatusMessage, "Updating...",
        color: "orange"
      , false

    $scope.displaySuccess = ->
      $scope.setMessage $scope.updateStatusMessage, "Update complete",
        color: "green"
      , 3000

    $scope.displayFailure = (failMessage) ->
      $scope.setMessage $scope.updateStatusMessage, "Updating failed. " + failMessage,
        color: "red"
      , 10000

    $scope.displayDirtyProducts = ->
      if $scope.dirtyProductCount() > 0



productsApp.controller "AdminBulkProductsCtrl", [
  "$scope", "$timeout", "$http", "dataFetcher"
  ($scope, $timeout, $http, dataFetcher) ->
    $scope.updateStatusMessage =
      text: ""
      style: {}

    $scope.columns =
      name:         {name: "Name",         visible: true}
      supplier:     {name: "Supplier",     visible: true}
      price:        {name: "Price",        visible: true}
      unit:         {name: "Unit",         visible: true}
      on_hand:      {name: "On Hand",      visible: true}
      available_on: {name: "Available On", visible: true}

    $scope.variant_unit_options = [
      "Weight (g)", "Weight (kg)", "Weight (T)"
      "Volume (mL)", "Volume (L)", "Volume (ML)"
      "Items"
    ]


    $scope.initialise = (spree_api_key) ->
      authorise_api_reponse = ""
