- Portfolio CRUD: добавление, редактирование, удаление, переключение публикации - Services CRUD: полное управление услугами с возможностью активации/деактивации - Banner system: новая модель Banner с CRUD операциями и аналитикой кликов - Telegram integration: расширенные настройки бота, обнаружение чатов, отправка сообщений - Media management: улучшенная загрузка файлов с оптимизацией изображений и превью - UI improvements: обновлённые админ-панели с rich-text редактором и drag&drop загрузкой - Database: добавлена таблица banners с полями для баннеров и аналитики
219 lines
9.5 KiB
Plaintext
219 lines
9.5 KiB
Plaintext
<!-- Contact Details -->
|
||
<div class="bg-white shadow rounded-lg">
|
||
<div class="px-4 py-5 sm:px-6 border-b border-gray-200">
|
||
<div class="flex items-center justify-between">
|
||
<h3 class="text-lg leading-6 font-medium text-gray-900">
|
||
<i class="fas fa-envelope mr-2"></i>
|
||
Детали сообщения
|
||
</h3>
|
||
<a href="/admin/contacts" class="bg-gray-300 hover:bg-gray-400 text-gray-800 font-bold py-2 px-4 rounded">
|
||
<i class="fas fa-arrow-left mr-1"></i>
|
||
Назад к списку
|
||
</a>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="p-6">
|
||
<div class="grid grid-cols-1 gap-6 sm:grid-cols-2">
|
||
<!-- Contact Information -->
|
||
<div class="bg-gray-50 p-4 rounded-lg">
|
||
<h4 class="text-lg font-medium text-gray-900 mb-4">Информация о контакте</h4>
|
||
|
||
<dl class="space-y-3">
|
||
<div>
|
||
<dt class="text-sm font-medium text-gray-500">Имя</dt>
|
||
<dd class="mt-1 text-sm text-gray-900"><%= contact.name %></dd>
|
||
</div>
|
||
|
||
<div>
|
||
<dt class="text-sm font-medium text-gray-500">Email</dt>
|
||
<dd class="mt-1 text-sm text-gray-900">
|
||
<a href="mailto:<%= contact.email %>" class="text-blue-600 hover:text-blue-800">
|
||
<%= contact.email %>
|
||
</a>
|
||
</dd>
|
||
</div>
|
||
|
||
<% if (contact.phone) { %>
|
||
<div>
|
||
<dt class="text-sm font-medium text-gray-500">Телефон</dt>
|
||
<dd class="mt-1 text-sm text-gray-900">
|
||
<a href="tel:<%= contact.phone %>" class="text-blue-600 hover:text-blue-800">
|
||
<%= contact.phone %>
|
||
</a>
|
||
</dd>
|
||
</div>
|
||
<% } %>
|
||
|
||
<div>
|
||
<dt class="text-sm font-medium text-gray-500">Дата создания</dt>
|
||
<dd class="mt-1 text-sm text-gray-900">
|
||
<%= new Date(contact.createdAt).toLocaleString('ru-RU') %>
|
||
</dd>
|
||
</div>
|
||
</dl>
|
||
</div>
|
||
|
||
<!-- Project Details -->
|
||
<div class="bg-gray-50 p-4 rounded-lg">
|
||
<h4 class="text-lg font-medium text-gray-900 mb-4">Детали проекта</h4>
|
||
|
||
<dl class="space-y-3">
|
||
<% if (contact.serviceInterest) { %>
|
||
<div>
|
||
<dt class="text-sm font-medium text-gray-500">Интересующая услуга</dt>
|
||
<dd class="mt-1">
|
||
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800">
|
||
<%= contact.serviceInterest %>
|
||
</span>
|
||
</dd>
|
||
</div>
|
||
<% } %>
|
||
|
||
<% if (contact.budget) { %>
|
||
<div>
|
||
<dt class="text-sm font-medium text-gray-500">Бюджет</dt>
|
||
<dd class="mt-1 text-sm text-gray-900"><%= contact.budget %></dd>
|
||
</div>
|
||
<% } %>
|
||
|
||
<% if (contact.timeline) { %>
|
||
<div>
|
||
<dt class="text-sm font-medium text-gray-500">Временные рамки</dt>
|
||
<dd class="mt-1 text-sm text-gray-900"><%= contact.timeline %></dd>
|
||
</div>
|
||
<% } %>
|
||
|
||
<div>
|
||
<dt class="text-sm font-medium text-gray-500">Статус</dt>
|
||
<dd class="mt-1">
|
||
<select id="statusSelect" data-contact-id="<%= contact.id %>"
|
||
class="border-gray-300 rounded-md shadow-sm text-sm">
|
||
<option value="new" <%= contact.status === 'new' ? 'selected' : '' %>>Новое</option>
|
||
<option value="in_progress" <%= contact.status === 'in_progress' ? 'selected' : '' %>>В работе</option>
|
||
<option value="completed" <%= contact.status === 'completed' ? 'selected' : '' %>>Завершено</option>
|
||
</select>
|
||
</dd>
|
||
</div>
|
||
|
||
<div>
|
||
<dt class="text-sm font-medium text-gray-500">Приоритет</dt>
|
||
<dd class="mt-1">
|
||
<select id="prioritySelect" data-contact-id="<%= contact.id %>"
|
||
class="border-gray-300 rounded-md shadow-sm text-sm">
|
||
<option value="low" <%= contact.priority === 'low' ? 'selected' : '' %>>Низкий</option>
|
||
<option value="medium" <%= contact.priority === 'medium' ? 'selected' : '' %>>Средний</option>
|
||
<option value="high" <%= contact.priority === 'high' ? 'selected' : '' %>>Высокий</option>
|
||
</select>
|
||
</dd>
|
||
</div>
|
||
</dl>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Message -->
|
||
<div class="mt-6">
|
||
<h4 class="text-lg font-medium text-gray-900 mb-3">Сообщение</h4>
|
||
<div class="bg-gray-50 p-4 rounded-lg">
|
||
<p class="text-sm text-gray-700 whitespace-pre-wrap"><%= contact.message %></p>
|
||
</div>
|
||
</div>
|
||
|
||
<!-- Actions -->
|
||
<div class="mt-6 flex space-x-3">
|
||
<button onclick="sendTelegramNotification('<%= contact.id %>')"
|
||
class="bg-blue-500 hover:bg-blue-600 text-white px-4 py-2 rounded-md text-sm font-medium">
|
||
<i class="fab fa-telegram-plane mr-1"></i>
|
||
Отправить в Telegram
|
||
</button>
|
||
|
||
<a href="mailto:<%= contact.email %>?subject=Re: <%= encodeURIComponent(contact.serviceInterest || 'Ваш запрос') %>"
|
||
class="bg-green-500 hover:bg-green-600 text-white px-4 py-2 rounded-md text-sm font-medium">
|
||
<i class="fas fa-reply mr-1"></i>
|
||
Ответить по email
|
||
</a>
|
||
|
||
<button onclick="deleteContact('<%= contact.id %>')"
|
||
class="bg-red-500 hover:bg-red-600 text-white px-4 py-2 rounded-md text-sm font-medium">
|
||
<i class="fas fa-trash mr-1"></i>
|
||
Удалить
|
||
</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
<script>
|
||
// Update status
|
||
document.getElementById('statusSelect').addEventListener('change', function() {
|
||
updateContactField('status', this.value, this.dataset.contactId);
|
||
});
|
||
|
||
// Update priority
|
||
document.getElementById('prioritySelect').addEventListener('change', function() {
|
||
updateContactField('priority', this.value, this.dataset.contactId);
|
||
});
|
||
|
||
function updateContactField(field, value, contactId) {
|
||
fetch(`/api/admin/contacts/${contactId}`, {
|
||
method: 'PATCH',
|
||
headers: {
|
||
'Content-Type': 'application/json',
|
||
},
|
||
body: JSON.stringify({ [field]: value })
|
||
})
|
||
.then(response => response.json())
|
||
.then(data => {
|
||
if (!data.success) {
|
||
alert('Ошибка при обновлении контакта');
|
||
}
|
||
})
|
||
.catch(error => {
|
||
console.error('Error:', error);
|
||
alert('Ошибка при обновлении контакта');
|
||
});
|
||
}
|
||
|
||
function sendTelegramNotification(contactId) {
|
||
fetch(`/api/admin/contacts/${contactId}/telegram`, {
|
||
method: 'POST',
|
||
headers: {
|
||
'Content-Type': 'application/json',
|
||
}
|
||
})
|
||
.then(response => response.json())
|
||
.then(data => {
|
||
if (data.success) {
|
||
alert('Уведомление отправлено в Telegram');
|
||
} else {
|
||
alert('Ошибка при отправке уведомления');
|
||
}
|
||
})
|
||
.catch(error => {
|
||
console.error('Error:', error);
|
||
alert('Ошибка при отправке уведомления');
|
||
});
|
||
}
|
||
|
||
function deleteContact(contactId) {
|
||
if (confirm('Вы уверены, что хотите удалить это сообщение?')) {
|
||
fetch(`/api/admin/contacts/${contactId}`, {
|
||
method: 'DELETE',
|
||
headers: {
|
||
'Content-Type': 'application/json',
|
||
}
|
||
})
|
||
.then(response => response.json())
|
||
.then(data => {
|
||
if (data.success) {
|
||
window.location.href = '/admin/contacts';
|
||
} else {
|
||
alert('Ошибка при удалении сообщения');
|
||
}
|
||
})
|
||
.catch(error => {
|
||
console.error('Error:', error);
|
||
alert('Ошибка при удалении сообщения');
|
||
});
|
||
}
|
||
}
|
||
</script> |