Added Tasks Page, Routing, SideBar entry, and API methods.
This commit is contained in:
parent
909dab62b5
commit
94e1c4dfed
5 changed files with 359 additions and 1 deletions
|
|
@ -21,6 +21,8 @@ const FRAPPE_UPSERT_JOB_METHOD = "custom_ui.api.db.jobs.upsert_job";
|
|||
const FRAPPE_GET_JOB_TASK_LIST_METHOD = "custom_ui.api.db.jobs.get_job_task_table_data";
|
||||
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_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";
|
||||
|
|
@ -240,7 +242,7 @@ class Api {
|
|||
static async getJobTemplates(company) {
|
||||
return await this.request(FRAPPE_GET_JOB_TEMPLATES_METHOD, { company });
|
||||
}
|
||||
|
||||
|
||||
static async getJobDetails() {
|
||||
const projects = await this.getDocsList("Project");
|
||||
const data = [];
|
||||
|
|
@ -339,7 +341,40 @@ class Api {
|
|||
return result;
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// TASK METHODS
|
||||
// ============================================================================
|
||||
|
||||
/**
|
||||
* Get paginated job data with filtering and sorting
|
||||
* @param {Object} paginationParams - Pagination parameters from store
|
||||
* @param {Object} filters - Filter parameters from store
|
||||
* @param {Object} sorting - Sorting parameters from store (optional)
|
||||
* @returns {Promise<{data: Array, pagination: Object}>}
|
||||
*/
|
||||
static async getPaginatedTaskDetails(paginationParams = {}, filters = {}, sorting = null) {
|
||||
const { page = 0, pageSize = 10, sortField = null, sortOrder = null } = paginationParams;
|
||||
|
||||
// Use sorting from the dedicated sorting parameter first, then fall back to pagination params
|
||||
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
|
||||
? `${actualSortField} ${actualSortOrder === -1 ? "desc" : "asc"}`
|
||||
: null,
|
||||
for_table: true,
|
||||
};
|
||||
|
||||
console.log("DEBUG: API - Sending task options to backend:", options);
|
||||
|
||||
const result = await this.request(FRAPPE_GET_TASKS_METHOD, { options });
|
||||
return result;
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// INVOICE / PAYMENT METHODS
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue