Merge pull request #2546 from brylie/master
[civicrm-core.git] / templates / CRM / Contact / Page / View / Relationship.tpl
1 {*
2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.4 |
4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC (c) 2004-2013 |
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 {* Relationship tab within View Contact - browse, and view relationships for a contact *}
27 {if !empty($cdType) }
28 {include file="CRM/Custom/Form/CustomData.tpl"}
29 {elseif $action neq 16} {* add, update or view *}
30 {include file="CRM/Contact/Form/Relationship.tpl"}
31 {else}
32 <div class="view-content">
33 <div class="crm-block crm-content-block">
34 {if $permission EQ 'edit'}
35 <div class="action-link">
36 <a accesskey="N" href="{crmURL p='civicrm/contact/view/rel' q="cid=`$contactId`&action=add&reset=1"}" class="button"><span><div class="icon add-icon"></div>{ts}Add Relationship{/ts}</span></a>
37 </div>
38 {/if}
39 {include file="CRM/common/jsortable.tpl" useAjax=0}
40 {* start of code to show current relationships *}
41 {if $currentRelationships}
42 {* show browse table for any action *}
43 <div id="current-relationships">
44 {if $relationshipTabContext} {*to show the title and links only when viewed from relationship tab, not from dashboard*}
45 <h3>{ts}Current Relationships{/ts}</h3>
46 {/if}
47 {strip}
48 <table id="current_relationship" class="display">
49 <thead>
50 <tr>
51 <th>{ts}Relationship{/ts}</th>
52 <th></th>
53 <th id="start_date">{ts}Start{/ts}</th>
54 <th id="end_date">{ts}End{/ts}</th>
55 <th>{ts}City{/ts}</th>
56 <th>{ts}State/Prov{/ts}</th>
57 <th>{ts}Email{/ts}</th>
58 <th>{ts}Phone{/ts}</th>
59 <th></th>
60 <th class="hiddenElement"></th>
61 <th class="hiddenElement"></th>
62 </tr>
63 </thead>
64 {foreach from=$currentRelationships item=rel}
65 {*assign var = "rtype" value = "" }
66 {if $rel.contact_a eq $contactId }
67 {assign var = "rtype" value = "a_b" }
68 {else}
69 {assign var = "rtype" value = "b_a" }
70 {/if*}
71
72 <tr id="relationship-{$rel.id}" class="crm-entity {cycle values="odd-row,even-row"} row-relationship {if $rel.is_permission_a_b eq 1 or $rel.is_permission_b_a eq 1}row-highlight{/if}">
73
74 {if $relationshipTabContext}
75 <td class="bold">
76 <a href="{crmURL p='civicrm/contact/view/rel' q="action=view&reset=1&selectedChild=rel&cid=`$contactId`&id=`$rel.id`&rtype=`$rel.rtype`"}">{$rel.relation}</a>
77 {if ($rel.cid eq $rel.contact_id_a and $rel.is_permission_a_b eq 1) OR
78 ($rel.cid eq $rel.contact_id_b and $rel.is_permission_b_a eq 1) }
79 <span id="permission-b-a" class="crm-marker permission-relationship"> *</span>
80 {/if}
81 {if $rel.description}<p class='description'>{$rel.description}</p>{/if}
82 </td>
83 <td>
84 <a href="{crmURL p='civicrm/contact/view' q="action=view&reset=1&cid=`$rel.cid`"}">{$rel.name}</a>
85 {if ($contactId eq $rel.contact_id_a and $rel.is_permission_a_b eq 1) OR
86 ($contactId eq $rel.contact_id_b and $rel.is_permission_b_a eq 1) }
87 <span id="permission-a-b" class="crm-marker permission-relationship"> *</span>
88 {/if}
89 </td>
90 {else}
91 <td class="bold">{$rel.relation}</strong></td>
92 <td>{$rel.name}</td>
93 {/if}
94 <td class="crm-rel-start_date">{$rel.start_date}</td>
95 <td class="crm-rel-end_date">{$rel.end_date}</td>
96 <td>{$rel.city}</td>
97 <td>{$rel.state}</td>
98 <td>{$rel.email}</td>
99 <td>{$rel.phone}</td>
100 <td class="nowrap">{$rel.action|replace:'xx':$rel.id}</td>
101 <td class="start_date hiddenElement">{$rel.start_date|crmDate}</td>
102 <td class="end_date hiddenElement">{$rel.end_date|crmDate}</td>
103 </tr>
104 {/foreach}
105 </table>
106 {/strip}
107 </div>
108
109 {if $relationshipTabContext}
110 <div id="permission-legend" class="crm-content-block">
111 <span class="crm-marker">* </span>{ts}Indicates a permissioned relationship. This contact can be viewed and updated by the other.{/ts}
112 </div>
113 {/if}
114 {/if}
115 {* end of code to show current relationships *}
116
117 {if $currentRelationships or $inactiveRelationships}
118 {include file="CRM/common/enableDisableApi.tpl"}
119 {else}
120 <div class="messages status no-popup">
121 <div class="icon inform-icon"></div>
122 {capture assign=link}accesskey="N" class="action-item action-item-first" href="{crmURL p='civicrm/contact/view/rel' q="cid=`$contactId`&action=add&reset=1"}"{/capture}
123 {if $permission EQ 'edit'}
124 {ts 1=$link}There are no Relationships entered for this contact. You can <a %1>add one</a>.{/ts}
125 {elseif ! $relationshipTabContext}
126 {ts}There are no related contacts / organizations on record for you.{/ts}
127 {else}
128 {ts}There are no Relationships entered for this contact.{/ts}
129 {/if}
130 </div>
131 {/if}
132 </div>
133 <div class="spacer"></div>
134
135 {* start of code to show inactive relationships *}
136 {if $inactiveRelationships}
137 {* show browse table for any action *}
138 <div id="inactive-relationships">
139 <p></p>
140 <div class="label font-red">{ts}Inactive Relationships{/ts}</div>
141 <div class="description">{ts}These relationships are Disabled OR have a past End Date.{/ts}</div>
142 {strip}
143 <table id="inactive_relationship" class="display">
144 <thead>
145 <tr>
146 <th>{ts}Relationship{/ts}</th>
147 <th></th>
148 <th id="dis-start_date">{ts}Start{/ts}</th>
149 <th id="dis-end_date">{ts}End{/ts}</th>
150 <th>{ts}City{/ts}</th>
151 <th>{ts}State/Prov{/ts}</th>
152 <th>{ts}Email{/ts}</th>
153 <th>{ts}Phone{/ts}</th>
154 <th></th>
155 <th class="hiddenElement"></th>
156 <th class="hiddenElement"></th>
157 </tr>
158 </thead>
159 {foreach from=$inactiveRelationships item=rel}
160 {assign var = "rtype" value = "" }
161 {if $rel.contact_a > 0 }
162 {assign var = "rtype" value = "b_a" }
163 {else}
164 {assign var = "rtype" value = "a_b" }
165 {/if}
166 <tr id="relationship-{$rel.id}" class="crm-entity {cycle values="odd-row,even-row"}">
167 <td class="bold">
168 {$rel.relation}
169 {if $rel.description}<p class='description'>{$rel.description}</p>{/if}
170 </td>
171 <td><a href="{crmURL p='civicrm/contact/view' q="reset=1&cid=`$rel.cid`"}">{$rel.name}</a></td>
172 <td class="dis-crm-rel-start_date">{$rel.start_date}</td>
173 <td class="dis-crm-rel-end_date">{$rel.end_date}</td>
174 <td>{$rel.city}</td>
175 <td>{$rel.state}</td>
176 <td>{$rel.email}</td>
177 <td>{$rel.phone}</td>
178 <td class="nowrap">{$rel.action|replace:'xx':$rel.id}</td>
179 <td class="dis-start_date hiddenElement">{$rel.start_date|crmDate}</td>
180 <td class="dis-end_date hiddenElement">{$rel.end_date|crmDate}</td>
181 </tr>
182 {/foreach}
183 </table>
184 {/strip}
185 </div>
186 {/if}
187
188 {* end of code to show inactive relationships *}
189
190
191 </div>
192 {/if} {* close of custom data else*}
193
194 {if !empty($searchRows) }
195 {*include custom data js file*}
196 {include file="CRM/common/customData.tpl"}
197 {/if}