mirror of
https://github.com/rjNemo/rentease.git
synced 2026-06-06 02:36:49 +00:00
replace the current line and don't show paid option when already paid
This commit is contained in:
parent
8db9e6ebb8
commit
057f9991e9
2 changed files with 20 additions and 8 deletions
|
|
@ -1,7 +1,7 @@
|
|||
package view
|
||||
|
||||
templ LineItem(item *ItemViewModel) {
|
||||
<tr id="line-item">
|
||||
<tr>
|
||||
<td>{ item.Item }</td>
|
||||
<td>{ item.Quantity }</td>
|
||||
<td>{ item.Price }</td>
|
||||
|
|
@ -10,7 +10,9 @@ templ LineItem(item *ItemViewModel) {
|
|||
<td>{ item.SubTotal }</td>
|
||||
<td>
|
||||
<button class="secondary">Edit</button>
|
||||
<button class="secondary" hx-post={ item.ItemUrl } hx-target="#line-item" hx-swap="outerHTML">Paid</button>
|
||||
if item.PaymentStatus != "Completed" {
|
||||
<button class="secondary" hx-post={ item.ItemUrl } hx-target="closest tr" hx-swap="outerHTML">Paid</button>
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ func LineItem(item *ItemViewModel) templ.Component {
|
|||
templ_7745c5c3_Var1 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<tr id=\"line-item\"><td>")
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<tr><td>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
|
@ -101,15 +101,25 @@ func LineItem(item *ItemViewModel) templ.Component {
|
|||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</td><td><button class=\"secondary\">Edit</button> <button class=\"secondary\" hx-post=\"")
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</td><td><button class=\"secondary\">Edit</button> ")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(item.ItemUrl))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
if item.PaymentStatus != "Completed" {
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<button class=\"secondary\" hx-post=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(item.ItemUrl))
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-target=\"closest tr\" hx-swap=\"outerHTML\">Paid</button>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-target=\"#line-item\" hx-swap=\"outerHTML\">Paid</button></td></tr>")
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</td></tr>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue