bitmine/templates/import_select.html

231 lines
9.1 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Импорт задач — Bitmine</title>
<style>
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
background: #f5f5f5;
padding: 20px;
}
.container { max-width: 1200px; margin: 0 auto; }
h1 { color: #333; margin-bottom: 20px; }
.card {
background: white;
border-radius: 8px;
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
padding: 24px;
margin-bottom: 20px;
}
.form-group { margin-bottom: 20px; }
label {
display: block;
margin-bottom: 8px;
font-weight: 500;
color: #333;
}
select {
width: 100%;
padding: 12px;
border: 1px solid #ddd;
border-radius: 6px;
font-size: 14px;
background: white;
}
table {
width: 100%;
border-collapse: collapse;
margin-top: 16px;
}
th, td {
padding: 12px;
text-align: left;
border-bottom: 1px solid #eee;
}
th { background: #f8f9fa; }
.btn {
background: #007bff;
color: white;
border: none;
padding: 12px 24px;
border-radius: 6px;
cursor: pointer;
font-size: 14px;
font-weight: 500;
}
.btn:hover { background: #0056b3; }
.btn-success { background: #28a745; }
.btn-success:hover { background: #218838; }
.btn-secondary { background: #6c757d; }
.btn-secondary:hover { background: #545b62; }
.error {
background: #ffebee;
color: #c62828;
padding: 16px;
border-radius: 8px;
margin-bottom: 20px;
}
.back-link {
display: inline-block;
margin-bottom: 20px;
color: #007bff;
text-decoration: none;
}
.back-link:hover { text-decoration: underline; }
.select-all {
margin-bottom: 16px;
}
.task-count {
color: #666;
margin-left: 8px;
}
.help-text {
font-size: 12px;
color: #666;
margin-top: 4px;
}
</style>
</head>
<body>
<div class="container">
<a href="/api/redmine/tasks" class="back-link">← Назад к списку задач</a>
<h1>📥 Импорт задач из Redmine в Bitrix24</h1>
{% if error.is_some() %}
<div class="error">{{ error.as_ref().unwrap() }}</div>
{% endif %}
<form method="POST" action="/import">
<div class="card">
<div class="form-group">
<label for="project_id">📁 Выберите проект в Bitrix24 для импорта:</label>
<select name="project_id" id="project_id" required>
<option value="">-- Выберите проект --</option>
{% for project in projects %}
<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>
<div class="card">
<h2>Выберите задачи для импорта</h2>
<div class="select-all">
<label>
<input type="checkbox" id="select-all" onchange="toggleAll(this)">
Выбрать все <span class="task-count">({{ tasks.len() }} задач)</span>
</label>
</div>
<table>
<thead>
<tr>
<th style="width: 40px;"></th>
<th></th>
<th>Тема</th>
<th>Статус</th>
<th>Проект</th>
</tr>
</thead>
<tbody>
{% for task in tasks %}
<tr>
<td>
<input type="checkbox" name="task_ids" value="{{ task.id }}">
</td>
<td>{{ task.id }}</td>
<td>{{ task.subject }}</td>
<td>
<span class="status status-{{ task.status_class }}" style="padding: 4px 12px; border-radius: 12px; font-size: 12px;">
{{ task.status_name }}
</span>
</td>
<td>
{% match task.project %}
{% when Some(proj) %}{{ proj }}
{% when None %}—
{% endmatch %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</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>
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; }
.status-progress { background: #fff3e0; color: #f57c00; }
.status-resolved { background: #e8f5e9; color: #388e3c; }
.status-closed { background: #f5f5f5; color: #616161; }
</style>
</body>
</html>