diff --git a/frontend/src/lib/components/ui/kanban/KanbanBoard.svelte b/frontend/src/lib/components/ui/kanban/KanbanBoard.svelte index 2814b2ba..69320cc8 100644 --- a/frontend/src/lib/components/ui/kanban/KanbanBoard.svelte +++ b/frontend/src/lib/components/ui/kanban/KanbanBoard.svelte @@ -33,7 +33,7 @@ * loading?: boolean, * itemName?: string, * itemNamePlural?: string, - * onItemMove: (itemId: string, newStatus: string, columnId: string) => Promise, + * onItemMove: (itemId: string, newStatus: string, columnId: string, aboveId: string | null, belowId: string | null) => Promise, * onCardClick: (item: any) => void, * CardComponent: any, * emptyMessage?: string, @@ -139,52 +139,72 @@ /** * @param {DragEvent} e * @param {string} targetColumnId + * @param {{ aboveId: string | null, belowId: string | null }} neighbors */ - async function handleDrop(e, targetColumnId) { + async function handleDrop(e, targetColumnId, neighbors) { e.preventDefault(); dragOverColumn = null; - if (!draggedItem || dragSourceColumn === targetColumnId) { - draggedItem = null; + if (!draggedItem) { dragSourceColumn = null; return; } const item = draggedItem; const sourceColumnId = dragSourceColumn; + const { aboveId, belowId } = neighbors; draggedItem = null; dragSourceColumn = null; const sourceCol = localColumns.find((c) => c.id === sourceColumnId); const targetCol = localColumns.find((c) => c.id === targetColumnId); + if (!sourceCol || !targetCol) return; - if (sourceCol && targetCol) { - const itemIndex = sourceCol.items.findIndex((i) => i.id === item.id); - if (itemIndex !== -1) { - sourceCol.items.splice(itemIndex, 1); - sourceCol.item_count--; - } - targetCol.items.unshift({ ...item, status: targetColumnId }); - targetCol.item_count++; - localColumns = [...localColumns]; + // Snapshot for rollback + const sourceItemsBefore = [...sourceCol.items]; + const targetItemsBefore = [...targetCol.items]; + const sourceCountBefore = sourceCol.item_count; + const targetCountBefore = targetCol.item_count; + + // Detect no-op: same column AND the dropped position equals current position + if (sourceColumnId === targetColumnId) { + const currentIdx = sourceCol.items.findIndex((i) => i.id === item.id); + const currentAbove = sourceCol.items[currentIdx - 1]?.id ?? null; + const currentBelow = sourceCol.items[currentIdx + 1]?.id ?? null; + if (aboveId === currentAbove && belowId === currentBelow) return; } + // Optimistic update: remove from source, insert at resolved position in target + const srcIdx = sourceCol.items.findIndex((i) => i.id === item.id); + if (srcIdx !== -1) { + sourceCol.items.splice(srcIdx, 1); + sourceCol.item_count--; + } + let insertIdx; + if (belowId) { + insertIdx = targetCol.items.findIndex((i) => i.id === belowId); + if (insertIdx === -1) insertIdx = targetCol.items.length; + } else if (aboveId) { + const aboveIdx = targetCol.items.findIndex((i) => i.id === aboveId); + insertIdx = aboveIdx === -1 ? targetCol.items.length : aboveIdx + 1; + } else { + insertIdx = targetCol.items.length; + } + targetCol.items.splice(insertIdx, 0, { ...item, status: targetColumnId }); + targetCol.item_count++; + localColumns = [...localColumns]; + try { - await onItemMove(item.id, targetColumnId, targetColumnId); + await onItemMove(item.id, targetColumnId, targetColumnId, aboveId, belowId); } catch (error) { console.error(`Failed to move ${itemName}:`, error); toast.error(`Failed to move ${itemName}`); - if (sourceCol && targetCol) { - const itemIndex = targetCol.items.findIndex((i) => i.id === item.id); - if (itemIndex !== -1) { - targetCol.items.splice(itemIndex, 1); - targetCol.item_count--; - } - sourceCol.items.unshift(item); - sourceCol.item_count++; - localColumns = [...localColumns]; - } + sourceCol.items = sourceItemsBefore; + targetCol.items = targetItemsBefore; + sourceCol.item_count = sourceCountBefore; + targetCol.item_count = targetCountBefore; + localColumns = [...localColumns]; } } @@ -229,8 +249,12 @@
-
-
+
+
@@ -263,7 +287,9 @@ >
- + Pipeline @@ -275,7 +301,9 @@
- + Hot @@ -287,7 +315,9 @@
- + Total {itemNamePlural} @@ -305,9 +335,10 @@ {itemName} {CardComponent} isDragOver={dragOverColumn === column.id} + draggedItemId={draggedItem?.id ?? null} onDragOver={(e) => handleDragOver(e, column.id)} onDragLeave={handleDragLeave} - onDrop={(e) => handleDrop(e, column.id)} + onDrop={(e, neighbors) => handleDrop(e, column.id, neighbors)} {onCardClick} onCardDragStart={(e, item) => handleDragStart(e, item, column.id)} onCardDragEnd={handleDragEnd} diff --git a/frontend/src/lib/components/ui/kanban/KanbanColumn.svelte b/frontend/src/lib/components/ui/kanban/KanbanColumn.svelte index 8bcdd381..572c8ca4 100644 --- a/frontend/src/lib/components/ui/kanban/KanbanColumn.svelte +++ b/frontend/src/lib/components/ui/kanban/KanbanColumn.svelte @@ -18,10 +18,11 @@ * column: Column, * itemName?: string, * isDragOver: boolean, + * draggedItemId?: string | null, * CardComponent?: any, * onDragOver: (e: DragEvent) => void, * onDragLeave: () => void, - * onDrop: (e: DragEvent) => void, + * onDrop: (e: DragEvent, neighbors: { aboveId: string | null, belowId: string | null }) => void, * onCardClick: (item: any) => void, * onCardDragStart: (e: DragEvent, item: any) => void, * onCardDragEnd: () => void, @@ -32,6 +33,7 @@ column, itemName = 'item', isDragOver, + draggedItemId = null, CardComponent = null, onDragOver, onDragLeave, @@ -42,6 +44,61 @@ onAddItem } = $props(); + /** @type {HTMLDivElement | undefined} */ + let cardsEl; + // Render-index where the dragged card would insert. null = unknown / column empty. + let dropRenderIdx = $state(/** @type {number | null} */ (null)); + + /** @param {number} clientY */ + function computeDropRenderIdx(clientY) { + if (!cardsEl) return 0; + const els = /** @type {HTMLElement[]} */ ( + Array.from(cardsEl.querySelectorAll('[data-card-id]')) + ); + if (els.length === 0) return 0; + for (let i = 0; i < els.length; i++) { + const rect = els[i].getBoundingClientRect(); + const mid = rect.top + rect.height / 2; + if (clientY < mid) return i; + } + return els.length; + } + + const draggedIdxInColumn = $derived( + draggedItemId ? column.items.findIndex((it) => it.id === draggedItemId) : -1 + ); + + /** @param {number} renderIdx */ + function showIndicatorAt(renderIdx) { + if (!isDragOver || dropRenderIdx !== renderIdx) return false; + if (draggedIdxInColumn !== -1) { + // No-op slots: current position or immediately below the dragged card + if (renderIdx === draggedIdxInColumn || renderIdx === draggedIdxInColumn + 1) return false; + } + return true; + } + + /** @param {number} renderIdx */ + function resolveNeighbors(renderIdx) { + /** @type {string | null} */ + let aboveId = null; + /** @type {string | null} */ + let belowId = null; + for (let i = renderIdx - 1; i >= 0; i--) { + if (column.items[i].id !== draggedItemId) { + aboveId = column.items[i].id; + break; + } + } + for (let i = renderIdx; i < column.items.length; i++) { + if (column.items[i].id !== draggedItemId) { + belowId = column.items[i].id; + break; + } + } + return { aboveId, belowId }; + } + // WIP limit check const isAtWipLimit = $derived( column.wip_limit !== null && @@ -73,8 +130,21 @@ function handleDragOver(e) { e.preventDefault(); e.dataTransfer.dropEffect = 'move'; + dropRenderIdx = computeDropRenderIdx(e.clientY); onDragOver(e); } + + function handleColumnDragLeave() { + dropRenderIdx = null; + onDragLeave(); + } + + /** @param {DragEvent} e */ + function handleColumnDrop(e) { + const idx = computeDropRenderIdx(e.clientY); + dropRenderIdx = null; + onDrop(e, resolveNeighbors(idx)); + }
@@ -124,32 +194,40 @@
-
- {#each column.items as item (item.id)} - {#if CardComponent} - onCardClick(item)} - ondragstart={(e) => onCardDragStart(e, item)} - ondragend={onCardDragEnd} - /> - {:else} -
onCardClick(item)} - onkeydown={(e) => (e.key === 'Enter' || e.key === ' ') && onCardClick(item)} - ondragstart={(e) => onCardDragStart(e, item)} - ondragend={onCardDragEnd} - role="button" - tabindex="0" - > -
- {item.title || item.name || 'Untitled'} -
-
+
+ {#each column.items as item, i (item.id)} + {#if showIndicatorAt(i)} + {/if} +
+ {#if CardComponent} + onCardClick(item)} + ondragstart={(e) => onCardDragStart(e, item)} + ondragend={onCardDragEnd} + /> + {:else} +
onCardClick(item)} + onkeydown={(e) => (e.key === 'Enter' || e.key === ' ') && onCardClick(item)} + ondragstart={(e) => onCardDragStart(e, item)} + ondragend={onCardDragEnd} + role="button" + tabindex="0" + > +
+ {item.title || item.name || 'Untitled'} +
+
+ {/if} +
{/each} + {#if showIndicatorAt(column.items.length)} + + {/if}
@@ -180,6 +258,13 @@ box-shadow: inset 0 0 0 1px rgba(251, 113, 133, 0.4); } + .drop-indicator { + height: 3px; + border-radius: 2px; + background: rgb(34 211 238); + margin: 2px 0; + } + .kanban-cards::-webkit-scrollbar { width: 6px; } diff --git a/frontend/src/lib/components/ui/lead-kanban/LeadKanban.svelte b/frontend/src/lib/components/ui/lead-kanban/LeadKanban.svelte index 3bc71430..e974ddea 100644 --- a/frontend/src/lib/components/ui/lead-kanban/LeadKanban.svelte +++ b/frontend/src/lib/components/ui/lead-kanban/LeadKanban.svelte @@ -27,7 +27,7 @@ * @type {{ * data: KanbanData | null, * loading?: boolean, - * onStatusChange: (leadId: string, newStatus: string, columnId: string) => Promise, + * onStatusChange: (leadId: string, newStatus: string, columnId: string, aboveId: string | null, belowId: string | null) => Promise, * onCardClick: (lead: any) => void * }} */ diff --git a/frontend/src/lib/components/ui/task-kanban/TaskKanban.svelte b/frontend/src/lib/components/ui/task-kanban/TaskKanban.svelte index 3151f8f9..1fe32063 100644 --- a/frontend/src/lib/components/ui/task-kanban/TaskKanban.svelte +++ b/frontend/src/lib/components/ui/task-kanban/TaskKanban.svelte @@ -27,7 +27,7 @@ * @type {{ * data: KanbanData | null, * loading?: boolean, - * onStatusChange: (taskId: string, newStatus: string, columnId: string) => Promise, + * onStatusChange: (taskId: string, newStatus: string, columnId: string, aboveId: string | null, belowId: string | null) => Promise, * onCardClick: (task: any) => void, * onAddItem?: (columnId: string) => void * }} diff --git a/frontend/src/lib/components/ui/ticket-kanban/TicketKanban.svelte b/frontend/src/lib/components/ui/ticket-kanban/TicketKanban.svelte index ffb917f6..9a3fc5cb 100644 --- a/frontend/src/lib/components/ui/ticket-kanban/TicketKanban.svelte +++ b/frontend/src/lib/components/ui/ticket-kanban/TicketKanban.svelte @@ -27,7 +27,7 @@ * @type {{ * data: KanbanData | null, * loading?: boolean, - * onStatusChange: (ticketId: string, newStatus: string, columnId: string) => Promise, + * onStatusChange: (ticketId: string, newStatus: string, columnId: string, aboveId: string | null, belowId: string | null) => Promise, * onCardClick: (ticketItem: any) => void * }} */ diff --git a/frontend/src/routes/(app)/leads/+page.server.js b/frontend/src/routes/(app)/leads/+page.server.js index ef4c2ce7..8dcf9a7a 100644 --- a/frontend/src/routes/(app)/leads/+page.server.js +++ b/frontend/src/routes/(app)/leads/+page.server.js @@ -656,6 +656,8 @@ export const actions = { const statusRaw = form.get('status')?.toString().trim().toLowerCase().replace(/_/g, ' ') || ''; const status = validStatuses.includes(statusRaw) ? statusRaw : null; + const aboveLeadId = form.get('aboveLeadId')?.toString() || null; + const belowLeadId = form.get('belowLeadId')?.toString() || null; if (!leadId) { return fail(400, { error: 'Lead ID is required.' }); @@ -665,11 +667,16 @@ export const actions = { return fail(400, { error: 'Valid status is required.' }); } + /** @type {Record} */ + const moveData = { status }; + if (aboveLeadId) moveData.above_lead_id = aboveLeadId; + if (belowLeadId) moveData.below_lead_id = belowLeadId; + await apiRequest( `/leads/${leadId}/move/`, { method: 'PATCH', - body: { status } + body: moveData }, { cookies, org: locals.org } ); diff --git a/frontend/src/routes/(app)/leads/+page.svelte b/frontend/src/routes/(app)/leads/+page.svelte index 262424b8..0c3643a4 100644 --- a/frontend/src/routes/(app)/leads/+page.svelte +++ b/frontend/src/routes/(app)/leads/+page.svelte @@ -31,19 +31,19 @@ } from '@lucide/svelte'; import { LinkedinIcon as Linkedin } from '$lib/components/icons'; import { page } from '$app/stores'; - import { - SearchInput, - SelectFilter, - DateRangeFilter, - TagFilter - } from '$lib/components/ui/filter'; + import { SearchInput, SelectFilter, DateRangeFilter, TagFilter } from '$lib/components/ui/filter'; import { Pagination } from '$lib/components/ui/pagination'; import { Button } from '$lib/components/ui/button/index.js'; import { PageHeader, FilterStrip, ViewTabs, FilterPill } from '$lib/components/layout'; import { INDUSTRIES, COUNTRIES } from '$lib/constants/lead-choices.js'; import { CURRENCY_CODES } from '$lib/constants/filters.js'; import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js'; - import { formatRelativeDate, formatDate, getNameInitials, getInitials } from '$lib/utils/formatting.js'; + import { + formatRelativeDate, + formatDate, + getNameInitials, + getInitials + } from '$lib/utils/formatting.js'; import { leadStatusOptions, leadRatingOptions, @@ -642,10 +642,7 @@ const initialAction = initialUrlParams.get('action'); const initialLead = initialViewId ? untrack( - () => - (data.leads || []).find( - (/** @type {any} */ l) => l.id === initialViewId - ) || null + () => (data.leads || []).find((/** @type {any} */ l) => l.id === initialViewId) || null ) : null; @@ -974,8 +971,10 @@ * @param {string} leadId * @param {string} newStatus * @param {string} _columnId + * @param {string | null} aboveLeadId + * @param {string | null} belowLeadId */ - async function handleKanbanStatusChange(leadId, newStatus, _columnId) { + async function handleKanbanStatusChange(leadId, newStatus, _columnId, aboveLeadId, belowLeadId) { // Convert column ID (status) to proper format // Column IDs are: "assigned", "in process", "recycled", "closed" const status = newStatus; @@ -983,6 +982,8 @@ // Populate form and submit kanbanFormState.leadId = leadId; kanbanFormState.status = status; + kanbanFormState.aboveLeadId = aboveLeadId || ''; + kanbanFormState.belowLeadId = belowLeadId || ''; await tick(); updateStatusForm.requestSubmit(); @@ -1255,7 +1256,9 @@ // Kanban form state (for drag-drop status updates) let kanbanFormState = $state({ leadId: '', - status: '' + status: '', + aboveLeadId: '', + belowLeadId: '' }); // Form data state let formState = $state({ @@ -1496,286 +1499,282 @@ class:overflow-hidden={viewMode === 'kanban'} > - {#snippet actions()} -
- - + title="Leads" + subtitle="{viewMode === 'kanban' + ? totalLeadCount + : filteredLeads.length} of {totalLeadCount} leads" + > + {#snippet actions()} +
+ + -
+
- -
- - - -
- -
- - - {#if viewMode === 'table'} - - - {#snippet child({ props })} - - {/snippet} - - - Toggle columns - - {#each columns as column (column.key)} - toggleColumn(column.key)} - > - {column.label} - - {/each} - - - {/if} - - -
- {/snippet} - {#snippet tabs()} - - {/snippet} - - -
- - updateFilters({ ...filters, search: value })} - class="w-64" - /> - updateFilters({ ...filters, source: value })} - class="w-40" - /> - updateFilters({ ...filters, rating: value })} - class="w-32" - /> - - updateFilters({ ...filters, created_at_gte: start, created_at_lte: end })} - class="w-56" - /> - updateFilters({ ...filters, tags: ids })} - /> - {#if activeFiltersCount > 0} - - {/if} - {#snippet meta()} - {filteredLeads.length} of {pagination.total} leads - {/snippet} - - - - {#if viewMode === 'kanban'} - -
- openLead(lead, true)} - /> -
- {:else} - - {#if filteredLeads.length === 0} -
-
- -
-

No leads found

-

Create a new lead to get started

-
- {:else} - - - - -
- {#each filteredLeads as lead (lead.id)} + +
+ + +
+ +
+ + + {#if viewMode === 'table'} + + + {#snippet child({ props })} +
- + {/snippet} + + + Toggle columns + + {#each columns as column (column.key)} + toggleColumn(column.key)} > - {getOptionLabel(lead.status, leadStatusOptions)} - + {column.label} + + {/each} + + + {/if} + + +
+ {/snippet} + {#snippet tabs()} + + {/snippet} + + +
+ + updateFilters({ ...filters, search: value })} + class="w-64" + /> + updateFilters({ ...filters, source: value })} + class="w-40" + /> + updateFilters({ ...filters, rating: value })} + class="w-32" + /> + + updateFilters({ ...filters, created_at_gte: start, created_at_lte: end })} + class="w-56" + /> + updateFilters({ ...filters, tags: ids })} + /> + {#if activeFiltersCount > 0} + + {/if} + {#snippet meta()} + {filteredLeads.length} of {pagination.total} leads + {/snippet} + + + + {#if viewMode === 'kanban'} + +
+ openLead(lead, true)} + /> +
+ {:else} + + {#if filteredLeads.length === 0} +
+
+ +
+

No leads found

+

Create a new lead to get started

+
+ {:else} + + + {/if} - - -
+ + {/if} - - - - {/if} -
- +
@@ -1820,7 +1819,9 @@ {#snippet metaSection()} {#if drawerData} -
+
{#if drawerData.owner}
+ + diff --git a/frontend/src/routes/(app)/tasks/+page.svelte b/frontend/src/routes/(app)/tasks/+page.svelte index 785af28a..0939e1aa 100644 --- a/frontend/src/routes/(app)/tasks/+page.svelte +++ b/frontend/src/routes/(app)/tasks/+page.svelte @@ -2,7 +2,7 @@ import { enhance } from '$app/forms'; import { invalidateAll, goto } from '$app/navigation'; import { page } from '$app/stores'; - import { onMount, tick } from 'svelte'; + import { onMount, tick, untrack } from 'svelte'; import { toast } from 'svelte-sonner'; import { Plus, @@ -38,12 +38,7 @@ import { CommentSection } from '$lib/components/ui/comment-section'; import CustomFieldsPanel from '$lib/components/custom-fields/CustomFieldsPanel.svelte'; import { getCurrentUser } from '$lib/api.js'; - import { - SearchInput, - SelectFilter, - DateRangeFilter, - TagFilter - } from '$lib/components/ui/filter'; + import { SearchInput, SelectFilter, DateRangeFilter, TagFilter } from '$lib/components/ui/filter'; import { Pagination } from '$lib/components/ui/pagination'; import { cn } from '$lib/utils.js'; import { TASK_STATUSES as statuses, PRIORITIES as priorities } from '$lib/constants/filters.js'; @@ -441,8 +436,11 @@ return filtered; }); - // Local data for optimistic updates - let localTasks = $state(/** @type {any[]} */ ([])); + // Local data for optimistic updates. Initialize synchronously from props so SSR + // renders the actual rows instead of flashing "No tasks" until $effect runs on hydration. + let localTasks = $state( + /** @type {any[]} */ (untrack(() => (data.tasks ? [...data.tasks] : []))) + ); $effect(() => { localTasks = [...filteredTasks]; @@ -1026,13 +1024,15 @@ * @param {string} taskId * @param {string} newStatus * @param {string} _columnId + * @param {string | null} aboveTaskId + * @param {string | null} belowTaskId */ - async function handleKanbanStatusChange(taskId, newStatus, _columnId) { + async function handleKanbanStatusChange(taskId, newStatus, _columnId, aboveTaskId, belowTaskId) { kanbanFormState.taskId = taskId; kanbanFormState.status = newStatus; kanbanFormState.stageId = ''; - kanbanFormState.aboveTaskId = ''; - kanbanFormState.belowTaskId = ''; + kanbanFormState.aboveTaskId = aboveTaskId || ''; + kanbanFormState.belowTaskId = belowTaskId || ''; await tick(); moveTaskForm.requestSubmit(); } @@ -1110,246 +1110,244 @@
- - {#snippet actions()} -
- -
- - + - + -
- -
- - -
- - - -
- - {#if viewMode === 'list'} - - - {#snippet child({ props })} - - {/snippet} - - - Toggle columns - - {#each taskColumns as column (column.key)} - toggleColumn(column.key)} - disabled={column.canHide === false} - > - {column.label} - - {/each} - - - {/if} - - -
- {/snippet} - {#snippet tabs()} - - {/snippet} -
- -
- - updateFilters({ ...filters, search: value })} - placeholder="Search tasks..." - /> - updateFilters({ ...filters, priority: value })} - /> - - updateFilters({ ...filters, due_date_gte: start, due_date_lte: end })} - /> - updateFilters({ ...filters, tags: ids })} - /> - {#if activeFiltersCount > 0} - - {/if} - {#snippet meta()} - {filteredTasks.length} of {pagination.total} tasks - {/snippet} - - {#if viewMode === 'list'} - - {#snippet emptyState()} -
-
- -
-

No tasks found

-

- Try adjusting your filters or create a new task -

+ Completed + + {completedCount} + +
- {/snippet} -
- {:else if viewMode === 'kanban'} - - {:else} - -
- -
- - -
+ + +
+ + + +
+ + {#if viewMode === 'list'} + + + {#snippet child({ props })} + + {/snippet} + + + Toggle columns + + {#each taskColumns as column (column.key)} + toggleColumn(column.key)} + disabled={column.canHide === false} + > + {column.label} + + {/each} + + + {/if} + + +
+ {/snippet} + {#snippet tabs()} + + {/snippet} + + +
+ + updateFilters({ ...filters, search: value })} + placeholder="Search tasks..." + /> + updateFilters({ ...filters, priority: value })} + /> + + updateFilters({ ...filters, due_date_gte: start, due_date_lte: end })} + /> + updateFilters({ ...filters, tags: ids })} + /> + {#if activeFiltersCount > 0} + + {/if} + {#snippet meta()} + {filteredTasks.length} of {pagination.total} tasks + {/snippet} + + {#if viewMode === 'list'} + + {#snippet emptyState()} +
+
+ +
+

No tasks found

+

+ Try adjusting your filters or create a new task +

+
+ {/snippet} +
+ {:else if viewMode === 'kanban'} + + {:else} + +
+ +
+ + +
+
+ +

+ {monthNames[calendarMonth]} + {calendarYear} +

+ +
-

- {monthNames[calendarMonth]} - {calendarYear} -

-
- -
{#each ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'] as day} @@ -1408,26 +1406,28 @@ {/if} {/each}
- -
+ +
- -
- - {#snippet title()} -
-

- Tasks for {new Date(selectedDate + 'T00:00:00').toLocaleDateString('en-US', { - weekday: 'long', - month: 'long', - day: 'numeric' - })} -

-

- {selectedTasks.length} task{selectedTasks.length !== 1 ? 's' : ''} -

-
- {/snippet} + +
+ + {#snippet title()} +
+

+ Tasks for {new Date(selectedDate + 'T00:00:00').toLocaleDateString('en-US', { + weekday: 'long', + month: 'long', + day: 'numeric' + })} +

+

+ {selectedTasks.length} task{selectedTasks.length !== 1 ? 's' : ''} +

+
+ {/snippet} {#if selectedTasks.length > 0}
{#each selectedTasks as task} @@ -1487,34 +1487,34 @@
{/if} -
+ - - -
-
- Total Tasks - {totalMonthlyTasks} + + +
+
+ Total Tasks + {totalMonthlyTasks} +
+
+ Days with Tasks + {monthlyTaskDates.length} +
-
- Days with Tasks - {monthlyTaskDates.length} -
-
- + +
-
- {/if} + {/if} - - -
+ + +
diff --git a/frontend/src/routes/(app)/tickets/+page.svelte b/frontend/src/routes/(app)/tickets/+page.svelte index e6a26cb5..ae565c54 100644 --- a/frontend/src/routes/(app)/tickets/+page.svelte +++ b/frontend/src/routes/(app)/tickets/+page.svelte @@ -28,13 +28,12 @@ import { CrmTable } from '$lib/components/ui/crm-table'; import { CrmDrawer } from '$lib/components/ui/crm-drawer'; import { BulkActionBar } from '$lib/components/ui/bulk-action-bar'; - import { TicketStatusChips, TicketListActions, TicketImportDrawer } from '$lib/components/tickets'; import { - SearchInput, - SelectFilter, - DateRangeFilter, - TagFilter - } from '$lib/components/ui/filter'; + TicketStatusChips, + TicketListActions, + TicketImportDrawer + } from '$lib/components/tickets'; + import { SearchInput, SelectFilter, DateRangeFilter, TagFilter } from '$lib/components/ui/filter'; import { Pagination } from '$lib/components/ui/pagination'; import { ticketStatusOptions, @@ -685,11 +684,19 @@ * @param {string} ticketId * @param {string} targetColumnId * @param {string} _columnId + * @param {string | null} aboveTicketId + * @param {string | null} belowTicketId */ - async function handleKanbanStatusChange(ticketId, targetColumnId, _columnId) { + async function handleKanbanStatusChange( + ticketId, + targetColumnId, + _columnId, + aboveTicketId, + belowTicketId + ) { kanbanFormState.ticketId = ticketId; - kanbanFormState.aboveTicketId = ''; - kanbanFormState.belowTicketId = ''; + kanbanFormState.aboveTicketId = aboveTicketId || ''; + kanbanFormState.belowTicketId = belowTicketId || ''; // Determine mode from kanban data // In status-based mode, column.id is a status value (e.g., "New", "Assigned") @@ -720,173 +727,170 @@
- - {#snippet actions()} -
- (statusChipFilter = v)} - /> - - -
- {}} - onToggleColumn={toggleColumn} - onCreate={drawer.openCreate} - onImport={() => (importOpen = true)} - /> -
- {/snippet} - {#snippet tabs()} - - {/snippet} -
- -
- - updateFilters({ ...filters, search: value })} - placeholder="Search tickets..." - /> - updateFilters({ ...filters, priority: value })} - /> - updateFilters({ ...filters, case_type: value })} - /> - - updateFilters({ ...filters, created_at_gte: start, created_at_lte: end })} - /> - updateFilters({ ...filters, tags: ids })} - /> - {#if activeFiltersCount > 0} - - {/if} - {#snippet meta()} - {filteredTickets.length} of {pagination.total} tickets + + {#snippet actions()} +
+ (statusChipFilter = v)} + /> + + +
+ {}} + onToggleColumn={toggleColumn} + onCreate={drawer.openCreate} + onImport={() => (importOpen = true)} + /> +
{/snippet} -
+ {#snippet tabs()} + + {/snippet} + - {#if viewMode === 'list'} - goto(`/tickets/${row.id}`)} - > - {#snippet cellSuffix(row, column)} - {#if column.key === 'subject' && row.escalationCount > 0} - - - Escalated - - {/if} - {#if column.key === 'subject' && (row.isProblem || row.childCount > 0)} - - - {row.isProblem ? 'Problem' : 'Tree'} - - {/if} +
+ + updateFilters({ ...filters, search: value })} + placeholder="Search tickets..." + /> + updateFilters({ ...filters, priority: value })} + /> + updateFilters({ ...filters, case_type: value })} + /> + + updateFilters({ ...filters, created_at_gte: start, created_at_lte: end })} + /> + updateFilters({ ...filters, tags: ids })} + /> + {#if activeFiltersCount > 0} + + {/if} + {#snippet meta()} + {filteredTickets.length} of {pagination.total} tickets {/snippet} - {#snippet emptyState()} -
-
- + + + {#if viewMode === 'list'} + goto(`/tickets/${row.id}`)} + > + {#snippet cellSuffix(row, column)} + {#if column.key === 'subject' && row.escalationCount > 0} + + + Escalated + + {/if} + {#if column.key === 'subject' && (row.isProblem || row.childCount > 0)} + + + {row.isProblem ? 'Problem' : 'Tree'} + + {/if} + {/snippet} + {#snippet emptyState()} +
+
+ +
+

No tickets found

+

+ Try adjusting your filters or create a new ticket +

-

No tickets found

-

- Try adjusting your filters or create a new ticket -

-
- {/snippet} - - - - - {:else} - - {/if} -
+ {/snippet} + + + + {:else} + + {/if} +