css
9 months ago
img
9 months ago
js
9 months ago
partials
9 months ago
class-adv-order-filter.php
9 months ago
class-analytics.php
9 months ago
class-order-tip-promotion.php
9 months ago
class-pi-dtt-labels.php
9 months ago
class-pi-dtt-order-table.php
9 months ago
conflict-fixer.php
9 months ago
menu.php
9 months ago
options-addons.php
9 months ago
options-date.php
9 months ago
options-limit.php
9 months ago
options-pickup.php
9 months ago
options-time-slot.php
9 months ago
options-time.php
9 months ago
options.php
9 months ago
menu.php
216 lines
| 1 | <?php |
| 2 | |
| 3 | class pisol_dtt_menu{ |
| 4 | |
| 5 | public $screen_ids = ['shop_order', 'woocommerce_page_wc-orders']; |
| 6 | |
| 7 | public $version; |
| 8 | |
| 9 | |
| 10 | function __construct(){ |
| 11 | $this->version = PISOL_DTT_PLUGIN_VERSION; |
| 12 | add_action( 'admin_menu', array($this,'plugin_menu') ); |
| 13 | add_action('pisol_dtt_promotion', array($this,'promotion')); |
| 14 | add_action( 'admin_enqueue_scripts',array($this, 'orderPageScript')); |
| 15 | } |
| 16 | |
| 17 | function plugin_menu(){ |
| 18 | |
| 19 | $require_capability = $this->getCapability(); |
| 20 | |
| 21 | $menu = add_submenu_page('woocommerce', __('Date & Time','pisol-dtt'), __('Date & Time','pisol-dtt'), $require_capability, 'pisol-dtt', array($this, 'menu_option_page') ); |
| 22 | |
| 23 | add_action("load-".$menu, array($this,'menu_page_style')); |
| 24 | } |
| 25 | |
| 26 | function getCapability(){ |
| 27 | $capability = 'manage_options'; |
| 28 | |
| 29 | return (string)apply_filters('pisol_dtt_settings_cap', $capability); |
| 30 | } |
| 31 | |
| 32 | function menu_option_page(){ |
| 33 | if(function_exists('settings_errors')){ |
| 34 | settings_errors(); |
| 35 | } |
| 36 | ?> |
| 37 | <div class="bootstrap-wrapper"> |
| 38 | <div class="pisol-container mt-2"> |
| 39 | <div class="pisol-row"> |
| 40 | <div class="col-12"> |
| 41 | <div class='bg-dark'> |
| 42 | <div class="pisol-row"> |
| 43 | <div class="col-12 col-sm-2 py-2"> |
| 44 | <a href="https://www.piwebsolution.com/" target="_blank"><img class="img-fluid ml-2" src="<?php echo esc_url(PISOL_DTT_URL); ?>admin/img/pi-web-solution.svg"></a> |
| 45 | </div> |
| 46 | <div class="col-12 col-sm-10 text-right small d-flex align-items-center justify-content-end "> |
| 47 | |
| 48 | <a id="pi-special-button" href="<?php echo esc_url(PISOL_DTT_BUY_URL); ?>&utm_ref=top_link" target="_blank"><span class="dashicons dashicons-unlock"></span> GET PRO !!</a> |
| 49 | |
| 50 | </div> |
| 51 | </div> |
| 52 | </div> |
| 53 | </div> |
| 54 | </div> |
| 55 | <div class="pisol-row"> |
| 56 | <div class="col-12"> |
| 57 | <div class="bg-light border px-3"> |
| 58 | <div class="pisol-row"> |
| 59 | <div class="col-12 col-md-12 col-lg-2 border-right"> |
| 60 | <div id="pisol-side-menu" class="mb-4 rounded mt-4 py-3 pi-sticky "> |
| 61 | <?php do_action('pisol_dtt_tab'); ?> |
| 62 | </div> |
| 63 | </div> |
| 64 | <?php |
| 65 | if ( isset($_GET['tab']) && ($_GET['tab'] === 'pi_time_slot' || $_GET['tab'] === 'addons') ) { |
| 66 | ?> |
| 67 | <div class="col"> |
| 68 | <?php }else{ ?> |
| 69 | <div class="col-lg-6 col-md-8 col-12"> |
| 70 | <?php } ?> |
| 71 | <?php do_action('pisol_dtt_tab_content'); ?> |
| 72 | </div> |
| 73 | <?php do_action('pisol_dtt_promotion'); ?> |
| 74 | </div> |
| 75 | </div> |
| 76 | </div> |
| 77 | </div> |
| 78 | </div> |
| 79 | </div> |
| 80 | <?php |
| 81 | $this->currentTime(); |
| 82 | $this->support(); |
| 83 | } |
| 84 | |
| 85 | function menu_page_style(){ |
| 86 | global $post_type; |
| 87 | wp_enqueue_script('jquery-ui-sortable'); |
| 88 | wp_enqueue_style('pi_dtt_menu_page_style_bootstrap', plugins_url('css/bootstrap.css', __FILE__), array(), $this->version); |
| 89 | wp_enqueue_style('pi_dtt_menu_page_style', plugins_url('css/style.css', __FILE__), [], $this->version); |
| 90 | |
| 91 | wp_enqueue_style('pi_dtt_timepicker', plugins_url('css/jquery.timepicker.min.css', __FILE__), [], $this->version); |
| 92 | |
| 93 | wp_enqueue_script( 'jquery-ui-datepicker' ); |
| 94 | wp_enqueue_script( 'pisol-jquery-ui-timepicker', plugins_url('js/jquery.timepicker.min.js', __FILE__) ); |
| 95 | |
| 96 | wp_enqueue_style( 'jquery-ui', plugins_url('css/jquery-ui.css', __FILE__)); |
| 97 | wp_enqueue_script( 'pi-dtt-custom',plugins_url('js/custom.js', __FILE__) ); |
| 98 | |
| 99 | wp_enqueue_script( 'pi-dtt-pro-custom', plugins_url('js/pi-woocommerce-order-date-time-and-type-pro-admin.js', __FILE__), array( 'jquery' ), $this->version, false ); |
| 100 | |
| 101 | wp_localize_script('pi-dtt-custom','pi_dtt_settings', array('delivery_type'=> get_option('pi_type','Both'))); |
| 102 | |
| 103 | wp_register_script( 'selectWoo', WC()->plugin_url() . '/assets/js/selectWoo/selectWoo.full.min.js', array( 'jquery' ) ); |
| 104 | wp_enqueue_script( 'selectWoo' ); |
| 105 | wp_enqueue_style( 'select2', WC()->plugin_url() . '/assets/css/select2.css'); |
| 106 | |
| 107 | wp_enqueue_script( "pi_dtt_quick_save", plugin_dir_url( __FILE__ ) . 'js/pisol-quick-save.js', array('jquery'), '1.0.2', 'all' ); |
| 108 | |
| 109 | $translation = self::translationStrings(); |
| 110 | wp_localize_script('pi-dtt-pro-custom', 'pisol_dtt_translation', $translation); |
| 111 | } |
| 112 | |
| 113 | function orderPageScript(){ |
| 114 | $current_screen = get_current_screen(); |
| 115 | $current_screen_id = $current_screen->id; |
| 116 | if (in_array( $current_screen_id, $this->screen_ids) || $current_screen_id == 'edit-shop_order') { |
| 117 | wp_enqueue_script( 'jquery-ui-datepicker' ); |
| 118 | |
| 119 | wp_enqueue_style( 'jquery-ui', plugins_url('css/jquery-ui.css', __FILE__)); |
| 120 | |
| 121 | wp_enqueue_script( 'pi-dtt-order-page-js', plugins_url('js/pi-order-page.js', __FILE__), array( 'jquery' )); |
| 122 | |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | function promotion(){ |
| 127 | if(isset($_GET['tab']) && ($_GET['tab'] === 'addons' || $_GET['tab'] === 'pi_time_slot')) return; |
| 128 | ?> |
| 129 | <div class="col-12 col-lg-4 col-md-4 border-left"> |
| 130 | |
| 131 | <div class="pi-shadow mb-2 mt-4 px-2 py-3"> |
| 132 | <h2 id="pi-banner-tagline" class="mb-0" style="color:#ccc !important;"> |
| 133 | <span class="d-block mb-2">⭐️⭐️⭐️⭐️⭐️</span> |
| 134 | <span class="d-block mb-2">🚀 Trusted by <span style="color:#fff;">2,000+</span> WooCommerce Stores</span> |
| 135 | <span class="d-block mb-2">Rated <span style="color:#fff;">4.9/5</span> – Users love it</span> |
| 136 | </h2> |
| 137 | <div class="inside px-2 mt-4"> |
| 138 | <ul class="pisol-pro-feature-list mb-4"> |
| 139 | <li><span style="color:white;">✓</span> Advanced order limits (day, date & time slot)</li> |
| 140 | <li><span style="color:white;">✓</span> Separate prep time for delivery & pickup</li> |
| 141 | <li><span style="color:white;">✓</span> Time range instead of exact time</li> |
| 142 | <li><span style="color:white;">✓</span> Disable delivery/pickup by method</li> |
| 143 | <li><span style="color:white;">✓</span> Multiple pickup/delivery locations & holidays</li> |
| 144 | <li><span style="color:white;">✓</span> Custom time intervals & pre-order limits</li> |
| 145 | <li><span style="color:white;">✓</span> Optional delivery date/time fields</li> |
| 146 | <li><span style="color:white;">✓</span> Show custom delivery messages</li> |
| 147 | <li><span style="color:white;">✓</span> Change button color & invoice support</li> |
| 148 | <li><span style="color:white;">✓</span> Hide fields based on delivery type</li> |
| 149 | <li><span style="color:white;">✓</span> Support for virtual products</li> |
| 150 | <li><span style="color:white;">✓</span> Special date settings & forced orders</li> |
| 151 | <li><span style="color:white;">✓</span> Smart email routing to pickup stores</li> |
| 152 | <li><span style="color:white;">✓</span> Change payment gateway per method</li> |
| 153 | <li>🎯 And many more powerful features...</li> |
| 154 | </ul> |
| 155 | <h4 class="pi-bottom-banner">💰 Just <?php echo esc_html(PISOL_DTT_PRICE); ?></h4> |
| 156 | <h4 class="pi-bottom-banner">🔥 Unlock all features and grow your sales!</h4> |
| 157 | <div class="text-center pt-2 pb-3"> |
| 158 | <a class="btn btn-primary btn-md" href="<?php echo esc_url( PISOL_DTT_BUY_URL ); ?>&utm_ref=bottom_link" target="_blank">🔓 Unlock Pro Now – Limited Time Price!</a> |
| 159 | </div> |
| 160 | </div> |
| 161 | </div> |
| 162 | |
| 163 | <div class="bg-dark text-light text-center mb-3 mt-4"> |
| 164 | <a href="<?php echo esc_url( PISOL_DTT_BUY_URL ); ?>&utm_ref=discount_banner" target="_blank"> |
| 165 | <?php new pisol_promotion("pi_order_date_time_installation_date"); ?> |
| 166 | </a> |
| 167 | </div> |
| 168 | |
| 169 | </div> |
| 170 | |
| 171 | <?php |
| 172 | } |
| 173 | |
| 174 | static function translationStrings(){ |
| 175 | $translation = array( |
| 176 | 'disable_pickup_on' => __('Disable pickup on', 'pisol-dtt'), |
| 177 | 'disable_delivery_on' => __('Disable delivery on', 'pisol-dtt'), |
| 178 | 'special_pickup_on' => __('Special pickup on', 'pisol-dtt'), |
| 179 | 'special_delivery_on' => __('Special delivery on', 'pisol-dtt'), |
| 180 | 'order_limit_on_time_slot' => __('( PRO ) order limit on this time slot', 'pisol-dtt'), |
| 181 | 'quantity_limit_on_time_slot' => __('( PRO ) quantity limit on this time slot', 'pisol-dtt'), |
| 182 | 'start_date' => __('Start date', 'pisol-dtt'), |
| 183 | 'delivery_order_limit' => __('Delivery order limit', 'pisol-dtt'), |
| 184 | 'pickup_order_limit' => __('Pickup order limit', 'pisol-dtt'), |
| 185 | 'overall_order_limit' => __('Overall order limit', 'pisol-dtt'), |
| 186 | 'slot_time_divider_to' => __('To', 'pisol-dtt'), |
| 187 | 'clear_value' => __('Clear Value', 'pisol-dtt') |
| 188 | ); |
| 189 | return $translation; |
| 190 | } |
| 191 | |
| 192 | function currentTime(){ |
| 193 | echo '<div class="pi-edd-current-time-box">'; |
| 194 | echo '<strong>Timing as per your website timezone (Plugin considers this time as present time)</strong><br>'; |
| 195 | echo esc_html( current_time('M d, Y H:i A') ); |
| 196 | echo '<br><a href="'.esc_url( admin_url('options-general.php#timezone_string') ).'" target="_blank">(click to change)</a>'; |
| 197 | echo '</div>'; |
| 198 | } |
| 199 | |
| 200 | function support(){ |
| 201 | $website_url = home_url(); |
| 202 | $plugin_name = 'order-date-time-and-type'; |
| 203 | ?> |
| 204 | <form action="https://www.piwebsolution.com/quick-support/" method="post" target="_blank" style="display:inline; position:fixed; bottom:120px; right:35px; z-index:9999;" > |
| 205 | <input type="hidden" name="website_url" value="<?php echo esc_attr( $website_url ); ?>"> |
| 206 | <input type="hidden" name="plugin_name" value="<?php echo esc_attr( $plugin_name ); ?>"> |
| 207 | <button type="submit" style="background:none;border:none;cursor:pointer;padding:0;"> |
| 208 | <img src="<?php echo esc_url( plugin_dir_url( __FILE__ ) ); ?>img/chat.png" |
| 209 | alt="Live Support" title="Quick Support" style="width:60px;height:60px;"> |
| 210 | </button> |
| 211 | </form> |
| 212 | <?php |
| 213 | } |
| 214 | } |
| 215 | |
| 216 | new pisol_dtt_menu(); |