| 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 'user'} |
| 27 | <div class="view-content"> |
| 28 | {if $pledge_rows} |
| 29 | {strip} |
| 30 | <table class="selector"> |
| 31 | <tr class="columnheader"> |
| 32 | {foreach from=$pledge_columnHeaders item=header} |
| 33 | <th>{$header.name}</th> |
| 34 | {/foreach} |
| 35 | </tr> |
| 36 | {counter start=0 skip=1 print=false} |
| 37 | {foreach from=$pledge_rows item=row} |
| 38 | <tr id='rowid{$row.pledge_id}' class="{cycle values="odd-row,even-row"} {if $row.pledge_status_name eq 'Overdue' } disabled{/if} crm-pledge crm-pledge_{$row.pledge_id} "> |
| 39 | <td class="crm-pledge-pledge_amount">{$row.pledge_amount|crmMoney:$row.pledge_currency}</td> |
| 40 | <td class="crm-pledge-pledge_total_paid">{$row.pledge_total_paid|crmMoney:$row.pledge_currency}</td> |
| 41 | <td class="crm-pledge-pledge_amount">{$row.pledge_amount-$row.pledge_total_paid|crmMoney:$row.pledge_currency}</td> |
| 42 | <td class="crm-pledge-pledge_contribution_type">{$row.pledge_financial_type}</td> |
| 43 | <td class="crm-pledge-pledge_create_date">{$row.pledge_create_date|truncate:10:''|crmDate}</td> |
| 44 | <td class="crm-pledge-pledge_next_pay_date">{$row.pledge_next_pay_date|truncate:10:''|crmDate}</td> |
| 45 | <td class="crm-pledge-pledge_next_pay_amount">{$row.pledge_next_pay_amount|crmMoney:$row.pledge_currency}</td> |
| 46 | <td class="crm-pledge-pledge_status crm-pledge-pledge_status_{$row.pledge_status}">{$row.pledge_status}</td> |
| 47 | <td>{if $row.pledge_contribution_page_id and ($row.pledge_status_name neq 'Completed') and ( $row.contact_id eq $loggedUserID ) }<a href="{crmURL p='civicrm/contribute/transact' q="reset=1&id=`$row.pledge_contribution_page_id`&pledgeId=`$row.pledge_id`"}">{ts}Make Payment{/ts}</a><br/>{/if} |
| 48 | <div id="{$row.pledge_id}_show"> |
| 49 | <a href="#" onclick="cj('#paymentDetails{$row.pledge_id}').show(); buildPaymentDetails('{$row.pledge_id}','{$row.contact_id}'); cj('#{$row.pledge_id}_show').hide();cj('#{$row.pledge_id}_hide').show();return false;"><img src="{$config->resourceBase}i/TreePlus.gif" class="action-icon" alt="{ts}open section{/ts}"/>{ts}Payments{/ts}</a> |
| 50 | </div> |
| 51 | </td> |
| 52 | </tr> |
| 53 | <tr id="{$row.pledge_id}_hide"> |
| 54 | <td colspan="11"> |
| 55 | <a href="#" onclick="cj('#{$row.pledge_id}_show').show();cj('#{$row.pledge_id}_hide').hide();return false;"><img src="{$config->resourceBase}i/TreeMinus.gif" class="action-icon" alt="{ts}open section{/ts}"/>{ts}Payments{/ts}</a> |
| 56 | <br/> |
| 57 | <div id="paymentDetails{$row.pledge_id}"></div> |
| 58 | </td> |
| 59 | </tr> |
| 60 | <script type="text/javascript"> |
| 61 | cj('#{$row.pledge_id}_hide').hide(); |
| 62 | </script> |
| 63 | {/foreach} |
| 64 | </table> |
| 65 | {/strip} |
| 66 | {else} |
| 67 | <div class="messages status no-popup"> |
| 68 | <div class="icon inform-icon"></div> |
| 69 | {ts}There are no Pledges for your record.{/ts} |
| 70 | </div> |
| 71 | {/if} |
| 72 | {*pledge row if*} |
| 73 | |
| 74 | {*Display honor block*} |
| 75 | {if $pledgeHonor && $pledgeHonorRows} |
| 76 | {strip} |
| 77 | <div id="help"> |
| 78 | <p>{ts}Pledges made in your honor.{/ts}</p> |
| 79 | </div> |
| 80 | <table class="selector"> |
| 81 | <tr class="columnheader"> |
| 82 | <th>{ts}Pledger{/ts}</th> |
| 83 | <th>{ts}Amount{/ts}</th> |
| 84 | <th>{ts}Financial Type{/ts}</th> |
| 85 | <th>{ts}Create date{/ts}</th> |
| 86 | <th>{ts}Acknowledgment Sent{/ts}</th> |
| 87 | <th>{ts}Acknowledgment Date{/ts}</th> |
| 88 | <th>{ts}Status{/ts}</th> |
| 89 | <th></th> |
| 90 | </tr> |
| 91 | {foreach from=$pledgeHonorRows item=row} |
| 92 | <tr id='rowid{$row.honorId}' class="{cycle values="odd-row,even-row"}"> |
| 93 | <td class="crm-pledge-display_name"><a href="{crmURL p="civicrm/contact/view" q="reset=1&cid=`$row.honorId`"}" id="view_contact">{$row.display_name}</a></td> |
| 94 | <td class="crm-pledge-amount">{$row.amount|crmMoney:$row.pledge_currency}</td> |
| 95 | <td class="crm-pledge-type">{$row.type}</td> |
| 96 | <td class="crm-pledge-create_date">{$row.create_date|truncate:10:''|crmDate}</td> |
| 97 | <td align="center">{if $row.acknowledge_date}{ts}Yes{/ts}{else}{ts}No{/ts}{/if}</td> |
| 98 | <td class="crm-pledge-acknowledge_date">{$row.acknowledge_date|truncate:10:''|crmDate}</td> |
| 99 | <td class="crm-pledge-status">{$row.status}</td> |
| 100 | </tr> |
| 101 | {/foreach} |
| 102 | </table> |
| 103 | {/strip} |
| 104 | {/if} |
| 105 | </div> |
| 106 | {* main if close*} |
| 107 | {/if} |
| 108 | |
| 109 | {* Build pledge payment details*} |
| 110 | {literal} |
| 111 | <script type="text/javascript"> |
| 112 | |
| 113 | function buildPaymentDetails( pledgeId, contactId ) |
| 114 | { |
| 115 | var dataUrl = {/literal}"{crmURL p='civicrm/pledge/payment' h=0 q="action=browse&context=`$context`&snippet=4&pledgeId="}"{literal} + pledgeId + '&cid=' + contactId; |
| 116 | |
| 117 | cj.ajax({ |
| 118 | url : dataUrl, |
| 119 | dataType: "html", |
| 120 | timeout : 5000, //Time in milliseconds |
| 121 | success : function( data ){ |
| 122 | cj( '#paymentDetails' + pledgeId ).html( data ); |
| 123 | }, |
| 124 | error : function( XMLHttpRequest, textStatus, errorThrown ) { |
| 125 | console.error( 'Error: '+ textStatus ); |
| 126 | } |
| 127 | }); |
| 128 | } |
| 129 | </script> |
| 130 | {/literal} |