Added a Select component to the Actions section of the Datatable, and API methods to load the available status-es from the Task doctype to populate the select for the tasks list.

This commit is contained in:
rocketdebris 2026-01-13 16:39:52 -05:00
parent adb7bc5930
commit 0c52f3fc23
4 changed files with 88 additions and 7 deletions

View file

@ -36,6 +36,8 @@ const notifications = useNotificationStore();
const tableData = ref([]);
const totalRecords = ref(0);
const isLoading = ref(false);
const showCompleted = ref(false);
const statusOptions = ref([]);
// Computed property to get current filters for the chart
const currentFilters = computed(() => {
@ -63,6 +65,29 @@ const filterBy = (filter) => {
console.log("DEBUG: Tasks filterBy not implemented yet.");
};
const tableActions = [
{
label: "Show Completed",
action: () => {
showCompleted = !showCompleted
},
type: "button",
style: "info",
},
{
label: "Set Status",
action: (rowData, newValue) => {
console.log("DEBUG: Row Data:", rowData);
console.log("DEBUG: New Value:", newValue);
},
rowAction: true,
layout: {
priority: "select"
},
statusOptions: statusOptions.value
},
];
// Handle lazy loading events from DataTable
const handleLazyLoad = async (event) => {
console.log("Tasks page - handling lazy load:", event);
@ -154,13 +179,11 @@ const handlePropertyClick = (link, rowData) => {
// router.push(`/task?taskId=${rowData.name}`);
//}
watch(
() => filtersStore.getTableFilters("clients"),
async () => {
await refreshStatusCounts();
},
{ deep: true },
);
watch(showCompleted, () => {
if (showCompleted) {
// TODO: Logic for filtering on "Completed" goes here
}
});
// Load initial data
onMounted(async () => {
@ -175,6 +198,10 @@ onMounted(async () => {
const initialFilters = filtersStore.getTableFilters("tasks");
const initialSorting = filtersStore.getTableSorting("tasks");
const optionsResult = await Api.getTaskStatusOptions();
statusOptions.value = optionsResult;
console.log("DEBUG: Loaded Status options: ", statusOptions.value)
await handleLazyLoad({
page: initialPagination.page,
rows: initialPagination.rows,