Files
PowderCoatingLogix/src/PowderCoating.Web/Views/SetupWizard/Step9.cshtml
T
spouliot e4a256a6c4 Fix subscription expiry logic and HTML entities in page titles
Subscription expiry (SubscriptionExpiryBackgroundService):
- Trials with no grace period now go directly Active -> Expired instead
  of briefly entering GracePeriod for a day, which was causing repeated
  'Grace Period Started' admin notification emails
- Remove redundant isTrial variable (query already filters to non-Stripe
  companies, so all processed companies are trials by definition)
- Save per-company inside the loop so a single SaveChangesAsync failure
  no longer discards all other companies' status changes and notification
  log entries (which was the other cause of repeated emails)

HTML entities in page titles (33 views):
- Replace – / — with plain ' - ' in ViewData["Title"] C#
  strings; Razor HTML-encodes these when rendering @ViewData["Title"],
  causing browsers to display the literal text '–' instead of a dash

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-25 09:58:37 -04:00

137 lines
8.1 KiB
Plaintext

@using PowderCoating.Application.DTOs.Wizard
@model WizardStep7Dto
@{
ViewData["Title"] = "Setup Wizard - Notifications";
var progress = ViewBag.Progress as WizardProgressDto ?? new WizardProgressDto();
int step = ViewBag.Step as int? ?? 5;
}
@section Styles { @await Html.PartialAsync("_WizardStyles") }
<div class="wizard-layout">
@await Html.PartialAsync("_WizardProgress", progress)
<div class="wizard-content">
<div class="wizard-step-header">
<span class="wizard-step-badge">Step @step of @WizardProgressDto.TotalSteps</span>
<h2><i class="bi bi-bell me-2"></i>Notification Preferences</h2>
<p class="text-secondary">Configure which email notifications are sent to your customers when key events happen in the system.</p>
</div>
<form asp-action="PostStep9" method="post">
@Html.AntiForgeryToken()
<div class="wizard-card">
<h5 class="wizard-card-title">Email Sender</h5>
<div class="row g-3">
<div class="col-12">
<div class="form-check form-switch mb-3">
<input class="form-check-input" type="checkbox" asp-for="EmailNotificationsEnabled" id="EmailNotificationsEnabled" />
<label class="form-check-label fw-semibold" for="EmailNotificationsEnabled">Enable Email Notifications</label>
</div>
</div>
<div class="col-md-6">
<label asp-for="EmailFromAddress" class="form-label fw-semibold"></label>
<input asp-for="EmailFromAddress" class="form-control" type="email" placeholder="noreply@yourcompany.com" />
<div class="form-text">Leave blank to use the system default sender.</div>
<span asp-validation-for="EmailFromAddress" class="text-danger small"></span>
</div>
<div class="col-md-6">
<label asp-for="EmailFromName" class="form-label fw-semibold"></label>
<input asp-for="EmailFromName" class="form-control" placeholder="Acme Powder Coating" />
<div class="form-text">The name customers see in their inbox.</div>
</div>
</div>
</div>
<div class="wizard-card">
<h5 class="wizard-card-title">Notification Events</h5>
<p class="text-secondary small mb-3">Choose which events trigger an automatic email to the customer.</p>
<div class="row g-3">
<div class="col-md-6">
<div class="form-check form-switch mb-2">
<input class="form-check-input" type="checkbox" asp-for="NotifyOnNewJob" id="NotifyOnNewJob" />
<label class="form-check-label" for="NotifyOnNewJob">New Job Created</label>
</div>
<div class="form-check form-switch mb-2">
<input class="form-check-input" type="checkbox" asp-for="NotifyOnNewQuote" id="NotifyOnNewQuote" />
<label class="form-check-label" for="NotifyOnNewQuote">New Quote Sent</label>
</div>
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" asp-for="NotifyOnJobStatusChange" id="NotifyOnJobStatusChange" />
<label class="form-check-label" for="NotifyOnJobStatusChange">Job Status Changes</label>
</div>
</div>
<div class="col-md-6">
<div class="form-check form-switch mb-2">
<input class="form-check-input" type="checkbox" asp-for="NotifyOnQuoteApproval" id="NotifyOnQuoteApproval" />
<label class="form-check-label" for="NotifyOnQuoteApproval">Quote Approved</label>
</div>
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" asp-for="NotifyOnPaymentReceived" id="NotifyOnPaymentReceived" />
<label class="form-check-label" for="NotifyOnPaymentReceived">Payment Received</label>
</div>
</div>
</div>
</div>
<div class="wizard-card">
<h5 class="wizard-card-title">Automated Payment Reminders</h5>
<p class="text-secondary small mb-3">
Automatically send overdue invoice reminders to customers at configurable intervals.
The system checks daily and sends one reminder per threshold, per invoice.
</p>
<div class="row g-3">
<div class="col-12">
<div class="form-check form-switch mb-3">
<input class="form-check-input" type="checkbox" asp-for="PaymentRemindersEnabled" id="PaymentRemindersEnabled" />
<label class="form-check-label fw-semibold" for="PaymentRemindersEnabled">Enable Automated Payment Reminders</label>
</div>
</div>
<div class="col-md-6">
<label asp-for="PaymentReminderDays" class="form-label fw-semibold"></label>
<input asp-for="PaymentReminderDays" class="form-control" placeholder="7,14,30" />
<div class="form-text">Days past the invoice due date to send a reminder (e.g. <code>7,14,30</code>).</div>
<span asp-validation-for="PaymentReminderDays" class="text-danger small"></span>
</div>
</div>
</div>
<div class="wizard-card">
<h5 class="wizard-card-title">Alert Thresholds</h5>
<p class="text-secondary small mb-3">How far in advance the system warns you about upcoming deadlines and maintenance.</p>
<div class="row g-3">
<div class="col-md-4">
<label asp-for="QuoteExpiryWarningDays" class="form-label fw-semibold"></label>
<div class="input-group">
<input asp-for="QuoteExpiryWarningDays" class="form-control" type="number" min="0" max="90" />
<span class="input-group-text">days</span>
</div>
<div class="form-text">Warn before a quote's expiry date.</div>
<span asp-validation-for="QuoteExpiryWarningDays" class="text-danger small"></span>
</div>
<div class="col-md-4">
<label asp-for="DueDateWarningDays" class="form-label fw-semibold"></label>
<div class="input-group">
<input asp-for="DueDateWarningDays" class="form-control" type="number" min="0" max="90" />
<span class="input-group-text">days</span>
</div>
<div class="form-text">Warn before a job's due date.</div>
<span asp-validation-for="DueDateWarningDays" class="text-danger small"></span>
</div>
<div class="col-md-4">
<label asp-for="MaintenanceAlertDays" class="form-label fw-semibold"></label>
<div class="input-group">
<input asp-for="MaintenanceAlertDays" class="form-control" type="number" min="0" max="90" />
<span class="input-group-text">days</span>
</div>
<div class="form-text">Warn before scheduled equipment maintenance.</div>
<span asp-validation-for="MaintenanceAlertDays" class="text-danger small"></span>
</div>
</div>
</div>
@await Html.PartialAsync("_WizardFooter", step)
</form>
</div>
</div>