Connected data for Projects/Jobs.
This commit is contained in:
parent
b6d6a8b788
commit
ac3c05cb78
@ -194,10 +194,23 @@ class Api {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static async getJobDetails() {
|
static async getJobDetails() {
|
||||||
const data = DataUtils.dummyJobData.map((job) => ({
|
//const data = DataUtils.dummyJobData.map((job) => ({
|
||||||
...job,
|
// ...job,
|
||||||
stepProgress: DataUtils.calculateStepProgress(job.steps),
|
// stepProgress: DataUtils.calculateStepProgress(job.steps),
|
||||||
}));
|
//}));
|
||||||
|
const projects = await this.getDocsList("Project")
|
||||||
|
const data = [];
|
||||||
|
for (let prj of projects) {
|
||||||
|
let project = await this.getDetailedDoc("Project", prj.name);
|
||||||
|
const tableRow = {
|
||||||
|
name: project.name,
|
||||||
|
customInstallationAddress: project.custom_installation_address,
|
||||||
|
customer: project.customer,
|
||||||
|
status: project.status,
|
||||||
|
percentComplete: project.percent_complete
|
||||||
|
};
|
||||||
|
data.push(tableRow);
|
||||||
|
}
|
||||||
console.log("DEBUG: API - getJobDetails result: ", data);
|
console.log("DEBUG: API - getJobDetails result: ", data);
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
@ -260,7 +273,7 @@ class Api {
|
|||||||
* @param {Object} filters
|
* @param {Object} filters
|
||||||
* @returns {Promise<Object[]>}
|
* @returns {Promise<Object[]>}
|
||||||
*/
|
*/
|
||||||
static async getDocsList(doctype, fields = [], filters = {}, page = 0, pageLength = 600) {
|
static async getDocsList(doctype, fields = [], filters = {}, page = 0, pageLength = 0) {
|
||||||
const docs = await frappe.db.get_list(doctype, {
|
const docs = await frappe.db.get_list(doctype, {
|
||||||
fields,
|
fields,
|
||||||
filters,
|
filters,
|
||||||
|
|||||||
@ -30,11 +30,11 @@ const totalRecords = ref(0);
|
|||||||
const isLoading = ref(false);
|
const isLoading = ref(false);
|
||||||
|
|
||||||
const columns = [
|
const columns = [
|
||||||
{ label: "Job ID", fieldName: "jobId", type: "text", sortable: true, filterable: true },
|
{ label: "Job ID", fieldName: "name", type: "text", sortable: true, filterable: true },
|
||||||
{ label: "Address", fieldName: "address", type: "text", sortable: true },
|
{ label: "Address", fieldName: "customInstallationAddress", type: "text", sortable: true },
|
||||||
{ label: "Customer", fieldName: "customer", type: "text", sortable: true, filterable: true },
|
{ label: "Customer", fieldName: "customer", type: "text", sortable: true, filterable: true },
|
||||||
{ label: "Overall Status", fieldName: "overAllStatus", type: "status", sortable: true },
|
{ label: "Overall Status", fieldName: "status", type: "status", sortable: true },
|
||||||
{ label: "Progress", fieldName: "stepProgress", type: "text", sortable: true },
|
{ label: "Progress", fieldName: "percentComplete", type: "text", sortable: true },
|
||||||
];
|
];
|
||||||
|
|
||||||
// Handle lazy loading events from DataTable
|
// Handle lazy loading events from DataTable
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user