jsrender.min.js
3 days ago
pisol-enquiry-quotation-woocommerce-admin.js
3 days ago
pisol-quick-save.js
3 days ago
pisol-sales-notification-admin.js
3 days ago
pisol-translate.js
3 days ago
pisol-sales-notification-admin.js
144 lines
| 1 | (function ($) { |
| 2 | 'use strict'; |
| 3 | |
| 4 | /** |
| 5 | * All of the code for your admin-facing JavaScript source |
| 6 | * should reside in this file. |
| 7 | * |
| 8 | * Note: It has been assumed you will write jQuery code here, so the |
| 9 | * $ function reference has been prepared for usage within the scope |
| 10 | * of this function. |
| 11 | * |
| 12 | * This enables you to define handlers, for when the DOM is ready: |
| 13 | * |
| 14 | * $(function() { |
| 15 | * |
| 16 | * }); |
| 17 | * |
| 18 | * When the window is loaded: |
| 19 | * |
| 20 | * $( window ).load(function() { |
| 21 | * |
| 22 | * }); |
| 23 | * |
| 24 | * ...and/or other possibilities. |
| 25 | * |
| 26 | * Ideally, it is not considered best practise to attach more than a |
| 27 | * single DOM-ready or window-load handler for a particular page. |
| 28 | * Although scripts in the WordPress core, Plugins and Themes may be |
| 29 | * practising this, we should strive to set a better example in our own work. |
| 30 | */ |
| 31 | jQuery(function ($) { |
| 32 | |
| 33 | |
| 34 | |
| 35 | /** |
| 36 | * Control tab |
| 37 | */ |
| 38 | /* |
| 39 | $("#pi_sn_show_all").on("change", function () { |
| 40 | if ($(this).is(":checked")) { |
| 41 | $("#pi_control .row").not("#row_pi_sn_show_all").fadeOut(); |
| 42 | } else { |
| 43 | $("#pi_control .row").not("#row_pi_sn_show_all").fadeIn() |
| 44 | } |
| 45 | }); |
| 46 | $("#pi_sn_show_all").trigger('change'); |
| 47 | */ |
| 48 | /* End control tab */ |
| 49 | |
| 50 | /** |
| 51 | * Product selection tab |
| 52 | */ |
| 53 | $("#pi_sn_product_selection").on("change", function () { |
| 54 | var selected = $("#pi_sn_product_selection option:selected").val(); |
| 55 | virtual_name_location(selected); |
| 56 | selected_product(selected); |
| 57 | selected_category(selected); |
| 58 | orders(selected); |
| 59 | }); |
| 60 | |
| 61 | $("#pi_sn_product_selection").trigger('change'); |
| 62 | |
| 63 | $("#pi_sn_selected_product").selectWoo({ |
| 64 | ajax: { |
| 65 | url: window.pi_ajax_object.ajax_url, |
| 66 | dataType: 'json', |
| 67 | type: "GET", |
| 68 | delay: 250, |
| 69 | data: function (params) { |
| 70 | return { |
| 71 | keyword: params.term, |
| 72 | action: "pi_search_product" |
| 73 | }; |
| 74 | }, |
| 75 | processResults: function (data) { |
| 76 | return { |
| 77 | results: data |
| 78 | }; |
| 79 | |
| 80 | }, |
| 81 | } |
| 82 | }); |
| 83 | |
| 84 | $("#pi_sn_selected_category").selectWoo({ |
| 85 | ajax: { |
| 86 | url: window.pi_ajax_object.ajax_url, |
| 87 | dataType: 'json', |
| 88 | type: "GET", |
| 89 | delay: 250, |
| 90 | data: function (params) { |
| 91 | return { |
| 92 | keyword: params.term, |
| 93 | action: "pi_search_category" |
| 94 | }; |
| 95 | }, |
| 96 | processResults: function (data) { |
| 97 | return { |
| 98 | results: data |
| 99 | }; |
| 100 | |
| 101 | }, |
| 102 | } |
| 103 | }); |
| 104 | |
| 105 | $("#pi_sn_order_status").selectWoo(); |
| 106 | /* End product selection tab */ |
| 107 | |
| 108 | }); |
| 109 | |
| 110 | function virtual_name_location(selected) { |
| 111 | if (selected == "recently-viewed-products" || selected == "selected-products" || selected == "selected-categories") { |
| 112 | $("#virtual-name-location").fadeIn(); |
| 113 | } else { |
| 114 | $("#virtual-name-location").fadeOut(); |
| 115 | } |
| 116 | } |
| 117 | |
| 118 | function selected_product(selected) { |
| 119 | if (selected == "selected-products") { |
| 120 | $("#selected-products").fadeIn(); |
| 121 | } else { |
| 122 | $("#selected-products").fadeOut(); |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | function selected_category(selected) { |
| 127 | if (selected == "selected-categories") { |
| 128 | $("#selected-categories").fadeIn(); |
| 129 | } else { |
| 130 | $("#selected-categories").fadeOut(); |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | function orders(selected) { |
| 135 | if (selected == "orders") { |
| 136 | $("#orders").fadeIn(); |
| 137 | } else { |
| 138 | $("#orders").fadeOut(); |
| 139 | } |
| 140 | } |
| 141 | |
| 142 | |
| 143 | })(jQuery); |
| 144 |