mirror of
https://github.com/itsdave-de/msp.git
synced 2025-05-06 15:35:12 +02:00
Dashboard Technik with Perfomance Chart
This commit is contained in:
parent
6660093ccb
commit
70f8dc9a84
34
msp/dashboard_chart-1/compare_hours_chart.json
Normal file
34
msp/dashboard_chart-1/compare_hours_chart.json
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
|
||||||
|
{
|
||||||
|
"based_on": "",
|
||||||
|
"chart_name": "Compare Hours",
|
||||||
|
"chart_type": "Custom",
|
||||||
|
"creation": "2024-07-29 19:07:51.906347",
|
||||||
|
"custom_options": "{\n\t\"colors\": [\"#7cd6fd\", \"#743ee2\"],\n\t\"barOptions\": {\"spaceRatio\": 0.5}\n}",
|
||||||
|
"docstatus": 0,
|
||||||
|
"doctype": "Dashboard Chart",
|
||||||
|
"document_type": "",
|
||||||
|
"dynamic_filters_json": "{}",
|
||||||
|
"filters_json": "{}",
|
||||||
|
"group_by_type": "",
|
||||||
|
"idx": 0,
|
||||||
|
"is_public": 1,
|
||||||
|
"is_standard": 1,
|
||||||
|
"last_synced_on": "2024-07-29 19:00:02.464180",
|
||||||
|
"modified": "2024-07-29 19:11:20.076166",
|
||||||
|
"modified_by": "Administrator",
|
||||||
|
"module": "My Custom App",
|
||||||
|
"name": "Compare Hours",
|
||||||
|
"number_of_groups": 0,
|
||||||
|
"owner": "Administrator",
|
||||||
|
"parent_document_type": "",
|
||||||
|
"roles": [],
|
||||||
|
"source": "Compare Hours",
|
||||||
|
"time_interval": "",
|
||||||
|
"timeseries": 0,
|
||||||
|
"timespan": "",
|
||||||
|
"type": "Bar",
|
||||||
|
"use_report_chart": 0,
|
||||||
|
"value_based_on": "",
|
||||||
|
"y_axis": []
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"creation": "2024-07-29 12:00:00.000000",
|
||||||
|
"docstatus": 0,
|
||||||
|
"doctype": "Dashboard Chart Source",
|
||||||
|
"idx": 0,
|
||||||
|
"modified": "2024-07-29 12:00:00.000000",
|
||||||
|
"modified_by": "Administrator",
|
||||||
|
"module": "MSP",
|
||||||
|
"name": "Compare Hours",
|
||||||
|
"owner": "Administrator",
|
||||||
|
"source_name": "Compare Hours",
|
||||||
|
"timeseries": 0
|
||||||
|
}
|
@ -0,0 +1,31 @@
|
|||||||
|
{
|
||||||
|
"based_on": "",
|
||||||
|
"chart_name": "Employee Hours Performance",
|
||||||
|
"chart_type": "Custom",
|
||||||
|
"creation": "2024-07-29 23:02:07.381655",
|
||||||
|
"docstatus": 0,
|
||||||
|
"doctype": "Dashboard Chart",
|
||||||
|
"document_type": "",
|
||||||
|
"dynamic_filters_json": "[]",
|
||||||
|
"filters_json": "{}",
|
||||||
|
"group_by_type": "Count",
|
||||||
|
"idx": 0,
|
||||||
|
"is_public": 1,
|
||||||
|
"is_standard": 1,
|
||||||
|
"modified": "2024-07-29 23:40:42.844289",
|
||||||
|
"modified_by": "D.Malinowski@itsdave.de",
|
||||||
|
"module": "MSP",
|
||||||
|
"name": "Employee Hours Performance",
|
||||||
|
"number_of_groups": 0,
|
||||||
|
"owner": "D.Malinowski@itsdave.de",
|
||||||
|
"parent_document_type": "",
|
||||||
|
"roles": [],
|
||||||
|
"source": "Employee Hours Performance",
|
||||||
|
"time_interval": "Yearly",
|
||||||
|
"timeseries": 1,
|
||||||
|
"timespan": "Last Month",
|
||||||
|
"type": "Line",
|
||||||
|
"use_report_chart": 0,
|
||||||
|
"value_based_on": "",
|
||||||
|
"y_axis": []
|
||||||
|
}
|
44
msp/msp/dashboard_chart/my_performance/my_performance.json
Normal file
44
msp/msp/dashboard_chart/my_performance/my_performance.json
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
{
|
||||||
|
"based_on": "",
|
||||||
|
"chart_name": "My Performance",
|
||||||
|
"chart_type": "Custom",
|
||||||
|
"creation": "2024-07-29 23:47:15.150259",
|
||||||
|
"docstatus": 0,
|
||||||
|
"doctype": "Dashboard Chart",
|
||||||
|
"document_type": "",
|
||||||
|
"dynamic_filters_json": "{\"from_date\":\"frappe.datetime.add_days(frappe.datetime.now_date(), -14)\",\"to_date\":\"frappe.datetime.now_date()\"}",
|
||||||
|
"filters_json": "{}",
|
||||||
|
"group_by_type": "Count",
|
||||||
|
"idx": 0,
|
||||||
|
"is_public": 1,
|
||||||
|
"is_standard": 1,
|
||||||
|
"modified": "2024-07-30 07:25:59.956576",
|
||||||
|
"modified_by": "Administrator",
|
||||||
|
"module": "MSP",
|
||||||
|
"name": "My Performance",
|
||||||
|
"number_of_groups": 0,
|
||||||
|
"owner": "D.Malinowski@itsdave.de",
|
||||||
|
"parent_document_type": "",
|
||||||
|
"roles": [
|
||||||
|
{
|
||||||
|
"role": "ITSDoc Techniker"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "Tech Support"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "System Manager"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "HR Manager"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": "Employee Hours Performance",
|
||||||
|
"time_interval": "Yearly",
|
||||||
|
"timeseries": 0,
|
||||||
|
"timespan": "Last Year",
|
||||||
|
"type": "Bar",
|
||||||
|
"use_report_chart": 0,
|
||||||
|
"value_based_on": "",
|
||||||
|
"y_axis": []
|
||||||
|
}
|
0
msp/msp/dashboard_chart_source/__init__.py
Normal file
0
msp/msp/dashboard_chart_source/__init__.py
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
|
||||||
|
|
||||||
|
frappe.dashboards.chart_sources["Employee Hours Performance"] = {
|
||||||
|
method: "msp.msp.dashboard_chart_source.employee_hours_performance.employee_hours_performance.get_data",
|
||||||
|
filters: [
|
||||||
|
{
|
||||||
|
fieldname: "employee",
|
||||||
|
label: __("Employee"),
|
||||||
|
fieldtype: "Link",
|
||||||
|
options: "Employee",
|
||||||
|
default: "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fieldname: "from_date",
|
||||||
|
label: __("From Date"),
|
||||||
|
fieldtype: "Date",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
fieldname: "to_date",
|
||||||
|
label: __("To Date"),
|
||||||
|
fieldtype: "Date",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"creation": "2024-07-29 22:56:38.521578",
|
||||||
|
"docstatus": 0,
|
||||||
|
"doctype": "Dashboard Chart Source",
|
||||||
|
"idx": 0,
|
||||||
|
"modified": "2024-07-29 22:56:38.521578",
|
||||||
|
"modified_by": "Administrator",
|
||||||
|
"module": "MSP",
|
||||||
|
"name": "Employee Hours Performance",
|
||||||
|
"owner": "Administrator",
|
||||||
|
"source_name": "Employee Hours Performance",
|
||||||
|
"timeseries": 0
|
||||||
|
}
|
@ -0,0 +1,52 @@
|
|||||||
|
# compare_hours_chart_source.py
|
||||||
|
|
||||||
|
import frappe
|
||||||
|
from frappe import _
|
||||||
|
from msp.tools import compare_hours
|
||||||
|
|
||||||
|
@frappe.whitelist()
|
||||||
|
def get_employee_for_current_user():
|
||||||
|
user = frappe.session.user
|
||||||
|
employee = frappe.get_value("Employee", {"user_id": user}, "name")
|
||||||
|
return employee
|
||||||
|
|
||||||
|
@frappe.whitelist()
|
||||||
|
def get_data(chart_name=None, chart=None, no_cache=None, filters=None, from_date=None, to_date=None, timespan=None, time_interval=None, heatmap_year=None):
|
||||||
|
if filters:
|
||||||
|
filters = frappe.parse_json(filters)
|
||||||
|
|
||||||
|
employee = filters.get("employee")
|
||||||
|
from_date = filters.get("from_date")
|
||||||
|
to_date = filters.get("to_date")
|
||||||
|
|
||||||
|
if not employee:
|
||||||
|
employee = get_employee_for_current_user()
|
||||||
|
|
||||||
|
if not (employee and from_date and to_date):
|
||||||
|
return {}
|
||||||
|
|
||||||
|
# Get data from compare_hours function
|
||||||
|
|
||||||
|
o = compare_hours(employee, from_date, to_date)
|
||||||
|
|
||||||
|
# Extract data for the chart
|
||||||
|
labels = [str(date) for date in o['daily_dict'].keys()]
|
||||||
|
service_hours = [o['daily_dict'][date]['service_hours'] for date in o['daily_dict']]
|
||||||
|
target_hours = [o['daily_dict'][date]['target_hours'] for date in o['daily_dict']]
|
||||||
|
|
||||||
|
# Prepare data for Frappe chart
|
||||||
|
data = {
|
||||||
|
'labels': labels,
|
||||||
|
'datasets': [
|
||||||
|
{
|
||||||
|
'name': 'Service Hours',
|
||||||
|
'values': service_hours
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': 'Target Hours',
|
||||||
|
'values': target_hours
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
return data
|
@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"cards": [],
|
||||||
|
"charts": [
|
||||||
|
{
|
||||||
|
"chart": "My Performance",
|
||||||
|
"width": "Full"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"creation": "2024-07-29 23:16:38.781648",
|
||||||
|
"dashboard_name": "Performance Technik",
|
||||||
|
"docstatus": 0,
|
||||||
|
"doctype": "Dashboard",
|
||||||
|
"idx": 0,
|
||||||
|
"is_default": 0,
|
||||||
|
"is_standard": 1,
|
||||||
|
"modified": "2024-07-30 00:11:48.277123",
|
||||||
|
"modified_by": "D.Malinowski@itsdave.de",
|
||||||
|
"module": "MSP",
|
||||||
|
"name": "Performance Technik",
|
||||||
|
"owner": "D.Malinowski@itsdave.de"
|
||||||
|
}
|
93
msp/msp/workspace/technik/technik.json
Normal file
93
msp/msp/workspace/technik/technik.json
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
{
|
||||||
|
"charts": [
|
||||||
|
{
|
||||||
|
"chart_name": "My Performance",
|
||||||
|
"label": "Meine Performance"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"content": "[{\"id\":\"HEmp649Etq\",\"type\":\"header\",\"data\":{\"text\":\"<span class=\\\"h4\\\">Technik</span>\",\"col\":12}},{\"id\":\"AW8p3HUvHt\",\"type\":\"chart\",\"data\":{\"chart_name\":\"Meine Performance\",\"col\":12}},{\"id\":\"vBNumIecsh\",\"type\":\"spacer\",\"data\":{\"col\":12}},{\"id\":\"zJ7GHiOCcI\",\"type\":\"card\",\"data\":{\"card_name\":\"MSP\",\"col\":5}},{\"id\":\"XNPhytxMcq\",\"type\":\"card\",\"data\":{\"card_name\":\"Service Reports\",\"col\":5}},{\"id\":\"ylnuD9q8fE\",\"type\":\"spacer\",\"data\":{\"col\":12}}]",
|
||||||
|
"creation": "2024-06-25 14:11:39.269749",
|
||||||
|
"custom_blocks": [],
|
||||||
|
"docstatus": 0,
|
||||||
|
"doctype": "Workspace",
|
||||||
|
"for_user": "",
|
||||||
|
"hide_custom": 1,
|
||||||
|
"icon": "tool",
|
||||||
|
"idx": 0,
|
||||||
|
"indicator_color": "green",
|
||||||
|
"is_hidden": 0,
|
||||||
|
"label": "Technik",
|
||||||
|
"links": [
|
||||||
|
{
|
||||||
|
"hidden": 0,
|
||||||
|
"is_query_report": 0,
|
||||||
|
"label": "Service Reports",
|
||||||
|
"link_count": 1,
|
||||||
|
"link_type": "DocType",
|
||||||
|
"onboard": 0,
|
||||||
|
"type": "Card Break"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"hidden": 0,
|
||||||
|
"is_query_report": 0,
|
||||||
|
"label": "Service Report",
|
||||||
|
"link_count": 0,
|
||||||
|
"link_to": "Service Report",
|
||||||
|
"link_type": "DocType",
|
||||||
|
"onboard": 0,
|
||||||
|
"type": "Link"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"hidden": 0,
|
||||||
|
"is_query_report": 0,
|
||||||
|
"label": "MSP",
|
||||||
|
"link_count": 3,
|
||||||
|
"link_type": "DocType",
|
||||||
|
"onboard": 0,
|
||||||
|
"type": "Card Break"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"hidden": 0,
|
||||||
|
"is_query_report": 0,
|
||||||
|
"label": "IT Objects",
|
||||||
|
"link_count": 0,
|
||||||
|
"link_to": "IT Object",
|
||||||
|
"link_type": "DocType",
|
||||||
|
"onboard": 0,
|
||||||
|
"type": "Link"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"hidden": 0,
|
||||||
|
"is_query_report": 0,
|
||||||
|
"label": "IT Landscapes",
|
||||||
|
"link_count": 0,
|
||||||
|
"link_to": "IT Landscape",
|
||||||
|
"link_type": "DocType",
|
||||||
|
"onboard": 0,
|
||||||
|
"type": "Link"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"hidden": 0,
|
||||||
|
"is_query_report": 0,
|
||||||
|
"label": "MSP Documentation",
|
||||||
|
"link_count": 0,
|
||||||
|
"link_to": "MSP Documentation",
|
||||||
|
"link_type": "DocType",
|
||||||
|
"onboard": 0,
|
||||||
|
"type": "Link"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"modified": "2024-07-30 07:36:09.918509",
|
||||||
|
"modified_by": "D.Malinowski@itsdave.de",
|
||||||
|
"module": "MSP",
|
||||||
|
"name": "Technik",
|
||||||
|
"number_cards": [],
|
||||||
|
"owner": "D.Malinowski@itsdave.de",
|
||||||
|
"parent_page": "",
|
||||||
|
"public": 1,
|
||||||
|
"quick_lists": [],
|
||||||
|
"roles": [],
|
||||||
|
"sequence_id": 2.0,
|
||||||
|
"shortcuts": [],
|
||||||
|
"title": "Technik"
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user