Update cascade type for all the events option
authorunknown <priyanka.karan26@gmail.com>
Thu, 4 Sep 2014 17:42:48 +0000 (18:42 +0100)
committerdeepak-srivastava <deepak.srivastava.0303@gmail.com>
Fri, 3 Oct 2014 08:55:15 +0000 (09:55 +0100)
templates/CRM/Event/Form/ConfirmSubmit.tpl

index 531d7cd5e2dcd9871ea1a7bc8929b30fecbc7ab1..bfcb4cc8e4f46b37bd8c579fa16cc7993f08de39 100644 (file)
               <div style="width:30%;float:left;">
                   <button class="dialog-button only-this-event">Only this Event</button>
               </div>
-              <div style="width:70%;float:left;">All other events in the series will remain same</div></div>
+              <div style="width:70%;float:left;">All other events in the series will remain same</div>
+          </div>
           <div style="display:inline-block;width:100%;">
               <div style="width:30%;float:left;">
                   <button class="dialog-button this-and-all-following-event">This and Following Events</button>
               </div>
               <div style="width:70%;float:left;">This and all the following events will be changed</div>
           </div>
+          <div style="display:inline-block;width:100%;">
+              <div style="width:30%;float:left;">
+                  <button class="dialog-button all-events">All the Events</button>
+              </div>
+              <div style="width:70%;float:left;">All the related events will be changed</div>
+          </div>
       </div>
   </div>
   <input type="hidden" value="" name="isRepeatingEvent" id="is-repeating-event"/>
@@ -62,7 +69,8 @@
     {literal}
         <script type="text/javascript">
         cj(document).ready(function() {
-            var saveButtonID = '';
+           var saveButtonID = '';
+           var eventID ={/literal}{$id}{literal};
            cj("#dialog").dialog({ autoOpen: false });
             cj('div.crm-submit-buttons span.crm-button input[value="Save"], div.crm-submit-buttons span.crm-button input[value="Save and Done"]').click( function () {
                 saveButtonID = this.id;
@@ -81,7 +89,6 @@
                 return false;
             });
             cj(".this-and-all-following-event").click(function(){
-                var eventID ={/literal}{$id}{literal};
                 if(eventID != ""){
                     var ajaxurl = CRM.url("civicrm/ajax/recurringEntity/update_cascade_type");
                     var data    = {cascadeType: 2, entityId: eventID};
                     });
                 }
             });
+            cj(".all-events").click(function(){
+                if(eventID != ""){
+                    var ajaxurl = CRM.url("civicrm/ajax/recurringEntity/update_cascade_type");
+                    var data    = {cascadeType: 3, entityId: eventID};
+                    cj.ajax({
+                      dataType: "json",
+                      data: data,
+                      url:  ajaxurl,
+                      success: function (result) {
+                          cj("#dialog").dialog('close');
+                          if(saveButtonID != ""){
+                            cj('#'+saveButtonID).closest('form').submit();
+                          }
+                      }
+                    });
+                }
+            });
             cj(".only-this-event").click(function(){
                 cj("#dialog").dialog('close');
                 if(saveButtonID != ""){