Add WarningPermanent toast type and upgrade invoice failure notifications
Email delivery failures and PDF generation errors now show a permanent warning/error toast that requires manual dismissal, so users cannot accidentally miss critical action-blocking feedback. - ToastHelper: WarningPermanent TempData key + Warning/WarningPermanent extension methods on both ITempDataDictionary and Controller - SetNotificationResultToast: NotificationStatus.Failed now uses ToastWarningPermanent (previously auto-dismissed in 5 s) - InvoicesController.Send: TempData["Warning"] → TempData["WarningPermanent"] when PDF generation or email dispatch fails - InvoicesController.DownloadPdf: TempData["Error"] → TempData["ErrorPermanent"] with the actual exception message so root cause is visible - _Layout.cshtml: WarningPermanent hidden div - toast-notifications.js: WarningPermanent handler (timeOut: 0) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -917,7 +917,7 @@ public class InvoicesController : Controller
|
||||
|
||||
TempData["Success"] = $"Invoice {invoice.InvoiceNumber} marked as sent.";
|
||||
if (!pdfAndNotifSucceeded)
|
||||
TempData["Warning"] = "The invoice is marked as sent, but PDF generation or the customer email failed. Check the notification logs or your email configuration.";
|
||||
TempData["WarningPermanent"] = "The invoice is marked as sent, but PDF generation or the customer email failed. Check the notification logs or your email configuration.";
|
||||
return RedirectToAction(nameof(Details), new { id });
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -1302,8 +1302,8 @@ public class InvoicesController : Controller
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error generating PDF for invoice {Id}", id);
|
||||
TempData["Error"] = "An error occurred while generating the PDF.";
|
||||
_logger.LogError(ex, "Error generating PDF for invoice {Id}. Inner: {Inner}", id, ex.InnerException?.Message ?? ex.Message);
|
||||
TempData["ErrorPermanent"] = $"PDF generation failed: {ex.Message}";
|
||||
return RedirectToAction(nameof(Details), new { id });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user