Merge pull request #9503 from agh1/same-match-honoree
[civicrm-core.git] / templates / CRM / Profile / Page / MultipleRecordFieldsListing.tpl
1 {*
2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.7 |
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2017 |
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 $showListing}
27 {if $dontShowTitle neq 1}<h1>{ts}{$customGroupTitle}{/ts}</h1>{/if}
28 {if $pageViewType eq 'customDataView'}
29 {assign var='dialogId' value='custom-record-dialog'}
30 {else}
31 {assign var='dialogId' value='profile-dialog'}
32 {/if}
33 {if ($records and $headers) or ($pageViewType eq 'customDataView')}
34 {include file="CRM/common/jsortable.tpl"}
35 <div id="custom-{$customGroupId}-table-wrapper" {if $pageViewType eq 'customDataView'}class="crm-entity" data-entity="contact" data-id="{$contactId}"{/if}>
36 <div>
37 {strip}
38 <table id="records-{$customGroupId}" class={if $pageViewType eq 'customDataView'}"crm-multifield-selector crm-ajax-table"{else}'display'{/if}>
39 <thead>
40 {if $pageViewType eq 'customDataView'}
41 {foreach from=$headers key=recId item=head}
42 <th data-data={ts}'{$headerAttr.$recId.columnName}'{/ts}
43 {if !empty($headerAttr.$recId.dataType)}cell-data-type="{$headerAttr.$recId.dataType}"{/if}
44 {if !empty($headerAttr.$recId.dataEmptyOption)}cell-data-empty-option="{$headerAttr.$recId.dataEmptyOption}"{/if}>{ts}{$head}{/ts}
45 </th>
46 {/foreach}
47 <th data-data="action" data-orderable="false">&nbsp;</th>
48 </thead>
49 {literal}
50 <script type="text/javascript">
51 (function($) {
52 var ZeroRecordText = {/literal}'{ts 1=$customGroupTitle}No records of type \'%1\' found.{/ts}'{literal};
53 var $table = $('#records-' + {/literal}'{$customGroupId}'{literal});
54 $('table.crm-multifield-selector').data({
55 "ajax": {
56 "url": {/literal}'{crmURL p="civicrm/ajax/multirecordfieldlist" h=0 q="snippet=4&cid=$contactId&cgid=$customGroupId"}'{literal},
57 },
58 "language": {
59 "emptyTable": ZeroRecordText,
60 },
61 //Add class attributes to cells
62 "rowCallback": function(row, data) {
63 $('thead th', $table).each(function(index) {
64 var fName = $(this).attr('data-data');
65 var cell = $('td:eq(' + index + ')', row);
66 if (typeof data[fName] == 'object') {
67 if (typeof data[fName].data != 'undefined') {
68 $(cell).html(data[fName].data);
69 }
70 if (typeof data[fName].cellClass != 'undefined') {
71 $(cell).attr('class', data[fName].cellClass);
72 }
73 }
74 });
75 },
76 })
77 })(CRM.$);
78 </script>
79 {/literal}
80
81 {else}
82 {foreach from=$headers key=recId item=head}
83 <th>{ts}{$head}{/ts}</th>
84 {/foreach}
85
86 {foreach from=$dateFields key=fieldId item=v}
87 <th class='hiddenElement'></th>
88 {/foreach}
89 <th>&nbsp;</th>
90 </thead>
91 {foreach from=$records key=recId item=rows}
92 <tr class="{cycle values="odd-row,even-row"}">
93 {foreach from=$headers key=hrecId item=head}
94 <td {crmAttributes a=$attributes.$hrecId.$recId}>{$rows.$hrecId}</td>
95 {/foreach}
96 <td>{$rows.action}</td>
97 {foreach from=$dateFieldsVals key=fid item=rec}
98 <td class='crm-field-{$fid}_date hiddenElement'>{$rec.$recId}</td>
99 {/foreach}
100 </tr>
101 {/foreach}
102 {/if}
103 </table>
104 {/strip}
105 </div>
106 </div>
107 <div id='{$dialogId}' class="hiddenElement"></div>
108 {elseif !$records}
109 <div class="messages status no-popup">
110 <div class="icon inform-icon"></div>
111 &nbsp;
112 {ts 1=$customGroupTitle}No records of type '%1' found.{/ts}
113 </div>
114 <div id='{$dialogId}' class="hiddenElement"></div>
115 {/if}
116
117 {if !$reachedMax}
118 <div class="action-link">
119 {if $pageViewType eq 'customDataView'}
120 <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"}"
121 class="button action-item"><span><i class="crm-i fa-plus-circle"></i> {ts 1=$customGroupTitle}Add %1 Record{/ts}</span></a>
122 {else}
123 <a accesskey="N" href="{crmURL p='civicrm/profile/edit' q="reset=1&id=`$contactId`&multiRecord=add&gid=`$gid`&context=multiProfileDialog&onPopupClose=`$onPopupClose`"}"
124 class="button action-item"><span><i class="crm-i fa-plus-circle"></i> {ts}Add New Record{/ts}</span></a>
125 {/if}
126 </div>
127 <br />
128 {/if}
129 {/if}