mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-29 18:04:46 +00:00
added support analytics and some other minor updates
This commit is contained in:
@@ -1,4 +1,8 @@
|
|||||||
erpnext.updates = [
|
erpnext.updates = [
|
||||||
|
["4th January 2013", [
|
||||||
|
"Support Analytics: Simple Tool to Plot Number Tickets and time to Closing",
|
||||||
|
"Workflow: Added Workflow Help",
|
||||||
|
]],
|
||||||
["2nd January 2013", [
|
["2nd January 2013", [
|
||||||
"Permission Manager: New Design with better help and better advanced permission selection.",
|
"Permission Manager: New Design with better help and better advanced permission selection.",
|
||||||
"User Properties: Better way to set User Properties (defaults).",
|
"User Properties: Better way to set User Properties (defaults).",
|
||||||
|
|||||||
@@ -215,6 +215,13 @@ data_map = {
|
|||||||
"parent": ["Purchase Invoice", "name"],
|
"parent": ["Purchase Invoice", "name"],
|
||||||
"item_code": ["Item", "name"]
|
"item_code": ["Item", "name"]
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
# Support
|
||||||
|
"Support Ticket": {
|
||||||
|
"columns": ["name","status","creation","modified"],
|
||||||
|
"conditions": ["docstatus < 2"],
|
||||||
|
"order_by": "creation"
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
0
support/page/support_analytics/__init__.py
Normal file
0
support/page/support_analytics/__init__.py
Normal file
91
support/page/support_analytics/support_analytics.js
Normal file
91
support/page/support_analytics/support_analytics.js
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
wn.pages['support-analytics'].onload = function(wrapper) {
|
||||||
|
wn.ui.make_app_page({
|
||||||
|
parent: wrapper,
|
||||||
|
title: 'Support Analytics',
|
||||||
|
single_column: true
|
||||||
|
});
|
||||||
|
|
||||||
|
new erpnext.SupportAnalytics(wrapper);
|
||||||
|
|
||||||
|
wrapper.appframe.add_home_breadcrumb()
|
||||||
|
wrapper.appframe.add_module_breadcrumb("Support")
|
||||||
|
wrapper.appframe.add_breadcrumb("icon-bar-chart")
|
||||||
|
}
|
||||||
|
|
||||||
|
erpnext.SupportAnalytics = wn.views.GridReportWithPlot.extend({
|
||||||
|
init: function(wrapper) {
|
||||||
|
this._super({
|
||||||
|
title: "Support Analtyics",
|
||||||
|
page: wrapper,
|
||||||
|
parent: $(wrapper).find('.layout-main'),
|
||||||
|
appframe: wrapper.appframe,
|
||||||
|
doctypes: ["Support Ticket", "Fiscal Year"],
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
filters: [
|
||||||
|
{fieldtype:"Select", label: "Fiscal Year", link:"Fiscal Year",
|
||||||
|
default_value: "Select Fiscal Year..."},
|
||||||
|
{fieldtype:"Date", label: "From Date"},
|
||||||
|
{fieldtype:"Label", label: "To"},
|
||||||
|
{fieldtype:"Date", label: "To Date"},
|
||||||
|
{fieldtype:"Select", label: "Range",
|
||||||
|
options:["Daily", "Weekly", "Monthly", "Quarterly", "Yearly"]},
|
||||||
|
{fieldtype:"Button", label: "Refresh", icon:"icon-refresh icon-white", cssClass:"btn-info"},
|
||||||
|
{fieldtype:"Button", label: "Reset Filters"}
|
||||||
|
],
|
||||||
|
|
||||||
|
setup_columns: function() {
|
||||||
|
var std_columns = [
|
||||||
|
{id: "check", name: "Plot", field: "check", width: 30,
|
||||||
|
formatter: this.check_formatter},
|
||||||
|
{id: "status", name: "Status", field: "status", width: 100},
|
||||||
|
];
|
||||||
|
this.make_date_range_columns();
|
||||||
|
this.columns = std_columns.concat(this.columns);
|
||||||
|
},
|
||||||
|
|
||||||
|
prepare_data: function() {
|
||||||
|
// add Opening, Closing, Totals rows
|
||||||
|
// if filtered by account and / or voucher
|
||||||
|
var me = this;
|
||||||
|
var total_tickets = {status:"All Tickets", "id": "all-tickets",
|
||||||
|
checked:true};
|
||||||
|
var days_to_close = {status:"Days to Close", "id":"days-to-close",
|
||||||
|
checked:false};
|
||||||
|
var hours_to_close = {status:"Hours to Close", "id":"hours-to-close",
|
||||||
|
checked:false};
|
||||||
|
|
||||||
|
|
||||||
|
$.each(wn.report_dump.data["Support Ticket"], function(i, d) {
|
||||||
|
var dateobj = dateutil.str_to_obj(d.creation);
|
||||||
|
var date = d.creation.split(" ")[0];
|
||||||
|
var col = me.column_map[date];
|
||||||
|
if(col) {
|
||||||
|
// just count
|
||||||
|
var day_diff = dateutil.get_diff(d.modified, d.creation);
|
||||||
|
var hour_diff = dateutil.get_hour_diff(d.modified, d.creation);
|
||||||
|
|
||||||
|
total_tickets[col.field] = flt(total_tickets[col.field]) + 1;
|
||||||
|
days_to_close[col.field] = flt(days_to_close[col.field]) + day_diff;
|
||||||
|
hours_to_close[col.field] = flt(hours_to_close[col.field]) + hour_diff;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// make averages
|
||||||
|
$.each(this.columns, function(i, col) {
|
||||||
|
if(col.formatter==me.currency_formatter && total_tickets[col.field]) {
|
||||||
|
days_to_close[col.field] = flt(days_to_close[col.field]) / flt(total_tickets[col.field]);
|
||||||
|
hours_to_close[col.field] = flt(hours_to_close[col.field]) / flt(total_tickets[col.field]);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
this.data = [total_tickets, days_to_close, hours_to_close];
|
||||||
|
},
|
||||||
|
|
||||||
|
get_plot_points: function(item, col, idx) {
|
||||||
|
return [[dateutil.str_to_obj(col.id).getTime(), item[col.field]],
|
||||||
|
[dateutil.user_to_obj(col.name).getTime(), item[col.field]]];
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
32
support/page/support_analytics/support_analytics.txt
Normal file
32
support/page/support_analytics/support_analytics.txt
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"owner": "Administrator",
|
||||||
|
"docstatus": 0,
|
||||||
|
"creation": "2013-01-04 15:31:45",
|
||||||
|
"modified_by": "Administrator",
|
||||||
|
"modified": "2013-01-04 15:38:44"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "__common__",
|
||||||
|
"title": "Support Analytics",
|
||||||
|
"doctype": "Page",
|
||||||
|
"module": "Support",
|
||||||
|
"standard": "Yes",
|
||||||
|
"page_name": "support-analytics"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "__common__",
|
||||||
|
"parent": "support-analytics",
|
||||||
|
"doctype": "Page Role",
|
||||||
|
"parenttype": "Page",
|
||||||
|
"role": "Support Team",
|
||||||
|
"parentfield": "roles"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "support-analytics",
|
||||||
|
"doctype": "Page"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"doctype": "Page Role"
|
||||||
|
}
|
||||||
|
]
|
||||||
@@ -27,6 +27,17 @@
|
|||||||
<div style="clear: both"></div>
|
<div style="clear: both"></div>
|
||||||
<hr>
|
<hr>
|
||||||
<h4>Reports</h4>
|
<h4>Reports</h4>
|
||||||
|
<div style="width: 48%; float: left;">
|
||||||
|
<h5><a href="#support-analytics" data-role="Analytics, Support Manager">
|
||||||
|
Support Analytics</a>
|
||||||
|
</h5>
|
||||||
|
<p class="help">Support Ticket trends and response.</p>
|
||||||
|
</div>
|
||||||
|
<div style="width: 48%; float: right;">
|
||||||
|
</div>
|
||||||
|
<div style="clear: both;"></div>
|
||||||
|
<hr>
|
||||||
|
<h4>Reports</h4>
|
||||||
<div class="reports-list"></div>
|
<div class="reports-list"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="layout-side-section">
|
<div class="layout-side-section">
|
||||||
|
|||||||
Reference in New Issue
Block a user