bitrix tasks are created with comments (imported only 1-by-1)

This commit is contained in:
Ivan I. Ovchinnikov
2026-03-25 22:05:38 +03:00
parent d1570b30c4
commit e238c00a30
7 changed files with 643 additions and 81 deletions
+61 -18
View File
@@ -74,6 +74,7 @@
color: #007bff;
text-decoration: none;
}
.back-link:hover { text-decoration: underline; }
.select-all {
margin-bottom: 16px;
}
@@ -81,6 +82,11 @@
color: #666;
margin-left: 8px;
}
.help-text {
font-size: 12px;
color: #666;
margin-top: 4px;
}
</style>
</head>
<body>
@@ -103,6 +109,20 @@
<option value="{{ project.id }}">{{ project.name }}</option>
{% endfor %}
</select>
<div class="help-text" style="margin-top: 12px; background: #fff3e0; padding: 12px; border-radius: 6px; border-left: 4px solid #f57c00;">
<strong>⚠️ Не видите свой проект?</strong> Введите ID вручную:<br>
<input type="number" id="project_id_manual" name="project_id_manual" placeholder="Например: 105"
style="width: 150px; margin-top: 8px; padding: 8px; border: 1px solid #ddd; border-radius: 4px;"
onchange="document.getElementById('project_id').value = this.value">
<div style="margin-top: 8px; font-size: 12px; color: #666;">
<strong>📋 Как узнать ID проекта:</strong><br>
1. Откройте Bitrix24 → Задачи и Проекты<br>
2. Откройте нужный проект<br>
3. В URL будет <code>group/XXX/</code> или <code>project/XXX/</code> — это ID
</div>
</div>
</div>
</div>
@@ -152,30 +172,53 @@
</div>
<div class="card">
<h3>📋 Опции импорта</h3>
<div style="margin: 16px 0;">
<label style="display: flex; align-items: center; gap: 8px; cursor: pointer;">
<input type="checkbox" name="import_comments" id="import_comments" value="on" checked>
<div>
<strong>Импортировать комментарии и вложения</strong>
<div style="font-size: 12px; color: #666; margin-top: 4px;">
Все примечания, история и файлы из Redmine будут добавлены в Bitrix24
</div>
</div>
</label>
</div>
<button type="submit" class="btn btn-success">🚀 Импортировать выбранные задачи</button>
<a href="/api/redmine/tasks" class="btn btn-secondary">Отмена</a>
</div>
</form>
</div>
<script>
async function submitImport(event) {
event.preventDefault();
const formData = new FormData(event.target);
const data = {
project_id: formData.get('project_id'),
task_ids: Array.from(formData.getAll('task_ids'))
};
const response = await fetch('/import', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(data)
});
window.location.href = '/import/result';
}
</script>
<script>
function toggleAll(checkbox) {
const checkboxes = document.querySelectorAll('input[name="task_ids"]');
checkboxes.forEach(cb => {
cb.checked = checkbox.checked;
});
}
document.addEventListener('DOMContentLoaded', function() {
const manualInput = document.getElementById('project_id_manual');
const selectInput = document.getElementById('project_id');
if (manualInput && selectInput) {
manualInput.addEventListener('input', function() {
if (this.value) {
selectInput.value = this.value;
}
});
selectInput.addEventListener('change', function() {
if (this.value && this.value !== '0') {
manualInput.value = this.value;
}
});
}
});
</script>
<style>
.status-new { background: #e3f2fd; color: #1976d2; }