From da5f4be8df8f1ba42971009e72f7d0e27617bd60 Mon Sep 17 00:00:00 2001 From: Saiful Islam Date: Wed, 5 May 2021 01:11:12 +0600 Subject: [PATCH] Choosing Inner time is now select2 with multiple --- assets/css/admin.css | 9 ++++--- assets/js/admin.js | 11 ++++++-- includes/functions.php | 60 +++++++++++++++++++++++++++--------------- 3 files changed, 53 insertions(+), 27 deletions(-) diff --git a/assets/css/admin.css b/assets/css/admin.css index 1b3edefb..b882adbf 100644 --- a/assets/css/admin.css +++ b/assets/css/admin.css @@ -87,7 +87,7 @@ ul#wpt_keyword_hide_mobile padding: 12px 10px 8px 10px; } li.expanded_li .wpt_shortable_data{ - padding: 20px 10px 15px 10px; + padding: 20px 15px 15px 15px; } .wpt_shortable_data { @@ -140,7 +140,8 @@ ul#wpt_keyword_hide_mobile li>span.handle.checkbox_handle>input border: 1px solid transparent; } .wpt_shortable_data>input{ - font-weight: bold; + font-weight: 500; + color: #333333; } .enabled:hover .wpt_shortable_data>input{ border: 1px solid #00769324; @@ -533,12 +534,12 @@ span.purchase_code_active { background: #e5e5e5; } .wpt_column_setting_extra { - padding: 0 10px 16px 10px; + /* padding: 0 10px 16px 10px; */ background: transparent; width: calc(100% - 20px); background: #ffffffd9; margin-top: 21px; - border: 1px solid #dddddd91; + /* border: 1px solid #dddddd91; */ margin-bottom: 5px; } .wpt_column_setting_single_extra { diff --git a/assets/js/admin.js b/assets/js/admin.js index a0ffe3d5..0a721f6b 100644 --- a/assets/js/admin.js +++ b/assets/js/admin.js @@ -12,8 +12,15 @@ option.detach(); $(target).append(option).change(); } - $('select#wpt_product_ids,select#product_tag_ids,select.wpt_select2').select2(); + $('select#wpt_product_ids,select#product_tag_ids,select.wpt_select2').select2({ + placeholder: "Select Option", + allowClear: true + }); + $('select.internal_select').select2({ + placeholder: "Select mulitple inner Items.", + allowClear: true + }); /** * Product Exclude Include Feature Added Here, * Which is normally in Pro Actually @@ -92,7 +99,7 @@ }); - $('select#wpt_product_ids,select#product_tag_ids,select.wpt_select2').on('select2:select', function(e){ + $('select#wpt_product_ids,select#product_tag_ids,select.wpt_select2,select.internal_select').on('select2:select', function(e){ wptSelectItem(e.target, e.params.data.id); }); diff --git a/includes/functions.php b/includes/functions.php index 7f93542c..cf6bd137 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -292,7 +292,7 @@ function wpt_column_tag_for_all( $keyword, $_device_name, $column_settings ){ if( !function_exists( 'wpt_column_add_extra_items' ) ){ function wpt_column_add_extra_items( $keyword, $_device_name, $column_settings, $columns_array, $updated_columns_array, $post, $additional_data ){ - + unset( $columns_array[$keyword] ); //Unset this column. if in action, here $keyword - action //unset( $columns_array['check'] ); unset( $columns_array['blank'] ); @@ -301,6 +301,7 @@ function wpt_column_add_extra_items( $keyword, $_device_name, $column_settings, * Items actually Checked Items */ $items = isset( $column_settings[$keyword]['items'] ) ? $column_settings[$keyword]['items'] : array(); + $items = is_array( $items ) ? $items : array(); $items = array_filter( $items ); /** @@ -317,29 +318,46 @@ function wpt_column_add_extra_items( $keyword, $_device_name, $column_settings, } ?>
- -
+ + + + + $key_val){ + $seleced = in_array( $key,$items ) ? 'checked' : false; + $seleced_option = in_array( $key,$items ) ? 'selected' : false; + //var_dump($key, $keyword); + $unique_id = $keyword . '_' . $key . '_' . $_device_name; +// echo '
'; + ?> + + $key_val){ - $seleced = in_array( $key,$items ) ? 'checked' : false; - //var_dump($key, $keyword); - $unique_id = $keyword . '_' . $key . '_' . $_device_name; - echo '
'; - echo ""; - echo '
'; - } - ?> -
-

All Items are move able. And Settings of item will come from main column. which can be inactive as Table Column.

+ $select .= ""; +// echo ""; +// echo '
'; + } + ?> + + +