rentease/internal/view/line_item.templ
Ruidy 584d81f7bd
Some checks failed
CI / checks (push) Has been cancelled
feat(i18n): add language toggle and localize views
2026-01-09 16:09:20 -04:00

47 lines
1.2 KiB
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package view
import "github.com/rjNemo/rentease/internal/i18n"
templ LineItem(item *ItemViewModel) {
<tr class="hover">
<td>{ item.Item }</td>
<td>{ item.Quantity }</td>
<td>{ item.Price }</td>
<td></td>
<td>{ item.SubTotal }</td>
<td class="text-right">
<button
class="btn btn-xs btn-outline btn-secondary"
hx-get={ item.ItemUrl }
hx-target="closest tr"
hx-swap="outerHTML"
>
{ i18n.Localize(ctx, "action.edit") }
</button>
</td>
</tr>
}
templ LineItemForm(item *ItemViewModel) {
<tr class="hover">
<form hx-put={ item.ItemUrl } id="edit-item" hx-target="closest tr" hx-swap="outerHTML">
<td><input class="input input-bordered input-sm w-full" value={ item.Item } name="item" form="edit-item"/></td>
<td>
<input
class="input input-bordered input-sm w-full"
value={ item.Quantity }
name="quantity"
form="edit-item"
/>
</td>
<td>
<input class="input input-bordered input-sm w-full" value={ item.Price } name="price" form="edit-item"/>
</td>
<td></td>
<td>{ item.SubTotal }</td>
<td>
<button class="btn btn-sm btn-primary" type="submit" form="edit-item">{ i18n.Localize(ctx, "action.save") }</button>
</td>
</form>
</tr>
}