<div class="wrap">
	<div id="icon-options-general" class="icon32"></div>
	<h1><?php 
esc_attr_e( 'Wootrello settings page !', 'WpAdminStyle' );
?></h1>
    <!-- Data Processing Code Starts -->
    <?php 
# 3rd party Plugin Fields
$woo_checkout_field_editor_fields = $this->helpers->wootrello_woo_checkout_field_editor_pro_fields();
# Security Check & Status ID Check
if ( isset( $_POST['wootrello_nonce'], $_POST['statusID'] ) and wp_verify_nonce( $_POST['wootrello_nonce'], 'wootrello_nonce_value' ) and !empty( $_POST['statusID'] ) ) {
    # security sanitize Post ID
    $statusID = sanitize_text_field( $_POST['statusID'] );
    $settings = array();
    $settings['trello_board'] = ( (isset( $_POST['trello_board'] ) and !empty( $_POST['trello_board'] )) ? sanitize_text_field( $_POST['trello_board'] ) : FALSE );
    $settings['trello_list'] = ( (isset( $_POST['trello_list'] ) and !empty( $_POST['trello_list'] )) ? sanitize_text_field( $_POST['trello_list'] ) : FALSE );
    $settings['trello_due_date'] = ( (isset( $_POST['trello_due_date'] ) and !empty( $_POST['trello_due_date'] )) ? sanitize_text_field( $_POST['trello_due_date'] ) : FALSE );
    $settings['trello_label_colour'] = ( (isset( $_POST['trello_label_colour'] ) and !empty( $_POST['trello_label_colour'] )) ? sanitize_text_field( $_POST['trello_label_colour'] ) : FALSE );
    #
    $settings['filter_strategy'] = ( isset( $_POST['filter_strategy'] ) ? sanitize_text_field( $_POST['filter_strategy'] ) : 'ALL' );
    $settings['filters'] = array();
    if ( isset( $_POST['filter_field'] ) && is_array( $_POST['filter_field'] ) ) {
        foreach ( $_POST['filter_field'] as $key => $field ) {
            $field = sanitize_text_field( $field );
            $condition = sanitize_text_field( $_POST['filter_condition'][$key] );
            // Save only if BOTH field and condition are selected (not empty)
            if ( !empty( $field ) && !empty( $condition ) ) {
                $settings['filters'][] = array(
                    'field'     => $field,
                    'condition' => $condition,
                    'value'     => sanitize_text_field( $_POST['filter_value'][$key] ),
                );
            }
        }
    }
    #
    $card = array();
    $card['order_id_in_title'] = ( (isset( $_POST['order_id_in_title'] ) and !empty( $_POST['order_id_in_title'] )) ? TRUE : FALSE );
    $card['date'] = ( (isset( $_POST['date'] ) and !empty( $_POST['date'] )) ? TRUE : FALSE );
    $card['date_formate'] = ( (isset( $_POST['date_formate'] ) and !empty( $_POST['date_formate'] )) ? sanitize_text_field( $_POST['date_formate'] ) : "us" );
    $card['customer_name_in_title'] = ( (isset( $_POST['customer_name_in_title'] ) and !empty( $_POST['customer_name_in_title'] )) ? TRUE : FALSE );
    $card['order_total_in_title'] = ( (isset( $_POST['order_total_in_title'] ) and !empty( $_POST['order_total_in_title'] )) ? TRUE : FALSE );
    $card['order_meta_position'] = ( isset( $_POST['order_meta_position'] ) ? sanitize_text_field( $_POST['order_meta_position'] ) : "" );
    $card['order_post_meta_position'] = ( isset( $_POST['order_post_meta_position'] ) ? sanitize_text_field( $_POST['order_post_meta_position'] ) : "" );
    # order_total_in_title
    $card['order_url'] = ( (isset( $_POST['order_url'] ) and !empty( $_POST['order_url'] )) ? TRUE : FALSE );
    $card['customer_name'] = ( (isset( $_POST['customer_name'] ) and !empty( $_POST['customer_name'] )) ? TRUE : FALSE );
    $card['customer_note'] = ( (isset( $_POST['customer_note'] ) and !empty( $_POST['customer_note'] )) ? TRUE : FALSE );
    $card['billing_address'] = ( (isset( $_POST['billing_address'] ) and !empty( $_POST['billing_address'] )) ? TRUE : FALSE );
    $card['billing_email'] = ( (isset( $_POST['billing_email'] ) and !empty( $_POST['billing_email'] )) ? TRUE : FALSE );
    $card['billing_phone'] = ( (isset( $_POST['billing_phone'] ) and !empty( $_POST['billing_phone'] )) ? TRUE : FALSE );
    $card['shipping_address'] = ( (isset( $_POST['shipping_address'] ) and !empty( $_POST['shipping_address'] )) ? TRUE : FALSE );
    $card['product_categories'] = ( (isset( $_POST['product_categories'] ) and !empty( $_POST['product_categories'] )) ? TRUE : FALSE );
    $card['payment_method'] = ( (isset( $_POST['payment_method'] ) and !empty( $_POST['payment_method'] )) ? TRUE : FALSE );
    $card['shipping_method'] = ( (isset( $_POST['shipping_method'] ) and !empty( $_POST['shipping_method'] )) ? TRUE : FALSE );
    $card['shipping_total'] = ( (isset( $_POST['shipping_total'] ) and !empty( $_POST['shipping_total'] )) ? TRUE : FALSE );
    $card['discount_total'] = ( (isset( $_POST['discount_total'] ) and !empty( $_POST['discount_total'] )) ? TRUE : FALSE );
    $card['cart_items_weight'] = ( (isset( $_POST['cart_items_weight'] ) and !empty( $_POST['cart_items_weight'] )) ? TRUE : FALSE );
    $card['order_total'] = ( (isset( $_POST['order_total'] ) and !empty( $_POST['order_total'] )) ? TRUE : FALSE );
    $card['previous_orders'] = ( (isset( $_POST['previous_orders'] ) and !empty( $_POST['previous_orders'] )) ? TRUE : FALSE );
    #
    $card['product_serial_number'] = ( (isset( $_POST['serial_number'] ) and !empty( $_POST['serial_number'] )) ? TRUE : FALSE );
    $card['product_id'] = ( (isset( $_POST['product_id'] ) and !empty( $_POST['product_id'] )) ? TRUE : FALSE );
    $card['product_sku'] = ( (isset( $_POST['product_sku'] ) and !empty( $_POST['product_sku'] )) ? TRUE : FALSE );
    $card['product_qty'] = ( (isset( $_POST['product_qty'] ) and !empty( $_POST['product_qty'] )) ? TRUE : FALSE );
    $card['product_weight'] = ( (isset( $_POST['product_weight'] ) and !empty( $_POST['product_weight'] )) ? TRUE : FALSE );
    $card['product_qty_price'] = ( (isset( $_POST['product_qty_price'] ) and !empty( $_POST['product_qty_price'] )) ? TRUE : FALSE );
    # Post status  publish or pending
    $post_status = ( (isset( $_POST['status'] ) and $_POST['status'] = 'publish') ? "publish" : "pending" );
    #####################################################################################################################################
    # Check the Order Meta Key for card TITLE [Unified]
    if ( wootrello_freemius()->can_use_premium_code() ) {
        // Get data from the new field name
        $title_meta_source = ( isset( $_POST['orderTitleMeta'] ) ? $_POST['orderTitleMeta'] : array() );
        // BACKWARD COMPATIBILITY: Fallback to old name if new one is empty
        if ( empty( $title_meta_source ) && isset( $_POST['orderTitlePostMeta'] ) ) {
            $title_meta_source = $_POST['orderTitlePostMeta'];
        }
        if ( is_array( $title_meta_source ) ) {
            $metaKeysTitleTMP = array();
            foreach ( $title_meta_source as $key ) {
                if ( !empty( $key ) ) {
                    $clean_key = sanitize_text_field( $key );
                    $metaKeysTitleTMP[$clean_key] = $clean_key;
                }
            }
            $card['orderTitleMeta'] = $metaKeysTitleTMP;
            // Cleanup: Remove old legacy key from the card data
            unset($card['orderTitlePostMeta']);
        }
        # Check the Order Meta Key for card BODY [Unified]
        // Get data from the new field name
        $body_meta_source = ( isset( $_POST['orderBodyMeta'] ) ? $_POST['orderBodyMeta'] : array() );
        // BACKWARD COMPATIBILITY: Merge old 'Meta' and 'Post Meta' if the new key is empty
        if ( empty( $body_meta_source ) ) {
            $old_meta = ( isset( $_POST['orderMetaKeys'] ) ? (array) $_POST['orderMetaKeys'] : array() );
            $old_post_meta = ( isset( $_POST['orderPostMetaKeys'] ) ? (array) $_POST['orderPostMetaKeys'] : array() );
            $body_meta_source = array_unique( array_merge( $old_meta, $old_post_meta ) );
        }
        if ( is_array( $body_meta_source ) ) {
            $metaKeysBodyTMP = array();
            foreach ( $body_meta_source as $key ) {
                if ( !empty( $key ) ) {
                    $clean_key = sanitize_text_field( $key );
                    $metaKeysBodyTMP[$clean_key] = $clean_key;
                }
            }
            $card['orderBodyMeta'] = $metaKeysBodyTMP;
            // Cleanup: Remove old legacy keys from the card data
            unset($card['orderMetaKeys']);
            unset($card['orderPostMetaKeys']);
        }
        # 3rd party Plugin
        $card['checkout_field_editor'] = ( (isset( $_POST['checkout_field_editor'] ) and !empty( $_POST['checkout_field_editor'] )) ? TRUE : FALSE );
    }
    #####################################################################################################################################
    # database Global instance
    global $wpdb;
    # run Query # Getting saved integrations by there title
    $savedIntegration = $wpdb->get_results( "SELECT * FROM `" . $wpdb->posts . "` WHERE post_title  = '" . $statusID . "' AND post_type = 'wootrello';", OBJECT );
    # creating input data array
    $postData = array(
        'post_title'   => wp_strip_all_tags( $statusID ),
        'post_content' => json_encode( $card ),
        'post_excerpt' => json_encode( $settings ),
        'post_status'  => $post_status,
        'post_type'    => 'wootrello',
    );
    # If There are No Settings than Insert if Have settings Update
    if ( isset( $savedIntegration[0], $savedIntegration[0]->ID ) and !empty( $savedIntegration[0]->ID ) ) {
        $postData['ID'] = $savedIntegration[0]->ID;
        $r = wp_update_post( $postData );
    } else {
        $r = wp_insert_post( $postData );
    }
    # unset aka clearing some memory; losing some weight
    unset($_POST);
    unset($settings);
    unset($card);
    unset($metaKeysTMP);
}
# Saving Trello API Starts
if ( isset( $_POST['wootrello_api_nonce'], $_POST['trello_api'] ) and wp_verify_nonce( $_POST['wootrello_api_nonce'], 'wootrello_settings_api_nonce_value' ) ) {
    $trello_API = ( (isset( $_POST['trello_api'] ) and !empty( $_POST['trello_api'] )) ? sanitize_text_field( trim( $_POST['trello_api'] ) ) : FALSE );
    update_option( 'wootrello_trello_API', $trello_API );
}
# getting data from database;
$wootrello_trello_API = get_option( "wootrello_trello_API" );
# Trello Board list;
$trello_boards = $this->trelloApi->wootrello_trello_boards( $wootrello_trello_API );
?>
    <!-- Data Processing Code Ends -->
  
    <div id="poststuff">
		<div id="post-body" class="metabox-holder columns-2">
			<!-- main content -->
			<div id="post-body-content">
                <!-- Forms starts -->
				<?php 
# This Variable will Count all the connections;
$total_connection = 0;
# Looping the order statuses
foreach ( $this->order_statuses as $status_key => $status_value ) {
    # database Global instance
    global $wpdb;
    # run Query # Getting saved integrations by there title
    $result = $wpdb->get_results( "SELECT * FROM `" . $wpdb->posts . "` WHERE post_type = 'wootrello' AND post_title = 'wootrello_" . $status_key . "';", ARRAY_A );
    #
    # new code, if not set or empty skype this
    if ( isset( $result[0] ) and !empty( $result[0] ) ) {
        $saved_value = $result[0];
    } else {
        $saved_value = array();
    }
    # Empty Holders
    $saved_settings = "";
    $saved_card = "";
    //
    if ( !empty( $saved_value ) ) {
        $saved_settings = @json_decode( $saved_value['post_excerpt'], TRUE );
        $saved_card = @json_decode( $saved_value['post_content'], TRUE );
        # Counting Total integrations
        if ( isset( $saved_settings['trello_board'], $saved_settings['trello_list'] ) and $saved_value['post_status'] == 'publish' and !empty( $saved_settings['trello_board'] ) and !empty( $saved_settings['trello_list'] ) ) {
            $total_connection++;
        }
    }
    echo "<form name='wootrello_settings' method='POST' action='' >";
    # Nonce fields
    echo "<input type='hidden'  name='wootrello_nonce' value='" . wp_create_nonce( 'wootrello_nonce_value' ) . "'>";
    echo "<input type='hidden'  name='statusID' value='wootrello_" . $status_key . "'>";
    # প্যানেল স্টার্ট
    echo "<div class='meta-box-sortables ui-sortable'>";
    echo "<div class='postbox'>";
    echo "<h2 class='hndle'><span> " . $status_value . " </span></h2>";
    echo "<div class='inside'>";
    //  Form Fields Starts from Here ;
    echo "<table class='widefat' style='width: 100%; border-collapse: collapse;' >";
    echo "<thead>";
    echo "<tr>";
    echo "<th class='row-title'>";
    echo "Enable | Disable ";
    echo "</th>";
    echo "<th>";
    echo "Trello Boards";
    echo "</th>";
    echo "<th>";
    echo "Trello List";
    echo "</th>";
    if ( wootrello_freemius()->can_use_premium_code() ) {
        echo "<th>";
        echo "Due Date";
        echo "</th>";
        echo "<th>";
        echo "Color";
        echo "</th>";
    }
    echo "</tr>";
    echo "</thead>";
    echo "<tbody>";
    echo "<tr class='alternate'>";
    echo "<td>";
    # Enable & Disable
    if ( isset( $saved_value['post_status'] ) and $saved_value['post_status'] == 'publish' ) {
        echo "<input  type='checkbox' name='status' id='" . $status_key . "_status' value='publish' checked  />";
    } else {
        echo "<input  type='checkbox' name='status' id='" . $status_key . "_status' value='pending' />";
    }
    echo "</td>";
    echo "<td>";
    # Select Trello Board
    echo "<select  name='trello_board' id='wootrello_" . $status_key . "' class='trelloBoard'>";
    echo "<option value=''> -- Select Trello Board -- </option>";
    if ( $trello_boards[0] == 200 and !empty( $trello_boards[1] ) ) {
        foreach ( $trello_boards[1] as $key => $value ) {
            if ( isset( $saved_settings['trello_board'] ) and $saved_settings['trello_board'] == $key ) {
                echo "<option value='" . $key . "' selected > " . addslashes( $value ) . "</option>";
            } else {
                echo "<option value='" . $key . "'> " . addslashes( $value ) . "</option>";
            }
        }
    }
    echo "</select>";
    echo "</td>";
    echo "<td>";
    # Select Trello List
    echo "<select  name='trello_list'  id='wootrello_" . $status_key . "_trello_list' class='trello_list'>";
    if ( isset( $saved_settings['trello_board'] ) and $saved_settings['trello_board'] ) {
        $lists = $this->trelloApi->wootrello_board_lists( $wootrello_trello_API, $saved_settings['trello_board'], 'Settings Display page' );
        # if Request is OK
        if ( $lists[0] == 200 ) {
            echo "<option selected='selected' value=''> -- Select Trello List -- </option>";
            foreach ( $lists[1] as $listKey => $listName ) {
                if ( isset( $saved_settings, $saved_settings['trello_list'] ) and $saved_settings['trello_list'] == $listKey ) {
                    echo "<option value='" . $listKey . "' selected>" . $listName . "</option>";
                } else {
                    echo "<option value='" . $listKey . "'>" . $listName . "</option>";
                }
            }
        } else {
            echo "<option selected='selected' value=''> -- Select Trello List - </option>";
        }
    } else {
        echo "<option selected='selected' value=''> -- Select Trello List -- </option>";
    }
    echo "</select>";
    echo "</td>";
    if ( wootrello_freemius()->can_use_premium_code() ) {
        echo "<td>";
        # Due Date
        $days = array(
            "1d" => "1 Day",
            "2d" => "2 Day",
            "3d" => "3 Day",
            "5d" => "5 Day",
            "1w" => "1 Week",
            "2w" => "2 Weeks",
            "1m" => "1 Month",
            "3m" => "3 Month",
            "6m" => "6 Month",
        );
        # Due Date Dropdown
        echo "<select name='trello_due_date' style='' id='" . $status_key . "_trello_due_date' class='trello_due_date'>";
        echo "<option value='' selected disabled hidden> -- Due Date -- </option>";
        foreach ( $days as $dayKey => $dayValue ) {
            if ( isset( $saved_settings, $saved_settings['trello_due_date'] ) and $saved_settings['trello_due_date'] == $dayKey ) {
                echo "<option value='" . $dayKey . "' selected>" . $dayValue . "</option>";
            } else {
                echo "<option value='" . $dayKey . "'>" . $dayValue . "</option>";
            }
        }
        echo "</select>";
        echo "</td>";
        echo "<td>";
        # Color Dropdown
        echo "<select name='trello_label_colour' style='' id='wootrello_" . $status_key . "_trello_label_colour' class='trello_label_colour' >";
        if ( isset( $saved_settings['trello_label_colour'] ) and $saved_settings['trello_label_colour'] ) {
            $lists = $this->trelloApi->wootrello_board_labels( $wootrello_trello_API, $saved_settings['trello_board'] );
            # if Request is OK
            if ( $lists[0] == 200 ) {
                echo "<option selected='selected' value=''> -- Color -- </option>";
                foreach ( $lists[1] as $listKey => $listName ) {
                    if ( isset( $saved_settings, $saved_settings['trello_label_colour'] ) and $saved_settings['trello_label_colour'] == $listKey ) {
                        echo "<option value='" . $listKey . "' selected>" . $listName . "</option>";
                    } else {
                        echo "<option value='" . $listKey . "'>" . $listName . "</option>";
                    }
                }
            } else {
                echo "<option selected='selected' value=''> -- Color -- </option>";
            }
        } else {
            echo "<option selected='selected' value=''> -- Color -- </option>";
        }
        echo "</select>";
        echo "</td>";
    }
    echo "</tr>";
    echo "</tbody>";
    echo "</table>";
    echo "<br class='clear'>";
    //=======================================================================
    // filter starts
    echo "<table class='widefat' style='width: 100%; border-collapse: collapse;' >";
    echo "<thead>";
    echo "<tr>";
    echo "<th class='row-title' colspan='4'>";
    // Colspan 4 to include remove button
    echo "<b>Add filters</b>";
    echo "</th>";
    echo "</tr>";
    echo "</thead>";
    echo "<tbody id='" . $status_key . "_filter_tbody'>";
    // 1. Strategy Row (Always Visible)
    echo "<tr class='alternate'>";
    echo "<td colspan='2'>";
    echo "Match Logic (if multiple filters):";
    echo "</td>";
    echo "<td colspan='2'>";
    echo "<select name='filter_strategy' id='" . $status_key . "_filter_strategy' class='filter_strategy' >";
    $f_strat = ( isset( $saved_settings['filter_strategy'] ) ? $saved_settings['filter_strategy'] : 'ALL' );
    echo "<option value='ANY' " . selected( 'ANY', $f_strat, false ) . "> Match ANY condition (OR) </option>";
    echo "<option value='ALL' " . selected( 'ALL', $f_strat, false ) . "> Match ALL conditions (AND) </option>";
    echo "</select>";
    echo "</td>";
    echo "</tr>";
    // 2. Filter Rows Loop
    $current_filters = ( isset( $saved_settings['filters'] ) && !empty( $saved_settings['filters'] ) ? $saved_settings['filters'] : array(array(
        'field'     => '',
        'condition' => '',
        'value'     => '',
    )) );
    foreach ( $current_filters as $filter ) {
        echo "<tr class='wootrello-filter-row'>";
        echo "<td>";
        echo "<select name='filter_field[]' class='filter_field' style='width:100%'>";
        $opts = array(
            'total'            => 'Order Total',
            'billing_email'    => 'Customer Email',
            'product_category' => 'Product Category',
            'product_id'       => 'Product ID',
            'product_name'     => 'Product Name',
            'product_sku'      => 'Product SKU',
            'payment_method'   => 'Payment Method',
            'shipping_country' => 'Shipping Country (Code)',
            'shipping_city'    => 'Shipping City',
            'billing_state'    => 'Billing State/Province',
            'billing_phone'    => 'Customer Phone',
            'shipping_method'  => 'Shipping Method Title',
            'coupon_code'      => 'Coupon Code Used',
            'item_count'       => 'Total Item Quantity',
            'currency'         => 'Order Currency',
            'total_discount'   => 'Total Discount',
        );
        echo "<option value=''> -- Select Field -- </option>";
        foreach ( $opts as $val => $label ) {
            echo "<option value='" . $val . "' " . selected( $val, $filter['field'], false ) . "> " . $label . " </option>";
        }
        echo "</select>";
        echo "</td>";
        echo "<td>";
        echo "<select name='filter_condition[]' class='filter_condition' style='width:100%'>";
        $conds = array(
            'equals'             => 'Equals (==)',
            'not_equals'         => 'Not Equals (!=)',
            'contains'           => 'Contains',
            'not_contains'       => 'Does Not Contain',
            'greater_than'       => 'Greater Than (>)',
            'less_than'          => 'Less Than (<)',
            'greater_than_equal' => 'Greater Than or Equal (>=)',
            'less_than_equal'    => 'Less Than or Equal (<=)',
        );
        foreach ( $conds as $val => $label ) {
            echo "<option value='" . $val . "' " . selected( $val, $filter['condition'], false ) . "> " . $label . " </option>";
        }
        echo "</select>";
        echo "</td>";
        echo "<td>";
        echo "<input type='text' name='filter_value[]' class='filter_value' placeholder='Value' value='" . esc_attr( $filter['value'] ) . "' style='width:100%' />";
        echo "</td>";
        // REMOVE BUTTON
        echo "<td style='width: 30px; text-align: center; vertical-align: middle;'>";
        echo "<span class='dashicons dashicons-trash' style='color: #a00; cursor: pointer;' onclick=\"wootrello_remove_filter_row(this)\"></span>";
        echo "</td>";
        echo "</tr>";
    }
    echo "</tbody>";
    echo "<tfoot>";
    echo "<tr class='alternate'>";
    echo "<td colspan='4' style='text-align:center;'>";
    echo "<button type='button' class='button' onclick=\"wootrello_add_filter_row('" . $status_key . "_filter_tbody')\"> + Add another condition </button>";
    echo "</td>";
    echo "</tr>";
    echo "</tfoot>";
    echo "</table>";
    // filter ends
    //=======================================================================
    echo "<br class='clear'>";
    # Another Table Starts
    echo "<table class='widefat'>";
    echo "<tbody>";
    echo "<tr class=''>";
    echo "<td class='row-title'><label for='tablecell'> Title of the card </label></td>";
    echo "<td>";
    //
    echo "<fieldset>";
    echo "<legend class='screen-reader-text'> <span> Order ID </span> </legend>";
    echo "<label for='order_id_in_title'>";
    if ( isset( $saved_card['order_id_in_title'] ) and $saved_card['order_id_in_title'] ) {
        echo "<input type='checkbox' name='order_id_in_title'  id='" . $status_key . "_order_id_in_title' checked value='1' />";
    } else {
        echo "<input type='checkbox' name='order_id_in_title'  id='" . $status_key . "_order_id_in_title' value='1' />";
    }
    echo "<span> Order ID </span>";
    echo "</label>";
    echo "</fieldset>";
    //
    echo "<fieldset>";
    echo "<legend class='screen-reader-text'> <span> Date </span> </legend>";
    echo "<label for='users_can_register'>";
    if ( isset( $saved_card['date'] ) and $saved_card['date'] ) {
        echo "<span><input type='checkbox' name='date'  id='" . $status_key . "_date' checked value='1' /> <span> Date </span>";
    } else {
        echo "<span><input type='checkbox' name='date'  id='" . $status_key . "_date' value='1' /> <span> Date </span>";
    }
    // date formate
    if ( isset( $saved_card['date_formate'] ) and $saved_card['date_formate'] == 'uk' ) {
        echo "& Formate :  \n                                                        <label for='html'>31/01/2025</label> <input type='radio' name='date_formate' value='uk' checked>\n                                                        <label for='html'>2025/01/31</label> <input type='radio' name='date_formate' value='us'> \n                                                        <label for='html'>01 January 2025</label> <input type='radio' name='date_formate' value='uk_alphabet'  >";
    } elseif ( isset( $saved_card['date_formate'] ) and $saved_card['date_formate'] == 'us' ) {
        echo "& Formate :  \n                                                        <label for='html'>31/01/2025</label> <input type='radio' name='date_formate' value='uk'>\n                                                        <label for='html'>2025/01/31</label> <input type='radio' name='date_formate' value='us' checked > \n                                                        <label for='html'>01 January 2025</label> <input type='radio' name='date_formate' value='uk_alphabet'>";
    } elseif ( isset( $saved_card['date_formate'] ) and $saved_card['date_formate'] == 'uk_alphabet' ) {
        echo "& Formate : \n                                                        <label for='html'>31/01/2025</label> <input type='radio' name='date_formate' value='uk'>  \n                                                        <label for='html'>2025/01/31</label> <input type='radio' name='date_formate' value='us'> \n                                                        <label for='html'>01 January 2025</label> <input type='radio' name='date_formate' value='uk_alphabet'  checked>";
    } else {
        echo "& Formate : \n                                                        <label for='html'>31/01/2025</label> <input type='radio' name='date_formate' value='uk'>\n                                                        <label for='html'>2025/01/31</label> <input type='radio' name='date_formate' value='us' checked> \n                                                        <label for='html'>01 January 2025</label> <input type='radio' name='date_formate' value='uk_alphabet'>";
    }
    echo "</label>";
    echo "</fieldset>";
    if ( wootrello_freemius()->can_use_premium_code() ) {
        echo "<fieldset>";
        echo "<legend class='screen-reader-text'> <span> Customer name </span> </legend>";
        echo "<label for='users_can_register'>";
        if ( isset( $saved_card['customer_name_in_title'] ) and $saved_card['customer_name_in_title'] ) {
            echo "<input type='checkbox' name='customer_name_in_title'  id='" . $status_key . "_customer_name_in_title' checked value='1' />";
        } else {
            echo "<input type='checkbox' name='customer_name_in_title'  id='" . $status_key . "_customer_name_in_title' value='1' />";
        }
        echo "<span> Customer name </span>";
        echo "</label>";
        echo "</fieldset>";
        echo "<fieldset>";
        echo "<legend class='screen-reader-text'> <span> Order total </span> </legend>";
        echo "<label for='users_can_register'>";
        if ( isset( $saved_card['order_total_in_title'] ) and $saved_card['order_total_in_title'] ) {
            echo "<input type='checkbox' name='order_total_in_title'  id='" . $status_key . "_order_total_in_title' checked value='1' />";
        } else {
            echo "<input type='checkbox' name='order_total_in_title'  id='" . $status_key . "_order_total_in_title' value='1' />";
        }
        echo "<span> Order total </span>";
        echo "</label>";
        echo "</fieldset>";
        echo "</td>";
        echo "</tr>";
        # new code is here.
        if ( wootrello_freemius()->can_use_premium_code() ) {
            ?>
                                            <tr class='alternate'>
                                                <td>
                                                    <b style='vertical-align: middle;'> Order Custom Fields (Title) </b> 
                                                    <p class="description">Includes both standard Meta and HPOS fields.</p>
                                                </td>
                                                <td>
                                                    <?php 
            $unified_keys = $this->helpers->wootrello_get_unified_meta_keys();
            if ( $unified_keys[0] && !empty( $unified_keys[1] ) ) {
                echo "<select multiple name='orderTitleMeta[]' class='metaDropDown'  id='" . $status_key . "_order_title_meta' style='width: 100%;'>";
                foreach ( $unified_keys[1] as $meta_key ) {
                    // Check if saved in new 'orderTitleMeta' OR old 'orderTitlePostMeta'
                    $is_selected = isset( $saved_card['orderTitleMeta'][$meta_key] ) || isset( $saved_card['orderTitlePostMeta'][$meta_key] );
                    echo "<option value='" . esc_attr( $meta_key ) . "' " . selected( $is_selected, true, false ) . ">" . esc_html( $meta_key ) . "</option>";
                }
                echo "</select>";
                // Position Selector
                echo "<select name='order_meta_position' style=''>";
                $curr_pos = ( isset( $saved_card['order_meta_position'] ) ? $saved_card['order_meta_position'] : '' );
                echo "<option value='' " . selected( $curr_pos, '', false ) . ">Position: After Order ID</option>";
                echo "<option value='order_meta_before_default_fields' " . selected( $curr_pos, 'order_meta_before_default_fields', false ) . ">Position: Before Order ID</option>";
                echo "</select>";
            } else {
                echo "No custom fields found.";
            }
            ?>
                                                </td>
                                            </tr>
                                            <?php 
        }
    }
    echo "<tr>";
    echo "<td class='row-title'><label for='tablecell'> Description of the card </label></td>";
    echo "<td>";
    if ( wootrello_freemius()->can_use_premium_code() ) {
        echo "<fieldset>";
        echo "<legend class='screen-reader-text'> <span> Order URL </span> </legend>";
        echo "<label for='users_can_register'>";
        if ( isset( $saved_card['order_url'] ) and $saved_card['order_url'] ) {
            echo "<input type='checkbox' name='order_url'  id='" . $status_key . "_order_url' checked value='1' />";
        } else {
            echo "<input type='checkbox' name='order_url'  id='" . $status_key . "_order_url' value='1' />";
        }
        echo "<span> Order URL </span>";
        echo "</label>";
        echo "</fieldset>";
    }
    echo "<fieldset>";
    echo "<legend class='screen-reader-text'> <span> Customer name </span> </legend>";
    echo "<label for='users_can_register'>";
    if ( isset( $saved_card['customer_name'] ) and $saved_card['customer_name'] ) {
        echo "<input type='checkbox' name='customer_name'  id='" . $status_key . "_customer_name' checked value='1' />";
    } else {
        echo "<input type='checkbox' name='customer_name'  id='" . $status_key . "_customer_name' value='1' />";
    }
    echo "<span> Customer name </span>";
    echo "</label>";
    echo "</fieldset>";
    if ( wootrello_freemius()->can_use_premium_code() ) {
        echo "<fieldset>";
        echo "<legend class='screen-reader-text'> <span> customer note  </span> </legend>";
        echo "<label for='users_can_register'>";
        if ( isset( $saved_card['customer_note'] ) and $saved_card['customer_note'] ) {
            echo "<input type='checkbox' name='customer_note'  id='" . $status_key . "_customer_note' checked value='1' />";
        } else {
            echo "<input type='checkbox' name='customer_note'  id='" . $status_key . "_customer_note' value='1' />";
        }
        echo "<span> Customer note </span>";
        echo "</label>";
        echo "</fieldset>";
        echo "<fieldset>";
        echo "<legend class='screen-reader-text'> <span> Billing Email  </span> </legend>";
        echo "<label for='users_can_register'>";
        if ( isset( $saved_card['billing_email'] ) and $saved_card['billing_email'] ) {
            echo "<input type='checkbox' name='billing_email'  id='" . $status_key . "_billing_email' checked value='1' />";
        } else {
            echo "<input type='checkbox' name='billing_email'  id='" . $status_key . "_billing_email' value='1' />";
        }
        echo "<span> Billing Email </span>";
        echo "</label>";
        echo "</fieldset>";
        echo "<fieldset>";
        echo "<legend class='screen-reader-text'> <span> Billing Phone  </span> </legend>";
        echo "<label for='users_can_register'>";
        if ( isset( $saved_card['billing_phone'] ) and $saved_card['billing_phone'] ) {
            echo "<input type='checkbox' name='billing_phone'  id='" . $status_key . "_billing_phone' checked value='1' />";
        } else {
            echo "<input type='checkbox' name='billing_phone'  id='" . $status_key . "_billing_phone' value='1' />";
        }
        echo "<span> Billing Phone </span>";
        echo "</label>";
        echo "</fieldset>";
    }
    echo "<fieldset>";
    echo "<legend class='screen-reader-text'> <span> Billing Address  </span> </legend>";
    echo "<label for='users_can_register'>";
    if ( isset( $saved_card['billing_address'] ) and $saved_card['billing_address'] ) {
        echo "<input type='checkbox' name='billing_address'  id='" . $status_key . "_billing_address' checked value='1' />";
    } else {
        echo "<input type='checkbox' name='billing_address'  id='" . $status_key . "_billing_address' value='1' />";
    }
    echo "<span> Billing Address </span>";
    echo "</label>";
    echo "</fieldset>";
    echo "<fieldset>";
    echo "<legend class='screen-reader-text'> <span> Shipping Address  </span> </legend>";
    echo "<label for='users_can_register'>";
    if ( isset( $saved_card['shipping_address'] ) and $saved_card['shipping_address'] ) {
        echo "<input type='checkbox' name='shipping_address'  id='" . $status_key . "_shipping_address' checked value='1' />";
    } else {
        echo "<input type='checkbox' name='shipping_address'  id='" . $status_key . "_shipping_address' value='1' />";
    }
    echo "<span> Shipping Address </span>";
    echo "</label>";
    echo "</fieldset>";
    if ( wootrello_freemius()->can_use_premium_code() ) {
        echo "<fieldset>";
        echo "<legend class='screen-reader-text'> <span> Shipping Method  </span> </legend>";
        echo "<label for='users_can_register'>";
        if ( isset( $saved_card['shipping_method'] ) and $saved_card['shipping_method'] ) {
            echo "<input type='checkbox' name='shipping_method'  id='" . $status_key . "_shipping_method' checked value='1' />";
        } else {
            echo "<input type='checkbox' name='shipping_method'  id='" . $status_key . "_shipping_method' value='1' />";
        }
        echo "<span> Shipping Method </span>";
        echo "</label>";
        echo "</fieldset>";
        echo "<fieldset>";
        echo "<legend class='screen-reader-text'> <span> Discount total  </span> </legend>";
        echo "<label for='users_can_register'>";
        if ( isset( $saved_card['discount_total'] ) and $saved_card['discount_total'] ) {
            echo "<input type='checkbox' name='discount_total'  id='" . $status_key . "_discount_total' checked value='1' />";
        } else {
            echo "<input type='checkbox' name='discount_total'  id='" . $status_key . "_discount_total' value='1' />";
        }
        echo "<span> Discount total  </span>";
        echo "</label>";
        echo "</fieldset>";
        echo "<fieldset>";
        echo "<legend class='screen-reader-text'> <span> Cart Items Weight  </span> </legend>";
        echo "<label for='cart_items_weight'>";
        if ( isset( $saved_card['cart_items_weight'] ) and $saved_card['cart_items_weight'] ) {
            echo "<input type='checkbox' name='cart_items_weight'  id='" . $status_key . "_cart_items_weight' checked value='1' />";
        } else {
            echo "<input type='checkbox' name='cart_items_weight'  id='" . $status_key . "_cart_items_weight' value='1' />";
        }
        echo "<span> Cart Items Weight  </span>";
        echo "</label>";
        echo "</fieldset>";
    }
    echo "<fieldset>";
    echo "<legend class='screen-reader-text'> <span> Product categories </span> </legend>";
    echo "<label for='product_categories'>";
    if ( isset( $saved_card['product_categories'] ) and $saved_card['product_categories'] ) {
        echo "<input type='checkbox' name='product_categories'  id='" . $status_key . "_product_categories' checked value='1' />";
    } else {
        echo "<input type='checkbox' name='product_categories'  id='" . $status_key . "_product_categories' value='1' />";
    }
    echo "<span> Product categories  </span>";
    echo "</label>";
    echo "</fieldset>";
    echo "<fieldset>";
    echo "<legend class='screen-reader-text'> <span> Payment method </span> </legend>";
    echo "<label for='users_can_register'>";
    if ( isset( $saved_card['payment_method'] ) and $saved_card['payment_method'] ) {
        echo "<input type='checkbox' name='payment_method'  id='" . $status_key . "_payment_method' checked value='1' />";
    } else {
        echo "<input type='checkbox' name='payment_method'  id='" . $status_key . "_payment_method' value='1' />";
    }
    echo "<span> Payment method  </span>";
    echo "</label>";
    echo "</fieldset>";
    echo "<fieldset>";
    echo "<legend class='screen-reader-text'> <span> Order total </span> </legend>";
    echo "<label for='users_can_register'>";
    if ( isset( $saved_card['order_total'] ) and $saved_card['order_total'] ) {
        echo "<input type='checkbox' name='order_total'  id='" . $status_key . "_order_total' checked value='1' />";
    } else {
        echo "<input type='checkbox' name='order_total'  id='" . $status_key . "_order_total' value='1' />";
    }
    echo "<span>  Order total </span>";
    echo "</label>";
    echo "</fieldset>";
    if ( wootrello_freemius()->can_use_premium_code() ) {
        echo "<fieldset>";
        echo "<legend class='screen-reader-text'> <span> Previous orders </span> </legend>";
        echo "<label for='users_can_register'>";
        if ( isset( $saved_card['previous_orders'] ) and $saved_card['previous_orders'] ) {
            echo "<input type='checkbox' name='previous_orders'  id='" . $status_key . "_previous_orders' checked value='1' />";
        } else {
            echo "<input type='checkbox' name='previous_orders'  id='" . $status_key . "_previous_orders' value='1' />";
        }
        echo "<span> Previous orders </span>";
        echo "</label>";
        echo "</fieldset>";
    }
    echo "</td>";
    echo "</tr>";
    echo "<tr class='alternate'>";
    echo "<td class='row-title'> Product check list </td>";
    echo "<td>";
    echo "<fieldset>";
    echo "<legend class='screen-reader-text'> <span>  Serial Number  </span> </legend>";
    echo "<label for='users_can_register'>";
    if ( isset( $saved_card['product_serial_number'] ) and $saved_card['product_serial_number'] ) {
        echo "<input type='checkbox' name='serial_number'  id='" . $status_key . "_serial_number' checked value='1' />";
    } else {
        echo "<input type='checkbox' name='serial_number'  id='" . $status_key . "_serial_number' value='1' />";
    }
    echo "<span>  Serial Number  </span>";
    echo "</label>";
    echo "</fieldset>";
    echo "<fieldset>";
    echo "<legend class='screen-reader-text'> <span>  Product ID </span> </legend>";
    echo "<label for='users_can_register'>";
    if ( isset( $saved_card['product_id'] ) and $saved_card['product_id'] ) {
        echo "<input type='checkbox' name='product_id'  id='" . $status_key . "_display_product_id' checked value='1' />";
    } else {
        echo "<input type='checkbox' name='product_id'  id='" . $status_key . "_display_product_id' value='1' />";
    }
    echo "<span>  Product ID </span>";
    echo "</label>";
    echo "</fieldset>";
    echo "<fieldset>";
    echo "<legend class='screen-reader-text'> <span>  Product Qty </span> </legend>";
    echo "<label for='product_qty'>";
    if ( isset( $saved_card['product_qty'] ) and $saved_card['product_qty'] ) {
        echo "<input type='checkbox' name='product_qty'  id='" . $status_key . "_product_qty' checked value='1' />";
    } else {
        echo "<input type='checkbox' name='product_qty'  id='" . $status_key . "_product_qty' value='1' />";
    }
    echo "<span>  Product Qty </span>";
    echo "</label>";
    echo "</fieldset>";
    if ( wootrello_freemius()->can_use_premium_code() ) {
        echo "<fieldset>";
        echo "<legend class='screen-reader-text'> <span>  Product Weight </span> </legend>";
        echo "<label for='product_qty_price'>";
        if ( isset( $saved_card['product_weight'] ) and $saved_card['product_weight'] ) {
            echo "<input type='checkbox' name='product_weight'  id='" . $status_key . "_product_weight' checked value='1' />";
        } else {
            echo "<input type='checkbox' name='product_weight'  id='" . $status_key . "_product_weight' value='1' />";
        }
        echo "<span>  Product Weight </span>";
        echo "</label>";
        echo "</fieldset>";
        echo "<fieldset>";
        echo "<legend class='screen-reader-text'> <span>  Product Qty * Price </span> </legend>";
        echo "<label for='product_qty_price'>";
        if ( isset( $saved_card['product_qty_price'] ) and $saved_card['product_qty_price'] ) {
            echo "<input type='checkbox' name='product_qty_price'  id='" . $status_key . "_product_qty_price' checked value='1' />";
        } else {
            echo "<input type='checkbox' name='product_qty_price'  id='" . $status_key . "_product_qty_price' value='1' />";
        }
        echo "<span>  Product Qty * Price </span>";
        echo "</label>";
        echo "</fieldset>";
        echo "<fieldset>";
        echo "<legend class='screen-reader-text'> <span>  Product SKU </span> </legend>";
        echo "<label for='product_sku'>";
        if ( isset( $saved_card['product_sku'] ) and $saved_card['product_sku'] ) {
            echo "<input type='checkbox' name='product_sku'  id='" . $status_key . "_display_product_sku' checked value='1' />";
        } else {
            echo "<input type='checkbox' name='product_sku'  id='" . $status_key . "_display_product_sku' value='1' />";
        }
        echo "<span>  Product SKU </span>";
        echo "</label>";
        echo "</fieldset>";
    }
    echo "</td>";
    echo "</tr>";
    if ( wootrello_freemius()->can_use_premium_code() ) {
        ?>
                                            <tr>
                                                <td>
                                                    <b style='vertical-align: middle;'> Order Custom Fields (Card Body) </b> 
                                                    <p class='description'>Includes both standard Meta and HPOS fields.</p>
                                                </td>
                                                <td>
                                                    <?php 
        $unified_data = $this->helpers->wootrello_get_unified_meta_keys();
        if ( $unified_data[0] && !empty( $unified_data[1] ) ) {
            // Updated name: orderBodyMeta[]
            echo "<select multiple name='orderBodyMeta[]' class='metaDropDown' id='" . $status_key . "_order_body_meta' style='width: 100%;'>";
            foreach ( $unified_data[1] as $meta_key ) {
                // Check New Name, then fall back to BOTH old names for compatibility
                $is_selected = isset( $saved_card['orderBodyMeta'][$meta_key] ) || isset( $saved_card['orderMetaKeys'][$meta_key] ) || isset( $saved_card['orderPostMetaKeys'][$meta_key] );
                echo "<option value='" . esc_attr( $meta_key ) . "' " . selected( $is_selected, true, false ) . ">" . esc_html( $meta_key ) . "</option>";
            }
            echo "</select>";
        }
        ?>
                                                </td>
                                            </tr>
                                            <?php 
        # 3rd party Starts Here
        if ( $woo_checkout_field_editor_fields[0] ) {
            echo "<tr class='alternate'>";
            echo "<td class='row-title'>";
            echo "<label for='tablecell'> Third party plugin : #1 </label>";
            echo " <br> <a href='https://wordpress.org/plugins/woo-checkout-field-editor-pro/' style='font-size: .75em;' target='_blank' > Checkout Field Editor ( Checkout Manager ) for WooCommerce </a> ";
            echo "</td>";
            echo "<td>";
            echo "<fieldset>";
            echo "<legend class='screen-reader-text'> <span> Third party plugin : #1 </span> </legend>";
            echo "<label for='product_qty_price'>";
            if ( isset( $saved_card['checkout_field_editor'] ) and $saved_card['checkout_field_editor'] ) {
                echo "<input type='checkbox' name='checkout_field_editor'  id='" . $status_key . "_checkout_field_editor' checked value='1' />";
            } else {
                echo "<input type='checkbox' name='checkout_field_editor'  id='" . $status_key . "_checkout_field_editor' value='1' />";
            }
            echo "<span> Send below third party plugin fields data  </span>";
            foreach ( $woo_checkout_field_editor_fields[1] as $key => $value ) {
                echo "<br> - " . $value['label'];
            }
            echo "</label>";
            echo "</fieldset>";
            echo "</td>";
            echo "</tr>";
        }
    }
    //  Fields Ends Here
    echo "</tbody>";
    echo "</table>";
    echo "<br class='clear'>";
    # Form Submit button;
    echo "<input class='button-secondary'  type='submit' id='" . $status_key . "_save_settings' name='save_settings' value='Save " . $status_value . " settings'  />";
    echo "</div>";
    // <!-- .inside -->
    echo "</div>";
    // <!-- .postbox -->
    echo "</div>";
    # প্যানেল  এন্ড্স
    echo "</form>";
}
?>
			</div>
			<!-- post-body-content -->

			<!-- sidebar -->
			<div id="postbox-container-1" class="postbox-container">

				<div class="meta-box-sortables">

					<div class="postbox">

						<!-- <button type="button" class="handlediv" aria-expanded="true" >
							<span class="screen-reader-text">Toggle panel</span>
							<span class="toggle-indicator" aria-hidden="true"></span> 
                        </button> -->
                        
						<!-- Toggle -->
						<h2 class="hndle"><span><?php 
esc_attr_e( 'Trello access code', 'WpAdminStyle' );
?></span></h2>

						<div class="inside">
							<p>
                                <form name='trello_api_form' method='POST' action=''>
								<?php 
# Nonce fields
wp_nonce_field( 'wootrello_settings_api_nonce_value', 'wootrello_api_nonce' );
#
if ( isset( $wootrello_trello_API ) and !empty( $wootrello_trello_API ) ) {
    echo " <input type='text' name='trello_api' id='trello_api'  value='" . $wootrello_trello_API . "' style='width: 100%; height: 3em;' />";
    echo "<br class='clear' />";
    echo "<br class='clear' />";
    echo "<input class='button-secondary'  type='submit' id='save_settings' name='save_settings' value='save'  />";
    echo " &#32; &#32; <span title='to remove the Trello access code, empty the input field then save the empty field.' class='dashicons dashicons-editor-help'></span>";
} else {
    echo "<a href='https://trello.com/1/authorize?expiration=never&name=Wootrello&scope=read%2Cwrite&response_type=token&key=7385fea630899510fd036b6e89b90c60'  style='margin-left:150px; text-decoration: none; ' target='_blank'>Trello access code</a>";
    echo " <input type='text' name='trello_api' id='trello_api' placeholder='Pest trello access code here.'  value='' style='width: 100%; height: 3em;' />";
    echo "<br class='clear' />";
    echo "<br class='clear' />";
    echo "<input class='button-secondary'  type='submit' id='save_settings' name='save_settings' value='save access code'  />";
}
?>
                                </form>
                            </p>
						</div>
						<!-- .inside -->

					</div>
					<!-- .postbox -->

				</div>
				<!-- .meta-box-sortables -->

                <div class="meta-box-sortables">

					<div class="postbox">
						<div class="inside">
							<p> <?php 
echo "<b>Active Connection : <code> " . $total_connection . " </code>  </b>";
?> </p>
                            <p> 
                                Add order product list to card body  
                                <!-- // you can use this feature to add product list to card description area.
                                // there will be a check box if you want to add product list to card description area. check it and save settings. -->
                                <?php 
$checked = get_option( 'wootrello_include_products_in_card' );
$url = admin_url( 'admin.php?page=wootrello&action=wootrello_toggle_products_in_card' );
?>

                                <input type="checkbox" name="wootrello_include_products_in_card"  id="wootrello_include_products_in_card"  value="1"
                                    <?php 
checked( $checked, 1 );
?> onclick="window.location.href='<?php 
echo esc_url( $url );
?>';">
                            </p>
                            <?php 
if ( $total_connection ) {
    echo "<code> <a href=" . admin_url( 'admin.php?page=wootrello&action=removeInt' ) . " style='opacity: 0.5; color: red;'> Remove all integrations </a> </code>";
}
?>
						</div>
						<!-- .inside -->
					</div>
					<!-- .postbox -->
				</div>
				<!-- .meta-box-sortables -->

                <div class="meta-box-sortables">
                    <!-- .postbox -->
					<div class="postbox">
						<!-- <button type="button" class="handlediv" aria-expanded="true" >
							<span class="screen-reader-text">Toggle panel</span>
							<span class="toggle-indicator" aria-hidden="true"></span>
                        </button> -->
                        
						<!-- Toggle -->
						<h2 class="hndle"><span><?php 
esc_attr_e( 'Hello, Howdy', 'WpAdminStyle' );
?></span> <span class="dashicons dashicons-smiley"></span></h2>

						<div class="inside">
							<p>
                                <i>
                                    This Plugin has <b> 17 </b> files and  <b>3,145‬</b> lines of code, Trello changed its API in many ways, so I follow with the new API.
                                    Development, Testing, and Debugging takes a lot of time & patience. 
                                    I hope you will appreciate my effort. 
                                    
                                    <!-- For Paid User  -->
                                    <?php 
?>
                                        
                                    <!-- for Free and Trial  user  -->
                                    <?php 
if ( wootrello_freemius()->is_trial() or wootrello_freemius()->is_not_paying() ) {
    ?>
                                        If possible Please purchase the <?php 
    echo '<a style="text-decoration: none;" href="' . wootrello_freemius()->get_upgrade_url() . '">' . __( ' Professional copy', 'my-text-domain' ) . '</a>';
    ?>, 
                                        if not please leave a <a style='text-decoration: none;' href='https://wordpress.org/support/plugin/wootrello/reviews/?filter=5'> 5-star review </a>, It will inspire me to add more awesome feature . 
                                            
                                        <br> 
                                        <br> 
                                        Thank you & best regards.
                                        <br>
                                        <br>
                                        <b>P.S :</b> <a style="text-decoration: none;" href=" <?php 
    echo admin_url( 'admin.php?page=wootrello-contact' );
    ?> "> let me know your questions & thoughts.</a> 
                                    <?php 
}
?>
                                </i>
                            </p>
						</div>
						<!-- .inside -->
					</div>
                    <!-- .postbox -->
                    
                    <!-- .postbox -->
					<div class="postbox">
						<div class="inside">
							<p>
                                <i>
                                I would like to express my sincere gratitude to <b> Mr. Alexis. </b> Without his support, the release of version 3.3.1 would not have been possible. Your belief in this project means a lot. <i> Muchas gracias! </i>
                                </i>
                            </p>
						</div>
						<!-- .inside -->
					</div>
					<!-- .postbox -->

				</div>
				<!-- .meta-box-sortables -->

                <!-- Basic Version error note -->
                <?php 
if ( wootrello_freemius()->is_trial() or wootrello_freemius()->is_not_paying() ) {
    ?>
                    <span> 
                        <i> Wootrello use <a style='text-decoration: none;' href='https://github.com/woocommerce/woocommerce/blob/master/templates/checkout/thankyou.php'> woocommerce_thankyou </a> Hook for Checkout Page order so it will  <b>  not </b> work 
                        without any thank you page. please make sure you have a thank you page. 
                        </i> 
                    </span> 
                    <br>
                    <br>
                <?php 
}
?>

                <span style='float:right; padding-right:25px;'> <a href="<?php 
echo admin_url( 'admin.php?page=wootrello&action=log' );
?>" style='text-decoration: none;font-style: italic;'> log for good ! log page.  </a> </span>
                <!-- Log Code Ends -->

			</div>
			<!-- #postbox-container-1 .postbox-container -->
		</div>
		<!-- #post-body .metabox-holder .columns-2 -->

		<br class="clear">
	</div>
</div> <!-- .wrap -->

<!-- new code starts -->
<script type="text/javascript">
    function wootrello_add_filter_row(tbodyId) {
        var tbody = document.getElementById(tbodyId);
        var rows = tbody.getElementsByClassName('wootrello-filter-row');
        
        if(rows.length > 0) {
            // Clone the last row
            var newRow = rows[rows.length - 1].cloneNode(true);
            
            // Clear inputs in the new row
            var inputs = newRow.querySelectorAll('input');
            for (var i = 0; i < inputs.length; i++) {
                inputs[i].value = '';
            }
            
            // Append
            tbody.appendChild(newRow);
        }
    }

    function wootrello_remove_filter_row(btn) {
        // Find the row
        var row = btn.closest('tr');
        var tbody = row.parentNode;
        var rows = tbody.getElementsByClassName('wootrello-filter-row');
        row.remove();
    }
</script>
<!-- new code ends -->

<!-- Link for help  -->
<!-- https://wordpress.stackexchange.com/questions/58834/echo-all-meta-keys-of-a-custom-post-type  -->
<!-- https://codepen.io/rajatsansar/pen/NZJMoW -->
<!-- https://www.cssscript.com/multiselect-dropdown-list-checkboxes-multiselect-js/ -->
