@@ -120,8 +121,19 @@
-
-
+
+
+
+
+
Ваш профиль
@@ -191,7 +203,11 @@
const message = document.querySelector('#message');
const summary = document.querySelector('#summary');
const copy = document.querySelector('#copy');
+ const goalCopy = document.querySelector('#goalCopy');
const screenshots = document.querySelector('#screenshots');
+ const reportAttachments = document.querySelector('#reportAttachments');
+ const reportActions = document.querySelector('#reportActions');
+ const goalActions = document.querySelector('#goalActions');
const bulkText = document.querySelector('#bulkText');
const bulkStatus = document.querySelector('#bulkStatus');
const bulk = document.querySelector('.bulk');
@@ -240,7 +256,11 @@
mode = nextMode;
document.querySelectorAll('[data-mode]').forEach(item => item.classList.toggle('active', item.dataset.mode === mode));
document.querySelectorAll('.mode').forEach(panel => panel.classList.toggle('hidden', panel.id !== mode));
+ document.querySelectorAll('.mode').forEach(panel => panel.querySelectorAll('input, select, textarea').forEach(field => { field.disabled = panel.id !== mode; }));
bulk.classList.toggle('hidden', mode !== 'coaching');
+ reportAttachments.classList.toggle('hidden', mode === 'goal');
+ reportActions.classList.toggle('hidden', mode === 'goal');
+ goalActions.classList.toggle('hidden', mode !== 'goal');
if (mode !== 'coaching') bulkStatus.textContent = '';
error.textContent = '';
}
@@ -312,7 +332,7 @@
const data = {};
document.querySelectorAll(`#${mode} [name]`).forEach(field => { data[field.name] = field.value; });
data.mode = mode;
- ['escort_id', 'kitten_id', 'character_id', 'inspections'].forEach(key => { if (data[key] !== undefined && data[key] !== '') data[key] = Number(data[key]); });
+ ['escort_id', 'kitten_id', 'character_id', 'inspections', 'current_points', 'target_points', 'minutes_per_session', 'kitten_count'].forEach(key => { if (data[key] !== undefined && data[key] !== '') data[key] = Number(data[key]); });
if (mode === 'inspection') {
data.resources = (data.resources || '').split('\n').map(line => line.trim()).filter(Boolean).map(line => {
const match = line.match(/^\+\s*(\d+)\s+(.+)$/);
@@ -349,15 +369,18 @@
if (statusError) throw new Error(statusError);
}
const reportPayload = payload();
- reportPayload.attachments = await uploadScreenshots();
+ reportPayload.attachments = mode === 'goal' ? [] : await uploadScreenshots();
const response = await fetch('/api/calculate', { method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify(reportPayload) });
const data = await response.json();
if (!response.ok) throw new Error(data.error || 'Ошибка калькулятора');
message.value = data.message; summary.textContent = data.result ? `Результат: ${JSON.stringify(data.result)}` : '';
- result.classList.remove('hidden'); copy.disabled = false;
+ result.classList.remove('hidden');
+ copy.disabled = mode === 'goal';
+ goalCopy.disabled = mode !== 'goal';
} catch (err) { error.textContent = err.message; }
});
copy.addEventListener('click', async () => { await navigator.clipboard.writeText(message.value); copy.textContent = 'Скопировано'; setTimeout(() => copy.textContent = 'Скопировать', 1500); });
+ goalCopy.addEventListener('click', async () => { await navigator.clipboard.writeText(message.value); goalCopy.textContent = 'Скопировано'; setTimeout(() => goalCopy.textContent = 'Скопировать', 1500); });
const reportsSection = document.querySelector('#reportsSection');
const applicationsSection = document.querySelector('#applicationsSection');
@@ -464,6 +487,7 @@
});
addApplicationFeather();
syncApplicationForm();
+ selectMode(mode);
setSection(new URLSearchParams(window.location.search).get('section') === 'applications' ? 'applications' : 'reports', false);