Skip to content
Merged

Dev #2673

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,14 @@ public async Task<int> GetPendingEmailsCountAsync()

public async Task<dynamic> BuildEmailObjectWithAttachmentsAsync(EmailLog emailLog)
{
var persistedUtcSendOn = emailLog.SendOnDateTime.HasValue
? DateTime.SpecifyKind(emailLog.SendOnDateTime.Value, DateTimeKind.Utc)
: (DateTime?)null;

// Get base email object (without attachments)
var emailObject = await GetEmailObjectAsync(
new EmailMessageParams(emailLog.ToAddress, emailLog.Body, emailLog.Subject,
emailLog.FromAddress, emailLog.TemplateName, emailLog.CC, emailLog.BCC, emailLog.SendOnDateTime),
emailLog.FromAddress, emailLog.TemplateName, emailLog.CC, emailLog.BCC, persistedUtcSendOn),
emailLog.BodyType,
excludeTemplate: true);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@

$(function () {

let dropdownItems = [];
let emailAttachmentsTable = null;
let templatesDataTable = null;
let originalFormValues = {};

const UiElements = {
saveButton: $("#saveTemplateBtn"),
discardButton: $("#discardTemaplateBtn"),
Expand All @@ -15,14 +9,66 @@ $(function () {
templatesTable: $('#TemplatesTable')
}

const NotificationUiElements = {
settingForm: $("#NotificationsSettingsForm"),
saveButton: $("#NotificationsSaveButton"),
discardButton: $("#NotificationsDiscardButton")
}

let initialFormState = NotificationUiElements.settingForm.serialize();
let dropdownItems = [];
let emailAttachmentsTable = null;
let templatesDataTable = null;
let originalFormValues = {};

function init() {
$('#email-attachments-section').hide();
initializeTemplateDataTables();
initializeDivider();
initializeTabPersistence();
initializeRecipientSelect();
checkFormChanges();
}

function checkFormChanges() {
let currentFormState = NotificationUiElements.settingForm.serialize();
let isFormChanged = currentFormState !== initialFormState;

NotificationUiElements.saveButton.prop('disabled', !isFormChanged);
NotificationUiElements.discardButton.prop('disabled', !isFormChanged);
}

NotificationUiElements.settingForm.on('input change', function () {
checkFormChanges();
});

NotificationUiElements.settingForm.on('submit', function (event) {
event.preventDefault();

if (!$(this).valid()) {
return;
}

let form = $(this).serializeFormToObject();
unity.notifications.emailNotifications.emailNotification.updateSettings(form).then(function (result) {
$(document).trigger("AbpSettingSaved");
initialFormState = NotificationUiElements.settingForm.serialize();
checkFormChanges();
}).then(function () {
abp.notify.success('Settings saved successfully.');
}).$catch(function (e) {
console.warn('Failed to save settings:', e);
abp.notify.error('Failed to save settings.');
});

});

NotificationUiElements.discardButton.on('click', function () {
NotificationUiElements.settingForm[0].reset();
initialFormState = NotificationUiElements.settingForm.serialize();
checkFormChanges();
});

init();

// ── Tab State Persistence ─────────────────────────────────────────────
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@
"ProgramDetails:Branch": "Branch",
"ProgramDetails:Description": "Description",
"ProgramDetails:SaveChanges": "Save Changes",
"ProgramDetails:ResetChanges": "Reset",
"ProgramDetails:ResetChanges": "Discard Changes",
"ProgramDetails:NoChanges": "No changes to save.",
"ProgramDetails:ChangesReset": "Changes have been reset to original values.",
"ProgramDetails:SaveSuccess": "Program details updated successfully.",
Expand Down
Loading