attempt chart component
This commit is contained in:
parent
6025a9890a
commit
80aae6f09b
7 changed files with 1253 additions and 31 deletions
|
|
@ -25,27 +25,31 @@ def get_client_status_counts(weekly=False, week_start_date=None, week_end_date=N
|
|||
|
||||
|
||||
onsite_meeting_scheduled_status_counts = {
|
||||
"Not Started": frappe.db.count("Address", filters=get_filters("custom_onsite_meeting_scheduled_status", "Not Started")),
|
||||
"In Progress": frappe.db.count("Address", filters=get_filters("custom_onsite_meeting_scheduled_status", "In Progress")),
|
||||
"Completed": frappe.db.count("Address", filters=get_filters("custom_onsite_meeting_scheduled_status", "Completed"))
|
||||
"label": "On-Site Meeting Scheduled",
|
||||
"not_started": frappe.db.count("Address", filters=get_filters("custom_onsite_meeting_scheduled", "Not Started")),
|
||||
"in_progress": frappe.db.count("Address", filters=get_filters("custom_onsite_meeting_scheduled", "In Progress")),
|
||||
"completed": frappe.db.count("Address", filters=get_filters("custom_onsite_meeting_scheduled", "Completed"))
|
||||
}
|
||||
|
||||
estimate_sent_status_counts = {
|
||||
"Not Started": frappe.db.count("Address", filters=get_filters("custom_estimate_sent_status", "Not Started")),
|
||||
"In Progress": frappe.db.count("Address", filters=get_filters("custom_estimate_sent_status", "In Progress")),
|
||||
"Completed": frappe.db.count("Address", filters=get_filters("custom_estimate_sent_status", "Completed"))
|
||||
"label": "Estimate Sent",
|
||||
"not_started": frappe.db.count("Address", filters=get_filters("custom_estimate_sent_status", "Not Started")),
|
||||
"in_progress": frappe.db.count("Address", filters=get_filters("custom_estimate_sent_status", "In Progress")),
|
||||
"completed": frappe.db.count("Address", filters=get_filters("custom_estimate_sent_status", "Completed"))
|
||||
}
|
||||
|
||||
job_status_counts = {
|
||||
"Not Started": frappe.db.count("Address", filters=get_filters("custom_job_status", "Not Started")),
|
||||
"In Progress": frappe.db.count("Address", filters=get_filters("custom_job_status", "In Progress")),
|
||||
"Completed": frappe.db.count("Address", filters=get_filters("custom_job_status", "Completed"))
|
||||
"label": "Job Status",
|
||||
"not_started": frappe.db.count("Address", filters=get_filters("custom_job_status", "Not Started")),
|
||||
"in_progress": frappe.db.count("Address", filters=get_filters("custom_job_status", "In Progress")),
|
||||
"completed": frappe.db.count("Address", filters=get_filters("custom_job_status", "Completed"))
|
||||
}
|
||||
|
||||
payment_received_status_counts = {
|
||||
"Not Started": frappe.db.count("Address", filters=get_filters("custom_payment_received_status", "Not Started")),
|
||||
"In Progress": frappe.db.count("Address", filters=get_filters("custom_payment_received_status", "In Progress")),
|
||||
"Completed": frappe.db.count("Address", filters=get_filters("custom_payment_received_status", "Completed"))
|
||||
"label": "Payment Received",
|
||||
"not_started": frappe.db.count("Address", filters=get_filters("custom_payment_received_status", "Not Started")),
|
||||
"in_progress": frappe.db.count("Address", filters=get_filters("custom_payment_received_status", "In Progress")),
|
||||
"completed": frappe.db.count("Address", filters=get_filters("custom_payment_received_status", "Completed"))
|
||||
}
|
||||
|
||||
status_dicts = [
|
||||
|
|
@ -54,18 +58,31 @@ def get_client_status_counts(weekly=False, week_start_date=None, week_end_date=N
|
|||
job_status_counts,
|
||||
payment_received_status_counts
|
||||
]
|
||||
categories = []
|
||||
for status_dict in status_dicts:
|
||||
category = {
|
||||
"label": status_dict["label"],
|
||||
"statuses": [
|
||||
{
|
||||
"color": "red",
|
||||
"label": "Not Started",
|
||||
"count": status_dict["not_started"]
|
||||
},
|
||||
{
|
||||
"color": "yellow",
|
||||
"label": "In Progress",
|
||||
"count": status_dict["in_progress"]
|
||||
},
|
||||
{
|
||||
"color": "green",
|
||||
"label": "Completed",
|
||||
"count": status_dict["completed"]
|
||||
}
|
||||
]
|
||||
}
|
||||
categories.append(category)
|
||||
|
||||
return {
|
||||
"totals": {
|
||||
"not_started": get_status_total(status_dicts, "Not Started"),
|
||||
"in_progress": get_status_total(status_dicts, "In Progress"),
|
||||
"completed": get_status_total(status_dicts, "Completed")
|
||||
},
|
||||
"onsite_meeting_scheduled_status": onsite_meeting_scheduled_status_counts,
|
||||
"estimate_sent_status": estimate_sent_status_counts,
|
||||
"job_status": job_status_counts,
|
||||
"payment_received_status": payment_received_status_counts
|
||||
}
|
||||
return categories
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_clients(options):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue