CRM-13973
authorPratik Joshi <pratik.joshi@webaccess.co.in>
Thu, 16 Jan 2014 08:09:00 +0000 (13:39 +0530)
committerPratik Joshi <pratik.joshi@webaccess.co.in>
Thu, 16 Jan 2014 08:09:00 +0000 (13:39 +0530)
templates/CRM/Contribute/Page/PaymentInfo.tpl
templates/CRM/Event/Form/EventFees.tpl
templates/CRM/Event/Form/ParticipantFeeSelection.tpl
templates/CRM/Event/Form/ParticipantView.tpl
templates/CRM/Price/Form/Calculate.tpl
templates/CRM/Price/Form/PriceSet.tpl

index 444250e3548febb07dda392f286ef189cd73b482..c8c10339da227afc7703057e64804467a45cbda6 100644 (file)
 *}
 {if $show eq 'event-payment'}
 {literal}
-  <script type='text/javascript'>
-    var dataUrl = {/literal}'{crmURL p="civicrm/payment/view" h=0 q="action=browse&id=$participantId&cid=`$contactId`&component=event&context=payment_info&snippet=4"}'{literal};
-    cj.ajax({
-      url: dataUrl,
-      async: false,
-      success: function(html) {
-        cj("#payment-info").html(html);
-      }
-    });
-  </script>
+<script type='text/javascript'>
+cj(function($){
+  var dataUrl = {/literal}'{crmURL p="civicrm/payment/view" h=0 q="action=browse&id=$participantId&cid=`$contactId`&component=event&context=payment_info&snippet=4"}'{literal};
+  cj.ajax({
+     url: dataUrl,
+     async: false,
+     success: function(html) {
+       cj("#payment-info").html(html);
+     }
+   });
+
+  cj('.total_amount-section').remove();
+});
+</script>
 {/literal}
 {/if}
 {if $context eq 'payment_info'}
index 60423c019031aba60b6adb523bee150ce6a9af6d..bc8e961ea5d58de1b80a66ea84a7e23a65d966df 100644 (file)
       {if $action eq 2 and $hasPayment} {* Updating *}
             {if $lineItem}
                 <tr class="crm-event-eventfees-form-block-line_items">
-                    <td class="label">{ts}Event Fees{/ts}</td>
+                    <td class="label">{ts}Selections{/ts}</td>
                     <td>{include file="CRM/Price/Page/LineItem.tpl" context="Event"}</td>
                 </tr>
+                <tr>
+                  <td></td>
+                  <td>
+                    <a class="button" href='{crmURL p="civicrm/event/participant/feeselection" q="reset=1&id=`$participantId`&cid=`$contactId`&action=update"}' title="{ts}Change Selections{/ts}"><span><div class="icon edit-icon"></div> {ts}Change Selections{/ts}</span></a>
+                  </td>
+                </tr>
             {else}
                 <tr class="crm-event-eventfees-form-block-event_level">
                     <td class="label">{ts}Event Level{/ts}</td>
index ea9641b0692e734e683755711a66bdd0f1adf6a6..731047a6259a51d2e6ef440634e4022b7e8fdc38 100644 (file)
  +--------------------------------------------------------------------+
 *}
 {* This template is used to change selections of fees for a participant *}
-   
+{literal}
+<script type='text/javascript'>
+function display(totalfee) {
+  // totalfee is monetary, round it to 2 decimal points so it can
+  // go as a float - CRM-13491
+  totalfee = Math.round(totalfee*100)/100;
+  // note : some variables used used here are global variables defined inside Calculate.tpl
+  var totalEventFee  = formatMoney( totalfee, 2, seperator, thousandMarker);
+  document.getElementById('pricevalue').innerHTML = "<b>"+symbol+"</b> "+totalEventFee;
+  scriptfee   = totalfee;
+  scriptarray = price;
+  cj('#total_amount').val( totalfee );
+  ( totalfee < 0 ) ? cj('table#pricelabel').addClass('disabled') : cj('table#pricelabel').removeClass('disabled');
+
+  // populate the balance amount div
+  populatebalanceFee();
+}
+
+function populatebalanceFee() {
+  // calculate the balance amount using total paid and updated amount
+  var updatedFeeUnFormatted = cj('#pricevalue').text();
+  var updatedAmt = parseFloat(updatedFeeUnFormatted.replace(/[^0-9-.]/g, ''));
+  var balanceAmt = updatedAmt - CRM.feePaid;
+  balanceAmt = formatMoney(balanceAmt, 2, seperator, thousandMarker);
+  cj('#balance-fee').text(symbol+" "+balanceAmt);
+}
+
+{/literal}
+</script>
 <h3>Change Registration Selections</h3>
 
 <div class="crm-block crm-form-block crm-payment-form-block">
@@ -53,8 +81,8 @@
       <table class='form-layout'>
         <tr class="crm-event-eventfees-form-block-price_set_amount">
           <td class="label" style="padding-top: 10px;">{$form.amount.label}</td>
-          <td class="view-value"><table class="form-layout">{include file="CRM/Price/Form/PriceSet.tpl" extends="Event"}</table></td>
-        </tr>  
+          <td class="view-value"><table class="form-layout">{include file="CRM/Price/Form/PriceSet.tpl" extends="Event" dontInclCal="true"}</table></td>
+        </tr>
      {if $paymentInfo}
        <tr><td></td><td>
          <div class='crm-section'> 
@@ -64,7 +92,7 @@
          </div>
          <div class='label'><strong>{ts}Balance Owed{/ts}</strong></div><div id='balance-fee' class='content'></div>
           </div>
-       {include file='CRM/Price/Form/Calculate.tpl' currencySymbol=$currencySymbol noCalcValueDisplay='false'}
+       {include file='CRM/Price/Form/Calculate.tpl' currencySymbol=$currencySymbol noCalcValueDisplay='false' displayOveride='true'}
        {/if}    
       </table>
     </fieldset>
 </div>
 {literal}
 <script type='text/javascript'>
-cj(function(){
+cj(function($){
   cj('.total_amount-section').remove();
-  cj('#pricevalue').val().trigger('populatebalanceFee');
-
-  function populatebalanceFee() {
-    console.log('dd');
-    // calculate the balance amount using total paid and updated amount
-    var updatedFeeUnFormatted = cj('#pricevalue').val();
-    var updatedAmt = parseFloat(updatedFeeUnFormatted.replace(/[^0-9-.]/g, ''));
-    var balanceAmt = updatedAmt - CRM.feePaid;
-    balanceAmt = formatMoney(balanceAmt, 2, seperator, thousandMarker);
-    cj('#balance-fee').val(balanceAmt);
-  }
 });
 </script>
 {/literal}
\ No newline at end of file
index b889f590e88584a3f6da95e90359eb254f8bdf65..192ba558049cfbe4c99d1f923aed28cf386cf8ea 100644 (file)
     {if $fee_level}
         <tr class="crm-event-participantview-form-block-fee_amount">
             {if $lineItem}
-                <td class="label">{ts}Event Fees{/ts}</td>
-                <td>{include file="CRM/Price/Page/LineItem.tpl" context="Event"}</td>
+                <td class="label">{ts}Selections{/ts}</td>
+                <td>{include file="CRM/Price/Page/LineItem.tpl" context="Event"}
+                   <a class="button" href='{crmURL p="civicrm/event/participant/feeselection" q="reset=1&id=`$participantId`&cid=`$contactId`&action=update"}' title="{ts}Change Selections{/ts}"><span><div class="icon edit-icon"></div> {ts}Change Selections{/ts}</span></a>
+                </td>
             {else}
                 <td class="label">{ts}Event Level{/ts}</td>
                 <td>{$fee_level}&nbsp;{if $fee_amount}- {$fee_amount|crmMoney:$fee_currency}{/if}</td>
index d8397508c31f6fc466e0d1d1cfc50c2819f73b01..93034f213d9bd1ea9e7fc37cafaf044016212c81 100644 (file)
@@ -198,7 +198,9 @@ function calculateText( object ) {
     }
   display( totalfee );
 }
-
+{/literal}
+{if $displayOveride neq 'true'}
+{literal}
 //display calculated amount
 function display( totalfee ) {
     // totalfee is monetary, round it to 2 decimal points so it can
@@ -213,7 +215,9 @@ function display( totalfee ) {
     ( totalfee < 0 ) ? cj('table#pricelabel').addClass('disabled') : cj('table#pricelabel').removeClass('disabled');
 
 }
-
+{/literal}
+{/if}
+{literal}
 //money formatting/localization
 function formatMoney (amount, c, d, t) {
 var n = amount,
index ab303bf782b48d2ae4711396d96374bdf0176a33..a54cd488facc9728c5615e8a1ad7ae6a85a3a245 100644 (file)
@@ -65,7 +65,7 @@
                 <div class="content {$element.name}-content">{$form.$element_name.html}
                   {if $element.is_display_amounts && $element.html_type eq 'Text'}
                     <span class="price-field-amount">
-                      {foreach item=option from=$element.options}{$option.amount|crmMoney}{/foreach}
+                      {foreach item=option from=$element.options}{$option.amount|crmMoney}{/foreach}
                     </span>
                   {/if}
                       {if $element.help_post}<br /><span class="description">{$element.help_post}</span>{/if}
@@ -82,8 +82,7 @@
     {/if}
 
 {* Include the total calculation widget if this is NOT a quickconfig event/contribution page. *}
-{if !$quickConfig}
+{if !$quickConfig and !$dontInclCal}
     {include file="CRM/Price/Form/Calculate.tpl"}
 {/if}
-
-</div>
+</div>
\ No newline at end of file