This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function() { | |
var is_sales_orders = false; | |
var is_marketing_early_pay = false; | |
var is_marketing_totals = false; | |
var is_discretionary = false; | |
var sales_orders = []; | |
var marketing_early_pay = []; | |
var marketing_totals = []; | |
var discretionary = []; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//On prefill success trigger other SF select element. | |
formyoula.form_fields['7221-d2aa-1adf'].on('prefill:success',function(){ | |
$('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>'); | |
$('#component-1e42-f81b-0812 button:first').trigger('click'); | |
setTimeout(function(){ | |
//Click on first SF select. | |
$('#component-1e42-f81b-0812 .select_salesforce_record:first').trigger('click'); //Select first record | |
$('#component-de81-49c2-670c button:first').trigger('click'); //Click on second SF select | |
setTimeout(function() { | |
//Select first record |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/***********************First***************************/ | |
var product1 = { | |
"AUSTRAL PLUS 20 L ROA": ["AUSTRAL PLUS","3250"] | |
} | |
//Repeat group event on adding the record | |
formyoula.form_fields['c47a-5772-e40f'].on('element:create:success',function() { | |
//Loop for repeat index | |
for (var repeat_index=0; repeat_index < window.formyoula.form_fields["c47a-5772-e40f"].get('repeat_value').length; repeat_index++ ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//on click | |
$(document).on('click', '.add', function(){ | |
//Loop for repeat index | |
for (var repeat_index=0; repeat_index < window.formyoula.form_fields["c47a-5772-e40f"].get('repeat_value').length; repeat_index++ ) { | |
//Looop for component data | |
for ( var i_component = 0; i_component < window.formyoula.form_fields["c47a-5772-e40f"].get('repeat_value')[repeat_index].length; i_component++ ) { | |
//Check if type is Salesforce and null value or no value available | |
if ( window.formyoula.form_fields["c47a-5772-e40f"].get('repeat_value')[repeat_index][i_component].type == "Salesforce" ) { | |
if ( window.formyoula.form_fields["c47a-5772-e40f"].get('repeat_value')[repeat_index][i_component].value ) { | |
//Get component_id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Define a global variable to store the selected item on selection of a checkbox | |
var selected_values; | |
// Trigger a function on prefill success once the repeat group is prefilled based on the salesforce selected item | |
window.formyoula.form_fields["Contact"].on("prefill:success", function(){ | |
// Trigger the below function once the data is populated and the checkbox is selected/unselected | |
$(document).on('change', 'input[type="checkbox"]', function(e){ | |
// If selected hide the repeat groups other than the selected one | |
if( $(this).is(':checked') && window.formyoula.form_fields["7221-d2aa-1adf"].changed.repeat_value){ | |
if_checked(); | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//On change on existing repeat group select element please replace the component id of select element | |
// Inside of repeat group. | |
$('.existing_repeat_entry_panel #component-751d-c4d1-b504 select').on('change',function(){ | |
$('.existing_repeat_entry_panel #component-751d-c4d1-b504 select').each(function(index,element){ | |
//Get Pre-fill value on select element | |
var select_value = element ? element.value : ''; | |
//Check the selected pre-fill value if Referencia | |
console.log('Selected value '+ select_value) | |
if ( select_value == 'US' ){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var imageData = null; | |
function getBase64FromImageUrl(url) { | |
var img = new Image(); | |
img.setAttribute('crossOrigin', 'anonymous'); | |
img.src = url; | |
img.onload = function () { | |
var canvas = document.createElement("canvas"); | |
canvas.width =this.width; | |
canvas.height =this.height; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*$(".btn").hide(); | |
formyoula.form_fields["24e6-dc4b-31b9"].on("change", function(){ | |
//loading screen. | |
//formyoula.event_trigger("main:spinner_dialog", { show: true }); | |
}); | |
*/ | |
$(document).ready(function() { | |
if(formyoula.form_fields["1a6c-6142-08cc"]){ | |
console.log(formyoula.form_fields["1a6c-6142-08cc"].get("value")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Supported files | |
//script( type='text/javascript' src="https://fastcdn.org/FileSaver.js/1.1.20151003/FileSaver.min.js"). | |
//script( type='text/javascript' src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.2.0/jszip.min.js"). | |
html2pdf().from(formyoula.get_pdf_html().pdf_html).toPdf().output('datauristring').then(function (pdfAsString) { | |
// The PDF has been converted to a Data URI string and passed to this function. | |
// Use pdfAsString however you like (ZIP, send as email, etc) | |
console.log(pdfAsString); | |
var zip = new JSZip(); | |
var pdf = zip.folder("PDFS"); |