File: /storage/v4513/tepnot/public_html/wp-content/plugins/dokan-pro/assets/js/dokan-admin-coupon.js
!function(e){function n(n){"yes"===n?(e(".dokan-admin-coupons-include-vendors").hide(),e(".dokan-admin-coupons-exclude-vendors").show()):(e(".dokan-admin-coupons-include-vendors").show(),e(".dokan-admin-coupons-exclude-vendors").hide())}function o(n){"shared_coupon"===n?(e(".admin_shared_coupon_amount_field").show(),e(".admin_shared_coupon_type_field").show()):(e(".admin_shared_coupon_amount_field").hide(),e(".admin_shared_coupon_type_field").hide()),e(".coupon_commissions_type_label").hide(),e(".coupon_commissions_type_"+n).show()}n(e("#admin_coupons_enabled_for_vendor").is(":checked")?"yes":"no"),o(e("#coupon_commissions_type").val()),e("#usage_restriction_coupon_data .options_group:nth-of-type(2)").remove(),e("body").on("click","#admin_coupons_enabled_for_vendor",function(o){n(e("#admin_coupons_enabled_for_vendor").is(":checked")?"yes":"no")}),e("body").on("change","#coupon_commissions_type",function(n){o(e("#coupon_commissions_type").val())}),e("body").on("change","#discount_type",function(){let n=e("#woocommerce-coupon-data #general_coupon_data").find("#discount_type"),o=e("#woocommerce-coupon-data #general_coupon_data").find("#fixed-cart-discount-warning"),c=n.val(),t=`<p id="fixed-cart-discount-warning"><br><span>${dokan_coupon.i18n_fixed_cart_discount_warning}</span></p>`;e(o).remove(),"on"!==dokan_coupon.single_seller_mode&&"fixed_cart"===c&&e(n).after(t)})}(jQuery),jQuery(function(e){function n(){return{language:{errorLoading:function(){return wc_enhanced_select_params.i18n_searching},inputTooLong:function(e){var n=e.input.length-e.maximum;return 1===n?wc_enhanced_select_params.i18n_input_too_long_1:wc_enhanced_select_params.i18n_input_too_long_n.replace("%qty%",n)},inputTooShort:function(e){var n=e.minimum-e.input.length;return 1===n?wc_enhanced_select_params.i18n_input_too_short_1:wc_enhanced_select_params.i18n_input_too_short_n.replace("%qty%",n)},loadingMore:function(){return wc_enhanced_select_params.i18n_load_more},maximumSelected:function(e){return 1===e.maximum?wc_enhanced_select_params.i18n_selection_too_long_1:wc_enhanced_select_params.i18n_selection_too_long_n.replace("%qty%",e.maximum)},noResults:function(){return wc_enhanced_select_params.i18n_no_matches},searching:function(){return wc_enhanced_select_params.i18n_searching}}}}try{e(document.body).on("wc-enhanced-select-init",function(){e(":input.wc-enhanced-select, :input.chosen_select").filter(":not(.enhanced)").each(function(){var o=e.extend({minimumResultsForSearch:10,allowClear:!!e(this).data("allow_clear"),placeholder:e(this).data("placeholder")},n());e(this).selectWoo(o).addClass("enhanced")}),e(":input.wc-enhanced-select-nostd, :input.chosen_select_nostd").filter(":not(.enhanced)").each(function(){var o=e.extend({minimumResultsForSearch:10,allowClear:!0,placeholder:e(this).data("placeholder")},n());e(this).selectWoo(o).addClass("enhanced")}),e(":input.dokan-coupons-exclude-include-product-search").filter(":not(.enhanced)").each(function(){!function(o,c){if(c=e.extend(c,n()),e(o).selectWoo(c).addClass("enhanced"),e(o).data("sortable")){var t=e(o),a=e(o).next(".select2-container").find("ul.select2-selection__rendered");a.sortable({placeholder:"ui-state-highlight select2-selection__choice",forcePlaceholderSize:!0,items:"li:not(.select2-search__field)",tolerance:"pointer",stop:function(){e(a.find(".select2-selection__choice").get().reverse()).each(function(){var n=e(this).data("data").id,o=t.find('option[value="'+n+'"]')[0];t.prepend(o)})}})}else e(o).prop("multiple")&&e(o).on("change",function(){var n=e(o).children();n.sort(function(e,n){var o=e.text.toLowerCase(),c=n.text.toLowerCase();return o>c?1:o<c?-1:0}),e(o).html(n)})}(this,{allowClear:!!e(this).data("allow_clear"),placeholder:e(this).data("placeholder"),minimumInputLength:e(this).data("minimum_input_length")?e(this).data("minimum_input_length"):"3",escapeMarkup:function(e){return e},ajax:{url:wc_enhanced_select_params.ajax_url,dataType:"json",delay:250,data:function(n){const o=e('.dokan-coupons-exclude-include-product-search[name="product_ids[]"]').val(),c=e('.dokan-coupons-exclude-include-product-search[name="exclude_product_ids[]"]').val();return"product_ids[]"===e(this).attr("name")?e(this).data("exclude",c):e(this).data("exclude",o),{term:n.term,action:e(this).data("action")||"woocommerce_json_search_products_and_variations",security:wc_enhanced_select_params.search_products_nonce,exclude:e(this).data("exclude"),exclude_type:e(this).data("exclude_type"),include:e(this).data("include"),limit:e(this).data("limit"),display_stock:e(this).data("display_stock"),user_ids:e(this).data("user_ids"),search_products_for_vendor_coupon:"yes",include_vendor_ids:e(".dokan_admin_coupons_vendors_include_ids").val(),exclude_vendor_ids:e(".dokan_admin_coupons_vendors_exclude_ids").val(),enable_all_vendor:e("#admin_coupons_enabled_for_vendor").is(":checked")?"yes":"no"}},processResults:function(n){var o=[];return n&&e.each(n,function(e,n){o.push({id:e,text:n})}),{results:o}},cache:!0}})})}).on("wc_backbone_modal_before_remove",function(){e(".wc-enhanced-select, :input.wc-product-search, :input.wc-customer-search").filter(".select2-hidden-accessible").selectWoo("close")}).trigger("wc-enhanced-select-init"),e("html").on("click",function(n){this===n.target&&e(".wc-enhanced-select, :input.wc-product-search, :input.wc-customer-search").filter(".select2-hidden-accessible").selectWoo("close")})}catch(e){window.console.log(e)}});