*}\r
\r
<div class="crm-core-form-recurringentity-block crm-accordion-wrapper" id="recurring-entity-block">\r
- <div class="crm-accordion-header">\r
- Repeat {if $entityType}{$entityType}{/if}\r
+ <div class="crm-accordion-header">\r
+ Repeat {if $entityType}{$entityType}{/if}\r
+ </div>\r
+ <div class="crm-accordion-body">\r
+ <div class="crm-submit-buttons">\r
+ {include file="CRM/common/formButtons.tpl" location="top"}\r
</div>\r
- <div class="crm-accordion-body">\r
- <div class="crm-submit-buttons">\r
- {include file="CRM/common/formButtons.tpl" location="top"}\r
- </div>\r
- <table class="form-layout-compressed">\r
- <tr class="crm-core-form-recurringentity-block-repetition_start_date" id="tr-repetition_start_date">\r
- <td class="label">{$form.repetition_start_date.label}</td>\r
- <td>{include file="CRM/common/jcalendar.tpl" elementName=repetition_start_date}</td>\r
- </tr>\r
- <tr class="crm-core-form-recurringentity-block-repetition_frequency_unit">\r
- <td class="label">{$form.repetition_frequency_unit.label} <span class="crm-marker" title="This field is required.">*</span></td>\r
- <td>{$form.repetition_frequency_unit.html} {help id="id-repeats" entityType=$entityType file="CRM/Core/Form/RecurringEntity.hlp"}</td>\r
- </tr>\r
- <tr class="crm-core-form-recurringentity-block-repetition_frequency_interval">\r
- <td class="label">{$form.repetition_frequency_interval.label} <span class="crm-marker" title="This field is required.">*</span></td>\r
- <td>{$form.repetition_frequency_interval.html} <span id="repeats-every-text">hour(s)</span> {help id="id-repeats-every" entityType=$entityType file="CRM/Core/Form/RecurringEntity.hlp"}</td>\r
- </td>\r
- </tr>\r
- <tr class="crm-core-form-recurringentity-block-start_action_condition">\r
- <td class="label">\r
- <label for="repeats_on">{$form.start_action_condition.label}: </label>\r
- </td>\r
- <td>\r
- {$form.start_action_condition.html} {help id="id-repeats-on" entityType=$entityType file="CRM/Core/Form/RecurringEntity.hlp"}</td>\r
- </td>\r
- </tr>\r
- <tr class="crm-core-form-recurringentity-block-repeats_by">\r
- <td class="label">{$form.repeats_by.label}</td>\r
- <td>{$form.repeats_by.1.html} {$form.limit_to.html} {help id="id-repeats-by-month" entityType=$entityType file="CRM/Core/Form/RecurringEntity.hlp"}\r
- </td>\r
- </tr>\r
- <tr class="crm-core-form-recurringentity-block-repeats_by">\r
- <td class="label"></td>\r
- <td>{$form.repeats_by.2.html} {$form.entity_status_1.html} {$form.entity_status_2.html} {help id="id-repeats-by-week" entityType=$entityType file="CRM/Core/Form/RecurringEntity.hlp"}\r
- </td>\r
- </tr>\r
- <tr class="crm-core-form-recurringentity-block-ends">\r
- <td class="label">{$form.ends.label} <span class="crm-marker" title="This field is required.">*</span></td>\r
- <td>{$form.ends.1.html} {$form.start_action_offset.html} occurrences {help id="id-ends-after" entityType=$entityType file="CRM/Core/Form/RecurringEntity.hlp"}</td>\r
- </tr>\r
- <tr class="crm-core-form-recurringentity-block-absolute_date">\r
- <td class="label"></td>\r
- <td>{$form.ends.2.html} {include file="CRM/common/jcalendar.tpl" elementName=repeat_absolute_date} {help id="id-ends-on" entityType=$entityType file="CRM/Core/Form/RecurringEntity.hlp"}\r
- </td>\r
- </tr>\r
- <tr class="crm-core-form-recurringentity-block-exclude_date">\r
- <td class="label">{$form.exclude_date.label}</td>\r
- <td> {include file="CRM/common/jcalendar.tpl" elementName=exclude_date}\r
- {$form.add_to_exclude_list.html} {$form.remove_from_exclude_list.html}\r
- {$form.exclude_date_list.html} {help id="id-exclude-date" entityType=$entityType file="CRM/Core/Form/RecurringEntity.hlp"}\r
- </td>\r
- </tr>\r
- <tr>\r
- <td class="label bold">{ts}Summary:{/ts}</td>\r
- <td><span id="rec-summary"></span></td>\r
- </tr>\r
- </table>\r
- <div class="crm-submit-buttons">\r
- {include file="CRM/common/formButtons.tpl" location="bottom"}\r
- </div>\r
+ <table class="form-layout-compressed">\r
+ <tr class="crm-core-form-recurringentity-block-repetition_start_date" id="tr-repetition_start_date">\r
+ <td class="label">{$form.repetition_start_date.label}</td>\r
+ <td>{include file="CRM/common/jcalendar.tpl" elementName=repetition_start_date}</td>\r
+ </tr>\r
+ <tr class="crm-core-form-recurringentity-block-repetition_frequency_unit">\r
+ <td class="label">{$form.repetition_frequency_unit.label} <span class="crm-marker" title="This field is required.">*</span> {help id="id-repeats" entityType=$entityType file="CRM/Core/Form/RecurringEntity.hlp"}</td>\r
+ <td>{$form.repetition_frequency_unit.html}</td>\r
+ </tr>\r
+ <tr class="crm-core-form-recurringentity-block-repetition_frequency_interval">\r
+ <td class="label">{$form.repetition_frequency_interval.label} <span class="crm-marker" title="This field is required.">*</span> {help id="id-repeats-every" entityType=$entityType file="CRM/Core/Form/RecurringEntity.hlp"}</td>\r
+ <td>{$form.repetition_frequency_interval.html} <span id="repeats-every-text">hour(s)</span>\r
+ </td>\r
+ </tr>\r
+ <tr class="crm-core-form-recurringentity-block-start_action_condition">\r
+ <td class="label">\r
+ <label for="repeats_on">{$form.start_action_condition.label} {help id="id-repeats-on" entityType=$entityType file="CRM/Core/Form/RecurringEntity.hlp"}</label>\r
+ </td>\r
+ <td>\r
+ {$form.start_action_condition.html}\r
+ </td>\r
+ </tr>\r
+ <tr class="crm-core-form-recurringentity-block-repeats_by">\r
+ <td class="label">{$form.repeats_by.label}</td>\r
+ <td>{$form.repeats_by.1.html} {$form.limit_to.html} {help id="id-repeats-by-month" entityType=$entityType file="CRM/Core/Form/RecurringEntity.hlp"}\r
+ </td>\r
+ </tr>\r
+ <tr class="crm-core-form-recurringentity-block-repeats_by">\r
+ <td class="label">{help id="id-repeats-by-week" entityType=$entityType file="CRM/Core/Form/RecurringEntity.hlp"}</td>\r
+ <td>{$form.repeats_by.2.html} {$form.entity_status_1.html} {$form.entity_status_2.html}\r
+ </td>\r
+ </tr>\r
+ <tr class="crm-core-form-recurringentity-block-ends">\r
+ <td class="label">{$form.ends.label} <span class="crm-marker" title="This field is required.">*</span> {help id="id-ends-after" entityType=$entityType file="CRM/Core/Form/RecurringEntity.hlp"}</td>\r
+ <td>{$form.ends.1.html} {$form.start_action_offset.html} occurrences </td>\r
+ </tr>\r
+ <tr class="crm-core-form-recurringentity-block-absolute_date">\r
+ <td class="label"> {help id="id-ends-on" entityType=$entityType file="CRM/Core/Form/RecurringEntity.hlp"}</td>\r
+ <td>{$form.ends.2.html} {include file="CRM/common/jcalendar.tpl" elementName=repeat_absolute_date}\r
+ </td>\r
+ </tr>\r
+ <tr class="crm-core-form-recurringentity-block-exclude_date">\r
+ <td class="label">{$form.exclude_date.label} {help id="id-exclude-date" entityType=$entityType file="CRM/Core/Form/RecurringEntity.hlp"}</td>\r
+ <td> {include file="CRM/common/jcalendar.tpl" elementName=exclude_date}\r
+ {$form.add_to_exclude_list.html} {$form.remove_from_exclude_list.html}\r
+ {$form.exclude_date_list.html}\r
+ </td>\r
+ </tr>\r
+ <tr>\r
+ <td class="label bold">{ts}Summary:{/ts}</td>\r
+ <td><span id="rec-summary"></span></td>\r
+ </tr>\r
+ </table>\r
+ <div class="crm-submit-buttons">\r
+ {include file="CRM/common/formButtons.tpl" location="bottom"}\r
</div>\r
+ </div>\r
</div>\r
<div id="preview-dialog" class="hiddenElement">\r
- <div id="generated_dates" class="show-block"></div>\r
+ <div id="generated_dates" class="show-block"></div>\r
</div>\r
{literal}\r
<script type="text/javascript">\r
- cj(document).ready(function() {\r
- cj('#repetition_start_date_display').closest("tr").hide();\r
+ CRM.$(function($) {\r
+ $('#repetition_start_date_display').closest("tr").hide();\r
/****** On load "Repeats By" and "Repeats On" blocks should be hidden if dropdown value is not week or month****** (Edit Mode)***/\r
- if (cj('#repetition_frequency_unit').val() == "week") {\r
- cj('.crm-core-form-recurringentity-block-start_action_condition').show();\r
- cj('.crm-core-form-recurringentity-block-repeats_by td').hide();\r
- } else if (cj('#repetition_frequency_unit').val() == "month") {\r
- cj('.crm-core-form-recurringentity-block-repeats_by td').show();\r
- cj('.crm-core-form-recurringentity-block-start_action_condition').hide();\r
- } else {\r
- cj('.crm-core-form-recurringentity-block-start_action_condition').hide();\r
- cj('.crm-core-form-recurringentity-block-repeats_by td').hide();\r
+ switch ($('#repetition_frequency_unit').val()) {\r
+ case 'week':\r
+ $('.crm-core-form-recurringentity-block-start_action_condition').show();\r
+ $('.crm-core-form-recurringentity-block-repeats_by td').hide();\r
+ break;\r
+ case 'month':\r
+ $('.crm-core-form-recurringentity-block-repeats_by td').show();\r
+ $('.crm-core-form-recurringentity-block-start_action_condition').hide();\r
+ break;\r
+ default:\r
+ $('.crm-core-form-recurringentity-block-start_action_condition').hide();\r
+ $('.crm-core-form-recurringentity-block-repeats_by td').hide();\r
+ break;\r
}\r
- cj("#repeats-every-text").html(cj('#repetition_frequency_unit').val()+'(s)');\r
+ $("#repeats-every-text").html($('#repetition_frequency_unit').val()+'(s)');\r
\r
/***********On Load Set Ends Value (Edit Mode) **********/\r
- if (cj('input:radio[name=ends]:checked').val() == 1) {\r
- cj('#start_action_offset').removeAttr('disabled').attr('enabled','enabled');\r
- cj('#repeat_absolute_date_display').removeAttr("enabled").attr('disabled','disabled');\r
- cj('#repeat_absolute_date_display').val('');\r
- } else if (cj('input:radio[name=ends]:checked').val() == 2) {\r
- cj('#repeat_absolute_date_display').removeAttr("disabled").attr('enabled','enabled');\r
- cj('#start_action_offset').removeAttr('enabled').attr('disabled','disabled');\r
- cj('#start_action_offset').val('');\r
- } else {\r
- cj('#start_action_offset').removeAttr('enabled').attr('disabled','disabled');\r
- cj('#repeat_absolute_date_display').removeAttr('enabled').attr('disabled','disabled');\r
+ switch ($('input:radio[name=ends]:checked').val()) {\r
+ case '1':\r
+ $('#start_action_offset').prop('disabled', false);\r
+ $('#repeat_absolute_date_display').prop('disabled', true).val('');\r
+ break;\r
+ case '2':\r
+ $('#repeat_absolute_date_display').prop('disabled', false);\r
+ $('#start_action_offset').prop('disabled', true).val('');\r
+ break;\r
+ default:\r
+ $('#start_action_offset').prop('disabled', true);\r
+ $('#repeat_absolute_date_display').prop('disabled', true);\r
+ break;\r
}\r
\r
/******On Load set Repeats by section******************/\r
- if (cj('input:radio[name=repeats_by]:checked').val() == 1) {\r
- cj('#limit_to').removeAttr('disabled').attr('enabled','enabled');\r
- cj('#entity_status_1, #entity_status_2').removeAttr("enabled").attr('disabled','disabled');\r
- } else if (cj('input:radio[name=repeats_by]:checked').val() == 2) {\r
- cj('#entity_status_1, #entity_status_2').removeAttr("disabled").attr('enabled','enabled');\r
- cj('#limit_to').removeAttr('enabled').attr('disabled','disabled');\r
- } else {\r
- //Just in-case block shows up, disable it\r
- cj('#limit_to, #entity_status_1, #entity_status_2').removeAttr('enabled').attr('disabled','disabled');\r
+ switch ($('input:radio[name=repeats_by]:checked').val()) {\r
+ case '1':\r
+ $('#limit_to').prop('disabled', false);\r
+ $('#entity_status_1, #entity_status_2').prop('disabled', true);\r
+ break;\r
+ case '2':\r
+ $('#entity_status_1, #entity_status_2').prop('disabled', false);\r
+ $('#limit_to').prop('disabled', true);\r
+ break;\r
+ default:\r
+ //Just in-case block shows up, disable it\r
+ $('#limit_to, #entity_status_1, #entity_status_2').prop('disabled', true);\r
+ break;\r
}\r
\r
- cj('#repetition_frequency_unit').change(function () {\r
- if (cj(this).val()==='hour') {\r
- cj('#repeats-every-text').html(cj(this).val()+'(s)');\r
- cj('.crm-core-form-recurringentity-block-start_action_condition').hide();\r
- cj('.crm-core-form-recurringentity-block-repeats_by td').hide();\r
- } else if (cj(this).val()==='day') {\r
- cj('#repeats-every-text').html(cj(this).val()+'(s)');\r
- cj('.crm-core-form-recurringentity-block-start_action_condition').hide();\r
- cj('.crm-core-form-recurringentity-block-repeats_by td').hide();\r
- } else if (cj(this).val()==='week') {\r
- cj('#repeats-every-text').html(cj(this).val()+'(s)');\r
- //Show "Repeats On" block when week is selected\r
- cj('.crm-core-form-recurringentity-block-start_action_condition').show();\r
- cj('.crm-core-form-recurringentity-block-repeats_by td').hide();\r
- } else if (cj(this).val()==='month') {\r
- cj('#repeats-every-text').html(cj(this).val()+'(s)');\r
- cj('.crm-core-form-recurringentity-block-start_action_condition').hide();\r
- //Show "Repeats By" block when month is selected\r
- cj('.crm-core-form-recurringentity-block-repeats_by td').show();\r
- } else if (cj(this).val()==='year') {\r
- cj('#repeats-every-text').html(cj(this).val()+'(s)');\r
- cj('.crm-core-form-recurringentity-block-start_action_condition').hide();\r
- cj('.crm-core-form-recurringentity-block-repeats_by td').hide();\r
+ $('#repetition_frequency_unit').change(function () {\r
+ switch ($(this).val()) {\r
+ case 'hour':\r
+ $('#repeats-every-text').html($(this).val()+'(s)');\r
+ $('.crm-core-form-recurringentity-block-start_action_condition').hide();\r
+ $('.crm-core-form-recurringentity-block-repeats_by td').hide();\r
+ break;\r
+ case 'day':\r
+ $('#repeats-every-text').html($(this).val()+'(s)');\r
+ $('.crm-core-form-recurringentity-block-start_action_condition').hide();\r
+ $('.crm-core-form-recurringentity-block-repeats_by td').hide();\r
+ break;\r
+ case 'week':\r
+ $('#repeats-every-text').html($(this).val()+'(s)');\r
+ //Show "Repeats On" block when week is selected\r
+ $('.crm-core-form-recurringentity-block-start_action_condition').show();\r
+ $('.crm-core-form-recurringentity-block-repeats_by td').hide();\r
+ break;\r
+ case 'month':\r
+ $('#repeats-every-text').html($(this).val()+'(s)');\r
+ $('.crm-core-form-recurringentity-block-start_action_condition').hide();\r
+ //Show "Repeats By" block when month is selected\r
+ $('.crm-core-form-recurringentity-block-repeats_by td').show();\r
+ break;\r
+ case 'year':\r
+ $('#repeats-every-text').html($(this).val()+'(s)');\r
+ $('.crm-core-form-recurringentity-block-start_action_condition').hide();\r
+ $('.crm-core-form-recurringentity-block-repeats_by td').hide();\r
+ break;\r
}\r
});\r
\r
// For "Ends" block\r
- cj('input:radio[name=ends]').click(function() {\r
- if (cj(this).val() == 1) {\r
- cj('#start_action_offset').removeAttr('disabled').attr('enabled','enabled');\r
- cj('#repeat_absolute_date_display').val('');\r
- } else if (cj(this).val() == 2) {\r
- cj('#repeat_absolute_date_display').removeAttr('disabled').attr('enabled','enabled');\r
- cj('#start_action_offset').val('');\r
- } else {\r
- cj('#repeat_absolute_date_display').removeAttr('enabled').attr('disabled','disabled');\r
+ $('input:radio[name=ends]').click(function() {\r
+ switch ($(this).val()) {\r
+ case '1':\r
+ $('#start_action_offset').prop('disabled', false);\r
+ $('#repeat_absolute_date_display').val('');\r
+ break;\r
+ case '2':\r
+ $('#repeat_absolute_date_display').prop('disabled', false);\r
+ $('#start_action_offset').val('');\r
+ break;\r
+ default:\r
+ $('#repeat_absolute_date_display').prop('disabled', true);\r
+ break;\r
}\r
});\r
\r
//For "Repeats By" block\r
- cj('input:radio[name=repeats_by]').click(function() {\r
- if (cj(this).val() == 1) {\r
- cj('#limit_to').removeAttr('disabled').attr('enabled','enabled');\r
- } else {\r
- cj('#limit_to').removeAttr('enabled').attr('disabled','disabled');\r
- }\r
- if (cj(this).val() == 2) {\r
- cj('#entity_status_1').removeAttr('disabled').attr('enabled','enabled');\r
- cj('#entity_status_2').removeAttr('disabled').attr('enabled','enabled');\r
- } else {\r
- cj('#entity_status_1').removeAttr('enabled').attr('disabled','disabled');\r
- cj('#entity_status_2').removeAttr('enabled').attr('disabled','disabled');\r
- }\r
+ $('input:radio[name=repeats_by]').click(function() {\r
+ $('#limit_to').prop('disabled', $(this).val() != 1);\r
+ $('#entity_status_1, #entity_status_2').prop('disabled', $(this).val() != 2);\r
});\r
\r
//Select all options in selectbox before submitting\r
- cj(this).submit(function() {\r
- cj('#exclude_date_list option').attr('selected',true);\r
+ $(this).submit(function() {\r
+ $('#exclude_date_list option').attr('selected',true);\r
\r
//Check form for values submitted\r
- if (cj('input[name=ends]:checked').val() == 1) {\r
- if (cj('#start_action_offset').val() == "") {\r
- if (!cj('span#start_action_offset-error').length) {\r
- cj('#start_action_offset').after('<span id ="start_action_offset-error" class="crm-error"> This is a required field.</span>');\r
- //Check if other message already present, hide it\r
- cj('span#repeat_absolute_date_display-error').toggle();\r
+ if ($('input[name=ends]:checked').val() == 1) {\r
+ if ($('#start_action_offset').val() == "") {\r
+ if (!$('span#start_action_offset-error').length) {\r
+ $('#start_action_offset').after('<span id ="start_action_offset-error" class="crm-error"> This is a required field.</span>');\r
+ //Check if other message already present, hide it\r
+ $('span#repeat_absolute_date_display-error').toggle();\r
}\r
return false;\r
}\r
- } else if (cj('input[name=ends]:checked').val() == 2) {\r
- if (cj('#repeat_absolute_date_display').val() == "") {\r
- if (!cj('span#repeat_absolute_date_display-error').length) {\r
- cj('#repeat_absolute_date_display').after('<span id="repeat_absolute_date_display-error" class="crm-error"> This is a required field.</span>');\r
+ } else if ($('input[name=ends]:checked').val() == 2) {\r
+ if ($('#repeat_absolute_date_display').val() == "") {\r
+ if (!$('span#repeat_absolute_date_display-error').length) {\r
+ $('#repeat_absolute_date_display').after('<span id="repeat_absolute_date_display-error" class="crm-error"> This is a required field.</span>');\r
//Check if other message already present, hide it\r
- cj('span#start_action_offset-error').toggle();\r
+ $('span#start_action_offset-error').toggle();\r
}\r
return false;\r
}\r
\r
//Detect changes in Repeat configuration field\r
var unsavedChanges = false;\r
- cj('div.crm-core-form-recurringentity-block').on('change', function() {\r
+ $('div.crm-core-form-recurringentity-block').on('change', function() {\r
unsavedChanges = true;\r
});\r
\r
//If there are changes in repeat configuration, enable save button\r
//Dialog for preview repeat Configuration dates\r
- cj('#preview-dialog').dialog({ autoOpen: false });\r
+ $('#preview-dialog').dialog({ autoOpen: false });\r
function previewDialog() {\r
- cj('#exclude_date_list option').attr('selected',true);\r
- //Copy exclude dates\r
- var dateTxt=[];\r
- cj('#exclude_date_list option:selected').each(function() {\r
- dateTxt.push(cj(this).text());\r
- });\r
- var completeDateText = dateTxt.join(',');\r
- cj('#copyExcludeDates').val(completeDateText);\r
+ $('#exclude_date_list option').attr('selected', true);\r
+ //Copy exclude dates\r
+ var dateTxt=[];\r
+ $('#exclude_date_list option:selected').each(function() {\r
+ dateTxt.push($(this).text());\r
+ });\r
+ var completeDateText = dateTxt.join(',');\r
+ $('#copyExcludeDates').val(completeDateText);\r
\r
- cj('#generated_dates').html('').html('<div class="crm-loading-element"><span class="loading-text">{/literal}{ts escape='js'}Just a moment, generating dates{/ts}{literal}...</span></div>');\r
- cj('#preview-dialog').dialog('open');\r
- cj('#preview-dialog').dialog({\r
- title: 'Confirm dates',\r
- width: '650',\r
- position: 'center',\r
- //draggable: false,\r
- buttons: {\r
- Ok: function() {\r
- cj(this).dialog( "close" );\r
- cj('form#Repeat, form#Activity').submit();\r
- },\r
- Cancel: function() { //cancel\r
- cj(this).dialog( "close" );\r
- }\r
+ $('#generated_dates').html('').html('<div class="crm-loading-element"><span class="loading-text">{/literal}{ts escape='js'}Just a moment, generating dates{/ts}{literal}...</span></div>');\r
+ $('#preview-dialog').dialog('open');\r
+ $('#preview-dialog').dialog({\r
+ title: 'Confirm dates',\r
+ width: '650',\r
+ position: 'center',\r
+ //draggable: false,\r
+ buttons: {\r
+ Ok: function() {\r
+ $(this).dialog( "close" );\r
+ $('form#Repeat, form#Activity').submit();\r
+ },\r
+ Cancel: function() { //cancel\r
+ $(this).dialog( "close" );\r
}\r
- });\r
- var ajaxurl = CRM.url("civicrm/ajax/recurringentity/generate-preview");\r
- var entityID = parseInt('{/literal}{$currentEntityId}{literal}');\r
- var entityTable = '{/literal}{$entityTable}{literal}';\r
- if (entityTable != "") {\r
- ajaxurl += "?entity_table="+entityTable;\r
- }\r
- if (entityID != "") {\r
- ajaxurl += "&entity_id="+entityID;\r
}\r
- var formData = cj('form').serializeArray();\r
- cj.ajax({\r
- dataType: "json",\r
- type: "POST",\r
- data: formData,\r
- url: ajaxurl,\r
- success: function (result) {\r
- if (Object.keys(result).length > 0) {\r
- var errors = [];\r
- var participantData = [];\r
- var html = 'Based on your repeat configuration, here is the list of dates. Do you wish to create a recurring set with these dates?<br/><table id="options" class="display"><thead><tr><th></th><th>Start date</th><th id="th-end-date">End date</th></tr><thead>';\r
- var count = 1;\r
- for(var i in result) {\r
- if (i != 'errors') {\r
- if (i == 'participantData') {\r
- participantData = result.participantData;\r
- break;\r
- }\r
- var start_date = result[i].start_date;\r
- var end_date = result[i].end_date;\r
+ });\r
+ var ajaxurl = CRM.url("civicrm/ajax/recurringentity/generate-preview");\r
+ var entityID = parseInt('{/literal}{$currentEntityId}{literal}');\r
+ var entityTable = '{/literal}{$entityTable}{literal}';\r
+ if (entityTable != "") {\r
+ ajaxurl += "?entity_table="+entityTable;\r
+ }\r
+ if (entityID != "") {\r
+ ajaxurl += "&entity_id="+entityID;\r
+ }\r
+ var formData = $('form').serializeArray();\r
+ $.ajax({\r
+ dataType: "json",\r
+ type: "POST",\r
+ data: formData,\r
+ url: ajaxurl,\r
+ success: function (result) {\r
+ if (Object.keys(result).length > 0) {\r
+ var errors = [];\r
+ var participantData = [];\r
+ var html = 'Based on your repeat configuration, here is the list of dates. Do you wish to create a recurring set with these dates?<br/><table id="options" class="display"><thead><tr><th></th><th>Start date</th><th id="th-end-date">End date</th></tr><thead>';\r
+ var count = 1;\r
+ for(var i in result) {\r
+ if (i != 'errors') {\r
+ if (i == 'participantData') {\r
+ participantData = result.participantData;\r
+ break;\r
+ }\r
+ var start_date = result[i].start_date;\r
+ var end_date = result[i].end_date;\r
\r
- var end_date_text = '';\r
- if (end_date !== undefined) {\r
- end_date_text = '<td>'+end_date+'</td>';\r
- }\r
- html += '<tr><td>'+count+'</td><td>'+start_date+'</td>'+end_date_text+'</tr>';\r
- count = count + 1;\r
- } else {\r
- errors = result.errors;\r
+ var end_date_text = '';\r
+ if (end_date !== undefined) {\r
+ end_date_text = '<td>'+end_date+'</td>';\r
}\r
+ html += '<tr><td>'+count+'</td><td>'+start_date+'</td>'+end_date_text+'</tr>';\r
+ count = count + 1;\r
+ } else {\r
+ errors = result.errors;\r
}\r
- html += '</table>';\r
- var warningHtml = '';\r
- if (Object.keys(participantData).length > 0) {\r
- warningHtml += '<div class="messages status no-popup"><div class="icon inform-icon"></div> There are registrations for the repeating events already present in the set, continuing with the process would unlink them and repeating events without registration would be trashed. </div><table id="options" class="display"><thead><tr><th>Event ID</th><th>Event</th><th>Participant Count</th></tr><thead>';\r
- for (var id in participantData) {\r
- for(var data in participantData[id]) {\r
+ }\r
+ html += '</table>';\r
+ var warningHtml = '';\r
+ if (Object.keys(participantData).length > 0) {\r
+ warningHtml += '<div class="messages status no-popup"><div class="icon inform-icon"></div> There are registrations for the repeating events already present in the set, continuing with the process would unlink them and repeating events without registration would be trashed. </div><table id="options" class="display"><thead><tr><th>Event ID</th><th>Event</th><th>Participant Count</th></tr><thead>';\r
+ for (var id in participantData) {\r
+ for(var data in participantData[id]) {\r
warningHtml += '<tr><td>'+id+'</td><td> <a href="{/literal}{crmURL p="civicrm/event/manage/settings" q="reset=1&action=update&id="}{literal}'+id+'{/literal}{literal}">'+data+'</a></td><td><a href="{/literal}{crmURL p='civicrm/event/search' q="reset=1&force=1&status=true&event="}{literal}'+id+'{/literal}{literal}">'+participantData[id][data]+'</a></td></tr>';\r
- }\r
- }\r
- warningHtml += '</table><br/>';\r
- }\r
- if (errors.length > 0) {\r
- html = '';\r
- for (var j = 0; j < errors.length; j++) {\r
- html += '<span class="crm-error">* ' + errors[j] + '</span><br/>';\r
}\r
}\r
- if (warningHtml != "") {\r
- cj('#generated_dates').append(warningHtml).append(html);\r
- } else {\r
- cj('#generated_dates').html(html);\r
- }\r
- if (end_date_text == "") {\r
- cj('#th-end-date').hide();\r
- }\r
- if (cj("#preview-dialog").height() >= 300) {\r
- cj('#preview-dialog').css('height', '300');\r
- cj('#preview-dialog').css('overflow-y', 'auto');\r
+ warningHtml += '</table><br/>';\r
+ }\r
+ if (errors.length > 0) {\r
+ html = '';\r
+ for (var j = 0; j < errors.length; j++) {\r
+ html += '<span class="crm-error">* ' + errors[j] + '</span><br/>';\r
}\r
+ }\r
+ if (warningHtml != "") {\r
+ $('#generated_dates').append(warningHtml).append(html);\r
} else {\r
- cj('div.ui-dialog-buttonset button span:contains(Ok)').hide();\r
- cj('#generated_dates').append("<span class='crm-error'>Sorry, no dates could be generated for the given criteria!</span>");\r
+ $('#generated_dates').html(html);\r
}\r
- },\r
- complete: function() {\r
- cj('div.crm-loading-element').hide();\r
+ if (end_date_text == "") {\r
+ $('#th-end-date').hide();\r
+ }\r
+ if ($("#preview-dialog").height() >= 300) {\r
+ $('#preview-dialog').css('height', '300');\r
+ $('#preview-dialog').css('overflow-y', 'auto');\r
+ }\r
+ } else {\r
+ $('div.ui-dialog-buttonset button span:contains(Ok)').hide();\r
+ $('#generated_dates').append("<span class='crm-error'>Sorry, no dates could be generated for the given criteria!</span>");\r
}\r
- });\r
- return false;\r
+ },\r
+ complete: function() {\r
+ $('div.crm-loading-element').hide();\r
+ }\r
+ });\r
+ return false;\r
}\r
\r
- cj('#_qf_Repeat_submit-top, #_qf_Repeat_submit-bottom').click( function () {\r
+ $('#_qf_Repeat_submit-top, #_qf_Repeat_submit-bottom').click( function () {\r
return previewDialog();\r
});\r
\r
- cj('#_qf_Activity_upload-top, #_qf_Activity_upload-bottom').click( function () {\r
+ $('#_qf_Activity_upload-top, #_qf_Activity_upload-bottom').click( function () {\r
//Process this only when repeat is configured. We need to do this test here as there is a common save for activity.\r
var isRepeatConfigured = '{/literal}{$scheduleReminderId}{literal}';\r
if (isRepeatConfigured) {\r
- if (unsavedChanges) {\r
- cj('#allowRepeatConfigToSubmit').val('1');\r
+ if (unsavedChanges) {\r
+ $('#allowRepeatConfigToSubmit').val('1');\r
//Set this variable to decide which dialog box to show\r
- cj.data( document.body, "preview-dialog", true );\r
+ $.data( document.body, "preview-dialog", true );\r
return previewDialog();\r
}\r
else {\r
- cj.data( document.body, "preview-dialog", false );\r
+ $.data( document.body, "preview-dialog", false );\r
return false;\r
}\r
}\r
else {\r
if (unsavedChanges) {\r
- cj('#allowRepeatConfigToSubmit').val('1');\r
+ $('#allowRepeatConfigToSubmit').val('1');\r
return previewDialog();\r
}\r
}\r
//Build Summary\r
var finalSummary = '';\r
var numberText = '';\r
- var interval = cj('#repetition_frequency_interval').val() + ' ';\r
- if (cj('#repetition_frequency_interval').val() == 1) {\r
+ var interval = $('#repetition_frequency_interval').val() + ' ';\r
+ if ($('#repetition_frequency_interval').val() == 1) {\r
interval = '';\r
} else {\r
numberText = 's';\r
}\r
- finalSummary = "Every " + interval + cj('#repetition_frequency_unit option:selected').val() + numberText;\r
+ finalSummary = "Every " + interval + $('#repetition_frequency_unit option:selected').val() + numberText;\r
\r
//Case Week\r
- var dayOfWeek = new Array();\r
- if (cj('#repetition_frequency_unit option:selected').val() == "week") {\r
- cj("input[name^='start_action_condition']:checked").each(function() {\r
- var tempArray = new Array();\r
- var thisID = cj(this).attr('id');\r
+ var dayOfWeek = [];\r
+ if ($('#repetition_frequency_unit option:selected').val() == "week") {\r
+ $("input[name^='start_action_condition']:checked").each(function() {\r
+ var tempArray = [];\r
+ var thisID = $(this).attr('id');\r
tempArray = thisID.split('_');\r
dayOfWeek.push(tempArray[3].substr(0, 1).toUpperCase() + tempArray[3].substr(1).toLowerCase());\r
});\r
}\r
\r
//Case Monthly\r
- if (cj('#repetition_frequency_unit option:selected').val() == "month") {\r
- if (cj('input:radio[name=repeats_by]:checked').val() == 1) {\r
- finalSummary += ' on day ' + cj('#limit_to').val();\r
+ if ($('#repetition_frequency_unit option:selected').val() == "month") {\r
+ if ($('input:radio[name=repeats_by]:checked').val() == 1) {\r
+ finalSummary += ' on day ' + $('#limit_to').val();\r
}\r
- if (cj('input:radio[name=repeats_by]:checked').val() == 2) {\r
- finalSummary += ' on ' + cj('#entity_status_1').val().substr(0, 1).toUpperCase() + cj('#entity_status_1').val().substr(1).toLowerCase() + ' ' + cj('#entity_status_2').val().substr(0, 1).toUpperCase() + cj('#entity_status_2').val().substr(1).toLowerCase();\r
+ if ($('input:radio[name=repeats_by]:checked').val() == 2) {\r
+ finalSummary += ' on ' + $('#entity_status_1').val().substr(0, 1).toUpperCase() + $('#entity_status_1').val().substr(1).toLowerCase() + ' ' + $('#entity_status_2').val().substr(0, 1).toUpperCase() + $('#entity_status_2').val().substr(1).toLowerCase();\r
}\r
}\r
\r
//Case Ends\r
- if (cj('input:radio[name=ends]:checked').val() == 1) {\r
+ if ($('input:radio[name=ends]:checked').val() == 1) {\r
var timeText = ''\r
- if (cj('#start_action_offset').val() != 1) {\r
- timeText = cj('#start_action_offset').val() + ' times';\r
+ if ($('#start_action_offset').val() != 1) {\r
+ timeText = $('#start_action_offset').val() + ' times';\r
} else {\r
timeText = ' once';\r
}\r
finalSummary += ', ' + timeText;\r
}\r
- if (cj('input:radio[name=ends]:checked').val() == 2) {\r
- var monthNames = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");\r
- var date = new Date(cj('#repeat_absolute_date_display').val());\r
+ if ($('input:radio[name=ends]:checked').val() == 2) {\r
+ var monthNames = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];\r
+ var date = new Date($('#repeat_absolute_date_display').val());\r
function addOrdinal(d) {\r
if (d>3 && d<21) return 'th';\r
switch (d % 10) {\r
}\r
\r
//Build/Attach final Summary\r
- cj('#rec-summary').html(finalSummary);\r
+ $('#rec-summary').html(finalSummary);\r
\r
-});\r
+ });\r
\r
//Exclude list function\r
function addToExcludeList(val) {\r
{/literal}\r
{*Hide Summary*}\r
{if empty($scheduleReminderId)}\r
- {literal}\r
- <script type="text/javascript">\r
- cj(document).ready(function() {\r
- if (cj('#rec-summary').length) {\r
- cj('#rec-summary').parent().parent().hide();\r
- }\r
- });\r
- </script>\r
- {/literal}\r
+{literal}\r
+ <script type="text/javascript">\r
+ CRM.$(function($) {\r
+ if ($('#rec-summary').length) {\r
+ $('#rec-summary').parent().parent().hide();\r
+ }\r
+ });\r
+ </script>\r
+{/literal}\r
{/if}\r