add shopping list and tag management
This commit is contained in:
parent
d2560630f4
commit
b7905ddded
19 changed files with 1253 additions and 11 deletions
38
internal/ui/components/shoppinglist/shoppinglist.templ
Normal file
38
internal/ui/components/shoppinglist/shoppinglist.templ
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
package shoppinglist
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"git.juancwu.dev/juancwu/budgit/internal/model"
|
||||
)
|
||||
|
||||
templ ListItem(list *model.ShoppingList) {
|
||||
<a href={ templ.URL(fmt.Sprintf("/app/spaces/%s/lists/%s", list.SpaceID, list.ID)) } class="block p-4 border rounded-lg hover:bg-muted transition-colors">
|
||||
<div class="flex justify-between items-center">
|
||||
<span class="font-medium">{ list.Name }</span>
|
||||
// TODO: Add item count or other info
|
||||
</div>
|
||||
</a>
|
||||
}
|
||||
|
||||
templ ItemDetail(spaceID string, item *model.ListItem) {
|
||||
<div id={ "item-" + item.ID } class="flex items-center gap-2 p-2 border-b">
|
||||
<input
|
||||
type="checkbox"
|
||||
name="is_checked"
|
||||
checked?={ item.IsChecked }
|
||||
hx-patch={ fmt.Sprintf("/app/spaces/%s/lists/%s/items/%s", spaceID, item.ListID, item.ID) }
|
||||
hx-target={ "#item-" + item.ID }
|
||||
hx-swap="outerHTML"
|
||||
class="checkbox"
|
||||
/>
|
||||
<span class={ templ.KV("line-through text-muted-foreground", item.IsChecked) }>{ item.Name }</span>
|
||||
<button
|
||||
hx-delete={ fmt.Sprintf("/app/spaces/%s/lists/%s/items/%s", spaceID, item.ListID, item.ID) }
|
||||
hx-target={ "#item-" + item.ID }
|
||||
hx-swap="outerHTML"
|
||||
class="ml-auto btn btn-xs btn-ghost"
|
||||
>
|
||||
×
|
||||
</button>
|
||||
</div>
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue