Replaced custom wizard UI with MudBlazor's MudStepper for a modern and consistent design. Added dynamic step titles, descriptions, and forms for envelope creation, including advanced settings like certification, reminders, and email notifications. Integrated PDF upload with preview functionality. Refactored `CreateEnvelopeWizardPopup.razor` for better maintainability and modularity. Removed redundant code and centralized step-related logic. Improved localization, accessibility, and user experience. Updated `EnvelopeGenerator.Server.Client.csproj` and `EnvelopeGenerator.Server.csproj` to include MudBlazor. Registered MudBlazor services in `Program.cs` and added required CSS/JS in `App.razor`. Updated styles in `sender-page.css` to align with the new stepper design.
45 lines
2.1 KiB
C#
45 lines
2.1 KiB
C#
using DigitalData.Core.Abstraction.Application.Repository;
|
|
using DigitalData.MessagingService.Application.Common.Interfaces;
|
|
using DigitalData.MessagingService.Application.EmailSending.Commands;
|
|
using EnvelopeGenerator.Application.Common.Interfaces.Services.Notification;
|
|
using EnvelopeGenerator.Domain.Constants;
|
|
using EnvelopeGenerator.Domain.Entities;
|
|
using EnvelopeGenerator.Domain.Exceptions;
|
|
using EnvelopeGenerator.Infrastructure.Notification.Configuration;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.Extensions.Options;
|
|
|
|
namespace EnvelopeGenerator.Infrastructure.Notification;
|
|
|
|
public class EnvelopeNotificationService(IRepository<EmailTemplate> TempRepo, IMessagingServiceClient MsgClient, IOptions<NotificationOptions> ntfOpt) : IEnvelopeNotificationService
|
|
{
|
|
private readonly NotificationOptions NtfOpt = ntfOpt.Value;
|
|
|
|
private async Task<EmailTemplate> GetTemplateAsync(EmailTemplateType templateType, CancellationToken cancel = default)
|
|
{
|
|
return await TempRepo.Where(t => t.Name == templateType.ToString()).FirstOrDefaultAsync(cancel)
|
|
?? throw new DataIntegrityException($"{templateType} email template not found");
|
|
}
|
|
|
|
public async Task Notify<TEnvelopeNotificationBase>(string receiverEmail, TEnvelopeNotificationBase notification, CancellationToken cancel = default)
|
|
where TEnvelopeNotificationBase : EnvelopeNotificationBase
|
|
{
|
|
var template = await GetTemplateAsync(notification.GetTemplateType(), cancel);
|
|
|
|
// create email command
|
|
var mail = new PublishEmailViaSmtpCommand()
|
|
{
|
|
Body = template.Body.ReplacePlaceholders(notification),
|
|
Subject = template.Subject.ReplacePlaceholders(notification),
|
|
Recipients = [receiverEmail],
|
|
Sender = NtfOpt.SenderEmail.ToSender(),
|
|
IsHtml = true
|
|
};
|
|
|
|
// add attachments if any
|
|
if(notification.Attachments?.Any() ?? false)
|
|
mail = mail.WithAttachments(notification.Attachments.ToEmailAttachmentDto());
|
|
|
|
await MsgClient.SendAsync(mail, cancel);
|
|
}
|
|
} |