diff --git a/constant/routes.go b/constant/routes.go
index b2e749c..6d65e2d 100644
--- a/constant/routes.go
+++ b/constant/routes.go
@@ -3,4 +3,5 @@ package constant
const (
RouteBooking = "/bookings"
RouteReports = "/reports"
+ RouteItem = "/items"
)
diff --git a/internal/booking/service.go b/internal/booking/service.go
index e21478c..b47b6a3 100644
--- a/internal/booking/service.go
+++ b/internal/booking/service.go
@@ -7,6 +7,7 @@ import (
u "github.com/rjNemo/underscore"
"gorm.io/gorm"
+ "gorm.io/gorm/clause"
"github.com/rjNemo/rentease/config"
)
@@ -85,6 +86,12 @@ func (bs Service) CreateItem(bid int, item string, qty int, price float64, metho
return i
}
+func (bs Service) PayItem(id int) *Item {
+ i := new(Item)
+ bs.db.Model(i).Clauses(clause.Returning{}).Where("id = ?", id).Update("payment_status", "Completed")
+ return i
+}
+
type Report struct {
Lines []*Line
Total float64
diff --git a/internal/server/handle_bookings.go b/internal/server/handle_bookings.go
index b0e6c58..aac07ac 100644
--- a/internal/server/handle_bookings.go
+++ b/internal/server/handle_bookings.go
@@ -98,12 +98,14 @@ func handleBookingPage(bs *booking.Service, hc *config.Host) echo.HandlerFunc {
PdfUrl: templ.SafeURL(fmt.Sprintf("%s/pdf/%d", constant.RouteBooking, b.Id)),
Items: u.Map(b.Items, func(i booking.Item) view.ItemViewModel {
return view.ItemViewModel{
+ Id: strconv.Itoa(i.Id),
Item: i.Item,
Quantity: strconv.Itoa(i.Quantity),
Price: strconv.FormatFloat(i.Price, 'f', 2, 64),
SubTotal: strconv.FormatFloat(i.Price*float64(i.Quantity), 'f', 2, 64),
PaymentMethod: i.PaymentMethod,
PaymentStatus: i.PaymentStatus,
+ ItemUrl: fmt.Sprintf("%s/%d", constant.RouteItem, i.Id),
}
}),
Total: strconv.FormatFloat(u.Reduce(b.Items, func(i booking.Item, sum float64) float64 {
@@ -123,11 +125,11 @@ func handleUpdateBooking(bs *booking.Service, hc *config.Host) echo.HandlerFunc
type UpdateBooking struct {
From time.Time `json:"from"`
To time.Time `json:"to"`
- Id int `param:"id"`
Name string `form:"name"`
PhoneNumber string `form:"phone_number"`
Email string `form:"email"`
Platform string `form:"platform"`
+ Id int `param:"id"`
CustomerNumber int `form:"customer_number"`
PlatformFees float64 `form:"platform_fees"`
}
@@ -185,6 +187,37 @@ func handleCreateItem(bs *booking.Service) echo.HandlerFunc {
return err
}
i := bs.CreateItem(bid, ni.Item, ni.Quantity, ni.Price, ni.PaymentMethod)
- return renderTempl(c, http.StatusCreated, view.LineItem(i))
+ return renderTempl(c, http.StatusCreated, view.LineItem(&view.ItemViewModel{
+ Id: strconv.Itoa(i.Id),
+ Item: i.Item,
+ Quantity: strconv.Itoa(i.Quantity),
+ Price: strconv.FormatFloat(i.Price, 'f', 2, 64),
+ PaymentMethod: i.PaymentMethod,
+ PaymentStatus: i.PaymentStatus,
+ SubTotal: strconv.FormatFloat(i.Price*float64(i.Quantity), 'f', 2, 64),
+ ItemUrl: fmt.Sprintf("%s/%d", constant.RouteItem, i.Id),
+ }))
+ }
+}
+
+func handlePayItem(bs *booking.Service) echo.HandlerFunc {
+ return func(c echo.Context) error {
+ itemIdStr := c.Param("id")
+ itemId, err := strconv.Atoi(itemIdStr)
+ if err != nil {
+ return err
+ }
+
+ i := bs.PayItem(itemId)
+ return renderTempl(c, http.StatusOK, view.LineItem(&view.ItemViewModel{
+ Id: itemIdStr,
+ Item: i.Item,
+ Quantity: strconv.Itoa(i.Quantity),
+ Price: strconv.FormatFloat(i.Price, 'f', 2, 64),
+ PaymentMethod: i.PaymentMethod,
+ PaymentStatus: i.PaymentStatus,
+ SubTotal: strconv.FormatFloat(i.Price*float64(i.Quantity), 'f', 2, 64),
+ ItemUrl: fmt.Sprintf("%s/%d", constant.RouteItem, i.Id),
+ }))
}
}
diff --git a/internal/server/routes.go b/internal/server/routes.go
index 1c58707..e839fa8 100644
--- a/internal/server/routes.go
+++ b/internal/server/routes.go
@@ -11,6 +11,7 @@ func (s Server) MountHandlers() {
s.Router.GET("/bookings/:id", handleBookingPage(s.bs, s.hc))
s.Router.PUT("/bookings/:id", handleUpdateBooking(s.bs, s.hc))
s.Router.POST("/bookings/:id/items", handleCreateItem(s.bs))
+ s.Router.POST("/items/:id", handlePayItem(s.bs))
s.Router.GET("/bookings/pdf/:id", handleCreateInvoicePdf(s.bs, s.ps, s.hc))
s.Router.GET("/reports", handleReportsPage())
s.Router.GET("/reports/do", handleComputeReport(s.bs, s.hc))
diff --git a/internal/view/booking_by_id.templ b/internal/view/booking_by_id.templ
index 035b91d..04dd78e 100644
--- a/internal/view/booking_by_id.templ
+++ b/internal/view/booking_by_id.templ
@@ -24,12 +24,14 @@ type BookingViewModel struct {
}
type ItemViewModel struct {
+ Id string
Item string
Quantity string
Price string
SubTotal string
PaymentMethod string
PaymentStatus string
+ ItemUrl string
}
templ BookingById(booking *BookingViewModel) {
@@ -109,18 +111,12 @@ templ BookingById(booking *BookingViewModel) {
Payment Method |
Payment Status |
Sub-total (€) |
+ |
for _, item := range booking.Items {
-
- | { item.Item } |
- { item.Quantity } |
- { item.Price } |
- { item.PaymentMethod } |
- { item.PaymentStatus } |
- { item.SubTotal } |
-
+ @LineItem(&item)
}
@@ -130,6 +126,7 @@ templ BookingById(booking *BookingViewModel) {
|
|
{ booking.Total } |
+ |
diff --git a/internal/view/booking_by_id_templ.go b/internal/view/booking_by_id_templ.go
index e29fd80..a9e1724 100644
--- a/internal/view/booking_by_id_templ.go
+++ b/internal/view/booking_by_id_templ.go
@@ -34,12 +34,14 @@ type BookingViewModel struct {
}
type ItemViewModel struct {
+ Id string
Item string
Quantity string
Price string
SubTotal string
PaymentMethod string
PaymentStatus string
+ ItemUrl string
}
func BookingById(booking *BookingViewModel) templ.Component {
@@ -68,7 +70,7 @@ func BookingById(booking *BookingViewModel) templ.Component {
var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(booking.Name)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/booking_by_id.templ`, Line: 38, Col: 22}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/booking_by_id.templ`, Line: 40, Col: 22}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
if templ_7745c5c3_Err != nil {
@@ -81,7 +83,7 @@ func BookingById(booking *BookingViewModel) templ.Component {
var templ_7745c5c3_Var4 string
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(booking.Id)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/booking_by_id.templ`, Line: 39, Col: 20}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/booking_by_id.templ`, Line: 41, Col: 20}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
if templ_7745c5c3_Err != nil {
@@ -167,7 +169,7 @@ func BookingById(booking *BookingViewModel) templ.Component {
var templ_7745c5c3_Var6 string
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(booking.Platform)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/booking_by_id.templ`, Line: 84, Col: 70}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/booking_by_id.templ`, Line: 86, Col: 70}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
if templ_7745c5c3_Err != nil {
@@ -193,7 +195,7 @@ func BookingById(booking *BookingViewModel) templ.Component {
var templ_7745c5c3_Var7 string
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(platform)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/booking_by_id.templ`, Line: 86, Col: 46}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/booking_by_id.templ`, Line: 88, Col: 46}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
if templ_7745c5c3_Err != nil {
@@ -212,90 +214,12 @@ func BookingById(booking *BookingViewModel) templ.Component {
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\">Line Items
| Item | Quantity | Price (€) | Payment Method | Payment Status | Sub-total (€) |
")
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\">Line Items
| Item | Quantity | Price (€) | Payment Method | Payment Status | Sub-total (€) | |
")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
for _, item := range booking.Items {
- _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("| ")
- if templ_7745c5c3_Err != nil {
- return templ_7745c5c3_Err
- }
- var templ_7745c5c3_Var8 string
- templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(item.Item)
- if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/booking_by_id.templ`, Line: 116, Col: 23}
- }
- _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
- if templ_7745c5c3_Err != nil {
- return templ_7745c5c3_Err
- }
- _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" | ")
- if templ_7745c5c3_Err != nil {
- return templ_7745c5c3_Err
- }
- var templ_7745c5c3_Var9 string
- templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(item.Quantity)
- if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/booking_by_id.templ`, Line: 117, Col: 27}
- }
- _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
- if templ_7745c5c3_Err != nil {
- return templ_7745c5c3_Err
- }
- _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" | ")
- if templ_7745c5c3_Err != nil {
- return templ_7745c5c3_Err
- }
- var templ_7745c5c3_Var10 string
- templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(item.Price)
- if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/booking_by_id.templ`, Line: 118, Col: 24}
- }
- _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10))
- if templ_7745c5c3_Err != nil {
- return templ_7745c5c3_Err
- }
- _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" | ")
- if templ_7745c5c3_Err != nil {
- return templ_7745c5c3_Err
- }
- var templ_7745c5c3_Var11 string
- templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(item.PaymentMethod)
- if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/booking_by_id.templ`, Line: 119, Col: 32}
- }
- _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11))
- if templ_7745c5c3_Err != nil {
- return templ_7745c5c3_Err
- }
- _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" | ")
- if templ_7745c5c3_Err != nil {
- return templ_7745c5c3_Err
- }
- var templ_7745c5c3_Var12 string
- templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(item.PaymentStatus)
- if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/booking_by_id.templ`, Line: 120, Col: 32}
- }
- _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12))
- if templ_7745c5c3_Err != nil {
- return templ_7745c5c3_Err
- }
- _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" | ")
- if templ_7745c5c3_Err != nil {
- return templ_7745c5c3_Err
- }
- var templ_7745c5c3_Var13 string
- templ_7745c5c3_Var13, templ_7745c5c3_Err = templ.JoinStringErrs(item.SubTotal)
- if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/booking_by_id.templ`, Line: 121, Col: 27}
- }
- _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var13))
- if templ_7745c5c3_Err != nil {
- return templ_7745c5c3_Err
- }
- _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" |
")
+ templ_7745c5c3_Err = LineItem(&item).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
@@ -304,16 +228,16 @@ func BookingById(booking *BookingViewModel) templ.Component {
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- var templ_7745c5c3_Var14 string
- templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(booking.Total)
+ var templ_7745c5c3_Var8 string
+ templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(booking.Total)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/booking_by_id.templ`, Line: 131, Col: 37}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/booking_by_id.templ`, Line: 127, Col: 37}
}
- _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14))
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
Add line
Add line
+
}
diff --git a/internal/view/booking_form_templ.go b/internal/view/booking_form_templ.go
index 279734e..afe0faa 100644
--- a/internal/view/booking_form_templ.go
+++ b/internal/view/booking_form_templ.go
@@ -94,7 +94,7 @@ func BookingForm(booking BookingViewModel) templ.Component {
var templ_7745c5c3_Var2 string
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(booking.Platform)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/booking_form.templ`, Line: 39, Col: 70}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/booking_form.templ`, Line: 39, Col: 68}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
if templ_7745c5c3_Err != nil {
@@ -120,7 +120,7 @@ func BookingForm(booking BookingViewModel) templ.Component {
var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(platform)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/booking_form.templ`, Line: 41, Col: 46}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/booking_form.templ`, Line: 41, Col: 44}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
if templ_7745c5c3_Err != nil {
diff --git a/internal/view/line_item.templ b/internal/view/line_item.templ
index 604b6c8..dda31aa 100644
--- a/internal/view/line_item.templ
+++ b/internal/view/line_item.templ
@@ -1,17 +1,16 @@
package view
-import (
- "strconv"
- "github.com/rjNemo/rentease/internal/booking"
-)
-
-templ LineItem(item *booking.Item) {
-
+templ LineItem(item *ItemViewModel) {
+
| { item.Item } |
- { strconv.Itoa(item.Quantity) } |
- { strconv.FormatFloat(item.Price, 'f', 2, 64) } |
+ { item.Quantity } |
+ { item.Price } |
{ item.PaymentMethod } |
{ item.PaymentStatus } |
- { strconv.FormatFloat(float64(item.Quantity)*item.Price,'f',2,64) } |
+ { item.SubTotal } |
+
+
+
+ |
}
diff --git a/internal/view/line_item_templ.go b/internal/view/line_item_templ.go
index 4545a02..11df255 100644
--- a/internal/view/line_item_templ.go
+++ b/internal/view/line_item_templ.go
@@ -10,12 +10,7 @@ import "context"
import "io"
import "bytes"
-import (
- "github.com/rjNemo/rentease/internal/booking"
- "strconv"
-)
-
-func LineItem(item *booking.Item) templ.Component {
+func LineItem(item *ItemViewModel) templ.Component {
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
if !templ_7745c5c3_IsBuffer {
@@ -28,14 +23,14 @@ func LineItem(item *booking.Item) templ.Component {
templ_7745c5c3_Var1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
- _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("| ")
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" |
| ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var2 string
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(item.Item)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/line_item.templ`, Line: 9, Col: 17}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/line_item.templ`, Line: 4, Col: 17}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
if templ_7745c5c3_Err != nil {
@@ -46,9 +41,9 @@ func LineItem(item *booking.Item) templ.Component {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var3 string
- templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.Itoa(item.Quantity))
+ templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(item.Quantity)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/line_item.templ`, Line: 10, Col: 35}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/line_item.templ`, Line: 5, Col: 21}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
if templ_7745c5c3_Err != nil {
@@ -59,9 +54,9 @@ func LineItem(item *booking.Item) templ.Component {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var4 string
- templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.FormatFloat(item.Price, 'f', 2, 64))
+ templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(item.Price)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/line_item.templ`, Line: 11, Col: 51}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/line_item.templ`, Line: 6, Col: 18}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
if templ_7745c5c3_Err != nil {
@@ -74,7 +69,7 @@ func LineItem(item *booking.Item) templ.Component {
var templ_7745c5c3_Var5 string
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(item.PaymentMethod)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/line_item.templ`, Line: 12, Col: 26}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/line_item.templ`, Line: 7, Col: 26}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
if templ_7745c5c3_Err != nil {
@@ -87,7 +82,7 @@ func LineItem(item *booking.Item) templ.Component {
var templ_7745c5c3_Var6 string
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(item.PaymentStatus)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/line_item.templ`, Line: 13, Col: 26}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/line_item.templ`, Line: 8, Col: 26}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
if templ_7745c5c3_Err != nil {
@@ -98,15 +93,23 @@ func LineItem(item *booking.Item) templ.Component {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var7 string
- templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(strconv.FormatFloat(float64(item.Quantity)*item.Price, 'f', 2, 64))
+ templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(item.SubTotal)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/line_item.templ`, Line: 14, Col: 71}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/view/line_item.templ`, Line: 9, Col: 21}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" |
")
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(" | ")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}