--HR-313 Split case activity datatable tpl into separate file
[civicrm-core.git] / templates / CRM / Case / Form / ActivityTab.tpl
1 {*
2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.4 |
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2013 |
6 +--------------------------------------------------------------------+
7 | This file is a part of CiviCRM. |
8 | |
9 | CiviCRM is free software; you can copy, modify, and distribute it |
10 | under the terms of the GNU Affero General Public License |
11 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
12 | |
13 | CiviCRM is distributed in the hope that it will be useful, but |
14 | WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
16 | See the GNU Affero General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU Affero General Public |
19 | License and the CiviCRM Licensing Exception along |
20 | with this program; if not, contact CiviCRM LLC |
21 | at info[AT]civicrm[DOT]org. If you have questions about the |
22 | GNU Affero General Public License or the licensing of CiviCRM, |
23 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
24 +--------------------------------------------------------------------+
25 *}
26 {*this template is used for activity accordion*}
27 <div class="crm-accordion-wrapper crm-case_activities-accordion crm-case-activities-block">
28 <div class="crm-accordion-header">
29 {ts}Activities{/ts}
30 </div>
31 <div id="activities" class="crm-accordion-body">
32 <div class="crm-accordion-wrapper crm-accordion-inner crm-search_filters-accordion collapsed">
33 <div class="crm-accordion-header">
34 {ts}Search Filters{/ts}</a>
35 </div><!-- /.crm-accordion-header -->
36 <div class="crm-accordion-body">
37 <table class="no-border form-layout-compressed" id="searchOptions">
38 <tr>
39 <td class="crm-case-caseview-form-block-repoter_id"colspan="2"><label for="reporter_id">{ts}Reporter/Role{/ts}</label><br />
40 {$form.reporter_id.html|crmAddClass:twenty}
41 </td>
42 <td class="crm-case-caseview-form-block-status_id"><label for="status_id">{$form.status_id.label}</label><br />
43 {$form.status_id.html}
44 </td>
45 <td style="vertical-align: bottom;">
46 <span class="crm-button"><input class="form-submit default" name="_qf_Basic_refresh" value="Search" type="button" onclick="buildCaseActivities( true )"; /></span>
47 </td>
48 </tr>
49 <tr>
50 <td class="crm-case-caseview-form-block-activity_date_low">
51 {$form.activity_date_low.label}<br />
52 {include file="CRM/common/jcalendar.tpl" elementName=activity_date_low}
53 </td>
54 <td class="crm-case-caseview-form-block-activity_date_high">
55 {$form.activity_date_high.label}<br />
56 {include file="CRM/common/jcalendar.tpl" elementName=activity_date_high}
57 </td>
58 <td class="crm-case-caseview-form-block-activity_type_filter_id">
59 {$form.activity_type_filter_id.label}<br />
60 {$form.activity_type_filter_id.html}
61 </td>
62 </tr>
63 {if $form.activity_deleted}
64 <tr class="crm-case-caseview-form-block-activity_deleted">
65 <td>
66 {$form.activity_deleted.html}{$form.activity_deleted.label}
67 </td>
68 </tr>
69 {/if}
70 </table>
71 </div><!-- /.crm-accordion-body -->
72 </div><!-- /.crm-accordion-wrapper -->
73
74 <table id="activities-selector" class="nestedActivitySelector">
75 <thead><tr>
76 <th class='crm-case-activities-date'>{ts}Date{/ts}</th>
77 <th class='crm-case-activities-subject'>{ts}Subject{/ts}</th>
78 <th class='crm-case-activities-type'>{ts}Type{/ts}</th>
79 <th class='crm-case-activities-with'>{ts}With{/ts}</th>
80 <th class='crm-case-activities-assignee'>{ts}Reporter / Assignee{/ts}</th>
81 <th class='crm-case-activities-status'>{ts}Status{/ts}</th>
82 <th class='crm-case-activities-status' id="nosort">&nbsp;</th>
83 <th class='hiddenElement'>&nbsp;</th>
84 </tr></thead>
85 </table>
86
87 </div><!-- /.crm-accordion-body -->
88 </div><!-- /.crm-accordion-wrapper -->
89
90 {literal}
91 <script type="text/javascript">
92 cj(function( ) {
93 buildCaseActivities(false);
94 });
95
96 function buildCaseActivities(filterSearch) {
97 if (filterSearch) {
98 oTable.fnDestroy();
99 }
100 var count = 0;
101 var columns = '';
102 var sourceUrl = {/literal}"{crmURL p='civicrm/ajax/activity' h=0 q='snippet=4&caseID='}{$caseID}"{literal};
103 sourceUrl = sourceUrl + '&cid={/literal}{$contactID}{literal}';
104 sourceUrl = sourceUrl + '&userID={/literal}{$userID}{literal}';
105
106 cj('#activities-selector th').each(function( ) {
107 if (cj(this).attr('id') != 'nosort') {
108 columns += '{"sClass": "' + cj(this).attr('class') +'"},';
109 }
110 else {
111 columns += '{ "bSortable": false },';
112 }
113 count++;
114 });
115
116 columns = columns.substring(0, columns.length - 1 );
117 eval('columns =[' + columns + ']');
118
119 oTable = cj('#activities-selector').dataTable({
120 "bFilter" : false,
121 "bAutoWidth" : false,
122 "aaSorting" : [],
123 "aoColumns" : columns,
124 "bProcessing": true,
125 "bJQueryUI": true,
126 "asStripClasses" : [ "odd-row", "even-row" ],
127 "sPaginationType": "full_numbers",
128 "sDom" : '<"crm-datatable-pager-top"lfp>rt<"crm-datatable-pager-bottom"ip>',
129 "bServerSide": true,
130 "sAjaxSource": sourceUrl,
131 "iDisplayLength": 10,
132 "fnDrawCallback": function() { setSelectorClass(); },
133 "fnServerData": function ( sSource, aoData, fnCallback ) {
134
135 if ( filterSearch ) {
136 var activity_deleted = 0;
137 if ( cj("#activity_deleted:checked").val() == 1 ) {
138 activity_deleted = 1;
139 }
140 aoData.push(
141 {name:'status_id', value: cj("select#status_id").val()},
142 {name:'activity_type_id', value: cj("select#activity_type_filter_id").val()},
143 {name:'activity_date_low', value: cj("#activity_date_low").val()},
144 {name:'activity_date_high', value: cj("#activity_date_high").val() },
145 {name:'activity_deleted', value: activity_deleted }
146 );
147 }
148 cj.ajax( {
149 "dataType": 'json',
150 "type": "POST",
151 "url": sSource,
152 "data": aoData,
153 "success": fnCallback
154 } );
155 }
156 });
157 }
158
159 function setSelectorClass( ) {
160 cj("#activities-selector td:last-child").each( function( ) {
161 cj(this).parent().addClass(cj(this).text() );
162 });
163 }
164 </script>
165 {/literal}