Improve admin donation pages
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing

This commit is contained in:
Râu Cao 2023-02-26 11:33:11 +08:00
parent 1c3e893b6b
commit 5f74212603
Signed by: raucao
GPG Key ID: 15E65F399D084BA9
4 changed files with 53 additions and 76 deletions

View File

@ -10,46 +10,24 @@
</div> </div>
<% end %> <% end %>
<div class="field"> <div class="sm:w-1/2 grid grid-cols-2 items-center gap-y-2">
<p> <%= form.label :user_id %>
<%= form.label :user_id %> <%= form.collection_select :user_id, User.where(ou: "kosmos.org").order(:cn), :id, :cn, {} %>
<%= form.collection_select :user_id, User.where(ou: "kosmos.org").order(:cn), :id, :cn %>
</p>
</div>
<div class="field"> <%= form.label :amount_sats, "Amount BTC (sats)" %>
<p> <%= form.number_field :amount_sats %>
<%= form.label :amount_sats, "Amount BTC (sats)" %>
<%= form.number_field :amount_sats %>
</p>
</div>
<div class="field"> <%= form.label :amount_eur, "Amount EUR (cents)" %>
<p> <%= form.number_field :amount_eur %>
<%= form.label :amount_eur, "Amount EUR (cents)" %>
<%= form.number_field :amount_eur %>
</p>
</div>
<div class="field"> <%= form.label :amount_usd, "Amount USD (cents)"%>
<p> <%= form.number_field :amount_usd %>
<%= form.label :amount_usd, "Amount USD (cents)"%>
<%= form.number_field :amount_usd %>
</p>
</div>
<div class="field"> <%= form.label :public_name %>
<p> <%= form.text_field :public_name %>
<%= form.label :public_name %>
<%= form.text_field :public_name %>
</p>
</div>
<div class="field"> <%= form.label :paid_at %>
<p> <%= form.text_field :paid_at %>
<%= form.label :paid_at %>
<%= form.text_field :paid_at %>
</p>
</div> </div>
<p class="mt-8"> <p class="mt-8">

View File

@ -1,12 +1,9 @@
<%= render HeaderComponent.new(title: "Donations") %> <%= render HeaderComponent.new(title: "Donation ##{@donation.id}") %>
<%= render MainSimpleComponent.new do %> <%= render MainSimpleComponent.new do %>
<h2>Editing Donation</h2>
<%= render 'form', donation: @donation, url: admin_donation_path(@donation) %> <%= render 'form', donation: @donation, url: admin_donation_path(@donation) %>
<p class="mt-8"> <p class="mt-8">
<%= link_to 'Show', admin_donation_path(@donation), class: 'ks-text-link' %> | <%= link_to 'Cancel', admin_donation_path(@donation), class: 'btn-sm btn-gray' %>
<%= link_to 'Back', admin_donations_path, class: 'ks-text-link' %>
<p> <p>
<% end %> <% end %>

View File

@ -1,8 +1,6 @@
<%= render HeaderComponent.new(title: "Donations") %> <%= render HeaderComponent.new(title: "Add Donation") %>
<%= render MainSimpleComponent.new do %> <%= render MainSimpleComponent.new do %>
<h2>New Donation</h2>
<%= render 'form', donation: @donation, url: admin_donations_path %> <%= render 'form', donation: @donation, url: admin_donations_path %>
<p class="mt-8"> <p class="mt-8">

View File

@ -1,37 +1,41 @@
<%= render HeaderComponent.new(title: "Donations") %> <%= render HeaderComponent.new(title: "Donation ##{@donation.id}") %>
<%= render MainSimpleComponent.new do %> <%= render MainSimpleComponent.new do %>
<table class="w-1/2"> <section>
<tbody> <table class="w-1/2 divided">
<tr> <tbody>
<th>User</th> <tr>
<td><%= link_to @donation.user.address, admin_user_path(@donation.user.address), class: 'ks-text-link' %></td> <th>User</th>
</tr> <td><%= link_to @donation.user.address, admin_user_path(@donation.user.address), class: 'ks-text-link' %></td>
<tr> </tr>
<th>Amount sats</th> <tr>
<td><%= @donation.amount_sats %></td> <th>Amount sats</th>
</tr> <td><%= @donation.amount_sats %></td>
<tr> </tr>
<th>Amount EUR</th> <tr>
<td><%= @donation.amount_eur %></td> <th>Amount EUR</th>
</tr> <td><%= @donation.amount_eur %></td>
<tr> </tr>
<th>Amount USD</th> <tr>
<td><%= @donation.amount_usd %></td> <th>Amount USD</th>
</tr> <td><%= @donation.amount_usd %></td>
<tr> </tr>
<th>Public name</th> <tr>
<td><%= @donation.public_name %></td> <th>Public name</th>
</tr> <td><%= @donation.public_name %></td>
<tr> </tr>
<th>Date</th> <tr>
<td><%= @donation.paid_at.strftime("%Y-%m-%d (%H:%M UTC)") %></td> <th>Date</th>
</tr> <td><%= @donation.paid_at.strftime("%Y-%m-%d (%H:%M UTC)") %></td>
</tbody> </tr>
</table> </tbody>
</table>
</section>
<p class="mt-8"> <section>
<%= link_to 'Edit', edit_admin_donation_path(@donation), class: 'ks-text-link' %> | <p>
<%= link_to 'Back', admin_donations_path, class: 'ks-text-link' %> <%= link_to 'Edit', edit_admin_donation_path(@donation), class: 'btn-md btn-blue mr-1' %>
</p> <%= link_to 'Back', admin_donations_path, class: 'btn-md btn-gray' %>
</p>
</section>
<% end %> <% end %>