feat(budget): further implementation with modal for editing
Some checks failed
Build and Push Docker Image / Build-And-Push-Docker-Image (push) Failing after 1m9s
Some checks failed
Build and Push Docker Image / Build-And-Push-Docker-Image (push) Failing after 1m9s
This commit is contained in:
@@ -2,39 +2,75 @@ package budget
|
||||
|
||||
import "spend-sparrow/internal/template/svg"
|
||||
|
||||
templ page() {
|
||||
templ page(budgets []Budget) {
|
||||
<!-- for _,name:=range([]string{"Lebensmittel", "Tanken", "Drogerie", "Milch", "Parken"}) { -->
|
||||
<div class="flex flex-wrap gap-20 text-xl mt-10 justify-center">
|
||||
@newItem()
|
||||
for i:=range(10) {
|
||||
@item(i)
|
||||
for _,budget:=range(budgets ) {
|
||||
@item(budget)
|
||||
}
|
||||
</div>
|
||||
}
|
||||
|
||||
templ Items() {
|
||||
<div></div>
|
||||
}
|
||||
|
||||
templ Edit() {
|
||||
<div></div>
|
||||
templ editNew() {
|
||||
<dialog id="newBudget" class="absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 rounded-lg openDialogModal">
|
||||
<form
|
||||
hx-post={ "/transaction/new" }
|
||||
class="flex justify-end gap-4 items-center "
|
||||
>
|
||||
<div class="grid grid-cols-[auto_auto] items-center gap-4 mr-auto">
|
||||
<label for="timestamp" class="text-sm text-gray-500">Name</label>
|
||||
<input
|
||||
autofocus
|
||||
name="name"
|
||||
type="text"
|
||||
class="bg-white input datetime"
|
||||
/>
|
||||
<label for="value" class="text-sm text-gray-500">Value</label>
|
||||
<input
|
||||
name="value"
|
||||
type="number"
|
||||
class="mr-auto bg-white input"
|
||||
/>
|
||||
</div>
|
||||
<button type="submit" class="button button-neglect px-1 flex items-center gap-2">
|
||||
@svg.Save()
|
||||
<span>
|
||||
Save
|
||||
</span>
|
||||
</button>
|
||||
<button commandfor="newBudget" command="close" class="button button-neglect px-1 flex items-center gap-2">
|
||||
<span class="h-4 w-4">
|
||||
@svg.Cancel()
|
||||
</span>
|
||||
<span>
|
||||
Cancel
|
||||
</span>
|
||||
</button>
|
||||
</form>
|
||||
</dialog>
|
||||
}
|
||||
|
||||
templ newItem() {
|
||||
<section class="p-5 flex gap-4 active:bg-gray-200 flex-col justify-center items-center hover:bg-gray-100 transition-all cursor-pointer w-44 h-44 rounded-lg bg-gray-50 border-1 border-gray-300">
|
||||
<button
|
||||
hx-get="/budget/new"
|
||||
hx-target="#dialogContainer"
|
||||
class="p-5 w-64 h-64 flex gap-10 active:bg-gray-200 flex-col justify-center items-center hover:bg-gray-100 transition-all cursor-pointer rounded-lg bg-gray-50 border-1 border-gray-300"
|
||||
>
|
||||
New Budget
|
||||
<div class="w-10">
|
||||
@svg.Plus()
|
||||
</div>
|
||||
</section>
|
||||
</button>
|
||||
}
|
||||
|
||||
templ item(i int) {
|
||||
<section class="flex flex-col w-44 h-44 p-5 rounded-lg bg-gray-50 border-1 border-gray-300 ">
|
||||
templ item(budget Budget) {
|
||||
<section class="flex flex-col w-64 h-64 p-5 rounded-lg bg-gray-50 border-1 border-gray-300 ">
|
||||
<span>
|
||||
Budget { i }
|
||||
{ budget.Description }
|
||||
</span>
|
||||
<span>
|
||||
{ 200 + i }€
|
||||
{ 200 }€
|
||||
</span>
|
||||
</section>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user