<% provide(:head_title, t("storage_locations.index.head_title")) %>
<% provide(:container_class, "no-second-nav-container") %>

<% if current_team %>
  <div class="content-pane with-grey-background flexible">
    <div class="content-header">
      <div class="title-row">
        <% if @parent_location && can_manage_storage_location?(@parent_location)  %>
          <h1 class="storage-locations-title">
            <%= render partial: "shared/inline_editing",
                       locals: {
                         initial_value: @parent_location.name,
                         config: @inline_editable_title_config
                       } %>
          </h1>
        <% elsif @parent_location %>
          <h1><%= @parent_location.name %></h1>
        <% else %>
          <h1><%= t('storage_locations.index.head_title') %></h1>
        <% end %>
      </div>
    </div>
    <div class="content-body " data-e2e="e2e-CO-storageLocations">
      <div id="storageLocationsTable" class="fixed-content-body">
        <storage-locations
          actions-url="<%= actions_toolbar_storage_locations_path(current_team) %>"
          :can-create-location="<%= can_create_storage_locations?(current_team) %>"
          :can-create-container="<%= can_create_storage_location_containers?(current_team) %>"
          :can-manage-parent="<%= can_manage_storage_location?(@parent_location) if @parent_location %>"
          :has-parent="<%= @parent_location.present? %>"
          data-source="<%= storage_locations_path(format: :json, parent_id: params[:parent_id]) %>"
          direct-upload-url="<%= rails_direct_uploads_url %>"
          create-location-url="<%= storage_locations_path(parent_id: params[:parent_id]) %>"
          create-location-instance-url="<%= storage_locations_path(parent_id: params[:parent_id]) %>"
        />
      </div>
    </div>
  </div>

  <%= javascript_include_tag 'vue_storage_locations_table' %>
<% end %>
