Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | {* |
2 | +--------------------------------------------------------------------+ | |
2c4c49ca | 3 | | CiviCRM version 4.7 | |
6a488035 | 4 | +--------------------------------------------------------------------+ |
e7112fa7 | 5 | | Copyright CiviCRM LLC (c) 2004-2015 | |
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 $showListing} | |
e41f4660 PJ |
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} | |
f8c36033 | 33 | {if $records and $headers} |
6a488035 | 34 | {include file="CRM/common/jsortable.tpl"} |
4411002f | 35 | <div id="custom-{$customGroupId}-table-wrapper" {if $pageViewType eq 'customDataView'}class="crm-entity" data-entity="contact" data-id="{$contactId}"{/if}> |
f8c36033 | 36 | <div> |
6a488035 | 37 | {strip} |
5a2c7bb9 | 38 | <table id="records" class={if $pageViewType eq 'customDataView'}"crm-multifield-selector"{else}'display'{/if}> |
f8c36033 | 39 | <thead> |
7253f198 | 40 | <tr> |
f8c36033 KJ |
41 | {foreach from=$headers key=recId item=head} |
42 | <th>{ts}{$head}{/ts}</th> | |
7253f198 | 43 | {/foreach} |
f8c36033 | 44 | <th></th> |
b05a0fb6 PJ |
45 | {foreach from=$dateFields key=fieldId item=v} |
46 | <th class='hiddenElement'></th> | |
47 | {/foreach} | |
7253f198 | 48 | </tr> |
f8c36033 | 49 | </thead> |
5a2c7bb9 | 50 | {if $pageViewType eq 'customDataView'} |
51 | {literal} | |
52 | <script type="text/javascript"> | |
53 | CRM.$(function($) { | |
54 | var sourceUrl = {/literal}'{crmURL p="civicrm/ajax/multirecordfieldlist" h=0 q="snippet=4&cid=$contactId&cgid=$customGroupId"}'{literal}; | |
55 | ||
56 | $('table.crm-multifield-selector').dataTable({ | |
57 | "bProcessing": true, | |
58 | "aaSorting": [], | |
59 | "asStripClasses" : [ "odd-row", "even-row" ], | |
60 | "sPaginationType": "full_numbers", | |
61 | "sDom" : '<"crm-datatable-pager-top"lfp>rt<"crm-datatable-pager-bottom"ip>', | |
62 | "bServerSide": true, | |
63 | "sAjaxSource": sourceUrl, | |
64 | }); | |
65 | ||
66 | $(".crm-multifield-selector").on('click','.delete-custom-row', function (e) { | |
67 | var $el = $(this); | |
68 | CRM.confirm({ | |
69 | message: '{/literal}{ts escape='js'}Are you sure you want to delete this record?{/ts}{literal}' | |
70 | }).on('crmConfirm:yes', function() { | |
71 | var postUrl = {/literal}"{crmURL p='civicrm/ajax/customvalue' h=0 }"{literal}; | |
72 | var request = $.post(postUrl, $el.data('delete_params')); | |
73 | CRM.status({/literal}"{ts escape='js'}Record Deleted{/ts}"{literal}, request); | |
74 | request.done(function() { | |
75 | CRM.refreshParent($el); | |
76 | }); | |
77 | }) | |
78 | e.preventDefault(); | |
79 | }); | |
80 | }); | |
81 | </script> | |
82 | {/literal} | |
83 | {else} | |
84 | {foreach from=$records key=recId item=rows} | |
85 | <tr class="{cycle values="odd-row,even-row"}"> | |
86 | {foreach from=$headers key=hrecId item=head} | |
87 | <td {crmAttributes a=$attributes.$hrecId.$recId}>{$rows.$hrecId}</td> | |
88 | {/foreach} | |
89 | <td>{$rows.action}</td> | |
90 | {foreach from=$dateFieldsVals key=fid item=rec} | |
91 | <td class='crm-field-{$fid}_date hiddenElement'>{$rec.$recId}</td> | |
92 | {/foreach} | |
93 | </tr> | |
94 | {/foreach} | |
95 | {/if} | |
6a488035 TO |
96 | </table> |
97 | {/strip} | |
6a488035 | 98 | </div> |
f8c36033 | 99 | </div> |
e41f4660 | 100 | <div id='{$dialogId}' class="hiddenElement"></div> |
f8c36033 KJ |
101 | {elseif !$records} |
102 | <div class="messages status no-popup"> | |
103 | <div class="icon inform-icon"></div> | |
104 | | |
e5e3f1ad | 105 | {ts 1=$customGroupTitle}No records of type '%1' found.{/ts} |
f8c36033 | 106 | </div> |
e41f4660 | 107 | <div id='{$dialogId}' class="hiddenElement"></div> |
f8c36033 | 108 | {/if} |
6a488035 | 109 | |
f8c36033 | 110 | {if !$reachedMax} |
4da822ca EM |
111 | <div class="action-link"> |
112 | {if $pageViewType eq 'customDataView'} | |
113 | <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=$cgcount&multiRecordDisplay=single&mode=add"}" | |
a2c70872 | 114 | class="button action-item"><span><i class="crm-i fa-plus-circle"></i> {ts 1=$customGroupTitle}Add %1 Record{/ts}</span></a> |
4da822ca EM |
115 | {else} |
116 | <a accesskey="N" href="{crmURL p='civicrm/profile/edit' q="reset=1&id=`$contactId`&multiRecord=add&gid=`$gid`&context=multiProfileDialog&onPopupClose=`$onPopupClose`"}" | |
a2c70872 | 117 | class="button action-item"><span><i class="crm-i fa-plus-circle"></i> {ts}Add New Record{/ts}</span></a> |
4da822ca EM |
118 | {/if} |
119 | </div> | |
120 | <br /> | |
f8c36033 | 121 | {/if} |
3cc60a06 | 122 | {/if} |