Ergonomia e estações de trabalho

'); }else{ form_div.find(".cfx_thanks_msg").html(re.msg);} /// console.log( form.find(".crm_alert")); form_div.find(".cfx_thanks_msg").show(); form_div.find(".cfx_alert_msg").hide(); //form.find(".cfx_msg_div").hide(); if(re.hide_form){ if(re.hide_form == 'yes'){ form.find('.cfx_form_fields').hide(); form.find('.cfx_form_head').hide(); form.find('.crm_form_footer').hide(); } }else{ form[0].reset(); } if(is_steps){ step=form.find('.cfx_steps:visible'); var next=form.find('.cfx_steps').eq(0); sel_step(step,next,form); } } //reset html5 validation if(!form.find(".crm_no_validate").length){ form.removeAttr('novalidate'); } if(form.find(".vx_custom_captcha").length){ var cap=form.find(".vx_custom_captcha"); var cap_img=cap.find("img").attr('src'); jQuery(".vx_custom_captcha").find("img").attr({src:cap_img+"?img="+Math.round(Math.random()*100000)}); jQuery(".captcha_input").val(""); } } else if(re.status == 'next_step'){ var next=step.next(); sel_step(step,next,form); } else{ if(form.find(".vx_custom_captcha").length){ var cap=form.find(".vx_custom_captcha"); var cap_img=cap.find("img").attr('src'); jQuery(".vx_custom_captcha").find("img").attr({src:cap_img+"?img="+Math.round(Math.random()*100000)}); jQuery(".captcha_input").val(""); } if(re.msgs){ jQuery.each(re.msgs,function(k,v){ if(!form.find('#crm_alert_'+form_id+'_'+k).length ){ var row=form.find('#cfx_row_'+form_id+'_'+k); row.find('.crm_input_field').append('
'+v+'
'); }else{ form.find('#crm_alert_'+form_id+'_'+k).html(v); form.find('#crm_alert_'+form_id+'_'+k).show(); } }) } if(re.msg){ if(!form_div.find(".cfx_alert_msg").length){ form.after('
'+re.msg+'
'); }else{ form_div.find(".cfx_alert_msg").html(re.msg); } } if(is_steps){ step=form.find('.cfx_steps:visible'); var error=form.find('.cfx_alert_block').eq(0); if(error.length){ var next=error.parents('.cfx_steps'); //console.info(step,next); sel_step(step,next,form); } } form_div.find(".cfx_alert_msg").show(); form_div.find(".cfx_thanks_msg").hide(); } if(reset_btn){ if(btn_type=="submit"){ button.text(text); }else{ form.find(".crm_sf_ajax").hide(); } btn_all.removeAttr('disabled'); // btn_all.css({opacity:'1'}); } form.triggerHandler('cfx_form_end_submit',re); } }); } var cap_time= new Date().getTime() - cfx_captcha_stamp; if( cfx_captcha_stamp && cap_time > 110000 ){ //google cap token expiry is 120 sec , we use 110 cfx_cap_loaded(function(token){ data.append('g-recaptcha-response',token); vx_post(); }); }else{ vx_post(); } }); jQuery(document).on('click',".cfx_submit",function(e){ jQuery('.cfx_submit_clicked').removeClass('cfx_submit_clicked'); jQuery(this).addClass('cfx_submit_clicked'); }); jQuery(".cfx_steps:hidden").find('.crm_required').removeAttr('required'); jQuery(".cfx_form_ajax").each(function(){ if(jQuery(this).find('.cfx_steps').length){ jQuery(this).addClass('has_error'); } }); jQuery(document).on('click','.cfx_prev_btn',function(e){ var step=jQuery(this).parents('.cfx_steps'); var form=step.parents('form'); if(form.hasClass('cfx_form_ajax')){ e.preventDefault(); var val=jQuery(this).val(); var form_id=form.find('.form_id').val(); var next=jQuery('#cfx_step_'+form_id+'_'+val); sel_step(step,next,form); } }); if(typeof cfx_filters == 'object' ){ var body; jQuery.each(cfx_filters,function(form_id,v){ body=jQuery('.cfx_form_div_'+form_id); do_filters(body); }) } jQuery(document).on('input','.crm_form_body :input',function(){ var body=jQuery(this).parents('.crm_form_body'); do_filters(body); }); function do_filters(body){ var form_id=body.find('.form_id').val(); var field_row,matched; if(typeof cfx_filters != 'undefined' && cfx_filters[form_id]){ jQuery.each(cfx_filters[form_id],function(k,filter){ if(typeof filter == 'object' && filter['when'] && filter['do']){ matched=cfx_check_filter(filter['when'],form_id,body); jQuery.each(filter['do'],function(k,v){ if(v['do_field']){ field_row=jQuery('#cfx_row_'+form_id+'_'+v['do_field'],body); switch(v['do_action']){ case'hide': if(matched){ field_row.hide(); }else{ field_row.show(); } break; default: if(matched){ field_row.show(); }else{ field_row.hide(); } break; } } }) } }); } } function sel_step(step,next,form){ step.hide(); next.show(); step.find('.crm_required').removeAttr('required'); next.find('.crm_required').attr('required','required'); var part=parseInt(next.attr('data-id')); var total_parts=form.find('.cfx_steps').length; var percent=Math.ceil((part/total_parts)*100); form.find('.cfx_prog_percent').css({width: percent+'%'}); // console.info(form,percent,part,total_parts); form.find('.cfx_prog_title').text(next.attr('data-label')); form.find('.cfx_prog_step').text(next.attr('data-id')); } jQuery(document).on('click',".cfx_refresh_cap",function(e){ e.preventDefault(); var captcha=jQuery(this).parents(".vx_custom_captcha").find("img"); var url=captcha.attr('src').split("?")[0]; captcha.attr({src:url+"?time="+Math.random()}); }); }); function cfx_check_filter(filter,form_id,body){ var val,or,and,matched; if(typeof filter == 'object'){ or=false; jQuery.each(filter,function(k,box){ if(typeof box == 'object'){ and=true; jQuery.each(box,function(k,v){ if(v['field'] != ''){ var elem=jQuery('#cfx_row_'+form_id+'_'+v['field']+' :input',body); if(elem.length){ if(elem.is(':checkbox')){ elem=jQuery('#cfx_row_'+form_id+'_'+v['field']+' input[value="'+v['value']+'"]',body); if(elem.is(':checked')){ val=v['value']; } }else if(elem.is(':radio')){ elem=jQuery('#cfx_row_'+form_id+'_'+v['field']+' input:checked',body); val=elem.val(); }else{ val=elem.val(); } } var str=v['value']; var op=v['op']; matched=false; if(jQuery.inArray(op,['','not_is']) != -1){ matched=str == val; } if(jQuery.inArray(op,['empty','not_empty']) != -1){ matched=val == ''; } if(jQuery.inArray(op,['less','less_not']) != -1){ val=parseFloat(val); str=parseFloat(str); if(isNaN(val)){ val=0; } if(isNaN(str)){ str=0; } matched=str -1; } if(jQuery.inArray(op,['starts','not_starts']) != -1){ var pos=val.indexOf(str); matched=pos == 0; } if(jQuery.inArray(op,['ends','not_ends']) != -1){ var pos=val.indexOf(str); matched=pos == (str.length-val.length); } if(op.indexOf('not_') == 0){ matched=!matched; } and=and&&matched; } }); or=and||or; } }) } // console.info(val,or); return or; } function cfx_get_cookie(c_name) { var i,x,y,ARRcookies=document.cookie.split(";"); for (i=0;i
Ir ao Topo