Commit | Line | Data |
---|---|---|
fc7d8951 DJ |
1 | {* |
2 | +--------------------------------------------------------------------+ | |
819d0d41 | 3 | | CiviCRM version 4.5 | |
fc7d8951 | 4 | +--------------------------------------------------------------------+ |
819d0d41 | 5 | | Copyright CiviCRM LLC (c) 2004-2014 | |
fc7d8951 DJ |
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;"> | |
4e126867 | 46 | {assign var=caseid value=$caseID} |
97e557d7 | 47 | <span class="crm-button"><input class="crm-form-submit default" name="_qf_Basic_refresh" value="Search" type="button" onclick="buildCaseActivities( true,{$caseid} )"; /></span> |
fc7d8951 DJ |
48 | </td> |
49 | </tr> | |
50 | <tr> | |
51 | <td class="crm-case-caseview-form-block-activity_date_low"> | |
7f7fa13a | 52 | {assign var=activitylow value=activity_date_low_$caseID} |
4e126867 DJ |
53 | {$form.$activitylow.label}<br /> |
54 | {include file="CRM/common/jcalendar.tpl" elementName=$activitylow} | |
fc7d8951 DJ |
55 | </td> |
56 | <td class="crm-case-caseview-form-block-activity_date_high"> | |
7f7fa13a | 57 | {assign var=activityhigh value=activity_date_high_$caseID} |
4e126867 DJ |
58 | {$form.$activityhigh.label}<br /> |
59 | {include file="CRM/common/jcalendar.tpl" elementName=$activityhigh} | |
fc7d8951 DJ |
60 | </td> |
61 | <td class="crm-case-caseview-form-block-activity_type_filter_id"> | |
62 | {$form.activity_type_filter_id.label}<br /> | |
63 | {$form.activity_type_filter_id.html} | |
64 | </td> | |
65 | </tr> | |
66 | {if $form.activity_deleted} | |
67 | <tr class="crm-case-caseview-form-block-activity_deleted"> | |
68 | <td> | |
69 | {$form.activity_deleted.html}{$form.activity_deleted.label} | |
70 | </td> | |
71 | </tr> | |
72 | {/if} | |
73 | </table> | |
74 | </div><!-- /.crm-accordion-body --> | |
75 | </div><!-- /.crm-accordion-wrapper --> | |
76 | ||
4e126867 | 77 | <table id=case_id_{$caseid} class="nestedActivitySelector"> |
fc7d8951 DJ |
78 | <thead><tr> |
79 | <th class='crm-case-activities-date'>{ts}Date{/ts}</th> | |
80 | <th class='crm-case-activities-subject'>{ts}Subject{/ts}</th> | |
81 | <th class='crm-case-activities-type'>{ts}Type{/ts}</th> | |
82 | <th class='crm-case-activities-with'>{ts}With{/ts}</th> | |
83 | <th class='crm-case-activities-assignee'>{ts}Reporter / Assignee{/ts}</th> | |
84 | <th class='crm-case-activities-status'>{ts}Status{/ts}</th> | |
85 | <th class='crm-case-activities-status' id="nosort"> </th> | |
86 | <th class='hiddenElement'> </th> | |
87 | </tr></thead> | |
88 | </table> | |
89 | ||
90 | </div><!-- /.crm-accordion-body --> | |
91 | </div><!-- /.crm-accordion-wrapper --> | |
92 | ||
93 | {literal} | |
94 | <script type="text/javascript"> | |
3cc60a06 | 95 | CRM.$(function($) { |
4e126867 | 96 | buildCaseActivities(false,{/literal}{$caseID}{literal}); |
fc7d8951 DJ |
97 | }); |
98 | ||
4e126867 | 99 | function buildCaseActivities(filterSearch , CaseId) { |
fc7d8951 DJ |
100 | if (filterSearch) { |
101 | oTable.fnDestroy(); | |
102 | } | |
103 | var count = 0; | |
104 | var columns = ''; | |
4e126867 | 105 | var sourceUrl = {/literal}"{crmURL p='civicrm/ajax/activity' h=0 q='snippet=4&caseID='}"{literal}+CaseId; |
fc7d8951 DJ |
106 | sourceUrl = sourceUrl + '&cid={/literal}{$contactID}{literal}'; |
107 | sourceUrl = sourceUrl + '&userID={/literal}{$userID}{literal}'; | |
108 | ||
2c68626a DJ |
109 | CRM.$('#case_id_'+CaseId+' th').each(function( ) { |
110 | if (CRM.$(this).attr('id') != 'nosort') { | |
111 | columns += '{"sClass": "' + CRM.$(this).attr('class') +'"},'; | |
fc7d8951 DJ |
112 | } |
113 | else { | |
114 | columns += '{ "bSortable": false },'; | |
115 | } | |
116 | count++; | |
117 | }); | |
118 | ||
119 | columns = columns.substring(0, columns.length - 1 ); | |
120 | eval('columns =[' + columns + ']'); | |
121 | ||
2c68626a | 122 | oTable = CRM.$('#case_id_'+CaseId).dataTable({ |
fc7d8951 DJ |
123 | "bFilter" : false, |
124 | "bAutoWidth" : false, | |
125 | "aaSorting" : [], | |
126 | "aoColumns" : columns, | |
127 | "bProcessing": true, | |
128 | "bJQueryUI": true, | |
129 | "asStripClasses" : [ "odd-row", "even-row" ], | |
130 | "sPaginationType": "full_numbers", | |
131 | "sDom" : '<"crm-datatable-pager-top"lfp>rt<"crm-datatable-pager-bottom"ip>', | |
132 | "bServerSide": true, | |
133 | "sAjaxSource": sourceUrl, | |
134 | "iDisplayLength": 10, | |
4e126867 DJ |
135 | "bDestroy": true, |
136 | "fnDrawCallback": function() { setSelectorClass(CaseId); }, | |
fc7d8951 DJ |
137 | "fnServerData": function ( sSource, aoData, fnCallback ) { |
138 | ||
139 | if ( filterSearch ) { | |
140 | var activity_deleted = 0; | |
2c68626a | 141 | if ( CRM.$("#activity_deleted_"+CaseId+":checked").val() == 1 ) { |
fc7d8951 DJ |
142 | activity_deleted = 1; |
143 | } | |
144 | aoData.push( | |
2c68626a DJ |
145 | {name:'status_id', value: CRM.$("select#status_id_"+CaseId).val()}, |
146 | {name:'reporter_id', value: CRM.$("select#reporter_id_"+CaseId).val()}, | |
147 | {name:'activity_type_id', value: CRM.$("select#activity_type_filter_id_"+CaseId).val()}, | |
148 | {name:'activity_date_low', value: CRM.$("#activity_date_low_"+CaseId).val()}, | |
149 | {name:'activity_date_high', value: CRM.$("#activity_date_high_"+CaseId).val() }, | |
fc7d8951 DJ |
150 | {name:'activity_deleted', value: activity_deleted } |
151 | ); | |
152 | } | |
2c68626a | 153 | CRM.$.ajax( { |
fc7d8951 DJ |
154 | "dataType": 'json', |
155 | "type": "POST", | |
156 | "url": sSource, | |
157 | "data": aoData, | |
158 | "success": fnCallback | |
159 | } ); | |
160 | } | |
161 | }); | |
162 | } | |
163 | ||
4e126867 | 164 | function setSelectorClass(CaseId) { |
2c68626a DJ |
165 | CRM.$("#case_id_"+CaseId+" td:last-child").each( function( ) { |
166 | CRM.$(this).parent().addClass(CRM.$(this).text() ); | |
fc7d8951 DJ |
167 | }); |
168 | } | |
169 | </script> | |
3cc60a06 | 170 | {/literal} |