{"version":3,"names":[],"mappings":"","sources":["main.js"],"sourcesContent":["(function($) {\n\n $.wizard = function(element, options) {\n\n var defaults = {}\n\n var plugin = this;\n\n plugin.settings = {}\n\n var $element = $(element),\n element = element;\n\n plugin.init = function() {\n \n plugin.settings = $.extend({}, defaults, options);\n \n $element.find(\".step-content:not(:first)\").hide();\n $element.data('step',1);\n\n }\n\n plugin.step = function() {\n \n return $element.data('step');\n\n }\n\n plugin.go = function(target) {\n\n \tvar current = plugin.step();\n\n \t$element.find(\".step-content[data-step='\" + current + \"']\").fadeOut(function() {\n\n\t $element.find(\".step-content[data-step='\" + target + \"']\").fadeIn(function() {\n\n\t \t$element.data('step',target);\n\n\t $element.parents('.proposal-steps').find(\".step-link\").removeClass('active');\n\n\t $element.parents('.proposal-steps').find(\".step-link[data-step='\" + target + \"']\").addClass('active');\n\n\t if (current > target) {\n\t\t $element.parents('.proposal-steps').find(\".step-link\").filter(function() {\n\t\t\t return parseInt($(this).attr(\"data-step\")) > target && parseInt($(this).attr(\"data-step\")) <= current;\n\t\t\t }).removeClass('success');\n\t \t}\n\n\t if ($(window).width() <= 576) {\n\n\t $('html, body').animate({\n\t scrollTop: $element.find(\".step-link--mobile[data-step='\" + target + \"']\").offset().top - 60\n\t }, 1000);\n\n\t } else {\n\n\t $element.find(\".proposal-steps__content\").stop(true, true).animate({\n\t scrollTop: 0\n\t }, 1000);\n\n\t }\n\n\t });\n\n\t });\n\n }\n\n plugin.init();\n\n }\n\n $.fn.wizard = function(options) {\n\n return this.each(function() {\n if (undefined == $(this).data('wizard')) {\n var plugin = new $.wizard(this, options);\n $(this).data('wizard', plugin);\n }\n });\n\n }\n\n})(jQuery);\n\nfunction bindValidation($form, $group, target) {\n\n $group.each(function() {\n\n if (target != $(this).data('toggle-target-id')) {\n\n $(this).find('[data-bind-validation]').each(function() {\n var field = $(this).attr('name');\n $form.data('formValidation').enableFieldValidators(field, false);\n $form.formValidation('resetField', $(this));\n });\n\n $(this).hide();\n\n } else {\n\n $(this).find('[data-bind-validation]').each(function() {\n var field = $(this).attr('name');\n $form.data('formValidation').enableFieldValidators(field, true);\n $form.formValidation('resetField', $(this));\n });\n \n $(this).show();\n\n }\n\n });\n\n};\n\n$(document).ready(function() {\n\n\t$('.search-select').select2();\n\n $('.mask-plate-number').inputmask(\"99 ******\", {\n jitMasking: true,\n casing: \"upper\"\n });\n\n $('.mask-id').inputmask(\"9999999999[9]\", {\n jitMasking: true\n });\n\n $('.mask-email').inputmask(\"email\");\n\n $('body').on('change', '[data-change=\"bubble\"]', function() {\n\n var $target = $('[data-bubble-target-id=\"' + $(this).data('target') + '\"]');\n var state = $(this).children('option:selected').data('state');\n\n if (state) {\n $target.addClass('bubble--active');\n } else {\n $target.removeClass('bubble--active');\n }\n\n });\n\n $('body').on('change', 'input[type=radio][data-change=\"toggle\"]', function() {\n\n var $form = $(this).parents('form');\n var $group = $('[data-toggle-group-id=\"' + $(this).data('toggle-group') + '\"]');\n var target = $(this).data('toggle-target');\n\n bindValidation($form, $group, target);\n\n });\n\n $('body').on('change', 'select[data-change=\"toggle\"]', function() {\n\n var $form = $(this).parents('form');\n var $group = $('[data-toggle-group-id=\"' + $(this).data('toggle-group') + '\"]');\n var target = $(this).children('option:selected').data('toggle-target');\n\n bindValidation($form, $group, target);\n\n });\n\n});"],"file":"main.js"}