var LForm_Time, IsSqlsingle = !0, IsSqlmultiple = !1, loadingTime, field = new Array; function debounce(e, i, t) { var a; return function () { var l = this, o = arguments, n = t && !a; clearTimeout(a), a = setTimeout((function () { a = null, t || e.apply(l, o) }), i), n && e.apply(l, o) } } function ConditionCheck(e, i) { if (loadingTime = new Date, "undefined" != $(".ClientSideActionJson") && "" != $(".ClientSideActionJson").val()) { var t = $(".ClientSideActionJson[value!='[]']"); field = new Array, $.each(t, (function (t, a) { for (var l = jQuery.parseJSON($(a).val()), o = $(a).attr("mid"), n = $(a).attr("pid"), r = 0; r < l.length; r++) { var s = !0, d = l[r]; if (e) { s = !1; for (var c = d.ConditionSet.Conditions, u = 0; u < c.length; u++)c[u].FieldId === $(e).parents("li.Field").attr("guid") && (s = !0); for (var p = d.Actions, f = 0; f < p.length; f++)"Evaluating JavaScript" === p[f].FriendlyName ? -1 !== p[f].Script.indexOf($(e).parents("li.Field").attr("guid")) && (s = !0) : "SQLQuery" === p[f].FriendlyName && -1 !== p[f].Query.indexOf($(e).parents("li.Field").attr("guid")) && (s = !0) } s && ConditionalActionCheck(e, i, d, o, n) } })), setTimeout((function () { $(".lfoverlay, .lfmodal").hide(), IsSqlsingle = !1 }), 10) } } function ConditionalActionCheck(e, i, t, a, l) { new Date - loadingTime > 1e3 && $(".lfoverlay, .lfmodal").show(); var o, n = t, r = []; if (void 0 !== n.Actions && ((o = n.Actions[0]).ModuleId = a, o.PortalId = l, o.GUID = n.GUID), void 0 !== n.ConditionSet) { for (var s = 0; s < n.ConditionSet.Conditions.length; s++) { var d = n.ConditionSet.Conditions[s]; null != e && "undefined" != e || (e = jQuery("[guid='" + d.FieldId + "']").children().first()); var c = ""; if ($(e).parents("li").hasClass("Textbox") && (c = jQuery(".LiveForm li[guid='" + d.FieldId + "'] input[type='text']")), $(e).parents("li").hasClass("Currency") ? c = $.browser.device ? jQuery(".LiveForm li[guid='" + d.FieldId + "'] input[type='tel']") : jQuery(".LiveForm li[guid='" + d.FieldId + "'] input[type='text']") : $(e).parents("li").hasClass("Datetime") || $(e).parents("li").hasClass("Number") || $(e).parents("li").hasClass("Fullname") || $(e).parents("li").hasClass("Address") || $(e).parents("li").hasClass("CreditCard") || $(e).parents("li").hasClass("Phone") || $(e).parents("li").hasClass("Email") ? c = jQuery(".LiveForm li[guid='" + d.FieldId + "'] input[type='text']") : $(e).parents("li").hasClass("Textarea") ? c = jQuery(".LiveForm li[guid='" + d.FieldId + "'] textarea") : $(e).parents("li").hasClass("Dropdown") ? c = jQuery(".LiveForm li[guid='" + d.FieldId + "'] select") : $(e).parents("li").hasClass("Radiobutton") || $(e).parents("li").hasClass("ScaleRating") ? c = jQuery(".LiveForm li[guid='" + d.FieldId + "'] input[type='radio']:checked") : $(e).parents("li").hasClass("Checkbox") ? c = jQuery(".LiveForm li[guid='" + d.FieldId + "'] input[type='checkbox']:checked") : $(e).parents("li").hasClass("Fileupload") ? c = jQuery(".LiveForm li[guid='" + d.FieldId + "'] div[controlid]") : $(e).parents("li").hasClass("StarRating") ? c = jQuery(".LiveForm li[guid='" + d.FieldId + "']").find(".StarRatingRequired").find("div") : $(e).parents("li").hasClass("Matrix") ? c = jQuery(".LiveForm li[guid='" + d.FieldId + "'] input[type='text']") : ($(e).parents("li").hasClass("SingleReference") || $(e).parents("li").hasClass("MultiReference")) && (c = jQuery(".LiveForm li[guid='" + d.FieldId + "'] .tagify")), "" != c && 0 == c.length) c = getElement(jQuery(".LiveForm li[guid='" + d.FieldId + "']"), d); if ("undefined" != c && c.length > 0 && $(c).parents("li").attr("guid") == d.FieldId) { for (var u = "", p = c.length, f = 0; f < p; f++) { var h = c[f]; if ("" != u && (p > 1 && "Is Selected" != d.DisplayName ? u += " && " : u += " || "), d.CompareTo && (d.CompareTo = d.CompareTo.replace("'", '"')), void 0 !== $(h).attr("id") && "plupload_content" != $(h).attr("class") && "StarRatingRequired" != $(h).parent("div").attr("class") && 0 == $(e).parents("li").hasClass("Currency") && 0 == $(h).closest("li").hasClass("Datetime")) u += "jQuery('#" + $(h).attr("id") + "').val().replace(\"'\",'\"') "; else if (1 == $(e).parents("li").hasClass("Currency")) u += "element.maskMoney('unmasked')[0]"; else if (1 == $(e).parents("li").hasClass("SingleReference") || 1 == $(e).parents("li").hasClass("MultiReference")) { var v = new Array; $(".LiveForm li[guid=" + d.FieldId + "] .Field-Container-Wide tags tag").each((function (e, i) { v.push(i.__tagifyTagData.code) })); var m = d.CompareTo.split(","), g = 0; $.each(m, (function (e, i) { $.each(v, (function (i, t) { v[i] == m[e] && (g += 1) })) })), u += g } var y = $(h).closest("li").hasClass("Datetime"); if (!y && ("" != u || u.length > 0) && ("Is Equal To" == d.DisplayName || "Is Selected" == d.DisplayName ? u += "== '" + d.CompareTo + "'" : "Less Than" == d.DisplayName ? u += "<" + d.CompareTo + "&&" + u + "!=''" : "Greater Than" == d.DisplayName ? u += ">" + d.CompareTo + "&&" + u + "!=''" : "Is Not Equal To" == d.DisplayName || "Not Selected" == d.DisplayName ? u += "!= '" + d.CompareTo + "'" : "Is Filled" == d.DisplayName ? u += "!= ''" : "Is Empty" == d.DisplayName ? u += "== ''" : "Contains" == d.DisplayName ? u += ".indexOf('" + d.CompareTo + "')!=-1" : "Does Not Contains" == d.DisplayName ? u += ".indexOf('" + d.CompareTo + "')==-1" : "Starts With" == d.DisplayName ? u += ".indexOf('" + d.CompareTo + "')==0" : "Doesn't Start With" == d.DisplayName ? u += ".indexOf('" + d.CompareTo + "')!=0" : "Ends With" == d.DisplayName ? u += ".substr(-" + d.CompareTo.length + ")=='" + d.CompareTo + "'" : "Doesn't End With" == d.DisplayName ? u += ".substr(-" + d.CompareTo.length + ")!='" + d.CompareTo + "'" : "Is In" != d.DisplayName || 1 != $(e).parents("li").hasClass("SingleReference") && 1 != $(e).parents("li").hasClass("MultiReference") ? "Is Not In" != d.DisplayName || 1 != $(e).parents("li").hasClass("SingleReference") && 1 != $(e).parents("li").hasClass("MultiReference") || (u += "== 0") : u += " > 0"), "plupload_content" == $(h).attr("class") && ("Is Filled" == d.DisplayName ? u += " " + jQuery(h).attr("controlid") + ".files.length > 0 " : "Is Empty" == d.DisplayName && (u += " " + jQuery(h).attr("controlid") + ".files.length == 0 ")), "StarRatingRequired" == $(h).parent("div").attr("class") && ("Is Equal To" == d.DisplayName ? u += "jQuery('#" + h.id + "').raty('score')=='" + d.CompareTo + "'" : "Is Not Equal To" == d.DisplayName ? u += "jQuery('#" + h.id + "').raty('score')!='" + d.CompareTo + "'" : "Less Than" == d.DisplayName ? u += "jQuery('#" + h.id + "').raty('score')<'" + d.CompareTo + "'" : "Greater Than" == d.DisplayName ? u += "jQuery('#" + h.id + "').raty('score')>'" + d.CompareTo + "'" : "Is Filled" == d.DisplayName ? u += "jQuery('#" + h.id + "').raty('score') > 0" : "Is Empty" == d.DisplayName && (u += "jQuery('#" + h.id + "').raty('score') == 'undefined' || jQuery('#" + h.id + "').raty('score') == 0")), y) { var F = jQuery("#" + h.id).closest("li").find(".datepicker_day").val(), b = jQuery("#" + h.id).closest("li").find(".datepicker_month").val(), C = jQuery("#" + h.id).closest("li").find(".datepicker_year").val(); F.length > 0 && F < 10 && (F = `0${F}`), b.length > 0 && b < 10 && (b = `0${b}`); var I = `${b}/${F}/${C}`; if (jQuery("#" + h.id).closest("li").find(".Calander-Icon").val(I), "Is Filled" == d.DisplayName) u += "jQuery('#" + h.id + "').closest('li').find('.datepicker_day').val().replace(\"'\",'\"')!=''"; else if ("Is Empty" == d.DisplayName) u += "jQuery('#" + h.id + "').closest('li').find('.datepicker_day').val().replace(\"'\",'\"')==''"; else if ("Is Equal To" == d.DisplayName) u += "jQuery('#" + h.id + "').closest('li').find('.Calander-Icon').val()=='" + d.CompareTo + "'"; else if ("Is Not Equal To" == d.DisplayName) u += "jQuery('#" + h.id + "').closest('li').find('.Calander-Icon').val()!='" + d.CompareTo + "'"; else if ("Is Before" == d.DisplayName) u += "jQuery('#" + h.id + "').closest('li').find('.Calander-Icon').val()<'" + d.CompareTo + "'"; else if ("Is After" == d.DisplayName) u += "jQuery('#" + h.id + "').closest('li').find('.Calander-Icon').val()>'" + d.CompareTo + "'"; else if ("Is Today" == d.DisplayName) { var k = new Date, x = k.getDate(), w = k.getMonth() + 1, D = k.getFullYear(); x < 10 && (x = `0${x}`), w < 10 && (w = `0${w}`), k = `${w}/${x}/${D}`, u += "jQuery('#" + h.id + "').closest('li').find('.Calander-Icon').val()=='" + k + "'" } else "Is In Next" == d.DisplayName ? u += "(new Date(jQuery('#" + h.id + "').closest('li').find('.Calander-Icon').val())>new Date() && new Date(jQuery('#" + h.id + "').closest('li').find('.Calander-Icon').val())new Date().setDate(new Date().getDate() - " + d.CompareTo + "))") } } "" != u && (r.push(u), u = "") } else ($(jQuery(".LiveForm li[guid='" + d.FieldId + "']")).hasClass("Radiobutton") || $(jQuery(".LiveForm li[guid='" + d.FieldId + "']")).hasClass("Checkbox")) && "Not Selected" == d.DisplayName || ($(jQuery(".LiveForm li[guid='" + d.FieldId + "']")).hasClass("Radiobutton") || $(jQuery(".LiveForm li[guid='" + d.FieldId + "']")).hasClass("Checkbox")) && "Is Empty" == d.DisplayName ? r.push(!0) : r.push(!1) } var L = ""; if ($.each(r, (function (e, i) { "" != L && (1 == n.ConditionSet.MatchCondition ? L += " && " : L += " || "), L += i })), "jQuery('#undefined').val() != ''" == L && (L = ""), "SQLQuery" == o.FriendlyName) { var T = $($(e).closest(".Field")).attr("guid"); if (IsSqlsingle && PerformAction(L, o, e, c, i), o.FieldValue != T && "" != o.Query && 1 == IsSqlmultiple) { var S = !1; $.each(field, (function (e, i) { if (o.Query.indexOf(i) > -1) return S = !0, !1; S = !1 })), (S || o.Query.indexOf(T) > -1) && (PerformAction(L, o, e, c, i), field.push(o.FieldValue)) } } else ("Evaluating JavaScript" == o.FriendlyName || "Create Ticket" == o.FriendlyName || "" != L || "" == L && "plupload_content" == $(c).attr("class")) && PerformAction(L, o, e, c, i); showhideFields(a) } } function showhideFields(e) { $("#LiveForm" + e + " li.Field.clear-left:not(.form-col-12)").each((function (e, i) { if (null != $(i).attr("style") && $(i).attr("style").indexOf("visibility") > -1) { var t = []; fieldObj = {}, fieldObj.elem = $(i), fieldObj.visibility = $(i).css("visibility"), t.push(fieldObj), $(i).find(" ~ li.Field").each((function (e, i) { if ($(i).hasClass("clear-left") || !$(i).hasClass("clear-left") && $(i).hasClass("Last")) { !$(i).hasClass("clear-left") && $(i).hasClass("Last") && (fieldObj = {}, fieldObj.elem = $(i), fieldObj.visibility = $(i).css("visibility"), t.push(fieldObj)); var a, l = []; for (e = 0; e < t.length - 1; e++)t[e + 1].visibility != t[e].visibility && l.push(t[e]); if (!l.length) a = "visible" == t[0].visibility ? "block" : "none", $(t).each((function (e, i) { $(i.elem).css("display", a) })); return !1 } fieldObj = {}, fieldObj.elem = $(i), fieldObj.visibility = $(i).css("visibility"), t.push(fieldObj) })) } })) } function getElement(e, i) { return $(e).hasClass("Textbox") && (element = jQuery(".LiveForm li[guid='" + i.FieldId + "'] input[type='text']")), $(e).hasClass("Currency") ? $.browser.device ? element = jQuery(".LiveForm li[guid='" + i.FieldId + "'] input[type='tel']") : element = jQuery(".LiveForm li[guid='" + i.FieldId + "'] input[type='text']") : $(e).hasClass("Datetime") || $(e).hasClass("Number") || $(e).hasClass("Fullname") || $(e).hasClass("Address") || $(e).hasClass("CreditCard") || $(e).hasClass("Phone") || $(e).hasClass("Email") ? element = jQuery(".LiveForm li[guid='" + i.FieldId + "'] input[type='text']") : $(e).hasClass("Textarea") ? element = jQuery(".LiveForm li[guid='" + i.FieldId + "'] textarea") : $(e).hasClass("Dropdown") ? element = jQuery(".LiveForm li[guid='" + i.FieldId + "'] select") : $(e).hasClass("Radiobutton") || $(e).hasClass("ScaleRating") ? element = jQuery(".LiveForm li[guid='" + i.FieldId + "'] input[type='radio']:checked") : $(e).hasClass("Checkbox") ? element = jQuery(".LiveForm li[guid='" + i.FieldId + "'] input[type='checkbox']:checked") : $(e).hasClass("Fileupload") ? element = jQuery(".LiveForm li[guid='" + i.FieldId + "'] div[controlid]") : $(e).hasClass("StarRating") ? element = jQuery(".LiveForm li[guid='" + i.FieldId + "']").find(".StarRatingRequired").find("div") : $(e).hasClass("Matrix") && (element = jQuery(".LiveForm li[guid='" + i.FieldId + "'] input[type='text']")), element } function PerformAction(evalScript, action, obj, element, ele) { var result = eval(evalScript); if ("Show Hide Field" == action.FriendlyName) { var ControlsToHideShow = action.ControlToHideShow.split(","); $.each(ControlsToHideShow, (function (e, i) { if ("Show" == action.HideShowType || "Show Multiple" == action.HideShowType) if (result) { $(".LiveForm li[guid='" + i + "']").find("input[furequired],input[scalerequired],input[scorerequired]").removeClass("novalidate"); var t = $(".LiveForm li[guid='" + i + "']").find("input[type=text],textarea,select,input[type=radio],input[type=checkbox]"); $.each(t, (function (e, i) { $(i).removeClass("novalidate") })), $(".LiveForm li[guid='" + i + "']").hasClass("form-col-12") ? $(".LiveForm li[guid='" + i + "']").css("display", "block") : $(".LiveForm li[guid='" + i + "']").css("visibility", "visible") } else { $(".LiveForm li[guid='" + i + "']").find("input[furequired],input[scalerequired],input[scorerequired]").addClass("novalidate"); t = $(".LiveForm li[guid='" + i + "']").find("input[type=text],textarea,select,input[type=radio],input[type=checkbox]"); $.each(t, (function (e, i) { $(i).addClass("novalidate") })), $(".LiveForm li[guid='" + i + "']").hasClass("form-col-12") ? $(".LiveForm li[guid='" + i + "']").css("display", "none") : $(".LiveForm li[guid='" + i + "']").css("visibility", "hidden") } if ("Hide" == action.HideShowType || "Hide Multiple" == action.HideShowType) if (result) { $(".LiveForm li[guid='" + i + "']").find("input[furequired],input[scalerequired],input[scorerequired]").addClass("novalidate"); t = $(".LiveForm li[guid='" + i + "']").find("input[type=text],textarea,select,input[type=radio],input[type=checkbox]"); $.each(t, (function (e, i) { $(i).addClass("novalidate") })), $(".LiveForm li[guid='" + i + "']").hasClass("form-col-12") ? $(".LiveForm li[guid='" + i + "']").css("display", "none") : $(".LiveForm li[guid='" + i + "']").css("visibility", "hidden") } else { $(".LiveForm li[guid='" + i + "']").find("input[furequired],input[scalerequired],input[scorerequired]").removeClass("novalidate"); t = $(".LiveForm li[guid='" + i + "']").find("input[type=text],textarea,select,input[type=radio],input[type=checkbox]"); $.each(t, (function (e, i) { $(i).removeClass("novalidate") })), $(".LiveForm li[guid='" + i + "']").hasClass("form-col-12") ? $(".LiveForm li[guid='" + i + "']").css("display", "block") : $(".LiveForm li[guid='" + i + "']").css("visibility", "visible") } })) } else if ("Require Field" == action.FriendlyName) { var controlToRequire = action.controlToRequire.split(","); $.each(controlToRequire, (function (e, i) { if ("Require" == action.requireType || "Require Multiple" == action.requireType) if (result) { $(".LiveForm li[guid='" + i + "']").addClass("Required"), $(".LiveForm li[guid='" + i + "']").find("input.starratinghidden").attr("scorerequired", "scorerequired"), $(".LiveForm li[guid='" + i + "']").find("input").attr("furequired", "furequired"); var t = $(".LiveForm li[guid='" + i + "']").find("input[type=text],textarea,select,input[type=radio],input[type=checkbox]"); $.each(t, (function (e, i) { $(i).attr("required", "required") })) } else { $(".LiveForm li[guid='" + i + "']").removeClass("Required"); t = $(".LiveForm li[guid='" + i + "']").find("input[type=text],textarea,select,input[type=radio],input[type=checkbox]"); $.each(t, (function (e, i) { $(i).removeAttr("required"), $(i).removeClass("error"), $(i).next(".error").css("display", "none") })) } if ("Unrequire" == action.requireType || "Unrequire Multiple" == action.requireType) if (result) { $(".LiveForm li[guid='" + i + "']").removeClass("Required"), $(".LiveForm li[guid='" + i + "']").find("input[furequired]").removeAttr("furequired"), $(".LiveForm li[guid='" + i + "']").find("input[scalerequired]").removeAttr("scalerequired"), $(".LiveForm li[guid='" + i + "']").find("input[scorerequired]").removeAttr("scorerequired"); t = $(".LiveForm li[guid='" + i + "']").find("input[type=text],textarea,select,input[type=radio],input[type=checkbox]"); $.each(t, (function (e, i) { $(i).removeAttr("required"), $(i).removeAttr("cbrequired"), $(i).removeClass("error"), $(i).next(".error").css("display", "none"), $(i).parents("div").next(".error").css("display", "none") })) } else { $(".LiveForm li[guid='" + i + "']").addClass("Required"), $(".LiveForm li[guid='" + i + "']").find("input.starratinghidden").attr("scorerequired", "scorerequired"), $(".LiveForm li[guid='" + i + "']").find("input").attr("furequired", "furequired"); t = $(".LiveForm li[guid='" + i + "']").find("input[type=text],textarea,select,input[type=radio],input[type=checkbox]"); $.each(t, (function (e, i) { $(i).attr("required", "required") })) } })) } else if ("SQLQuery" == action.FriendlyName) { if (result || null == result) { var fields = []; $(".Field.Textbox,.Field.Textarea,.Field.Dropdown,.Field.Radiobutton,.Field.Email,.Field.Number,.Field.Currency").each((function (e, i) { var t = ""; if ($(i).hasClass("Textbox")) t = $(i).find("input[type=text]").val(); else if ($(i).hasClass("Textarea")) t = $(i).find("textarea").val(); else if ($(i).hasClass("Email")) t = $(i).find("input[type=text]").val(); else if ($(i).hasClass("Number")) t = $(i).find("input[type=text]").val(); else if ($(i).hasClass("Currency")) t = $.browser.device ? $($(i).find("input[type=tel]")).maskMoney("unmasked")[0].toString() : $($(i).find("input[type=text]")).maskMoney("unmasked")[0].toString(); else if ($(i).hasClass("Dropdown")) { t = (a = $(i).find("select").val().split("|"))[0], a.length > 1 && (t = a[1]), "" == t && (t = $(i).find("select").attr("selectedoption")) } else if ($(i).hasClass("Radiobutton")) { var a; if (null != $(i).find("input[type=radio]:checked").val()) t = (a = $(i).find("input[type=radio]:checked").val().split("|"))[0], a.length > 1 && (t = a[1]); else t = "" } null == t && (t = ""), t.indexOf("+") > -1 && (t = encodeURIComponent(t)); var l = { GUID: "" + i.getAttribute("guid"), Value: "" + t }; fields.push(l) })); var controls = $(".LiveForm li[guid='" + action.FieldValue + "']").find("input[type=text],textarea,select,input[type=radio],input[type=checkbox]"), api = eval("LiveFormTabID" + action.ModuleId), sf = $.ServicesFramework(api.TabID), formdata = JSON.stringify(fields); $(".lfoverlay, .lfmodal").show(), $.ajax({ type: "POST", url: window.location.origin + sf.getServiceRoot("LiveForms") + "views/ExecuteSQL?SqlId=" + action.SqlId, headers: { ModuleId: parseInt(action.ModuleId), TabId: parseInt(api.TabID), RequestVerificationToken: $.ServicesFramework(parseInt(action.ModuleId)).getAntiForgeryValue() }, data: JSON.stringify(formdata), dataType: "json", async: !1, contentType: "application/json", success: function (e) { if ($(".lfoverlay, .lfmodal").hide(), $(controls).closest(".Field").hasClass("Textbox")) controls[0].value = "" != e ? e.Value : ""; else if ($(controls).closest(".Field").hasClass("Currency")) controls[0].value = "" != e ? e.Value : ""; else if ($(controls).closest(".Field").hasClass("Textarea")) controls[0].value = "" != e ? e.Value : ""; else if ($(controls).closest(".Field").hasClass("Email")) controls[0].value = "" != e ? e.Value : ""; else if ($(controls).closest(".Field").hasClass("Number")) controls[0].value = "" != e ? e.Value : ""; else if ($(controls).closest(".Field").hasClass("Dropdown")) { var i = $(controls).val(); if ("" == i && (i = $(controls).attr("selectedoption")), $(controls).empty(), "" != e) $.each(e, (function (e, t) { var a = $(""); a.attr("value", t), i == t && a.attr("selected", "selected"); var l = e.substr(1); a.append(l), $(controls).append(a) })); else (n = $("")).attr("value", ""), n.append(""), $(controls).append(n) } else if ($(controls).closest(".Field").hasClass("Checkbox")) { var t = $(controls).closest(".Field").hasClass("Required"); r = (r = $(controls[0]).attr("id")).substring(0, r.length - 2), s = (s = $(controls[0]).attr("name")).substring(0, s.length - 1); var a = 0, l = document.getElementById(r); r += "_"; var o = document.createElement("tbody"); if ("" != e) $.each(e, (function (e, i) { var l = '' + n + "", $(o).append(l), a++ })); else { var n = '' + n + "", $(o).append(l), a++ })); else { n = ' 1 && (t = l[1]), a = $(i).find("option:selected").text() } else if ($(i).hasClass("Radiobutton")) { var l; if (null != $(i).find("input[type=radio]:checked").val()) t = (l = $(i).find("input[type=radio]:checked").val().split("|"))[0], l.length > 1 && (t = l[1]), a = $(i).find("input:checked").next().text() } else if ($(i).hasClass("Checkbox")) { var o = 0; $.each($(i).find("input[type=checkbox]:checked"), (function (e, i) { if (null != $(i).val()) { var t = $(i).val().split("|"), l = t[0]; t.length > 1 && (l = t[1]), o = o + "+" + l, a += $(this).next().text() + "," } })), t = "(" + o + ")", a = a.replace(/,$/, "") } "" == t && (t = 0), action.Script.indexOf("[" + i.getAttribute("guid") + "]") >= 0 && (action.Script = action.Script.replace(new RegExp("\\[" + i.getAttribute("guid") + "]", "g"), t)), action.Script.indexOf("[" + i.getAttribute("guid") + ":text]") >= 0 && (action.Script = action.Script.replace(new RegExp("\\[" + i.getAttribute("guid") + ":text]", "g"), "'" + a + "'")) })); try { var Value = ""; eval("Value =" + action.Script) } catch (e) { Value = action.Script } var controls = $(".LiveForm li[guid='" + action.FieldName + "']").find("input[type=text],textarea,input[type=tel]"); $.each(controls, (function (e, i) { if ($(i).closest("li").hasClass("Currency")) { var t = $(i).attr("precision"); $(i).val(parseFloat(Value).toFixed(t)), $(i).maskMoney("mask") } else $(i).val(Value) })), $(':contains("{' + action.FieldValue + '}")').filter((function () { $(this).children().length < 1 && $(this).html((function (e, i) { return i.replace("{" + action.FieldValue + "}", "") })) })), $(".LiveForm *").each((function () { var e = $(this); $.each(this.attributes, (function () { this.value.includes("{" + action.FieldValue + "}") && (e.attr("data-" + action.GUID, this.name), e.attr(this.name, this.value.replace("{" + action.FieldValue + "}", Value))) })) })), $("[data-" + action.GUID + "]").each((function () { var e = $(this); e.attr(e.attr("data-" + action.GUID), Value) })), controls = $("." + action.GUID), $.each(controls, (function (e, i) { $(i).html(Value) })) } } else if ("Create Ticket" == action.FriendlyName && ($(':contains("{' + action.Token + '}")').filter((function () { $(this).children().length < 1 && $(this).html((function (e, i) { return i.replace("{" + action.Token + "}", "
") })) })), $("#" + action.GUID).hide(), null != action.ModuleID)) { var controls = $(".LiveForm li[guid='" + action.Subject.replace(/[\[\]']+/g, "") + "']").find("input[type=text],textarea,select,input[type=radio],input[type=checkbox]").val(), Category = $(".LiveForm li[guid='" + action.CategoryName.replace(/[\[\]']+/g, "") + "']").find("input[type=text],textarea,select,input[type=radio],input[type=checkbox]").val(); if ("" != controls) { var IsTokenExistInUI = !1; null != action.Token && "" != action.Token && (IsTokenExistInUI = document.documentElement.innerHTML.indexOf("{" + action.Token + "}") > -1), IsTokenExistInUI && $.ajax({ url: action.IntegrationURL + "?app=Knowledgebase", headers: { ModuleId: parseInt(action.ModuleID), TabId: parseInt(action.TabID), RequestVerificationToken: $.ServicesFramework(parseInt(action.ModuleID)).getAntiForgeryValue() }, dataType: "json", method: "GET", async: !1, success: function (e) { null != e && null != e && "true" == e.KnowledgebaseIntegrationAvailable && "false" != e.IntegrateKnowledgebase && $.ajax({ url: e.URL + "?moduleId=" + parseInt(e.ModuleID) + "&query=" + controls + "&category=" + Category, headers: { ModuleId: parseInt(e.ModuleID), TabId: parseInt(e.TabID), RequestVerificationToken: $.ServicesFramework(parseInt(e.ModuleID)).getAntiForgeryValue() }, dataType: "json", method: "GET", async: !1, success: function (e) { null != e && e.length > 0 ? ($("#" + action.GUID).show(), $("#Panel_" + action.GUID).remove(), $("#" + action.GUID).append("
" + LFValidations.RelatedArticle + "
    "), $.each(e, (function (e, i) { $("ul." + action.GUID).append('
  • ' + i.Title + '

    ' + i.Folder.Parent.Name + " / " + i.Folder.Name + "
  • ") }))) : ($("#Panel_" + action.GUID).remove(), $("#" + action.GUID).hide()) } }) } }) } } if ("Skip To Page" == action.FriendlyName) { var pageToSkip = action.skipToPage.replace("Page ", ""), SkipPage = !$(obj).closest(".LiveForm").find("ul.page-break-section:nth-of-type(" + pageToSkip + ")").is(":visible"); if (result) for (var prevUL = $(obj).closest("ul.page-break-section").prevAll("ul.page-break-section").length, i = prevUL + 2; i < pageToSkip; i++)$(obj).closest(".LiveForm").find("ul.page-break-section:nth-of-type(" + i + ")").addClass("skipped").hide(); else for (var prevUL = $(obj).closest("ul.page-break-section").prevAll("ul.page-break-section").length, i = prevUL + 2; i < pageToSkip; i++)$(obj).closest(".LiveForm").find("ul.page-break-section:nth-of-type(" + i + ")").removeClass("skipped"); if (SkipPage && result && ValidatePageNextSubmit(obj, element) && null == ele && $(obj).is(":visible")) { $(obj).closest("ul.page-break-section").hide(), $(obj).closest(".LiveForm").find("ul.page-break-section:nth-of-type(" + pageToSkip + ")").fadeIn((function () { $(".Signatures").each((function (e, i) { $(i).is(":visible") && $(i).find("canvas").length <= 0 && (parseInt(i.getAttribute("width")) > 0 ? $(i).jSignature({ "decor-color": "transparent", height: parseInt(i.getAttribute("height")), width: parseInt(i.getAttribute("width")) }).addClass("mobile-resp") : $(i).jSignature({ "decor-color": "transparent", height: parseInt(i.getAttribute("height")) }).addClass("mobile-resp")) })) })), ProgressSection($(obj).closest(".LiveForm").find("ul.page-break-section:nth-of-type(" + pageToSkip + ")")), $("html,body").animate({ scrollTop: $(obj).closest(".LiveForm").find("ul.page-break-section:nth-of-type(" + pageToSkip + ")").find("li").first().offset().top - 100 }, 500); var pages = $(obj).closest(".LiveForm").find("ul.page-break-section.skipped"); $.each(pages, (function (e, i) { var t = $(i).find("li.Field"); $.each(t, (function (e, i) { $(i).find("input[furequired],input[scalerequired],input[scorerequired]").addClass("novalidate"); var t = $(i).find("input[type=text],textarea,select,input[type=radio],input[type=checkbox]"); $.each(t, (function (e, i) { $(i).addClass("novalidate") })) })) })) } } } function ValidatePageNextSubmit(e, i) { return $(".Field.Currency input").each((function () { $(this).select() })), ProcessingActions(e, i, this) } $(document).ready((function () { $(".Form_Navigation").find("li:first-child").addClass("active"), $(".Form_title").find("li:first-child").addClass("active"), $(".LiveForm").each((function (e, i) { var t = $(i).attr("uniqueid"); $(window).width() <= 768 ? ($("#" + t + " ul.Form_Navigation li").hide().slice(0, 2).show(), $("#" + t + " ul.Form_title li").hide().slice(0, 2).show()) : ($("#" + t + " ul.Form_Navigation li").hide().slice(0, 5).show(), $("#" + t + " ul.Form_title li").hide().slice(0, 5).show()) })), ConditionCheck(null), $('[condition] select,[condition] input[type="radio"]').each((function (e, i) { $(i).bind("keyup change FilesAdded", (function () { ConditionCheck(i) })) })), $('[condition] input[type="checkbox"], [condition] input[type="tel"]').each((function (e, i) { $(i).bind("keyup change FilesAdded", debounce((function (e) { ConditionCheck(i) }), 1500)) })), $('[condition] input[type="text"],[condition] textarea').each((function (e, i) { $(i).bind("blur", (function () { ConditionCheck(i) })) })), $("[condition]").find(".StarRatingRequired").find("div img").each((function (e, i) { $(i).bind("click", (function () { ConditionCheck(i) })) })), $("[condition].Datetime").find('input[type="text"]').each((function (e, i) { $(i).on("change", (function (e) { ConditionCheck(i) })) })), $("[condition] .Field-Container-Wide tags").each((function (e, i) { $(i).on("DOMSubtreeModified", (function (e) { ConditionCheck(i) })) })), $(window).load((function (ob) { $(".LiveForm .Fileupload div[controlid]").each((function (i, obj) { eval(jQuery(obj).attr("controlid")).bind("FilesAdded", (function (e, i) { ConditionCheck(obj) })), eval(jQuery(obj).attr("controlid")).bind("FilesRemoved", (function (e, i) { ConditionCheck(obj) })) })) })), IsSqlmultiple = !0, $(".DvLfBrowsefile").click() })), $("[pageNext]").unbind("click"), $(document).on("click", "[pageNext]", ValidatePageNextSubmit), $("[pageBack]").unbind("click"), $(document).on("click", "[pageBack]", ValidatePageNextSubmit); var ProcessingActions = function (evt, element, currentobj) { loadingTime = new Date; var selector = evt.currentTarget; void 0 === selector && (selector = evt), void 0 === element && (element = evt); var $group = $(selector).parents(".page-break-section"), isValid = !0, focus = new Array; if ($(element.currentTarget).is(":visible") && "pageBack" != $(selector).attr("pageback") && ($group.find(":input").each((function (e, i) { if ($(i).is(":visible") && !$(i).valid() ? (focus.push(i), isValid = !1) : ("furequired" != $(i).attr("furequired") || $(i).valid()) && ("fbrequired" != $(i).attr("fbrequired") || $(i).valid()) ? "tagrequired" == $(i).attr("tagrequired") ? null != $(i).parent("div").attr("tagrequired") && "true" == $(i).parent("div").attr("tagrequired") && ($(i).parent("div").find("tag").length < 1 ? ($("#label" + $(i).attr("tag")).remove(), $("").insertAfter($(i)), isValid = !1) : $("#label" + $(i).attr("tag")).remove()) : "required" == $(i).attr("ckeditor") && null != $(i).parent("div").attr("editorrequired") && "true" == $(i).parent("div").attr("editorrequired") && $.each(CKEDITOR.instances, (function (e, t) { null != $(t.element.$).parent("div").parent("li") && 1 == $(t.element.$).parent("div").parent("li").is(":visible") && $(i).attr("ckeditor") == $(t.element.$).attr("ckeditor") && ("" == t.getData() ? ($("#label" + $(i).attr("ckeditor")).remove(), $("").insertAfter($(i).parent("div").children("div")), isValid = !1) : $("#label" + $(i).attr("ckeditor")).remove()) })) : (focus.push(i), isValid = !1), $(i).hasClass("g-recaptcha-response") && !$(i).hasClass("novalidate")) { var t = $(i).closest("div[googlerecaptchaid]"), a = grecaptcha.getResponse($(t).attr("googlerecaptchaid")); $("#" + $(t).attr("id") + " .error").remove(), 0 == a.length && (isValid = !1, $("#" + $(t).attr("id")).append('")) } })), $group.find(".Field.Password").each((function (e, i) { var t = "", a = ""; $(i).find(":input").each((function (e, i) { $(i).is(":visible") && ($(i).next(".conmessage").remove(), $(i).hasClass("password") ? t = i.value : $(i).hasClass("confirmpassword") && ($(i).next(".conmessage").remove(), a = i.value, t != a && ($('").insertAfter(i), isValid = !1))) })) })), isValid = ValidateExtension($group, focus, isValid), $(focus).length > 0 && $("html,body").animate({ scrollTop: $(focus).first().closest("li").first().offset().top - 100 }, 500, (function () { $(focus).first().focus() }))), isValid) if ($.isWindow(currentobj)) { if ($.isWindow(currentobj)) return !0 } else $(".lfoverlay, .lfmodal").show(), $('[condition] input[type="text"],[condition] textarea,[condition] select,[condition] input[type="radio"],[condition] input[type="checkbox"]').each((function (e, i) { $(i).is(":visible") && setTimeout((function () { ConditionCheck(i, element) }), 10) })), setTimeout((function () { var srcElement = element.srcElement || element.target; if ($(srcElement).is(":visible")) { if ("pageNext" == $(srcElement).attr("pageNext")) { var item = $(srcElement).parents("ul.page-break-section").nextAll("ul.page-break-section:not(.skipped)").first(); $(currentobj).closest("ul.page-break-section").hide(), $(srcElement).parents("ul.page-break-section").nextAll("ul.page-break-section:hidden:not(.skipped)").first().removeClass("bounceInRight bounceInLeft").fadeIn((function () { $(".plupload_content").each((function (e, i) { window[$(i).attr("controlid")].refresh() })), $(".Signatures").each((function (e, i) { $(i).is(":visible") && $(i).find("canvas").length <= 0 && (parseInt(i.getAttribute("width")) > 0 ? $(i).jSignature({ "decor-color": "transparent", height: parseInt(i.getAttribute("height")), width: parseInt(i.getAttribute("width")) }).addClass("mobile-resp") : $(i).jSignature({ "decor-color": "transparent", height: parseInt(i.getAttribute("height")) }).addClass("mobile-resp")) })) })).addClass("appear-animation appear-animation-visible bounceInRight"), $("body").addClass("overflow-hide"), ProgressSection(item), void 0 !== item && $("html,body").animate({ scrollTop: $(item).find("li").first().offset().top - 100 }, 500), setTimeout((function () { $("body").removeClass("overflow-hide") }), 1e3) } else if ("pageBack" == $(srcElement).attr("pageBack")) { var item = $(srcElement).parents("ul.page-break-section").prevAll("ul.page-break-section:not(.skipped)").first(); $(currentobj).closest("ul.page-break-section").hide(), $(srcElement).parents("ul.page-break-section").prevAll("ul.page-break-section:hidden:not(.skipped)").first().removeClass("bounceInRight bounceInLeft").fadeIn().addClass("appear-animation appear-animation-visible bounceInLeft"), $("body").addClass("overflow-hide"), ProgressSection(item), void 0 !== item && $("html,body").animate({ scrollTop: $(item).find("li").first().offset().top - 100 }, 500), setTimeout((function () { $("body").removeClass("overflow-hide") }), 1e3) } var LF = $(currentobj).parents(".LiveForm").attr("uniqueid"); null != typeof LF && LiveForms.AppendViewPortClass(LF, eval(LF + "MU")), $(".lfoverlay, .lfmodal").hide() } }), 10); else $(evt).is("input[type=button]") && evt.preventDefault() }, ProgressSection = function (e) { var i = $(e).parents(".LiveForm").attr("uniqueid"), t = $("#" + i + " .Form_Navigation"), a = e.index(); if (t.length > 0) { var l = $("#" + i + " ul.page-break-section").length, o = 100 / l * a, n = (t = $("#" + i + " .Form_Navigation"), $("#" + i + " .progressbar")); if ($(t).find("li").removeClass("active"), $("#" + i + " .Form_title").find("li").removeClass("active"), $(t).find("li:eq(" + (a - 1) + ")").addClass("active"), $("#" + i + " .Form_title").find("li:eq(" + (a - 1) + ")").addClass("active"), $(n).find(".progressfield").css("width", o + "%"), 100 == Math.round(o) ? $(n).find(".progressfield").css("border-radius", "20px") : $(n).find(".progressfield").css("border-radius", "20px 0 0 20px"), $("#" + i + " .numbering").text(a + " of " + l), $("#" + i + " .percentage").text(Math.round(o) + "%"), $(window).width() <= 768 && l > 2) for (var r = 1; r <= a; r++)$("#" + i + " ul.Form_Navigation li").hide().slice(r - 1, r + 1).show(), $("#" + i + " ul.Form_title li").hide().slice(r - 1, r + 1).show(), r == l && ($("#" + i + " ul.Form_Navigation li").hide().slice(r - 2, r).show(), $("#" + i + " ul.Form_title li").hide().slice(r - 2, r).show()); else if ($(window).width() > 768 && l > 5) for (r = 3; r < a; r++)$("#" + i + " ul.Form_Navigation li").hide().slice(r - 3, r + 2).show(), $("#" + i + " ul.Form_title li").hide().slice(r - 3, r + 2).show(), r == l - 1 && ($("#" + i + " ul.Form_Navigation li").hide().slice(r - 4, r + 1).show(), $("#" + i + " ul.Form_title li").hide().slice(r - 4, r + 1).show()) } }, Click_FileBrowseUpload = function (event, GUID, ModuleId, Extension, Size) { var errormsg = "", sf = $.ServicesFramework(ModuleId); if (null != sf) { for (var form_data = new FormData, x = 0; x < $(event).prop("files").length; x++) { var parts = $(event).prop("files")[x].name.split("."), ext = parts[parts.length - 1], size = $(event).prop("files")[x].size / 1024; Extension.indexOf(ext) < 0 ? errormsg += "Allowed extensions are " + Extension : size > Size ? errormsg += "Max allowed file size is " + Size / 1024 + " MB" : form_data.append("files[]", $(event).prop("files")[x]) } if ("" == errormsg) { var api = eval("LiveFormWebapi" + ModuleId), foid = -1, allow = !1; null != $($(".browse." + GUID.replace(/-/g, "_") + ">.folder").find("li.active")).attr("foid") && (foid = $($(".browse." + GUID.replace(/-/g, "_") + ">.folder").find("li.active")).attr("foid"), allow = $($(".browse." + GUID.replace(/-/g, "_") + ">.folder").find("li.active")).attr("allow")), $.ajax({ url: sf.getServiceRoot(api.ModuleFolder) + "BrowseFile/UploadFile?GUID=" + GUID + "&FolderID=" + foid, headers: { ModuleId: parseInt(sf.getModuleId()), TabId: parseInt(sf.getTabId()), RequestVerificationToken: sf.getAntiForgeryValue() }, cache: !1, contentType: !1, processData: !1, data: form_data, type: "POST", success: function (e) { "File/s not uploaded successfully!" == e ? swal(e) : setTimeout((function () { LFClick_GetFiles("" + GUID, ModuleId, foid, 0, allow, e.split("fileid")[1]) }), 100) }, error: function (e) { swal(e) } }) } else swal(errormsg) } }, Click_FileBrowse = function (GUID, ModuleId) { $(".browsefile." + GUID.replace(/-/g, "_")).hide(), $(".browse." + GUID.replace(/-/g, "_")).show(); var api = eval("LiveFormWebapi" + ModuleId), foid = -1, allow = !1; 0 == $.trim($("." + GUID.replace(/-/g, "_") + " .folder").text()).length && api.webApi.get("BrowseFile/GetFolders", "GUID=" + GUID).success((function (e) { var i = "Select Folder", $("." + GUID.replace(/-/g, "_") + " .folder").html(i), setTimeout((function () { LFClick_GetFiles("" + GUID, ModuleId, foid, 0, allow, "") }), 100) })) }, FolderMarkup = function (e, i, t) { var a = ""; return $(e).each((function (e, l) { a += "
  • ", l.childrenCount > 0 ? a += "" : a += '', a += "", a += "" + l.Text + "", a += '", a += "
  • " })), a }, LFClick_GetSubFolder = function (GUID, ModuleId, value) { var api = eval("LiveFormWebapi" + ModuleId); 0 == $.trim($("." + GUID.replace(/-/g, "_") + " .rootfolder." + ModuleId + "_" + value).text()).length && api.webApi.get("BrowseFile/GetSubFolders", "folderid=" + value).success((function (e) { $("." + GUID.replace(/-/g, "_") + " .rootfolder." + ModuleId + "_" + value).html(FolderMarkup(e, GUID, ModuleId)) })) }, LFKeyword_Search = function (e, i, t, a) { LForm_Time && clearTimeout(LForm_Time), LForm_Time = setTimeout((function () { LFClick_GetFiles(e, i, t, 0, a, "") }), 500) }, LFKeypress = function (e) { 13 === e.which && e.preventDefault() }, LFClick_GetFiles = function (GUID, ModuleId, Value, Skip, allowUpload, uploadedfileid) { allowUpload ? $(".BrowseInputSpan." + GUID.replace(/-/g, "_")).attr("style", "display: inline-block;") : $(".BrowseInputSpan." + GUID.replace(/-/g, "_")).attr("style", "display: none;"); var api = eval("LiveFormWebapi" + ModuleId), keyword = $("#keyword" + GUID).val(); null == keyword && (keyword = ""); var string = "Select File"; api.webApi.get("BrowseFile/GetFiles", "GUID=" + GUID + "&folderid=" + Value + "&skip=" + Skip + "&pagesize=100&keyword=" + keyword).success((function (e) { $("." + GUID.replace(/-/g, "_") + " .file").html(string + FileMarkup(GUID, e) + e.Pager), $("#keyword" + GUID).val(keyword), null != uploadedfileid && "" != uploadedfileid && $("." + GUID.replace(/-/g, "_") + " .file").find('li[fid="' + uploadedfileid + '"]').click() })) }, FileMarkup = function (e, i) { var t = ""; return i && (t += "", $(i.Files).each((function (i, a) { t += "
  • ', t += "", t += "" + a.Text + "", t += "
  • " })), t += ""), t }, LFClick_SelectFile = function (e, i, t) { var a = $("." + i + "_browseFileUploadButton").val().split(","), l = !1; for (let e = 0; e < a.length; e++)a[e] == t && (l = !0); l || LFSelectedMarkUp(e, i, t) }, LFSelectedMarkUp = function (e, i, t) { "display: none;" == $(".fileheader." + i.replace(/-/g, "_")).attr("style") && $(".fileheader." + i.replace(/-/g, "_")).attr("style", "display: block;"); var a = "
    " + e.innerText + "
    ", l = 1; void 0 !== $(e).closest(".Field-Container-Wide").find(".browse")[0] ? $.each($($(e).closest(".Field-Container-Wide").find(".browse")[0]).attr("class").split(" "), (function (e, i) { i.indexOf("maxallowed") > -1 && (l = parseInt(i.split("maxallowed")[1])) })) : $.each($($(e).closest(".Field-Container").find(".browse")[0]).attr("class").split(" "), (function (e, i) { i.indexOf("maxallowed") > -1 && (l = parseInt(i.split("maxallowed")[1])) })); var o = $(".selectedfile" + i.replace(/-/g, "_")).find(".rowfile").length; 0 != l && o == l && LFClick_DeleteFile(i, $($(".selectedfile" + i.replace(/-/g, "_")).find(".rowfile")[0]).attr("file")), $(".selectedfile" + i.replace(/-/g, "_")).append(a), $("." + i + "_browseFileUploadButton").val($("." + i + "_browseFileUploadButton").val() + "," + t) }, LFClick_DeleteFile = function (e, i) { var t = $("." + e + "_browseFileUploadButton").val().split(","); $("." + e + "_browseFileUploadButton").val(""); for (let a = 0; a < t.length; a++)t[a] != i && t[a] && $("." + e + "_browseFileUploadButton").val($("." + e + "_browseFileUploadButton").val() + "," + t[a]); $("." + e + "_browseFileUploadButton").val() || $(".fileheader." + e.replace(/-/g, "_")).attr("style", "display: none;"), $(".selectedfile" + e.replace(/-/g, "_") + " .row_" + i).remove() }; $(".asset_grid > div").sortable({ items: "div", handle: ".assetsmove", stop: function (e, i) { var t = i.item.attr("guid"); t && ($("." + t + "_browseFileUploadButton").val(""), $(".selectedfile" + t.replace(/-/g, "_") + " .rowfile").each((function (e, i) { var a = $(i).attr("file"); a && $("." + t + "_browseFileUploadButton").val($("." + t + "_browseFileUploadButton").val() + "," + a) }))) } }); var LFClick_DeletePlUploadFile = function (e, i, t) { var a = $("." + e + "_FileUploadButton").val().split("%&%"); $("." + e + "_FileUploadButton").val(""); for (let t = 0; t < a.length; t++)a[t] != i && a[t] && $("." + e + "_FileUploadButton").val($("." + e + "_FileUploadButton").val() + "%&%" + a[t]); $("." + e + "_FileUploadButton").val() || $(".fileheader." + e.replace(/-/g, "_")).attr("style", "display: none;"), $(".selectedfile" + e.replace(/-/g, "_") + " .pluploadrow_" + t).remove() };