diff --git a/go-app/internal/cmc/handlers/quotes/quotes.go b/go-app/internal/cmc/handlers/quotes/quotes.go index 51299020..cf0d39e9 100644 --- a/go-app/internal/cmc/handlers/quotes/quotes.go +++ b/go-app/internal/cmc/handlers/quotes/quotes.go @@ -13,6 +13,17 @@ import ( "code.springupsoftware.com/cmc/cmc-sales/internal/cmc/templates" ) +// Import getUsername from pages.go +// If you move getUsername to a shared utils package, update the import accordingly. +func getUsername(r *http.Request) string { + username, _, ok := r.BasicAuth() + if ok && username != "" { + // Capitalise the username for display + return strings.Title(username) + } + return "Guest" +} + // Helper: returns date string or empty if zero func formatDate(t time.Time) string { if t.IsZero() || t.Year() == 1970 { @@ -201,6 +212,7 @@ func (h *QuotesHandler) QuotesOutstandingView(w http.ResponseWriter, r *http.Req data := map[string]interface{}{ "RecentlyExpiredQuotes": recentlyExpiredQuotes, "ExpiringSoonQuotes": expiringSoonQuotes, + "User": getUsername(r), } if err := h.tmpl.Render(w, "quotes/index.html", data); err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) @@ -292,9 +304,7 @@ func (h *QuotesHandler) DailyQuoteExpirationCheck() { fmt.Println("Running DailyQuoteExpirationCheck...") reminderJobs := []quoteReminderJob{ - {5, FirstReminder, "Reminder: Quote %s Expires Soon", "first_reminder.html"}, // FOR TESTING {7, FirstReminder, "Reminder: Quote %s Expires Soon", "first_reminder.html"}, - {-3, SecondReminder, "Follow-Up: Quote %s Expired", "second_reminder.html"}, // FOR TESTING {-7, SecondReminder, "Follow-Up: Quote %s Expired", "second_reminder.html"}, {-60, ThirdReminder, "Final Reminder: Quote %s Closed", "final_reminder.html"}, } @@ -307,7 +317,6 @@ func (h *QuotesHandler) DailyQuoteExpirationCheck() { } if len(quotes) == 0 { - fmt.Printf("No %s emails to send for day offset %d.\n", job.ReminderType.String(), job.DayOffset) continue } for _, q := range quotes { diff --git a/go-app/server b/go-app/server index 570b4c0b..54b70bf1 100755 Binary files a/go-app/server and b/go-app/server differ