Merge pull request #16577 from civicrm/5.23
[civicrm-core.git] / templates / CRM / Case / Audit / Audit.tpl
CommitLineData
b2603e29 1{*
2 +--------------------------------------------------------------------+
1188c7a8 3 | Copyright CiviCRM LLC. All rights reserved. |
b2603e29 4 | |
1188c7a8
TO
5 | This work is published under the GNU AGPLv3 license with some |
6 | permitted exceptions and without any warranty. For full license |
7 | and copyright information, see https://civicrm.org/licensing |
b2603e29 8 +--------------------------------------------------------------------+
9*}
10{*
11Notes:
12- Any id's should be prefixed with civicase-audit to avoid name collisions.
13- The idea behind the regex_replace is that for a css selector on a field, we can make it simple by saying the convention is to use the field label, but convert to lower case and strip out all except a-z and 0-9.
14There's the potential for collisions (two different labels having the same shortened version), but it would be odd for the user to configure fields that way, and at most affects styling as opposed to crashing or something.
15- Note the whole output gets contained within a <form> with name="Report".
16*}
17<script src="{$config->resourceBase}js/Audit/audit.js" type="text/javascript"></script>
18<link rel="stylesheet" type="text/css" href="{$config->resourceBase}css/Audit/style.css" />
19<input type="hidden" name="currentSelection" value="1" />
20
21<table class = "form-layout">
22<tr>
23 <td colspan=2>
24 &nbsp;<input type="button" accesskey="P" value="Print Report" name="case_report" onClick="printReport({$caseId}, this );"/>&nbsp;&nbsp;
25 &nbsp;<input type="button" accesskey="B" value="Back to Case" name="back" onClick="printReport({$caseId}, this );"/>&nbsp;&nbsp;
26 </td>
27</tr>
28<tr>
29<td>
30<div id="civicase-audit">
31<table><tr><td class="leftpane">
32<table class="report">
33<tr class="columnheader-dark">
34<th>&nbsp;</th>
35<th>{ts}Description{/ts}</th>
36</tr>
37{foreach from=$activities item=activity name=activityloop}
38<tr class="activity{if $smarty.foreach.activityloop.first} selected{/if}" id="civicase-audit-activity-{$smarty.foreach.activityloop.iteration}">
39 <td class="indicator">
40 {if $activity.completed}
41 <img src="{$config->resourceBase}i/spacer.gif" width="20" height="20">
42 {else}
43 <a href="#" onclick="selectActivity({$smarty.foreach.activityloop.iteration}); return false;">
44 <img src="{$config->resourceBase}i/contribute/incomplete.gif" width="20" height="20" alt="{ts}Incomplete{/ts}" title="{ts}Incomplete{/ts}">
45 </a>
46 {/if}
47 </td>
48 <td>
49 <a href="#" onclick="selectActivity({$smarty.foreach.activityloop.iteration}); return false;">
50 {foreach from=$activity.leftpane item=field name=fieldloop}
51 <span class="civicase-audit-{$field.label|lower|regex_replace:'/[^a-z0-9]+/':''} {$field.datatype}">
52 {if $field.datatype == 'File'}<a href="{$field.value|escape}">{/if}
53 {if $field.datatype == 'Date'}
54 {if $field.includeTime}
55 {$field.value|escape|replace:'T':' '|crmDate}
56 {else}
57 {$field.value|escape|truncate:10:'':true|crmDate}
58 {/if}
59 {else}
60 {$field.value|escape}
61 {/if}
62 {if $field.datatype == 'File'}</a>{/if}
63 </span><br>
64 {/foreach}
65 </a>
66 </td>
67</tr>
68{/foreach}
69</table>
70</td>
71<td class="separator">&nbsp;</td>
72<td class="rightpane">
73 <div class="rightpaneheader">
74 {foreach from=$activities item=activity name=activityloop}
75 <div class="activityheader" id="civicase-audit-header-{$smarty.foreach.activityloop.iteration}">
76 <div class="auditmenu">
77 <span class="editlink"><a target="editauditwin" href="{$activity.editurl}">{ts}Edit{/ts}</a></span>
78 </div>
79 {foreach from=$activity.rightpaneheader item=field name=fieldloop}
80 <div class="civicase-audit-{$field.label|lower|regex_replace:'/[^a-z0-9]+/':''}">
81 <label>{$field.label|escape}</label>
82 <span class="{$field.datatype}">{if $field.datatype == 'File'}<a href="{$field.value|escape}">{/if}
83 {if $field.datatype == 'Date'}
84 {if $field.includeTime}
85 {$field.value|escape|replace:'T':' '|crmDate}
86 {else}
87 {$field.value|escape|truncate:10:'':true|crmDate}
88 {/if}
89 {else}
90 {$field.value|escape}
91 {/if}
92 {if $field.datatype == 'File'}</a>{/if}
93 </span>
94 </div>
95 {/foreach}
96 </div>
97 {/foreach}
98 </div>
99 <div class="rightpanebody">
100 {foreach from=$activities item=activity name=activityloop}
101 <div class="activitybody" id="civicase-audit-body-{$smarty.foreach.activityloop.iteration}">
102 {foreach from=$activity.rightpanebody item=field name=fieldloop}
103 <div class="civicase-audit-{$field.label|lower|regex_replace:'/[^a-z0-9]+/':''}">
104 <label>{$field.label|escape}</label>
105 <span class="{$field.datatype}">{if $field.datatype == 'File'}<a href="{$field.value|escape}">{/if}
106 {if $field.datatype == 'Date'}
107 {if $field.includeTime}
108 {$field.value|escape|replace:'T':' '|crmDate}
109 {else}
110 {$field.value|escape|truncate:10:'':true|crmDate}
111 {/if}
112 {elseif $field.label eq 'Details'}
113 {$field.value}
114 {else}
115 {$field.value|escape}
116 {/if}
117 {if $field.datatype == 'File'}</a>{/if}
118 </span>
119 </div>
120 {/foreach}
121 </div>
122 {/foreach}
123 </div>
124</td></tr></table>
125</div>
126</td>
127</tr>
128<tr>
129 <td colspan=2>
130 &nbsp;<input type="button" accesskey="P" value="Print Report" name="case_report" onclick="printReport({$caseId}, this );"/>&nbsp;&nbsp;
131 &nbsp;<input type="button" accesskey="B" value="Back to Case" name="back" onClick="printReport({$caseId}, this );"/>&nbsp;&nbsp;
132 </td>
133</tr>
134</table>
135{literal}
136<script type="text/javascript">
137 function printReport( id, button ) {
138
139 if ( button.name == 'case_report' ) {
140 var dataUrl = {/literal}"{crmURL p='civicrm/case/report/print' h=0 q='caseID='}"{literal}+id;
8838f818 141 dataUrl = dataUrl + '&cid={/literal}{$clientID}{literal}&asn=' + {/literal}{$activitySetName|@json_encode}{literal};
b2603e29 142 var redact = '{/literal}{$_isRedact}{literal}'
143
144 var isRedact = 1;
145 if ( redact == 'false' ) {
146 isRedact = 0;
147 }
148
149 var includeActivities = '{/literal}{$includeActivities}{literal}';
150 var all = 0;
151 if( includeActivities == 'All' ) {
152 all = 1;
153 }
154
155 dataUrl = dataUrl + '&redact='+isRedact + '&all='+ all;
156
157 } else {
158
159 var dataUrl = {/literal}"{crmURL p='civicrm/contact/view/case' h=0 q='reset=1&action=view&id='}"{literal}+id;
160 dataUrl = dataUrl + '&cid={/literal}{$clientID}{literal}'+'&selectedChild=case';
161 }
162
f4af7a1e 163 window.location.href = dataUrl;
b2603e29 164}
165</script>
166{/literal}