Streamlining quote reminder logging
This commit is contained in:
parent
e94cabfc3e
commit
016f77a2c9
|
|
@ -589,8 +589,6 @@ func (h *QuotesHandler) SendQuoteReminderEmailWithAttachment(ctx context.Context
|
|||
|
||||
// SendManualReminder handles POST requests to manually send a quote reminder
|
||||
func (h *QuotesHandler) SendManualReminder(w http.ResponseWriter, r *http.Request) {
|
||||
log.Printf("SendManualReminder handler called")
|
||||
|
||||
if r.Method != http.MethodPost {
|
||||
http.Error(w, "Method not allowed", http.StatusMethodNotAllowed)
|
||||
return
|
||||
|
|
@ -657,7 +655,6 @@ func (h *QuotesHandler) SendManualReminder(w http.ResponseWriter, r *http.Reques
|
|||
// Attach PDF quote from URL
|
||||
pdfURL := fmt.Sprintf("https://stg.cmctechnologies.com.au/pdf/%s.pdf", enquiryRef)
|
||||
pdfFilename := fmt.Sprintf("%s.pdf", enquiryRef)
|
||||
log.Printf("Manual reminder for quote %d (%s): recipient=%s, pdfURL=%s", quoteID, enquiryRef, customerEmail, pdfURL)
|
||||
|
||||
// Get username from request
|
||||
username := getUsername(r)
|
||||
|
|
@ -685,8 +682,6 @@ func (h *QuotesHandler) SendManualReminder(w http.ResponseWriter, r *http.Reques
|
|||
return
|
||||
}
|
||||
|
||||
log.Printf("Manual reminder sent successfully for quote %d (%s) to %s", quoteID, enquiryRef, customerEmail)
|
||||
|
||||
// Check if this is an AJAX request
|
||||
if r.Header.Get("X-Requested-With") == "XMLHttpRequest" {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
|
|
@ -710,13 +705,11 @@ func (h *QuotesHandler) DisableReminders(w http.ResponseWriter, r *http.Request)
|
|||
|
||||
// Parse form data
|
||||
if err := r.ParseForm(); err != nil {
|
||||
log.Printf("Failed to parse form for disable reminders: %v", err)
|
||||
http.Error(w, "Invalid form data", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
quoteIDStr := r.FormValue("quote_id")
|
||||
log.Printf("DisableReminders: received quote_id='%s', all form values: %v", quoteIDStr, r.Form)
|
||||
if quoteIDStr == "" {
|
||||
http.Error(w, "Missing quote_id", http.StatusBadRequest)
|
||||
return
|
||||
|
|
@ -743,8 +736,6 @@ func (h *QuotesHandler) DisableReminders(w http.ResponseWriter, r *http.Request)
|
|||
return
|
||||
}
|
||||
|
||||
log.Printf("Reminders disabled for quote %d by %s", quoteID, username)
|
||||
|
||||
// Check if this is an AJAX request
|
||||
if r.Header.Get("X-Requested-With") == "XMLHttpRequest" {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
|
|
@ -793,8 +784,6 @@ func (h *QuotesHandler) EnableReminders(w http.ResponseWriter, r *http.Request)
|
|||
return
|
||||
}
|
||||
|
||||
log.Printf("Reminders enabled for quote %d", quoteID)
|
||||
|
||||
// Check if this is an AJAX request
|
||||
if r.Header.Get("X-Requested-With") == "XMLHttpRequest" {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
|
|
|
|||
|
|
@ -339,7 +339,6 @@ function hideConfirmModal() {
|
|||
}
|
||||
|
||||
function showDisableModal(quoteID, enquiryRef) {
|
||||
console.log('showDisableModal called with:', quoteID, enquiryRef);
|
||||
currentQuoteID = quoteID;
|
||||
document.getElementById('disableModalQuoteID').textContent = quoteID;
|
||||
document.getElementById('disableModalEnquiryRef').textContent = enquiryRef;
|
||||
|
|
@ -421,11 +420,9 @@ document.getElementById('modalConfirmBtn').addEventListener('click', async funct
|
|||
document.getElementById('disableModalCancelBtn').addEventListener('click', hideDisableModal);
|
||||
|
||||
document.getElementById('disableModalConfirmBtn').addEventListener('click', async function() {
|
||||
console.log('Disable confirm clicked, currentQuoteID:', currentQuoteID);
|
||||
if (currentQuoteID) {
|
||||
const formData = new URLSearchParams();
|
||||
formData.append('quote_id', currentQuoteID);
|
||||
console.log('FormData quote_id:', formData.get('quote_id'));
|
||||
|
||||
try {
|
||||
const response = await fetch('/go/quotes/disable-reminders', {
|
||||
|
|
|
|||
Loading…
Reference in a new issue