Skip to content

Commit

Permalink
Merge pull request #127 from codersaiful/3.0.1.1
Browse files Browse the repository at this point in the history
3.0.1.1
  • Loading branch information
codersaiful authored Oct 14, 2021
2 parents 09b93d6 + 2906a88 commit 8e24b2e
Show file tree
Hide file tree
Showing 13 changed files with 304 additions and 70 deletions.
56 changes: 36 additions & 20 deletions admin/action-hook.php

Large diffs are not rendered by default.

17 changes: 9 additions & 8 deletions admin/admin-enqueue.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,22 @@
* @update 1.0.3
*/
function wpt_admin_enqueue(){

wp_enqueue_style( 'wpt-admin', WPT_Product_Table::getPath( 'BASE_URL' ) . 'assets/css/admin.css', array(), WPT_DEV_VERSION, 'all' );
/**
* Select2 CSS file including.
*
* @since 1.0.3
*/
wp_enqueue_style( 'select2', WPT_Product_Table::getPath( 'BASE_URL' ) . 'assets/css/select2.min.css', array(), '1.8.2', 'all' );

/**
* Including UltraAddons CSS form Style
*/
wp_enqueue_style( 'ultraaddons-css', WPT_Product_Table::getPath( 'BASE_URL' ) . 'assets/css/admin-common.css', array(), WPT_DEV_VERSION, 'all' );
wp_enqueue_style('ultraaddons-css');

wp_enqueue_style( 'wpt-admin', WPT_Product_Table::getPath( 'BASE_URL' ) . 'assets/css/admin.css', array('select2'), WPT_DEV_VERSION, 'all' );


/**
* Select2 CSS file including.
*
* @since 1.0.3
*/
wp_enqueue_style( 'select2', WPT_Product_Table::getPath( 'BASE_URL' ) . 'assets/css/select2.min.css', array(), '1.8.2', 'all' );

//jQuery file including. jQuery is a already registerd to WordPress
wp_enqueue_script( 'jquery' );
Expand Down
59 changes: 59 additions & 0 deletions admin/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,65 @@ function wpt_get_base64_post_meta( $post_id ){
}
}

/**
* User wise limit function,
* we will detect new user
* based on date 12 Oct, 2021
*
* if have post on product table before that date,
* we will consider as old user
*
* @since 3.0.1.0
*/
function wpt_datewise_validation(){
//If pro available, directly return true
if( defined( 'WPT_PRO_DEV_VERSION' ) ) return true;

$prev_args = array(
'post_type' => 'wpt_product_tables',
'date_query' => array(
'before' => '2021-10-1'
),
);

$prev_query = new WP_Query( $prev_args );
$prev_total = $prev_query->found_posts;
if($prev_total>0) return true;

$args = array(
'post_type' => 'wpt_product_table',
'post_status' => 'publish',
);

$query = new WP_Query( $args );
$total = $query->found_posts;

return $total < 1;
}

/**
* Alias function of wpt_datewise_validation()
* to validation check for old and new user
*
* @since 3.0.1.0
* @return bool true|false
*/
function wpt_user_can_edit(){
return wpt_datewise_validation();
}
/**
* check pro available or not
*
* @since 3.0.1
* @by Saiful
*
* @return boolean true|false
*/
function wpt_is_pro(){
if( defined( 'WPT_PRO_DEV_VERSION' ) ) return true;

return false;
}

if( ! function_exists( 'wpt_ajax_get_post_meta_base64' ) ){

Expand Down
14 changes: 13 additions & 1 deletion admin/tabs/inc-column/add-new-column.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,23 @@
'custom_field' => 'Custom Field',
'taxonomy' => 'Taxonomy',
);

if( ! wpt_is_pro() ){
$add_new_col_type[] = __( 'Blank', 'wpt_pro' );
$add_new_col_type[] = __( 'Advance Custom Field', 'wpt_pro' );
$add_new_col_type[] = __( 'Action Hooks', 'wpt_pro' );
$add_new_col_type[] = __( 'Array type Custom Field', 'wpt_pro' );
$add_new_col_type[] = __( 'Audio File Type', 'wpt_pro' );
$add_new_col_type[] = __( 'All Type Content', 'wpt_pro' );
}

$add_new_col_type = apply_filters( 'wpto_addnew_col_arr', $add_new_col_type, $columns_array, $column_settings, $post );
if( is_array( $add_new_col_type ) && count( $add_new_col_type ) > 1 ){
echo '<select class="add_new_column_type_select ua_select">';
foreach($add_new_col_type as $an_key => $an_val){
echo "<option value='{$an_key}'>$an_val</option>";
$disable = is_numeric($an_key) ? 'disabled' : '';
$pro = is_numeric($an_key) ? __( '(Pro)' ) : '';
echo "<option value='{$an_key}' {$disable}>$an_val $pro</option>";
}
echo '</select>';
}
Expand Down
73 changes: 65 additions & 8 deletions assets/css/admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -1044,16 +1044,43 @@ span.wpt_colunm_type>i {
.details.wpt_item.wpt_item_right>p {
color: #E91E63;
}
body.wpt_admin_body span.select2-selection__choice__remove {
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
background: #2c3438;
padding: 0 5px;
padding: 0;
color: white !important;
border-radius: 10px;
height: 20px;
border-radius: 50%;
height: 18px;
width: 20px;
font-size: 15px;
line-height: 1;
display: flex !important;
align-items: center;
justify-content: center;
margin-right: 10px;
padding-bottom: 2px;
}
body.wpt_admin_body span.select2-selection__choice__remove:hover {
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover,
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:focus {
background: red;
}
.select2-container--default .select2-selection--multiple .select2-selection__clear {
cursor: pointer;
font-weight: bold;
margin-top: 5px;
margin-right: 0;
position: absolute;
right: -20px;
width: 20px;
height: 24px;
background: black;
display: flex;
align-items: center;
justify-content: center;
color: #fff;
font-size: 17px;
line-height: 18px;
padding-bottom: 2px;
}
body.wpt_admin_body .select2-container--default .select2-results__option--highlighted[aria-selected] {
background-color: #607D8B;
}
Expand All @@ -1064,14 +1091,15 @@ body.wpt_admin_body .select2-container--default .select2-selection--multiple .se
background-color: rgb(255, 255, 255);
border: 1px solid white;
border-radius: 4px;
margin: 5px 5px 3px 2px;
padding: 1px 5px 4px 22px;
margin: 5px;
padding: 5px 10px;
color: black;
box-shadow: 1px 1px 3px 0px #0000003b;
float: left;
}

body.wpt_admin_body .select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
margin-top: 3px;
/* margin-top: 0px; */
}


Expand Down Expand Up @@ -1288,4 +1316,33 @@ body.wpt_admin_body .ultraaddons-panel td .notice-for-variations{
body.wpt_admin_body div div .wpt-tips {
color: #19acef;
font-size: 120%;
}
tr.user_can_not_edit:after {
content: "pro";
position: absolute;
top: 0;
left: 0;
background: #ff5722;
color: white;
padding: 1px 10px;
/*border-radius: 4px;*/
opacity: .8;
z-index: 150;
}
tr.user_can_not_edit{
position: relative;
display: table-row;
}
tr.user_can_not_edit input[disabled='disabled'] {
opacity: 0.5;
}
tr.user_can_not_edit:before {
content: "";
position: absolute;
top: 0;
left: 0;
background: #78787824;
width: 100%;
height: 100%;
z-index: 100;
}
8 changes: 8 additions & 0 deletions assets/css/universal.css
Original file line number Diff line number Diff line change
Expand Up @@ -1752,6 +1752,7 @@ a.search_box_reset:focus,
justify-content: end;
}

.wpt_product_table_wrapper div.tables_cart_message_box.message-box-loading:before,
.wpt_table_tag_wrapper.loading-table table.wpt_product_table:before {
position: absolute;
z-index: 9999;
Expand All @@ -1766,6 +1767,13 @@ a.search_box_reset:focus,
left: 0;
}

span.wpt_empty_cart_btn {
opacity: 0.6;
}
span.wpt_empty_cart_btn:hover {
opacity: 1;
}

button.loading::after,
a.loading::after,
a.wpt_woo_add_cart_button.loading::after,
Expand Down
Binary file modified assets/images/pro-features/column_extra.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions assets/js/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -743,4 +743,9 @@
}
}


$(document.body).on('click,change','tr.user_can_not_edit input,tr.user_can_not_edit select',function(e){
e.preventDefault();
alert("Sorry");
});
})(jQuery);
64 changes: 50 additions & 14 deletions assets/js/custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,13 @@

}

if( fragments.wpt_quckcart && config_json.empty_cart_text ){
var emty_cart_btn = '<span class="wpt_empty_cart_btn">' + config_json.empty_cart_text + '</span>';
$('.wpt_product_table_wrapper div.tables_cart_message_box a.cart-contents').append(emty_cart_btn);
}else{
$('.wpt_empty_cart_btn').remove();
}

var argStats = {};
argStats['status'] = true;
$(document.body).trigger('wpt_minicart_load',argStats, fragments);
Expand All @@ -333,6 +340,38 @@
}
});
}


//.wpt_product_table_wrapper div.tables_cart_message_box.message-box-loading
$(document.body).on('click','.wpt_empty_cart_btn',function(e){
e.preventDefault();
var cart_message_box = $( '.wpt_product_table_wrapper div.tables_cart_message_box' );
cart_message_box.addClass('message-box-loading');
$.ajax({
type: 'POST',
url: ajax_url,
data: {
action: 'wpt_fragment_empty_cart'
},
complete:function(){
cart_message_box.removeClass('message-box-loading');
},
success: function( response ){
$( document.body ).trigger( 'updated_cart_totals' );
$( document.body ).trigger( 'wc_fragments_refreshed' );
$( document.body ).trigger( 'wc_fragments_refresh' );
$( document.body ).trigger( 'wc_fragment_refresh' );
$( document.body ).trigger( 'removed_from_cart' );

},
error: function(){
$( document.body ).trigger( 'removed_from_cart' );
console.log("Unable to empty your cart.");
return false;
}
});
});

//wc_fragments_refreshed,wc_fragments_refresh,wc_fragment_refresh,removed_from_cart
$( document.body ).trigger( 'updated_cart_totals' );
$( document.body ).trigger( 'wc_fragments_refreshed' );
Expand Down Expand Up @@ -501,7 +540,7 @@

//Changed at2.9
var quantity = $(this).attr('data-quantity');
var custom_message = $('#table_id_' + temp_number + ' table#wpt_table .wpt_row_product_id_' + product_id + ' .wpt_message input.message').val();
var custom_message = $('#table_id_' + temp_number + ' table#wpt_table .wpt_row_product_id_' + product_id + ' .wpt_message .message').val();
var variation_id = $(this).attr('data-variation_id');
var variation = $(this).attr('data-variation');
if(variation){
Expand Down Expand Up @@ -629,18 +668,10 @@
* On change Product Variation
* Vairation Change
*/

$('body').on('change','.wpt_varition_section',function(e) {
$('body').on('change','.wpt_varition_section',function() {

var product_id = $(this).data('product_id');
var temp_number = $(this).data('temp_number');

// $('body').on('change','.wpt_varition_section.variations select,.wpt_action .variations select',function() {
//
// var product_id = $(this).closest('tr.wpt_row').data('product_id');
// var temp_number = $(this).closest('tr.wpt_row').data('temp_number');


config_json = getConfig_json( temp_number ); //Added vat V5.0
var target_class = '#product_id_' + product_id;

Expand Down Expand Up @@ -737,7 +768,7 @@


var quote_data = '';
$(this).find('select').each(function() { //.find('select')
$(this).find('select').each(function() {
var attribute_name = $(this).data('attribute_name');
var attribute_value = $(this).val();
current[attribute_name] = attribute_value;
Expand Down Expand Up @@ -1058,7 +1089,7 @@
}

var currentAddToCartSelector = $('#table_id_' + temp_number + ' #product_id_' + product_id + ' .wpt_action a.wpt_woo_add_cart_button');
var currentCustomMessage = $('#table_id_' + temp_number + ' #product_id_' + product_id + ' .wpt_message input.message').val();
var currentCustomMessage = $('#table_id_' + temp_number + ' #product_id_' + product_id + ' .wpt_message .message').val();
var currentVariaionId = currentAddToCartSelector.attr('data-variation_id');//currentAddToCartSelector.data('variation_id');
//var currentVariaion = currentAddToCartSelector.data('variation');
var currentVariaion;
Expand Down Expand Up @@ -1647,13 +1678,13 @@
/**
* Mainly for shortmessage field
*/
$('body').on('change', '.wpt_row input.message', function() {
$('body').on('change', '.wpt_row .message', function() {
var temp_number = $(this).parents('tr.wpt_row').data('temp_number');
var msg = $(this).val();
var product_id = $(this).parents('tr').data('product_id');

var thisRow = '#table_id_' + temp_number + ' tr.product_id_' + product_id;
$( thisRow + ' input.message').val(msg);
$( thisRow + ' .message').val(msg);
});
$('body').on('change', '.wpt_row input.input-text.qty.text', function() {
var temp_number = $(this).parents('tr.wpt_row').data('temp_number');
Expand Down Expand Up @@ -1760,6 +1791,11 @@
$(document.body).trigger('wpt_count_updated',argStats);
}

$(document.body).on('updateCheckBoxCount',function(temp_number){

updateCheckBoxCount(temp_number);
});

// $(document).on('wpt_count_updated',function(aaa,args){
// //console.log(args);
// var btn = args['button_object'];
Expand Down
Loading

0 comments on commit 8e24b2e

Please sign in to comment.