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 <div class="view-content view-contact-groups">
12 <div class="messages status no-popup">
13 <div class="icon inform-icon"></div>
14 {ts}This contact does not currently belong to any groups.{/ts}
17 {include file="CRM/common/jsortable.tpl"}
20 {* Include 'add to new group' form if session has edit contact permissions *}
21 {if $permission EQ 'edit'}
22 {include file="CRM/Contact/Form/GroupContact.tpl"}
26 <div class="ht-one"></div>
27 <h3>{ts}Regular Groups{/ts}</h3>
28 <div class="description">{ts 1=$displayName}%1 has joined or been added to these group(s).{/ts}</div>
30 <table id="current_group" class="display">
33 <th>{ts}Group{/ts}</th>
34 <th>{ts}Status{/ts}</th>
35 <th>{ts}Date Added{/ts}</th>
39 {foreach from=$groupIn item=row}
40 <tr id="group_contact-{$row.id}" class="crm-entity {cycle values="odd-row,even-row"}">
42 <a href="{crmURL p='civicrm/group/search' q="reset=1&force=1&context=smog&gid=`$row.group_id`"}">
46 <td>{ts 1=$row.in_method}Added (by %1){/ts}</td>
47 <td>{$row.in_date|crmDate}</td>
49 {if $permission EQ 'edit'}
50 <a class="action-item crm-hover-button" href="#Removed" title="{ts 1=$displayName 2=$row.title}Remove %1 from %2? (status in this group will be changed to 'Removed').{/ts}">
52 <a class="action-item crm-hover-button" href="#Deleted" title="{ts 1=$displayName 2=$row.title}Delete %1 from %2? (remove contact AND delete their record of having been in this group).{/ts}">
62 {if $contactSmartGroupSettings neq 3}
63 <div class="spacer" style="height: 1.5em;"></div>
64 <div class="accordion ui-accordion ui-widget ui-helper-reset">
65 <div class="crm-accordion-wrapper crm-ajax-accordion crm-smartgroup-accordion {if $contactSmartGroupSettings eq 1}collapsed{/if}">
66 <div class="crm-accordion-header" id="crm-contact_smartgroup" contact_id="{$contactId}">
69 <!-- /.crm-accordion-header -->
70 <div class="crm-accordion-body">
71 <div class="crm-contact_smartgroup" style="min-height: 3em;"></div>
73 <!-- /.crm-accordion-body -->
75 <!-- /.crm-accordion-wrapper -->
80 <div class="ht-one"></div>
81 <h3 class="status-pending">{ts}Pending{/ts}</h3>
82 <div class="description">{ts}Joining these group(s) is pending confirmation by this contact.{/ts}</div>
84 <table id="pending_group" class="display">
87 <th>{ts}Group{/ts}</th>
88 <th>{ts}Status{/ts}</th>
89 <th>{ts}Date Pending{/ts}</th>
93 {foreach from=$groupPending item=row}
94 <tr id="group_contact-{$row.id}" class="crm-entity {cycle values="odd-row,even-row"}">
96 <a href="{crmURL p='civicrm/group/search' q="reset=1&force=1&context=smog&gid=`$row.group_id`"}">
100 <td>{ts 1=$row.pending_method}Pending (by %1){/ts}</td>
101 <td>{$row.pending_date|crmDate}</td>
103 {if $permission EQ 'edit'}
104 <a class="action-item crm-hover-button" href="#Removed" title="{ts 1=$displayName 2=$row.title}Remove %1 from %2? (status in this group will be changed to 'Removed').{/ts}">
106 <a class="action-item crm-hover-button" href="#Deleted" title="{ts 1=$displayName 2=$row.title}Delete %1 from %2? (this group will no longer be listed under Pending Groups){/ts}">
117 <div class="ht-one"></div>
118 <h3 class="status-removed">{ts}Past Groups{/ts}</h3>
119 <div class="description">{ts 1=$displayName}%1 is no longer part of these group(s).{/ts}</div>
121 <table id="past_group" class="display">
124 <th>{ts}Group{/ts}</th>
125 <th>{ts}Status{/ts}</th>
126 <th>{ts}Date Added{/ts}</th>
127 <th>{ts}Date Removed{/ts}</th>
131 {foreach from=$groupOut item=row}
132 <tr id="group_contact-{$row.id}" class="crm-entity {cycle values="odd-row,even-row"}">
134 <a href="{crmURL p='civicrm/group/search' q="reset=1&force=1&context=smog&gid=`$row.group_id`"}">
138 <td class="status-removed">{ts 1=$row.out_method}Removed (by %1){/ts}</td>
139 <td data-order="{$row.date_added}">{$row.date_added|crmDate}</td>
140 <td data-order="{$row.out_date}">{$row.out_date|crmDate}</td>
141 <td>{if $permission EQ 'edit'}
142 <a class="action-item crm-hover-button" href="#Added" title="{ts 1=$displayName 2=$row.title}Add %1 back into %2?{/ts}">
143 {ts}Rejoin Group{/ts}</a>
144 <a class="action-item crm-hover-button" href="#Deleted" title="{ts 1=$displayName 2=$row.title}Delete %1 from %2? (this group will no longer be listed under Past Groups).{/ts}">
145 {ts}Delete{/ts}</a>{/if}
156 <script type="text/javascript">
158 // load panes function calls for snippet based on id of crm-accordion-header
159 function loadPanes() {
160 var $el = $(this).parent().find('div.crm-contact_smartgroup');
161 var contactId = $(this).attr('contact_id');
163 CRM.loadPage(CRM.url('civicrm/contact/view/smartgroup', {cid: contactId}), {target: $el});
166 // bind first click of accordion header to load crm-accordion-body with snippet
167 $('.view-contact-groups .crm-ajax-accordion.collapsed .crm-accordion-header').one('click', loadPanes);
168 $('.view-contact-groups .crm-ajax-accordion:not(.collapsed) .crm-accordion-header').each(loadPanes);
169 // Handle enable/delete links
172 CRM.refreshParent(that);
174 function enableDisableGroup() {
176 id: $(that).closest('.crm-entity').attr('id').split('-')[1],
179 var status = that.href.split('#')[1];
180 if (status === 'Deleted') {
181 params.skip_undelete = true;
183 params.status = status;
185 // This api is weird - 'delete' actually works for updating as well as deleting
186 // Normally you wouldn't put a variable within ts() but this works due to smarty hack below
187 CRM.api3('group_contact', 'delete', params, {success: ts(status)}).done(refresh);
189 $('.view-contact-groups a.action-item').click(function() {
191 CRM.confirm(enableDisableGroup, {message: this.title});
196 // Hack to ensure status msg is properly translated
197 CRM.strings.Added = "{ts escape='js'}Added{/ts}";
198 CRM.strings.Removed = "{ts escape='js'}Removed{/ts}";
199 CRM.strings.Deleted = "{ts escape='js'}Deleted{/ts}";