Merge pull request #5898 from monishdeb/master
[civicrm-core.git] / templates / CRM / Event / Form / Search / Common.tpl
index 7bd688cfabaf29112602f1fbfeaafc1af0b6e43a..fa72a9f4f595066f96e8df33473c150a4a081acb 100644 (file)
@@ -1,8 +1,8 @@
 {*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.5                                                |
+ | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014                                |
+ | Copyright CiviCRM LLC (c) 2004-2015                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
 *}
 <tr>
   <td class="crm-event-form-block-event_id">
-      {$form.event_id.label}  <br />{$form.event_id.html|crmAddClass:huge} <br/>
-      {$form.event_include_repeating_events.label}&nbsp;&nbsp;{$form.event_include_repeating_events.html}
+      {$form.event_id.label}  <br />{$form.event_id.html|crmAddClass:huge}
+      <div class="crm-event-form-block-event_include_repeating_events">
+        {$form.event_include_repeating_events.label}&nbsp;&nbsp;{$form.event_include_repeating_events.html}
+      </div>
   </td>
   <td class="crm-event-form-block-event_type_id"> {$form.event_type_id.label}<br />{$form.event_type_id.html} </td>
 </tr>
 {include file="CRM/Core/DateRange.tpl" fieldName="event" from='_start_date_low' to='_end_date_high'}
 </tr>
 <tr>
-  <td class="crm-event-form-block-participant_status"><label>{ts}Participant Status{/ts}</label>
+  <td class="crm-event-form-block-participant_status"><label>{$form.participant_status_id.label}</label>
     <br />
-    <div class="listing-box" style="width: auto; height: 120px">
-    {foreach from=$form.participant_status_id item="participant_status_val"}
-      <div class="{cycle values="odd-row,even-row"}">
-        {$participant_status_val.html}
-      </div>
-    {/foreach}
-    </div>
+    {$form.participant_status_id.html}
   </td>
-  <td class="crm-event-form-block-participant_role_id"><label>{ts}Participant Role{/ts}</label>
+  <td class="crm-event-form-block-participant_role_id"><label>{$form.participant_role_id.label}</label>
     <br />
-    <div class="listing-box" style="width: auto; height: 120px">
-    {foreach from=$form.participant_role_id item="participant_role_id_val"}
-      <div class="{cycle values="odd-row,even-row"}">
-        {$participant_role_id_val.html}
-      </div>
-    {/foreach}
-    </div><br />
+    {$form.participant_role_id.html}
   </td>
 </tr>
 <tr>
@@ -64,7 +54,7 @@
     &nbsp; {$form.participant_test.html}
   </td>
   <td class="crm-event-form-block-participant_pay_later">
-  {$form.participant_pay_later.label} {$form.participant_pay_later.html}
+  {$form.participant_is_pay_later.label} {$form.participant_is_pay_later.html}
   </td>
 </tr>
 <tr>
@@ -93,6 +83,26 @@ campaignTrClass='' campaignTdClass='crm-event-form-block-participant_campaign_id
 {literal}
 <script type="text/javascript">
 CRM.$(function($) {
+  var recurringLabel = $('label[for=event_include_repeating_events]').html();
+  // Conditional rule for recurring checkbox
+  function toggleRecurrigCheckbox() {
+    var isRepeating = false;
+    if ($(this).val()) {
+      // Workaround: In some cases this code gets called before the select2 initialization.
+      if (!$(this).data('select2')) {
+        $(this).crmEntityRef();
+      }
+      isRepeating = $(this).select2('data').extra.is_recur;
+    }
+    if (isRepeating) {
+      $('.crm-event-form-block-event_include_repeating_events').show();
+      $('label[for=event_include_repeating_events]').html(recurringLabel.replace('%1', $(this).select2('data').label));
+    } else {
+      $('.crm-event-form-block-event_include_repeating_events').hide().find('input').prop('checked', false);
+    }
+  }
+  $('#event_id').each(toggleRecurrigCheckbox).change(toggleRecurrigCheckbox);
+
   // FIXME: This could be much simpler as an entityRef field but the priceFieldValue api doesn't currently support the filters we need
   $('#participant_fee_id').crmSelect2({
     placeholder: {/literal}'{ts escape="js"}- any -{/ts}'{literal},