Orders

<%if @btc_multipay_available %> <%=link_to 'Multipay with bitcoin', multipay_path(payment_method: PaymentMethod.bitcoin.id), class: 'btn btn-primary btn-sm' %> <%end%> <%if @ltc_multipay_available %> <%=link_to 'Multipay with litecoin', multipay_path(payment_method: PaymentMethod.litecoin.id), class: 'btn btn-primary btn-sm' %> <%end%>

<% if is_vendor? %> <% if @filter_paid %> <%= link_to 'Show unpaid', vendor_orders_path(filter_paid: false), class: 'btn btn-primary btn-xs' %> <%else%> <%# 'Exclude unpaid' not applicable when viewing archived because they cannot be archived. %> <%= link_to 'Exclude unpaid', vendor_orders_path(filter_paid: true), class: "btn btn-primary btn-xs #{@filter_archived_only ? 'disabled' : ''}" %> <%end%> <% if @filter_archived_only %> <%= link_to 'Show unarchived', vendor_orders_path(filter_archived_only: false), class: 'btn btn-primary btn-xs' %> <%else%> <%= link_to 'Show archived', vendor_orders_path(filter_archived_only: true), class: 'btn btn-primary btn-xs' %> <%end%> <%= link_to 'Actions view', vendor_orders_path(actions_view: true, filter_archived_only: @filter_archived_only, filter_paid: @filter_paid), class: 'btn btn-primary btn-xs' %> <%end%>

<% if is_vendor? %> <%else%> <%end%> <% if is_vendor? %> <%end%> <% @orders.each do |order| %> <% if is_vendor? %> <%else%> <%end%> <%# Price ([in users currency]) %> <%# Pay price %> <% if is_vendor? %> <%end%> <% if is_vendor? %> <%else%><%# buyer %> <%end%> <% end %>
Order date ProductBuyerVendorStatus Feedback Total quantity Price (<%= current_user.currency %>) Pay PricePayout
<%= order.created_at.in_time_zone(current_user.timezone).strftime('%F') %> <%= order.title %> <%= link_to truncate(order.buyer.displayname, length:15), profile_path(order.buyer) %><%= link_to truncate(order.vendor.displayname, length:15), profile_path(order.vendor) %> <% labeltype = (order.status == Order::EXPIRED) ? 'warning' : 'primary' %> <%= order.status %> <%if order.locked %>

locked

<%end%> <% if is_vendor? && order.status == Order::PAID && order.unseen == 1 %> new <%end%> <% if order.status == Order::PAYMENT_PENDING && !order.stock_available? %>

insufficient stock

<%end%> <% if order.status == Order::SHIPPED %>

<%= order.dispatched_on.in_time_zone(current_user.timezone).strftime('%F') %>

<%end%>
<% if order.allow_feedback_submission? %> <% unless order.feedbacks.find_by(placedby: current_user) %> <%= link_to 'Submit feedback', new_feedback_path(order: order.id) %>
<%end%> <% if f = order.feedbacks.find_by(placedon: current_user) %> <%= truncate(f.feedback, length: 20, separator: ' ') %> <%end%> <%else%> n/a <%end%>
<%= "%g" % order.total_quantity %> <%=order.product.unitdesc%> <%= currency_format(order.total_price_in_currency(current_user.currency)) %>  <%= order.btc_price %> <%=image_tag("#{order.payment_method.name.downcase}.svg", class: "small_logo", width: "16", height: "16")%> <% if order.vendor_payout %> <% if order.vendor_payout.paid %> paid <%elsif order.vendor_payout.btc_address %> pending <%else%> no address set <%end%> <%else%> n/a <%end%> <%# Historically all action buttons were only on the order show screen but to make order processing easier for vendor, they were duplicated to the index screen. %> <%# No accept button here because you need to view the order and verify postage details valid before accepting. %> <% if order.allow_shipped? %> <%= form_for([:vendor, order], method: 'post', url: vendor_ship_order_path(order, return_to_index: true), html: { class: 'inline' }) do |f| %> <%= f.submit 'Ship', class: 'btn btn-secondary btn-sm' %> <% end %> <%end%> <% if order.allow_vendor_archive? %> <%= form_for([:vendor, order], method: 'post', url: vendor_archive_order_path(order, return_to_index: true), html: { class: 'inline' }) do |f| %> <%= f.submit 'Archive', class: 'btn btn-info btn-sm' %> <% end %> <%end%> <% if order.archived_by_vendor %> <%= form_for([:vendor, order], method: 'post', url: vendor_unarchive_order_path(order), html: { class: 'inline' }) do |f| %> <%= f.submit 'Unarchive', class: 'btn btn-info btn-sm' %> <% end %> <%end%> <%= link_to 'Details', vendor_order_path(order), class: "btn btn-primary btn-sm" %> <% if order.allow_finalize? %> <%# Finalize button added to orders index to encourage using it. On the order view they forget. %> <%= link_to 'Finalize', finalize_confirm_order_path(order), class: 'btn btn-success btn-sm' %> <% end %> <%= link_to 'Details', order, class: "btn btn-primary btn-sm" %>
Order count: <%=@orders_count%>
<%= paginate @orders %>