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 +--------------------------------------------------------------------+
10 {* Custom Data view mode*}
11 {assign var="showEdit" value=1}
12 {assign var="rowCount" value=1}
13 {foreach from=$viewCustomData item=customValues key=customGroupId}
14 {foreach from=$customValues item=cd_edit key=cvID}
15 {crmRegion name="custom-data-view-`$cd_edit.name`"}
16 {if $cd_edit.help_pre}
17 <div class="messages help">{$cd_edit.help_pre}</div>
19 {if $multiRecordDisplay neq 'single'}
20 <table class="no-border">
21 {assign var='index' value=$groupId|cat:"_$cvID"}
22 {if ($showEdit && $cd_edit.editable && $groupId) && ($editOwnCustomData or $editCustomData)}
26 href="{crmURL p="civicrm/contact/view/cd/edit" q="tableId=`$contactId`&cid=`$contactId`&groupID=`$groupId`&action=update&reset=1"}"
27 class="button" style="margin-left: 6px;"><span><i class="crm-i fa-pencil"></i> {ts 1=$cd_edit.title}Edit %1{/ts}</span></a><br/><br/>
31 {assign var="showEdit" value=0}
33 <td id="{$cd_edit.name}_{$index}" class="section-shown form-item">
34 <div class="crm-accordion-wrapper {if $cd_edit.collapse_display eq 0 or $skipTitle} {else}collapsed{/if}">
36 <div class="crm-accordion-header">
40 <div class="crm-accordion-body">
41 {if $groupId and $cvID and $editCustomData and $cd_edit.editable}
42 <div class="crm-submit-buttons">
43 <a href="#" class="crm-hover-button crm-custom-value-del"
44 data-post='{ldelim}"valueID": "{$cvID}", "groupID": "{$customGroupId}", "contactId": "{$contactId}", "key": "{crmKey name='civicrm/ajax/customvalue'}"{rdelim}'
45 title="{ts 1=$cd_edit.title|cat:" `$rowCount`"}Delete %1{/ts}">
46 <i class="crm-i fa-trash"></i> {ts}Delete{/ts}
50 {foreach from=$cd_edit.fields item=element key=field_id}
51 <table class="crm-info-panel">
53 {if $element.options_per_line != 0}
54 <td class="label">{$element.field_title}</td>
55 <td class="html-adjust">
56 {* sort by fails for option per line. Added a variable to iterate through the element array*}
57 {foreach from=$element.field_value item=val}
63 <td class="label">{$element.field_title}</td>
64 {if $element.field_data_type == 'Money'}
65 {if $element.field_type == 'Text'}
66 <td class="html-adjust">{$element.field_value|crmMoney}</td>
68 <td class="html-adjust">{$element.field_value}</td>
71 <td class="html-adjust">
72 {if $element.contact_ref_id}
73 <a href='{crmURL p="civicrm/contact/view" q="reset=1&cid=`$element.contact_ref_id`"}'>
75 {if $element.field_data_type == 'Memo'}
76 {$element.field_value|nl2br}
78 {$element.field_value}
80 {if $element.contact_ref_id}
89 {assign var="rowCount" value=$rowCount+1}
92 <div class="clear"></div>
94 <!-- end of main accordion -->
99 {foreach from=$cd_edit.fields item=element key=field_id}
100 <div class="crm-section">
101 {if $element.options_per_line != 0}
102 <div class="label">{$element.field_title}</div>
103 <div class="content">
104 {* sort by fails for option per line. Added a variable to iterate through the element array*}
105 {foreach from=$element.field_value item=val}
111 <div class="label">{$element.field_title}</div>
112 {if $element.field_type == 'File'}
113 <div class="content">
114 {if $element.field_value}
115 {$element.field_value}
121 {if $element.field_data_type == 'Money'}
122 {if $element.field_type == 'Text'}
123 <div class="content">{if $element.field_value}{$element.field_value|crmMoney}{else}<br/>{/if}</div>
125 <div class="content">{if $element.field_value}{$element.field_value}{else}<br/>{/if}</div>
128 <div class="content">
129 {if $element.contact_ref_id}
130 <a href='{crmURL p="civicrm/contact/view" q="reset=1&cid=`$element.contact_ref_id`"}'>
132 {if $element.field_data_type == 'Memo'}
133 {if $element.field_value}{$element.field_value|nl2br}{else}<br/>{/if}
135 {if $element.field_value}{$element.field_value} {else}<br/>{/if}
137 {if $element.contact_ref_id}
147 {if $cd_edit.help_post}
148 <div class="messages help">{$cd_edit.help_post}</div>
153 {*currently delete is available only for tab custom data*}
155 <script type="text/javascript">
158 // Handle delete of multi-record custom data
160 .off('.customValueDel')
161 .on('click.customValueDel', '.crm-custom-value-del', function(e) {
164 msg = '{/literal}{ts escape="js"}The record will be deleted immediately. This action cannot be undone.{/ts}{literal}';
165 CRM.confirm({title: $el.attr('title'), message: msg})
166 .on('crmConfirm:yes', function() {
167 var url = CRM.url('civicrm/ajax/customvalue');
168 var request = $.post(url, $el.data('post'))
169 .done(CRM.refreshParent($el));
170 CRM.status({success: '{/literal}{ts escape="js"}Record Deleted{/ts}{literal}'}, request);