- Portfolio CRUD: добавление, редактирование, удаление, переключение публикации - Services CRUD: полное управление услугами с возможностью активации/деактивации - Banner system: новая модель Banner с CRUD операциями и аналитикой кликов - Telegram integration: расширенные настройки бота, обнаружение чатов, отправка сообщений - Media management: улучшенная загрузка файлов с оптимизацией изображений и превью - UI improvements: обновлённые админ-панели с rich-text редактором и drag&drop загрузкой - Database: добавлена таблица banners с полями для баннеров и аналитики
121 lines
6.2 KiB
Plaintext
121 lines
6.2 KiB
Plaintext
<!-- Services List -->
|
|
<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-cog mr-2"></i>
|
|
Управление услугами
|
|
</h3>
|
|
<a href="/admin/services/add" class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-md text-sm font-medium">
|
|
<i class="fas fa-plus mr-1"></i>
|
|
Добавить услугу
|
|
</a>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="bg-white shadow overflow-hidden sm:rounded-md">
|
|
<ul role="list" class="divide-y divide-gray-200">
|
|
<% if (services && services.length > 0) { %>
|
|
<% services.forEach(service => { %>
|
|
<li>
|
|
<div class="px-4 py-4 flex items-center justify-between">
|
|
<div class="flex items-center">
|
|
<div class="flex-shrink-0 h-10 w-10">
|
|
<div class="h-10 w-10 rounded-full bg-blue-100 flex items-center justify-center">
|
|
<i class="<%= service.icon || 'fas fa-cog' %> text-blue-600"></i>
|
|
</div>
|
|
</div>
|
|
<div class="ml-4">
|
|
<div class="flex items-center">
|
|
<div class="text-sm font-medium text-gray-900"><%= service.name %></div>
|
|
<% if (service.featured) { %>
|
|
<span class="ml-2 inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-yellow-100 text-yellow-800">
|
|
<i class="fas fa-star mr-1"></i>
|
|
Рекомендуемая
|
|
</span>
|
|
<% } %>
|
|
<% if (!service.isActive) { %>
|
|
<span class="ml-2 inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-gray-100 text-gray-800">
|
|
Неактивна
|
|
</span>
|
|
<% } %>
|
|
</div>
|
|
<div class="text-sm text-gray-500">
|
|
<%= service.category %> •
|
|
<% if (service.pricing && service.pricing.basePrice) { %>
|
|
от $<%= service.pricing.basePrice %>
|
|
<% } %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="flex items-center space-x-2">
|
|
<a href="/services#<%= service.id %>" target="_blank" class="text-blue-600 hover:text-blue-900">
|
|
<i class="fas fa-external-link-alt"></i>
|
|
</a>
|
|
<a href="/admin/services/edit/<%= service.id %>" class="text-indigo-600 hover:text-indigo-900">
|
|
<i class="fas fa-edit"></i>
|
|
</a>
|
|
<button onclick="deleteService('<%= service.id %>')" class="text-red-600 hover:text-red-900">
|
|
<i class="fas fa-trash"></i>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</li>
|
|
<% }) %>
|
|
<% } else { %>
|
|
<li>
|
|
<div class="px-4 py-8 text-center">
|
|
<i class="fas fa-cog text-4xl text-gray-300 mb-4"></i>
|
|
<p class="text-gray-500">Услуги не найдены</p>
|
|
<a href="/admin/services/add" class="mt-2 inline-block bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-md text-sm font-medium">
|
|
Добавить первую услугу
|
|
</a>
|
|
</div>
|
|
</li>
|
|
<% } %>
|
|
</ul>
|
|
</div>
|
|
|
|
<!-- Pagination -->
|
|
<% if (pagination && pagination.total > 1) { %>
|
|
<div class="bg-white px-4 py-3 flex items-center justify-between border-t border-gray-200 sm:px-6">
|
|
<div class="flex-1 flex justify-between sm:hidden">
|
|
<% if (pagination.hasPrev) { %>
|
|
<a href="?page=<%= pagination.current - 1 %>" class="relative inline-flex items-center px-4 py-2 border border-gray-300 text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50">
|
|
Предыдущая
|
|
</a>
|
|
<% } %>
|
|
<% if (pagination.hasNext) { %>
|
|
<a href="?page=<%= pagination.current + 1 %>" class="ml-3 relative inline-flex items-center px-4 py-2 border border-gray-300 text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50">
|
|
Следующая
|
|
</a>
|
|
<% } %>
|
|
</div>
|
|
</div>
|
|
<% } %>
|
|
</div>
|
|
|
|
<script>
|
|
function deleteService(id) {
|
|
if (confirm('Вы уверены, что хотите удалить эту услугу?')) {
|
|
fetch(`/api/admin/services/${id}`, {
|
|
method: 'DELETE',
|
|
headers: {
|
|
'Content-Type': 'application/json',
|
|
}
|
|
})
|
|
.then(response => response.json())
|
|
.then(data => {
|
|
if (data.success) {
|
|
location.reload();
|
|
} else {
|
|
alert('Ошибка при удалении услуги');
|
|
}
|
|
})
|
|
.catch(error => {
|
|
console.error('Error:', error);
|
|
alert('Ошибка при удалении услуги');
|
|
});
|
|
}
|
|
}
|
|
</script> |