Added the functional Estimates page showing the list of estimates in the system.
This commit is contained in:
parent
888b135fe0
commit
a1e9de489d
5 changed files with 252 additions and 2 deletions
|
|
@ -6,6 +6,7 @@ const ZIPPOPOTAMUS_BASE_URL = "https://api.zippopotam.us/us";
|
|||
const FRAPPE_PROXY_METHOD = "custom_ui.api.proxy.request";
|
||||
// Estimate methods
|
||||
const FRAPPE_UPSERT_ESTIMATE_METHOD = "custom_ui.api.db.estimates.upsert_estimate";
|
||||
const FRAPPE_GET_ESTIMATES_METHOD = "custom_ui.api.db.estimates.get_estimate_table_data";
|
||||
// Job methods
|
||||
const FRAPPE_GET_JOBS_METHOD = "custom_ui.api.db.get_jobs";
|
||||
const FRAPPE_UPSERT_JOB_METHOD = "custom_ui.api.db.jobs.upsert_job";
|
||||
|
|
@ -178,6 +179,31 @@ class Api {
|
|||
return result;
|
||||
}
|
||||
|
||||
static async getPaginatedEstimateDetails(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 estimate options to backend:", options);
|
||||
|
||||
const result = await this.request(FRAPPE_GET_ESTIMATES_METHOD, { options });
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get paginated job data with filtering and sorting
|
||||
* @param {Object} paginationParams - Pagination parameters from store
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue