release
This commit is contained in:
+18
-30
@@ -20,9 +20,8 @@ function saveOriginalSettings() {
|
||||
selected_users: getSelectedUsers(),
|
||||
static_text: document.getElementById('static_text').value,
|
||||
full_name: document.getElementById('full_name').checked,
|
||||
start_hour: parseInt(document.getElementById('start_hour').value),
|
||||
end_hour: parseInt(document.getElementById('end_hour').value),
|
||||
interval_minutes: parseInt(document.getElementById('interval_minutes').value),
|
||||
hour: parseInt(document.getElementById('hour').value),
|
||||
minute: parseInt(document.getElementById('minute').value),
|
||||
enabled: document.getElementById('scheduler_enabled').checked
|
||||
};
|
||||
}
|
||||
@@ -38,7 +37,7 @@ function setupChangeListeners() {
|
||||
});
|
||||
|
||||
// Поля формы
|
||||
const formFields = ['static_text', 'start_hour', 'end_hour', 'interval_minutes'];
|
||||
const formFields = ['static_text', 'hour', 'minute'];
|
||||
formFields.forEach(field => {
|
||||
const element = document.getElementById(field);
|
||||
if (element) {
|
||||
@@ -58,9 +57,8 @@ function checkForChanges() {
|
||||
selected_users: getSelectedUsers(),
|
||||
static_text: document.getElementById('static_text').value,
|
||||
full_name: document.getElementById('full_name').checked,
|
||||
start_hour: parseInt(document.getElementById('start_hour').value),
|
||||
end_hour: parseInt(document.getElementById('end_hour').value),
|
||||
interval_minutes: parseInt(document.getElementById('interval_minutes').value),
|
||||
hour: parseInt(document.getElementById('hour').value),
|
||||
minute: parseInt(document.getElementById('minute').value),
|
||||
enabled: document.getElementById('scheduler_enabled').checked
|
||||
};
|
||||
|
||||
@@ -194,9 +192,8 @@ async function saveSettings() {
|
||||
const selectedUsers = getSelectedUsers();
|
||||
const staticText = document.getElementById('static_text').value.trim();
|
||||
const fullName = document.getElementById('full_name').checked;
|
||||
const startHour = parseInt(document.getElementById('start_hour').value);
|
||||
const endHour = parseInt(document.getElementById('end_hour').value);
|
||||
const intervalMinutes = parseInt(document.getElementById('interval_minutes').value);
|
||||
const hour = parseInt(document.getElementById('hour').value);
|
||||
const minute = parseInt(document.getElementById('minute').value);
|
||||
const schedulerEnabled = document.getElementById('scheduler_enabled').checked;
|
||||
|
||||
// Валидация
|
||||
@@ -210,23 +207,13 @@ async function saveSettings() {
|
||||
return;
|
||||
}
|
||||
|
||||
if (startHour < 0 || startHour > 23) {
|
||||
showAlert('warning', 'Время начала должно быть от 0 до 23 часов');
|
||||
if (hour < 0 || hour > 23) {
|
||||
showAlert('warning', 'Час должен быть от 0 до 23 часов');
|
||||
return;
|
||||
}
|
||||
|
||||
if (endHour < 0 || endHour > 23) {
|
||||
showAlert('warning', 'Время окончания должно быть от 0 до 23 часов');
|
||||
return;
|
||||
}
|
||||
|
||||
if (startHour >= endHour) {
|
||||
showAlert('warning', 'Время начала должно быть раньше времени окончания');
|
||||
return;
|
||||
}
|
||||
|
||||
if (intervalMinutes < 1 || intervalMinutes > 1440) {
|
||||
showAlert('warning', 'Интервал должен быть от 1 до 1440 минут');
|
||||
if (minute < 0 || minute > 59) {
|
||||
showAlert('warning', 'Минута должна быть от 0 до 59 минут');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -248,14 +235,12 @@ async function saveSettings() {
|
||||
}
|
||||
|
||||
// Только измененные данные для schedulerData
|
||||
if (startHour !== originalSettings.start_hour ||
|
||||
endHour !== originalSettings.end_hour ||
|
||||
intervalMinutes !== originalSettings.interval_minutes ||
|
||||
if (hour !== originalSettings.hour ||
|
||||
minute !== originalSettings.minute ||
|
||||
schedulerEnabled !== originalSettings.enabled) {
|
||||
postData.schedulerData = {
|
||||
startTime: startHour.toString(),
|
||||
endTime: endHour.toString(),
|
||||
interval_minutes: intervalMinutes.toString(),
|
||||
hour: hour,
|
||||
minute: minute,
|
||||
enabled: schedulerEnabled
|
||||
};
|
||||
}
|
||||
@@ -288,6 +273,9 @@ async function saveSettings() {
|
||||
if (Object.keys(postData.schedulerData).length > 0) {
|
||||
setTimeout(updateSchedulerStatus, 1000);
|
||||
}
|
||||
if (data.next_run_time) {
|
||||
document.getElementById('nextRunTime').textContent = data.next_run_time;
|
||||
}
|
||||
} else {
|
||||
const error = data.message || 'Ошибка сохранения';
|
||||
showAlert('danger', error);
|
||||
|
||||
Reference in New Issue
Block a user