diff --git a/README.md b/README.md index 7ecdf3d..b90ac55 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Manage your holiday rental - [x] Read from the database - [x] Build the pdf invoice - [ ] Build the pdf report -- [ ] Refactor the env variable calls to a Config struct with proper defaults +- [x] Refactor the env variable calls to a Config struct with proper defaults - [x] Refactor handlers to call their dependencies instead of taking them from the Server struct - [x] Embed mandatory assets, css in the executable - [ ] Calendar to store new booking in calendar diff --git a/config/host.go b/config/host.go index 920c708..16b7e6b 100644 --- a/config/host.go +++ b/config/host.go @@ -1,6 +1,7 @@ package config type Host struct { + InvoicePrefix string PaymentMethods []string Platforms []string Items []HostItem @@ -15,6 +16,7 @@ type HostItem struct { func NewHost() *Host { return &Host{ CustomerSeed: 239, + InvoicePrefix: "VFNI", PaymentMethods: []string{"Card", "Cash", "Cheque", "Transfer"}, Platforms: []string{"Booking", "AirBnb", "TripAdvisor", "Other"}, Items: []HostItem{ diff --git a/internal/booking/models.go b/internal/booking/models.go index dd9e4a1..6ea0f7a 100644 --- a/internal/booking/models.go +++ b/internal/booking/models.go @@ -1,8 +1,11 @@ package booking import ( + "fmt" + "strconv" "time" + "github.com/rjNemo/rentease/config" "gorm.io/gorm" ) @@ -30,3 +33,7 @@ type Item struct { Quantity int Price float64 `gorm:"type:decimal(10,2)"` } + +func (b Booking) InvoiceNumber(hc *config.Host) string { + return fmt.Sprintf("%s%04s", hc.InvoicePrefix, strconv.Itoa(b.Id+hc.CustomerSeed)) +} diff --git a/internal/booking/service.go b/internal/booking/service.go index de700b6..a77b112 100644 --- a/internal/booking/service.go +++ b/internal/booking/service.go @@ -1,8 +1,11 @@ package booking import ( + "fmt" + "strconv" "time" + "github.com/rjNemo/rentease/config" "gorm.io/gorm" ) @@ -58,13 +61,17 @@ func (bs Service) CreateItem(bid int, item string, qty int, price float64, metho type Line struct { From time.Time To time.Time - Id string CustomerName string Platform string + Id int Total float64 PlatformFees float64 } +func (l Line) InvoiceNumber(hc *config.Host) string { + return fmt.Sprintf("%s%04s", hc.InvoicePrefix, strconv.Itoa(l.Id+hc.CustomerSeed)) +} + func (bs Service) BuildReport(period string, month, year int) []*Line { res := make([]*Line, 0) var startDate time.Time diff --git a/internal/pdf/service.go b/internal/pdf/service.go index f8cfc8f..984f014 100644 --- a/internal/pdf/service.go +++ b/internal/pdf/service.go @@ -4,7 +4,6 @@ import ( "bytes" "encoding/json" "errors" - "fmt" "io" "net/http" "os" @@ -46,7 +45,7 @@ func (ps PdfService) BuildInvoice(b *booking.Booking, hc *config.Host) error { ProjectId string `json:"projectId"` }{ Context: map[string]any{ - "id": fmt.Sprintf("VFNI%04s", strconv.Itoa(b.Id+hc.CustomerSeed)), + "id": b.InvoiceNumber(hc), "name": b.Name, "phone_number": b.PhoneNumber, "customers_number": b.CustomerNumber, diff --git a/internal/server/handler_booking.go b/internal/server/handle_bookings.go similarity index 95% rename from internal/server/handler_booking.go rename to internal/server/handle_bookings.go index d1d8ac4..2d66487 100644 --- a/internal/server/handler_booking.go +++ b/internal/server/handle_bookings.go @@ -18,13 +18,13 @@ import ( myTime "github.com/rjNemo/rentease/pkg/time" ) -func handleListBookingPage(bs *booking.Service) echo.HandlerFunc { +func handleListBookingPage(bs *booking.Service, hc *config.Host) echo.HandlerFunc { return func(c echo.Context) error { bookings := bs.All() bvm := u.Map(bookings, func(b *booking.Booking) *views.ListBookingsViewModel { return &views.ListBookingsViewModel{ - Id: strconv.Itoa(b.Id), + Id: b.InvoiceNumber(hc), Url: templ.SafeURL(fmt.Sprintf("%s/%d", constants.RouteBooking, b.Id)), From: b.From.Format("2006-01-02"), To: b.To.Format("2006-01-02"), @@ -84,7 +84,7 @@ func handleBookingPage(bs *booking.Service, hc *config.Host) echo.HandlerFunc { b := bs.One(id) bvm := &views.BookingViewModel{ - Id: fmt.Sprintf("%04s", strconv.Itoa(b.Id+hc.CustomerSeed)), + Id: b.InvoiceNumber(hc), Name: b.Name, PhoneNumber: b.PhoneNumber, CustomerNumber: strconv.Itoa(b.CustomerNumber), diff --git a/internal/server/handle_reports.go b/internal/server/handle_reports.go index cb6ed85..fd620d5 100644 --- a/internal/server/handle_reports.go +++ b/internal/server/handle_reports.go @@ -8,6 +8,7 @@ import ( "github.com/a-h/templ" "github.com/labstack/echo/v4" + "github.com/rjNemo/rentease/config" "github.com/rjNemo/rentease/constants" "github.com/rjNemo/rentease/internal/booking" "github.com/rjNemo/rentease/internal/views" @@ -36,7 +37,7 @@ func handleReportsPage() echo.HandlerFunc { } } -func handleComputeReport(bs *booking.Service) echo.HandlerFunc { +func handleComputeReport(bs *booking.Service, hc *config.Host) echo.HandlerFunc { return func(c echo.Context) error { period := c.FormValue("period") if !u.Contains([]string{"month", "year"}, period) { @@ -68,16 +69,19 @@ func handleComputeReport(bs *booking.Service) echo.HandlerFunc { reportVm := u.Map(res, func(r *booking.Line) *views.ReportViewModel { return &views.ReportViewModel{ - Id: r.Id, - Url: templ.SafeURL(fmt.Sprintf("%s/%s", constants.RouteBooking, r.Id)), + Id: r.InvoiceNumber(hc), + Url: templ.SafeURL(fmt.Sprintf("%s/%s", constants.RouteBooking, r.Id)), + // TODO: return the full invoice amount including lines Total: strconv.FormatFloat(r.Total, 'f', 2, 64), CustomerName: r.CustomerName, From: r.From.Format("2006-01-02"), To: r.To.Format("2006-01-02"), Platform: r.Platform, PlatformFees: strconv.FormatFloat(r.PlatformFees, 'f', 2, 64), + // TODO: add NemoImmo part and compute the profit } }) + return renderTempl(c, http.StatusOK, views.ReportSection(reportVm)) } } diff --git a/internal/server/routes.go b/internal/server/routes.go index f57482a..83cb020 100644 --- a/internal/server/routes.go +++ b/internal/server/routes.go @@ -2,12 +2,12 @@ package server func (s Server) MountHandlers() { s.Router.GET("/", handleHomePage()) - s.Router.GET("/bookings", handleListBookingPage(s.bs)) + s.Router.GET("/bookings", handleListBookingPage(s.bs, s.hc)) s.Router.GET("/bookings/new", handleNewBookingPage()) s.Router.POST("/bookings/new", handleCreateBooking(s.bs)) s.Router.GET("/bookings/:id", handleBookingPage(s.bs, s.hc)) s.Router.POST("/bookings/:id/items", handleCreateItem(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.Router.GET("/reports/do", handleComputeReport(s.bs, s.hc)) } diff --git a/internal/views/base_templ.go b/internal/views/base_templ.go index ad7ac63..f5b0f9b 100644 --- a/internal/views/base_templ.go +++ b/internal/views/base_templ.go @@ -23,7 +23,7 @@ func BaseLayout() templ.Component { templ_7745c5c3_Var1 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("RentEase | Your Property Management System
") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 1) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -31,7 +31,7 @@ func BaseLayout() templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 2) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/internal/views/booking_by_id.templ b/internal/views/booking_by_id.templ index 92293ef..46ab9c4 100644 --- a/internal/views/booking_by_id.templ +++ b/internal/views/booking_by_id.templ @@ -33,7 +33,7 @@ templ BookingById(booking *BookingViewModel) {

{ booking.Name }

-

VFNI#{ booking.Id }

+

{ booking.Id }

Create PDF diff --git a/internal/views/booking_by_id_templ.go b/internal/views/booking_by_id_templ.go index 996fe4a..36b0dd5 100644 --- a/internal/views/booking_by_id_templ.go +++ b/internal/views/booking_by_id_templ.go @@ -57,7 +57,7 @@ func BookingById(booking *BookingViewModel) templ.Component { templ_7745c5c3_Buffer = templ.GetBuffer() defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 1) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -70,20 +70,20 @@ func BookingById(booking *BookingViewModel) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

VFNI#") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 2) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } 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/views/booking_by_id.templ`, Line: 35, Col: 25} + return templ.Error{Err: templ_7745c5c3_Err, FileName: `internal/views/booking_by_id.templ`, Line: 35, Col: 20} } _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

Create PDF

Line Items

") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 17) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } for _, item := range booking.Items { - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 24) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
ItemQuantityPrice (€)Payment MethodPayment StatusSub-total (€)
") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 18) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -218,7 +218,7 @@ func BookingById(booking *BookingViewModel) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 19) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -231,7 +231,7 @@ func BookingById(booking *BookingViewModel) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 20) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -244,7 +244,7 @@ func BookingById(booking *BookingViewModel) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 21) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -257,7 +257,7 @@ func BookingById(booking *BookingViewModel) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 22) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -270,7 +270,7 @@ func BookingById(booking *BookingViewModel) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 23) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -283,12 +283,12 @@ func BookingById(booking *BookingViewModel) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 25) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -301,7 +301,7 @@ func BookingById(booking *BookingViewModel) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
Add line
") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 35) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/internal/views/bookings_list_templ.go b/internal/views/bookings_list_templ.go index 0c9e6eb..c38485a 100644 --- a/internal/views/bookings_list_templ.go +++ b/internal/views/bookings_list_templ.go @@ -38,12 +38,12 @@ func ListBookings(bookings []*ListBookingsViewModel) templ.Component { templ_7745c5c3_Buffer = templ.GetBuffer() defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

Bookings

Overview of the activity

") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 1) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } for _, b := range bookings { - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 8) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
IDNameTotal (€)FromToPlatform
") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 3) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -65,7 +65,7 @@ func ListBookings(bookings []*ListBookingsViewModel) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 4) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -78,7 +78,7 @@ func ListBookings(bookings []*ListBookingsViewModel) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 5) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -91,7 +91,7 @@ func ListBookings(bookings []*ListBookingsViewModel) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 6) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -104,7 +104,7 @@ func ListBookings(bookings []*ListBookingsViewModel) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 7) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -117,12 +117,12 @@ func ListBookings(bookings []*ListBookingsViewModel) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 9) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/internal/views/bookings_new_templ.go b/internal/views/bookings_new_templ.go index 5a51e06..f0e832b 100644 --- a/internal/views/bookings_new_templ.go +++ b/internal/views/bookings_new_templ.go @@ -29,12 +29,12 @@ func NewBooking(platforms []string) templ.Component { templ_7745c5c3_Buffer = templ.GetBuffer() defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

New Booking

Create a new booking

") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 5) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/internal/views/index_templ.go b/internal/views/index_templ.go index eb3e3bf..abb2259 100644 --- a/internal/views/index_templ.go +++ b/internal/views/index_templ.go @@ -29,7 +29,7 @@ func Index() templ.Component { templ_7745c5c3_Buffer = templ.GetBuffer() defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("New Booking ") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 1) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/internal/views/line_item_templ.go b/internal/views/line_item_templ.go index 727d9b5..e590bec 100644 --- a/internal/views/line_item_templ.go +++ b/internal/views/line_item_templ.go @@ -28,7 +28,7 @@ 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.WriteWatchModeString(templ_7745c5c3_Buffer, 1) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -41,7 +41,7 @@ func LineItem(item *booking.Item) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 2) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -54,7 +54,7 @@ func LineItem(item *booking.Item) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 3) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -67,7 +67,7 @@ func LineItem(item *booking.Item) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 4) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -80,7 +80,7 @@ func LineItem(item *booking.Item) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 5) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -93,7 +93,7 @@ func LineItem(item *booking.Item) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 6) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -106,7 +106,7 @@ func LineItem(item *booking.Item) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 7) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/internal/views/report_section_templ.go b/internal/views/report_section_templ.go index d7b6a1f..74a628f 100644 --- a/internal/views/report_section_templ.go +++ b/internal/views/report_section_templ.go @@ -34,12 +34,12 @@ func ReportSection(report []*ReportViewModel) templ.Component { templ_7745c5c3_Var1 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

Your report

") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 1) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } for _, row := range report { - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 10) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
IDNameFromToTotal (€)PlatformPlatform Fees
") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 3) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -61,7 +61,7 @@ func ReportSection(report []*ReportViewModel) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 4) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -74,7 +74,7 @@ func ReportSection(report []*ReportViewModel) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 5) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -87,7 +87,7 @@ func ReportSection(report []*ReportViewModel) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 6) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -100,7 +100,7 @@ func ReportSection(report []*ReportViewModel) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 7) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -113,7 +113,7 @@ func ReportSection(report []*ReportViewModel) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 8) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -126,7 +126,7 @@ func ReportSection(report []*ReportViewModel) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 9) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -139,12 +139,12 @@ func ReportSection(report []*ReportViewModel) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 11) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/internal/views/reports_templ.go b/internal/views/reports_templ.go index 80c8b1b..8442536 100644 --- a/internal/views/reports_templ.go +++ b/internal/views/reports_templ.go @@ -33,7 +33,7 @@ func Reports(months []string, m int, year string) templ.Component { templ_7745c5c3_Buffer = templ.GetBuffer() defer templ.ReleaseBuffer(templ_7745c5c3_Buffer) } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

Reports

Generate monthly and yearly statements

Period
") + templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 9) if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/main.go b/main.go index 9c4bbe8..2c41134 100644 --- a/main.go +++ b/main.go @@ -42,5 +42,6 @@ func main() { if err != nil { log.Fatal(err) } + server.New(&static, booking.NewService(db), ps, config.NewHost()).Start() }