golden hour
/home/godaofbq/beyondhyperbarics.com/wp-content/plugins/woocompositeproduct/assets/js
⬆️ Go Up
Upload
File/Folder
Size
Actions
accounting.min.js
3.08 KB
Del
OK
backend.js
11.41 KB
Del
OK
frontend.js
52.68 KB
Del
OK
Edit: backend.js
jQuery(document).ready(function($) { // select2 $('.hide_components_save').select2(); function showComponentDetails() { $(this).closest('.product-composite-items_dependence').find('.all_component_details_save').css('display', 'block'); $(this).closest('.product-composite-items_dependence').find('.all_component_products_details_save').css('display', 'none'); } function showComponentProducts() { $(this).closest('.product-composite-items_dependence').find('.all_component_products_details_save').css('display', 'block'); $(this).closest('.product-composite-items_dependence').find('.all_component_details_save').css('display', 'none'); } // Check which radio button is checked on page load and trigger the corresponding function $('input[type="radio"].hide_component_save').each(function() { if ($(this).is(':checked')) { showComponentDetails.call(this); } }); $('input[type="radio"].hide_component_opt_save').each(function() { if ($(this).is(':checked')) { ; showComponentProducts.call(this); } }); // Handle click events $('input[type="radio"].hide_component_save').click(function() { // alert("only component"); // console.log("show only component"); if (this.checked) { showComponentDetails.call(this); } }); $('input[type="radio"].hide_component_opt_save').click(function() { // alert(" component product") // console.log("show component's products"); if (this.checked) { showComponentProducts.call(this); } }); }); function denpendence_composite_add_option(aa , iteamcout , counter){ var action = (jQuery(aa).val()); if (action == 'do'){ jQuery('#dep_component_action_type_'+iteamcout+counter).html('<option value="do_nothing">Nothing</option><option value="selection_is">Force selection to</option><option value="selection_is_not">Exclude</option>'); }else { jQuery('#dep_component_action_type_'+iteamcout+counter).html('<option value="do_nothing">No action</option><option value="is_selected">Any product is selected</option><option value="selection_is">Selection is</option><option value="selection_is_not">Selection is not</option>'); } } function show_hide_dep_component_action_pro(obj , iteamcout , counter){ var action = (jQuery(obj).val()); if( action == 'do_nothing' || action == 'is_selected'){ jQuery('#dep_component_action_pro_'+iteamcout+counter).hide(); }else { jQuery('#dep_component_action_pro_'+iteamcout+counter).show(); } } jQuery(document).ready(function($) { "use strict"; jQuery( ".sortable" ).sortable({ revert: true, update: function( event, ui ) { var order = $(this).sortable('toArray'); } }); }); jQuery(document).ready(function(jQuery) { "use strict"; jQuery( "#compositepro_make_composite" ).accordion({animate: {duration: 200},heightStyle: "content", collapsible : true, active : false, header: '> div.product-composite-items >h3' }); jQuery( "#compositepro_make_composite_denpendence" ).accordion({animate: {duration: 200},heightStyle: "content", collapsible : true, active : false, header: '> div.product-composite-items_dependence >h3' }); var icons = jQuery( "#compositepro_add_pro" ).accordion( "option", "icons" ); jQuery('.open-uiacc').click(function () { jQuery('.ui-accordion-header').removeClass('ui-corner-all').addClass('ui-accordion-header-active ui-state-active ui-corner-top').attr({ 'aria-selected': 'true', 'tabindex': '0' }); jQuery('.ui-accordion-header-icon').removeClass(icons.header).addClass(icons.headerSelected); jQuery('.ui-accordion-content').addClass('ui-accordion-content-active').attr({ 'aria-expanded': 'true', 'aria-hidden': 'false' }).show(); jQuery(this).attr("disabled","disabled"); jQuery('.close-uiacc').removeAttr("disabled"); }); jQuery('.close-uiacc').click(function () { jQuery('.ui-accordion-header').removeClass('ui-accordion-header-active ui-state-active ui-corner-top').addClass('ui-corner-all').attr({ 'aria-selected': 'false', 'tabindex': '-1' }); jQuery('.ui-accordion-header-icon').removeClass(icons.headerSelected).addClass(icons.header); jQuery('.ui-accordion-content').removeClass('ui-accordion-content-active').attr({ 'aria-expanded': 'false', 'aria-hidden': 'true' }).hide(); jQuery(this).attr("disabled","disabled"); jQuery('.open-uiacc').removeAttr("disabled"); }); jQuery('.ui-accordion-header').click(function () { jQuery('.open-uiacc').removeAttr("disabled"); jQuery('.close-uiacc').removeAttr("disabled"); }); // remove button do noting window.save_composite_removed = function(e, i) { e.stopPropagation(); jQuery('#compositepro-pro-item'+i).remove(); } window.remove_dependence_list = function(e, i) { e.stopPropagation(); jQuery('#dependence-pro-item'+i).remove(); } // render all products jQuery('.search_product_composite').select2({ ajax: { url: composite_vars.ajax_url, dataType: 'json', delay: 250, data: function (params, exclude) { var ide = composite_vars.id; return { q: params.term, action: 'composite_products_select' , ide: ide, }; }, processResults: function( data ) { var options = []; if ( data ) { jQuery.each( data, function( index, text ) { options.push( { id: text[0], text: text[1] } ); }); } return { results: options }; }, cache: true }, minimumInputLength: 3 }); // make category select2 jQuery('.categories_id-select2').select2({multipel:true}); // select on selection product, category, tags jQuery( 'body' ).on( 'change', 'select._composite_layout_options', function( ) { var select_val = jQuery( this ).val(); var $container = jQuery( this ).closest('.composite_form_listing'); $container.find('p.composite_layout_options_container').hide(); if ( select_val === 'product' ) { $container.find('._compositepro_porduct_selection').show(); } else if( select_val === 'product_categories' ) { $container.find('._compositepro_category_selection').show(); } else if( select_val === 'product_tags' ) { $container.find('._compositepro_tag_selection').show(); } }); jQuery('select._composite_layout_options').change(); // add dependence jQuery('#compositepro_add_new_dependencies').on('click',function () { jQuery('#add_dependence_loader').show(); var dependencecount = jQuery('#compositepro_make_composite_denpendence .product-composite-items_dependence').size(); var data = { post_id : composite_vars.id, action : 'compositepro_ajax_add_dependence', itemcount: dependencecount, }; var $dependence_pro_container = jQuery( '#compositepro_make_composite_denpendence' ); // alert($dependence_pro_container); jQuery.post(composite_vars.ajax_url, data,function (response) { jQuery($dependence_pro_container).append(response).accordion('destroy').accordion({heightStyle: "content", collapsible : true, active : false, header: '> div.product-composite-items_dependence >h3' }); jQuery('#add_dependence_loader').hide(); }); }); //save dependences jQuery('#compositepro_save_dependencies').on( 'click' , function () { jQuery('#saveDependenceSpinner').show(); var dependenceAjaxSave = jQuery("#compositepro_make_composite_denpendence :input").serialize(); // console.log(dependenceAjaxSave); var data = { post_id : composite_vars.id, action : 'compositepro_ajax_save_Dependencies', dependenceAjaxSave: dependenceAjaxSave, condition : "ajaxSaveDependence" }; jQuery.post(composite_vars.ajax_url, data, function (response) { jQuery('#saveDependenceSpinner').hide(); location.reload(); console.log(response); }); }); // add new component jQuery(document).ready(function(){ jQuery('#compositepro_add_new_componenet').on( 'click', function() { var itemcount = jQuery('#compositepro_make_composite .product-composite-items').size(); var data = { post_id : composite_vars.id, action : 'compositepro_ajax_add_component', itemcount: itemcount, }; var $compositepro_container = jQuery( '#compositepro_make_composite' ); // console.log($compositepro_container); jQuery.post( composite_vars.ajax_url, data, function ( response ) { // append data with accordiont jQuery($compositepro_container).append(response).accordion('destroy').accordion({heightStyle: "content", collapsible : true, active : false, header: '> div.product-composite-items >h3' }); // make select2 for both category and tags jQuery('.categories_id-select2').select2({multipel:true}); // make select2 for all products jQuery('.search_product_composite').select2({ ajax: { url: composite_vars.ajax_url, dataType: 'json', delay: 250, data: function (params, exclude) { var ide = composite_vars.id; return { q: params.term, action: 'composite_products_select' , ide: ide, }; }, processResults: function( data ) { var options = []; if ( data ) { jQuery.each( data, function( index, text ) { options.push( { id: text[0], text: text[1] } ); }); } return { results: options }; }, cache: true }, minimumInputLength: 3 }); }); return false; }); }); // save componenet via ajax jQuery('#compositepro_save_component').on( 'click', function() { jQuery('#spinnerCompnent').show(); var componenetAjaxSave = jQuery("#compositepro_make_composite :input").serialize(); var data = { post_id : composite_vars.id, action : 'compositepro_ajax_save_component', componenetAjaxSave: componenetAjaxSave, condition : "ajaxSaveComponent" }; jQuery.post( composite_vars.ajax_url, data, function ( response ) { if(response.success == true) { alert('Components Saved Successfully'); jQuery('#spinnerCompnent').hide(); } }); }); });
Save