From 0c52f3fc23e36ebba7fa7b34194e093fb4d63b4d Mon Sep 17 00:00:00 2001 From: rocketdebris Date: Tue, 13 Jan 2026 16:39:52 -0500 Subject: [PATCH] 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. --- custom_ui/api/db/tasks.py | 17 ++++++++ frontend/src/api.js | 7 ++++ frontend/src/components/common/DataTable.vue | 30 ++++++++++++++ frontend/src/components/pages/Tasks.vue | 41 ++++++++++++++++---- 4 files changed, 88 insertions(+), 7 deletions(-) diff --git a/custom_ui/api/db/tasks.py b/custom_ui/api/db/tasks.py index 93ce9d3..adf282c 100644 --- a/custom_ui/api/db/tasks.py +++ b/custom_ui/api/db/tasks.py @@ -13,6 +13,23 @@ def get_job_task_list(job_id=""): return build_error_response(str(e), 500) +@frappe.whitelist() +def get_task_status_options(): + print("DEBUG: Getting task status options") + try: + task_doctype = frappe.get_doc("DocType", "Task") + status_index = 0 + for i, field in enumerate(task_doctype.fields): + if field.fieldname == "status": + status_index = i + break + options = task_doctype.fields[status_index].options.split() + print("DEBUG: Task Status options retreived", options) + return build_success_response(options) + except Exception as e: + return build_error_response(str(e), 500) + + @frappe.whitelist() def get_tasks_table_data(filters={}, sortings=[], page=1, page_size=10): """Get paginated task table data with filtering and sorting support.""" diff --git a/frontend/src/api.js b/frontend/src/api.js index b110b4a..00acc3b 100644 --- a/frontend/src/api.js +++ b/frontend/src/api.js @@ -23,6 +23,7 @@ const FRAPPE_GET_INSTALL_PROJECTS_METHOD = "custom_ui.api.db.jobs.get_install_pr 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"; +const FRAPPE_GET_TASKS_STATUS_OPTIONS = "custom_ui.api.db.tasks.get_task_status_options"; // 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"; @@ -384,6 +385,12 @@ class Api { return result; } + static async getTaskStatusOptions() { + console.log("DEBUG: API - Loading Task Status options form the backend."); + const result = await this.request(FRAPPE_GET_TASKS_STATUS_OPTIONS, {}); + return result + } + // ============================================================================ // INVOICE / PAYMENT METHODS // ============================================================================ diff --git a/frontend/src/components/common/DataTable.vue b/frontend/src/components/common/DataTable.vue index 96bc7a7..a3e22f3 100644 --- a/frontend/src/components/common/DataTable.vue +++ b/frontend/src/components/common/DataTable.vue @@ -376,6 +376,18 @@ /> + +
+