{"request":{"hurl":"https:\/\/www.voger.hr\/wp-content\/plugins\/yith-woocommerce-request-a-quote-premium\/assets\/js\/frontend.min.js","inline":"","disable_minification":false,"type":"js","handle":"yith_ywraq_frontend"},"log":"\/wp-content\/plugins\/yith-woocommerce-request-a-quote-premium\/assets\/js\/frontend.min.js\n","code":"jQuery(document).ready(function(t){\"use strict\";t(\"body\"),t(\".add-request-quote-button\");var e=t(document).find(\".widget_ywraq_list_quote, .widget_ywraq_mini_list_quote\"),a=\"undefined\"!=typeof ywraq_frontend&&ywraq_frontend.block_loader,i=(t(\".yith-ywraq-item-remove\"),t(\".shipping_address\")),n=t(\".woocommerce-billing-fields\"),r=document.location.href;t(document).find(\"#yith-ywrq-table-list\").length>0&&ywraq_frontend.raq_table_refresh_check&&t.post(r,function(e){if(\"\"!=e){var a=t(\"<div><\/div>\").html(e).find(\"#yith-ywrq-table-list\");t(\"#yith-ywrq-table-list\").html(a.html()),t(document).trigger(\"ywraq_table_reloaded\")}}),t.fn.yith_ywraq_variations=function(){var e=t(document).find(\"form.variations_form\");if(e.length&&void 0!==e.data(\"product_id\")){var a=e.data(\"product_id\").toString().replace(\/[^0-9]\/g,\"\"),i=t(\".add-to-quote-\"+a).find(\".yith-ywraq-add-button\"),n=i.find(\"a.add-request-quote-button\"),r=t(\".yith_ywraq_add_item_product-response-\"+a),o=t(\".yith_ywraq_add_item_response-\"+a),d=t(\".yith_ywraq_add_item_browse-list-\"+a),s=function(){n.show().addClass(\"disabled\"),i.show().removeClass(\"hide\").removeClass(\"addedd\"),r.hide().removeClass(\"show\"),o.hide().removeClass(\"show\"),d.hide().removeClass(\"show\")};e.on(\"found_variation\",function(e,s){var c=\"\"+t(\".add-to-quote-\"+a).attr(\"data-variation\");r.hide().removeClass(\"show\"),-1!==c.indexOf(\"\"+s.variation_id)?(n.hide(),o.show().removeClass(\"hide\"),d.show().removeClass(\"hide\")):(n.show().removeClass(\"disabled\"),i.show().removeClass(\"hide\").removeClass(\"addedd\"),o.hide().removeClass(\"show\"),d.hide().removeClass(\"show\"))}),e.on(\"reset_data\",function(t){s()}),s()}},t(\".variations_form\").each(function(){t(this).yith_ywraq_variations()}),t(document).on(\"qv_loader_stop\",function(e){t(\".variations_form\").each(function(){t(this).yith_ywraq_variations()})}),t.fn.yith_ywraq_refresh_button=function(){var e=t('[name|=\"product_id\"]').val();t(\".add-to-quote-\"+e).find(\"a.add-request-quote-button\").parents(\".yith-ywraq-add-to-quote\");if(!t('[name|=\"variation_id\"]').length)return!1},t.fn.yith_ywraq_refresh_button();var o=!1;t(document).on(\"click\",\".add-request-quote-button\",function(i){i.preventDefault();var n=t(this),r=n.closest(\".yith-ywraq-add-to-quote\"),d=\"ac\",c=\"\";if(n.hasClass(\"disabled\")&&window.alert(ywraq_frontend.i18n_choose_a_variation),!n.hasClass(\"disabled\")&&!o){if(t(\".grouped_form\").length){var _=0;if(t(\".grouped_form input.qty\").each(function(){_=Math.floor(t(this).val())+_}),0==_)return void alert(ywraq_frontend.select_quantity)}if(void 0===(c=n.closest(\".cart\").length?n.closest(\".cart\"):r.siblings(\".cart\").first().length?r.siblings(\".cart\").first():t(\".composite_form\").length?t(\".composite_form\"):t(\".cart:not(.in_loop)\"))[0]||\"function\"!=typeof c[0].checkValidity||c[0].checkValidity()){if(n.closest(\"ul.products\").length>0)var l=\"\",u=(y=n.closest(\"li.product\").find(\"a.add_to_cart_button\")).data(\"product_id\");else{var y;l=n.closest(\".product\").find('input[name=\"add-to-cart\"]'),u=(y=n.closest(\".product\").find('input[name=\"product_id\"]')).length?y.val():l.val()}var f=void 0===u?n.data(\"product_id\"):u;(d=c.serializefiles()).append(\"context\",\"frontend\"),d.append(\"action\",\"yith_ywraq_action\"),d.append(\"ywraq_action\",\"add_item\"),d.append(\"product_id\",n.data(\"product_id\")),d.append(\"wp_nonce\",n.data(\"wp_nonce\")),d.append(\"yith-add-to-cart\",n.data(\"product_id\"));var h=r.find(\"input.qty\").val();if(h>0&&d.append(\"quantity\",h),n.closest(\".yith_wc_qof_button_and_price\").length>0){var w=n.closest(\".yith_wc_qof_button_and_price\").find(\".YITH_WC_QOF_Quantity_Cart\").val();d.append(\"quantity\",w)}var p=n.closest(\"li.product\").find(\".variations_form.in_loop\"),m=!!p.length&&p.data(\"active_variation\");return m&&(d.append(\"variation_id\",m),p.find(\"select\").each(function(){d.append(this.name,this.value)})),t(document).trigger(\"yith_ywraq_action_before\"),!(\"undefined\"!=typeof yith_wapo_general&&!yith_wapo_general.do_submit)&&(!(\"undefined\"!=typeof ywcnp_raq&&!ywcnp_raq.do_submit)&&void(o=t.ajax({type:\"POST\",url:ywraq_frontend.ajaxurl.toString().replace(\"%%endpoint%%\",\"yith_ywraq_action\"),dataType:\"json\",data:d,contentType:!1,processData:!1,beforeSend:function(){n.after(' <img src=\"'+a+'\" class=\"ywraq-loader\" >')},complete:function(){n.next().remove()},success:function(a){\"true\"==a.result||\"exists\"==a.result?(\"yes\"==ywraq_frontend.go_to_the_list?window.location.href=a.rqa_url:(t(\".yith_ywraq_add_item_product-response-\"+f).show().removeClass(\"hide\").html(a.message),t(\".yith_ywraq_add_item_browse-list-\"+f).show().removeClass(\"hide\"),n.parent().hide().removeClass(\"show\").addClass(\"addedd\"),t(\".add-to-quote-\"+f).attr(\"data-variation\",a.variations),e.length&&(e.ywraq_refresh_widget(),e=t(document).find(\".widget_ywraq_list_quote, .widget_ywraq_mini_list_quote\")),s()),t(document).trigger(\"yith_wwraq_added_successfully\",[a])):\"false\"==a.result&&(t(\".yith_ywraq_add_item_response-\"+f).show().removeClass(\"hide\").html(a.message),t(document).trigger(\"yith_wwraq_error_while_adding\")),o=!1}})))}t('<input type=\"submit\">').hide().appendTo(c).click().remove()}}),t.fn.serializefiles=function(){var e=t(this),a=new FormData;t.each(t(e).find(\"input[type='file']\"),function(e,i){t.each(t(i)[0].files,function(t,e){a.append(i.name,e)})});var i=t(e).serializeArray(),n=!1;return t.each(i,function(t,e){(\"quantity\"==e.name||e.name.indexOf(\"quantity\"))&&(n=!0),\"add-to-cart\"!=e.name&&a.append(e.name,e.value)}),!1===n&&a.append(\"quantity\",1),a},t.fn.ywraq_refresh_widget=function(){e.each(function(){var e=t(this),i=e.find(\".yith-ywraq-list-wrapper\"),n=e.find(\".yith-ywraq-list\"),r=e.find(\".yith-ywraq-list-widget-wrapper\").data(\"instance\");t.ajax({type:\"POST\",url:ywraq_frontend.ajaxurl.toString().replace(\"%%endpoint%%\",\"yith_ywraq_action\"),data:r+\"&ywraq_action=refresh_quote_list&action=yith_ywraq_action&context=frontend\",beforeSend:function(){n.css(\"opacity\",.5),e.hasClass(\"widget_ywraq_list_quote\")&&i.prepend(' <img src=\"'+a+'\" class=\"ywraq-loader\">')},complete:function(){e.hasClass(\"widget_ywraq_list_quote\")&&i.next().remove(),n.css(\"opacity\",1)},success:function(t){e.hasClass(\"widget_ywraq_mini_list_quote\")?e.find(\".yith-ywraq-list-widget-wrapper\").html(t.mini):e.find(\".yith-ywraq-list-widget-wrapper\").html(t.large)}})})},t(document).on(\"click\",\".yith-ywraq-item-remove\",function(a){a.preventDefault();var i,n=t(this),r=n.data(\"remove-item\"),o=n.parents(\".ywraq-wrapper\"),d=(t(\"#yith-ywraq-form\"),o.find(\".wpcf7-form\")),c=n.data(\"product_id\");i=\"context=frontend&action=yith_ywraq_action&ywraq_action=remove_item&key=\"+n.data(\"remove-item\")+\"&wp_nonce=\"+n.data(\"wp_nonce\")+\"&product_id=\"+c,t.ajax({type:\"POST\",url:ywraq_frontend.ajaxurl.toString().replace(\"%%endpoint%%\",\"yith_ywraq_action\"),dataType:\"json\",data:i,beforeSend:function(){n.find(\".ajax-loading\").css(\"visibility\",\"visible\")},complete:function(){n.siblings(\".ajax-loading\").css(\"visibility\",\"hidden\")},success:function(a){if(1===a){var i=t(\"[data-remove-item='\"+r+\"']\").parents(\".cart_item\");if(i.hasClass(\"composite-parent\")){var n=i.data(\"composite-id\");t(\"[data-composite-id='\"+n+\"']\").remove()}if(i.hasClass(\"ywcp_component_item\")&&t(\"tr.ywcp_component_child_item\").filter(\"[data-wcpkey='\"+r+\"']\").remove(),i.hasClass(\"bundle-parent\")){var o=i.data(\"bundle-key\");t(\"[data-bundle-key='\"+o+\"']\").remove()}i.remove(),0===t(\".cart_item\").length&&(d.length&&d.remove(),t(\"#yith-ywraq-form, .yith-ywraq-mail-form-wrapper\").remove(),t(\"#yith-ywraq-message\").html(ywraq_frontend.no_product_in_list)),e.length&&(e.ywraq_refresh_widget(),e=t(document).find(\".widget_ywraq_list_quote, .widget_ywraq_mini_list_quote\")),s(),t(document).find('.hide-when-removed[data-product_id=\"'+c+'\"]').hide(),t(document).find('.yith-ywraq-add-button[data-product_id=\"'+c+'\"]').show(),t(document).trigger(\"yith_wwraq_removed_successfully\")}else t(document).trigger(\"yith_wwraq_error_while_removing\")}})});var d;function s(){t(document).find(\".ywraq_number_items\").each(function(){var e=t(this),a=e.data(\"show_url\"),i=e.data(\"item_name\"),n=e.data(\"item_plural_name\");t.ajax({type:\"POST\",url:ywraq_frontend.ajaxurl.toString().replace(\"%%endpoint%%\",\"yith_ywraq_action\"),data:\"ywraq_action=refresh_number_items&action=yith_ywraq_action&context=frontend&item_name=\"+i+\"&item_plural_name=\"+n+\"&show_url=\"+a,success:function(t){e.replaceWith(t)}})})}t(\".wpcf7-submit\").closest(\".wpcf7\").length>0&&t(document).find(\".ywraq-wrapper .wpcf7\").each(function(){var e=t(this);e.find('input[name=\"_wpcf7\"]').val()==ywraq_frontend.cform7_id&&(e.on(\"wpcf7:mailsent\",function(){t.ajax({type:\"POST\",url:ywraq_frontend.ajaxurl.toString().replace(\"%%endpoint%%\",\"yith_ywraq_order_action\"),dataType:\"json\",data:{lang:ywraq_frontend.current_lang,action:\"yith_ywraq_order_action\",current_user_id:ywraq_frontend.current_user_id,context:\"frontend\",ywraq_order_action:\"mail_sent_order_created\"},success:function(t){\"\"!=t.rqa_url&&(window.location.href=t.rqa_url)}})}),document.addEventListener(\"wpcf7mailsent\",function(t){window.location.href=ywraq_frontend.rqa_url},!1))}),t(\"#yith-ywrq-table-list\").on(\"change\",\".qty\",function(){t(this).val()<=0&&t(this).val(1)}),t(document).bind(\"gform_confirmation_loaded\",function(t,e){ywraq_frontend.gf_id==e&&(window.location.href=ywraq_frontend.rqa_url)}),t(document).on(\"click, change\",\".product-quantity input\",function(e){void 0!==d&&d.abort();var a=t(this);if(void 0===(n=a.attr(\"name\"))){var i=a.closest(\".product-quantity\").find(\".input-text.qty\"),n=i.attr(\"name\"),o=i.val(),s=n.match(\/[^[\\]]+(?=])\/g);a.hasClass(\"plus\")&&o++,a.hasClass(\"minus\")&&o--;var c=\"context=frontend&action=yith_ywraq_action&ywraq_action=update_item_quantity&quantity=\"+o+\"&key=\"+s[0]}else c=\"context=frontend&action=yith_ywraq_action&ywraq_action=update_item_quantity&quantity=\"+(o=a.val())+\"&key=\"+(s=n.match(\/[^[\\]]+(?=])\/g))[0];d=t.ajax({type:\"POST\",url:ywraq_frontend.ajaxurl.toString().replace(\"%%endpoint%%\",\"yith_ywraq_action\"),dataType:\"json\",data:c,success:function(e){t.post(r,function(e){if(\"\"!=e){var a=t(\"<div><\/div>\").html(e).find(\"#yith-ywrq-table-list\");t(\"#yith-ywrq-table-list\").html(a.html()),t(document).trigger(\"ywraq_table_reloaded\")}})}})}),i.length>0&&1==ywraq_frontend.lock_shipping&&(i.find(\"input\").attr(\"readonly\",\"readonly\"),i.find(\"select\").attr(\"readonly\",\"readonly\"),t(\".woocommerce-checkout #shipping_country_field\").css(\"pointer-events\",\"none\"),t(\".woocommerce-checkout #shipping_state_field\").css(\"pointer-events\",\"none\")),n.length>0&&1==ywraq_frontend.lock_billing&&(n.find(\"input\").attr(\"readonly\",\"readonly\"),n.find(\"select\").attr(\"readonly\",\"readonly\"),t(\".woocommerce-checkout #billing_country_field\").css(\"pointer-events\",\"none\"),t(\".woocommerce-checkout #billing_state_field\").css(\"pointer-events\",\"none\")),e.ywraq_refresh_widget(),s(),t(document).on(\"click\",\"#ywraq_checkout_quote\",function(e){t(\"#ywraq_checkout_quote\").val(!0)})});\n","status":true}