<% bd_presenter = BorrowDirectPresenter.new(renderer) %> <% if bd_presenter.show_link_response? %> <%# display it the normal way with a standard response type %> <% end %> <% if bd_presenter.show_link_response? && (bd_presenter.show_request_form? || bd_presenter.show_not_available? || bd_presenter.service_in_progress? ) %> <%# separator between link and form when both are present %>
<% end %> <% if bd_presenter.show_confirmation? %>

<%= t("umlaut.services.borrow_direct_adaptor.bd_request_status.confirmation") %> <%= bd_presenter.status_response.view_data["request_number"] %>

<% end %> <% if bd_presenter.show_request_form? %> <% if str = bd_presenter.validation_error %>

<%= str %>

<% end %> <%= render "borrow_direct/request_form", :response => bd_presenter.request_prompt_response %> <% end %> <% if bd_presenter.show_not_available? %>

<%= t('umlaut.services.borrow_direct_adaptor.bd_not_available.display_text') %> <% if bd_presenter.link_response %> <%= link_to t('umlaut.services.borrow_direct_adaptor.bd_not_available.workaround_link'), link_router_url(bd_presenter.link_response), :class => "bd-direct-link", :target => "_blank" %> <% end %>

<% end %> <%# we do custom spinner, so we can customize label for 'placing request' %> <% if bd_presenter.service_in_progress? %> <%= render bd_presenter.spinner_render_hash %> <% end %> <%# do we have an error in the DispatchedService? If so, display a warning at bottom of the section no matter what. Do we have a bd_request_status with an error? Display it too. %> <% errors = umlaut_request. dispatch_objects_with(:service_type_values => UmlautBorrowDirect.service_type_values). find_all {|ds| ds.failed? } if errors.present? %> <% if bd_presenter.show_link_response? %>
<% end %> <%= content_tag "div", :class => bd_presenter.error_div_classes, :role=> "alert" do %>

<%= t(bd_presenter.error_message_i18n_key) %> <% if bd_presenter.link_response %> <%= link_to t('umlaut.display_sections.borrow_direct.workaround_link'), link_router_url(bd_presenter.link_response), :class => "bd-direct-link", :target => "_blank" %> <% end %>

<% if bd_presenter.user_reportable_error %>

<%= bd_presenter.user_reportable_error %>

<% end %> <% end %> <% end %>