Commit | Line | Data |
---|---|---|
6a488035 TO |
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 | {if $context EQ 'Search'} | |
27 | {include file="CRM/common/pager.tpl" location="top"} | |
28 | {/if} | |
29 | ||
30 | {capture assign=iconURL}<img src="{$config->resourceBase}i/TreePlus.gif" alt="{ts}open section{/ts}"/>{/capture} | |
31 | {ts 1=$iconURL}Click %1 to view pledge payments.{/ts} | |
32 | {strip} | |
33 | <table class="selector"> | |
34 | <thead class="sticky"> | |
35 | {if ! $single and $context eq 'Search' } | |
36 | <th scope="col" title="Select Rows">{$form.toggleSelect.html}</th> | |
37 | {/if} | |
38 | {if $single} | |
39 | <th></th> | |
40 | {/if} | |
41 | {foreach from=$columnHeaders item=header} | |
42 | <th scope="col"> | |
43 | {if $header.sort} | |
44 | {assign var='key' value=$header.sort} | |
45 | {$sort->_response.$key.link} | |
46 | {else} | |
47 | {$header.name} | |
48 | {/if} | |
49 | </th> | |
50 | {/foreach} | |
51 | </thead> | |
52 | {counter start=0 skip=1 print=false} | |
53 | {foreach from=$rows item=row} | |
54 | {cycle values="odd-row,even-row" assign=rowClass} | |
55 | <tr id='rowid{$row.pledge_id}' class='{$rowClass} {if $row.pledge_status_name eq 'Overdue' } status-overdue{/if}'> | |
56 | {if $context eq 'Search' } | |
57 | {assign var=cbName value=$row.checkbox} | |
58 | <td>{$form.$cbName.html}</td> | |
59 | {/if} | |
60 | <td> | |
61 | {if ! $single } | |
62 | {$row.contact_type}<br/> | |
63 | {/if} | |
64 | <span id="{$row.pledge_id}_show"> | |
65 | <a href="#" onclick="cj('#paymentDetails{$row.pledge_id},#minus{$row.pledge_id}_hide,#{$row.pledge_id}_hide').show(); | |
66 | buildPaymentDetails('{$row.pledge_id}','{$row.contact_id}'); | |
67 | cj('#{$row.pledge_id}_show').hide(); | |
68 | return false;"><img src="{$config->resourceBase}i/TreePlus.gif" class="action-icon" alt="{ts}open section{/ts}"/></a> | |
69 | </span> | |
70 | <span id="minus{$row.pledge_id}_hide"> | |
71 | <a href="#" onclick="cj('#paymentDetails{$row.pledge_id},#{$row.pledge_id}_hide,#minus{$row.pledge_id}_hide').hide(); | |
72 | cj('#{$row.pledge_id}_show').show(); | |
73 | return false;"><img src="{$config->resourceBase}i/TreeMinus.gif" class="action-icon" alt="{ts}open section{/ts}"/></a> | |
74 | </span> | |
75 | </td> | |
76 | {if ! $single } | |
77 | <td><a href="{crmURL p='civicrm/contact/view' q="reset=1&cid=`$row.contact_id`"}">{$row.sort_name}</a></td> | |
78 | {/if} | |
79 | <td class="right">{$row.pledge_amount|crmMoney:$row.pledge_currency}</td> | |
80 | <td class="right">{$row.pledge_total_paid|crmMoney:$row.pledge_currency}</td> | |
81 | <td class="right">{$row.pledge_amount-$row.pledge_total_paid|crmMoney:$row.pledge_currency}</td> | |
6d3864ef | 82 | <td>{$row.pledge_financial_type}</td> |
6a488035 TO |
83 | <td>{$row.pledge_create_date|truncate:10:''|crmDate}</td> |
84 | <td>{$row.pledge_next_pay_date|truncate:10:''|crmDate}</td> | |
85 | <td class="right">{$row.pledge_next_pay_amount|crmMoney:$row.pledge_currency}</td> | |
86 | <td>{$row.pledge_status}</td> | |
87 | <td>{$row.action|replace:'xx':$row.pledge_id}</td> | |
88 | </tr> | |
89 | <tr id="{$row.pledge_id}_hide" class='{$rowClass}'> | |
90 | <td style="border-right: none;"></td> | |
91 | <td colspan= {if $context EQ 'Search'} "10" {else} "8" {/if} class="enclosingNested" id="paymentDetails{$row.pledge_id}"> </td> | |
92 | </tr> | |
93 | <script type="text/javascript"> | |
94 | cj('#{$row.pledge_id}_hide').hide(); | |
95 | cj('#minus{$row.pledge_id}_hide').hide(); | |
96 | </script> | |
97 | {/foreach} | |
98 | ||
99 | {* Dashboard only lists 10 most recent pledges. *} | |
100 | {if $context EQ 'dashboard' and $limit and $pager->_totalItems GT $limit } | |
101 | <tr class="even-row"> | |
102 | <td colspan="10"><a href="{crmURL p='civicrm/pledge/search' q='reset=1'}">» {ts}Find more pledges{/ts}... </a></td> | |
103 | </tr> | |
104 | {/if} | |
105 | ||
106 | </table> | |
107 | {/strip} | |
108 | ||
109 | {if $context EQ 'Search'} | |
110 | <script type="text/javascript"> | |
111 | {* this function is called to change the color of selected row(s) *} | |
112 | var fname = "{$form.formName}"; | |
113 | on_load_init_checkboxes(fname); | |
114 | </script> | |
115 | {/if} | |
116 | ||
117 | {if $context EQ 'Search'} | |
118 | {include file="CRM/common/pager.tpl" location="bottom"} | |
119 | {/if} | |
120 | ||
121 | {* Build pledge payment details*} | |
122 | {literal} | |
123 | <script type="text/javascript"> | |
124 | ||
125 | function buildPaymentDetails( pledgeId, contactId ) | |
126 | { | |
127 | var dataUrl = {/literal}"{crmURL p='civicrm/pledge/payment' h=0 q="action=browse&snippet=4&context=`$context`&pledgeId="}"{literal} + pledgeId + '&cid=' + contactId; | |
128 | ||
129 | cj.ajax({ | |
130 | url : dataUrl, | |
131 | dataType: "html", | |
132 | timeout : 5000, //Time in milliseconds | |
133 | success : function( data ){ | |
134 | cj( '#paymentDetails' + pledgeId ).html( data ); | |
135 | }, | |
136 | error : function( XMLHttpRequest, textStatus, errorThrown ) { | |
137 | console.error( 'Error: '+ textStatus ); | |
138 | } | |
139 | }); | |
140 | } | |
141 | </script> | |
142 | {/literal} |