VAT-645 Display billing address fields on pay later option.
[civicrm-core.git] / templates / CRM / Contribute / Form / Contribution / Main.tpl
index 9d1b101a69858717f060ed567788051b3830cbbc..ea79486c8ee2737c1300c928961b47ea0ccc7e78 100644 (file)
@@ -1,8 +1,8 @@
 {*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.4                                                |
+ | CiviCRM version 4.5                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013                                |
+ | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
  | see the CiviCRM license FAQ at http://civicrm.org/licensing        |
  +--------------------------------------------------------------------+
 *}
+{* Callback snippet: On-behalf profile *}
+{if $snippet and !empty($isOnBehalfCallback)}
+  {include file="CRM/Contribute/Form/Contribution/OnBehalfOf.tpl" context="front-end"}
 
 {* Callback snippet: Load payment processor *}
-{if $snippet}
+{elseif $snippet}
 {include file="CRM/Core/BillingBlock.tpl" context="front-end"}
   {if $is_monetary}
   {* Put PayPal Express button after customPost block since it's the submit button in this case. *}
         {$form.frequency_unit.html}
       {/if}
       {if $is_recur_installments}
+        <span id="recur_installments_num">
         {ts}for{/ts} {$form.installments.html} {$form.installments.label}
+        </span>
       {/if}
+      <div id="recurHelp" class="description">
+                               {ts}Your recurring contribution will be processed automatically.{/ts}
+                               {if $is_recur_installments}
+                                       {ts}You can specify the number of installments, or you can leave the number of installments blank if you want to make an open-ended commitment. In either case, you can choose to cancel at any time.{/ts}
+                               {/if}
+        {if $is_email_receipt}
+          {ts}You will receive an email receipt for each recurring contribution.{/ts}
+        {/if}
+      </div>
     </div>
     <div class="clear"></div>
   </div>
 
   {if $is_for_organization}
   <div id='onBehalfOfOrg' class="crm-section">
-    {include file=CRM/Contribute/Form/Contribution/OnBehalfOf.tpl}
+    {include file="CRM/Contribute/Form/Contribution/OnBehalfOf.tpl"}
   </div>
   {/if}
 
 
   {if $honor_block_is_active}
   <fieldset class="crm-group honor_block-group">
-    <legend>{$honor_block_title}</legend>
-    <div class="crm-section honor_block_text-section">
-      {$honor_block_text}
-    </div>
-    {if $form.honor_type_id.html}
-      <div class="crm-section {$form.honor_type_id.name}-section">
-        <div class="content" >
-          {$form.honor_type_id.html}
-          <span class="crm-clear-link">(<a href="#" title="unselect" onclick="unselectRadio('honor_type_id', '{$form.formName}');enableHonorType(); return false;">{ts}clear{/ts}</a>)</span>
-          <div class="description">{ts}Select an option to reveal honoree information fields.{/ts}</div>
-        </div>
-      </div>
-    {/if}
+    {include file="CRM/Contribute/Form/SoftCredit.tpl"}
     <div id="honorType" class="honoree-name-email-section">
-      <div class="crm-section {$form.honor_prefix_id.name}-section">
-        <div class="content">{$form.honor_prefix_id.html}</div>
-      </div>
-      <div class="crm-section {$form.honor_first_name.name}-section">
-        <div class="label">{$form.honor_first_name.label}</div>
-        <div class="content">
-          {$form.honor_first_name.html}
-        </div>
-        <div class="clear"></div>
-      </div>
-      <div class="crm-section {$form.honor_last_name.name}-section">
-        <div class="label">{$form.honor_last_name.label}</div>
-        <div class="content">
-          {$form.honor_last_name.html}
-        </div>
-        <div class="clear"></div>
-      </div>
-      <div id="honorTypeEmail" class="crm-section {$form.honor_email.name}-section">
-        <div class="label">{$form.honor_email.label}</div>
-        <div class="content">
-          {$form.honor_email.html}
-        </div>
-        <div class="clear"></div>
-      </div>
+      {include file="CRM/UF/Form/Block.tpl" fields=$honoreeProfileFields mode=8 prefix='honor'}
     </div>
   </fieldset>
   {/if}
 
   <div id="billing-payment-block">
     {* If we have a payment processor, load it - otherwise it happens via ajax *}
-    {if $ppType}
+    {if $ppType or $isBillingAddressRequiredForPayLater}
       {include file="CRM/Contribute/Form/Contribution/Main.tpl" snippet=4}
     {/if}
   </div>
   {elseif $onBehalfRequired}
     showOnBehalf(true);
   {/if}
-
-  {if $honor_block_is_active AND $form.honor_type_id.html}
-    enableHonorType();
-  {/if}
   {literal}
 
+       cj('input[name="soft_credit_type_id"]').on('change', function() {
+               enableHonorType();
+       });
+       
   function enableHonorType( ) {
-    var element = document.getElementsByName("honor_type_id");
-    for (var i = 0; i < element.length; i++ ) {
-      var isHonor = false;
-      if ( element[i].checked == true ) {
-        var isHonor = true;
-        break;
-      }
-    }
-    if ( isHonor ) {
+    var selectedValue = cj('input[name="soft_credit_type_id"]:checked'); 
+    if ( selectedValue.val() > 0) {
       cj('#honorType').show();
-      cj('#honorTypeEmail').show();
     }
     else {
-      document.getElementById('honor_first_name').value = '';
-      document.getElementById('honor_last_name').value  = '';
-      document.getElementById('honor_email').value      = '';
-      document.getElementById('honor_prefix_id').value  = '';
       cj('#honorType').hide();
-      cj('#honorTypeEmail').hide();
     }
   }
 
+       cj('input[id="is_recur"]').on('change', function() {
+               showRecurHelp();
+       });
+
+  function showRecurHelp( ) {
+    var showHelp = cj('input[id="is_recur"]:checked'); 
+    if ( showHelp.val() > 0) {
+      cj('#recurHelp').show();
+    }
+    else {
+      cj('#recurHelp').hide();
+    }
+  }
+       
   function pcpAnonymous( ) {
     // clear nickname field if anonymous is true
     if (document.getElementsByName("pcp_is_anonymous")[1].checked) {
     toggleConfirmButton();
   });
 
-  cj(function() {
+  CRM.$(function($) {
     toggleConfirmButton();
+               enableHonorType();
+               showRecurHelp();
   });
 
   function showHidePayPalExpressOption() {
     }
   }
 
-  cj(function(){
+  CRM.$(function($) {
     // highlight price sets
     function updatePriceSetHighlight() {
       cj('#priceset .price-set-row').removeClass('highlight');