summaryrefslogtreecommitdiff
path: root/app/views
diff options
context:
space:
mode:
Diffstat (limited to 'app/views')
-rw-r--r--app/views/bazaar/index.html.erb46
1 files changed, 16 insertions, 30 deletions
diff --git a/app/views/bazaar/index.html.erb b/app/views/bazaar/index.html.erb
index e41fb2c..28f7109 100644
--- a/app/views/bazaar/index.html.erb
+++ b/app/views/bazaar/index.html.erb
@@ -36,34 +36,6 @@
</div>
<div class="my-8">
- <h2 class="text-xl mb-4">Your Orders</h2>
- <table class="table-auto mb-8">
- <thead>
- <tr>
- <th class="table-header-padded">Item</th>
- <th class="table-header-padded">Quantity</th>
- <th class="table-header-padded">Type</th>
- <th class="table-header-padded">Price Each</th>
- <th class="table-header-padded">Cancel</th>
- </tr>
- </thead>
- <tbody>
- <% @bazaar_orders.where(character: current_char).each do |bo| %>
- <tr>
- <td class="table-cell-padded"><%= bo.item.name %></td>
- <td class="table-cell-padded"><%= bo.quantity %></td>
- <td class="table-cell-padded"><%= bo.buy_order? ? "Buy" : "Sell" %></td>
- <td class="table-cell-padded"><%= bo.price_each %></td>
- <td class="table-cell-padded">
- <%= button_to "Cancel", bazzar_cancel_offer_path(id: bo.id), method: :delete %>
- </td>
- </tr>
- <% end %>
- </tbody>
- </table>
-</div>
-
-<div class="my-8">
<h2 class="text-xl mb-4">Sell Orders</h2>
<table class="table-auto mb-8">
@@ -74,10 +46,12 @@
<th class="table-header-padded">From</th>
<th class="table-header-padded">Price Each</th>
<th class="table-header-padded">Buy</th>
+ <th class="table-header-padded">Cancel</th>
</tr>
</thead>
<tbody>
- <% @bazaar_orders.where(buy_order: false).where.not(character: current_char).each do |bo| %>
+ <% @bazaar_orders.where(buy_order: false)
+ .order("items.name ASC, price_each ASC, created_at ASC").each do |bo| %>
<tr>
<td class="table-cell-padded"><%= bo.item.name %></td>
<td class="table-cell-padded"><%= bo.quantity %></td>
@@ -89,6 +63,11 @@
<%= f.submit "Buy" %>
<% end %>
</td>
+ <td class="table-cell-padded">
+ <% if bo.character == current_char %>
+ <%= button_to "Cancel", bazzar_cancel_offer_path(id: bo.id), method: :delete %>
+ <% end %>
+ </td>
</tr>
<% end %>
</tbody>
@@ -106,10 +85,12 @@
<th class="table-header-padded">From</th>
<th class="table-header-padded">Price Each</th>
<th class="table-header-padded">Sell</th>
+ <th class="table-header-padded">Cancel</th>
</tr>
</thead>
<tbody>
- <% @bazaar_orders.where(buy_order: true).where.not(character: current_char).each do |bo| %>
+ <% @bazaar_orders.where(buy_order: true)
+ .order("items.name ASC, price_each DESC, created_at ASC").each do |bo| %>
<tr>
<td class="table-cell-padded"><%= bo.item.name %></td>
<td class="table-cell-padded"><%= bo.quantity %></td>
@@ -121,6 +102,11 @@
<%= f.submit "Sell" %>
<% end %>
</td>
+ <td class="table-cell-padded">
+ <% if bo.character == current_char %>
+ <%= button_to "Cancel", bazzar_cancel_offer_path(id: bo.id), method: :delete %>
+ <% end %>
+ </td>
</tr>
<% end %>
</tbody>