shipment-viewer/app/views/shipments.erb
Leo Wilkin a7a99a6399
more admin functions (#16)
* add a favicon!

* add admin card and send email button

* Update main.rb to allow for email sending

* add user information to both public and internal!

* let's else that

---------

Co-authored-by: nora <163450896+24c02@users.noreply.github.com>
2025-01-06 13:25:55 -05:00

44 lines
1.7 KiB
Text

<% content_for :head do %>
<script src="https://cdn.jsdelivr.net/npm/macy@2.5.1"></script>
<% end %>
<div class="container">
<% if @internal %>
<div class="card internal" style="margin-bottom: var(--spacing-3); display: flex; justify-content: space-between; align-items: center;">
<a href="/internal"><button class="button">← Back</button></a>
<h3>Viewing shipments for: <%= params[:email] %></h3>
<form action="/dyn/send_mail" method="post" style="display: inline;">
<input type="hidden" name="email" value="<%= params[:email] %>">
<button type="submit" class="button">Send Email</button>
</form>
</div>
<% else %>
<div class="card" style="margin-bottom: var(--spacing-3); display: flex; justify-content: space-between; align-items: center;">
<span>You're signed in as <a href="mailto:<%= params[:email] %>"><%= params[:email] %></a> 👋🏻</span>
<a href="/"><button type="submit" class="button">Not you?</button></a>
</div>
<% end %>
<% if @shipments.empty? %>
<img src="https://cloud-m5nxd8r27-hack-club-bot.vercel.app/0cleanshot_2025-01-02_at_14.18.09_2x.png" alt="no shipments?">
<% else %>
<div class="shipments" id="shipments-container">
<%# for each shipment, render the partial _shipment.erb: %>
<% @shipments.each do |shipment, i| %>
<%= erb :_shipment, locals: { shipment: } %>
<% end %>
</div>
<% end %>
</div>
<script>
var macy = Macy({
container: '#shipments-container',
trueOrder: true,
waitForImages: false,
margin: 20,
columns: 3,
breakAt: {
940: 2,
700: 1,
}
});
</script>