fixed errors
[xtuple] / enyo-client / extensions / source / crm / client / widgets / chart.js
1 /*jshint bitwise:true, indent:2, curly:true, eqeqeq:true, immed:true,
2 latedef:true, newcap:true, noarg:true, regexp:true, undef:true,
3 trailing:true, white:true*/
4 /*global XT:true, XM:true, XV:true, _:true, window: true, enyo:true, nv:true, d3:true, console:true */
5
6 (function () {
7
8   XT.extensions.crm.initCharts = function () {
9
10     enyo.kind({
11       name: "XV.AssignedIncidentBarChart",
12       kind: "XV.DrilldownBarChart",
13       collection: "XM.IncidentListItemCollection",
14       chartTitle: "_assignedIncidents".loc(),
15       filterOptions: [
16         { name: "all", parameters: [] },
17         { name: "highPriority", parameters: [
18           { attribute: "priorityOrder", operator: "<", value: 2 } // XXX magical 2
19         ]}
20       ],
21       groupByOptions: [
22         { name: "assignedTo" },
23         { name: "category" },
24         { name: "priority" },
25         { name: "project" }
26       ],
27       // assigned incidents only
28       query: {
29         parameters: [{
30           attribute: "status",
31           operator: "=",
32           value: "A"
33         }],
34       }
35     });
36
37     enyo.kind({
38       name: "XV.OpportunityBarChart",
39       kind: "XV.DrilldownBarChart",
40       collection: "XM.OpportunityListItemCollection",
41       chartTitle: "_opportunitiesNext30Days".loc(),
42       groupByOptions: [
43         { name: "opportunityStage", content: "_stage".loc() },
44         { name: "opportunitySource", content: "_source".loc() },
45         { name: "opportunityType", content: "_type".loc() },
46         { name: "owner" },
47         { name: "assignedTo" },
48         { name: "priority" }
49       ],
50       query: {
51         parameters: [{
52           attribute: "targetClose",
53           operator: ">=",
54           value: XT.date.applyTimezoneOffset(XV.DateWidget.prototype.textToDate("0"), true)
55         }, {
56           attribute: "targetClose",
57           operator: "<=",
58           value: XT.date.applyTimezoneOffset(XV.DateWidget.prototype.textToDate("+30"), true)
59         }]
60       },
61       totalField: "amount"
62     });
63
64   };
65
66 }());