added pricing, orgs
tests / ci (push) Canceled after 0s

This commit is contained in:
2026-10-04 20:34:19 -07:00
parent 999d5ad28d
commit 2ca3860557
52 changed files with 3467 additions and 47 deletions
+35 -18
View File
@@ -266,10 +266,10 @@ new #[Title('Dashboard')] class extends Component
{
$this->todoForUser($todoId);
$ids = $this->filteredTodoQuery()->priority()->pluck('id')->all();
$ids = $this->orderedTodoIds;
$currentIndex = array_search($todoId, $ids, true);
if ($currentIndex === false || $ids === []) {
if ($currentIndex === false) {
return;
}
@@ -279,40 +279,57 @@ new #[Title('Dashboard')] class extends Component
return;
}
$this->reorderTodo($todoId, $ids, $target);
$this->reorderTodo($todoId, $target);
}
public function handleSort(int $todoId, int $position): void
{
$this->todoForUser($todoId);
$ids = $this->filteredTodoQuery()->priority()->pluck('id')->all();
$currentIndex = array_search($todoId, $ids, true);
if ($currentIndex === false || $ids === []) {
return;
}
$offset = ($this->todos->currentPage() - 1) * self::PER_PAGE;
$this->reorderTodo($todoId, $ids, $offset + $position);
$this->reorderTodo($todoId, $offset + $position);
}
/**
* @param array<int, int> $ids
* Move a todo to the given index of the currently visible order. The
* reordered todos are written back into the slots they already occupy in
* the user's full priority order, so reordering under an active filter
* permutes the visible todos without renumbering them from zero and
* colliding with the todos the filter hides.
*/
private function reorderTodo(int $todoId, array $ids, int $newIndex): void
private function reorderTodo(int $todoId, int $newIndex): void
{
unset($ids[array_search($todoId, $ids, true)]);
$ids = array_values($ids);
$visibleIds = $this->orderedTodoIds;
$currentIndex = array_search($todoId, $visibleIds, true);
$newIndex = max(0, min($newIndex, count($ids)));
if ($currentIndex === false) {
return;
}
array_splice($ids, $newIndex, 0, $todoId);
$newIndex = max(0, min($newIndex, count($visibleIds) - 1));
if ($newIndex === $currentIndex) {
return;
}
$visibleOrder = $visibleIds;
unset($visibleOrder[$currentIndex]);
array_splice($visibleOrder, $newIndex, 0, $todoId);
$ids = Todo::query()->forUser(auth()->id())->priority()->pluck('id')->all();
$slots = array_keys(array_intersect($ids, $visibleIds));
foreach ($slots as $visibleSlot => $slot) {
$ids[$slot] = $visibleOrder[$visibleSlot];
}
foreach ($ids as $position => $id) {
Todo::query()->forUser(auth()->id())->whereKey($id)->update(['position' => $position]);
}
unset($this->todos, $this->orderedTodoIds);
}
/**
@@ -493,7 +510,7 @@ new #[Title('Dashboard')] class extends Component
@forelse ($this->todos as $todo)
<flux:table.row :key="$todo->id" wire:sort:item="{{ $todo->id }}" data-test="todo-row">
<flux:table.cell class="py-0 text-zinc-300 dark:text-zinc-600">
<div wire:sort:handle class="inline-flex cursor-grab" :title="__('Reorder')">
<div wire:sort:handle class="inline-flex cursor-grab" title="{{ __('Reorder') }}">
<flux:icon.chevrons-up-down variant="micro" />
</div>
</flux:table.cell>