MiraitSystems/enju_trunk

View on GitHub
app/views/order_lists/show.html.erb

Summary

Maintainability
Test Coverage
<div id="content_detail" class="ui-corner-all ui-widget-content">
<h1 class="title"><%= t('page.showing', model: t('activerecord.models.order_list')) -%></h1>
<div id="content_list">
<p id="notice"><%= notice %></p>

<% if @order_list.user %>
<p>
  <strong><%= t('activerecord.models.user') -%>:</strong>
  <%= link_to @order_list.user.username, @order_list.user -%>
</p>
<% end %>

<p>
  <strong><%= t('activerecord.attributes.order_list.title') -%>:</strong>
  <%= @order_list.title -%>
</p>

<p>
  <strong><%= t('activerecord.models.bookstore') -%>:</strong>
  <%= link_to @order_list.bookstore.name, @order_list.bookstore -%>
</p>

<p>
  <strong><%= t('activerecord.attributes.order_list.state') -%>:</strong>
  <font style="color: red">
    <%= localized_order_state(@order_list.state) -%>
    <% if @order_list.completed_at %>
    (<%= l(@order_list.completed_at.to_date) %>)
    <% end %>
  </font>
</p>

<p>
  <strong><%= t('activerecord.attributes.order_list.ordered_at') -%>:</strong>
  <%= l(@order_list.ordered_at.to_date) if @order_list.ordered_at -%>
</p>

<p>
  <strong><%= t('activerecord.attributes.order_list.note') -%>:</strong>
  <%= @order_list.note -%>
</p>

<p>
  <strong><%= t('activerecord.attributes.order_list.total_price') -%>:</strong>
  <%= number_to_currency(@order_list.total_price, unit: '') -%>
</p>

</div>

<table style="margin-left: 30px;">
  <tr>
    <th><%= t('activerecord.attributes.order.purchase_order_number') %></th>
    <th><%= t('activerecord.attributes.manifestation.isbn') %></th>
    <th><%= t('activerecord.attributes.manifestation.original_title') %></th>
    <th><%= t('activerecord.attributes.order.price_string_on_order') %></th>
    <th><%= t('activerecord.attributes.order.accept_status') %></th>
    <th> &nbsp; </th>
  </tr>
  <% @order_list.orders.order(:purchase_order_number).each do |o| %>
    <tr>
      <td><%= o.purchase_order_number %></td>
      <td>
        <% if o.item && o.item.manifestation %>
        <%= o.item.manifestation.isbn %>
        <% end %>
      </td>
      <td>
        <% if o.item && o.item.manifestation %>
        <%= link_to o.item.manifestation.original_title, o.item %>
        <% end %>
      </td>
      <td style="text-align: right;"><%= number_to_currency(o.price_string_on_order, unit: '') %></td>
      <td><%= accept_status(o) %></td>
      <td>
        <%- if @order_list.can_destroy? -%>
          <%= link_to t('order_list.remove_order_list'), order_path(id: o.id, order_list_id: @order_list.id), :confirm => t('page.are_you_sure'), :method => :delete -%>
        <%- end -%>
        <%- if o.can_cancel? -%>
          <%= link_to t('order_list.cancel_after_ordered'), order_path(id: o.id, order_list_id: @order_list.id), :confirm => t('order_list.are_you_sure_item_cancel'), :method => :delete -%>
        <%- end -%>
        <% if o.canceled_at %>
         <%= t('order_list.has_been_canceled') %>
        <% end %>
        <!---
        item_id=<%= o.item.id if o.item %>
        -->
      </td>
    </tr>
  <% end %>
</table>
<br />
</div>

<div id="submenu" class="ui-corner-all ui-widget-content">
  <ul>
    <li><%= link_to t('page.edit'), edit_order_list_path(@order_list) -%></li>
    <li><%= back_to_index(flash[:page_info]) -%></li>
  </ul>
  <br />
  <ul>
    <% if @order_list.available_order? %>
      <li><%= link_to t('order_list.do_order'), do_order_order_list_path(@order_list), :confirm => t('order_list.are_you_sure_to_ordered') %></li>
    <% else %>
      <p style="color: grey">&nbsp;<%= t('order_list.ordered_label') %></p>
      <li><%= link_to t('order_list.order_letter'), order_letter_order_list_path(@order_list) %></li>
      <br />
      <% if @order_list.precomplete? %>
        <p style="color: red">&nbsp;<%= t('order_list.precomplete') %></p>
      <% end %>
      <% unless @order_list.completed? %>
        <li><%= link_to t('order_list.change_state_to_completed'), completed_order_list_order_list_path(@order_list), :confirm => t('order_list.are_you_sure_to_completed') %></li>
      <% end %>
    <% end %>
  </ul>
</div>