Skip to content

Instantly share code, notes, and snippets.

@anil826
Created May 28, 2018 12:28
Show Gist options
  • Save anil826/884188e181ac4790d15837d4da6d4cda to your computer and use it in GitHub Desktop.
Save anil826/884188e181ac4790d15837d4da6d4cda to your computer and use it in GitHub Desktop.
backup 25
$("#collapse_4c95-e714-99b6 a.btn.btn-success.btn-block.add").removeClass("btn-block").addClass("btn-lg");
$("#component-4ff3-27db-a932").css({"display":"none"})
$("#collapse_4c95-e714-99b6 .btn.btn-success.add.btn-lg").hide();
$("#add_new_contact_or_lead").on("click", function() {
//Showing loader
$('body').append('<div class="custom-loader"><div class="whirl traditional"><div class="spinner-dialog"><span class="spinner-dialog-title">Loading data</span> <br/><span>Please wait...</span> <br/></div></div></div>');
var campaign_member_id = window.formyoula.form_fields["3d01-9f62-3928"].get("value");
if( campaign_member_id ){
console.log("Checkin only")
//Set attended value for table only.
sfdc_data[selected_element].Attended__c = true;
$(".btn.btn-success.add.btn-lg").trigger("click");
setTimeout(function(){
$.each(window.formyoula.form_fields["4c95-e714-99b6"].get("repeat_value"), function(repeat_element, value){
value[13].value = true;
});
load_html_table();
$('.custom-loader').remove();
},4000);
} else {
new_user_data();
$(".btn.btn-success.add.btn-lg").trigger("click");
}
//$('#campaign_table_data_wrapper').show()
});
$(".btn.btn-success.add.btn-lg").on("click", function(){
var campaign_member_id = window.formyoula.form_fields["3d01-9f62-3928"].get("value");
if ( campaign_member_id ) {
$("#campaign_table_data_body tr." + campaign_member_id).find('a.check_in_contact_or_lead').remove();
$("#campaign_table_data_body tr." + campaign_member_id).find('td.user_attended').text("true");
}
$('#campaign_table_data_wrapper').show()
$("#campaign_event_register").show();
$("#component-a327-10f0-c462").show();
});
//check-in-cancel button click event
$("#check_in_cancel").on("click", function(){
$('#campaign_table_data_wrapper').show()
$("#campaign_event_register").show();
$("#component-a327-10f0-c462").show();
$("div.panel.panel-default.new_repeat_entry_panel").hide();
});
//function to set pre-filled data fields as readonly
function check_for_prefill_data(){
//Check if company field is populated
if ( window.formyoula.form_fields["d62e-2a6c-e1ee"].get("value") ) {
$(".new_repeat_entry_panel #component-d62e-2a6c-e1ee input.form-control.input_content").prop('readonly', true);
}
//Check if the firstname field is populated
if(window.formyoula.form_fields["d3fe-3c45-2d83"].get("value")){
$(".new_repeat_entry_panel #component-d3fe-3c45-2d83 input.form-control.input_content").prop('readonly', true);
}
//Check if the lastname field is populated
if(window.formyoula.form_fields["cd92-e232-4a97"].get("value")){
$(".new_repeat_entry_panel #component-cd92-e232-4a97 input.form-control.input_content").prop('readonly', true);
}
//Check if the email field is populated
if(window.formyoula.form_fields["54c3-543d-77a1"].get("value")){
$(".new_repeat_entry_panel #component-54c3-543d-77a1 input.form-control.input_content").prop('readonly', true);
}
//Check if the mobile field is populated
if(window.formyoula.form_fields["90db-9ffe-2306"].get("value")){
$(".new_repeat_entry_panel #component-90db-9ffe-2306 input.form-control.input_content").prop('readonly', true);
}
}
window.formyoula.form_fields["2a52-9b01-7ea4"].on("change", function(){
setTimeout(check_for_prefill_data, 3000);
});
window.formyoula.form_fields["4ff3-27db-a932"].on("change", function(){
setTimeout(check_for_prefill_data, 3000);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment