// Putting these functions directly in template for historical reasons.
function useAmountOther(mainPriceFieldName) {
var currentFocus = CRM.$(':focus');
CRM.$('input[name=' + mainPriceFieldName + ']:radio:unchecked').each(
function () {
if (CRM.$(this).data('is-null-option') !== undefined) {
// Triggering this click here because over in Calculate.tpl
// a blur action is attached
CRM.$(this).prop('checked', true).trigger('click');
}
}
);
// Copied from `updatePriceSetHighlight()` below which isn't available here.
// @todo - consider adding this to the actions assigned in Calculate.tpl
CRM.$('#priceset .price-set-row span').removeClass('highlight');
CRM.$('#priceset .price-set-row input:checked').parent().addClass('highlight');
// Return the focus we blurred earlier.
currentFocus.trigger('focus');
function clearAmountOther(otherPriceFieldName) {
cj('#' + otherPriceFieldName).val('').trigger('blur');
}
Welcome to the Physicians’ Alliance against Euthanasia membership page. The membership fee is voluntary. Thank you for contributing to our efforts to be your voice and give you support at this critical moment in the history of our profession. You will receive a receipt for the fee as a professional expense.
CRM.$(function($) {
var orgOption = $("input:radio[name=org_option]:checked").attr('id');
var onBehalfRequired = '$onBehalfRequired';
var onbehalfof_id = $('#onbehalfof_id');
var is_for_organization = $('#is_for_organization');
selectCreateOrg(orgOption, false);
if (is_for_organization.length) {
showHideOnBehalfOfBlock();
is_for_organization.on('change', function() {
showHideOnBehalfOfBlock();
});
}
function showHideOnBehalfOfBlock() {
$('#on-behalf-block').toggle(is_for_organization.is(':checked'));
if (is_for_organization.is(':checked')) {
$('#onBehalfOfOrg select.crm-select2').removeClass('crm-no-validate');
}
else {
$('#onBehalfOfOrg select.crm-select2').addClass('crm-no-validate');
}
}
$("input:radio[name='org_option']").click( function( ) {
var orgOption = $(this).attr('id');
selectCreateOrg(orgOption, true);
});
onbehalfof_id.change(function() {
setLocationDetails($(this).val());
}).change();
if (onbehalfof_id.length) {
setLocationDetails(onbehalfof_id.val());
}
function resetValues() {
// Don't trip chain-select when clearing values
$('.crm-chain-select-control', "#select_org div").select2('val', '');
$('input[type=text], select, textarea', "#select_org div").not('.crm-chain-select-control, #onbehalfof_id').val('').change();
$('input[type=radio], input[type=checkbox]', "#select_org div").prop('checked', false).change();
$('#on-behalf-block input').not('input[type=checkbox], input[type=radio], #onbehalfof_id').val('');
// clear checkboxes and radio
$('#on-behalf-block')
.find('input[type=checkbox], input[type=radio]')
.not('input[name=org_option]')
.attr('checked', false);
}
function selectCreateOrg( orgOption, reset ) {
if (orgOption == 'CIVICRM_QFID_0_org_option') {
$("#onbehalfof_id").show().change();
$("input#onbehalf_organization_name").hide();
}
else if (orgOption == 'CIVICRM_QFID_1_org_option') {
$("input#onbehalf_organization_name").show();
$("#onbehalfof_id").hide();
reset = true;
}
if ( reset ) {
resetValues();
}
}
function setLocationDetails(contactID , reset) {
resetValues();
var locationUrl = '' + contactID;
var submittedOnBehalfInfo = '';
var submittedCID = "";
if (submittedOnBehalfInfo) {
submittedOnBehalfInfo = $.parseJSON(submittedOnBehalfInfo);
if (submittedCID == contactID) {
$.each(submittedOnBehalfInfo, function(key, value) {
//handle checkboxes
if (typeof value === 'object') {
$.each(value, function(k, v) {
$('#onbehalf_' + key + '_' + k).prop('checked', v);
});
}
else if ($('#onbehalf_' + key).length) {
$('#onbehalf_' + key ).val(value);
}
//radio buttons
else if ($("input[name='onbehalf[" + key + "]']").length) {
$("input[name='onbehalf[" + key + "]']").val([value]);
}
});
return;
}
}
$.ajax({
url : locationUrl,
dataType : "json",
success : function(data, status) {
for (var ele in data) {
if ($("#"+ ele).hasClass('crm-chain-select-target')) {
$("#"+ ele).data('newVal', data[ele].value).off('.autofill').on('crmOptionsUpdated.autofill', function() {
$(this).off('.autofill').val($(this).data('newVal')).change();
});
}
else if ($('#' + ele).data('select2')) {
$('#' + ele).select2('val', data[ele].value);
}
if (data[ele].type == 'Radio') {
if (data[ele].value) {
var fldName = ele.replace('onbehalf_', '');
$("input[name='onbehalf["+ fldName +"]']").filter("[value='" + data[ele].value + "']").prop('checked', true);
}
}
else if (data[ele].type == 'CheckBox') {
for (var selectedOption in data[ele].value) {
var fldName = ele.replace('onbehalf_', '');
$("input[name='onbehalf["+ fldName+"]["+ selectedOption +"]']").prop('checked','checked');
}
}
else if (data[ele].type == 'AdvMulti-Select') {
var customFld = ele.replace('onbehalf_', '');
// remove empty value if any
$('#onbehalf\\['+ customFld +'\\]-f option[value=""]').remove();
$('#onbehalf\\['+ customFld +'\\]-t option[value=""]').remove();
for (var selectedOption in data[ele].value) {
// remove selected values from left and selected values to right
$('#onbehalf\\['+ customFld +'\\]-f option[value="' + selectedOption + '"]').remove()
.appendTo('#onbehalf\\['+ customFld +'\\]-t');
$('#onbehalf_'+ customFld).val(selectedOption);
}
}
else {
// do not set defaults to file type fields
if ($('#' + ele).attr('type') != 'file') {
$('#' + ele ).val(data[ele].value).change();
}
}
}
},
error : function(XMLHttpRequest, textStatus, errorThrown) {
CRM.console('error', "HTTP error status: ", textStatus);
}
});
}
});
/**
* Show or hide payment options.
*
* @param bool $isHide
* Should the block be hidden.
*/
function showHidePayment(isHide) {
var payment_options = cj(".payment_options-group");
var payment_processor = cj("div.payment_processor-section");
var payment_information = cj("div#payment_information");
// I've added a hide for billing block. But, actually the issue
// might be that the unselecting of the processor should cause it
// to be hidden (or removed) in which case it can go from this function.
var billing_block = cj("div#billing-payment-block");
if (isHide) {
payment_options.hide();
payment_processor.hide();
payment_information.hide();
billing_block.hide();
// Ensure that jquery validation doesn't block submission when we don't need to fill in the billing details section
cj('#billing-payment-block select.crm-select2').addClass('crm-no-validate');
// also unset selected payment methods
cj('input[name="payment_processor_id"]').removeProp('checked');
}
else {
payment_options.show();
payment_processor.show();
payment_information.show();
billing_block.show();
cj('#billing-payment-block select.crm-select2').removeClass('crm-no-validate');
// also set selected payment methods
cj('input[name="payment_processor_id"][checked=checked]').prop('checked', true);
}
}
/**
* Hides or shows billing and payment options block depending on whether payment is required.
*
* In general incomplete orders or $0 orders do not require a payment block.
*/
function skipPaymentMethod() {
var isHide = false;
var alwaysShowFlag = (cj("#additional_participants").val());
var alwaysHideFlag = (cj("#bypass_payment").val() == 1);
var total_amount_tmp = cj('#pricevalue').data('raw-total');
// Hide billing questions if this is free
if (!alwaysShowFlag && total_amount_tmp == 0){
isHide = true;
}
else {
isHide = false;
}
if (alwaysHideFlag) {
isHide = true;
}
showHidePayment(isHide);
}
skipPaymentMethod();
CRM.$(function($) {
function buildPaymentBlock(type) {
var $form = $('#billing-payment-block').closest('form');
var payment_instrument_id = $('#payment_instrument_id').val();
var currency = 'CAD';
currency = currency == '' ? $('#currency').val() : currency;
var dataUrl = "https://collectifmedecins.org/en/membership/?civiwp=CiviCRM&q=civicrm%2Fpayment%2Fform&formName=Main&is_back_office=";
if (typeof(CRM.vars) != "undefined") {
if (typeof(CRM.vars.coreForm) != "undefined") {
if (typeof(CRM.vars.coreForm.contact_id) != "undefined") {
dataUrl = dataUrl + "&cid=" + CRM.vars.coreForm.contact_id;
}
if (typeof(CRM.vars.coreForm.checksum) != "undefined" ) {
dataUrl = dataUrl + "&cs=" + CRM.vars.coreForm.checksum;
}
}
}
dataUrl = dataUrl + "&processor_id=" + type + "&payment_instrument_id=" + payment_instrument_id + "¤cy=" + currency;
// Processors like pp-express will hide the form submit buttons, so re-show them when switching
$('.crm-submit-buttons', $form).show().find('input').prop('disabled', true);
CRM.loadPage(dataUrl, {target: '#billing-payment-block'});
}
$('[name=payment_processor_id], #currency').on('change.paymentBlock', function() {
var payment_processor_id = $('[name=payment_processor_id]:checked').val() == undefined ? $('[name=payment_processor_id]').val() : $('[name=payment_processor_id]:checked').val();
if (payment_processor_id != undefined) {
buildPaymentBlock(payment_processor_id);
}
});
$('#payment_instrument_id').on('change.paymentBlock', function() {
buildPaymentBlock(0);
});
if ($('#payment_instrument_id').val()) {
buildPaymentBlock(0);
}
$('#billing-payment-block').on('crmLoad', function() {
$('.crm-submit-buttons input').prop('disabled', false);
})
});
Please leave your postal address and phone number.
Membership details
Review your contribution
cj('input[name="soft_credit_type_id"]').on('change', function() {
enableHonorType();
});
function enableHonorType() {
var selectedValue = cj('input[name="soft_credit_type_id"]:checked');
if ( selectedValue.val() > 0) {
cj('#honorType').show();
}
else {
cj('#honorType').hide();
}
}
cj('input[id="is_recur"]').on('change', function() {
toggleRecur();
});
function toggleRecur() {
var isRecur = cj('input[id="is_recur"]:checked');
var quickConfig = '1';
if (cj("#auto_renew").length && quickConfig) {
showHideAutoRenew(null);
}
var frequencyUnit = cj('#frequency_unit');
var frequencyInerval = cj('#frequency_interval');
var installments = cj('#installments');
isDisabled = false;
if (isRecur.val() > 0) {
cj('#recurHelp').show();
frequencyUnit.prop('disabled', false).addClass('required');
frequencyInerval.prop('disabled', false).addClass('required');
installments.prop('disabled', false);
cj('#amount_sum_label').text('Regular Amount');
}
else {
cj('#recurHelp').hide();
frequencyUnit.prop('disabled', true).removeClass('required');
frequencyInerval.prop('disabled', true).removeClass('required');
installments.prop('disabled', true);
cj('#amount_sum_label').text('Total Amount');
}
}
function pcpAnonymous() {
// clear nickname field if anonymous is true
if (document.getElementsByName("pcp_is_anonymous")[1].checked) {
document.getElementById('pcp_roll_nickname').value = '';
}
if (!document.getElementsByName("pcp_display_in_roll")[0].checked) {
cj('#nickID').hide();
cj('#nameID').hide();
cj('#personalNoteID').hide();
}
else {
if (document.getElementsByName("pcp_is_anonymous")[0].checked) {
cj('#nameID').show();
cj('#nickID').show();
cj('#personalNoteID').show();
}
else {
cj('#nameID').show();
cj('#nickID').hide();
cj('#personalNoteID').hide();
}
}
}
CRM.$(function($) {
enableHonorType();
toggleRecur();
skipPaymentMethod();
});
CRM.$(function($) {
// highlight price sets
function updatePriceSetHighlight() {
$('#priceset .price-set-row span').removeClass('highlight');
$('#priceset .price-set-row input:checked').parent().addClass('highlight');
}
$('#priceset input[type="radio"]').change(updatePriceSetHighlight);
updatePriceSetHighlight();
// Update pledge contribution amount when pledge checkboxes change
$("input[name^='pledge_amount']").on('change', function() {
var total = 0;
$("input[name^='pledge_amount']:checked").each(function() {
total += Number($(this).attr('amount'));
});
$("input[name^='price_']").val(total.toFixed(2));
});
});