chore: init commit
in worker.../repo/GITFOLDER.zip is the .git folder.
This commit is contained in:
@@ -0,0 +1,145 @@
|
||||
<div class="flex flex-col h-full w-full">
|
||||
<% if notice.present? %>
|
||||
<p class="py-2 px-3 bg-green-50 mb-5 text-green-500 font-medium rounded-lg inline-block" id="notice">
|
||||
<%= notice %>
|
||||
</p>
|
||||
<% end %>
|
||||
|
||||
<header class="flex items-center justify-between px-6 py-4 border-b">
|
||||
<h1 class="text-2xl font-bold py-2">Transactions</h1>
|
||||
</header>
|
||||
|
||||
<main class="flex-1 p-6">
|
||||
<%= render "shared/table_container" do %>
|
||||
<thead>
|
||||
<tr class="table-header-row min-w-full">
|
||||
<th class="table-header-cell table-header-cell-left">
|
||||
<%= sort_link(:created_at, "Date") %>
|
||||
</th>
|
||||
<% if current_user&.teacher_or_admin? %>
|
||||
<th class="table-header-cell table-header-cell-left">
|
||||
<%= sort_link(:username, "Username") %>
|
||||
</th>
|
||||
<th class="table-header-cell table-header-cell-left">
|
||||
<%= sort_link(:classroom, "Class") %>
|
||||
</th>
|
||||
<% end %>
|
||||
<th class="table-header-cell table-header-cell-left">
|
||||
<%= sort_link(:stock, "Stock") %>
|
||||
</th>
|
||||
<th class="table-header-cell table-header-cell-left">
|
||||
<%= sort_link(:price_per_share, "Price per share") %>
|
||||
</th>
|
||||
<th class="table-header-cell table-header-cell-left">
|
||||
<%= sort_link(:shares, "Shares") %>
|
||||
</th>
|
||||
<th class="table-header-cell table-header-cell-left">
|
||||
<%= sort_link(:status, "Status") %>
|
||||
</th>
|
||||
<th class="table-header-cell table-header-cell-left">
|
||||
Type
|
||||
</th>
|
||||
<th class="table-header-cell table-header-cell-right">
|
||||
<%= sort_link(:total_cost, "Total Cost") %>
|
||||
</th>
|
||||
<th class="table-header-cell table-header-cell-right" />
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% if @orders.any? %>
|
||||
<% @orders.each do |order| %>
|
||||
<tr id="<%= dom_id(order) %>" class="table-body-row">
|
||||
<td class="table-body-cell">
|
||||
<span class="table-cell-content">
|
||||
<%= order.created_at.to_date %>
|
||||
</span>
|
||||
</td>
|
||||
<% if current_user&.teacher_or_admin? %>
|
||||
<td class="table-body-cell">
|
||||
<span class="table-cell-content">
|
||||
<%= order.user.username %>
|
||||
</span>
|
||||
</td>
|
||||
<td class="table-body-cell">
|
||||
<span class="table-cell-content">
|
||||
<%= order.user.classroom&.name || "-" %>
|
||||
</span>
|
||||
</td>
|
||||
<% end %>
|
||||
<td class="table-body-cell">
|
||||
<div class="flex flex-col gap-1">
|
||||
<span class="font-medium text-base text-black leading-tight">
|
||||
<%= order.stock.company_name %>
|
||||
</span>
|
||||
<span class="text-sm text-gray-600 leading-tight">
|
||||
<%= order.stock.ticker %>
|
||||
</span>
|
||||
</div>
|
||||
</td>
|
||||
<td class="table-body-cell">
|
||||
<span class="table-cell-content">
|
||||
$<%= order.stock.current_price %>
|
||||
</span>
|
||||
</td>
|
||||
<td class="table-body-cell">
|
||||
<span class="table-cell-content">
|
||||
<%= order.shares %>
|
||||
</span>
|
||||
</td>
|
||||
<td class="table-body-cell">
|
||||
<div class="box-border content-stretch flex gap-2 h-9 items-center justify-center px-4 py-2 relative rounded-[16px] shrink-0 inline-flex
|
||||
<%= case order.status
|
||||
when 'pending'
|
||||
'bg-yellow-100 text-yellow-800'
|
||||
when 'completed'
|
||||
'bg-green-100 text-green-800'
|
||||
when 'canceled'
|
||||
'bg-red-100 text-red-800'
|
||||
else
|
||||
'bg-gray-100 text-gray-800'
|
||||
end %>">
|
||||
<div class="font-medium leading-[0] relative shrink-0 text-[14px] text-nowrap">
|
||||
<p class="leading-[20px] whitespace-pre"><%= order.status.capitalize %></p>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td class="table-body-cell">
|
||||
<%= order.action.capitalize %>
|
||||
</td>
|
||||
<td class="table-body-cell table-body-cell-right">
|
||||
<span class="table-cell-content">
|
||||
<% if order.stock.price_cents && order.shares %>
|
||||
<%= number_to_currency(order.purchase_cost / 100.0) %>
|
||||
<% else %>
|
||||
<span class="text-gray-600">Price unavailable</span>
|
||||
<% end %>
|
||||
</span>
|
||||
</td>
|
||||
<td class="table-body-cell table-body-cell-center">
|
||||
<div class="flex justify-center space-x-2">
|
||||
<% if order.pending? %>
|
||||
<%= link_to edit_order_path(order), class: "table-action-link", data: { turbo_frame: "modal_frame", testid: "edit-order-button" } do %>
|
||||
<i class="fa fa-pencil fa-lg"></i>
|
||||
<% end %>
|
||||
<%= form_with url: cancel_order_path(order), method: :patch, data: { confirm: t("orders.cancel.confirm"), turbo_confirm: t("orders.cancel.confirm") } do %>
|
||||
<button type="submit" class="table-action-button" title="Cancel" data-testid="cancel-order-button">
|
||||
<i class="fa fa-ban fa-lg"></i>
|
||||
</button>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<tr class="table-body-row" data-testid="no-orders">
|
||||
<td class="table-empty-cell" colspan="9">
|
||||
<p class="text-lg">No orders found</p>
|
||||
<p class="mt-2">Create your first order to get started!</p>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
<% end %>
|
||||
</main>
|
||||
</div>
|
||||
Reference in New Issue
Block a user