Import from SVN (r45945, r596)
[civicrm-core.git] / templates / CRM / Contact / Page / View / Relationship.tpl
1 {*
2 +--------------------------------------------------------------------+
3 | CiviCRM version 4.3 |
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 </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 NOT ($currentRelationships or $inactiveRelationships) }
118
119 {if $action NEQ 1} {* show 'no relationships' message - unless already in 'add' mode. *}
120 <div class="messages status no-popup">
121 <div class="icon inform-icon"></div>
122 {capture assign=crmURL}{crmURL p='civicrm/contact/view/rel' q="cid=`$contactId`&action=add&reset=1"}{/capture}
123 {if $permission EQ 'edit'}
124 {ts 1=$crmURL}There are no Relationships entered for this contact. You can <a accesskey="N" href='%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 {/if}
133 </div>
134 <div class="spacer"></div>
135
136 {* start of code to show inactive relationships *}
137 {if $inactiveRelationships}
138 {* show browse table for any action *}
139 <div id="inactive-relationships">
140 <p></p>
141 <div class="label font-red">{ts}Inactive Relationships{/ts}</div>
142 <div class="description">{ts}These relationships are Disabled OR have a past End Date.{/ts}</div>
143 {strip}
144 <table id="inactive_relationship" class="display">
145 <thead>
146 <tr>
147 <th>{ts}Relationship{/ts}</th>
148 <th></th>
149 <th>{ts}City{/ts}</th>
150 <th>{ts}State/Prov{/ts}</th>
151 <th>{ts}Phone{/ts}</th>
152 <th id="dis-end_date">{ts}End Date{/ts}</th>
153 <th></th>
154 <th class="hiddenElement"></th>
155 </tr>
156 </thead>
157 {foreach from=$inactiveRelationships item=rel}
158 {assign var = "rtype" value = "" }
159 {if $rel.contact_a > 0 }
160 {assign var = "rtype" value = "b_a" }
161 {else}
162 {assign var = "rtype" value = "a_b" }
163 {/if}
164 <tr id="rel_{$rel.id}" class="{cycle values="odd-row,even-row"}">
165 <td class="bold">{$rel.relation}</td>
166 <td><a href="{crmURL p='civicrm/contact/view' q="reset=1&cid=`$rel.cid`"}">{$rel.name}</a></td>
167 <td>{$rel.city}</td>
168 <td>{$rel.state}</td>
169 <td>{$rel.phone}</td>
170 <td>{$rel.end_date}</td>
171 <td class="nowrap">{$rel.action|replace:'xx':$rel.id}</td>
172 <td class="dis-end_date hiddenElement">{$rel.end_date|crmDate}</td>
173 </tr>
174 {/foreach}
175 </table>
176 {/strip}
177 </div>
178 {/if}
179
180 {* end of code to show inactive relationships *}
181
182
183 </div>
184 {/if} {* close of custom data else*}
185
186 {if !empty($searchRows) }
187 {*include custom data js file*}
188 {include file="CRM/common/customData.tpl"}
189 {/if}