Many fixes
This commit is contained in:
@@ -101,7 +101,86 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{# Легенда #}
|
||||
{% block stylesheets %}
|
||||
<style>
|
||||
.calendar {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.calendar .calendar-header {
|
||||
display: grid !important;
|
||||
grid-template-columns: repeat(7, 1fr) !important;
|
||||
border-bottom: 1px solid #e5e7eb;
|
||||
}
|
||||
|
||||
.calendar .calendar-header-cell {
|
||||
padding: 0.75rem 0.5rem;
|
||||
font-weight: 500;
|
||||
color: #6b7280;
|
||||
font-size: 0.875rem;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.calendar .calendar-grid {
|
||||
display: grid !important;
|
||||
grid-template-columns: repeat(7, 1fr) !important;
|
||||
}
|
||||
|
||||
.calendar .calendar-cell {
|
||||
min-height: 100px;
|
||||
padding: 0.5rem;
|
||||
border-right: 1px solid #e5e7eb;
|
||||
border-bottom: 1px solid #e5e7eb;
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
.calendar .calendar-cell:nth-child(7n) {
|
||||
border-right: none;
|
||||
}
|
||||
|
||||
.calendar .calendar-cell.bg-light {
|
||||
background-color: #f9fafb;
|
||||
}
|
||||
|
||||
.calendar .calendar-cell-today {
|
||||
background-color: #eff6ff;
|
||||
}
|
||||
|
||||
.calendar .calendar-day-number {
|
||||
font-size: 0.875rem;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.calendar .calendar-events {
|
||||
display: flex !important;
|
||||
flex-direction: column;
|
||||
gap: 0.25rem;
|
||||
}
|
||||
|
||||
.calendar .calendar-event {
|
||||
display: block !important;
|
||||
padding: 0.25rem 0.5rem;
|
||||
font-size: 0.75rem;
|
||||
background-color: #f3f4f6;
|
||||
border-left: 3px solid #6b7280;
|
||||
border-radius: 0.25rem;
|
||||
text-decoration: none;
|
||||
color: #374151;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.calendar .calendar-event:hover {
|
||||
background-color: #e5e7eb;
|
||||
}
|
||||
|
||||
.calendar .calendar-events-more {
|
||||
padding: 0.125rem 0.5rem;
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
{% if showLegend|default(true) and (legend is defined or events is defined) %}
|
||||
<div class="card shadow-sm mt-4">
|
||||
<div class="card-body">
|
||||
|
||||
@@ -131,20 +131,42 @@ function handleDrop(e) {
|
||||
|
||||
if (itemId && newColumnId) {
|
||||
if (moveUrl) {
|
||||
// AJAX перемещение
|
||||
console.log('Moving deal:', itemId, 'to stage:', newColumnId);
|
||||
|
||||
// Находим перетаскиваемую карточку
|
||||
const draggedCard = document.querySelector(`.kanban-card[data-item-id="${itemId}"]`);
|
||||
const sourceColumn = draggedCard ? draggedCard.closest('.kanban-cards-container') : null;
|
||||
|
||||
// AJAX перемещение - base.js автоматически добавит CSRF заголовок
|
||||
fetch(moveUrl, {
|
||||
method: 'POST',
|
||||
credentials: 'same-origin',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
'X-Requested-With': 'XMLHttpRequest'
|
||||
},
|
||||
body: 'item_id=' + itemId + '&column_id=' + newColumnId
|
||||
body: 'deal_id=' + itemId + '&stage_id=' + newColumnId
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
if (data.success) {
|
||||
if (onMove) {
|
||||
window[onMove](itemId, newColumnId, data);
|
||||
} else if (draggedCard && sourceColumn) {
|
||||
// Перемещаем карточку в новую колонку
|
||||
const targetContainer = this;
|
||||
targetContainer.appendChild(draggedCard);
|
||||
|
||||
// Обновляем счётчики колонок
|
||||
updateColumnCounters(sourceColumn);
|
||||
updateColumnCounters(targetContainer);
|
||||
|
||||
// Анимация успешного перемещения
|
||||
draggedCard.style.transition = 'all 0.2s ease';
|
||||
draggedCard.style.transform = 'scale(1.02)';
|
||||
setTimeout(() => {
|
||||
draggedCard.style.transform = '';
|
||||
}, 200);
|
||||
} else {
|
||||
location.reload();
|
||||
}
|
||||
@@ -162,4 +184,22 @@ function handleDrop(e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Обновление счётчиков колонки (количество карточек и сумма)
|
||||
*/
|
||||
function updateColumnCounters(container) {
|
||||
const columnId = container.dataset.columnId;
|
||||
const cards = container.querySelectorAll('.kanban-card');
|
||||
const count = cards.length;
|
||||
|
||||
// Находим badge в заголовке колонки
|
||||
const column = container.closest('.kanban-column');
|
||||
if (column) {
|
||||
const badge = column.querySelector('.badge');
|
||||
if (badge) {
|
||||
badge.textContent = count;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user