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