brewlog/templates/partials/brew_list.html
Jon Seager c4357f2698
feat(brews): add web views and templates
- Add BrewView, BagOptionView, GearOptionView
- Add brews page with form and +/- adjustment buttons
- Add brew list partial with sortable columns
- Add Brews link to navigation
2026-02-02 19:31:46 +00:00

71 lines
3.3 KiB
HTML

{% import "partials/table.html" as table %}
<div id="brew-list" class="space-y-4" data-star-scope="brews">
<div class="rounded-lg border border-amber-300 bg-amber-100/80 shadow-sm">
{% call table::pagination_header(brews, navigator, "#brew-list") %}
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-amber-200 text-left text-sm text-stone-700">
<thead class="bg-amber-200/60 text-xs font-semibold tracking-wide text-amber-900">
<tr>
<th scope="col" class="px-4 py-3">Coffee</th>
{% call table::sortable_header("Weight", "coffee-weight", navigator, "#brew-list") %}
<th scope="col" class="px-4 py-3">Grind</th>
<th scope="col" class="px-4 py-3">Brewer</th>
{% call table::sortable_header("Water", "water-volume", navigator, "#brew-list") %}
<th scope="col" class="px-4 py-3">Temp</th>
<th scope="col" class="px-4 py-3">Ratio</th>
{% call table::sortable_header("Date", "created-at", navigator, "#brew-list") %}
{% if is_authenticated %}
<th scope="col" class="px-4 py-3 w-12"></th>
{% endif %}
</tr>
</thead>
<tbody class="divide-y divide-amber-200/70">
{% for brew in brews.items %}
<tr class="bg-amber-50/40 transition hover:bg-amber-50">
<td class="px-4 py-3 whitespace-nowrap">
<div class="font-medium text-stone-800">
<a href="/roasters/{{ brew.roaster_slug }}/roasts/{{ brew.roast_slug }}" class="hover:text-amber-700 hover:underline">
{{ brew.roast_name }}
</a>
</div>
<div class="text-xs text-stone-500">
<a href="/roasters/{{ brew.roaster_slug }}" class="hover:text-amber-700 hover:underline">
{{ brew.roaster_name }}
</a>
</div>
</td>
<td class="px-4 py-3 whitespace-nowrap">{{ brew.coffee_weight }}</td>
<td class="px-4 py-3 whitespace-nowrap">
<div>{{ brew.grind_setting }}</div>
<div class="text-xs text-stone-500">{{ brew.grinder_name }}</div>
</td>
<td class="px-4 py-3 whitespace-nowrap">{{ brew.brewer_name }}</td>
<td class="px-4 py-3 whitespace-nowrap">{{ brew.water_volume }}</td>
<td class="px-4 py-3 whitespace-nowrap">{{ brew.water_temp }}</td>
<td class="px-4 py-3 whitespace-nowrap font-mono text-xs">{{ brew.ratio }}</td>
<td class="px-4 py-3 whitespace-nowrap text-stone-500">{{ brew.created_at }}</td>
{% if is_authenticated %}
<td class="px-4 py-3 whitespace-nowrap text-right">
<button
class="text-red-600 hover:text-red-800 text-xs"
data-on:click="confirm('Delete this brew?') && @delete('/api/v1/brews/{{ brew.id }}?{{ navigator.query() }}', {responseOverrides: {selector: '#brew-list', mode: 'replace'}})"
>
Delete
</button>
</td>
{% endif %}
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% if brews.items.is_empty() %}
<div class="p-8 text-center text-stone-500">
No brews logged yet. Start by logging your first cup!
</div>
{% endif %}
</div>
</div>