2 +--------------------------------------------------------------------+
3 | Copyright CiviCRM LLC. All rights reserved. |
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 |
8 +--------------------------------------------------------------------+
11 {if $dontShowTitle neq 1}<h1>{ts}{$customGroupTitle}{/ts}</h1>{/if}
12 {if $pageViewType eq 'customDataView'}
13 {assign var='dialogId' value='custom-record-dialog'}
15 {assign var='dialogId' value='profile-dialog'}
17 {if ($records and $headers) or ($pageViewType eq 'customDataView')}
18 {include file="CRM/common/jsortable.tpl"}
19 <div id="custom-{$customGroupId}-table-wrapper" {if $pageViewType eq 'customDataView'}class="crm-entity" data-entity="contact" data-id="{$contactId}"{/if}>
22 <table id="records-{$customGroupId}" class={if $pageViewType eq 'customDataView'}"crm-multifield-selector crm-ajax-table"{else}'display'{/if}>
24 {if $pageViewType eq 'customDataView'}
25 {foreach from=$headers key=recId item=head}
26 <th data-data={ts}'{$headerAttr.$recId.columnName}'{/ts}
27 {if !empty($headerAttr.$recId.dataType)}cell-data-type="{$headerAttr.$recId.dataType}"{/if}
28 {if !empty($headerAttr.$recId.dataEmptyOption)}cell-data-empty-option="{$headerAttr.$recId.dataEmptyOption}"{/if}>{ts}{$head}{/ts}
31 <th data-data="action" data-orderable="false"> </th>
34 <script type="text/javascript">
36 var ZeroRecordText = {/literal}'{ts 1=$customGroupTitle|escape}No records of type \'%1\' found.{/ts}'{literal};
37 var $table = $('#records-' + {/literal}'{$customGroupId}'{literal});
38 $('table.crm-multifield-selector').data({
40 "url": {/literal}'{crmURL p="civicrm/ajax/multirecordfieldlist" h=0 q="snippet=4&cid=$contactId&cgid=$customGroupId"}'{literal},
43 "emptyTable": ZeroRecordText,
45 //Add class attributes to cells
46 "rowCallback": function(row, data) {
47 $('thead th', $table).each(function(index) {
48 var fName = $(this).attr('data-data');
49 var cell = $('td:eq(' + index + ')', row);
50 if (typeof data[fName] == 'object') {
51 if (typeof data[fName].data != 'undefined') {
52 $(cell).html(data[fName].data);
54 if (typeof data[fName].cellClass != 'undefined') {
55 $(cell).attr('class', data[fName].cellClass);
66 {foreach from=$headers key=recId item=head}
67 <th>{ts}{$head}{/ts}</th>
70 {foreach from=$dateFields key=fieldId item=v}
71 <th class='hiddenElement'></th>
75 {foreach from=$records key=recId item=rows}
76 <tr class="{cycle values="odd-row,even-row"}">
77 {foreach from=$headers key=hrecId item=head}
78 <td {crmAttributes a=$attributes.$hrecId.$recId}>{$rows.$hrecId}</td>
80 <td>{$rows.action}</td>
81 {foreach from=$dateFieldsVals key=fid item=rec}
82 <td class='crm-field-{$fid}_date hiddenElement'>{$rec.$recId}</td>
91 <div id='{$dialogId}' class="hiddenElement"></div>
93 <div class="messages status no-popup">
94 <div class="icon inform-icon"></div>
96 {ts 1=$customGroupTitle}No records of type '%1' found.{/ts}
98 <div id='{$dialogId}' class="hiddenElement"></div>
102 <div class="action-link">
103 {if $pageViewType eq 'customDataView'}
104 <br/><a accesskey="N" title="{ts 1=$customGroupTitle}Add %1 Record{/ts}" href="{crmURL p='civicrm/contact/view/cd/edit' q="reset=1&type=$ctype&groupID=$customGroupId&entityID=$contactId&cgcount=$newCgCount&multiRecordDisplay=single&mode=add"}"
105 class="button action-item"><span><i class="crm-i fa-plus-circle" aria-hidden="true"></i> {ts 1=$customGroupTitle}Add %1 Record{/ts}</span></a>
107 <a accesskey="N" href="{crmURL p='civicrm/profile/edit' q="reset=1&id=`$contactId`&multiRecord=add&gid=`$gid`&context=multiProfileDialog&onPopupClose=`$onPopupClose`"}"
108 class="button action-item"><span><i class="crm-i fa-plus-circle" aria-hidden="true"></i> {ts}Add New Record{/ts}</span></a>