2026-04-18 11:55:01 +00:00
|
|
|
import { ViewController } from "../viewController";
|
|
|
|
|
import { TaskViewModelToEntry } from "../Components/taskEntry";
|
2024-07-25 18:42:06 +02:00
|
|
|
import {
|
2026-04-01 08:29:39 +00:00
|
|
|
PropertyValueList,
|
|
|
|
|
createPropertyValueIndexState,
|
2024-07-25 18:42:06 +02:00
|
|
|
} from "../Components/propertyValueList";
|
2024-07-25 02:49:23 +02:00
|
|
|
import { FilteredList } from "../Components/filteredList";
|
2026-09-23 00:09:09 +02:00
|
|
|
import * as React from "../../react";
|
2024-07-25 15:31:27 +02:00
|
|
|
import { TaskCategoryBulkChangeViewModel } from "../../ViewModel/Utility/taskPropertyBulkChangeViewModel";
|
2024-07-25 01:42:41 +02:00
|
|
|
import TaskViewModel from "../../ViewModel/Pages/taskViewModel";
|
2026-04-18 11:55:01 +00:00
|
|
|
import BoardViewModel from "../../ViewModel/Pages/boardViewModel";
|
2026-04-09 16:48:22 +00:00
|
|
|
import CoreViewModel from "../../ViewModel/Global/coreViewModel";
|
2024-07-25 01:38:11 +02:00
|
|
|
|
2026-04-09 16:48:22 +00:00
|
|
|
export function BoardKanbanPage(
|
|
|
|
|
coreViewModel: CoreViewModel,
|
|
|
|
|
boardViewModel: BoardViewModel,
|
|
|
|
|
) {
|
2026-08-30 22:24:55 +02:00
|
|
|
return PropertyValueList(
|
2026-04-01 08:29:39 +00:00
|
|
|
"category",
|
|
|
|
|
(taskViewModel: TaskViewModel) => taskViewModel.task,
|
2026-04-01 09:42:51 +00:00
|
|
|
boardViewModel.filteredTaskViewModels,
|
2026-04-01 08:29:39 +00:00
|
|
|
(
|
|
|
|
|
categories: React.ListState<string>,
|
|
|
|
|
sortedCategories: React.State<string[]>,
|
|
|
|
|
) => {
|
|
|
|
|
const categoryNameConverter: React.StateItemConverter<string> = (
|
|
|
|
|
categoryName: string,
|
|
|
|
|
) => {
|
|
|
|
|
const index: React.State<number> =
|
|
|
|
|
createPropertyValueIndexState(
|
|
|
|
|
sortedCategories,
|
|
|
|
|
categoryName,
|
|
|
|
|
);
|
2026-04-09 16:48:22 +00:00
|
|
|
return Column(
|
|
|
|
|
coreViewModel,
|
|
|
|
|
categoryName,
|
|
|
|
|
index,
|
|
|
|
|
boardViewModel,
|
|
|
|
|
);
|
2026-04-01 08:29:39 +00:00
|
|
|
};
|
2024-07-25 18:25:05 +02:00
|
|
|
|
2026-04-01 08:29:39 +00:00
|
|
|
return (
|
|
|
|
|
<div
|
2026-09-24 23:45:38 +02:00
|
|
|
class="kanban-board-wrapper zoom allow-drag-move"
|
2026-04-01 08:29:39 +00:00
|
|
|
children:append={[categories, categoryNameConverter]}
|
|
|
|
|
></div>
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
);
|
2024-07-25 02:49:23 +02:00
|
|
|
}
|
|
|
|
|
|
2026-04-01 09:42:51 +00:00
|
|
|
function Column(
|
2026-04-09 16:48:22 +00:00
|
|
|
coreViewModel: CoreViewModel,
|
2026-04-01 08:29:39 +00:00
|
|
|
categoryName: string,
|
|
|
|
|
index: React.State<number>,
|
|
|
|
|
boardViewModel: BoardViewModel,
|
2024-07-25 18:25:05 +02:00
|
|
|
) {
|
2026-04-01 08:29:39 +00:00
|
|
|
return FilteredList(
|
|
|
|
|
{ category: categoryName },
|
|
|
|
|
(taskViewModel: TaskViewModel) => taskViewModel.task,
|
|
|
|
|
boardViewModel.filteredTaskViewModels,
|
|
|
|
|
(taskViewModels: React.ListState<TaskViewModel>) => {
|
|
|
|
|
const viewModel: TaskCategoryBulkChangeViewModel =
|
|
|
|
|
new TaskCategoryBulkChangeViewModel(
|
|
|
|
|
taskViewModels,
|
|
|
|
|
categoryName,
|
|
|
|
|
);
|
2024-07-25 02:49:23 +02:00
|
|
|
|
2026-04-01 08:29:39 +00:00
|
|
|
function drop() {
|
|
|
|
|
boardViewModel.handleDropWithinBoard(categoryName);
|
|
|
|
|
}
|
2024-07-25 16:20:43 +02:00
|
|
|
|
2026-04-01 08:29:39 +00:00
|
|
|
const view = (
|
|
|
|
|
<div
|
|
|
|
|
class="flex-column flex-no"
|
2026-04-15 12:47:10 +00:00
|
|
|
on:dragover={ViewController.allowDrop}
|
2026-04-01 08:29:39 +00:00
|
|
|
on:drop={drop}
|
|
|
|
|
>
|
|
|
|
|
<div class="flex-row width-input">
|
|
|
|
|
<input
|
|
|
|
|
placeholder={
|
2026-04-09 16:48:22 +00:00
|
|
|
coreViewModel.translations.chatPage.task
|
2026-04-01 08:29:39 +00:00
|
|
|
.renameCategoryInputPlaceholder
|
|
|
|
|
}
|
|
|
|
|
bind:value={viewModel.inputValue}
|
|
|
|
|
on:enter={viewModel.set}
|
|
|
|
|
></input>
|
|
|
|
|
<button
|
|
|
|
|
class="primary"
|
|
|
|
|
on:click={viewModel.set}
|
|
|
|
|
toggle:disabled={viewModel.cannotSet}
|
|
|
|
|
>
|
|
|
|
|
<span class="icon">check</span>
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
2024-07-25 02:49:23 +02:00
|
|
|
|
2026-04-01 08:29:39 +00:00
|
|
|
<hr></hr>
|
2024-07-25 02:49:23 +02:00
|
|
|
|
2026-04-01 08:29:39 +00:00
|
|
|
<div
|
|
|
|
|
class="kanban-column"
|
|
|
|
|
children:append={[taskViewModels, TaskViewModelToEntry]}
|
|
|
|
|
></div>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
2024-07-25 18:25:05 +02:00
|
|
|
|
2026-04-01 08:29:39 +00:00
|
|
|
index.subscribe((newIndex) => {
|
|
|
|
|
view.style.order = newIndex;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return view;
|
|
|
|
|
},
|
|
|
|
|
);
|
2024-07-25 01:38:11 +02:00
|
|
|
}
|