Merge pull request #1609 from xtuple/4_5_x
[xtuple] / enyo-client / application / source / widgets / parameter.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, strict:false*/
4 /*global XT:true, XM:true, _:true, enyo:true, Globalize:true*/
5
6 (function () {
7
8   // ..........................................................
9   // ACCOUNT
10   //
11
12   enyo.kind({
13     name: "XV.AccountListParameters",
14     kind: "XV.ParameterWidget",
15     characteristicsRole: "isAccounts",
16     components: [
17       {kind: "onyx.GroupboxHeader", content: "_account".loc()},
18       {name: "isActive", attr: "isActive", label: "_showInactive".loc(), defaultKind: "XV.CheckboxWidget",
19         getParameter: function () {
20           var param;
21           if (!this.getValue()) {
22             param = {
23               attribute: this.getAttr(),
24               operator: "=",
25               value: true
26             };
27           }
28           return param;
29         }
30       },
31       {name: "number", label: "_number".loc(), attr: "number"},
32       {name: "name", label: "_name".loc(), attr: "name"},
33       {kind: "onyx.GroupboxHeader", content: "_contact".loc()},
34       {name: "primaryContact", label: "_primaryContact".loc(), attr: "primaryContact.name"},
35       {name: "primaryEmail", label: "_primaryEmail".loc(), attr: "primaryContact.primaryEmail"},
36       {kind: "onyx.GroupboxHeader", content: "_address".loc()},
37       {name: "phone", label: "_phone".loc(), attr: ["primaryContact.phone", "primaryContact.alternate", "primaryContact.fax"]},
38       {name: "street", label: "_street".loc(), attr: ["primaryContact.address.line1", "primaryContact.address.line2", "primaryContact.address.line3"]},
39       {name: "city", label: "_city".loc(), attr: "primaryContact.address.city"},
40       {name: "postalCode", label: "_postalCode".loc(), attr: "primaryContact.address.postalCode"},
41       {name: "state", label: "_state".loc(), attr: "primaryContact.address.state"},
42       {name: "country", label: "_country".loc(), attr: "primaryContact.address.country"},
43       {kind: "onyx.GroupboxHeader", content: "_userAccount".loc()},
44       {name: "owner", label: "_owner".loc(), attr: "owner", defaultKind: "XV.UserAccountWidget"}
45     ]
46   });
47
48   enyo.kind({
49     name: "XV.UserAccountListParameters",
50     kind: "XV.ParameterWidget",
51     components: [
52       {kind: "onyx.GroupboxHeader", content: "_userAccount".loc()},
53       {name: "isActive", attr: "isActive", label: "_showInactive".loc(), defaultKind: "XV.CheckboxWidget",
54         getParameter: function () {
55           var param;
56           if (!this.getValue()) {
57             param = {
58               attribute: this.getAttr(),
59               operator: "=",
60               value: true
61             };
62           }
63           return param;
64         }
65       },
66       {name: "username", label: "_username".loc(), attr: "username"},
67       {name: "propername", label: "_propername".loc(), attr: "propername"},
68       {name: "email", label: "_email".loc(), attr: "email"}
69     ]
70   });
71
72   // ..........................................................
73   // ACTIVITY
74   //
75
76   /* @private */
77   var _namify = function (obj) {
78     return "show" + obj.type.pluralize();
79   };
80
81   enyo.kind({
82     name: "XV.ActivityListParameters",
83     kind: "XV.ParameterWidget",
84     published: {
85       activityTypes: {}
86     },
87     defaultParameters: function () {
88       var actTypes = this.getActivityTypes(),
89         keys = _.keys(actTypes),
90         params = {user: XM.currentUser};
91
92       _.each(keys, function (key) {
93         _.each(actTypes[key], function (obj) {
94           params[_namify(obj)] = true;
95         });
96       });
97
98       return params;
99     },
100     components: [
101       {kind: "onyx.GroupboxHeader", content: "_activities".loc()},
102       {name: "showInactive", label: "_showInactive".loc(), attr: "isActive", defaultKind: "XV.CheckboxWidget",
103         getParameter: function () {
104           var param;
105           if (!this.getValue()) {
106             param = {
107               attribute: this.getAttr(),
108               operator: "=",
109               value: true
110             };
111           }
112           return param;
113         }
114       },
115       {name: "name", label: "_name".loc(), attr: "name"},
116       {name: "description", label: "_description".loc(), attr: "description"},
117       {kind: "onyx.GroupboxHeader", content: "_userAccounts".loc(), name: "userHeader"},
118       {name: "owner", label: "_owner".loc(), attr: "owner", defaultKind: "XV.UserAccountWidget"},
119       {name: "assignedTo", label: "_assignedTo".loc(), attr: "assignedTo", defaultKind: "XV.UserAccountWidget"},
120       {name: "user", label: "_user".loc(), attr: ["owner.username", "assignedTo.username"], defaultKind: "XV.UserAccountWidget"},
121       {kind: "onyx.GroupboxHeader", content: "_dueDate".loc()},
122       {name: "fromDate", label: "_fromDate".loc(), attr: "dueDate", operator: ">=",
123         filterLabel: "_from".loc() + " " + "_dueDate".loc() + " " + "_date".loc(),
124         defaultKind: "XV.DateWidget"},
125       {name: "toDate", label: "_toDate".loc(), attr: "dueDate", operator: "<=",
126         filterLabel: "_to".loc() + " " + "_dueDate".loc() + " " + "_date".loc(),
127         defaultKind: "XV.DateWidget"}
128     ],
129     create: function () {
130       var fn1 = this.defaultFilterChanged, // Cache to intercept
131         fn2 = this.populateFromUserPref,
132         actTypes = this.getActivityTypes(),
133         keys = _.keys(actTypes),
134         that = this;
135
136       // Temporary stomp
137       this.defaultFilterChanged = function () {};
138       this.populateFromUserPref = function () {};
139
140       this.inherited(arguments);
141
142       // Build up toggle check boxes for activity types
143       _.each(keys, function (key) {
144         // Create header
145         that.createComponent({
146           kind: "onyx.GroupboxHeader",
147           content: ("_" + key).loc()
148         });
149
150         _.each(actTypes[key], function (obj) {
151           // Create filter Widget
152           that.createComponent({
153             name: _namify(obj),
154             label: obj.label ? obj.label : ("_" + obj.type.pluralize().camelize()).loc(),
155             defaultKind: "XV.ToggleButtonWidget"
156           });
157         });
158       });
159
160       // Unstomp
161       this.defaultFilterChanged = fn1;
162       this.defaultFilterChanged();
163       this.populateFromUserPref = fn2;
164       this.populateFromUserPref();
165     },
166     getParameters: function () {
167       var params = this.inherited(arguments),
168         actTypes = this.getActivityTypes(),
169         keys = _.keys(actTypes),
170         param = {},
171         value = [],
172         that = this;
173
174       // For each dynamically added object type
175       // see if toggle is on and update params
176       _.each(keys, function (key) {
177         _.each(actTypes[key], function (obj) {
178           if (that.$[_namify(obj)].getValue()) {
179             value.push(obj.type);
180           }
181         });
182       });
183
184       if (value.length) {
185         param.attribute = "activityType";
186         param.operator = "ANY";
187         param.value = value;
188         params.push(param);
189       }
190
191       return params;
192     }
193   });
194
195   // ..........................................................
196   // ADDRESS
197   //
198
199   enyo.kind({
200     name: "XV.AddressListParameters",
201     kind: "XV.ParameterWidget",
202     components: [
203       {kind: "onyx.GroupboxHeader", content: "_address".loc()},
204       {name: "isActive", attr: "isActive", label: "_showInactive".loc(), defaultKind: "XV.CheckboxWidget",
205         getParameter: function () {
206           var param;
207           if (!this.getValue()) {
208             param = {
209               attribute: this.getAttr(),
210               operator: "=",
211               value: true
212             };
213           }
214           return param;
215         }
216       },
217       {name: "street", label: "_street".loc(), attr: ["line1", "line2", "line3"]},
218       {name: "city", label: "_city".loc(), attr: "city"},
219       {name: "postalCode", label: "_postalCode".loc(), attr: "postalCode"},
220       {name: "state", label: "_state".loc(), attr: "state"},
221       {name: "country", label: "_country".loc(), attr: "country"},
222       {name: "account", label: "_account".loc(), attr: "account", defaultKind: "XV.AccountWidget"}
223     ]
224   });
225
226   // ..........................................................
227   // CONTACT
228   //
229
230   enyo.kind({
231     name: "XV.ContactListParameters",
232     kind: "XV.ParameterWidget",
233     characteristicsRole: "isContacts",
234     components: [
235       {kind: "onyx.GroupboxHeader", content: "_contact".loc()},
236       {name: "isActive", attr: "isActive", label: "_showInactive".loc(), defaultKind: "XV.CheckboxWidget",
237         getParameter: function () {
238           var param;
239           if (!this.getValue()) {
240             param = {
241               attribute: this.getAttr(),
242               operator: "=",
243               value: true
244             };
245           }
246           return param;
247         }
248       },
249       {name: "name", label: "_name".loc(), attr: "name"},
250       {name: "primaryEmail", label: "_primaryEmail".loc(), attr: "primaryEmail"},
251       {name: "phone", label: "_phone".loc(), attr: ["phone", "alternate", "fax"]},
252       {kind: "onyx.GroupboxHeader", content: "_address".loc()},
253       {name: "street", label: "_street".loc(), attr: ["address.line1", "address.line2", "address.line3"]},
254       {name: "city", label: "_city".loc(), attr: "address.city"},
255       {name: "state", label: "_state".loc(), attr: "address.state"},
256       {name: "postalCode", label: "_postalCode".loc(), attr: "address.postalCode"},
257       {name: "country", label: "_country".loc(), attr: "address.country"},
258       {kind: "onyx.GroupboxHeader", content: "_relationships".loc()},
259       {name: "account", label: "_account".loc(), attr: ["account.number", "accountParent"], defaultKind: "XV.AccountWidget"},
260       {kind: "onyx.GroupboxHeader", content: "_userAccount".loc()},
261       {name: "owner", label: "_owner".loc(), attr: "owner", defaultKind: "XV.UserAccountWidget"}
262     ]
263   });
264
265   // ..........................................................
266   // COST CATEGORY
267   //
268
269   enyo.kind({
270     name: "XV.CostCategoryListParameters",
271     kind: "XV.ParameterWidget",
272     components: [
273       {kind: "onyx.GroupboxHeader", content: "_costCategory".loc()},
274       {name: "code", label: "_code".loc(), attr: "code"}
275     ]
276   });
277
278   // ..........................................................
279   // CREDIT CARD
280   //
281
282   enyo.kind({
283     name: "XV.CreditCardListParameters",
284     kind: "XV.ParameterWidget",
285     components: [
286       {kind: "onyx.GroupboxHeader", content: "_creditCards".loc()},
287       {name: "name", label: "_name".loc(), attr: "name"}
288     ]
289   });
290
291   // ..........................................................
292   // CUSTOMER
293   //
294
295   enyo.kind({
296     name: "XV.CustomerListParameters",
297     kind: "XV.ParameterWidget",
298     components: [
299       {kind: "onyx.GroupboxHeader", content: "_customer".loc()},
300       {name: "isActive", attr: "isActive", label: "_showInactive".loc(), defaultKind: "XV.CheckboxWidget",
301         getParameter: function () {
302           var param;
303           if (!this.getValue()) {
304             param = {
305               attribute: this.getAttr(),
306               operator: "=",
307               value: true
308             };
309           }
310           return param;
311         }
312       },
313       {name: "number", label: "_number".loc(), attr: "number"},
314       {name: "name", label: "_name".loc(), attr: "name"},
315       {name: "customerType", attr: "customerType", label: "_customerType".loc(), defaultKind: "XV.CustomerTypePicker"},
316       {kind: "onyx.GroupboxHeader", content: "_contact".loc()},
317       {name: "primaryEmail", label: "_primaryEmail".loc(), attr: "billingContact.primaryEmail"},
318       {name: "phone", label: "_phone".loc(), attr: ["billingContact.phone", "billingContact.alternate", "billingContact.fax"]},
319       {kind: "onyx.GroupboxHeader", content: "_address".loc()},
320       {name: "street", label: "_street".loc(), attr: ["billingContact.address.line1", "billingContact.address.line2", "billingContact.address.line3"]},
321       {name: "city", label: "_city".loc(), attr: "billingContact.address.city"},
322       {name: "state", label: "_state".loc(), attr: "billingContact.address.state"},
323       {name: "postalCode", label: "_postalCode".loc(), attr: "billingContact.address.postalCode"},
324       {name: "country", label: "_country".loc(), attr: "billingContact.address.country"}
325     ]
326   });
327
328   // ..........................................................
329   // CUSTOMER GROUP
330   //
331
332   enyo.kind({
333     name: "XV.CustomerGroupListParameters",
334     kind: "XV.ParameterWidget",
335     components: [
336       {kind: "onyx.GroupboxHeader", content: "_customerGroup".loc()},
337       {name: "name", label: "_name".loc(), attr: "name"},
338       {name: "description", label: "_description".loc(), attr: "description"}
339     ]
340   });
341
342   // ..........................................................
343   // DEPARTMENT
344   //
345
346   enyo.kind({
347     name: "XV.DepartmentListParameters",
348     kind: "XV.ParameterWidget",
349     components: [
350       {kind: "onyx.GroupboxHeader", content: "_department".loc()},
351       {name: "number", label: "_number".loc(), attr: "number"},
352       {name: "name", label: "_code".loc(), attr: "name"}
353     ]
354   });
355
356   // ..........................................................
357   // EMPLOYEE
358   //
359
360   enyo.kind({
361     name: "XV.EmployeeListParameters",
362     kind: "XV.ParameterWidget",
363     characteristicsRole: "isEmployees",
364     components: [
365       {kind: "onyx.GroupboxHeader", content: "_account".loc()},
366       {name: "isActive", attr: "isActive", label: "_showInactive".loc(), defaultKind: "XV.CheckboxWidget",
367         getParameter: function () {
368           var param;
369           if (!this.getValue()) {
370             param = {
371               attribute: this.getAttr(),
372               operator: "=",
373               value: true
374             };
375           }
376           return param;
377         }
378       },
379       {name: "code", label: "_code".loc(), attr: "code"},
380       {name: "number", label: "_number".loc(), attr: "number"},
381       {name: "name", label: "_name".loc(), attr: "name"},
382       {kind: "onyx.GroupboxHeader", content: "_detail".loc()},
383       {name: "manager", label: "_manager".loc(), attr: "manager", defaultKind: "XV.EmployeeWidget"},
384       {name: "department", label: "_department".loc(), attr: "department", defaultKind: "XV.DepartmentWidget"},
385       {name: "shift", label: "_shift".loc(), attr: "shift", defaultKind: "XV.ShiftWidget"},
386       {kind: "onyx.GroupboxHeader", content: "_contact".loc()},
387       {name: "contact", label: "_contact".loc(), attr: "contact.name"},
388       {name: "primaryEmail", label: "_primaryEmail".loc(), attr: "contact.primaryEmail"},
389       {name: "phone", label: "_phone".loc(), attr: ["primaryContact.phone", "contact.alternate", "contact.fax"]},
390       {kind: "onyx.GroupboxHeader", content: "_address".loc()},
391       {name: "street", label: "_street".loc(), attr: ["primaryContact.address.line1", "contact.address.line2", "contact.address.line3"]},
392       {name: "city", label: "_city".loc(), attr: "contact.address.city"},
393       {name: "postalCode", label: "_postalCode".loc(), attr: "contact.address.postalCode"},
394       {name: "state", label: "_state".loc(), attr: "contact.address.state"},
395       {name: "country", label: "_country".loc(), attr: "cntact.address.country"}
396     ]
397   });
398
399   // ..........................................................
400   // EMPLOYEE GROUP
401   //
402
403   enyo.kind({
404     name: "XV.EmployeeGroupListParameters",
405     kind: "XV.ParameterWidget",
406     components: [
407       {kind: "onyx.GroupboxHeader", content: "_employeeGroup".loc()},
408       {name: "name", label: "_name".loc(), attr: "name"},
409       {name: "description", label: "_description".loc(),
410         attr: "description"}
411     ]
412   });
413
414   // ..........................................................
415   // FREIGHT CLASS
416   //
417
418   enyo.kind({
419     name: "XV.FreightClassListParameters",
420     kind: "XV.ParameterWidget",
421     components: [
422       {kind: "onyx.GroupboxHeader", content: "_freightClass".loc()},
423       {name: "code", label: "_code".loc(), attr: "code"},
424       {name: "description", label: "_description".loc(), attr: "description"}
425     ]
426   });
427
428   // ..........................................................
429   // CUSTOMER SHIPTO
430   //
431
432   enyo.kind({
433     name: "XV.CustomerShiptoParameters",
434     kind: "XV.ParameterWidget",
435     components: [
436       {kind: "onyx.GroupboxHeader", content: "_shipTo".loc()},
437       // TODO: this must not be editable
438       {name: "customer", label: "_customer".loc(), attr: "customer", defaultKind: "XV.CustomerWidget"},
439       {name: "number", label: "_number".loc(), attr: "number"},
440       {name: "name", label: "_name".loc(), attr: "name"}
441     ]
442   });
443
444   // ..........................................................
445   // FILE
446   //
447
448   enyo.kind({
449     name: "XV.FileListParameters",
450     kind: "XV.ParameterWidget",
451     components: [
452       {kind: "onyx.GroupboxHeader", content: "_file".loc()},
453       {name: "name", label: "_name".loc(), attr: "name"},
454       {name: "description", label: "_description".loc(), attr: "description"}
455     ]
456   });
457
458   // ..........................................................
459   // INCIDENT
460   //
461
462   enyo.kind({
463     name: "XV.IncidentListParameters",
464     kind: "XV.ParameterWidget",
465     defaultParameters: function () {
466       return {
467         user: XM.currentUser
468       };
469     },
470     characteristicsRole: "isIncidents",
471     components: [
472       {kind: "onyx.GroupboxHeader", content: "_incident".loc()},
473       {name: "number", label: "_number".loc(), attr: "number"},
474       {name: "description", label: "_description".loc(), attr: "description"},
475       {name: "category", label: "_category".loc(), attr: "category",
476         defaultKind: "XV.IncidentCategoryPicker"},
477       {name: "severity", label: "_severity".loc(), attr: "severity",
478         defaultKind: "XV.IncidentSeverityPicker"},
479       {name: "resolution", label: "_resolution".loc(), attr: "resolution",
480           defaultKind: "XV.IncidentResolutionPicker"},
481       {kind: "onyx.GroupboxHeader", content: "_priority".loc()},
482       {name: "priorityEquals", label: "_equals".loc(), attr: "priority",
483         defaultKind: "XV.PriorityPicker"},
484       {name: "priorityAbove", label: "_above".loc(), attr: "priority",
485           filterLabel: "_priority".loc() + " " + "_above".loc(),
486           defaultKind: "XV.PriorityPicker",
487           getParameter: function () {
488             var value = this.getValue(),
489               param;
490             if (value) {
491               param = {
492                 attribute: "priorityOrder",
493                 operator: "<",
494                 value: value.get("order")
495               };
496             }
497             return param;
498           }},
499       {kind: "onyx.GroupboxHeader", content: "_status".loc()},
500       {name: "statusEquals", label: "_equals".loc(), attr: "status",
501         filterLabel: "_status".loc() + " " + "_equals".loc(),
502         defaultKind: "XV.IncidentStatusPicker"},
503       {name: "statusAbove", label: "_above".loc(), attr: "status",
504         filterLabel: "_status".loc() + " " + "_above".loc(),
505         defaultKind: "XV.IncidentStatusPicker",
506         getParameter: function () {
507           var value = this.getValue(),
508             param;
509           switch (value)
510           {
511           case "N":
512             value = 0;
513             break;
514           case "F":
515             value = 1;
516             break;
517           case "C":
518             value = 2;
519             break;
520           case "A":
521             value = 3;
522             break;
523           case "R":
524             value = 4;
525             break;
526           case "L":
527             value = 5;
528             break;
529           }
530           if (value) {
531             param = {
532               attribute: "statusOrder",
533               operator: "<",
534               value: value
535             };
536           }
537           return param;
538         }},
539       {kind: "onyx.GroupboxHeader", content: "_relationships".loc()},
540       {name: "account", label: "_account".loc(), attr: "account", defaultKind: "XV.AccountWidget"},
541       {name: "contact", label: "_contact".loc(), attr: "contact", defaultKind: "XV.ContactWidget"},
542       {kind: "onyx.GroupboxHeader", content: "_userAccounts".loc()},
543       {name: "owner", label: "_owner".loc(), attr: "owner", defaultKind: "XV.UserAccountWidget"},
544       {name: "assignedTo", label: "_assignedTo".loc(), attr: "assignedTo", defaultKind: "XV.UserAccountWidget"},
545       {name: "user", label: "_user".loc(), attr: ["owner.username", "assignedTo.username"], defaultKind: "XV.UserAccountWidget"},
546       {kind: "onyx.GroupboxHeader", content: "_created".loc()},
547       {name: "createdFromDate", label: "_fromDate".loc(),
548         filterLabel: "_created".loc() + " " + "_fromDate".loc(),
549         attr: "created", operator: ">=",
550         defaultKind: "XV.DateWidget"},
551       {name: "createdToDate", label: "_toDate".loc(),
552         filterLabel: "_created".loc() + " " + "_toDate".loc(),
553         attr: "created", operator: "<=",
554         defaultKind: "XV.DateWidget"},
555       {kind: "onyx.GroupboxHeader", content: "_updated".loc()},
556       {name: "updatedFromDate", label: "_fromDate".loc(),
557         filterLabel: "_updated".loc() + " " + "_fromDate".loc(),
558         attr: "updated", operator: ">=",
559         defaultKind: "XV.DateWidget"},
560       {name: "updatedToDate", label: "_toDate".loc(),
561         filterLabel: "_updated".loc() + " " + "_toDate".loc(),
562         attr: "updated", operator: "<=",
563         defaultKind: "XV.DateWidget"}
564     ]
565   });
566
567   // ..........................................................
568   // INVOICE
569   //
570   enyo.kind({
571     name: "XV.InvoiceListParameters",
572     kind: "XV.ParameterWidget",
573     components: [
574       {kind: "onyx.GroupboxHeader", name: "invoiceHeader", content: "_invoice".loc()},
575       {name: "number", label: "_number".loc(), attr: "number"},
576       {kind: "onyx.GroupboxHeader", content: "_show".loc()},
577       {name: "showUnposted", label: "_showUnposted".loc(),
578         attr: "isPosted", defaultKind: "XV.CheckboxWidget",
579         getParameter: function () {
580           var param;
581           if (!this.getValue()) {
582             param = {
583               attribute: this.getAttr(),
584               operator: "=",
585               value: true
586             };
587           }
588           return param;
589         }
590       },
591       {name: "showPosted", label: "_showPosted".loc(),
592         attr: "isPosted", defaultKind: "XV.CheckboxWidget",
593         getParameter: function () {
594           var param;
595           if (!this.getValue()) {
596             param = {
597               attribute: this.getAttr(),
598               operator: "=",
599               value: false
600             };
601           }
602           return param;
603         }
604       },
605       {name: "showVoided", label: "_showVoided".loc(),
606         attr: "isVoid", defaultKind: "XV.CheckboxWidget"},
607       {kind: "onyx.GroupboxHeader", content: "_customer".loc()},
608       {name: "customer", attr: "customer", label: "_customer".loc(), defaultKind: "XV.BillingCustomerWidget"},
609       {name: "customerType", attr: "customer.customerType", label: "_customerType".loc(), defaultKind: "XV.CustomerTypePicker"},
610       {name: "customerTypePattern", attr: "customer.customerType", label: "_customerTypePattern".loc()},
611       // TODO: INCLUDES operator? But what would the attr be?
612       //{name: "customerGroup", attr: "customer.customerGroups.customerGroup",
613       //  label: "_customerGroup".loc(), defaultKind: "XV.CustomerGroupWidget"},
614
615   /*
616   > Customer
617     - Number
618     - Type (picker)
619     - Type Pattern (text)
620     - Group
621       */
622       {kind: "onyx.GroupboxHeader", name: "invoiceDateHeader", content: "_invoiceDate".loc()},
623       {name: "fromDate", label: "_fromDate".loc(), attr: "invoiceDate", operator: ">=",
624         defaultKind: "XV.DateWidget"},
625       {name: "toDate", label: "_toDate".loc(), attr: "invoiceDate", operator: "<=",
626         defaultKind: "XV.DateWidget"}
627     ],
628     create: function () {
629       this.inherited(arguments);
630       // XXX only apply this if the filter is default
631       this.$.showUnposted.setValue(true);
632     }
633
634   });
635
636   // ..........................................................
637   // ITEM
638   //
639
640   enyo.kind({
641     name: "XV.ItemListParameters",
642     kind: "XV.ParameterWidget",
643     characteristicsRole: "isItems",
644     components: [
645       {kind: "onyx.GroupboxHeader", content: "_item".loc()},
646       {name: "isActive", attr: "isActive", label: "_showInactive".loc(), defaultKind: "XV.CheckboxWidget",
647         getParameter: function () {
648           var param;
649           if (!this.getValue()) {
650             param = {
651               attribute: this.getAttr(),
652               operator: "=",
653               value: true
654             };
655           }
656           return param;
657         }
658       },
659       {name: "number", label: "_number".loc(), attr: "number"},
660       {name: "description", label: "_description".loc(), attr: ["description1", "description2"]},
661       {name: "itemType", label: "_type".loc(), attr: "itemType",
662         defaultKind: "XV.ItemTypePicker"},
663       {name: "classCode", label: "_classCode".loc(), attr: "classCode",
664         defaultKind: "XV.ClassCodePicker"},
665       {name: "category", label: "_category".loc(), attr: "productCategory",
666         defaultKind: "XV.ProductCategoryPicker"}
667     ]
668   });
669
670   // ..........................................................
671   // ITEM SITE
672   //
673
674   enyo.kind({
675     name: "XV.ItemSiteListParameters",
676     kind: "XV.ParameterWidget",
677     components: [
678       {kind: "onyx.GroupboxHeader", content: "_itemSite".loc()},
679       {name: "itemWidget", label: "_item".loc(), attr: "item",
680         defaultKind: "XV.ItemWidget"},
681       {name: "site", label: "_site".loc(), attr: "site",
682         defaultKind: "XV.SitePicker"},
683       {name: "isActive", attr: "isActive", label: "_showInactive".loc(), defaultKind: "XV.CheckboxWidget",
684         getParameter: function () {
685           var param;
686           if (!this.getValue()) {
687             param = {
688               attribute: this.getAttr(),
689               operator: "=",
690               value: true
691             };
692           }
693           return param;
694         }
695       },
696       {kind: "onyx.GroupboxHeader", content: "_item".loc()},
697       {name: "itemNumber", label: "_number".loc(), attr: "item.number"},
698       {name: "itemDescription", label: "_description".loc(), attr: ["item.description1", "item.description2"]},
699       {kind: "onyx.GroupboxHeader", content: "_site".loc()},
700       {name: "siteCode", label: "_code".loc(), attr: "site.code"},
701       {name: "siteDescription", label: "_description".loc(), attr: "site.description"},
702       {kind: "onyx.GroupboxHeader", content: "_classCode".loc()},
703       {name: "classCode", label: "_equals".loc(), attr: "item.classCode",
704         defaultKind: "XV.ClassCodePicker"},
705       {name: "classCodePattern", label: "_code".loc(), attr: "item.classCode.code"},
706       {kind: "onyx.GroupboxHeader", content: "_costCategory".loc()},
707       {name: "costCategory", label: "_equals".loc(), attr: "costCategory",
708         defaultKind: "XV.CostCategoryPicker"},
709       {name: "costCategoryPattern", label: "_code".loc(), attr: "costCategory.code"},
710       {kind: "onyx.GroupboxHeader", content: "_plannerCode".loc()},
711       {name: "plannerCode", label: "_equals".loc(), attr: "plannerCode",
712         defaultKind: "XV.PlannerCodePicker"},
713       {name: "plannerCodePattern", label: "_code".loc(), attr: "plannerCode.code"}
714     ]
715   });
716
717   // ..........................................................
718   // LEDGER ACCOUNT
719   //
720
721   enyo.kind({
722     name: "XV.LedgerAccountListParameters",
723     kind: "XV.ParameterWidget",
724     components: [
725       {kind: "onyx.GroupboxHeader", content: "_ledgerAccount".loc()},
726       {name: "isActive", attr: "isActive", label: "_showInactive".loc(), defaultKind: "XV.CheckboxWidget",
727         getParameter: function () {
728           var param;
729           if (!this.getValue()) {
730             param = {
731               attribute: this.getAttr(),
732               operator: "=",
733               value: true
734             };
735           }
736           return param;
737         }
738       },
739       {name: "name", label: "_name".loc(), attr: "name"},
740       {name: "description", label: "_description".loc(), attr: "description"},
741       {name: "accountType", label: "_type".loc(), attr: "accountType",
742         defaultKind: "XV.LedgerAccountTypePicker"}
743     ]
744
745   });
746
747   // ..........................................................
748   // OPPORTUNITY
749   //
750
751   enyo.kind({
752     name: "XV.OpportunityListParameters",
753     kind: "XV.ParameterWidget",
754     defaultParameters: function () {
755       return {
756         user: XM.currentUser
757       };
758     },
759     characteristicsRole: "isOpportunities",
760     components: [
761       {kind: "onyx.GroupboxHeader", content: "_opportunity".loc()},
762       {name: "showInactive", label: "_showInactive".loc(), attr: "isActive",
763         defaultKind: "XV.CheckboxWidget",
764         getParameter: function () {
765           var param;
766           if (!this.getValue()) {
767             param = {
768               attribute: this.getAttr(),
769               operator: "=",
770               value: true
771             };
772           }
773           return param;
774         }
775       },
776       {name: "name", label: "_name".loc(), attr: "name"},
777       {kind: "onyx.GroupboxHeader", content: "_status".loc()},
778       {name: "stage", label: "_stage".loc(), attr: "opportunityStage",
779         defaultKind: "XV.OpportunityStagePicker"},
780       {name: "priority", label: "_priority".loc(), attr: "priority",
781         defaultKind: "XV.PriorityPicker"},
782       {name: "type", label: "_type".loc(), attr: "opportunityType",
783         defaultKind: "XV.OpportunityTypePicker"},
784       {name: "source", label: "_source".loc(), attr: "opportunitySource",
785         defaultKind: "XV.OpportunitySourcePicker"},
786       {kind: "onyx.GroupboxHeader", content: "_relationships".loc()},
787       {name: "account", label: "_account".loc(), attr: "account", defaultKind: "XV.AccountWidget"},
788       {name: "contact", label: "_contact".loc(), attr: "contact", defaultKind: "XV.ContactWidget"},
789       {kind: "onyx.GroupboxHeader", content: "_userAccounts".loc()},
790       {name: "owner", label: "_owner".loc(), attr: "owner", defaultKind: "XV.UserAccountWidget"},
791       {name: "assignedTo", label: "_assignedTo".loc(), attr: "assignedTo", defaultKind: "XV.UserAccountWidget"},
792       {name: "user", label: "_user".loc(), attr: ["owner.username", "assignedTo.username"], defaultKind: "XV.UserAccountWidget"},
793       {kind: "onyx.GroupboxHeader", content: "_startDate".loc()},
794       {name: "fromStartDate", label: "_fromDate".loc(), attr: "startDate", operator: ">=",
795         filterLabel: "_from".loc() + " " + "_startDate".loc() + " " + "_date".loc(),
796         defaultKind: "XV.DateWidget"},
797       {name: "toStartDate", label: "_toDate".loc(), attr: "startDate", operator: "<=",
798         filterLabel: "_to".loc() + " " + "_startDate".loc() + " " + "_date".loc(),
799         defaultKind: "XV.DateWidget"},
800       {kind: "onyx.GroupboxHeader", content: "_assignDate".loc()},
801       {name: "fromAssignDate", label: "_fromDate".loc(), attr: "assignDate", operator: ">=",
802         filterLabel: "_from".loc() + " " + "_assignedDate".loc() + " " + "_date".loc(),
803         defaultKind: "XV.DateWidget"},
804       {name: "toAssignDate", label: "_toDate".loc(), attr: "assignDate", operator: "<=",
805         filterLabel: "_to".loc() + " " + "_assignedDate".loc() + " " + "_date".loc(),
806         defaultKind: "XV.DateWidget"},
807       {kind: "onyx.GroupboxHeader", content: "_targetClose".loc()},
808       {name: "fromTargetDate", label: "_fromDate".loc(), attr: "targetClose", operator: ">=",
809         filterLabel: "_from".loc() + " " + "_targetClose".loc() + " " + "_date".loc(),
810         defaultKind: "XV.DateWidget"},
811       {name: "toTargetDate", label: "_toDate".loc(), attr: "targetClose", operator: "<=",
812         filterLabel: "_to".loc() + " " + "_targetClose".loc() + " " + "_date".loc(),
813         defaultKind: "XV.DateWidget"},
814       {kind: "onyx.GroupboxHeader", content: "_actualDate".loc()},
815       {name: "fromActualDate", label: "_fromDate".loc(), attr: "actualDate", operator: ">=",
816         filterLabel: "_from".loc() + " " + "_actualDate".loc() + " " + "_date".loc(),
817         defaultKind: "XV.DateWidget"},
818       {name: "toActualDate", label: "_toDate".loc(), attr: "actualDate", operator: "<=",
819         filterLabel: "_to".loc() + " " + "_actualDate".loc() + " " + "_date".loc(),
820         defaultKind: "XV.DateWidget"}
821     ]
822   });
823
824   // ..........................................................
825   // PLANNER CODE
826   //
827
828   enyo.kind({
829     name: "XV.PlannerCodeListParameters",
830     kind: "XV.ParameterWidget",
831     components: [
832       {kind: "onyx.GroupboxHeader", content: "_plannerCode".loc()},
833       {name: "code", label: "_code".loc(), attr: "code"}
834     ]
835   });
836
837   // ..........................................................
838   // PROJECT
839   //
840
841   enyo.kind({
842     name: "XV.ProjectListParameters",
843     kind: "XV.ParameterWidget",
844     characteristicsRole: "isProjects",
845     defaultParameters: function () {
846       return {
847         user: XM.currentUser
848       };
849     },
850     components: [
851       {kind: "onyx.GroupboxHeader", content: "_project".loc()},
852       {name: "showCompleted", label: "_showCompleted".loc(), attr: "status", defaultKind: "XV.CheckboxWidget",
853         getParameter: function () {
854           var param;
855           if (!this.getValue()) {
856             param = {
857               attribute: this.getAttr(),
858               operator: "!=",
859               value: "C"
860             };
861           }
862           return param;
863         }
864       },
865       {name: "number", label: "_number".loc(), attr: "number"},
866       {name: "name", label: "_name".loc(), attr: "name"},
867       {name: "projectType", label: "_projectType".loc(), attr: "projectType", defaultKind: "XV.ProjectTypePicker"},
868       {name: "department", label: "_department".loc(), attr: "department", defaultKind: "XV.DepartmentWidget"},
869       {name: "account", label: "_account".loc(), attr: "account", defaultKind: "XV.AccountWidget"},
870       {name: "contact", label: "_contact".loc(), attr: "contact", defaultKind: "XV.ContactWidget"},
871       {name: "statusHeader", kind: "onyx.GroupboxHeader", content: "_status".loc()},
872       {name: "status", label: "_status".loc(), attr: "status",
873         defaultKind: "XV.ProjectStatusPicker"},
874       {kind: "onyx.GroupboxHeader", content: "_priority".loc()},
875       {name: "priorityEquals", label: "_equals".loc(), attr: "priority",
876         defaultKind: "XV.PriorityPicker"},
877       {name: "priorityAbove", label: "_above".loc(), attr: "priority",
878           filterLabel: "_priority".loc() + " " + "_above".loc(),
879           defaultKind: "XV.PriorityPicker",
880           getParameter: function () {
881             var value = this.getValue(),
882               param;
883             if (value) {
884               param = {
885                 attribute: "priority.order",
886                 operator: "<",
887                 value: value.get("order")
888               };
889             }
890             return param;
891           }},
892       {kind: "onyx.GroupboxHeader", content: "_userAccounts".loc()},
893       {name: "owner", label: "_owner".loc(), attr: "owner", defaultKind: "XV.UserAccountWidget"},
894       {name: "assignedTo", label: "_assignedTo".loc(), attr: "assignedTo", defaultKind: "XV.UserAccountWidget"},
895       {name: "user", label: "_user".loc(), attr: ["owner.username", "assignedTo.username"], defaultKind: "XV.UserAccountWidget"},
896       {kind: "onyx.GroupboxHeader", content: "_dueDate".loc()},
897       {name: "fromDueDate", label: "_fromDate".loc(), attr: "dueDate", operator: ">=",
898         filterLabel: "_from".loc() + " " + "_dueDate".loc() + " " + "_date".loc(),
899         defaultKind: "XV.DateWidget"},
900       {name: "toDueDate", label: "_toDate".loc(), attr: "dueDate", operator: "<=",
901         filterLabel: "_to".loc() + " " + "_dueDate".loc() + " " + "_date".loc(),
902         defaultKind: "XV.DateWidget"}
903     ],
904     /**
905       Special handling for status.
906     */
907     setParameterItemValues: function (items) {
908       this.inherited(arguments);
909       var i;
910       for (i = 0; i < items.length; i++) {
911         if (items[i].name === "status" &&
912             items[i].showing === false) {
913           this.$.showCompleted.hide();
914           this.$.statusHeader.hide();
915         }
916       }
917
918     }
919   });
920
921   // ..........................................................
922   // PROSPECT
923   //
924
925   enyo.kind({
926     name: "XV.ProspectListParameters",
927     kind: "XV.ParameterWidget",
928     components: [
929       {kind: "onyx.GroupboxHeader", content: "_contact".loc()},
930       {name: "isActive", attr: "isActive", label: "_showInactive".loc(), defaultKind: "XV.CheckboxWidget",
931         getParameter: function () {
932           var param;
933           if (!this.getValue()) {
934             param = {
935               attribute: this.getAttr(),
936               operator: "=",
937               value: true
938             };
939           }
940           return param;
941         }
942       },
943       {name: "number", label: "_number".loc(), attr: "number"},
944       {name: "name", label: "_name".loc(), attr: "name"},
945       {kind: "onyx.GroupboxHeader", content: "_contact".loc()},
946       {name: "primaryEmail", label: "_primaryEmail".loc(), attr: "contact.primaryEmail"},
947       {name: "phone", label: "_phone".loc(), attr: ["contact.phone", "contact.alternate", "contact.fax"]},
948       {kind: "onyx.GroupboxHeader", content: "_address".loc()},
949       {name: "street", label: "_street".loc(), attr: ["contact.address.line1", "contact.address.line2", "contact.address.line3"]},
950       {name: "city", label: "_city".loc(), attr: "contact.address.city"},
951       {name: "state", label: "_state".loc(), attr: "contact.address.state"},
952       {name: "postalCode", label: "_postalCode".loc(), attr: "contact.address.postalCode"},
953       {name: "country", label: "_country".loc(), attr: "contact.address.country"}
954     ]
955   });
956
957   // ..........................................................
958   // PURCHASE ORDER LIST
959   //
960
961   enyo.kind({
962     name: "XV.PurchaseOrderListItemParameters",
963     kind: "XV.ParameterWidget",
964     components: [
965       {kind: "onyx.GroupboxHeader", content: "_purchaseOrders".loc()},
966       {name: "showUnReleased", attr: "status", label: "_showUnReleased".loc(), defaultKind: "XV.CheckboxWidget",
967         getParameter: function () {
968           var param;
969           if (!this.getValue()) {
970             param = {
971               attribute: this.getAttr(),
972               operator: "!=",
973               value: "U"
974             };
975           }
976           return param;
977         }
978       },
979       {name: "showClosed", attr: "status", label: "_showClosed".loc(), defaultKind: "XV.CheckboxWidget",
980         getParameter: function () {
981           var param;
982           if (!this.getValue()) {
983             param = {
984               attribute: this.getAttr(),
985               operator: "!=",
986               value: "C"
987             };
988           }
989           return param;
990         }
991       },
992       {name: "number", label: "_number".loc(), attr: "number"},
993       {kind: "onyx.GroupboxHeader", content: "_vendor".loc()},
994       {name: "vendor", attr: "vendor.number", label: "_vendor".loc(), defaultKind: "XV.VendorWidget"},
995       {name: "vendorType", attr: "vendor.vendorType.code", label: "_vendorType".loc(), defaultKind: "XV.VendorTypePicker"},
996       {kind: "onyx.GroupboxHeader", content: "_purchaseOrderDate".loc()},
997       {name: "fromDate", label: "_fromDate".loc(),
998         filterLabel: "_date".loc() + " " + "_fromDate".loc(),
999         attr: "orderDate", operator: ">=",
1000         defaultKind: "XV.DateWidget"},
1001       {name: "toDate", label: "_toDate".loc(),
1002         filterLabel: "_date".loc() + " " + "_toDate".loc(),
1003         attr: "orderDate", operator: "<=",
1004         defaultKind: "XV.DateWidget"}
1005     ]
1006   });
1007
1008   // ..........................................................
1009   // QUOTE
1010   //
1011
1012   enyo.kind({
1013     name: "XV.QuoteListParameters",
1014     kind: "XV.ParameterWidget",
1015     components: [
1016       {kind: "onyx.GroupboxHeader", content: "_quote".loc()},
1017       {name: "showExpired", label: "_showExpired".loc(), attr: "expireDate", defaultKind: "XV.CheckboxWidget",
1018         getParameter: function () {
1019           var param;
1020           if (!this.getValue()) {
1021             param = {
1022               attribute: this.getAttr(),
1023               operator: ">=",
1024               value: new Date(),
1025               includeNull: true
1026             };
1027           }
1028           return param;
1029         }
1030       },
1031       {name: "showClosed", label: "_showClosed".loc(), attr: "status", defaultKind: "XV.CheckboxWidget",
1032         getParameter: function () {
1033           var param;
1034           if (!this.getValue()) {
1035             param = {
1036               attribute: this.getAttr(),
1037               operator: "!=",
1038               value: "C"
1039             };
1040           }
1041           return param;
1042         }
1043       },
1044       {name: "excludeProspects", label: "_excludeProspects".loc(), attr: "customer.status", defaultKind: "XV.CheckboxWidget",
1045         getParameter: function () {
1046           var param;
1047           if (this.getValue()) {
1048             param = {
1049               attribute: this.getAttr(),
1050               operator: "!=",
1051               value: "P"
1052             };
1053           }
1054           return param;
1055         }
1056       },
1057       {name: "number", label: "_number".loc(), attr: "number"},
1058       {name: "salesRep", attr: "salesRep", label: "_salesRep".loc(), defaultKind: "XV.SalesRepPicker"},
1059       {kind: "onyx.GroupboxHeader", content: "_customer".loc()},
1060       {name: "customer", attr: "customer", label: "_customer".loc(), defaultKind: "XV.CustomerProspectWidget"},
1061       {name: "customerType", attr: "customer.customerType", label: "_customerType".loc(), defaultKind: "XV.CustomerTypePicker"},
1062       {name: "customerPurchaseOrderNumber", attr: "customerPurchaseOrderNumber",
1063         label: "_custPO".loc()},
1064       {kind: "onyx.GroupboxHeader", content: "_quoteDate".loc()},
1065       {name: "createdFromDate", label: "_fromDate".loc(),
1066         filterLabel: "_quoteDate".loc() + " " + "_fromDate".loc(),
1067         attr: "quoteDate", operator: ">=",
1068         defaultKind: "XV.DateWidget"},
1069       {name: "createdToDate", label: "_toDate".loc(),
1070         filterLabel: "_quoteDate".loc() + " " + "_toDate".loc(),
1071         attr: "quoteDate", operator: "<=",
1072         defaultKind: "XV.DateWidget"}
1073     ]
1074   });
1075
1076   // ..........................................................
1077   // RETURN
1078   //
1079
1080   enyo.kind({
1081     name: "XV.ReturnListParameters",
1082     kind: "XV.InvoiceListParameters",
1083     create: function () {
1084       this.inherited(arguments);
1085       // swap out the header text
1086       this.$.invoiceHeader.setContent("_return".loc());
1087       this.$.invoiceDateHeader.setContent("_returnDate".loc());
1088       // swap out date attribute
1089       this.$.fromDate.setAttr("returnDate");
1090       this.$.toDate.setAttr("returnDate");
1091     }
1092
1093   });
1094
1095   // ..........................................................
1096   // SALES ORDER
1097   //
1098
1099   enyo.kind({
1100     name: "XV.SalesOrderListParameters",
1101     kind: "XV.ParameterWidget",
1102     components: [
1103       {kind: "onyx.GroupboxHeader", content: "_quote".loc()},
1104       {name: "showClosed", label: "_showClosed".loc(), attr: "status", defaultKind: "XV.CheckboxWidget",
1105         getParameter: function () {
1106           var param;
1107           if (!this.getValue()) {
1108             param = {
1109               attribute: this.getAttr(),
1110               value: "O"
1111             };
1112           }
1113           return param;
1114         }
1115       },
1116       {name: "number", label: "_number".loc(), attr: "number"},
1117       {name: "salesRep", attr: "salesRep", label: "_salesRep".loc(), defaultKind: "XV.SalesRepPicker"},
1118       {kind: "onyx.GroupboxHeader", content: "_customer".loc()},
1119       {name: "customer", attr: "customer", label: "_customer".loc(), defaultKind: "XV.CustomerProspectWidget"},
1120       {name: "customerType", attr: "customer.customerType", label: "_customerType".loc(), defaultKind: "XV.CustomerTypePicker"},
1121       {name: "customerPurchaseOrderNumber", attr: "customerPurchaseOrderNumber",
1122         label: "_custPO".loc()},
1123       {kind: "onyx.GroupboxHeader", content: "_salesOrderDate".loc()},
1124       {name: "createdFromDate", label: "_fromDate".loc(),
1125         filterLabel: "_salesOrderDate".loc() + " " + "_fromDate".loc(),
1126         attr: "orderDate", operator: ">=",
1127         defaultKind: "XV.DateWidget"},
1128       {name: "createdToDate", label: "_toDate".loc(),
1129         filterLabel: "_orderDate".loc() + " " + "_toDate".loc(),
1130         attr: "orderDate", operator: "<=",
1131         defaultKind: "XV.DateWidget"}
1132     ]
1133   });
1134
1135   // ..........................................................
1136   // SALE TYPE
1137   //
1138
1139   enyo.kind({
1140     name: "XV.SaleTypeListParameters",
1141     kind: "XV.ParameterWidget",
1142     components: [
1143       {name: "isActive", attr: "isActive", label: "_showInactive".loc(), defaultKind: "XV.CheckboxWidget",
1144         getParameter: function () {
1145           var param;
1146           if (!this.getValue()) {
1147             param = {
1148               attribute: this.getAttr(),
1149               operator: "=",
1150               value: true
1151             };
1152           }
1153           return param;
1154         }
1155       },
1156       {kind: "onyx.GroupboxHeader", content: "_saleTypes".loc()},
1157       {name: "code", label: "_code".loc(), attr: "code"},
1158       {name: "description", label: "_description".loc(), attr: "description"}
1159     ]
1160   });
1161
1162   // ..........................................................
1163   // SALES REP
1164   //
1165
1166   enyo.kind({
1167     name: "XV.SalesRepListParameters",
1168     kind: "XV.ParameterWidget",
1169     components: [
1170       {name: "isActive", attr: "isActive", label: "_showInactive".loc(), defaultKind: "XV.CheckboxWidget",
1171         getParameter: function () {
1172           var param;
1173           if (!this.getValue()) {
1174             param = {
1175               attribute: this.getAttr(),
1176               operator: "=",
1177               value: true
1178             };
1179           }
1180           return param;
1181         }
1182       },
1183       {kind: "onyx.GroupboxHeader", content: "_salesRep".loc()},
1184       {name: "number", label: "_number".loc(), attr: "number"},
1185       {name: "name", label: "_name".loc(), attr: "name"},
1186       {name: "commission", label: "_commission".loc(), attr: "commission"}
1187     ]
1188   });
1189
1190   // ..........................................................
1191   // SITE
1192   //
1193
1194   enyo.kind({
1195     name: "XV.SiteListParameters",
1196     kind: "XV.ParameterWidget",
1197     components: [
1198       {name: "isActive", attr: "isActive", label: "_showInactive".loc(), defaultKind: "XV.CheckboxWidget",
1199         getParameter: function () {
1200           var param;
1201           if (!this.getValue()) {
1202             param = {
1203               attribute: this.getAttr(),
1204               operator: "=",
1205               value: true
1206             };
1207           }
1208           return param;
1209         }
1210       },
1211       {kind: "onyx.GroupboxHeader", content: "_site".loc()},
1212       {name: "code", label: "_code".loc(), attr: "code"}
1213     ]
1214   });
1215
1216   // ..........................................................
1217   // SHIFT
1218   //
1219
1220   enyo.kind({
1221     name: "XV.ShiftListParameters",
1222     kind: "XV.ParameterWidget",
1223     components: [
1224       {kind: "onyx.GroupboxHeader", content: "_shift".loc()},
1225       {name: "number", label: "_number".loc(), attr: "number"},
1226       {name: "name", label: "_code".loc(), attr: "name"}
1227     ]
1228   });
1229
1230   // ..........................................................
1231   // SHIP ZONE
1232   //
1233
1234   enyo.kind({
1235     name: "XV.ShipZoneListParameters",
1236     kind: "XV.ParameterWidget",
1237     components: [
1238       {kind: "onyx.GroupboxHeader", content: "_shipZones".loc()},
1239       {name: "name", label: "_name".loc(), attr: "name"},
1240       {name: "description", label: "_description".loc(), attr: "description"}
1241     ]
1242   });
1243
1244   // ..........................................................
1245   // SITE TYPE
1246   //
1247
1248   enyo.kind({
1249     name: "XV.SiteTypeListParameters",
1250     kind: "XV.ParameterWidget",
1251     components: [
1252       {kind: "onyx.GroupboxHeader", content: "_siteType".loc()},
1253       {name: "name", label: "_name".loc(), attr: "name"}
1254     ]
1255   });
1256
1257   // ..........................................................
1258   // TAX ASSIGNMENT
1259   //
1260
1261   enyo.kind({
1262     name: "XV.TaxAssignmentListParameters",
1263     kind: "XV.ParameterWidget",
1264     components: [
1265       {kind: "onyx.GroupboxHeader", content: "_taxAssignment".loc()},
1266       {name: "tax", label: "_tax".loc(), attr: "tax"},
1267       {name: "taxZone", label: "_taxZone".loc(), attr: "taxZone"},
1268       {name: "taxType", label: "_taxType".loc(), attr: "taxType"}
1269     ]
1270   });
1271
1272   // ..........................................................
1273   // TAX AUTHORITY
1274   //
1275
1276   enyo.kind({
1277     name: "XV.TaxAuthorityListParameters",
1278     kind: "XV.ParameterWidget",
1279     components: [
1280       {kind: "onyx.GroupboxHeader", content: "_taxAuthority".loc()},
1281       {name: "code", label: "_code".loc(), attr: "code"},
1282       {name: "name", label: "_name".loc(), attr: "name"}
1283     ]
1284   });
1285
1286
1287   // ..........................................................
1288   // TAX CODE
1289   //
1290
1291   enyo.kind({
1292     name: "XV.TaxCodeListParameters",
1293     kind: "XV.ParameterWidget",
1294     components: [
1295       {kind: "onyx.GroupboxHeader", content: "_taxCode".loc()},
1296       {name: "code", label: "_code".loc(), attr: "code"},
1297       {name: "description", label: "_description".loc(), attr: "description"}
1298     ]
1299   });
1300
1301   // ..........................................................
1302   // TAX CLASS
1303   //
1304
1305   enyo.kind({
1306     name: "XV.TaxClassListParameters",
1307     kind: "XV.ParameterWidget",
1308     components: [
1309       {kind: "onyx.GroupboxHeader", content: "_taxClass".loc()},
1310       {name: "code", label: "_code".loc(), attr: "code"},
1311       {name: "description", label: "_description".loc(), attr: "description"}
1312     ]
1313   });
1314
1315   // ..........................................................
1316   // TAX RATE
1317   //
1318
1319   enyo.kind({
1320     name: "XV.TaxRateListParameters",
1321     kind: "XV.ParameterWidget",
1322     components: [
1323       {kind: "onyx.GroupboxHeader", content: "_taxRate".loc()},
1324       {name: "tax", label: "_tax".loc(), attr: "tax.code"},
1325       {name: "percent", label: "_percent".loc(), attr: "percent"}
1326     ]
1327   });
1328
1329   // ..........................................................
1330   // TAX TYPE
1331   //
1332
1333   enyo.kind({
1334     name: "XV.TaxTypeListParameters",
1335     kind: "XV.ParameterWidget",
1336     components: [
1337       {kind: "onyx.GroupboxHeader", content: "_taxType".loc()},
1338       {name: "name", label: "_name".loc(), attr: "name"},
1339       {name: "description", label: "_description".loc(), attr: "description"}
1340     ]
1341   });
1342
1343   // ..........................................................
1344   // TAX ZONE
1345   //
1346
1347   enyo.kind({
1348     name: "XV.TaxZoneListParameters",
1349     kind: "XV.ParameterWidget",
1350     components: [
1351       {kind: "onyx.GroupboxHeader", content: "_taxZone".loc()},
1352       {name: "code", label: "_code".loc(), attr: "code"},
1353       {name: "description", label: "_description".loc(), attr: "description"}
1354     ]
1355   });
1356
1357   // ..........................................................
1358   // TERMS
1359   //
1360
1361   enyo.kind({
1362     name: "XV.TermsListParameters",
1363     kind: "XV.ParameterWidget",
1364     components: [
1365       {kind: "onyx.GroupboxHeader", content: "_terms".loc()},
1366       {name: "code", label: "_code".loc(), attr: "code"},
1367       {name: "description", label: "_description".loc(), attr: "description"}
1368     ]
1369   });
1370
1371   // ..........................................................
1372   // TO DO
1373   //
1374
1375   enyo.kind({
1376     name: "XV.ToDoListParameters",
1377     kind: "XV.ParameterWidget",
1378     defaultParameters: function () {
1379       return {
1380         showInactive: false,
1381         user: XM.currentUser
1382       };
1383     },
1384     components: [
1385       {kind: "onyx.GroupboxHeader", content: "_toDo".loc()},
1386       {name: "showInactive", label: "_showInactive".loc(), attr: "isActive", defaultKind: "XV.CheckboxWidget",
1387         getParameter: function () {
1388           var param;
1389           if (!this.getValue()) {
1390             param = {
1391               attribute: this.getAttr(),
1392               operator: "=",
1393               value: true
1394             };
1395           }
1396           return param;
1397         }
1398       },
1399       {name: "name", label: "_name".loc(), attr: "name"},
1400       {name: "description", label: "_description".loc(), attr: "description"},
1401       {kind: "onyx.GroupboxHeader", content: "_relationships".loc()},
1402       {name: "account", label: "_account".loc(), attr: "account", defaultKind: "XV.AccountWidget"},
1403       {name: "contact", label: "_contact".loc(), attr: "contact", defaultKind: "XV.ContactWidget"},
1404       {kind: "onyx.GroupboxHeader", content: "_userAccounts".loc()},
1405       {name: "owner", label: "_owner".loc(), attr: "owner", defaultKind: "XV.UserAccountWidget"},
1406       {name: "assignedTo", label: "_assignedTo".loc(), attr: "assignedTo", defaultKind: "XV.UserAccountWidget"},
1407       {name: "user", label: "_user".loc(), attr: ["owner.username", "assignedTo.username"], defaultKind: "XV.UserAccountWidget"},
1408       {kind: "onyx.GroupboxHeader", content: "_dueDate".loc()},
1409       {name: "fromDate", label: "_fromDate".loc(), attr: "dueDate", operator: ">=",
1410         filterLabel: "_from".loc() + " " + "_dueDate".loc() + " " + "_date".loc(),
1411         defaultKind: "XV.DateWidget"},
1412       {name: "toDate", label: "_toDate".loc(), attr: "dueDate", operator: "<=",
1413         filterLabel: "_to".loc() + " " + "_dueDate".loc() + " " + "_date".loc(),
1414         defaultKind: "XV.DateWidget"}
1415     ]
1416   });
1417
1418   // ..........................................................
1419   // URL
1420   //
1421
1422   enyo.kind({
1423     name: "XV.UrlListParameters",
1424     kind: "XV.ParameterWidget",
1425     components: [
1426       {kind: "onyx.GroupboxHeader", content: "_url".loc()},
1427       {name: "name", label: "_name".loc(), attr: "name"},
1428       {name: "address", label: "_address".loc(), attr: "path"}
1429     ]
1430   });
1431
1432   // ..........................................................
1433   // VENDOR
1434   //
1435
1436   enyo.kind({
1437     name: "XV.VendorListParameters",
1438     kind: "XV.ParameterWidget",
1439     components: [
1440       {kind: "onyx.GroupboxHeader", content: "_vendor".loc()},
1441       {name: "isActive", attr: "isActive", label: "_showInactive".loc(), defaultKind: "XV.CheckboxWidget",
1442         getParameter: function () {
1443           var param;
1444           if (!this.getValue()) {
1445             param = {
1446               attribute: this.getAttr(),
1447               operator: "=",
1448               value: true
1449             };
1450           }
1451           return param;
1452         }
1453       },
1454       {name: "number", label: "_number".loc(), attr: "number"},
1455       {name: "name", label: "_name".loc(), attr: "name"},
1456       {name: "vendorType", attr: "vendorType.code", label: "_vendorType".loc(), defaultKind: "XV.VendorTypePicker"},
1457       {kind: "onyx.GroupboxHeader", content: "_contact".loc()},
1458       {name: "primaryEmail", label: "_primaryEmail".loc(), attr: "contact1.primaryEmail"},
1459       {name: "phone", label: "_phone".loc(), attr: ["contact1.phone", "contact1.alternate", "contact1.fax"]},
1460       {kind: "onyx.GroupboxHeader", content: "_address".loc()},
1461       {name: "street", label: "_street".loc(), attr: ["address.line1", "address.line2", "address.line3"]},
1462       {name: "city", label: "_city".loc(), attr: "address.city"},
1463       {name: "state", label: "_state".loc(), attr: "address.state"},
1464       {name: "postalCode", label: "_postalCode".loc(), attr: "address.postalCode"},
1465       {name: "country", label: "_country".loc(), attr: "address.country"}
1466     ]
1467   });
1468
1469   // ..........................................................
1470   // VENDOR ADDRESS
1471   //
1472
1473   enyo.kind({
1474     name: "XV.VendorAddressParameters",
1475     kind: "XV.ParameterWidget",
1476     components: [
1477       {kind: "onyx.GroupboxHeader", content: "_vendorAddress".loc()},
1478       {name: "vendor", label: "_vendor".loc(), attr: "vendor", defaultKind: "XV.VendorWidget"},
1479       {name: "code", label: "_code".loc(), attr: "code"},
1480       {name: "name", label: "_name".loc(), attr: "name"}
1481     ]
1482   });
1483
1484 }());