Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | {* |
2 | +--------------------------------------------------------------------+ | |
819d0d41 | 3 | | CiviCRM version 4.5 | |
6a488035 | 4 | +--------------------------------------------------------------------+ |
819d0d41 | 5 | | Copyright CiviCRM LLC (c) 2004-2014 | |
6a488035 TO |
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 | {if $context EQ 'Search'} | |
27 | {include file="CRM/common/pager.tpl" location="top"} | |
28 | {/if} | |
29 | {strip} | |
30 | <table class="caseSelector"> | |
31 | <tr class="columnheader"> | |
32 | ||
33 | {if ! $single and $context eq 'Search' } | |
34 | <th scope="col" title="Select Rows">{$form.toggleSelect.html}</th> | |
35 | {/if} | |
36 | ||
37 | {if $single} | |
38 | <th scope="col">{ts}ID{/ts}</th> | |
39 | {else} | |
40 | <th></th> | |
41 | {/if} | |
42 | ||
43 | {foreach from=$columnHeaders item=header} | |
44 | <th scope="col"> | |
45 | {if $header.sort} | |
46 | {assign var='key' value=$header.sort} | |
47 | {$sort->_response.$key.link} | |
48 | {else} | |
49 | {$header.name} | |
50 | {/if} | |
51 | </th> | |
52 | {/foreach} | |
53 | </tr> | |
54 | ||
55 | {counter start=0 skip=1 print=false} | |
56 | {foreach from=$rows item=row} | |
57 | ||
58 | <tr id='rowid{$list}{$row.case_id}' class="{cycle values="odd-row,even-row"} crm-case crm-case-status_{$row.case_status_id} crm-case-type_{$row.case_type_id}"> | |
59 | {if $context eq 'Search' && !$single} | |
60 | {assign var=cbName value=$row.checkbox} | |
61 | <td>{$form.$cbName.html}</td> | |
62 | {/if} | |
63 | {if $single } | |
64 | <td class="crm-case-id crm-case-id_{$row.case_id}">{$row.case_id}</td> | |
65 | {/if} | |
66 | {if $context != 'case'} | |
67 | <td class="crm-case-id crm-case-id_{$row.case_id}"> | |
68 | <span id="{$list}{$row.case_id}_show"> | |
69 | <a href="#" onclick="cj('#caseDetails{$list}{$row.case_id}').show(); | |
70 | buildCaseDetails('{$list}{$row.case_id}','{$row.contact_id}'); | |
71 | cj('#{$list}{$row.case_id}_show').hide(); | |
72 | cj('#minus{$list}{$row.case_id}_hide').show(); | |
73 | cj('#{$list}{$row.case_id}_hide').show(); | |
74 | return false;"><img src="{$config->resourceBase}i/TreePlus.gif" class="action-icon" alt="{ts}open section{/ts}"/></a> | |
75 | </span> | |
76 | <span id="minus{$list}{$row.case_id}_hide"> | |
77 | <a href="#" onclick="cj('#caseDetails{$list}{$row.case_id}').hide(); | |
78 | cj('#{$list}{$row.case_id}_show').show(); | |
79 | cj('#{$list}{$row.case_id}_hide').hide(); | |
80 | cj('#minus{$list}{$row.case_id}_hide').hide(); | |
81 | return false;"><img src="{$config->resourceBase}i/TreeMinus.gif" class="action-icon" alt="{ts}open section{/ts}"/></a> | |
82 | </td> | |
83 | {/if} | |
84 | ||
85 | {if !$single} | |
86 | <td class="crm-case-id crm-case-id_{$row.case_id}"><a href="{crmURL p='civicrm/contact/view' q="reset=1&cid=`$row.contact_id`"}" title="{ts}view contact details{/ts}">{$row.sort_name}</a>{if $row.phone}<br /><span class="description">{$row.phone}</span>{/if}<br /><span class="description">{ts}Case ID{/ts}: {$row.case_id}</span></td> | |
87 | {/if} | |
88 | ||
89 | <td class="crm-case-subject">{$row.case_subject}</td> | |
90 | <td class="{$row.class} crm-case-status_{$row.case_status}">{$row.case_status}</td> | |
91 | <td class="crm-case-case_type">{$row.case_type}</td> | |
92 | <td class="crm-case-case_role">{if $row.case_role}{$row.case_role}{else}---{/if}</td> | |
93 | <td class="crm-case-case_manager">{if $row.casemanager_id}<a href="{crmURL p='civicrm/contact/view' q="reset=1&cid=`$row.casemanager_id`"}">{$row.casemanager}</a>{else}---{/if}</td> | |
94 | <td class="crm-case-case_recent_activity_type">{if $row.case_recent_activity_type} | |
95 | {$row.case_recent_activity_type}<br />{$row.case_recent_activity_date|crmDate}{else}---{/if}</td> | |
96 | <td class="crm-case-case_scheduled_activity_type">{if $row.case_scheduled_activity_type} | |
97 | {$row.case_scheduled_activity_type}<br />{$row.case_scheduled_activity_date|crmDate}{else}---{/if}</td> | |
98 | <td>{$row.action|replace:'xx':$row.case_id}{$row.moreActions|replace:'xx':$row.case_id}</td> | |
99 | </tr> | |
100 | {if $context != 'case'} | |
101 | <tr id="{$list}{$row.case_id}_hide" class='{$rowClass}'> | |
102 | <td> | |
103 | </td> | |
104 | {if $context EQ 'Search'} | |
105 | <td colspan="10" class="enclosingNested"> | |
106 | {else} | |
107 | <td colspan="9" class="enclosingNested"> | |
108 | {/if} | |
109 | <div id="caseDetails{$list}{$row.case_id}"></div> | |
110 | </td> | |
111 | </tr> | |
112 | <script type="text/javascript"> | |
113 | cj('#{$list}{$row.case_id}_hide').hide(); | |
114 | cj('#minus{$list}{$row.case_id}_hide').hide(); | |
115 | </script> | |
116 | {/if} | |
117 | {/foreach} | |
118 | ||
119 | {* Dashboard only lists 10 most recent cases. *} | |
120 | {if $context EQ 'dashboard' and $limit and $pager->_totalItems GT $limit } | |
121 | <tr class="even-row"> | |
122 | <td colspan="10"><a href="{crmURL p='civicrm/case/search' q='reset=1'}">» {ts}Find more cases{/ts}... </a></td> | |
123 | </tr> | |
124 | {/if} | |
125 | ||
126 | </table> | |
127 | {/strip} | |
128 | ||
6a488035 TO |
129 | {if $context EQ 'Search'} |
130 | {include file="CRM/common/pager.tpl" location="bottom"} | |
131 | {/if} | |
132 | ||
133 | {* Build case details*} | |
134 | {literal} | |
135 | <script type="text/javascript"> | |
136 | ||
137 | function buildCaseDetails( caseId, contactId ) | |
138 | { | |
139 | var dataUrl = {/literal}"{crmURL p='civicrm/case/details' h=0 q='snippet=4&caseId='}{literal}" + caseId +'&cid=' + contactId; | |
140 | cj.ajax({ | |
141 | url : dataUrl, | |
142 | dataType: "html", | |
143 | timeout : 5000, //Time in milliseconds | |
144 | success : function( data ){ | |
145 | cj( '#caseDetails' + caseId ).html( data ); | |
146 | }, | |
147 | error : function( XMLHttpRequest, textStatus, errorThrown ) { | |
148 | console.error( 'Error: '+ textStatus ); | |
149 | } | |
150 | }); | |
151 | } | |
152 | </script> | |
153 | ||
154 | {/literal} |