This commit is contained in:
count-null 2025-02-25 19:21:31 -05:00
parent 27df1a73b5
commit a0cb5fb6b0
36 changed files with 1886 additions and 187 deletions

View file

@ -0,0 +1,27 @@
<section class="flex flex-col gap-4">
<h3 class="text-2xl font-semibold">Recently Sent Emails</h3>
<table class="min-w-full bg-white">
<thead>
<tr>
<th class="py-2">To</th>
<th class="py-2">From</th>
<th class="py-2">Subject</th>
<th class="py-2">Created At</th>
</tr>
</thead>
<tbody>
{% for email in recent_emails %}
<tr>
<td class="border px-4 py-2">{{ email.to_email }}</td>
<td class="border px-4 py-2">{{ email.from_email }}</td>
<td class="border px-4 py-2">{{ email.subject }}</td>
<td class="border px-4 py-2">{{ email.created_at }}</td>
</tr>
{% else %}
<tr>
<td class="border px-4 py-2" colspan="4">No recent emails found.</td>
</tr>
{% endfor %}
</tbody>
</table>
</section>

View file

@ -0,0 +1,10 @@
<section class="flex flex-col gap-4">
<a href="/admin">Dashboard</a>
<a href="/admin/users">Users</a>
<a href="/admin/orders">Orders</a>
<a href="/admin/returns">Returns</a>
<a href="/admin/emails">Emails</a>
<a href="/admin/transactions">Transactions</a>
INDEX
</section>

View file

@ -0,0 +1,3 @@
<section class="flex flex-col gap-4">
ORDERS
</section>

View file

@ -0,0 +1,3 @@
<section class="flex flex-col gap-4">
RETURNS
</section>

View file

@ -0,0 +1,61 @@
<section class="flex flex-col gap-4">
{% include 'lib/alert.twig' %}
<form action="/admin/transactions/add" method="post" class="flex flex-col gap-4">
{% if session.last_post.confirm %}
Confirm
<input type="hidden" name="confirm" id="confirm" value="{{ session.last_post.confirm }}">
{% endif %}
{% if session.last_post.amount is defined %}
{{ session.last_post.amount }} {{ session.last_post.currency }}
<input type="hidden" name="amount" id="amount" value="{{ session.last_post.amount }}">
{% else %}
{% include 'lib/number_input.twig' with {
id: 'amount',
name: 'amount',
label: 'Amount',
placeholder: 'Enter the amount',
value: session.last_post.amount,
required: true
} %}
{% endif %}
{% if session.last_post.currency is defined %}
<input type="hidden" name="currency" id="currency" value="{{ session.last_post.currency }}">
{% else %}
{% include 'lib/select.twig' with {
id: 'currency',
name: 'currency',
label: 'Currency',
value: session.last_post.currency,
options: [
{ 'value': 'sats', 'text': 'Sats' },
{ 'value': 'cents', 'text': 'Cents' }
],
required: true
} %}
{% endif %}
{% if session.last_post.user_identifier is defined %}
{% if session.last_post.email is defined %}
{{ session.last_post.id }} {{ session.last_post.email }}
{% endif %}
<input type="hidden" name="user_identifier" id="user_identifier" value="{{ session.last_post.user_identifier }}">
{% else %}
{% include 'lib/input.twig' with {
type: 'text',
name: 'user_identifier',
label: 'User Identifier',
placeholder: 'Enter email or user index',
value: session.last_post.user_identifier
} %}
{% endif %}
{% include 'lib/button.twig' with {
label: 'Submit',
onclick: 'this.parentNode.submit()'
} %}
</form>
{% if session.last_post %}
{% include 'lib/button.twig' with {
label: 'Cancel',
href: '/admin/transactions/reset'
} %}
{% endif %}
</section>

View file

@ -0,0 +1,144 @@
<section class="flex flex-col gap-4">
{% include 'lib/alert.twig' %}
<form action="/admin/transactions/add" method="post" class="flex flex-col gap-4">
{% include 'lib/number_input.twig' with {
id: 'amount',
name: 'amount',
label: 'Amount',
required: true
} %}
{% include 'lib/select.twig' with {
id: 'currency',
name: 'currency',
label: 'Currency',
options: [
{ value: 'cents', text: 'Cents' },
{ value: 'sats', text: 'Sats' }
],
required: true
} %}
{% include 'lib/button.twig' with {
label: 'Submit',
onclick: 'this.parentNode.submit()'
} %}
</form>
<h3 class="text-2xl font-semibold">Liabilities</h3>
<table class="min-w-full bg-white">
<thead>
<tr>
<th class="py-2">Currency</th>
<th class="py-2">Total Liability</th>
</tr>
</thead>
<tbody>
<tr>
<td class="border px-4 py-2">Sats</td>
<td class="border px-4 py-2">{{ sats_liability }}</td>
</tr>
<tr>
<td class="border px-4 py-2">Cents</td>
<td class="border px-4 py-2">{{ cents_liability }}</td>
</tr>
</tbody>
</table>
<h3 class="text-2xl font-semibold">Sats Transactions</h3>
<table class="min-w-full bg-white">
<thead>
<tr>
<th class="py-2">Type</th>
<th class="py-2">Amount (Sats)</th>
<th class="py-2">Date</th>
</tr>
</thead>
<tbody>
{% if recent_sats is not empty %}
{% for transaction in recent_sats %}
<tr>
<td class="border px-4 py-2">{{ transaction.type }}</td>
<td class="border px-4 py-2">{{ transaction.sats }}</td>
<td class="border px-4 py-2">{{ transaction.date }}</td>
</tr>
{% endfor %}
{% else %}
<tr>
<td class="border px-4 py-2" colspan="3">No Sats transactions available.</td>
</tr>
{% endif %}
</tbody>
</table>
<h3 class="text-2xl font-semibold">Cents Transactions</h3>
<table class="min-w-full bg-white">
<thead>
<tr>
<th class="py-2">Type</th>
<th class="py-2">Amount (Cents)</th>
<th class="py-2">Date</th>
</tr>
</thead>
<tbody>
{% if recent_cents is not empty %}
{% for transaction in recent_cents %}
<tr>
<td class="border px-4 py-2">{{ transaction.type }}</td>
<td class="border px-4 py-2">{{ transaction.cents }}</td>
<td class="border px-4 py-2">{{ transaction.date }}</td>
</tr>
{% endfor %}
{% else %}
<tr>
<td class="border px-4 py-2" colspan="3">No Cents transactions available.</td>
</tr>
{% endif %}
</tbody>
</table>
<h3 class="text-2xl font-semibold">Whales Sats</h3>
<table class="min-w-full bg-white">
<thead>
<tr>
<th class="py-2">User ID</th>
<th class="py-2">Total Sats</th>
</tr>
</thead>
<tbody>
{% if whales_sats is not empty %}
{% for whale in whales_sats %}
<tr>
<td class="border px-4 py-2">{{ whale.user_id }}</td>
<td class="border px-4 py-2">{{ whale.total }}</td>
</tr>
{% endfor %}
{% else %}
<tr>
<td class="border px-4 py-2" colspan="2">No Sats whales available.</td>
</tr>
{% endif %}
</tbody>
</table>
<h3 class="text-2xl font-semibold">Whales Cents</h3>
<table class="min-w-full bg-white">
<thead>
<tr>
<th class="py-2">User ID</th>
<th class="py-2">Total Cents</th>
</tr>
</thead>
<tbody>
{% if whales_cents is not empty %}
{% for whale in whales_cents %}
<tr>
<td class="border px-4 py-2">{{ whale.user_id }}</td>
<td class="border px-4 py-2">{{ whale.total }}</td>
</tr>
{% endfor %}
{% else %}
<tr>
<td class="border px-4 py-2" colspan="2">No Cents whales available.</td>
</tr>
{% endif %}
</tbody>
</table>
</section>

View file

@ -0,0 +1,3 @@
<section class="flex flex-col gap-4">
USERS
</section>