\" + msg + \"<\/div><\/div>\");\n\n ddiv.find(\".button.close\").on(\"click\", function (e) {\n e.preventDefault();\n $(this).parents(\".mod-warning-warning\").remove();\n $(\".mod-warning-mask\").remove();\n });\n\n const mask = $(\"
<\/div>\");\n\n if (options.container) {\n options.container.append(mask);\n options.container.append(ddiv);\n } else {\n mask.appendTo(\"body\");\n ddiv.appendTo(\"body\");\n }\n\n const duration = parseInt(warning.def.duration);\n\n if (duration) {\n setTimeout(function () {\n ddiv.find(\".button.close\").trigger(\"click\");\n }, duration * 1000);\n }\n\n if (options.onload) {\n options.onload(ddiv);\n }\n }\n });\n\n\n })(jQuery);\n\n});\n\n\/*******\n\/form\/script\/public\/ajax\n*********\/\n\nvar ddiv = null;\n\nif (typeof arguments != 'undefined') {\n ddiv = arguments[0];\n}\n\n$(document).ready(function () {\n\n $(\".layout.mod_form\").each(function () {\n\n var mfl = $(this);\n\n if (!mfl.find(\"form\").length) {\n return;\/\/.layout.mod_form can be nested ( it shouldn't be, but it is! )\n }\n\n var config = $(this).find(\".layout-component.main-config\");\n\n if (config.attr(\"data-ajax\")) {\n config.parents(\"form:first\").off(\"submit\").on(\"submit\", function (e, args) {\n e.preventDefault();\n\n var form = $(this);\n\n if (form.data(\"submitted\")) {\n return;\n }\n\n var query = $(this).serializeObject();\n\n query.ajax = true;\n\n if ($(this).data(\"submit-cancel\")) {\n query.cancelled = true;\n }\n\n $.eosbusy.show();\n\n $.post($(this).attr(\"action\"), query, function (data) {\n $.eosbusy.hide();\n\n if (!data.status) {\n $.eosmsg(data);\n return;\n }\n\n if (data.status === \"ERROR\") {\n if (data.key) {\n $.triggerwarning({\n key: data.key,\n container: form,\n msg: data.msg\n }, function () {\n $.eosmsg(data.msg);\n });\n return;\n }\n }\n\n if (data.missing) {\n if (args) {\n if (args.onerror) {\n args.onerror();\n }\n }\n form.find(\"[data-cid=\" + data.which + \"]\").addClass(\"required-missing\");\n if (data.errors) {\n $.triggerwarning({\n key: \"form-field-\" + data.which,\n container: form\n }, function () {\n $.eosmsg(data.errors);\n });\n \/\/console.log(data);\n \/\/$.eosmsg(data.errors);\n }\n } else {\n \n switch (data.action) {\n case \"redirect\":\n document.location = data.redirect;\n break;\n\n case \"reset\":\n mfl.data(\"reset\")();\n if (data.msg) {\n $.eosmsg({\n \"auto-close\": true,\n \"actimeout\": 3000,\n content: data.msg\n });\n } else {\n $.eosmsg({\n \"auto-close\": true,\n \"actimeout\": 3000,\n content: \"Form Submitted\"\n });\n }\n\n return;\n\n default:\n if (data.js) {\n var tf = new Function(data.js);\n tf(form, data, ddiv);\n break;\n }\n if (data.html) {\n \/\/form.html(data.html);\n \/\/do nothing - js events etc all break if we do this!\n }\n if (data.errors) {\n alert(data.errors);\n return;\n }\n }\n \/\/looks like all ok, so don't let the user re-submit\n form.data({\n submitted: true\n });\n\n $(\".layout-component.payment-before-complete\").trigger(\"payment-bypassed\");\n\n form.find(\".button.tab-ctrl.next-tab\").trigger(\"click\", {nosubmit: true, nocloseevent: true});\n }\n });\n });\n }\n });\n});\n\n\/*******\n\/form\/script\/public\/select\n*********\/\n$(document).ready(function(){\n $(\".layout-component.select\").each(function(){\n var container = $(this);\n if($(this).hasClass(\"searchable\")){\n \n container.find(\".option\").on(\"click\", function(){\n container.find(\".option-search-input\").val($(this).text().trim());\n container.find(\".data-container\").val($(this).attr(\"data-value\").trim());\n $(this).parent().addClass(\"hidden\");\n });\n \n $(this).find(\".option-search-input\").on(\"input\", function(){\n var filter = $(this).val().toLowerCase();\n \n container.find(\".option\").addClass(\"hidden\");\n \n if(!filter.length){\n container.find(\".options\").addClass(\"hidden\");\n }else {\n container.find(\".options\").removeClass(\"hidden\");\n }\n \n container.find(\".option\").each(function(){\n if($(this).text().toLowerCase().indexOf(filter) > -1){\n $(this).removeClass(\"hidden\");\n }\n });\n });\n }\n });\n});\n\n\/*******\n\/form\/script\/public\/text-field\n*********\/\n$(document).ready(function () {\n\n const init = function () {\n\n $(\".layout-component.text-field:not(.tfi)\").each(function () {\n var component = $(this);\n $(this).addClass(\"tfi\");\n\n if (component.attr(\"data-api-validate\")) {\n\n\n $(this).data({\n validate: function () {\n if (!component.hasClass(\"valid-reference\")) {\n return false;\n } else {\n return true;\n }\n }\n });\n\n let timeout = null;\n const input = component.find(\"input\");\n\n input.on(\"input\", function () {\n\n if (timeout) {\n clearTimeout(timeout);\n }\n\n input.addClass(\"error\");\n component.removeClass(\"valid-reference\");\n\n timeout = setTimeout(function () {\n const val = input.val().toString();\n if (val.length >= 2) {\n const query = {\n str: val\n };\n $.post(component.attr(\"data-api-path\") + \"api-validate\", query, function (data) {\n if (!data.status) {\n $.eosmsg(data);\n } else {\n console.log(data);\n if (data.valid !== \"true\") {\n input.addClass(\"error\");\n component.addClass(\"error\");\n } else {\n component.addClass(\"valid-reference\");\n component.removeClass(\"error\");\n input.removeClass(\"error\");\n }\n\n }\n });\n }\n }, 300);\n });\n\n if (input.val()) {\n input.trigger(\"input\");\n }\n }\n\n if (component.attr(\"data-auto-complete\")) {\n\n let timeout = null;\n const input = component.find(\"input\");\n\n const matches = $(\"