"use strict"; function setFieldValue(value, crmField, datatype) { var attribute = $("#" + crmField).first(); if (attribute === undefined || attribute === null) { alert("CRMField: " + crmField + " is not currently on the form. Please update the form or configuration."); } switch (datatype) { case "string": case "decimal": case "number": attribute.val(value); break; case "boolean": if (attribute.prop("class").indexOf("boolean-dropdown") !== -1) { if (value === true) { attribute.val("1"); } else if (value === false) { attribute.val("0"); } } if (attribute.prop("class").indexOf("boolean-radio") !== -1) { if (value === true) { $("#" + crmField + "_1").first().prop("checked", true); } else if (value === false) { $("#" + crmField + "_0").first().prop("checked", true); } } if (attribute.attr("type") === "checkbox") { attribute.prop("checked", value); } break; case "picklist": $("#" + crmField + " option[value='" + value + "']").prop('selected', true); break; default: alert("Attempted to set data type that is not supported. Please contact your system administrator or support@beyondcrm.com.au"); } } function getFieldValue(crmField, datatype) { var attribute = $("#" + crmField).first(); if (attribute === undefined || attribute === null) { alert("CRMField: " + crmField + " is not currently on the form. Please update the form or configuration."); } switch (datatype) { case "string": case "decimal": case "number": return attribute.val(); case "boolean": if (attribute.prop("class").indexOf("boolean-dropdown") !== -1) { if (attribute.val() === "1") return true; else if (attribute.val() === "0") return false; else return null; } if (attribute.prop("class").indexOf("boolean-radio") !== -1) { if ($("#" + crmField + "_1").first().prop("checked") === true) return true; if ($("#" + crmField + "_0").first().prop("checked") === true) return false; else return null; } if (attribute.attr("type") === "checkbox") { return attribute.prop("checked"); } return null; default: alert("Attempted to set data type that is not supported. Please contact your system administrator or support@beyondcrm.com.au"); return null; } } function changeReadOnly(t,e){e?($("#"+t).addClass("readonly"),$("#"+t).prop("readonly",!0)):($("#"+t).removeClass("readonly"),$("#"+t).prop("readonly",!1))}function addPortalValidator(t,e,a,n){if("undefined"!=typeof Page_Validators){var r=document.createElement("span");r.style.display="none",r.id=t,r.controltovalidate=e,r.errormessage=a,r.evaluationfunction=n,Page_Validators.push(r)}}function showHideField(t,e){e?$("#"+t).closest("td").show():$("#"+t).closest("td").hide()}function showHideSection(t,e){e?$('table[data-name="'+t+'"]').closest("fieldset").show():$('table[data-name="'+t+'"]').closest("fieldset").hide()}function markRequired(t,e){e?$("#"+t+"_label").parent().addClass("info required"):$("#"+t+"_label").parent().removeClass("info required")}function clearAllValidationErrors(){ValidationSummaryEntityFormView.style="display: none;",ValidationSummaryEntityFormView.innerHTML=""}function showNewValidationError(t){if("display: none;"===ValidationSummaryEntityFormView.style.cssText&&(ValidationSummaryEntityFormView.innerHTML=ValidationSummaryEntityFormView.headertext,ValidationSummaryEntityFormView.style=""),0===ValidationSummaryEntityFormView.getElementsByTagName("ul").length){var e=document.createElement("ul");ValidationSummaryEntityFormView.appendChild(e)}var a=document.createElement("li");a.innerText=t,ValidationSummaryEntityFormView.getElementsByTagName("ul")[0].appendChild(a)}function doEditButtonSetup(){$(".tab.clearfix:has(:input:not(.readonly):not(:button):not(:submit):not(:hidden):not(:reset):not([placeholder='Search']))").each(function(t,e){var a=$('');a.val("Update"),a.prop("data-name",e.getAttribute("data-name")),a.addClass("btn btn-primary pull-right action"),a.css("margin-right","38px"),a.css("margin-bottom","15px"),a.on("click",RunOnEdit),a.prop("id",e.getAttribute("data-name").replace(/[^a-z0-9\s]/gi,"").replace(/[_\s]/g,"-")+"-edit"),a.wrapAll('
'),$(e).find(":input:not(.readonly):not(:button):not(select):not(:hidden)").each(function(t,e){$(e).addClass("readonly reenablerequired"),$(e).prop("disabled",!0)}),$(e).find("select").each(function(t,e){var $copy=$(e).clone();$copy.removeAttr("id"),$copy.attr("id","hideOnEdit"),$copy.removeAttr("name"),$copy.prop("disabled","disabled"),$(e).addClass("readonly reenablerequired"),$(e).parent().prepend($copy),$(e).hide()}),$(e).prepend(a.parents().last())})}function RunOnEdit(t){var e=$("#"+t.target.id);e.prop("disabled",!0),e.val("Updating"),$("[data-name='"+e.prop("data-name")+"']").find(":input.reenablerequired:not(select)").each(function(t,e){$(e).removeClass("readonly"),$(e).removeClass("reenablerequired"),$(e).prop("disabled",!1)}),$("[data-name='"+e.prop("data-name")+"']").find("select.reenablerequired").each(function(t,e){$(e).removeClass("readonly"),$(e).removeClass("reenablerequired"),$(e).show(),$(e).prev().hide()})}$(document).ready(function(){if(0!==$("p.text-danger").length&&"undefined"!=typeof ValidationSummaryEntityFormView){if($("p.text-danger").first().parent().hide(),"display: none;"===ValidationSummaryEntityFormView.style.cssText&&(ValidationSummaryEntityFormView.innerHTML=ValidationSummaryEntityFormView.headertext,ValidationSummaryEntityFormView.style=""),0===ValidationSummaryEntityFormView.getElementsByTagName("ul").length){var t=document.createElement("ul");ValidationSummaryEntityFormView.appendChild(t)}var e=document.createElement("li");e.innerText=$("p.text-danger").first().text(),ValidationSummaryEntityFormView.getElementsByTagName("ul")[0].appendChild(e)}}),function(t,e,a){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof exports&&"undefined"==typeof Meteor?module.exports=t(require("jquery")):t(e||a)}(function(t){"use strict";var e=function(e,a,n){var r={invalid:[],getCaret:function(){try{var t,a=0,n=e.get(0),i=document.selection,o=n.selectionStart;return i&&-1===navigator.appVersion.indexOf("MSIE 10")?((t=i.createRange()).moveStart("character",-r.val().length),a=t.text.length):(o||"0"===o)&&(a=o),a}catch(t){}},setCaret:function(t){try{if(e.is(":focus")){var a,n=e.get(0);n.setSelectionRange?n.setSelectionRange(t,t):((a=n.createTextRange()).collapse(!0),a.moveEnd("character",t),a.moveStart("character",t),a.select())}}catch(t){}},events:function(){e.on("keydown.mask",function(t){e.data("mask-keycode",t.keyCode||t.which),e.data("mask-previus-value",e.val()),e.data("mask-previus-caret-pos",r.getCaret()),r.maskDigitPosMapOld=r.maskDigitPosMap}).on(t.jMaskGlobals.useInput?"input.mask":"keyup.mask",r.behaviour).on("paste.mask drop.mask",function(){setTimeout(function(){e.keydown().keyup()},100)}).on("change.mask",function(){e.data("changed",!0)}).on("blur.mask",function(){s===r.val()||e.data("changed")||e.trigger("change"),e.data("changed",!1)}).on("blur.mask",function(){s=r.val()}).on("focus.mask",function(e){!0===n.selectOnFocus&&t(e.target).select()}).on("focusout.mask",function(){n.clearIfNotMatch&&!i.test(r.val())&&r.val("")})},getRegexMask:function(){for(var t,e,n,r,i,s,l=[],d=0;d