mirror of
				https://github.com/itsdave-de/msp.git
				synced 2025-10-30 08:57:09 -03:00 
			
		
		
		
	merge
This commit is contained in:
		
						commit
						f88d9bc7d4
					
				
							
								
								
									
										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 | ||||||
|  | } | ||||||
| @ -18,11 +18,11 @@ app_license = "GPLv3" | |||||||
| # app_include_css = "/assets/msp/css/msp.css" | # app_include_css = "/assets/msp/css/msp.css" | ||||||
| app_include_js = "/assets/msp/js/customer_quick_entry.js" | app_include_js = "/assets/msp/js/customer_quick_entry.js" | ||||||
| 
 | 
 | ||||||
| jenv = { | jinja = { | ||||||
| 	"methods": [ | 	"methods": [ | ||||||
| 		"jinja_get_item_price:msp.things.get_item_price_for_label", | 		"msp.things.get_item_price_for_label", | ||||||
| 		"jinja_get_epc_code:msp.things.get_epc_inline", | 		"msp.things.get_epc_inline", | ||||||
| 		"jinja_get_qr_code:msp.things.get_qr_code_inline" | 		"msp.things.get_qr_code_inline" | ||||||
| 	] | 	] | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -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 | ||||||
| @ -9,34 +9,48 @@ | |||||||
|   "from_date", |   "from_date", | ||||||
|   "to_date", |   "to_date", | ||||||
|   "employee", |   "employee", | ||||||
|  |   "employee_name", | ||||||
|   "daily_hours" |   "daily_hours" | ||||||
|  ], |  ], | ||||||
|  "fields": [ |  "fields": [ | ||||||
|   { |   { | ||||||
|    "fieldname": "from_date", |    "fieldname": "from_date", | ||||||
|    "fieldtype": "Date", |    "fieldtype": "Date", | ||||||
|  |    "in_list_view": 1, | ||||||
|    "label": "From date" |    "label": "From date" | ||||||
|   }, |   }, | ||||||
|   { |   { | ||||||
|    "fieldname": "to_date", |    "fieldname": "to_date", | ||||||
|    "fieldtype": "Date", |    "fieldtype": "Date", | ||||||
|  |    "in_list_view": 1, | ||||||
|    "label": "To date" |    "label": "To date" | ||||||
|   }, |   }, | ||||||
|   { |   { | ||||||
|    "fieldname": "employee", |    "fieldname": "employee", | ||||||
|    "fieldtype": "Link", |    "fieldtype": "Link", | ||||||
|  |    "in_list_view": 1, | ||||||
|  |    "in_standard_filter": 1, | ||||||
|    "label": "Employee", |    "label": "Employee", | ||||||
|    "options": "Employee" |    "options": "Employee" | ||||||
|   }, |   }, | ||||||
|   { |   { | ||||||
|    "fieldname": "daily_hours", |    "fieldname": "daily_hours", | ||||||
|    "fieldtype": "Float", |    "fieldtype": "Float", | ||||||
|  |    "in_list_view": 1, | ||||||
|    "label": "Daily hours" |    "label": "Daily hours" | ||||||
|  |   }, | ||||||
|  |   { | ||||||
|  |    "fetch_from": "employee.employee_name", | ||||||
|  |    "fieldname": "employee_name", | ||||||
|  |    "fieldtype": "Data", | ||||||
|  |    "in_standard_filter": 1, | ||||||
|  |    "label": "Employee Name", | ||||||
|  |    "read_only": 1 | ||||||
|   } |   } | ||||||
|  ], |  ], | ||||||
|  "index_web_pages_for_search": 1, |  "index_web_pages_for_search": 1, | ||||||
|  "links": [], |  "links": [], | ||||||
|  "modified": "2023-12-07 10:42:48.367768", |  "modified": "2024-07-30 07:02:38.063949", | ||||||
|  "modified_by": "Administrator", |  "modified_by": "Administrator", | ||||||
|  "module": "MSP", |  "module": "MSP", | ||||||
|  "name": "Employee Target Agreement", |  "name": "Employee Target Agreement", | ||||||
| @ -56,5 +70,6 @@ | |||||||
|   } |   } | ||||||
|  ], |  ], | ||||||
|  "sort_field": "modified", |  "sort_field": "modified", | ||||||
|  "sort_order": "DESC" |  "sort_order": "DESC", | ||||||
|  |  "states": [] | ||||||
| } | } | ||||||
| @ -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" | ||||||
|  | } | ||||||
| @ -197,7 +197,7 @@ def get_holidays_list(from_date, to_date): | |||||||
|         holidays_li = [h.holiday_date for h in hol_doc.holidays] |         holidays_li = [h.holiday_date for h in hol_doc.holidays] | ||||||
|         holidays_list.extend(holidays_li) |         holidays_list.extend(holidays_li) | ||||||
|      |      | ||||||
|     print(holidays_list) |     #print(holidays_list) | ||||||
|      |      | ||||||
|     return holidays_list |     return holidays_list | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user