| 1 | {* |
| 2 | +--------------------------------------------------------------------+ |
| 3 | | CiviCRM version 4.5 | |
| 4 | +--------------------------------------------------------------------+ |
| 5 | | Copyright CiviCRM LLC (c) 2004-2014 | |
| 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 | {assign var=caseid value=$caseID} |
| 47 | <span class="crm-button"><input class="crm-form-submit default" name="_qf_Basic_refresh" value="Search" type="button" onclick="buildCaseActivities( true,{$caseid} )"; /></span> |
| 48 | </td> |
| 49 | </tr> |
| 50 | <tr> |
| 51 | <td class="crm-case-caseview-form-block-activity_date_low"> |
| 52 | {assign var=activitylow value=activity_date_low_$caseID} |
| 53 | {$form.$activitylow.label}<br /> |
| 54 | {include file="CRM/common/jcalendar.tpl" elementName=$activitylow} |
| 55 | </td> |
| 56 | <td class="crm-case-caseview-form-block-activity_date_high"> |
| 57 | {assign var=activityhigh value=activity_date_high_$caseID} |
| 58 | {$form.$activityhigh.label}<br /> |
| 59 | {include file="CRM/common/jcalendar.tpl" elementName=$activityhigh} |
| 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 | |
| 77 | <table id=case_id_{$caseid} class="nestedActivitySelector"> |
| 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"> |
| 95 | CRM.$(function($) { |
| 96 | buildCaseActivities(false,{/literal}{$caseID}{literal}); |
| 97 | }); |
| 98 | |
| 99 | function buildCaseActivities(filterSearch , CaseId) { |
| 100 | if (filterSearch) { |
| 101 | oTable.fnDestroy(); |
| 102 | } |
| 103 | var count = 0; |
| 104 | var columns = ''; |
| 105 | var sourceUrl = {/literal}"{crmURL p='civicrm/ajax/activity' h=0 q='snippet=4&caseID='}"{literal}+CaseId; |
| 106 | sourceUrl = sourceUrl + '&cid={/literal}{$contactID}{literal}'; |
| 107 | sourceUrl = sourceUrl + '&userID={/literal}{$userID}{literal}'; |
| 108 | |
| 109 | CRM.$('#case_id_'+CaseId+' th').each(function( ) { |
| 110 | if (CRM.$(this).attr('id') != 'nosort') { |
| 111 | columns += '{"sClass": "' + CRM.$(this).attr('class') +'"},'; |
| 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 | |
| 122 | oTable = CRM.$('#case_id_'+CaseId).dataTable({ |
| 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, |
| 135 | "bDestroy": true, |
| 136 | "fnDrawCallback": function() { setSelectorClass(CaseId); }, |
| 137 | "fnServerData": function ( sSource, aoData, fnCallback ) { |
| 138 | |
| 139 | if ( filterSearch ) { |
| 140 | var activity_deleted = 0; |
| 141 | if ( CRM.$("#activity_deleted_"+CaseId+":checked").val() == 1 ) { |
| 142 | activity_deleted = 1; |
| 143 | } |
| 144 | aoData.push( |
| 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() }, |
| 150 | {name:'activity_deleted', value: activity_deleted } |
| 151 | ); |
| 152 | } |
| 153 | CRM.$.ajax( { |
| 154 | "dataType": 'json', |
| 155 | "type": "POST", |
| 156 | "url": sSource, |
| 157 | "data": aoData, |
| 158 | "success": fnCallback |
| 159 | } ); |
| 160 | } |
| 161 | }); |
| 162 | } |
| 163 | |
| 164 | function setSelectorClass(CaseId) { |
| 165 | CRM.$("#case_id_"+CaseId+" td:last-child").each( function( ) { |
| 166 | CRM.$(this).parent().addClass(CRM.$(this).text() ); |
| 167 | }); |
| 168 | } |
| 169 | </script> |
| 170 | {/literal} |