Fixed pagination errors on the Task page, updated to the correct API calls to get that data.

This commit is contained in:
rocketdebris 2026-01-13 11:54:13 -05:00
parent 59e21a51f2
commit 84c7eb0580
3 changed files with 59 additions and 81 deletions

View file

@ -22,7 +22,7 @@ const FRAPPE_GET_JOB_TASK_LIST_METHOD = "custom_ui.api.db.jobs.get_job_task_tabl
const FRAPPE_GET_INSTALL_PROJECTS_METHOD = "custom_ui.api.db.jobs.get_install_projects";
const FRAPPE_GET_JOB_TEMPLATES_METHOD = "custom_ui.api.db.jobs.get_job_templates";
// Task methods
const FRAPPE_GET_TASKS_METHOD = "custom_ui.api.db.tasks.get_job_task_table_data";
const FRAPPE_GET_TASKS_METHOD = "custom_ui.api.db.tasks.get_tasks_table_data";
// Invoice methods
const FRAPPE_GET_INVOICES_METHOD = "custom_ui.api.db.invoices.get_invoice_table_data";
const FRAPPE_UPSERT_INVOICE_METHOD = "custom_ui.api.db.invoices.upsert_invoice";
@ -359,20 +359,28 @@ class Api {
const actualSortField = sorting?.field || sortField;
const actualSortOrder = sorting?.order || sortOrder;
const options = {
page: page + 1, // Backend expects 1-based pages
page_size: pageSize,
filters,
sorting:
actualSortField && actualSortOrder
//const options = {
// page: page + 1, // Backend expects 1-based pages
// page_size: pageSize,
// filters,
// sorting:
// actualSortField && actualSortOrder
// ? `${actualSortField} ${actualSortOrder === -1 ? "desc" : "asc"}`
// : null,
// for_table: true,
//};
const sortings = actualSortField && actualSortOrder
? `${actualSortField} ${actualSortOrder === -1 ? "desc" : "asc"}`
: null,
for_table: true,
};
: null;
console.log("DEBUG: API - Sending task options to backend:", page, pageSize, filters, sortings);
console.log("DEBUG: API - Sending task options to backend:", options);
const result = await this.request(FRAPPE_GET_TASKS_METHOD, { options });
const result = await this.request(FRAPPE_GET_TASKS_METHOD, {
filters,
sorting,
page: page + 1,
pageSize,
});
return result;
}

View file

@ -44,7 +44,7 @@ const currentFilters = computed(() => {
const columns = [
{ label: "Task", fieldName: "subject", type: "text", sortable: true, filterable: true },
{ label: "Project", fieldName: "project", type: "link", sortable: true,
{ label: "Job", fieldName: "project", type: "link", sortable: true,
onLinkClick: (link, rowData) => handleProjectClick(link, rowData)
},
{ label: "Address", fieldName: "address", type: "link", sortable: true,
@ -154,6 +154,14 @@ const handlePropertyClick = (link, rowData) => {
// router.push(`/task?taskId=${rowData.name}`);
//}
watch(
() => filtersStore.getTableFilters("clients"),
async () => {
await refreshStatusCounts();
},
{ deep: true },
);
// Load initial data
onMounted(async () => {
notifications.addWarning("Tasks page coming soon");
@ -173,6 +181,7 @@ onMounted(async () => {
first: initialPagination.first,
sortField: initialSorting.field || initialPagination.sortField,
sortOrder: initialSorting.order || initialPagination.sortOrder,
filters: initialFilters,
});
});
</script>