<?php
    //@ini_set('display_errors','On'); ini_set('display_startup_errors', 1); error_reporting(E_ALL);
    global $wpdb;
    if (function_exists( 'mysqli_connect' ) && $wpdb->use_mysqli) {
    } else if (function_exists( 'mysqli_connect' ) && !$wpdb->use_mysqli) {
        ?><div class="nomysqli" style="color:#721c24;background-color:#f8d7da;"><p><strong><?php
            _e("Bad news. Mysqli is NOT used in your WordPress. So this dragon ecommerce plugin can NOT be used for your website.");        
        ?></strong></p></div><?php
        exit;
    } else if (!function_exists( 'mysqli_connect' ) && !$wpdb->use_mysqli) {
        ?><div class="nomysqli" style="color:#721c24;background-color:#f8d7da;"><p><strong><?php
            _e("Bad news. Mysqli does NOT exist in your WordPress. So this dragon ecommerce plugin can NOT be used for your website.");        
        ?></strong></p></div><?php
        exit;
    }
    global $dragon_ecommerce_dbResult;
    global $user_ID;
    $dragon_ecommerce_dbResult = null;
    $timezone='';
    $current_user = wp_get_current_user();
        
    if($user_ID && in_array( 'administrator', (array) $current_user->roles ) && (!empty($_POST['dragonecommercereservezyx987_hidden'])) && $_POST['dragonecommercereservezyx987_hidden'] === 'Y') {
        $dragon_ecommerce_dbResult = '';
        
        if($_POST['Submit'] === 'Create Country') {
            dragonecommercereservezyx987_addCountry();
        }elseif($_POST['Submit'] === 'Create Province or State') {
            dragonecommercereservezyx987_addProvince();
        } elseif($_POST['Submit'] === 'Create City') {
            dragonecommercereservezyx987_addCity();
        } elseif($_POST['Submit'] === 'Create Department') {
            dragonecommercereservezyx987_addDepartment();
        } elseif($_POST['Submit'] === 'Create Group Category') {
            dragonecommercereservezyx987_addGroupcategory();
        } elseif($_POST['Submit'] === 'Create Group') {
            dragonecommercereservezyx987_addGroup();
        } elseif($_POST['Submit'] === 'Create Currency') {
            dragonecommercereservezyx987_addCurrency();
        } elseif($_POST['Submit'] === 'Create Slide') {
            dragonecommercereservezyx987_addSlide();
        } elseif($_POST['Submit'] === 'Create Product') {
            dragonecommercereservezyx987_addProduct();
        } elseif($_POST['Submit'] === 'Update Product') {
            dragonecommercereservezyx987_editProduct();
        } elseif($_POST['Submit'] === 'Create Process Status') {
            dragonecommercereservezyx987_addProcessStatus();
        } elseif($_POST['Submit'] === 'Create Update Email Method') {
            dragonecommercereservezyx987_addupdateSettingEmailMethod();
        } elseif($_POST['Submit'] === 'Create Product Default Location') {
            dragonecommercereservezyx987_addSettingProductDefaultLocation();
        } elseif($_POST['Submit'] === 'Update Product Default Location') {
            dragonecommercereservezyx987_editSettingProductDefaultLocation();
        } elseif($_POST['Submit'] === 'Create Product Default Timezone') {
            dragonecommercereservezyx987_addSettingProductDefaultTimezone();
        } elseif($_POST['Submit'] === 'Update Product Default Timezone') {
            dragonecommercereservezyx987_editSettingProductDefaultTimezone();
        } elseif($_POST['Submit'] === 'Edit SHIPPINGFEE_CHARGE_BY_TIMELENGTH') {
            dragonecommercereservezyx987_editSettingShippingfeechargebytimelength();
        } elseif($_POST['Submit'] === 'Edit SHIPPINGFEE_CHARGE_BY_DISTANCE') {
            dragonecommercereservezyx987_editSettingShippingfeechargebydistance();
        } elseif($_POST['Submit'] === 'Drop address table') {
            dragonecommercereservezyx987_dropAddressTable();
        } elseif($_POST['Submit'] === 'Drop chargetype table') {
            dragonecommercereservezyx987_dropChargetypeTable();
        } elseif($_POST['Submit'] === 'Drop country table') {
            dragonecommercereservezyx987_dropCountryTable();
        } elseif($_POST['Submit'] === 'Drop province table and related tables (country/province/city/distance bridge table)') {
            dragonecommercereservezyx987_dropProvinceAndRelatedTables();
        } elseif($_POST['Submit'] === 'Drop city and country/province/city/distance table') {
            dragonecommercereservezyx987_dropCityAndRelatedTable();
        } elseif($_POST['Submit'] === 'Drop department table') {
            dragonecommercereservezyx987_dropDepartmentTable();
        } elseif($_POST['Submit'] === 'Drop groupcategory table') {
            dragonecommercereservezyx987_dropGroupcategoryTable();
        } elseif($_POST['Submit'] === 'Drop group table and related tables (group/property, order/group, product/group bridge table)') {
            dragonecommercereservezyx987_dropGroupAndRelatedTables();
        } elseif($_POST['Submit'] === 'Drop processstatus table') {
            dragonecommercereservezyx987_dropProcessstatusTable();
        } elseif($_POST['Submit'] === 'Drop setting table') {
            dragonecommercereservezyx987_dropSettingTable();
        } elseif($_POST['Submit'] === 'Drop currency table') {
            dragonecommercereservezyx987_dropCurrencyTable();
        } elseif($_POST['Submit'] === 'Drop currencyexchangerate table') {
            dragonecommercereservezyx987_dropCurrencyexchangerateTable();
        } elseif($_POST['Submit'] === 'Drop user status and user token tables') {
            dragonecommercereservezyx987_dropUserStatusAndUserTokenTable();
        } elseif($_POST['Submit'] === 'Drop product table and related tables (product/group, product/order, product/propertyvalue, product/propertyvalue/store, product/quantity alert, product/store bridge table)') {
            dragonecommercereservezyx987_dropProductAndRelatedTables();
        } elseif($_POST['Submit'] === 'Drop order table and related tables (order/group, order/propertyvalue, product/order bridge table)') {
            dragonecommercereservezyx987_dropOrderAndRelatedTables();
        } elseif($_POST['Submit'] === 'Drop log table') {
            dragonecommercereservezyx987_dropLogTable();
        } elseif($_POST['Submit'] === 'Drop log table and create a new log table') {
            dragonecommercereservezyx987_dropLogCreateNewLogTable();
        } elseif($_POST['Submit'] === 'Export log table to Excel file') {
            //dragonecommercereservezyx987_exportLogTable();exit;
        } elseif($_POST['Submit'] === 'Drop discount table') {
            dragonecommercereservezyx987_dropDiscountTable();
        } elseif($_POST['Submit'] === 'Drop slideshow table') {
            dragonecommercereservezyx987_dropSlideshowTable();
        } elseif($_POST['Submit'] === 'Drop store table') {
            dragonecommercereservezyx987_dropStoreTable();
        }  elseif($_POST['Submit'] === 'Drop property table') {
            dragonecommercereservezyx987_dropPropertyTable();
        } elseif($_POST['Submit'] === 'Drop property value table') {
            dragonecommercereservezyx987_dropPropertyValueTable();
        } elseif($_POST['Submit'] === 'Drop all the ecommerce tables') {
            dragonecommercereservezyx987_dropAllTables();
        } elseif($_POST['Submit'] === 'Create Property') {
            dragonecommercereservezyx987_addProperty();
        } elseif($_POST['Submit'] === 'Update Property') {
            dragonecommercereservezyx987_updateProperty();
        } elseif($_POST['Submit'] === 'Disable Property') {        
            dragonecommercereservezyx987_disableProperty();
        } elseif($_POST['Submit'] === 'Create Property Value') {
            dragonecommercereservezyx987_addPropertyValue();
        } elseif($_POST['Submit'] === 'Update Property Value') {
            dragonecommercereservezyx987_updatePropertyValue();
        } elseif($_POST['Submit'] === 'Disable Property Value') {        
            dragonecommercereservezyx987_disablePropertyValue();
        } elseif($_POST['Submit'] === "Update a Department Products") {
            dragonecommercereservezyx987_updateDepartmentProducts();
        } elseif($_POST['Submit'] === 'Create Charge Type') {
            dragonecommercereservezyx987_addChargeType();
        } elseif($_POST['Submit'] === 'ENABLE automatically backup database everyday') {
            dragonecommercereservezyx987_enableAutoBackupDatabaseEveryday();
        } elseif($_POST['Submit'] === 'DISABLE automatically backup database everyday') {
            dragonecommercereservezyx987_disableAutoBackupDatabaseEveryday();
        }
    }

    //$timezone = get_option('dragonecommercereservezyx987_timezone');
    $alldepartments = dragonecommercereservezyx987_getAllDepartments();
    $activedepartments = dragonecommercereservezyx987_getAllDepartments(true);
    $allgroupcategories = dragonecommercereservezyx987_getAllGroupcategories();
    $activegroupcategories = dragonecommercereservezyx987_getAllGroupcategories(true);
    $allcurrencies = dragonecommercereservezyx987_getAllCurrencies();
    $activecurrencies = dragonecommercereservezyx987_getAllCurrencies(true);
    $allcountries = dragonecommercereservezyx987_getCountries(false);
    $activecountries = dragonecommercereservezyx987_getCountries();
    $activeprovinces = dragonecommercereservezyx987_getAllProvinces();
    $allprovinces = dragonecommercereservezyx987_getAllProvinces(false);
    $allcities = dragonecommercereservezyx987_getAllCities(false);
    $activecities = dragonecommercereservezyx987_getAllCities();
    $allproperties = dragonecommercereservezyx987_getProperties(false);
    $activeproperties = dragonecommercereservezyx987_getProperties();
    $allpropertyvalues = dragonecommercereservezyx987_getPropertyvalues(false);
    $activepropertyvalues = dragonecommercereservezyx987_getPropertyvalues();
    $allgroups = dragonecommercereservezyx987_getAllGroups(false);
    $activegroups = dragonecommercereservezyx987_getAllGroups();
    $allproducts = dragonecommercereservezyx987_getAllProducts(false);
    $activeproducts = dragonecommercereservezyx987_getAllProducts();
    $processstatuses = dragonecommercereservezyx987_getAllProcessstatuses();
    $activeprocessstatuses = dragonecommercereservezyx987_getAllProcessstatuses(true);
    $allchargetypes = dragonecommercereservezyx987_getAllChargetypes();
    $activechargetypes = dragonecommercereservezyx987_getAllChargetypes(true);
    $propertyvaluesArr = dragonecommercereservezyx987_getAllPropertyvalues();    
    $propertyvalueshownname_id_Arr = dragonecommercereservezyx987_getAllPropertyvalueshownnameandids();
    $activeemailmethods = dragonecommercereservezyx987_getAllEmailMethods(true);
    
    $log_Arr = dragonecommercereservezyx987_getAllLogtypesProcessnamesUserids();
    $log_types = $log_Arr["type"];
    $log_processnames = $log_Arr["processname"];
    $log_userids = $log_Arr["userid"];

    if($dragon_ecommerce_dbResult !== null) {
    ?><div class="updated" style="<?php echo ($dragon_ecommerce_dbResult === '' || strtolower($dragon_ecommerce_dbResult) === 'success. ' || strtolower($dragon_ecommerce_dbResult) === 'success.' || strtolower($dragon_ecommerce_dbResult) === 'success') ? 'color:#155724;background-color:#d4edda;' : 'color:#721c24;background-color:#f8d7da;'; ?>"><p><strong><?php echo ($dragon_ecommerce_dbResult === '' ? _e('Saved.') : sanitize_text_field($dragon_ecommerce_dbResult)); ?></strong></p></div>
    <?php
    }

    $editsettingpaypalvalue = '';
    $editsettingmailgunvalue = '';
    $editsettingmailgunbccemailaddressesvalue = '';
    $editsettingnewproductsdaysvalue = '';
    $editsettingproductdefaultlocationvalue = '';
    $editsettingproductdefaulttimezonevalue = '';
    $editsettingshippingfeechargebytimelength = '';
    $editsettingshippingfeechargebydistance = '';

    $name = '';
    $start = '';
    $end = '';
    $description = '';
    $groupname = '';
    $color = '';
    $name2 = '';
    $start2 = '';
    $end2 = '';
    $description2 = '';

    wp_enqueue_script('jquery');
    wp_enqueue_script('jquery-ui-core');
    wp_enqueue_script("jquery-ui-tabs");
    wp_enqueue_script('jquery-ui-datepicker');
    wp_enqueue_script('jquery-ui-dialog');
    //wp_enqueue_style('jquery-ui-core');
    //wp_enqueue_style("jquery-ui-tabs");
    wp_enqueue_style('wp-jquery-ui-dialog');  
    wp_enqueue_script('custom-script', plugins_url('js/jquery.datetimepicker.full.min.js', __FILE__ ));
    wp_enqueue_style('custom-style', plugins_url('css/jquery.datetimepicker.min.css', __FILE__ )); 
    wp_enqueue_script('custom-script-bootstrap', plugins_url('bootstrap/js/bootstrap.min.js', __FILE__ ));
    wp_enqueue_style('custom-style-bootstrap', plugins_url('bootstrap/css/bootstrap.min.css', __FILE__ )); 
    wp_enqueue_script('custom-script-d3', plugins_url('js/d3.v7.min.js', __FILE__ ));    

    wp_enqueue_style('custom-style-jqueryui', plugins_url('css/jquery-ui.css', __FILE__ ));
    wp_enqueue_style('custom-style-dragonecommerce', plugins_url('css/dragonecommerce.css', __FILE__ ));
?><noscript>Your browser does not support JavaScript! Please enable Javascript in your browser and refresh the page!</noscript>
<script>
    var jsurl2 = "<?php echo plugins_url('js/jquery.datetimepicker.full.min.js', __FILE__ ); ?>";    
    var mediumdialog, largedialog = null;
    var dragonecommercereservezyx987_addproductlocationarray = [], dragonecommercereservezyx987_editproductlocationarray = [], dragonecommercereservezyx987_addshippingpolicylocationarray = [], dragonecommercereservezyx987_addtaxlocationarray = [];
    var mediummodalElementContainer = "<div id='mymediummodal' style='display:none;' title=''></div>";
    var largemodalElementContainer = "<div id='mylargemodal' data-bs-backdrop='static' data-bs-keyboard='false' class='modal fade' style='z-index: 99999 !important;background-color:white;min-width:100% !important;width:100% !important;height:100% !important;overflow:auto;padding:0px !important;' title='' role='dialog'></div>";    
    var ORDER_ITEMS_PER_PAGE_PRESET_VALUE = '10';
    var totalpagenumber_onload_admin_order = 1, pg_onload_admin_order = 1;
    var ORDERDETAILS_ITEMS_PER_PAGE_PRESET_VALUE = '10';
    var totalpagenumber_onload_admin_orderdetails = 1, pg_onload_admin_orderdetails = 1;
    var PRODUCT_ITEMS_PER_PAGE_PRESET_VALUE = '10';
    var totalpagenumber_onload_admin_product = 1, pg_onload_admin_product = 1;
    var PRODUCTDETAILS_ITEMS_PER_PAGE_PRESET_VALUE = '10';
    var totalpagenumber_onload_admin_productdetails = 1, pg_onload_admin_productdetails = 1;
    var DISABLEDPRODUCT_ITEMS_PER_PAGE_PRESET_VALUE = '10';        
    var totalpagenumber_onload_admin_disabledproduct = 1, pg_onload_admin_disabledproduct = 1;
    var USER_ITEMS_PER_PAGE_PRESET_VALUE = '10';
    var totalpagenumber_onload_admin_user = 1, pg_onload_admin_user = 1;
    var COUNTRY_ITEMS_PER_PAGE_PRESET_VALUE = '10';
    var totalpagenumber_onload_admin_country = 1, pg_onload_admin_country = 1;
    var PROVINCE_ITEMS_PER_PAGE_PRESET_VALUE = '10';
    var totalpagenumber_onload_admin_province = 1, pg_onload_admin_province = 1;
    var DEPARTMENT_ITEMS_PER_PAGE_PRESET_VALUE = '10';
    var totalpagenumber_onload_admin_department = 1, pg_onload_admin_department = 1;
    var GROUPCATEGORY_ITEMS_PER_PAGE_PRESET_VALUE = '10';
    var totalpagenumber_onload_admin_groupcategory = 1, pg_onload_admin_groupcategory = 1;
    var PROCESSSTATUS_ITEMS_PER_PAGE_PRESET_VALUE = '10';
    var totalpagenumber_onload_admin_processstatus = 1, pg_onload_admin_processstatus = 1;
    var GROUP_ITEMS_PER_PAGE_PRESET_VALUE = '10';
    var totalpagenumber_onload_admin_group = 1, pg_onload_admin_group = 1;
    var CHARGETYPE_ITEMS_PER_PAGE_PRESET_VALUE = '10';
    var totalpagenumber_onload_admin_chargetype = 1, pg_onload_admin_chargetype = 1;
    var LOG_ITEMS_PER_PAGE_PRESET_VALUE = '10';
    var totalpagenumber_onload_admin_log = 1, pg_onload_admin_log = 1;
    var SLIDESHOW_ITEMS_PER_PAGE_PRESET_VALUE = '10';
    var totalpagenumber_onload_admin_slideshow = 1, pg_onload_admin_slideshow = 1;
    var DISCOUNT_ITEMS_PER_PAGE_PRESET_VALUE = '10';
    var totalpagenumber_onload_admin_discount = 1, pg_onload_admin_discount = 1;
    var COUPON_ITEMS_PER_PAGE_PRESET_VALUE = '10';
    var totalpagenumber_onload_admin_coupon = 1, pg_onload_admin_coupon = 1;
    var PROPERTYVALUE_ITEMS_PER_PAGE_PRESET_VALUE = '10';
    var totalpagenumber_onload_admin_propertyvalue = 1, pg_onload_admin_propertyvalue = 1;
    var HANDLING_ITEMS_PER_PAGE_PRESET_VALUE = '10';
    var totalpagenumber_onload_admin_handling = 1, pg_onload_admin_handling = 1;
    var SHIPPING_ITEMS_PER_PAGE_PRESET_VALUE = '10';
    var totalpagenumber_onload_admin_shipping = 1, pg_onload_admin_shipping = 1;
    var TAX_ITEMS_PER_PAGE_PRESET_VALUE = '10';
    var totalpagenumber_onload_admin_tax = 1, pg_onload_admin_tax = 1;
    var PROPERTY_ITEMS_PER_PAGE_PRESET_VALUE = '10';
    var totalpagenumber_onload_admin_property = 1, pg_onload_admin_property = 1;
    var CURRENCY_ITEMS_PER_PAGE_PRESET_VALUE = '10';
    var totalpagenumber_onload_admin_currency = 1, pg_onload_admin_currency = 1;
    var CITY_ITEMS_PER_PAGE_PRESET_VALUE = '10';
    var totalpagenumber_onload_admin_city = 1, pg_onload_admin_city = 1;
    var EMAILMETHOD_ITEMS_PER_PAGE_PRESET_VALUE = '10';
    var totalpagenumber_onload_admin_emailmethod = 1, pg_onload_admin_emailmethod = 1;
    var DISTANCE_ITEMS_PER_PAGE_PRESET_VALUE = '10';
    var totalpagenumber_onload_admin_distance = 1, pg_onload_admin_distance = 1;
    var PAYMENTMETHOD_ITEMS_PER_PAGE_PRESET_VALUE = '10';
    var totalpagenumber_onload_admin_paymentmethod = 1, pg_onload_admin_paymentmethod = 1;
    var WEIGHT_ITEMS_PER_PAGE_PRESET_VALUE = '10';
    var totalpagenumber_onload_admin_weight = 1, pg_onload_admin_weight = 1;
    var GROUPPROPERTY_ITEMS_PER_PAGE_PRESET_VALUE = '10';
    var totalpagenumber_onload_admin_groupproperty = 1, pg_onload_admin_groupproperty = 1;

    function dragonecommercereservezyx987_validString(mystring) {
        if(typeof mystring === 'undefined' || mystring === null) {
            return '';
        }
        return mystring; 
    }

    function dragonecommercereservezyx987_isEnterSpaceEvent(event) {
        if(event.type === 'keydown') {
            var code = event.charCode || event.keyCode;
            if(code === 32 || code === 13) {
                event.preventDefault();
                return true;
            }
        }
        return false;
    }

    function dragonecommercereservezyx987_isClickEnterSpaceEvent(event) {
        if(event.type === 'click') {
            return true;
        } else if(event.type === 'keydown') {
            var code = event.charCode || event.keyCode;
            if(code === 32 || code === 13) {
                event.preventDefault();
                return true;
            }
        }
        return false;
    }

    //Total reserve money in the past 14 days/16 weeks/12 months/10 years
    function dragonecommercereservezyx987_createChart1() {
        jQuery("div#dragonecommerce_chart_totalreservemoney svg").html('');
        jQuery("img#admin_chart_totalreservemoney_loader").show();
        var myfrequency = jQuery('select#dragonecommerce_chart_totalreservemoney_frequency').val();
        if(myfrequency !== '14days' && myfrequency !== '16weeks' && myfrequency !== '12months' && myfrequency !== '10years') {
            return alert("Please choose a value from the dropdown list.");
        }
        var dataObj = {dragonecommercereservezyx987_hidden_security_getchart1data:"<?php echo wp_create_nonce('dragonecommercereservezyx987_getChart1Data'); ?>",dragonecommercereservezyx987_hidden:"Y",action:"dragonecommercereservezyx987_getChart1Data",frequency: myfrequency};
        jQuery.ajax({
            type: "POST",
            async: true,
            url: ajaxurl,
            data: dataObj
        }).done(function (data) {
            //console.log(data);
            var svg = d3.select("div#dragonecommerce_chart_totalreservemoney svg"),
                margin = 200,
                width = svg.attr("width") - margin,
                height = svg.attr("height") - margin;

            svg.append("text")
               .attr("transform", "translate(100,0)")
               .attr("x", width * 0.5 -140)
               .attr("y", 50)
               .attr("font-size", "24px")
               .text("Total reserve money");

            var xScale = d3.scaleBand().range([0, width]).padding(0.4),
                yScale = d3.scaleLinear().range([height, 0]);

            var g = svg.append("g")
                       .attr("transform", "translate(" + 100 + "," + 100 + ")");

            xScale.domain(data.map(function(d) { return d.name; }));
            var max = d3.max(data, function(d) { return d.value; });
            if (max === 0) {max = 50;}
            yScale.domain([0, max]);

            g.append("g")
             .attr("transform", "translate(0," + height + ")")
             .call(d3.axisBottom(xScale))
             .append("text")
             .attr("y", height - 250)
             .attr("x", width * 0.5)
             .attr("font-size", "12px")
             .attr("text-anchor", "end")
             .attr("fill", "currentColor")
             .text("Time");

            g.append("g")
             .call(d3.axisLeft(yScale).tickFormat(function(d){
                 return "$" + d;
             })
             .ticks(10))
             .append("text")
             .attr("transform", "rotate(-90)")
             .attr("y", 6)
             .attr("dy", "-5.1em")
             .attr("font-size", "12px")
             .attr("text-anchor", "end")
             .attr("fill", "currentColor")
             .text("Money");


            var tooltip = d3.select("div#dragonecommerce_chart_totalreservemoney")
                .append("div")
                .attr("id", "mytooltip")
                .style("position", "absolute")
                .style("z-index", "10")
                .style("visibility", "hidden");

            g.selectAll(".bar")
             .data(data)
             .enter().append("rect")
             .attr("class", "bar")
             .attr("x", function(d) { return xScale(d.name); })
             .attr("y", function(d) { return yScale(d.value); })
             .attr("width", xScale.bandwidth())
             .attr("height", function(d) { return height - yScale(d.value); })
             .on("mouseover", function(event, d) {
                //console.log("event: " + JSON.stringify(event) + ", d: " + JSON.stringify(d));
                return tooltip
                      .style("visibility", "visible")
                      .html("<span style=font-size:30px;> " + d.value + "</span>");
             })
             .on("mouseout", function(event, d) {
                return tooltip.style("visibility", "hidden");
             })
             .on("mousemove", function(event, d) { 
                var myoffset = jQuery('div#dragonecommerce_tabs').offset();
                var xy = d3.pointer(event,d);
                //console.log("offset: " + JSON.stringify(myoffset) + ", " + xy[0] + ", " + xy[1]);
                return tooltip.style("left", (xy[0] - myoffset.left + 35) + "px")   
                           .style("top", (xy[1] - myoffset.top - 45) + "px");
             });
            jQuery("img#admin_chart_totalreservemoney_loader").hide();
        }).fail(function( jqXHR, textStatus ) {
            //alert( "Get chart 1 data failed: " + textStatus );
        });
    }

    function dragonecommercereservezyx987_createChart2() {
        jQuery("div#dragonecommerce_chart_totalreservequantity svg").html('');
        jQuery("img#admin_chart_totalreservequantity_loader").show();
        var myfrequency = jQuery('select#dragonecommerce_chart_totalreservequantity_frequency').val();
        if(myfrequency !== '14days' && myfrequency !== '16weeks' && myfrequency !== '12months' && myfrequency !== '10years') {
            return alert("Please choose a value from the dropdown list.");
        }
        var dataObj = {dragonecommercereservezyx987_hidden_security_getchart2data:"<?php echo wp_create_nonce('dragonecommercereservezyx987_getChart2Data'); ?>",dragonecommercereservezyx987_hidden:"Y",action:"dragonecommercereservezyx987_getChart2Data",frequency: myfrequency};        
        jQuery.ajax({
            type: "POST",
            async: true,
            url: ajaxurl,
            data: dataObj
        }).done(function (data) {
            //console.log(data);
            var svg = d3.select("div#dragonecommerce_chart_totalreservequantity svg"),
                margin = 200,
                width = svg.attr("width") - margin,
                height = svg.attr("height") - margin;

            svg.append("text")
               .attr("transform", "translate(100,0)")
               .attr("x", width * 0.5 -140)
               .attr("y", 50)
               .attr("font-size", "24px")
               .text("Total reserve quantity");

            var xScale = d3.scaleBand().range([0, width]).padding(0.4),
                yScale = d3.scaleLinear().range([height, 0]);

            var g = svg.append("g")
                       .attr("transform", "translate(" + 100 + "," + 100 + ")");

            xScale.domain(data.map(function(d) { return d.name; }));
            var max = d3.max(data, function(d) { return d.value; }); 
            if (max === 0) {max = 50;}
            yScale.domain([0, max]);

            g.append("g")
             .attr("transform", "translate(0," + height + ")")
             .call(d3.axisBottom(xScale))
             .append("text")
             .attr("y", height - 250)
             .attr("x", width * 0.5)
             .attr("font-size", "12px")
             .attr("text-anchor", "end")
             .attr("fill", "currentColor")
             .text("Time");

            g.append("g")
             .call(d3.axisLeft(yScale).tickFormat(function(d){
                 return d;
             })
             .ticks(10))
             .append("text")
             .attr("transform", "rotate(-90)")
             .attr("y", 6)
             .attr("dy", "-5.1em")
             .attr("font-size", "12px")
             .attr("text-anchor", "end")
             .attr("fill", "currentColor")
             .text("Quantity");

            var tooltip = d3.select("div#dragonecommerce_chart_totalreservequantity")
                .append("div")
                .attr("id", "mytooltip")
                .style("position", "absolute")
                .style("z-index", "10")
                .style("visibility", "hidden");

            g.selectAll(".bar")
             .data(data)
             .enter().append("rect")
             .attr("class", "bar")
             .attr("x", function(d) { return xScale(d.name); })
             .attr("y", function(d) { return yScale(d.value); })
             .attr("width", xScale.bandwidth())
             .attr("height", function(d) { return height - yScale(d.value); })
             .on("mouseover", function(event, d) {
                //console.log("event: " + JSON.stringify(event) + ", d: " + JSON.stringify(d));
                return tooltip
                      .style("visibility", "visible")
                      .html("<span style=font-size:30px;> " + d.value + "</span>");
             })
             .on("mouseout", function(event, d) {
                return tooltip.style("visibility", "hidden");
             })
             .on("mousemove", function(event, d) { 
                var myoffset = jQuery('div#dragonecommerce_tabs').offset();
                var xy = d3.pointer(event,d);
                //console.log("offset: " + JSON.stringify(myoffset) + ", " + xy[0] + ", " + xy[1]);
                return tooltip.style("left", (xy[0] - myoffset.left + 35) + "px")   
                           .style("top", (xy[1] - myoffset.top - 45) + "px");
             });
            jQuery("img#admin_chart_totalreservequantity_loader").hide();
        }).fail(function( jqXHR, textStatus ) {
            //alert( "Get chart 2 data failed: " + textStatus );
        });
    }

    function dragonecommercereservezyx987_createChart3() {
        jQuery("div#dragonecommerce_chart_top10productreservemoney svg").html('');
        jQuery("img#admin_chart_top10productreservemoney_loader").show();
        var myfrequency = jQuery('select#dragonecommerce_chart_top10productreservemoney_frequency').val();
        if(myfrequency !== '14days' && myfrequency !== '16weeks' && myfrequency !== '12months' && myfrequency !== '10years') {
            return alert("Please choose a value from the dropdown list.");
        }
        var dataObj = {dragonecommercereservezyx987_hidden_security_getchart3data:"<?php echo wp_create_nonce('dragonecommercereservezyx987_getChart3Data'); ?>",dragonecommercereservezyx987_hidden:"Y",action:"dragonecommercereservezyx987_getChart3Data",frequency: myfrequency};        
        jQuery.ajax({
            type: "POST",
            async: true,
            url: ajaxurl,
            data: dataObj
        }).done(function (data) {
            //console.log(data);
            var svg = d3.select("div#dragonecommerce_chart_top10productreservemoney svg"),
                margin = 200,
                width = svg.attr("width") - margin,
                height = svg.attr("height") - margin;

            svg.append("text")
               .attr("transform", "translate(100,0)")
               .attr("x", width * 0.5 -140)
               .attr("y", 50)
               .attr("font-size", "24px")
               .text("Top 10 product reserve by money");

            var xScale = d3.scaleBand().range([0, width]).padding(0.4),
                yScale = d3.scaleLinear().range([height, 0]);

            var g = svg.append("g")
                       .attr("transform", "translate(" + 100 + "," + 100 + ")");

            xScale.domain(data.map(function(d) { return d.name; }));            
            var max = d3.max(data, function(d) { return d.value; }); 
            if (max === 0) {max = 50;}
            yScale.domain([0, max]);

            g.append("g")
             .attr("transform", "translate(0," + height + ")")
             .call(d3.axisBottom(xScale))
             .append("text")
             .attr("y", height - 250)
             .attr("x", width * 0.5)
             .attr("font-size", "12px")
             .attr("text-anchor", "end")
             .attr("fill", "currentColor")
             .text("Product");

            g.append("g")
             .call(d3.axisLeft(yScale).tickFormat(function(d){
                 return "$" + d;
             })
             .ticks(10))
             .append("text")
             .attr("transform", "rotate(-90)")
             .attr("y", 6)
             .attr("dy", "-5.1em")
             .attr("font-size", "12px")
             .attr("text-anchor", "end")
             .attr("fill", "currentColor")
             .text("Money");

            var tooltip = d3.select("div#dragonecommerce_chart_top10productreservemoney")
                .append("div")
                .attr("id", "mytooltip")
                .style("position", "absolute")
                .style("z-index", "10")
                .style("visibility", "hidden");
                                
            g.selectAll(".bar")
             .data(data)
             .enter().append("rect")
             .attr("class", "bar")
             .attr("x", function(d) { return xScale(d.name); })
             .attr("y", function(d) { return yScale(d.value); })
             .attr("width", xScale.bandwidth())
             .attr("height", function(d) { return height - yScale(d.value); })
             .on("mouseover", function(event, d) {
                //console.log("event: " + JSON.stringify(event) + ", d: " + JSON.stringify(d));
                return tooltip
                      .style("visibility", "visible")
                      .html("<span style=font-size:30px;> " + d.value + "</span>");
             })
             .on("mouseout", function(event, d) {
                return tooltip.style("visibility", "hidden");
             })
             .on("mousemove", function(event, d) { 
                var myoffset = jQuery('div#dragonecommerce_tabs').offset();
                var xy = d3.pointer(event,d);
                //console.log("offset: " + JSON.stringify(myoffset) + ", " + xy[0] + ", " + xy[1]);
                return tooltip.style("left", (xy[0] - myoffset.left + 35) + "px")   
                           .style("top", (xy[1] - myoffset.top - 45) + "px");
             });
            jQuery("img#admin_chart_top10productreservemoney_loader").hide();
        }).fail(function( jqXHR, textStatus ) {
            //alert( "Get chart 3 data failed: " + textStatus );
        });
    }


    function dragonecommercereservezyx987_createChart4() {
        jQuery("div#dragonecommerce_chart_top10productreservequantity svg").html('');
        jQuery("img#admin_chart_top10productreservequantity_loader").show();
        var myfrequency = jQuery('select#dragonecommerce_chart_top10productreservequantity_frequency').val();
        if(myfrequency !== '14days' && myfrequency !== '16weeks' && myfrequency !== '12months' && myfrequency !== '10years') {
            return alert("Please choose a value from the dropdown list.");
        }
        var dataObj = {dragonecommercereservezyx987_hidden_security_getchart4data:"<?php echo wp_create_nonce('dragonecommercereservezyx987_getChart4Data'); ?>",dragonecommercereservezyx987_hidden:"Y",action:"dragonecommercereservezyx987_getChart4Data",frequency: myfrequency};
        jQuery.ajax({
            type: "POST",
            async: true,
            url: ajaxurl,
            data: dataObj
        }).done(function (data) {
            //console.log(data);
            var svg = d3.select("div#dragonecommerce_chart_top10productreservequantity svg"),
                margin = 200,
                width = svg.attr("width") - margin,
                height = svg.attr("height") - margin;

            svg.append("text")
               .attr("transform", "translate(100,0)")
               .attr("x", width * 0.5 -140)
               .attr("y", 50)
               .attr("font-size", "24px")
               .text("Top 10 product reserve by quantity");

            var xScale = d3.scaleBand().range([0, width]).padding(0.4),
                yScale = d3.scaleLinear().range([height, 0]);

            var g = svg.append("g")
                       .attr("transform", "translate(" + 100 + "," + 100 + ")");

            xScale.domain(data.map(function(d) { return d.name; }));            
            var max = d3.max(data, function(d) { return d.value; }); 
            if (max === 0) {max = 50;}
            yScale.domain([0, max]);

            g.append("g")
             .attr("transform", "translate(0," + height + ")")
             .call(d3.axisBottom(xScale))
             .append("text")
             .attr("y", height - 250)
             .attr("x", width * 0.5)
             .attr("font-size", "12px")
             .attr("text-anchor", "end")
             .attr("fill", "currentColor")
             .text("Product");

            g.append("g")
             .call(d3.axisLeft(yScale).tickFormat(function(d){
                 return d;
             })
             .ticks(10))
             .append("text")
             .attr("transform", "rotate(-90)")
             .attr("y", 6)
             .attr("dy", "-5.1em")
             .attr("font-size", "12px")
             .attr("text-anchor", "end")
             .attr("fill", "currentColor")
             .text("Quantity");

            var tooltip = d3.select("div#dragonecommerce_chart_top10productreservequantity")
                .append("div")
                .attr("id", "mytooltip")
                .style("position", "absolute")
                .style("z-index", "10")
                .style("visibility", "hidden");

            g.selectAll(".bar")
             .data(data)
             .enter().append("rect")
             .attr("class", "bar")
             .attr("x", function(d) { return xScale(d.name); })
             .attr("y", function(d) { return yScale(d.value); })
             .attr("width", xScale.bandwidth())
             .attr("height", function(d) { return height - yScale(d.value); })
             .on("mouseover", function(event, d) {
                //console.log("event: " + JSON.stringify(event) + ", d: " + JSON.stringify(d));
                return tooltip
                      .style("visibility", "visible")
                      .html("<span style=font-size:30px;> " + d.value + "</span>");
             })
             .on("mouseout", function(event, d) {
                return tooltip.style("visibility", "hidden");
             })
             .on("mousemove", function(event, d) { 
                var myoffset = jQuery('div#dragonecommerce_tabs').offset();
                var xy = d3.pointer(event,d);
                //console.log("offset: " + JSON.stringify(myoffset) + ", " + xy[0] + ", " + xy[1]);
                return tooltip.style("left", (xy[0] - myoffset.left + 35) + "px")   
                           .style("top", (xy[1] - myoffset.top - 45) + "px");
             });
            jQuery("img#admin_chart_top10productreservequantity_loader").hide();
        }).fail(function( jqXHR, textStatus ) {
            //alert( "Get chart 4 data failed: " + textStatus );
        });
    }

    function dragonecommercereservezyx987_createChart5() {
        jQuery("div#dragonecommerce_chart_top10clientsmoney svg").html('');
        jQuery("img#admin_chart_top10clientsmoney_loader").show();
        var myfrequency = jQuery('select#dragonecommerce_chart_top10clientsmoney_frequency').val();
        if(myfrequency !== '14days' && myfrequency !== '16weeks' && myfrequency !== '12months' && myfrequency !== '10years') {
            return alert("Please choose a value from the dropdown list.");
        }
        var dataObj = {dragonecommercereservezyx987_hidden_security_getchart5data:"<?php echo wp_create_nonce('dragonecommercereservezyx987_getChart5Data'); ?>",dragonecommercereservezyx987_hidden:"Y",action:"dragonecommercereservezyx987_getChart5Data",frequency: myfrequency};        
        jQuery.ajax({
            type: "POST",
            async: true,
            url: ajaxurl,
            data: dataObj
        }).done(function (data) {
            //console.log(data);
            var svg = d3.select("div#dragonecommerce_chart_top10clientsmoney svg"),
                margin = 200,
                width = svg.attr("width") - margin,
                height = svg.attr("height") - margin;

            svg.append("text")
               .attr("transform", "translate(100,0)")
               .attr("x", width * 0.5 -140)
               .attr("y", 50)
               .attr("font-size", "24px")
               .text("Top 10 customers by money");

            var xScale = d3.scaleBand().range([0, width]).padding(0.4),
                yScale = d3.scaleLinear().range([height, 0]);

            var g = svg.append("g")
                       .attr("transform", "translate(" + 100 + "," + 100 + ")");

            xScale.domain(data.map(function(d) { return d.name; }));            
            var max = d3.max(data, function(d) { return d.value; }); 
            if (max === 0) {max = 50;}
            yScale.domain([0, max]);

            g.append("g")
             .attr("transform", "translate(0," + height + ")")
             .call(d3.axisBottom(xScale))
             .append("text")
             .attr("y", height - 250)
             .attr("x", width * 0.5)
             .attr("font-size", "12px")
             .attr("text-anchor", "end")
             .attr("fill", "currentColor")
             .text("Customer");

            g.append("g")
             .call(d3.axisLeft(yScale).tickFormat(function(d){
                 return "$" + d;
             })
             .ticks(10))
             .append("text")
             .attr("transform", "rotate(-90)")
             .attr("y", 6)
             .attr("dy", "-5.1em")
             .attr("font-size", "12px")
             .attr("text-anchor", "end")
             .attr("fill", "currentColor")
             .text("Money");

            var tooltip = d3.select("div#dragonecommerce_chart_top10clientsmoney")
                .append("div")
                .attr("id", "mytooltip")
                .style("position", "absolute")
                .style("z-index", "10")
                .style("visibility", "hidden");
                                
            g.selectAll(".bar")
             .data(data)
             .enter().append("rect")
             .attr("class", "bar")
             .attr("x", function(d) { return xScale(d.name); })
             .attr("y", function(d) { return yScale(d.value); })
             .attr("width", xScale.bandwidth())
             .attr("height", function(d) { return height - yScale(d.value); })
             .on("mouseover", function(event, d) {
                //console.log("event: " + JSON.stringify(event) + ", d: " + JSON.stringify(d));
                return tooltip
                      .style("visibility", "visible")
                      .html("<span style=font-size:30px;> " + d.value + "</span>");
             })
             .on("mouseout", function(event, d) {
                return tooltip.style("visibility", "hidden");
             })
             .on("mousemove", function(event, d) { 
                var myoffset = jQuery('div#dragonecommerce_tabs').offset();
                var xy = d3.pointer(event,d);
                //console.log("offset: " + JSON.stringify(myoffset) + ", " + xy[0] + ", " + xy[1]);
                return tooltip.style("left", (xy[0] - myoffset.left + 35) + "px")   
                           .style("top", (xy[1] - myoffset.top - 45) + "px");
             });
            jQuery("img#admin_chart_top10clientsmoney_loader").hide();
        }).fail(function( jqXHR, textStatus ) {
            //alert( "Get chart 5 data failed: " + textStatus );
        });
    }

    function dragonecommercereservezyx987_editOrder(orderid, containerid) {
        if(jQuery('.' + containerid + orderid).length > 0) {
            jQuery('.' + containerid + orderid).toggle();
        }
    }

    function dragonecommercereservezyx987_saveOrder(orderid, selectid) {
        var orderstatus = '-1';
        if(jQuery('select#' + selectid + 'status_' + orderid).length > 0) {
            orderstatus = jQuery('select#' + selectid + 'status_' + orderid).val();
        }
        
        var emailsent = '-1';
        if(jQuery('select#' + selectid + 'emailsent_' + orderid).length > 0) {
            emailsent = jQuery('select#' + selectid + 'emailsent_' + orderid).val();
        }

        var ordercancelemailsent = '-1';
        if(jQuery('select#' + selectid + 'ordercancelemailsent_' + orderid).length > 0) {
            ordercancelemailsent = jQuery('select#' + selectid + 'ordercancelemailsent_' + orderid).val();
        }
        
        var ordercancelrefunded = '-1';
        if(jQuery('select#' + selectid + 'ordercancelrefunded_' + orderid).length > 0) {
            ordercancelrefunded = jQuery('select#' + selectid + 'ordercancelrefunded_' + orderid).val();
        }

        var ordercanceltimeutc = '';
        if(jQuery('input#' + selectid + 'ordercanceltimeutc_' + orderid).length > 0) {
            ordercanceltimeutc = jQuery.trim(jQuery('input#' + selectid + 'ordercanceltimeutc_' + orderid).val());
        }

        var ordercancelrefundtimeutc = '';
        if(jQuery('input#' + selectid + 'ordercancelrefundtimeutc_' + orderid).length > 0) {
            ordercancelrefundtimeutc = jQuery.trim(jQuery('input#' + selectid + 'ordercancelrefundtimeutc_' + orderid).val());
        }

        var description = '';
        if(jQuery('input#' + selectid + 'description_' + orderid).length > 0) {
            description = jQuery.trim(jQuery('input#' + selectid + 'description_' + orderid).val());
        }

        if(orderstatus === '-1' && emailsent === '-1' && ordercancelemailsent === '-1' && ordercancelrefunded === '-1'
           && ordercanceltimeutc === '' && ordercancelrefundtimeutc === '' && description === '') {
            return alert("Please enter a value.");
        }
        if(dragonecommercereservezyx987_validateDateInput(ordercanceltimeutc) && dragonecommercereservezyx987_validateDateInput(ordercancelrefundtimeutc)) {
            if(ordercanceltimeutc > ordercancelrefundtimeutc) {
                return alert("Order refund date is earlier than order cancel date.");
            }
        } else {
            return alert("Please enter a valid date.");
        }

        var emailsentvalue = parseInt(emailsent);
        var ordercancelemailsentvalue = parseInt(ordercancelemailsent);
        var ordercancelrefundedvalue = parseInt(ordercancelrefunded);
        var orderstatusvalue = parseInt(orderstatus);

        var dataObj = {dragonecommercereservezyx987_hidden_security_saveorder:"<?php echo wp_create_nonce('dragonecommercereservezyx987_saveOrder'); ?>",dragonecommercereservezyx987_hidden:"Y",action:"dragonecommercereservezyx987_saveOrder",id: orderid};
        dataObj.status = orderstatusvalue;
        dataObj.emailsent = emailsentvalue;
        dataObj.ordercancelemailsent = ordercancelemailsentvalue;
        dataObj.ordercancelrefunded = ordercancelrefundedvalue;
        dataObj.ordercanceltimeutc = ordercanceltimeutc;
        dataObj.ordercancelrefundtimeutc = ordercancelrefundtimeutc;
        dataObj.description = description;
        jQuery.ajax({
            type: "POST",
            url: ajaxurl,
            data: dataObj
        }).done(function (mydata) {
            alert(mydata);
            if(mydata === 'Success') {
                dragonecommercereservezyx987_getOrdersList();
            }
        }).fail(function( jqXHR, textStatus ) {
            alert( "Order update failed: " + textStatus );
        });
    }

    function dragonecommercereservezyx987_editProcessstatus(processstatusid, containerid) {
        if(jQuery('.' + containerid + processstatusid).length > 0) {
            jQuery('.' + containerid + processstatusid).toggle();
        }
    }

    function dragonecommercereservezyx987_saveProcessstatus(processstatusid, selectid) {
        var processstatusname = '';
        if(jQuery('input#' + selectid + 'name_' + processstatusid).length > 0) {
            processstatusname = jQuery('input#' + selectid + 'name_' + processstatusid).val();    
        }
        var processstatusdescription = '';
        if(jQuery('input#' + selectid + 'description_' + processstatusid).length > 0) {
            processstatusdescription = jQuery('input#' + selectid + 'description_' + processstatusid).val();
        }
        var processstatusstatus = '-1';
        if(jQuery('select#' + selectid + 'status_' + processstatusid).length > 0) {
            processstatusstatus = jQuery('select#' + selectid + 'status_' + processstatusid).val();
        }
        if(processstatusname === '' && processstatusdescription === '' && processstatusstatus === '-1') {
            return alert("Please enter a value.");
        }
        if(processstatusname === '' || processstatusstatus === '-1') {
            return alert("Name and status are required.");
        }
        var processstatusstatusvalue = parseInt(processstatusstatus);
        var dataObj = {dragonecommercereservezyx987_hidden_security_saveprocessstatus:"<?php echo wp_create_nonce('dragonecommercereservezyx987_saveProcessstatus'); ?>",dragonecommercereservezyx987_hidden:"Y",action:"dragonecommercereservezyx987_saveProcessstatus",id: processstatusid};
        dataObj.name = processstatusname;
        dataObj.description = processstatusdescription;
        dataObj.status = processstatusstatusvalue;
        jQuery.ajax({
            type: "POST",
            url: ajaxurl,
            data: dataObj
        }).done(function (mydata) {
            alert(mydata);
            if(mydata === 'Success') {
                dragonecommercereservezyx987_getProcessstatusesList();
            }
        }).fail(function( jqXHR, textStatus ) {
            alert( "Process status update failed: " + textStatus );
        });
    }

    function dragonecommercereservezyx987_editCountry(countryid, containerid) {
        if(jQuery('.' + containerid + countryid).length > 0) {
            jQuery('.' + containerid + countryid).toggle();
        }
    }

    function dragonecommercereservezyx987_saveCountry(countryid, selectid) {
        var countryname = '';
        if(jQuery('input#' + selectid + 'name_' + countryid).length > 0) {
            countryname = jQuery('input#' + selectid + 'name_' + countryid).val();
        }
        var countryabbreviation = '';
        if(jQuery('input#' + selectid + 'abbreviation_' + countryid).length > 0) {
            countryabbreviation = jQuery('input#' + selectid + 'abbreviation_' + countryid).val();
        }
        var countrydescription = '';
        if(jQuery('input#' + selectid + 'description_' + countryid).length > 0) {
            countrydescription = jQuery('input#' + selectid + 'description_' + countryid).val();
        }
        var countrystatus = '-1';
        if(jQuery('select#' + selectid + 'status_' + countryid).length > 0) {
            countrystatus = jQuery('select#' + selectid + 'status_' + countryid).val();
        }
        if(countryname === '' && countryabbreviation === '' && countrydescription === '' && countrystatus === '-1') {
            return alert("Please enter a value.");
        }
        if(countryname === '' || countryabbreviation === '' || countrystatus === '-1') {
            return alert("Name, abbreviation and status are required.");
        }
        var countrystatusvalue = parseInt(countrystatus);
        var dataObj = {dragonecommercereservezyx987_hidden_security_savecountry:"<?php echo wp_create_nonce('dragonecommercereservezyx987_saveCountry'); ?>",dragonecommercereservezyx987_hidden:"Y",action:"dragonecommercereservezyx987_saveCountry",id: countryid};
        dataObj.name = countryname;
        dataObj.abbreviation = countryabbreviation;
        dataObj.description = countrydescription;
        dataObj.status = countrystatusvalue;
        jQuery.ajax({
            type: "POST",
            url: ajaxurl,
            data: dataObj
        }).done(function (mydata) {
            alert(mydata);
            if(mydata === 'Success') {
                dragonecommercereservezyx987_getCountriesList();
            }
        }).fail(function( jqXHR, textStatus ) {
            alert( "Country update failed: " + textStatus );
        });
    }

    function dragonecommercereservezyx987_editProvince(provinceid, containerid) {
        if(jQuery('.' + containerid + provinceid).length > 0) {
            jQuery('.' + containerid + provinceid).toggle();
        }
    }

    function dragonecommercereservezyx987_saveProvince(provinceid, selectid) {
        var provincename = '';
        if(jQuery('input#' + selectid + 'name_' + provinceid).length > 0) {
            provincename = jQuery('input#' + selectid + 'name_' + provinceid).val();
        }
        var provincecountryid = '';
        if(jQuery('select#' + selectid + 'countryid_' + provinceid).length > 0) {
            provincecountryid = jQuery('select#' + selectid + 'countryid_' + provinceid).val();
        }
        var provincedescription = '';
        if(jQuery('input#' + selectid + 'description_' + provinceid).length > 0) {
            provincedescription = jQuery.trim(jQuery('input#' + selectid + 'description_' + provinceid).val());
        }
        var provincestatus = '-1';
        if(jQuery('select#' + selectid + 'status_' + provinceid).length > 0) {
            provincestatus = jQuery('select#' + selectid + 'status_' + provinceid).val();
        }
        if(provincename === '' && provincecountryid === '-1' && provincedescription === '' && provincestatus === '-1') {
            return alert("Please enter a value.");
        }
        if(provincename === '' || provincecountryid === '-1' || provincestatus === '-1') {
            return alert("Name, country and status are required.");
        }
        var provincestatusvalue = parseInt(provincestatus);
        var provincecountryidvalue = parseInt(provincecountryid);
        var dataObj = {dragonecommercereservezyx987_hidden_security_saveprovince:"<?php echo wp_create_nonce('dragonecommercereservezyx987_saveProvince'); ?>",dragonecommercereservezyx987_hidden:"Y",action:"dragonecommercereservezyx987_saveProvince",id: provinceid};
        dataObj.name = provincename;
        dataObj.countryid = provincecountryidvalue;
        dataObj.description = provincedescription;
        dataObj.status = provincestatusvalue;
        jQuery.ajax({
            type: "POST",
            url: ajaxurl,
            data: dataObj
        }).done(function (mydata) {
            alert(mydata);
            if(mydata === 'Success') {
                dragonecommercereservezyx987_getProvincesList();
            }
        }).fail(function( jqXHR, textStatus ) {
            alert( "Province update failed: " + textStatus );
        });
    }

    function dragonecommercereservezyx987_editCity(cityid, containerid) {
        if(jQuery('.' + containerid + cityid).length > 0) {
            jQuery('.' + containerid + cityid).toggle();
        }
    }

    function dragonecommercereservezyx987_saveCity(cityid, selectid) {
        var cityname = '';
        if(jQuery('input#' + selectid + 'name_' + cityid).length > 0) {
            cityname = jQuery('input#' + selectid + 'name_' + cityid).val();
        }
        var cityprovinceid = '';
        if(jQuery('select#' + selectid + 'provinceid_' + cityid).length > 0) {
            cityprovinceid = jQuery('select#' + selectid + 'provinceid_' + cityid).val();
        }
        var citycountryid = '';
        if(jQuery('select#' + selectid + 'countryid_' + cityid).length > 0) {
            citycountryid = jQuery('select#' + selectid + 'countryid_' + cityid).val();
        }
        var citydescription = '';
        if(jQuery('input#' + selectid + 'description_' + cityid).length > 0) {
            citydescription = jQuery('input#' + selectid + 'description_' + cityid).val();
        }
        var citystatus = '-1';
        if(jQuery('select#' + selectid + 'status_' + cityid).length > 0) {
            citystatus = jQuery('select#' + selectid + 'status_' + cityid).val();
        }
        if(cityname === '' && citycountryid === '-1' && cityprovinceid === '-1' && citydescription === '' && citystatus === '-1') {
            return alert("Please enter a value.");
        }
        if(cityname === '' || citycountryid === '-1' || cityprovinceid === '-1' || citystatus === '-1') {
            return alert("Name, country, province, and status are required.");
        }
        var citystatusvalue = parseInt(citystatus);
        var cityprovinceidvalue = parseInt(cityprovinceid);
        var citycountryidvalue = parseInt(citycountryid);
        var dataObj = {dragonecommercereservezyx987_hidden_security_savecity:"<?php echo wp_create_nonce('dragonecommercereservezyx987_saveCity'); ?>",dragonecommercereservezyx987_hidden:"Y",action:"dragonecommercereservezyx987_saveCity",id: cityid};
        dataObj.name = cityname;
        dataObj.provinceid = cityprovinceidvalue;
        dataObj.countryid = citycountryidvalue;
        dataObj.description = citydescription;
        dataObj.status = citystatusvalue;
        jQuery.ajax({
            type: "POST",
            url: ajaxurl,
            data: dataObj
        }).done(function (mydata) {
            alert(mydata);
            if(mydata === 'Success') {
                dragonecommercereservezyx987_getCitiesList();
            }
        }).fail(function( jqXHR, textStatus ) {
            alert( "City update failed: " + textStatus );
        });
    }

    function dragonecommercereservezyx987_editCurrency(currencyid, containerid) {
        if(jQuery('.' + containerid + currencyid).length > 0) {
            jQuery('.' + containerid + currencyid).toggle();
        }
    }

    function dragonecommercereservezyx987_saveCurrency(currencyid, selectid) {
        var currencyname = '';
        if(jQuery('input#' + selectid + 'name_' + currencyid).length > 0) {
            currencyname = jQuery('input#' + selectid + 'name_' + currencyid).val();
        }
        var currencysign = '';
        if(jQuery('input#' + selectid + 'sign_' + currencyid).length > 0) {
            currencysign = jQuery('input#' + selectid + 'sign_' + currencyid).val();
        }
        var isocurrencycode = '';
        if(jQuery('input#' + selectid + 'sign_' + currencyid).length > 0) {
            isocurrencycode = jQuery('input#' + selectid + 'isocurrencycode_' + currencyid).val();
        }
        var currencydescription = '';
        if(jQuery('input#' + selectid + 'description_' + currencyid).length > 0) {
            currencydescription = jQuery('input#' + selectid + 'description_' + currencyid).val();
        }
        var currencystatus = '-1';
        if(jQuery('select#' + selectid + 'status_' + currencyid).length > 0) {
            currencystatus = jQuery('select#' + selectid + 'status_' + currencyid).val();
        }
        if(currencyname === '' && isocurrencycode === '-1' && currencysign === '-1' && currencydescription === '' && currencystatus === '-1') {
            return alert("Please enter a value.");
        }
        if(currencyname === '' || isocurrencycode === '-1' || currencysign === '-1' || currencystatus === '-1') {
            return alert("Name, sign, isocurrencycode, and status are required.");
        }
        var currencystatusvalue = parseInt(currencystatus);
        var dataObj = {dragonecommercereservezyx987_hidden_security_savecurrency:"<?php echo wp_create_nonce('dragonecommercereservezyx987_saveCurrency'); ?>",dragonecommercereservezyx987_hidden:"Y",action:"dragonecommercereservezyx987_saveCurrency",id: currencyid};
        dataObj.name = currencyname;
        dataObj.sign = currencysign;
        dataObj.isocurrencycode = isocurrencycode;
        dataObj.description = currencydescription;
        dataObj.status = currencystatusvalue;
        jQuery.ajax({
            type: "POST",
            url: ajaxurl,
            data: dataObj
        }).done(function (mydata) {
            alert(mydata);
            if(mydata === 'Success') {
                dragonecommercereservezyx987_getCurrenciesList();
            }
        }).fail(function( jqXHR, textStatus ) {
            alert( "Currency update failed: " + textStatus );
        });
    }

    function dragonecommercereservezyx987_editDepartment(departmentid, containerid) {
        if(jQuery('.' + containerid + departmentid).length > 0) {
            jQuery('.' + containerid + departmentid).toggle();
        }
    }

    function dragonecommercereservezyx987_saveDepartment(departmentid, selectid) {
        var departmentname = '';
        if(jQuery('input#' + selectid + 'name_' + departmentid).length > 0) {
            departmentname = jQuery('input#' + selectid + 'name_' + departmentid).val();
        }
        var departmentdescription = '';
        if(jQuery('input#' + selectid + 'description_' + departmentid).length > 0) {
            departmentdescription = jQuery('input#' + selectid + 'description_' + departmentid).val();
        }
        var departmentstatus = '-1';
        if(jQuery('select#' + selectid + 'status_' + departmentid).length > 0) {
            departmentstatus = jQuery('select#' + selectid + 'status_' + departmentid).val();
        }
        if(departmentname === '' && departmentdescription === '' && departmentstatus === '-1') {
            return alert("Please enter a value.");
        }
        if(departmentname === '' || departmentstatus === '-1') {
            return alert("Name and status are required.");
        }
        var departmentstatusvalue = parseInt(departmentstatus);
        var dataObj = {dragonecommercereservezyx987_hidden_security_savedepartment:"<?php echo wp_create_nonce('dragonecommercereservezyx987_saveDepartment'); ?>",dragonecommercereservezyx987_hidden:"Y",action:"dragonecommercereservezyx987_saveDepartment",id: departmentid};
        dataObj.name = departmentname;
        dataObj.description = departmentdescription;
        dataObj.status = departmentstatusvalue;
        jQuery.ajax({
            type: "POST",
            url: ajaxurl,
            data: dataObj
        }).done(function (mydata) {
            alert(mydata);
            if(mydata === 'Success') {
                dragonecommercereservezyx987_getDepartmentsList();
            }
        }).fail(function( jqXHR, textStatus ) {
            alert( "Department update failed: " + textStatus );
        });
    }

    function dragonecommercereservezyx987_editGroupcategory(groupcategoryid, containerid) {
        if(jQuery('.' + containerid + groupcategoryid).length > 0) {
            jQuery('.' + containerid + groupcategoryid).toggle();
        }
    }

    function dragonecommercereservezyx987_saveGroupcategory(groupcategoryid, selectid) {
        var groupcategoryname = '';
        if(jQuery('input#' + selectid + 'name_' + groupcategoryid).length > 0) {
            groupcategoryname = jQuery('input#' + selectid + 'name_' + groupcategoryid).val();
        }
        var groupcategorydescription = '';
        if(jQuery('input#' + selectid + 'description_' + groupcategoryid).length > 0) {
            groupcategorydescription = jQuery('input#' + selectid + 'description_' + groupcategoryid).val();
        }
        var groupcategorypriority = '';
        if(jQuery('input#' + selectid + 'priority_' + groupcategoryid).length > 0) {
            groupcategorypriority = jQuery('input#' + selectid + 'priority_' + groupcategoryid).val();
        }
        groupcategorypriority = groupcategorypriority === '0' ? 0 : (groupcategorypriority === '' ? 'null' : (parseInt(groupcategorypriority) || ('invalid')));
        var groupcategorymandatory = '-1';
        if(jQuery('select#' + selectid + 'mandatory_' + groupcategoryid).length > 0) {
            groupcategorymandatory = jQuery('select#' + selectid + 'mandatory_' + groupcategoryid).val();
        }
        var groupcategorystatus = '-1';
        if(jQuery('select#' + selectid + 'status_' + groupcategoryid).length > 0) {
            groupcategorystatus = jQuery('select#' + selectid + 'status_' + groupcategoryid).val();
        }
        if(groupcategoryname === '' && groupcategorydescription === '' && groupcategorypriority === 'null' && groupcategorymandatory === '-1' && groupcategorystatus === '-1') {
            return alert("Please enter a value.");
        }
        if(groupcategoryname === '' || groupcategorymandatory === '-1' || groupcategorystatus === '-1') {
            return alert("Name, mandatory and status are required.");
        }
        if(groupcategorypriority === 'invalid') {
            return alert("Priority should be an integer.");
        }
        var groupcategorystatusvalue = parseInt(groupcategorystatus);
        var groupcategorymandatoryvalue = parseInt(groupcategorymandatory);
        var dataObj = {dragonecommercereservezyx987_hidden_security_savegroupcategory:"<?php echo wp_create_nonce('dragonecommercereservezyx987_saveGroupcategory'); ?>",dragonecommercereservezyx987_hidden:"Y",action:"dragonecommercereservezyx987_saveGroupcategory",id: groupcategoryid};
        dataObj.name = groupcategoryname;
        dataObj.priority = groupcategorypriority;
        dataObj.mandatory = groupcategorymandatoryvalue;
        dataObj.description = groupcategorydescription;
        dataObj.status = groupcategorystatusvalue;
        jQuery.ajax({
            type: "POST",
            url: ajaxurl,
            data: dataObj
        }).done(function (mydata) {
            alert(mydata);
            if(mydata === 'Success') {
                dragonecommercereservezyx987_getGroupcategoriesList();
            }
        }).fail(function( jqXHR, textStatus ) {
            alert( "Group category update failed: " + textStatus );
        });
    }

    function dragonecommercereservezyx987_editGroup(groupid, containerid) {
        if(jQuery('.' + containerid + groupid).length > 0) {
            jQuery('.' + containerid + groupid).toggle();
        }
    }

    function dragonecommercereservezyx987_saveGroup(groupid, selectid) {
        var groupname = '';
        if(jQuery('input#' + selectid + 'name_' + groupid).length > 0) {
            groupname = jQuery('input#' + selectid + 'name_' + groupid).val();
        }
        var groupdescription = '';
        if(jQuery('input#' + selectid + 'description_' + groupid).length > 0) {
            groupdescription = jQuery('input#' + selectid + 'description_' + groupid).val();
        }
        var groupcategoryid = '-1';
        if(jQuery('select#' + selectid + 'groupcategoryid_' + groupid).length > 0) {
            groupcategoryid = jQuery('select#' + selectid + 'groupcategoryid_' + groupid).val();
        }
        var grouppriority = '';
        if(jQuery('input#' + selectid + 'priority_' + groupid).length > 0) {
            grouppriority = jQuery.trim(jQuery('input#' + selectid + 'priority_' + groupid).val());
        }
        grouppriority = grouppriority === '0' ? 0 : (grouppriority === '' ? 'null' : (parseInt(grouppriority) || ('invalid')));
        var groupsearchable = '-1';
        if(jQuery('select#' + selectid + 'searchable_' + groupid).length > 0) {
            groupsearchable = jQuery('select#' + selectid + 'searchable_' + groupid).val();
        }
        var groupforallproduct = '-1';
        if(jQuery('select#' + selectid + 'forallproduct_' + groupid).length > 0) {
            groupforallproduct = jQuery('select#' + selectid + 'forallproduct_' + groupid).val();
        }
        var groupstatus = '-1';
        if(jQuery('select#' + selectid + 'status_' + groupid).length > 0) {
            groupstatus = jQuery('select#' + selectid + 'status_' + groupid).val();
        }
        if(groupname === '' && groupdescription === '' && groupcategoryid === '-1' && groupsearchable === '-1' && groupforallproduct === '-1' && groupstatus === '-1') {
            return alert("Please enter a value.");
        }
        if(groupname === '' || groupcategoryid === '-1' || groupsearchable === '-1' || groupforallproduct === '-1' || groupstatus === '-1') {
            return alert("Name, group category, searchable, for all product, and status are required.");
        }
        if(grouppriority === 'invalid') {
            return alert("Priority should be an integer.");
        }
        var groupcategoryidvalue = parseInt(groupcategoryid);
        var groupstatusvalue = parseInt(groupstatus);
        var groupsearchablevalue = parseInt(groupsearchable);
        var groupforallproductvalue = parseInt(groupforallproduct);
        var dataObj = {dragonecommercereservezyx987_hidden_security_savegroup:"<?php echo wp_create_nonce('dragonecommercereservezyx987_saveGroup'); ?>",dragonecommercereservezyx987_hidden:"Y",action:"dragonecommercereservezyx987_saveGroup",id: groupid};
        dataObj.name = groupname;
        dataObj.description = groupdescription;
        dataObj.groupcategoryid = groupcategoryidvalue;
        dataObj.priority = grouppriority;
        dataObj.searchable = groupsearchablevalue;
        dataObj.forallproduct = groupforallproductvalue;
        dataObj.status = groupstatusvalue;
        jQuery.ajax({
            type: "POST",
            url: ajaxurl,
            data: dataObj
        }).done(function (mydata) {
            alert(mydata);
            if(mydata === 'Success') {
                dragonecommercereservezyx987_getGroupsList();
            }
        }).fail(function( jqXHR, textStatus ) {
            alert( "Group update failed: " + textStatus );
        });
    }

    function dragonecommercereservezyx987_editChargetype(chargetypeid, containerid) {
        if(jQuery('.' + containerid + chargetypeid).length > 0) {
            jQuery('.' + containerid + chargetypeid).toggle();
        }
    }

    function dragonecommercereservezyx987_saveChargetype(chargetypeid, selectid) {
        var chargetypename = '';
        if(jQuery('input#' + selectid + 'name_' + chargetypeid).length > 0) {
            chargetypename = jQuery('input#' + selectid + 'name_' + chargetypeid).val();
        }
        var chargetypedescription = '';
        if(jQuery('input#' + selectid + 'description_' + chargetypeid).length > 0) {
            chargetypedescription = jQuery('input#' + selectid + 'description_' + chargetypeid).val();
        }

        var chargetypepriority = '';
        if(jQuery('input#' + selectid + 'priority_' + chargetypeid).length > 0) {
            chargetypepriority = jQuery('input#' + selectid + 'priority_' + chargetypeid).val();
        }
        chargetypepriority = chargetypepriority === '0' ? 0 : (chargetypepriority === '' ? 'null' : (parseInt(chargetypepriority) || ('invalid')));
        var chargetypestatus = '-1';
        if(jQuery('select#' + selectid + 'status_' + chargetypeid).length > 0) {
            chargetypestatus = jQuery('select#' + selectid + 'status_' + chargetypeid).val();
        }
        if(chargetypename === '' && chargetypedescription === '' && chargetypestatus === '-1') {
            return alert("Please enter a value.");
        }
        if(chargetypename === '' || chargetypestatus === '-1') {
            return alert("Name and status are required.");
        }
        if(chargetypepriority === 'invalid') {
            return alert("Priority should be an integer.");
        }
        var chargetypestatusvalue = parseInt(chargetypestatus);
        var dataObj = {dragonecommercereservezyx987_hidden_security_savechargetype:"<?php echo wp_create_nonce('dragonecommercereservezyx987_saveChargetype'); ?>",dragonecommercereservezyx987_hidden:"Y",action:"dragonecommercereservezyx987_saveChargetype",id: chargetypeid};
        dataObj.name = chargetypename;
        dataObj.priority = chargetypepriority;
        dataObj.description = chargetypedescription;
        dataObj.status = chargetypestatusvalue;
        jQuery.ajax({
            type: "POST",
            url: ajaxurl,
            data: dataObj
        }).done(function (mydata) {
            alert(mydata);
            if(mydata === 'Success') {
                dragonecommercereservezyx987_getChargetypesList();
            }
        }).fail(function( jqXHR, textStatus ) {
            alert( "Charge type update failed: " + textStatus );
        });
    }

    function dragonecommercereservezyx987_editProperty(propertyid, containerid) {
        if(jQuery('.' + containerid + propertyid).length > 0) {
            jQuery('.' + containerid + propertyid).toggle();
        }
    }

    function dragonecommercereservezyx987_saveProperty(propertyid, selectid) {
        var propertyname = '';
        if(jQuery('input#' + selectid + 'name_' + propertyid).length > 0) {
            propertyname = jQuery('input#' + selectid + 'name_' + propertyid).val();
        }
        var propertyshownname = '';
        if(jQuery('input#' + selectid + 'shownname_' + propertyid).length > 0) {
            propertyshownname = jQuery('input#' + selectid + 'shownname_' + propertyid).val();
        }
        var propertydescription = '';
        if(jQuery('input#' + selectid + 'description_' + propertyid).length > 0) {
            propertydescription = jQuery('input#' + selectid + 'description_' + propertyid).val();
        }
        var chargetypeid = '-1';
        if(jQuery('select#' + selectid + 'chargetypeid_' + propertyid).length > 0) {
            chargetypeid = jQuery('select#' + selectid + 'chargetypeid_' + propertyid).val();
        }
        var propertypriority = '';
        if(jQuery('input#' + selectid + 'priority_' + propertyid).length > 0) {
            propertypriority = jQuery('input#' + selectid + 'priority_' + propertyid).val();
        }
        propertypriority = propertypriority === '0' ? 0 : (propertypriority === '' ? 'null' : (parseInt(propertypriority) || ('invalid')));
        var propertyforallproduct = '-1';
        if(jQuery('select#' + selectid + 'forallproduct_' + propertyid).length > 0) {
            propertyforallproduct = jQuery('select#' + selectid + 'forallproduct_' + propertyid).val();
        }
        var propertymandatory = '-1';
        if(jQuery('select#' + selectid + 'mandatory_' + propertyid).length > 0) {
            propertymandatory = jQuery('select#' + selectid + 'mandatory_' + propertyid).val();
        }
        var propertystatus = '-1';
        if(jQuery('select#' + selectid + 'status_' + propertyid).length > 0) {
            propertystatus = jQuery('select#' + selectid + 'status_' + propertyid).val();
        }
        if(propertyname === '' && propertyshownname === '' && propertydescription === '' && chargetypeid === '-1' && propertymandatory === '-1' && propertyforallproduct === '-1' && propertystatus === '-1') {
            return alert("Please enter a value.");
        }
        if(propertyname === '' || propertyshownname === '' || propertymandatory === '-1' || propertyforallproduct === '-1' || propertystatus === '-1') {
            return alert("Name, for all product, mandatory, and status are required.");
        }
        if(propertypriority === 'invalid') {
            return alert("Priority should be an integer.");
        }
        var chargetypeidvalue = parseInt(chargetypeid);
        var propertystatusvalue = parseInt(propertystatus);
        var propertymandatoryvalue = parseInt(propertymandatory);
        var propertyforallproductvalue = parseInt(propertyforallproduct);

        var dataObj = {dragonecommercereservezyx987_hidden_security_saveproperty:"<?php echo wp_create_nonce('dragonecommercereservezyx987_saveProperty'); ?>",dragonecommercereservezyx987_hidden:"Y",action:"dragonecommercereservezyx987_saveProperty",id: propertyid};
        dataObj.name = propertyname;
        dataObj.shownname = propertyshownname;
        dataObj.description = propertydescription;
        dataObj.chargetypeid = chargetypeidvalue;
        dataObj.priority = propertypriority;
        dataObj.forallproduct = propertyforallproductvalue;
        dataObj.mandatory = propertymandatoryvalue;
        dataObj.status = propertystatusvalue;
        jQuery.ajax({
            type: "POST",
            url: ajaxurl,
            data: dataObj
        }).done(function (mydata) {
            alert(mydata);
            if(mydata === 'Success') {
                dragonecommercereservezyx987_getPropertiesList();
            }
        }).fail(function( jqXHR, textStatus ) {
            alert( "Property update failed: " + textStatus );
        });
    }

    function dragonecommercereservezyx987_editSlideshow(slideshowid, containerid) {
        if(jQuery('.' + containerid + slideshowid).length > 0) {
            jQuery('.' + containerid + slideshowid).toggle();
        }
    }

    function dragonecommercereservezyx987_saveSlideshow(slideshowid, selectid) {
        var slideshowname = '';
        if(jQuery('input#' + selectid + 'name_' + slideshowid).length > 0) {
            slideshowname = jQuery('input#' + selectid + 'name_' + slideshowid).val();
        }
        var slideshowdescription = '';
        if(jQuery('input#' + selectid + 'description_' + slideshowid).length > 0) {
            slideshowdescription = jQuery('input#' + selectid + 'description_' + slideshowid).val();
        }
        var slideshowsequencenumber = '';
        if(jQuery('input#' + selectid + 'sequencenumber_' + slideshowid).length > 0) {
            slideshowsequencenumber = jQuery('input#' + selectid + 'sequencenumber_' + slideshowid).val();
        }
        slideshowsequencenumber = slideshowsequencenumber === '0' ? 0 : (slideshowsequencenumber === '' ? 'null' : (parseInt(slideshowsequencenumber) || ('invalid')));
        var slideshowshowname = '-1';
        if(jQuery('select#' + selectid + 'showname_' + slideshowid).length > 0) {
            slideshowshowname = jQuery('select#' + selectid + 'showname_' + slideshowid).val();
        }

        var slideshowshowdescription = '-1';
        if(jQuery('select#' + selectid + 'showdescription_' + slideshowid).length > 0) {
            slideshowshowdescription = jQuery('select#' + selectid + 'showdescription_' + slideshowid).val();
        }

        var slideshowstatus = '-1';
        if(jQuery('select#' + selectid + 'status_' + slideshowid).length > 0) {
            slideshowstatus = jQuery('select#' + selectid + 'status_' + slideshowid).val();
        }

        if(slideshowname === '' && slideshowdescription === '' && slideshowsequencenumber === 'null' && slideshowshowname === '-1' && slideshowshowdescription === '-1' && slideshowstatus === '-1') {
            return alert("Please enter a value.");
        }
        if(slideshowname === '' || slideshowstatus === '-1' || slideshowshowname === '-1' || slideshowshowdescription === '-1') {
            return alert("Name, showname, showdescription and status are required.");
        }
        if(slideshowsequencenumber === 'invalid') {
            return alert("Sequence number should be an integer.");
        }
        var slideshowstatusvalue = parseInt(slideshowstatus);
        var dataObj = {dragonecommercereservezyx987_hidden_security_saveslideshow:"<?php echo wp_create_nonce('dragonecommercereservezyx987_saveSlideshow'); ?>",dragonecommercereservezyx987_hidden:"Y",action:"dragonecommercereservezyx987_saveSlideshow",id: slideshowid};
        dataObj.name = slideshowname;
        dataObj.sequencenumber = slideshowsequencenumber;
        dataObj.showname = slideshowshowname;
        dataObj.showdescription = slideshowshowdescription;
        dataObj.description = slideshowdescription;
        dataObj.status = slideshowstatusvalue;
        jQuery.ajax({
            type: "POST",
            url: ajaxurl,
            data: dataObj
        }).done(function (mydata) {
            alert(mydata);
            if(mydata === 'Success') {
                dragonecommercereservezyx987_getSlideshowsList();
            }
        }).fail(function( jqXHR, textStatus ) {
            alert( "Slide show update failed: " + textStatus );
        });
    }

    function dragonecommercereservezyx987_deleteSlideshow(slideshowid) {
        if(confirm("Are you sure you want to delete this slideshow?") == true) {
            jQuery.ajax({
                type: "POST",
                url: ajaxurl,
                data: {dragonecommercereservezyx987_hidden_security_deleteslideshow:"<?php echo wp_create_nonce('dragonecommercereservezyx987_deleteSlideshow'); ?>",dragonecommercereservezyx987_hidden:"Y",action:"dragonecommercereservezyx987_deleteSlideshow",id:slideshowid}
            }).done(function (mydata) {
                alert(mydata);
                if(mydata === 'success') {
                    dragonecommercereservezyx987_getSlideshowsList();
                }
            }).fail(function( jqXHR, textStatus ) {
                alert( "Delete slideshow request failed: " + textStatus );
            });
            return true;
        }
        return false;
    }

    function dragonecommercereservezyx987_editHandling(handlingid, containerid) {
        if(jQuery('.' + containerid + handlingid).length > 0) {
            jQuery('.' + containerid + handlingid).toggle();
        }
    }

    function dragonecommercereservezyx987_saveHandling(handlingid, selectid) {
        var handlingname = '';
        if(jQuery('input#' + selectid + 'name_' + handlingid).length > 0) {
            handlingname = jQuery('input#' + selectid + 'name_' + handlingid).val();
        }
        var handlingshownname = '';
        if(jQuery('input#' + selectid + 'shownname_' + handlingid).length > 0) {
            handlingshownname = jQuery('input#' + selectid + 'shownname_' + handlingid).val();
        }
        var handlingdescription = '';
        if(jQuery('input#' + selectid + 'description_' + handlingid).length > 0) {
            handlingdescription = jQuery('input#' + selectid + 'description_' + handlingid).val();
        }
        var handlinguserate = '-1';
        if(jQuery('select#' + selectid + 'userate_' + handlingid).length > 0) {
            handlinguserate = jQuery('select#' + selectid + 'userate_' + handlingid).val();
        }
        var handlingrate = '';
        if(jQuery('input#' + selectid + 'rate_' + handlingid).length > 0) {
            handlingrate = jQuery('input#' + selectid + 'rate_' + handlingid).val();
        }
        handlingrate = parseFloat(handlingrate) || (-1);
        var handlingusefee = '-1';
        if(jQuery('select#' + selectid + 'usefee_' + handlingid).length > 0) {
            handlingusefee = jQuery('select#' + selectid + 'usefee_' + handlingid).val();
        }
        var handlingfee = '';
        if(jQuery('input#' + selectid + 'fee_' + handlingid).length > 0) {
            handlingfee = jQuery('input#' + selectid + 'fee_' + handlingid).val();
        }
        handlingfee = parseFloat(handlingfee) || (-1);
        var handlingminordersubtotal = '';
        if(jQuery('input#' + selectid + 'minordersubtotal_' + handlingid).length > 0) {
            handlingminordersubtotal = jQuery('input#' + selectid + 'minordersubtotal_' + handlingid).val();
        }
        handlingminordersubtotal = parseFloat(handlingminordersubtotal) || (-1);
        var handlingstart = '';
        if(jQuery('input#' + selectid + 'start_' + handlingid).length > 0) {
            handlingstart = jQuery.trim(jQuery('input#' + selectid + 'start_' + handlingid).val());
        }
        var handlingend = '';
        if(jQuery('input#' + selectid + 'end_' + handlingid).length > 0) {
            handlingend = jQuery.trim(jQuery('input#' + selectid + 'end_' + handlingid).val());
        }
        var handlingfromcountryid = '-1';
        if(jQuery('select#' + selectid + 'fromcountryid_' + handlingid).length > 0) {
            handlingfromcountryid = jQuery('select#' + selectid + 'fromcountryid_' + handlingid).val();
        }
        handlingfromcountryid = parseInt(handlingfromcountryid) || (-1);
        var handlingfromstateprovinceid = '-1';
        if(jQuery('select#' + selectid + 'fromstateprovinceid_' + handlingid).length > 0) {
            handlingfromstateprovinceid = jQuery('select#' + selectid + 'fromstateprovinceid_' + handlingid).val();
        }
        handlingfromstateprovinceid = parseInt(handlingfromstateprovinceid) || (-1);
        var handlingtocountryid = '-1';
        if(jQuery('select#' + selectid + 'tocountryid_' + handlingid).length > 0) {
            handlingtocountryid = jQuery('select#' + selectid + 'tocountryid_' + handlingid).val();
        }
        handlingtocountryid = parseInt(handlingtocountryid) || (-1);
        var handlingtostateprovinceid = '-1';
        if(jQuery('select#' + selectid + 'tostateprovinceid_' + handlingid).length > 0) {
            handlingtostateprovinceid = jQuery('select#' + selectid + 'tostateprovinceid_' + handlingid).val();
        }
        handlingtostateprovinceid = parseInt(handlingtostateprovinceid) || (-1);
        var handlingpriority = '';
        if(jQuery('input#' + selectid + 'priority_' + handlingid).length > 0) {
            handlingpriority = jQuery('input#' + selectid + 'priority_' + handlingid).val();
        }
        handlingpriority = handlingpriority === '0' ? 0 : (handlingpriority === '' ? 'null' : (parseInt(handlingpriority) || ('invalid')));
        var handlingstatus = '-1';
        if(jQuery('select#' + selectid + 'status_' + handlingid).length > 0) {
            handlingstatus = jQuery('select#' + selectid + 'status_' + handlingid).val();
        }

        if(handlingname === '' && handlingshownname === '' && handlingdescription === '' && handlingpriority < 0 
                  && handlinguserate === '-1' && (handlingrate < 0 || handlingrate > 1) 
                  && handlingusefee === '-1' && (handlingfee < 0) && (handlingminordersubtotal < 0) && handlingstart === '' && handlingend === ''
                  && handlingfromcountryid <= 0 && handlingfromstateprovinceid <= 0 
                  && handlingtocountryid <= 0 && handlingtostateprovinceid <= 0
                  && handlingstatus === '-1') {
            return alert("Please enter a value.");
        }
        if(dragonecommercereservezyx987_validateDateInput(handlingstart) && dragonecommercereservezyx987_validateDateInput(handlingend)) {
            if(handlingstart >     handlingend) {
                return alert("End date is earlier than start date.");
            }
        } else {
            return alert("Please enter a valid date.");
        }
        if(handlingpriority === 'invalid') {
            return alert("Priority should be an integer.");
        }
        var handlinguseratevalue = parseInt(handlinguserate);
        var handlingusefeevalue = parseInt(handlingusefee);
        var handlingstatusvalue = parseInt(handlingstatus);

        var dataObj = {dragonecommercereservezyx987_hidden_security_savehandling:"<?php echo wp_create_nonce('dragonecommercereservezyx987_saveHandling'); ?>",dragonecommercereservezyx987_hidden:"Y",action:"dragonecommercereservezyx987_saveHandling",id: handlingid};
        dataObj.name = handlingname;
        dataObj.shownname = handlingshownname;
        dataObj.description = handlingdescription;
        dataObj.priority = handlingpriority;
        dataObj.userate = handlinguseratevalue;
        dataObj.rate = handlingrate;
        dataObj.usefee = handlingusefeevalue;
        dataObj.fee = handlingfee;
        dataObj.minordersubtotal = handlingminordersubtotal;
        dataObj.start = handlingstart;
        dataObj.end = handlingend;
        dataObj.fromcountryid = handlingfromcountryid;
        dataObj.fromstateprovinceid = handlingfromstateprovinceid;
        dataObj.tocountryid = handlingtocountryid;
        dataObj.tostateprovinceid = handlingtostateprovinceid;
        dataObj.status = handlingstatusvalue;
        jQuery.ajax({
            type: "POST",
            url: ajaxurl,
            data: dataObj
        }).done(function (mydata) {
            alert(mydata);
            if(mydata === 'Success') {
                dragonecommercereservezyx987_getHandlingsList();
            }
        }).fail(function( jqXHR, textStatus ) {
            alert( "Handling update failed: " + textStatus );
        });
    }

    function dragonecommercereservezyx987_editShipping(shippingid, containerid) {
        if(jQuery('.' + containerid + shippingid).length > 0) {
            jQuery('.' + containerid + shippingid).toggle();
        }
    }

    function dragonecommercereservezyx987_saveShipping(shippingid, selectid) {
        var shippingname = '';
        if(jQuery('input#' + selectid + 'name_' + shippingid).length > 0) {
            shippingname = jQuery('input#' + selectid + 'name_' + shippingid).val();
        }
        var shippingshownname = '';
        if(jQuery('input#' + selectid + 'shownname_' + shippingid).length > 0) {
            shippingshownname = jQuery('input#' + selectid + 'shownname_' + shippingid).val();
        }
        var shippingdescription = '';
        if(jQuery('input#' + selectid + 'description_' + shippingid).length > 0) {
            shippingdescription = jQuery('input#' + selectid + 'description_' + shippingid).val();
        }
        var shippinguserate = '-1';
        if(jQuery('select#' + selectid + 'userate_' + shippingid).length > 0) {
            shippinguserate = jQuery('select#' + selectid + 'userate_' + shippingid).val();
        }
        var shippingrate = '';
        if(jQuery('input#' + selectid + 'rate_' + shippingid).length > 0) {
            shippingrate = jQuery('input#' + selectid + 'rate_' + shippingid).val();
        }
        shippingrate = parseFloat(shippingrate) || (-1);
        var shippingusefee = '-1';
        if(jQuery('select#' + selectid + 'usefee_' + shippingid).length > 0) {
            shippingusefee = jQuery('select#' + selectid + 'usefee_' + shippingid).val();
        }
        var shippingfee = '';
        if(jQuery('input#' + selectid + 'fee_' + shippingid).length > 0) {
            shippingfee = jQuery('input#' + selectid + 'fee_' + shippingid).val();
        }
        shippingfee = parseFloat(shippingfee) || (-1);
        var shippingminordersubtotal = '';
        if(jQuery('input#' + selectid + 'minordersubtotal_' + shippingid).length > 0) {
            shippingminordersubtotal = jQuery('input#' + selectid + 'minordersubtotal_' + shippingid).val();
        }
        shippingminordersubtotal = parseFloat(shippingminordersubtotal) || (-1);
        var shippingstart = '';
        if(jQuery('input#' + selectid + 'start_' + shippingid).length > 0) {
            shippingstart = jQuery.trim(jQuery('input#' + selectid + 'start_' + shippingid).val());
        }
        var shippingend = '';
        if(jQuery('input#' + selectid + 'end_' + shippingid).length > 0) {
            shippingend = jQuery.trim(jQuery('input#' + selectid + 'end_' + shippingid).val());
        }
        var shippingfromcountryid = '-1';
        if(jQuery('select#' + selectid + 'fromcountryid_' + shippingid).length > 0) {
            shippingfromcountryid = jQuery('select#' + selectid + 'fromcountryid_' + shippingid).val();
        }
        shippingfromcountryid = parseInt(shippingfromcountryid) || (-1);
        var shippingfromstateprovinceid = '-1';
        if(jQuery('select#' + selectid + 'fromstateprovinceid_' + shippingid).length > 0) {
            shippingfromstateprovinceid = jQuery('select#' + selectid + 'fromstateprovinceid_' + shippingid).val();
        }
        shippingfromstateprovinceid = parseInt(shippingfromstateprovinceid) || (-1);
        var shippingtocountryid = '-1';
        if(jQuery('select#' + selectid + 'tocountryid_' + shippingid).length > 0) {
            shippingtocountryid = jQuery('select#' + selectid + 'tocountryid_' + shippingid).val();
        }
        shippingtocountryid = parseInt(shippingtocountryid) || (-1);
        var shippingtostateprovinceid = '-1';
        if(jQuery('select#' + selectid + 'tostateprovinceid_' + shippingid).length > 0) {
            shippingtostateprovinceid = jQuery('select#' + selectid + 'tostateprovinceid_' + shippingid).val();
        }
        shippingtostateprovinceid = parseInt(shippingtostateprovinceid) || (-1);
        var shippingpriority = '';
        if(jQuery('input#' + selectid + 'priority_' + shippingid).length > 0) {
            shippingpriority = jQuery('input#' + selectid + 'priority_' + shippingid).val();
        }
        shippingpriority = shippingpriority === '0' ? 0 : (shippingpriority === '' ? 'null' : (parseInt(shippingpriority) || ('invalid')));
        var shippingstatus = '-1';
        if(jQuery('select#' + selectid + 'status_' + shippingid).length > 0) {
            shippingstatus = jQuery('select#' + selectid + 'status_' + shippingid).val();
        }

        if(shippingname === '' && shippingshownname === '' && shippingdescription === '' && shippingpriority === 'null' 
                  && shippinguserate === '-1' && (shippingrate < 0 || shippingrate > 1) 
                  && shippingusefee === '-1' && (shippingfee < 0) && (shippingminordersubtotal < 0) && shippingstart === '' && shippingend === ''
                  && shippingfromcountryid <= 0 && shippingfromstateprovinceid <= 0 
                  && shippingtocountryid <= 0 && shippingtostateprovinceid <= 0
                  && shippingstatus === '-1') {
            return alert("Please enter a value.");
        }
        if(dragonecommercereservezyx987_validateDateInput(shippingstart) && dragonecommercereservezyx987_validateDateInput(shippingend)) {
            if(shippingstart >     shippingend) {
                return alert("End date is earlier than start date.");
            }
        } else {
            return alert("Please enter a valid date.");
        }
        if(shippingpriority === 'invalid') {
            return alert("Priority should be an integer.");
        }

        var shippinguseratevalue = parseInt(shippinguserate);
        var shippingusefeevalue = parseInt(shippingusefee);
        var shippingstatusvalue = parseInt(shippingstatus);

        var dataObj = {dragonecommercereservezyx987_hidden_security_saveshipping:"<?php echo wp_create_nonce('dragonecommercereservezyx987_saveShipping'); ?>",dragonecommercereservezyx987_hidden:"Y",action:"dragonecommercereservezyx987_saveShipping",id: shippingid};
        dataObj.name = shippingname;
        dataObj.shownname = shippingshownname;
        dataObj.description = shippingdescription;
        dataObj.priority = shippingpriority;
        dataObj.userate = shippinguseratevalue;
        dataObj.rate = shippingrate;
        dataObj.usefee = shippingusefeevalue;
        dataObj.fee = shippingfee;
        dataObj.minordersubtotal = shippingminordersubtotal;
        dataObj.start = shippingstart;
        dataObj.end = shippingend;
        dataObj.fromcountryid = shippingfromcountryid;
        dataObj.fromstateprovinceid = shippingfromstateprovinceid;
        dataObj.tocountryid = shippingtocountryid;
        dataObj.tostateprovinceid = shippingtostateprovinceid;
        dataObj.status = shippingstatusvalue;
        jQuery.ajax({
            type: "POST",
            url: ajaxurl,
            data: dataObj
        }).done(function (mydata) {
            alert(mydata);
            if(mydata === 'Success') {
                dragonecommercereservezyx987_getShippingsList();
            }
        }).fail(function( jqXHR, textStatus ) {
            alert( "Shipping update failed: " + textStatus );
        });
    }

    function dragonecommercereservezyx987_editTax(taxid, containerid) {
        if(jQuery('.' + containerid + taxid).length > 0) {
            jQuery('.' + containerid + taxid).toggle();
        }
    }

    function dragonecommercereservezyx987_saveTax(taxid, selectid) {
        var taxname = '';
        if(jQuery('input#' + selectid + 'name_' + taxid).length > 0) {
            taxname = jQuery('input#' + selectid + 'name_' + taxid).val();
        }
        var taxshownname = '';
        if(jQuery('input#' + selectid + 'shownname_' + taxid).length > 0) {
            taxshownname = jQuery('input#' + selectid + 'shownname_' + taxid).val();
        }
        var taxdescription = '';
        if(jQuery('input#' + selectid + 'description_' + taxid).length > 0) {
            taxdescription = jQuery('input#' + selectid + 'description_' + taxid).val();
        }
        var taxuserate = '-1';
        if(jQuery('select#' + selectid + 'userate_' + taxid).length > 0) {
            taxuserate = jQuery('select#' + selectid + 'userate_' + taxid).val();
        }
        var taxrate = '';
        if(jQuery('input#' + selectid + 'rate_' + taxid).length > 0) {
            taxrate = jQuery('input#' + selectid + 'rate_' + taxid).val();
        }
        taxrate = parseFloat(taxrate) || (-1);
        var taxusefee = '-1';
        if(jQuery('select#' + selectid + 'usefee_' + taxid).length > 0) {
            taxusefee = jQuery('select#' + selectid + 'usefee_' + taxid).val();
        }
        var taxfee = '';
        if(jQuery('input#' + selectid + 'fee_' + taxid).length > 0) {
            taxfee = jQuery('input#' + selectid + 'fee_' + taxid).val();
        }
        taxfee = parseFloat(taxfee) || (-1);
        var taxminordersubtotal = '';
        if(jQuery('input#' + selectid + 'minordersubtotal_' + taxid).length > 0) {
            taxminordersubtotal = jQuery('input#' + selectid + 'minordersubtotal_' + taxid).val();
        }
        taxminordersubtotal = parseFloat(taxminordersubtotal) || (-1);
        var taxstart = '';
        if(jQuery('input#' + selectid + 'start_' + taxid).length > 0) {
            taxstart = jQuery.trim(jQuery('input#' + selectid + 'start_' + taxid).val());
        }
        var taxend = '';
        if(jQuery('input#' + selectid + 'end_' + taxid).length > 0) {
            taxend = jQuery.trim(jQuery('input#' + selectid + 'end_' + taxid).val());
        }
        var taxfromcountryid = '-1';
        if(jQuery('select#' + selectid + 'fromcountryid_' + taxid).length > 0) {
            taxfromcountryid = jQuery('select#' + selectid + 'fromcountryid_' + taxid).val();
        }
        taxfromcountryid = parseInt(taxfromcountryid) || (-1);
        var taxfromstateprovinceid = '-1';
        if(jQuery('select#' + selectid + 'fromstateprovinceid_' + taxid).length > 0) {
            taxfromstateprovinceid = jQuery('select#' + selectid + 'fromstateprovinceid_' + taxid).val();
        }
        taxfromstateprovinceid = parseInt(taxfromstateprovinceid) || (-1);
        var taxtocountryid = '-1';
        if(jQuery('select#' + selectid + 'tocountryid_' + taxid).length > 0) {
            taxtocountryid = jQuery('select#' + selectid + 'tocountryid_' + taxid).val();
        }
        taxtocountryid = parseInt(taxtocountryid) || (-1);
        var taxtostateprovinceid = '-1';                            
        if(jQuery('select#' + selectid + 'tostateprovinceid_' + taxid).length > 0) {
            taxtostateprovinceid = jQuery('select#' + selectid + 'tostateprovinceid_' + taxid).val();
        }
        taxtostateprovinceid = parseInt(taxtostateprovinceid) || (-1);
        var taxtaxincludeshipping = '-1';
        if(jQuery('select#' + selectid + 'taxincludeshipping_' + taxid).length > 0) {
            taxtaxincludeshipping = jQuery('select#' + selectid + 'taxincludeshipping_' + taxid).val();
        }
        var taxtaxincludehandling = '-1';
        if(jQuery('select#' + selectid + 'taxincludehandling_' + taxid).length > 0) {
            taxtaxincludehandling = jQuery('select#' + selectid + 'taxincludehandling_' + taxid).val();
        }
        var taxpriority = '';
        if(jQuery('input#' + selectid + 'priority_' + taxid).length > 0) {
            taxpriority = jQuery('input#' + selectid + 'priority_' + taxid).val();    
        }
        taxpriority = taxpriority === '0' ? 0 : (taxpriority === '' ? 'null' : (parseInt(taxpriority) || ('invalid')));
        var taxstatus = '-1';
        if(jQuery('select#' + selectid + 'status_' + taxid).length > 0) {
            taxstatus = jQuery('select#' + selectid + 'status_' + taxid).val();
        }

        if(taxname === '' && taxshownname === '' && taxdescription === '' && taxpriority === 'null'  
                  && taxuserate === '-1' && (taxrate < 0 || taxrate > 1) 
                  && taxusefee === '-1' && (taxfee < 0) && (taxminordersubtotal < 0) && taxstart === '' && taxend === ''
                  && taxfromcountryid <= 0 && taxfromstateprovinceid <= 0 
                  && taxtocountryid <= 0 && taxtostateprovinceid <= 0
                  && taxtaxincludeshipping === '-1' && taxtaxincludehandling === '-1' && taxstatus === '-1') {
            return alert("Please enter a value.");
        }
        if(dragonecommercereservezyx987_validateDateInput(taxstart) && dragonecommercereservezyx987_validateDateInput(taxend)) {
            if(taxstart > taxend) {
                return alert("End date is earlier than start date.");
            }
        } else {
            return alert("Please enter a valid date.");
        }
        if(taxpriority === 'invalid') {
            return alert("Priority should be an integer.");
        }

        var taxuseratevalue = parseInt(taxuserate);
        var taxusefeevalue = parseInt(taxusefee);
        var taxstatusvalue = parseInt(taxstatus);
        var taxtaxincludeshippingvalue = parseInt(taxtaxincludeshipping);
        var taxtaxincludehandlingvalue = parseInt(taxtaxincludehandling);

        var dataObj = {dragonecommercereservezyx987_hidden_security_savetax:"<?php echo wp_create_nonce('dragonecommercereservezyx987_saveTax'); ?>",dragonecommercereservezyx987_hidden:"Y",action:"dragonecommercereservezyx987_saveTax",id: taxid};
        dataObj.name = taxname;
        dataObj.shownname = taxshownname;
        dataObj.description = taxdescription;
        dataObj.priority = taxpriority;
        dataObj.userate = taxuseratevalue;
        dataObj.rate = taxrate;
        dataObj.usefee = taxusefeevalue;
        dataObj.fee = taxfee;
        dataObj.minordersubtotal = taxminordersubtotal;
        dataObj.start = taxstart;
        dataObj.end = taxend;
        dataObj.fromcountryid = taxfromcountryid;
        dataObj.fromstateprovinceid = taxfromstateprovinceid;
        dataObj.tocountryid = taxtocountryid;
        dataObj.tostateprovinceid = taxtostateprovinceid;
        dataObj.taxincludeshipping = taxtaxincludeshippingvalue;
        dataObj.taxincludehandling = taxtaxincludehandlingvalue;
        dataObj.status = taxstatusvalue;
        jQuery.ajax({
            type: "POST",
            url: ajaxurl,
            data: dataObj
        }).done(function (mydata) {
            alert(mydata);
            if(mydata === 'Success') {
                dragonecommercereservezyx987_getTaxesList();
            }
        }).fail(function( jqXHR, textStatus ) {
            alert( "Tax update failed: " + textStatus );
        });
    }

    function dragonecommercereservezyx987_editDiscount(discountid, containerid) {
        if(jQuery('.' + containerid + discountid).length > 0) {
            jQuery('.' + containerid + discountid).toggle();
        }
    }

    function dragonecommercereservezyx987_saveDiscount(discountid, selectid) {
        var discountname = '';
        if(jQuery('input#' + selectid + 'name_' + discountid).length > 0) {
            discountname = jQuery('input#' + selectid + 'name_' + discountid).val();
        }
        var discountshownname = '';
        if(jQuery('input#' + selectid + 'shownname_' + discountid).length > 0) {
            discountshownname = jQuery('input#' + selectid + 'shownname_' + discountid).val();
        }
        var discountdescription = '';
        if(jQuery('input#' + selectid + 'description_' + discountid).length > 0) {
            discountdescription = jQuery('input#' + selectid + 'description_' + discountid).val();
        }
        var discountuserate = '-1';
        if(jQuery('select#' + selectid + 'userate_' + discountid).length > 0) {
            discountuserate = jQuery('select#' + selectid + 'userate_' + discountid).val();
        }
        var discountrate = '';
        if(jQuery('input#' + selectid + 'rate_' + discountid).length > 0) {
            discountrate = jQuery('input#' + selectid + 'rate_' + discountid).val();
        }
        discountrate = parseFloat(discountrate) || (-1);
        var discountusefee = '-1';
        if(jQuery('select#' + selectid + 'usefee_' + discountid).length > 0) {
            discountusefee = jQuery('select#' + selectid + 'usefee_' + discountid).val();
        }
        var discountfee = '';
        if(jQuery('input#' + selectid + 'fee_' + discountid).length > 0) {
            discountfee = jQuery('input#' + selectid + 'fee_' + discountid).val();
        }
        discountfee = parseFloat(discountfee) || (-1);
        var discountminordersubtotal = '';
        if(jQuery('input#' + selectid + 'minordersubtotal_' + discountid).length > 0) {
            discountminordersubtotal = jQuery('input#' + selectid + 'minordersubtotal_' + discountid).val();
        }
        discountminordersubtotal = parseFloat(discountminordersubtotal) || (-1);
        var discountstart = '';
        if(jQuery('input#' + selectid + 'start_' + discountid).length > 0) {
            discountstart = jQuery.trim(jQuery('input#' + selectid + 'start_' + discountid).val());
        }
        var discountend = '';
        if(jQuery('input#' + selectid + 'end_' + discountid).length > 0) {
            discountend = jQuery.trim(jQuery('input#' + selectid + 'end_' + discountid).val());
        }
        var discountfromcountryid = '-1';
        if(jQuery('select#' + selectid + 'fromcountryid_' + discountid).length > 0) {
            discountfromcountryid = jQuery('select#' + selectid + 'fromcountryid_' + discountid).val();
        }
        discountfromcountryid = parseInt(discountfromcountryid) || (-1);
        var discountfromstateprovinceid = '-1';
        if(jQuery('select#' + selectid + 'fromstateprovinceid_' + discountid).length > 0) {
            discountfromstateprovinceid = jQuery('select#' + selectid + 'fromstateprovinceid_' + discountid).val();
        }
        discountfromstateprovinceid = parseInt(discountfromstateprovinceid) || (-1);
        var discounttocountryid = '-1';
        if(jQuery('select#' + selectid + 'tocountryid_' + discountid).length > 0) {
            discounttocountryid = jQuery('select#' + selectid + 'tocountryid_' + discountid).val();
        }
        discounttocountryid = parseInt(discounttocountryid) || (-1);
        var discounttostateprovinceid = '-1';
        if(jQuery('select#' + selectid + 'tostateprovinceid_' + discountid).length > 0) {
            discounttostateprovinceid = jQuery('select#' + selectid + 'tostateprovinceid_' + discountid).val();
        }
        discounttostateprovinceid = parseInt(discounttostateprovinceid) || (-1);
        var discountpriority = '';
        if(jQuery('input#' + selectid + 'priority_' + discountid).length > 0) {
            discountpriority = jQuery('input#' + selectid + 'priority_' + discountid).val();
        }
        discountpriority = discountpriority === '0' ? 0 : (discountpriority === '' ? 'null' : (parseInt(discountpriority) || ('invalid')));
        var discountstatus = '-1';
        if(jQuery('select#' + selectid + 'status_' + discountid).length > 0) {
            discountstatus = jQuery('select#' + selectid + 'status_' + discountid).val();
        }

        if(discountname === '' && discountshownname === '' && discountdescription === '' && discountpriority === 'null'
                  && discountuserate === '-1' && (discountrate < 0 || discountrate > 1) 
                  && discountusefee === '-1' && (discountfee < 0) && (discountminordersubtotal < 0) && discountstart === '' && discountend === ''
                  && discountfromcountryid <= 0 && discountfromstateprovinceid <= 0 
                  && discounttocountryid <= 0 && discounttostateprovinceid <= 0
                  && discountstatus === '-1') {
            return alert("Please enter a value.");
        }
        if(dragonecommercereservezyx987_validateDateInput(discountstart) && dragonecommercereservezyx987_validateDateInput(discountend)) {
            if(discountstart > discountend) {
                return alert("End date is earlier than start date.");
            }
        } else {
            return alert("Please enter a valid date.");
        }
        if(discountpriority === 'invalid') {
            return alert("Priority should be an integer.");
        }

        var discountuseratevalue = parseInt(discountuserate);
        var discountusefeevalue = parseInt(discountusefee);
        var discountstatusvalue = parseInt(discountstatus);

        var dataObj = {dragonecommercereservezyx987_hidden_security_savediscount:"<?php echo wp_create_nonce('dragonecommercereservezyx987_saveDiscount'); ?>",dragonecommercereservezyx987_hidden:"Y",action:"dragonecommercereservezyx987_saveDiscount",id: discountid};
        dataObj.name = discountname;
        dataObj.shownname = discountshownname;
        dataObj.description = discountdescription;
        dataObj.priority = discountpriority;
        dataObj.userate = discountuseratevalue;
        dataObj.rate = discountrate;
        dataObj.usefee = discountusefeevalue;
        dataObj.fee = discountfee;
        dataObj.minordersubtotal = discountminordersubtotal;
        dataObj.start = discountstart;
        dataObj.end = discountend;
        dataObj.fromcountryid = discountfromcountryid;
        dataObj.fromstateprovinceid = discountfromstateprovinceid;
        dataObj.tocountryid = discounttocountryid;
        dataObj.tostateprovinceid = discounttostateprovinceid;
        dataObj.status = discountstatusvalue;
        jQuery.ajax({
            type: "POST",
            url: ajaxurl,
            data: dataObj
        }).done(function (mydata) {
            alert(mydata);
            if(mydata === 'Success') {
                dragonecommercereservezyx987_getDiscountsList();
            }
        }).fail(function( jqXHR, textStatus ) {
            alert( "Discount update failed: " + textStatus );
        });
    }

    function dragonecommercereservezyx987_editCoupon(couponid, containerid) {
        if(jQuery('.' + containerid + couponid).length > 0) {
            jQuery('.' + containerid + couponid).toggle();
        }
    }

    function dragonecommercereservezyx987_saveCoupon(couponid, selectid) {
        var couponname = '';
        if(jQuery('input#' + selectid + 'name_' + couponid).length > 0) {
            couponname = jQuery('input#' + selectid + 'name_' + couponid).val();
        }
        var couponshownname = '';
        if(jQuery('input#' + selectid + 'shownname_' + couponid).length > 0) {
            couponshownname = jQuery('input#' + selectid + 'shownname_' + couponid).val();
        }
        var coupondescription = '';
        if(jQuery('input#' + selectid + 'description_' + couponid).length > 0) {
            coupondescription = jQuery('input#' + selectid + 'description_' + couponid).val();
        }
        var couponcode = '';
        if(jQuery('input#' + selectid + 'code_' + couponid).length > 0) {
            couponcode = jQuery('input#' + selectid + 'code_' + couponid).val();
        }
        var couponuserate = '-1';
        if(jQuery('select#' + selectid + 'userate_' + couponid).length > 0) {
            couponuserate = jQuery('select#' + selectid + 'userate_' + couponid).val();
        }
        var couponrate = '';
        if(jQuery('input#' + selectid + 'rate_' + couponid).length > 0) {
            couponrate = jQuery('input#' + selectid + 'rate_' + couponid).val();
        }
        couponrate = parseFloat(couponrate) || (-1);
        var couponusefee = '-1';
        if(jQuery('select#' + selectid + 'usefee_' + couponid).length > 0) {
            couponusefee = jQuery('select#' + selectid + 'usefee_' + couponid).val();
        }
        var couponfee = '';
        if(jQuery('input#' + selectid + 'fee_' + couponid).length > 0) {
            couponfee = jQuery('input#' + selectid + 'fee_' + couponid).val();
        }
        couponfee = parseFloat(couponfee) || (-1);
        var couponminordersubtotal = '';
        if(jQuery('input#' + selectid + 'minordersubtotal_' + couponid).length > 0) {
            couponminordersubtotal = jQuery('input#' + selectid + 'minordersubtotal_' + couponid).val();
        }
        couponminordersubtotal = parseFloat(couponminordersubtotal) || (-1);
        var couponstart = '';
        if(jQuery('input#' + selectid + 'start_' + couponid).length > 0) {
            couponstart = jQuery.trim(jQuery('input#' + selectid + 'start_' + couponid).val());
        }
        var couponend = '';
        if(jQuery('input#' + selectid + 'end_' + couponid).length > 0) {
            couponend = jQuery.trim(jQuery('input#' + selectid + 'end_' + couponid).val());
        }
        var couponfromcountryid = '-1';
        if(jQuery('select#' + selectid + 'fromcountryid_' + couponid).length > 0) {
            couponfromcountryid = jQuery('select#' + selectid + 'fromcountryid_' + couponid).val();
        }
        couponfromcountryid = parseInt(couponfromcountryid) || (-1);
        var couponfromstateprovinceid = '-1';
        if(jQuery('select#' + selectid + 'fromstateprovinceid_' + couponid).length > 0) {
            couponfromstateprovinceid = jQuery('select#' + selectid + 'fromstateprovinceid_' + couponid).val();
        }
        couponfromstateprovinceid = parseInt(couponfromstateprovinceid) || (-1);
        var coupontocountryid = '-1';
        if(jQuery('select#' + selectid + 'tocountryid_' + couponid).length > 0) {
            coupontocountryid = jQuery('select#' + selectid + 'tocountryid_' + couponid).val();
        }
        coupontocountryid = parseInt(coupontocountryid) || (-1);
        var coupontostateprovinceid = '-1';
        if(jQuery('select#' + selectid + 'tostateprovinceid_' + couponid).length > 0) {
            coupontostateprovinceid = jQuery('select#' + selectid + 'tostateprovinceid_' + couponid).val();
        }
        coupontostateprovinceid = parseInt(coupontostateprovinceid) || (-1);
        var couponpriority = '';
        if(jQuery('input#' + selectid + 'priority_' + couponid).length > 0) {
            couponpriority = jQuery('input#' + selectid + 'priority_' + couponid).val();
        }
        couponpriority = couponpriority === '0' ? 0 : (couponpriority === '' ? 'null' : (parseInt(couponpriority) || ('invalid')));
        var couponstatus = '-1';
        if(jQuery('select#' + selectid + 'status_' + couponid).length > 0) {
            couponstatus = jQuery('select#' + selectid + 'status_' + couponid).val();
        }

        if(couponname === '' && couponshownname === '' && coupondescription === '' && couponcode === '' && couponpriority === 'null' 
                  && couponuserate === '-1' && (couponrate < 0 || couponrate > 1) 
                  && couponusefee === '-1' && (couponfee < 0) && (couponminordersubtotal < 0) && couponstart === '' && couponend === ''
                  && couponfromcountryid <= 0 && couponfromstateprovinceid <= 0 
                  && coupontocountryid <= 0 && coupontostateprovinceid <= 0
                  && couponstatus === '-1') {
            return alert("Please enter a value.");
        }
        if(dragonecommercereservezyx987_validateDateInput(couponstart) && dragonecommercereservezyx987_validateDateInput(couponend)) {
            if(couponstart > couponend) {
                return alert("End date is earlier than start date.");
            }
        } else {
            return alert("Please enter a valid date.");
        }
        if(couponpriority === 'invalid') {
            return alert("Priority should be an integer.");
        }

        var couponuseratevalue = parseInt(couponuserate);
        var couponusefeevalue = parseInt(couponusefee);
        var couponstatusvalue = parseInt(couponstatus);

        var dataObj = {dragonecommercereservezyx987_hidden_security_savecoupon:"<?php echo wp_create_nonce('dragonecommercereservezyx987_saveCoupon'); ?>",dragonecommercereservezyx987_hidden:"Y",action:"dragonecommercereservezyx987_saveCoupon",id: couponid};
        dataObj.name = couponname;
        dataObj.shownname = couponshownname;
        dataObj.description = coupondescription;
        dataObj.code = couponcode;
        dataObj.priority = couponpriority;
        dataObj.userate = couponuseratevalue;
        dataObj.rate = couponrate;
        dataObj.usefee = couponusefeevalue;
        dataObj.fee = couponfee;
        dataObj.minordersubtotal = couponminordersubtotal;
        dataObj.start = couponstart;
        dataObj.end = couponend;
        dataObj.fromcountryid = couponfromcountryid;
        dataObj.fromstateprovinceid = couponfromstateprovinceid;
        dataObj.tocountryid = coupontocountryid;
        dataObj.tostateprovinceid = coupontostateprovinceid;
        dataObj.status = couponstatusvalue;
        jQuery.ajax({
            type: "POST",
            url: ajaxurl,
            data: dataObj
        }).done(function (mydata) {
            alert(mydata);
            if(mydata === 'Success') {
                dragonecommercereservezyx987_getCouponsList();
            }
        }).fail(function( jqXHR, textStatus ) {
            alert( "Coupon update failed: " + textStatus );
        });
    }

    function dragonecommercereservezyx987_editPropertyvalue(propertyvalueid, containerid) {
        if(jQuery('.' + containerid + propertyvalueid).length > 0) {
            jQuery('.' + containerid + propertyvalueid).toggle();
        }
    }

    function dragonecommercereservezyx987_savePropertyvalue(propertyvalueid, selectid) {
        var propertyvaluename = '';
        if(jQuery('input#' + selectid + 'name_' + propertyvalueid).length > 0) {
            propertyvaluename = jQuery('input#' + selectid + 'name_' + propertyvalueid).val();
        }
        var propertyvalueshownname = '';
        if(jQuery('input#' + selectid + 'shownname_' + propertyvalueid).length > 0) {
            propertyvalueshownname = jQuery('input#' + selectid + 'shownname_' + propertyvalueid).val();
        }
        var propertyvaluedescription = '';
        if(jQuery('input#' + selectid + 'description_' + propertyvalueid).length > 0) {
            propertyvaluedescription = jQuery('input#' + selectid + 'description_' + propertyvalueid).val();
        }
        var propertyvalueuserate = '-1';
        if(jQuery('select#' + selectid + 'userate_' + propertyvalueid).length > 0) {
            propertyvalueuserate = jQuery('select#' + selectid + 'userate_' + propertyvalueid).val();
        }
        var propertyvaluerate = '';
        if(jQuery('input#' + selectid + 'rate_' + propertyvalueid).length > 0) {
            propertyvaluerate = jQuery('input#' + selectid + 'rate_' + propertyvalueid).val();    
        }
        propertyvaluerate = parseFloat(propertyvaluerate) || (-1);
        var propertyvalueusefee = '-1';
        if(jQuery('select#' + selectid + 'usefee_' + propertyvalueid).length > 0) {
            propertyvalueusefee = jQuery('select#' + selectid + 'usefee_' + propertyvalueid).val();
        }
        var propertyvaluefee = '';
        if(jQuery('input#' + selectid + 'fee_' + propertyvalueid).length > 0) {
            propertyvaluefee = jQuery('input#' + selectid + 'fee_' + propertyvalueid).val();
        }
        propertyvaluefee = parseFloat(propertyvaluefee) || (-1);
        var propertyvalueminordersubtotal = '';
        if(jQuery('input#' + selectid + 'minordersubtotal_' + propertyvalueid).length > 0) {
            propertyvalueminordersubtotal = jQuery('input#' + selectid + 'minordersubtotal_' + propertyvalueid).val();
        }
        propertyvalueminordersubtotal = parseFloat(propertyvalueminordersubtotal) || (-1);
        var propertyvaluestart = '';
        if(jQuery('input#' + selectid + 'start_' + propertyvalueid).length > 0) {
            propertyvaluestart = jQuery.trim(jQuery('input#' + selectid + 'start_' + propertyvalueid).val());
        }
        var propertyvalueend = '';
        if(jQuery('input#' + selectid + 'end_' + propertyvalueid).length > 0) {
            propertyvalueend = jQuery.trim(jQuery('input#' + selectid + 'end_' + propertyvalueid).val());
        }
        var propertyvaluefromcountryid = '-1';
        if(jQuery('select#' + selectid + 'fromcountryid_' + propertyvalueid).length > 0) {
            propertyvaluefromcountryid = jQuery('select#' + selectid + 'fromcountryid_' + propertyvalueid).val();
        }
        propertyvaluefromcountryid = parseInt(propertyvaluefromcountryid) || (-1);
        var propertyvaluefromstateprovinceid = '-1';
        if(jQuery('select#' + selectid + 'fromstateprovinceid_' + propertyvalueid).length > 0) {
            propertyvaluefromstateprovinceid = jQuery('select#' + selectid + 'fromstateprovinceid_' + propertyvalueid).val();
        }
        propertyvaluefromstateprovinceid = parseInt(propertyvaluefromstateprovinceid) || (-1);
        var propertyvaluetocountryid = '-1';
        if(jQuery('select#' + selectid + 'tocountryid_' + propertyvalueid).length > 0) {
            propertyvaluetocountryid = jQuery('select#' + selectid + 'tocountryid_' + propertyvalueid).val();
        }
        propertyvaluetocountryid = parseInt(propertyvaluetocountryid) || (-1);
        var propertyvaluetostateprovinceid = '-1';
        if(jQuery('select#' + selectid + 'tostateprovinceid_' + propertyvalueid).length > 0) {
            propertyvaluetostateprovinceid = jQuery('select#' + selectid + 'tostateprovinceid_' + propertyvalueid).val();
        }
        propertyvaluetostateprovinceid = parseInt(propertyvaluetostateprovinceid) || (-1);
        var propertyvaluepriority = '';
        if(jQuery('input#' + selectid + 'priority_' + propertyvalueid).length > 0) {
            propertyvaluepriority = jQuery('input#' + selectid + 'priority_' + propertyvalueid).val();
        }
        propertyvaluepriority = propertyvaluepriority === '0' ? 0 : (propertyvaluepriority === '' ? 'null' : (parseInt(propertyvaluepriority) || ('invalid')));
        var propertyvaluestatus = '-1';
        if(jQuery('select#' + selectid + 'status_' + propertyvalueid).length > 0) {
            propertyvaluestatus = jQuery('select#' + selectid + 'status_' + propertyvalueid).val();
        }
        var propertyvaluepropertyid = '';
        if(jQuery('input#' + selectid + 'propertyid_' + propertyvalueid).length > 0) {
            propertyvaluepropertyid = jQuery('input#' + selectid + 'propertyid_' + propertyvalueid).val();
        }
        propertyvaluepropertyid = parseInt(propertyvaluepropertyid) || (-1);
        if(propertyvaluename === '' && propertyvalueshownname === '' && propertyvaluedescription === '' && propertyvaluepriority === 'null' 
                  && propertyvalueuserate === '-1' && (propertyvaluerate < 0 || propertyvaluerate > 1) 
                  && propertyvalueusefee === '-1' && (propertyvaluefee < 0) && (propertyvalueminordersubtotal < 0) && propertyvaluestart === '' && propertyvalueend === ''
                  && propertyvaluefromcountryid <= 0 && propertyvaluefromstateprovinceid <= 0 
                  && propertyvaluetocountryid <= 0 && propertyvaluetostateprovinceid <= 0
                  && propertyvaluestatus === '-1') {
            return alert("Please enter a value.");
        }
        if(dragonecommercereservezyx987_validateDateInput(propertyvaluestart) && dragonecommercereservezyx987_validateDateInput(propertyvalueend)) {
            if(propertyvaluestart > propertyvalueend) {
                return alert("End date is earlier than start date.");
            }
        } else {
            return alert("Please enter a valid date.");
        }
        if(propertyvaluepriority === 'invalid') {
            return alert("Priority should be an integer.");
        }

        var propertyvalueuseratevalue = parseInt(propertyvalueuserate);
        var propertyvalueratevalue = parseFloat(propertyvaluerate);

        var propertyvalueusefeevalue = parseInt(propertyvalueusefee);
        var propertyvaluefeevalue = parseFloat(propertyvaluefee);

        var propertyvaluestatusvalue = parseInt(propertyvaluestatus);

        var dataObj = {dragonecommercereservezyx987_hidden_security_savepropertyvalue:"<?php echo wp_create_nonce('dragonecommercereservezyx987_savePropertyvalue'); ?>",dragonecommercereservezyx987_hidden:"Y",action:"dragonecommercereservezyx987_savePropertyvalue",id: propertyvalueid};
        dataObj.name = propertyvaluename;
        dataObj.shownname = propertyvalueshownname;
        dataObj.description = propertyvaluedescription;
        dataObj.priority = propertyvaluepriority;
        dataObj.userate = propertyvalueuseratevalue;
        dataObj.rate = propertyvalueratevalue;
        dataObj.usefee = propertyvalueusefeevalue;
        dataObj.fee = propertyvaluefeevalue;
        dataObj.minordersubtotal = propertyvalueminordersubtotal;
        dataObj.start = propertyvaluestart;
        dataObj.end = propertyvalueend;
        dataObj.fromcountryid = propertyvaluefromcountryid;
        dataObj.fromstateprovinceid = propertyvaluefromstateprovinceid;
        dataObj.tocountryid = propertyvaluetocountryid;
        dataObj.tostateprovinceid = propertyvaluetostateprovinceid;
        dataObj.status = propertyvaluestatusvalue;
        dataObj.propertyid = propertyvaluepropertyid;
        jQuery.ajax({
            type: "POST",
            url: ajaxurl,
            data: dataObj
        }).done(function (mydata) {
            alert(mydata);
            if(mydata === 'Success') {
                dragonecommercereservezyx987_getPropertyvaluesList();
            }
        }).fail(function( jqXHR, textStatus ) {
            alert( "Property value update failed: " + textStatus );
        });
    }

    // a - amount per page; o - order (asc, desc); p - page number; s - sortby
    function dragonecommercereservezyx987_createPagination(totalpagenumber, topagenumber, itemname) {
        if(totalpagenumber !== parseInt(totalpagenumber, 10) || topagenumber !== parseInt(topagenumber, 10)) {jQuery('div.master_pwrapper > div.master_mypagination').html('');return;}
        var temp = '<ul class="pagination">',i;
        if(topagenumber > totalpagenumber) {
            topagenumber = 1;
            totalpagenumber=1;
        }
        if(totalpagenumber < 7) {
            if(topagenumber===1) {
                temp += '<li class="page-item disabled"><a class="page-link" aria-label="previous page, button is disabled" role="img" ><span aria-hidden="true">&laquo;</span></a></li>';
            } else {
                temp += '<li class="page-item prev"><a class="page-link" tabindex="0"  aria-label="previous page" role="img" ><span aria-hidden="true">&laquo;</span></a></li>';
            }
            for(i=1;i<=totalpagenumber;i++) {
                temp += '<li' + (topagenumber===i ? ' class="page-item active" ' : ' class="page-item" ') + '><a class="page-link" role="button" tabindex="0" >' + i + '</a></li>';
            }
            if(topagenumber===totalpagenumber) {
                temp += '<li class="page-item disabled"><a class="page-link" aria-label="next page, button is disabled" role="img" ><span aria-hidden="true">&raquo;</span></a></li>';
            } else {
                temp += '<li class="page-item next"><a class="page-link" tabindex="0" aria-label="next page" role="img" ><span aria-hidden="true">&raquo;</span></a></li>';
            }
        } else if(topagenumber < 4) {
            if(topagenumber===1) {
                temp += '<li class="page-item disabled"><a class="page-link" aria-label="previous page, button is disabled" role="img" ><span aria-hidden="true">&laquo;</span></a></li>';
            } else {
                temp += '<li class="page-item prev"><a class="page-link" tabindex="0" aria-label="previous page" role="img" ><span aria-hidden="true">&laquo;</span></a></li>';
            }
            for(i=1;i<=5;i++) {
                temp += '<li' + (topagenumber===i ? ' class="page-item active" ' : ' class="page-item" ') + '><a class="page-link" role="button" tabindex="0" >' + i + '</a></li>';
            }
            temp += ((totalpagenumber - topagenumber) > 3) ? '<li class="page-item noborder"><a class="page-link" >...</a></li>' : '';
            if(topagenumber===totalpagenumber) {
                temp += '<li class="page-item active" ><a class="page-link" role="button" tabindex="0" >' + totalpagenumber + '</a></li><li class="page-item disabled"><a class="page-link" aria-label="next page, button is disabled" role="img" ><span aria-hidden="true">&raquo;</span></a></li>';
            } else {
                temp += '<li class="page-item"><a class="page-link" role="button" tabindex="0" >' + totalpagenumber + '</a></li><li class="page-item next"><a class="page-link" tabindex="0" aria-label="next page" role="img"><span aria-hidden="true">&raquo;</span></a></li>';
            }
        } else if(topagenumber < (totalpagenumber - 2)) {
            if(topagenumber===1) {
                temp += '<li class="page-item disabled"><a class="page-link" aria-label="previous page, button is disabled" role="img" ><span aria-hidden="true">&laquo;</span></a></li><li class="page-item active" ><a class="page-link" role="button" tabindex="0" >1</a></li>';
            } else {
                temp += '<li class="page-item prev"><a class="page-link" aria-label="previous page" role="img" tabindex="0" ><span aria-hidden="true">&laquo;</span></a></li><li class="page-item"><a class="page-link" role="button" tabindex="0" >1</a></li>';
            }
            temp += (topagenumber > 4) ? '<li class="page-item noborder"><a class="page-link" >...</a></li>' : '';
            for(i=(topagenumber-2);i<=((topagenumber+2)>(totalpagenumber-1) ? (totalpagenumber-1) : (topagenumber+2));i++) {
                temp += '<li' + (topagenumber===i ? ' class="page-item active" ' : ' class="page-item" ') + '><a class="page-link" role="button" tabindex="0" >' + i + '</a></li>';
            }
            temp += ((totalpagenumber - topagenumber) > 3) ? '<li class="page-item noborder"><a class="page-link" >...</a></li>' : '';
            if(topagenumber===totalpagenumber) {
                temp += '<li class="page-item active" ><a class="page-link" role="button" tabindex="0" >' + totalpagenumber + '</a></li><li class="page-item disabled"><a class="page-link" aria-label="next page, button is disabled" role="img" ><span aria-hidden="true">&raquo;</span></a></li>';
            } else {
                temp += '<li class="page-item"><a class="page-link" role="button" tabindex="0" >' + totalpagenumber + '</a></li><li class="page-item next"><a class="page-link" tabindex="0" aria-label="next page" role="img" ><span aria-hidden="true">&raquo;</span></a></li>';
            }
        } else if(topagenumber >= (totalpagenumber - 2)) {
            if(topagenumber===1) {
                temp += '<li class="page-item disabled"><a class="page-link" aria-label="previous page, button is disabled" role="img" ><span aria-hidden="true">&laquo;</span></a></li>';
            } else {
                temp += '<li class="page-item prev"><a class="page-link" tabindex="0" aria-label="previous page" role="img" ><span aria-hidden="true">&laquo;</span></a></li>';
            }
            temp += '<li' + (topagenumber===1 ? ' class="page-item active" ' : ' class="page-item" ') + '><a class="page-link" role="button" tabindex="0" >1</a></li>';
            temp += ((topagenumber - 1) > 3) ? '<li class="page-item noborder"><a class="page-link" >...</a></li>' : '';
            for(i=(totalpagenumber-4);i<=totalpagenumber;i++) {
                temp += '<li' + (topagenumber===i ? ' class="page-item active" ' : ' class="page-item" ') + '><a class="page-link" role="button" tabindex="0" >' + i + '</a></li>';
            }
            if(topagenumber===totalpagenumber) {
                temp += '<li class="page-item disabled"><a class="page-link" aria-label="next page, button is disabled" role="img" ><span aria-hidden="true">&raquo;</span></a></li>';
            } else {
                temp += '<li class="page-item next"><a class="page-link" tabindex="0" aria-label="next page" role="img" ><span aria-hidden="true">&raquo;</span></a></li>';
            }
        }
        temp += '</ul>';
        if(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_' + itemname).length > 0) {
            jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_' + itemname).html(temp);
        }
    }

    function dragonecommercereservezyx987_showResultOnAjaxReloadedPage(type, pagenumber, itemname, sortby) {
        if(itemname === 'order') {
            dragonecommercereservezyx987_getOrdersList(pagenumber);
        } else if(itemname === 'product') {
            dragonecommercereservezyx987_getProductsList(pagenumber);
        } else if(itemname === 'disabledproduct') {
            dragonecommercereservezyx987_getDisabledproductsList(pagenumber);
        } else if(itemname === 'user') {
            dragonecommercereservezyx987_getUsersList(pagenumber);
        } else if(itemname === 'country') {
            dragonecommercereservezyx987_getCountriesList(pagenumber);
        } else if(itemname === 'province') {
            dragonecommercereservezyx987_getProvincesList(pagenumber);
        } else if(itemname === 'department') {
            dragonecommercereservezyx987_getDepartmentsList(pagenumber);
        } else if(itemname === 'groupcategory') {
            dragonecommercereservezyx987_getGroupcategoriesList(pagenumber);
        } else if(itemname === 'processstatus') {
            dragonecommercereservezyx987_getProcessstatusesList(pagenumber);
        } else if(itemname === 'group') {
            dragonecommercereservezyx987_getGroupsList(pagenumber);
        } else if(itemname === 'chargetype') {
            dragonecommercereservezyx987_getChargetypesList(pagenumber);
        } else if(itemname === 'log') {
            dragonecommercereservezyx987_getLogsList(pagenumber);
        } else if(itemname === 'slideshow') {
            dragonecommercereservezyx987_getSlideshowsList(pagenumber);
        } else if(itemname === 'discount') {
            dragonecommercereservezyx987_getDiscountsList(pagenumber);
        } else if(itemname === 'coupon') {
            dragonecommercereservezyx987_getCouponsList(pagenumber);
        } else if(itemname === 'propertyvalue') {
            dragonecommercereservezyx987_getPropertyvaluesList(pagenumber);
        } else if(itemname === 'handling') {
            dragonecommercereservezyx987_getHandlingsList(pagenumber);
        } else if(itemname === 'shipping') {
            dragonecommercereservezyx987_getShippingsList(pagenumber);
        } else if(itemname === 'tax') {
            dragonecommercereservezyx987_getTaxesList(pagenumber);
        } else if(itemname === 'property') {
            dragonecommercereservezyx987_getPropertiesList(pagenumber);
        } else if(itemname === 'currency') {
            dragonecommercereservezyx987_getCurrenciesList(pagenumber);
        } else if(itemname === 'city') {
            dragonecommercereservezyx987_getCitiesList(pagenumber);
        } else if(itemname === 'emailmethod') {
            dragonecommercereservezyx987_getEmailmethodsList(pagenumber);
        } else if(itemname === 'distance') {
            dragonecommercereservezyx987_getDistancesList(pagenumber);
        } else if(itemname === 'weight') {
            dragonecommercereservezyx987_getWeightsList(pagenumber);
        } else if(itemname === 'groupproperty') {
            dragonecommercereservezyx987_getGroupPropertiesList(pagenumber);
        }
    }

    function dragonecommercereservezyx987_getOrdersList(pagenumber) {
        var dataObj = {dragonecommercereservezyx987_hidden_security_getorders:"<?php echo wp_create_nonce('dragonecommercereservezyx987_getOrders'); ?>",dragonecommercereservezyx987_hidden:"Y",action:"dragonecommercereservezyx987_getOrders"};
        dataObj.searchwords = jQuery('input#dragonecommerce_order_productname').val();
        dataObj.searchusername = jQuery('input#dragonecommerce_order_username').val();
        dataObj.minprice = parseFloat(jQuery('input#dragonecommerce_order_minprice').val());
        dataObj.maxprice = parseFloat(jQuery('input#dragonecommerce_order_maxprice').val());
        if(dataObj.minprice > dataObj.maxprice) {
            return alert("Error. Min price is bigger than max price.");
        }
        dataObj.fromdate = jQuery('input#dragonecommerce_order_fromdate').val();
        dataObj.todate = jQuery('input#dragonecommerce_order_todate').val();
        if(dataObj.fromdate > dataObj.todate) {
            return alert("Error. From date is later than to date.");
        }
        dataObj.mystatus = jQuery('select#dragonecommerce_order_status').val();
        dataObj.amountperpage = jQuery('select#dragonecommerce_order_itemsperpage').val();
        if(typeof pagenumber === 'undefined') {pagenumber = 1;}
        dataObj.pagenumber = pagenumber;

        var sortby = jQuery('select#dragonecommerce_order_sortby').val();
        if(sortby === 'id|asc') {
            dataObj.sortby = 'id';
            dataObj.order = 'asc';
        } else if(sortby === 'id|desc') {
            dataObj.sortby = 'id';
            dataObj.order = 'desc';
        } else if(sortby === 'description|asc') {
            dataObj.sortby = 'description';
            dataObj.order = 'asc';
        } else if(sortby === 'description|desc') {
            dataObj.sortby = 'description';
            dataObj.order = 'desc';
        } else if(sortby === 'total|asc') {
            dataObj.sortby = 'total';
            dataObj.order = 'asc';      
        } else if(sortby === 'total|desc') {
            dataObj.sortby = 'total';
            dataObj.order = 'desc';
        }

        jQuery('tbody#dragonecommerce_order').html('');
        jQuery('span#totalorderquantity').text('');
        jQuery('img#admin_orderlist_loader').show();
        jQuery.ajax({
            type: "POST",
            async: true,
            url: ajaxurl,
            data: dataObj
        }).done(function (mydata) {
            var objArr = mydata["order"];
            var tempRows = '';
            for (var i = 0; i < objArr.length; i++) {
                var temp_button = '<a href="javascript:void(0);" class="btn btn-primary" onclick="dragonecommercereservezyx987_editOrder(' + dragonecommercereservezyx987_validString(objArr[i].id) + ', \'dragonecommerce_order_container_\');">Edit</a>';
                temp_button += '<a href="javascript:void(0);" style="display:none;" class="btn btn-primary dragonecommerce_order_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" onclick="dragonecommercereservezyx987_saveOrder(' + dragonecommercereservezyx987_validString(objArr[i].id) + ', \'dragonecommerce_order_\');">Save</a>';

                tempRows += '<tr><td>'+ temp_button + '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].id) + '</td>';

                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].total) + '</td>';

                tempRows += '<td><span>';
                <?php foreach ($activeprocessstatuses as $processstatus) { ?>
                tempRows += dragonecommercereservezyx987_validString(objArr[i].status) === <?php echo $processstatus->id === null ? 0 : intval($processstatus->id); ?> ? '<?php echo esc_html($processstatus->name); ?>' : '';
                <?php } ?>
                tempRows += '</span>';
                tempRows += '<div style="display:none;" class="dragonecommerce_order_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<select name="dragonecommerce_order_status_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_order_status_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<option value="-1">Choose one...</option>';
               <?php foreach ($activeprocessstatuses as $processstatus) { ?>
                tempRows += '<option value="<?php echo intval($processstatus->id); ?>" ' + (dragonecommercereservezyx987_validString(objArr[i].status) === <?php echo $processstatus->id === null ? 0 : intval($processstatus->id); ?> ? 'selected' : '') + '><?php echo esc_html($processstatus->name) . ' - ' . intval($processstatus->id); ?></option>';
               <?php } ?>
                tempRows += '</select></div></td>';

                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].createtimeutc) + '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].username) + '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].orderdetaildescription) + '</td>';
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].subtotal) + '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].discount) + '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].coupon) + '</td>';
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].shippingfee) + '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].handlingfee) + '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].tax) + '</td>';
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].discountfee) + '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].couponfee) + '</td>';

                tempRows += '<td>' + (dragonecommercereservezyx987_validString(objArr[i].emailsent) === 1 ? '<span style="color:green;">Yes</span>' : '<span style="color:red;">No</span>');
                tempRows += '<div style="display:none;" class="dragonecommerce_order_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<select name="dragonecommerce_order_emailsent_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_order_emailsent_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<option value="-1">Choose one...</option>';
                tempRows += '<option value="1"' + (dragonecommercereservezyx987_validString(objArr[i].emailsent) === 1 ? 'selected' : '') + '>Yes</option>';
                tempRows += '<option value="0"' + (dragonecommercereservezyx987_validString(objArr[i].emailsent) === 0 ? 'selected' : '') + '>No</option>';
                tempRows += '</select></div></td>';

                tempRows += '<td>' + (dragonecommercereservezyx987_validString(objArr[i].ordercancelemailsent) === 1 ? '<span style="color:green;">Yes</span>' : '<span style="color:red;">No</span>');
                tempRows += '<div style="display:none;" class="dragonecommerce_order_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<select name="dragonecommerce_order_ordercancelemailsent_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_order_ordercancelemailsent_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<option value="-1">Choose one...</option>';
                tempRows += '<option value="1"' + (dragonecommercereservezyx987_validString(objArr[i].ordercancelemailsent) === 1 ? 'selected' : '') + '>Yes</option>';
                tempRows += '<option value="0"' + (dragonecommercereservezyx987_validString(objArr[i].ordercancelemailsent) === 0 ? 'selected' : '') + '>No</option>';
                tempRows += '</select></div></td>';    

                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].ordercanceltimeutc);
                tempRows += '<div style="display:none;" class="dragonecommerce_order_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" class="dragonecommercereservezyx987_datetimepicker" name="dragonecommerce_order_ordercanceltimeutc_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_order_ordercanceltimeutc_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].ordercanceltimeutc) + '" /></div>';
                tempRows += '</td>';

                tempRows += '<td>' + (dragonecommercereservezyx987_validString(objArr[i].ordercancelrefunded) === 1 ? '<span style="color:green;">Yes</span>' : '<span style="color:red;">No</span>');
                tempRows += '<div style="display:none;" class="dragonecommerce_order_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<select name="dragonecommerce_order_ordercancelrefunded_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_order_ordercancelrefunded_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<option value="-1">Choose one...</option>';
                tempRows += '<option value="1"' + (dragonecommercereservezyx987_validString(objArr[i].ordercancelrefunded) === 1 ? 'selected' : '') + '>Yes</option>';
                tempRows += '<option value="0"' + (dragonecommercereservezyx987_validString(objArr[i].ordercancelrefunded) === 0 ? 'selected' : '') + '>No</option>';
                tempRows += '</select></div></td>';

                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].ordercancelrefundtimeutc);
                tempRows += '<div style="display:none;" class="dragonecommerce_order_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" class="dragonecommercereservezyx987_datetimepicker" name="dragonecommerce_order_ordercancelrefundtimeutc_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_order_ordercancelrefundtimeutc_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].ordercancelrefundtimeutc) + '" /></div>';
                tempRows += '</td>';

                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].description);
                tempRows += '<div style="display:none;" class="dragonecommerce_order_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" class="" name="dragonecommerce_order_description_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_order_description_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].description) + '" /></div>';
                tempRows += '</td>';
                
                tempRows += '</tr>';
            }
            jQuery('tbody#dragonecommerce_order').html(tempRows);
            jQuery(".dragonecommercereservezyx987_datetimepicker" ).datetimepicker({ format:'Y-m-d H:i:s' });
            var totalOrderQuantity = mydata["total"] == null ? '0' : mydata["total"];
            jQuery('span#totalorderquantity').text(totalOrderQuantity);

            totalOrderQuantity = parseInt(mydata["total"]);
            var amountperpage = parseInt(jQuery('select#dragonecommerce_order_itemsperpage').val());
            if(amountperpage === -1) {amountperpage = parseInt(ORDER_ITEMS_PER_PAGE_PRESET_VALUE);}
            if(amountperpage > 0) {
                totalpagenumber_onload_admin_order = Math.ceil(totalOrderQuantity / amountperpage);
                dragonecommercereservezyx987_createPagination(totalpagenumber_onload_admin_order, pagenumber , 'order');
            }
            jQuery('img#admin_orderlist_loader').hide();
        }).fail(function( jqXHR, textStatus ) {
            //alert( "Reserve request failed: " + textStatus );
        });
    }

    function dragonecommercereservezyx987_resetOrdersSearchParameters() {
        jQuery('input#dragonecommerce_order_productname').val('');
        jQuery('input#dragonecommerce_order_username').val('');
        jQuery('input#dragonecommerce_order_minprice').val('');
        jQuery('input#dragonecommerce_order_maxprice').val('');
        jQuery('input#dragonecommerce_order_fromdate').val('');
        jQuery('input#dragonecommerce_order_todate').val('');
        jQuery('select#dragonecommerce_order_status').val('-1');
        jQuery('select#dragonecommerce_order_itemsperpage').val('-1');
        jQuery('select#dragonecommerce_order_sortby').val('-1');
    }

    function dragonecommercereservezyx987_resetOrderdetailsSearchParameters() {
        jQuery('input#dragonecommerce_orderdetails_productname').val('');    
        jQuery('select#dragonecommerce_orderdetails_propertyvalueid').val('-1');
        jQuery('input#dragonecommerce_orderdetails_username').val('');
        jQuery('input#dragonecommerce_orderdetails_minprice').val('');
        jQuery('input#dragonecommerce_orderdetails_maxprice').val('');
        jQuery('input#dragonecommerce_orderdetails_fromdate').val('');
        jQuery('input#dragonecommerce_orderdetails_todate').val('');
        jQuery('select#dragonecommerce_orderdetails_status').val('-1');
        jQuery('select#dragonecommerce_orderdetails_itemsperpage').val('-1');
        jQuery('select#dragonecommerce_orderdetails_sortby').val('-1');
    }

    function dragonecommercereservezyx987_getProductsList(pagenumber, productstatus) {
        var dataObj = {dragonecommercereservezyx987_hidden_security_getproducts:"<?php echo wp_create_nonce('dragonecommercereservezyx987_getProducts'); ?>",dragonecommercereservezyx987_hidden:"Y",action:"dragonecommercereservezyx987_getProducts"};
        dataObj.searchwords = jQuery('input#dragonecommerce_product_name').val();
        dataObj.departmentid = jQuery('select#dragonecommerce_product_department').val();
        dataObj.barcode = jQuery('input#dragonecommerce_product_barcode').val();        
        dataObj.minprice = parseFloat(jQuery('input#dragonecommerce_product_minprice').val());
        dataObj.maxprice = parseFloat(jQuery('input#dragonecommerce_product_maxprice').val());
        if(dataObj.minprice > dataObj.maxprice) {
            return alert("Error. Min price is bigger than max price.");
        }
        dataObj.fromdate = jQuery('input#dragonecommerce_product_fromdate').val();
        dataObj.todate = jQuery('input#dragonecommerce_product_todate').val();
        if(dataObj.fromdate > dataObj.todate) {
            return alert("Error. From date is later than to date.");
        }
        dataObj.amountperpage = jQuery('select#dragonecommerce_product_itemsperpage').val();
        if(typeof pagenumber === 'undefined') {pagenumber = 1;}
        dataObj.pagenumber = pagenumber;
        if(typeof productstatus === 'undefined') {productstatus = 1;}
        dataObj.productstatus = productstatus;
        dataObj.isonsale = jQuery('select#dragonecommerce_product_isonsale').val();
        dataObj.istaxfree = jQuery('select#dragonecommerce_product_istaxfree').val();

        var sortby = jQuery('select#dragonecommerce_product_sortby').val();
        if(sortby === 'id|asc') {
            dataObj.sortby = 'id';
            dataObj.order = 'asc';
        } else if(sortby === 'id|desc') {
            dataObj.sortby = 'id';
            dataObj.order = 'desc';
        } else if(sortby === 'name|asc') {
            dataObj.sortby = 'name';
            dataObj.order = 'asc';
        } else if(sortby === 'name|desc') {
            dataObj.sortby = 'name';
            dataObj.order = 'desc';
        } else if(sortby === 'price|asc') {
            dataObj.sortby = 'price';
            dataObj.order = 'asc';      
        } else if(sortby === 'price|desc') {
            dataObj.sortby = 'price';
            dataObj.order = 'desc';                  
        } else if(sortby === 'createtimeutc|asc') {
            dataObj.sortby = 'createtimeutc';
            dataObj.order = 'asc';      
        } else if(sortby === 'createtimeutc|desc') {
            dataObj.sortby = 'createtimeutc';
            dataObj.order = 'desc';                  
        }

        jQuery('tbody#dragonecommerce_product').html('');
        jQuery('span#totalproductquantity').text('');
        jQuery('img#admin_productlist_loader').show();
        
        jQuery.ajax({
            type: "POST",
            async: true,
            url: ajaxurl,
            data: dataObj
        }).done(function (mydata) {
            var objArr = mydata["product"];
            var tempRows = '';
            for (var i = 0; i < objArr.length; i++) {
                tempRows += '<tr><td><a href="javascript:void(0);" class="btn btn-primary" onclick="dragonecommercereservezyx987_editProduct(' + dragonecommercereservezyx987_validString(objArr[i].id) + ');">Edit</a>&nbsp;&nbsp;&nbsp;<a href="javascript:void(0);" class="btn btn-danger" onclick="dragonecommercereservezyx987_disableProduct(' + dragonecommercereservezyx987_validString(objArr[i].id) + ');">Disable</a></td><td>' + dragonecommercereservezyx987_validString(objArr[i].id) + '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].name) + '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].description) + '</td>';
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].departmentname) + '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].weightlb) + '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].price) + '</td>';
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].saleprice) + '</td>';
                tempRows += '<td>' + (dragonecommercereservezyx987_validString(objArr[i].isonsale) === 1 ? '<span style="color:green;">YES</span>' : '<span style="color:red;">NO</span>') + '</td>';
                tempRows += '<td>' + (dragonecommercereservezyx987_validString(objArr[i].istaxfree) === 1 ? '<span style="color:green;">YES</span>' : '<span style="color:red;">NO</span>') + '</td>';
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].onsalestartdateutc) + '</td>';
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].onsaleenddateutc) + '</td>';                
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].quantity) + '</td>';
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].originalquantity) + '</td>';
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].barcode) + '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].createtimeutc) + '</td></tr>';
            }                                    
            jQuery('tbody#dragonecommerce_product').html(tempRows);
            var totalProductQuantity = mydata["total"] == null ? '0' : mydata["total"];
            jQuery('span#totalproductquantity').text(totalProductQuantity);
            totalProductQuantity = parseInt(mydata["total"]);
            var amountperpage = parseInt(jQuery('select#dragonecommerce_product_itemsperpage').val());
            if(amountperpage === -1) {amountperpage = parseInt(PRODUCT_ITEMS_PER_PAGE_PRESET_VALUE);}
            if(amountperpage > 0) {
                totalpagenumber_onload_admin_product = Math.ceil(totalProductQuantity / amountperpage);
                dragonecommercereservezyx987_createPagination(totalpagenumber_onload_admin_product, pagenumber , 'product');        
            }            
            jQuery('img#admin_productlist_loader').hide();
        }).fail(function( jqXHR, textStatus ) {
            //alert( "Product list request failed: " + textStatus );
        });            
    }
    
    function dragonecommercereservezyx987_resetProductsSearchParameters() {    
        jQuery('input#dragonecommerce_product_name').val('');        
        jQuery('input#dragonecommerce_product_barcode').val('');
        jQuery('select#dragonecommerce_product_department').val('-1');        
        jQuery('input#dragonecommerce_product_minprice').val('');
        jQuery('input#dragonecommerce_product_maxprice').val('');
        jQuery('input#dragonecommerce_product_fromdate').val('');
        jQuery('input#dragonecommerce_product_todate').val('');
        jQuery('select#dragonecommerce_product_itemsperpage').val('-1');
        jQuery('select#dragonecommerce_product_sortby').val('-1');        
        jQuery('select#dragonecommerce_product_isonsale').val('-1');
        jQuery('select#dragonecommerce_product_istaxfree').val('-1');
    }
    
    function dragonecommercereservezyx987_resetProductdetailsSearchParameters() {    
        jQuery('input#dragonecommerce_productdetails_name').val('');        
        jQuery('input#dragonecommerce_productdetails_barcode').val('');
        jQuery('select#dragonecommerce_productdetails_department').val('-1');        
        jQuery('input#dragonecommerce_productdetails_minprice').val('');
        jQuery('input#dragonecommerce_productdetails_maxprice').val('');
        jQuery('input#dragonecommerce_productdetails_fromdate').val('');
        jQuery('input#dragonecommerce_productdetails_todate').val('');
        jQuery('select#dragonecommerce_productdetails_itemsperpage').val('-1');
        jQuery('select#dragonecommerce_productdetails_sortby').val('-1');        
        jQuery('select#dragonecommerce_productdetails_isonsale').val('-1');
        jQuery('select#dragonecommerce_productdetails_istaxfree').val('-1');
    }
    
    function dragonecommercereservezyx987_getDisabledproductsList(pagenumber) {
        var dataObj = {dragonecommercereservezyx987_hidden_security_getdisabledproducts:"<?php echo wp_create_nonce('dragonecommercereservezyx987_getdisabledProducts'); ?>",dragonecommercereservezyx987_hidden:"Y",action:"dragonecommercereservezyx987_getdisabledProducts"};
        dataObj.searchwords = jQuery('input#dragonecommerce_disabledproduct_name').val();
        dataObj.departmentid = jQuery('select#dragonecommerce_disabledproduct_department').val();        
        dataObj.barcode = jQuery('input#dragonecommerce_product_disabledbarcode').val();        
        dataObj.minprice = parseFloat(jQuery('input#dragonecommerce_disabledproduct_minprice').val());
        dataObj.maxprice = parseFloat(jQuery('input#dragonecommerce_disabledproduct_maxprice').val());
        if(dataObj.minprice > dataObj.maxprice) {
            return alert("Error. Min price is bigger than max price.");
        }
        dataObj.fromdate = jQuery('input#dragonecommerce_disabledproduct_fromdate').val();
        dataObj.todate = jQuery('input#dragonecommerce_disabledproduct_todate').val();
        if(dataObj.fromdate > dataObj.todate) {
            return alert("Error. From date is later than to date.");            
        }
        dataObj.amountperpage = jQuery('select#dragonecommerce_disabledproduct_itemsperpage').val();
        if(typeof pagenumber === 'undefined') {pagenumber = 1;}
        dataObj.pagenumber = pagenumber;
        dataObj.productstatus = 0;
        dataObj.isonsale = jQuery('select#dragonecommerce_disabledproduct_isonsale').val();
        dataObj.istaxfree = jQuery('select#dragonecommerce_disabledproduct_istaxfree').val();
        
        var sortby = jQuery('select#dragonecommerce_disabledproduct_sortby').val();
        if(sortby === 'id|asc') {
            dataObj.sortby = 'id';
            dataObj.order = 'asc';                  
        } else if(sortby === 'id|desc') {
            dataObj.sortby = 'id';
            dataObj.order = 'desc';                  
        } else if(sortby === 'name|asc') {
            dataObj.sortby = 'name';
            dataObj.order = 'asc';                  
        } else if(sortby === 'name|desc') {
            dataObj.sortby = 'name';
            dataObj.order = 'desc';                      
        } else if(sortby === 'price|asc') {
            dataObj.sortby = 'price';
            dataObj.order = 'asc';      
        } else if(sortby === 'price|desc') {
            dataObj.sortby = 'price';
            dataObj.order = 'desc';                  
        } else if(sortby === 'createtimeutc|asc') {
            dataObj.sortby = 'createtimeutc';
            dataObj.order = 'asc';      
        } else if(sortby === 'createtimeutc|desc') {
            dataObj.sortby = 'createtimeutc';
            dataObj.order = 'desc';                  
        }
                        
        jQuery('tbody#dragonecommerce_disabledproduct').html('');
        jQuery('span#totaldisabledproductquantity').text('');
        jQuery('img#admin_disabledproductlist_loader').show();
        
        jQuery.ajax({
            type: "POST",
            async: true,
            url: ajaxurl,
            data: dataObj
        }).done(function (mydata) {
            var objArr = mydata["product"];
            var tempRows = '';
            for (var i = 0; i < objArr.length; i++) {
                tempRows += '<tr><td><a href="javascript:void(0);" class="btn btn-primary" onclick="dragonecommercereservezyx987_editProduct(' + dragonecommercereservezyx987_validString(objArr[i].id) + ');">Edit</a>&nbsp;&nbsp;&nbsp;<a href="javascript:void(0);" class="btn btn-danger" onclick="dragonecommercereservezyx987_enableProduct(' + dragonecommercereservezyx987_validString(objArr[i].id) + ');">Enable</a></td><td>' + dragonecommercereservezyx987_validString(objArr[i].id) + '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].name) + '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].description) + '</td>';
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].departmentname) + '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].weightlb) + '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].price) + '</td>';
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].saleprice) + '</td>';
                tempRows += '<td>' + (dragonecommercereservezyx987_validString(objArr[i].isonsale) === 1 ? '<span style="color:green;">YES</span>' : '<span style="color:red;">NO</span>') + '</td>';
                tempRows += '<td>' + (dragonecommercereservezyx987_validString(objArr[i].istaxfree) === 1 ? '<span style="color:green;">YES</span>' : '<span style="color:red;">NO</span>') + '</td>';
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].quantity) + '</td>';
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].originalquantity) + '</td>';
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].barcode) + '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].createtimeutc) + '</td></tr>';
            }                                    
            jQuery('tbody#dragonecommerce_disabledproduct').html(tempRows);
            var totalProductQuantity = mydata["total"] == null ? '0' : mydata["total"];
            jQuery('span#totaldisabledproductquantity').text(totalProductQuantity);
            totalProductQuantity = parseInt(mydata["total"]);
            var amountperpage = parseInt(jQuery('select#dragonecommerce_product_itemsperpage').val());
            if(amountperpage === -1) {amountperpage = parseInt(DISABLEDPRODUCT_ITEMS_PER_PAGE_PRESET_VALUE);}
            if(amountperpage > 0) {
                totalpagenumber_onload_admin_disabledproduct = Math.ceil(totalProductQuantity / amountperpage);
                dragonecommercereservezyx987_createPagination(totalpagenumber_onload_admin_disabledproduct, pagenumber , 'disabledproduct');        
            }            
            jQuery('img#admin_disabledproductlist_loader').hide();
        }).fail(function( jqXHR, textStatus ) {
            //alert( "Disabled product list request failed: " + textStatus );
        });            
    }
    
    function dragonecommercereservezyx987_resetDisabledProductsSearchParameters() {    
        jQuery('input#dragonecommerce_disabledproduct_name').val('');        
        jQuery('input#dragonecommerce_disabledproduct_barcode').val('');
        jQuery('select#dragonecommerce_disabledproduct_department').val('-1');        
        jQuery('input#dragonecommerce_disabledproduct_minprice').val('');
        jQuery('input#dragonecommerce_disabledproduct_maxprice').val('');
        jQuery('input#dragonecommerce_disabledproduct_fromdate').val('');
        jQuery('input#dragonecommerce_disabledproduct_todate').val('');
        jQuery('select#dragonecommerce_disabledproduct_itemsperpage').val('-1');
        jQuery('select#dragonecommerce_disabledproduct_sortby').val('-1');
        jQuery('select#dragonecommerce_disabledproduct_isonsale').val('-1');    
        jQuery('select#dragonecommerce_disabledproduct_istaxfree').val('-1');            
    }
        
    function dragonecommercereservezyx987_getUsersList(pagenumber) {
        var dataObj = {dragonecommercereservezyx987_hidden_security_getusers:"<?php echo wp_create_nonce('dragonecommercereservezyx987_getUsers'); ?>",dragonecommercereservezyx987_hidden:"Y",action:"dragonecommercereservezyx987_getUsers"};
        dataObj.searchwords = jQuery('input#dragonecommerce_user_username').val();        
        dataObj.searchemail = jQuery('input#dragonecommerce_user_email').val();        
        
        dataObj.fromdate = jQuery('input#dragonecommerce_user_fromdate').val();
        dataObj.todate = jQuery('input#dragonecommerce_user_todate').val();
        if(dataObj.fromdate > dataObj.todate) {
            return alert("Error. From date is later than to date.");            
        }
        dataObj.userstatus = jQuery('select#dragonecommerce_user_status').val();
        dataObj.amountperpage = jQuery('select#dragonecommerce_user_itemsperpage').val();
        if(typeof pagenumber === 'undefined') {pagenumber = 1;}
        dataObj.pagenumber = pagenumber;

        var sortby = jQuery('select#dragonecommerce_user_sortby').val();
        if(sortby === 'id|asc') {
            dataObj.sortby = 'id';
            dataObj.order = 'asc';                  
        } else if(sortby === 'id|desc') {
            dataObj.sortby = 'id';
            dataObj.order = 'desc';                  
        } else if(sortby === 'username|asc') {
            dataObj.sortby = 'username';
            dataObj.order = 'asc';                  
        } else if(sortby === 'username|desc') {
            dataObj.sortby = 'username';
            dataObj.order = 'desc';                      
        } else if(sortby === 'email|asc') {
            dataObj.sortby = 'email';
            dataObj.order = 'asc';      
        } else if(sortby === 'email|desc') {
            dataObj.sortby = 'email';
            dataObj.order = 'desc';                  
        } else if(sortby === 'createtimeutc|asc') {
            dataObj.sortby = 'createtimeutc';
            dataObj.order = 'asc';      
        } else if(sortby === 'createtimeutc|desc') {
            dataObj.sortby = 'createtimeutc';
            dataObj.order = 'desc';                  
        }
                
        jQuery('tbody#dragonecommerce_user').html('');
        jQuery('span#totaluserquantity').text('');
        jQuery('img#admin_userlist_loader').show();
                
        jQuery.ajax({
            type: "POST",
            async: true,
            url: ajaxurl,
            data: dataObj
        }).done(function (mydata) {
            var objArr = mydata["user"];
            var tempRows = '';
            for (var i = 0; i < objArr.length; i++) {
                var temp_button = '';
                if(dragonecommercereservezyx987_validString(objArr[i].admin_approved) === 1) {
                    temp_button = '<a href="javascript:void(0);" class="btn btn-danger" onclick="dragonecommercereservezyx987_disapproveUser(' + dragonecommercereservezyx987_validString(objArr[i].userid) + ');">Disapprove</a>';                    
                } else {
                    temp_button = '<a href="javascript:void(0);" class="btn btn-primary" onclick="dragonecommercereservezyx987_approveUser(' + dragonecommercereservezyx987_validString(objArr[i].userid) + ');">Approve</a>';
                }                
                tempRows += '<tr><td>'+ temp_button + '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].userid) + '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].user_login) + '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].user_email) + '</td>';
                tempRows += '<td>' + (dragonecommercereservezyx987_validString(objArr[i].user_status) === 1 ? '<span style="color:green;">ACTIVE</span>' : '<span style="color:red;">INACTIVE</span>') + '</td><td>' + (dragonecommercereservezyx987_validString(objArr[i].admin_approved) === 1 ? '<span style="color:green;">YES</span>' : '<span style="color:red;">NO</span>') + '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].user_registered) + '</td></tr>';
            }                                    
            jQuery('tbody#dragonecommerce_user').html(tempRows);
            var totalUserQuantity = mydata["total"] == null ? '0' : mydata["total"];
            jQuery('span#totaluserquantity').text(totalUserQuantity);            
            totalUserQuantity = parseInt(mydata["total"]);
            var amountperpage = parseInt(jQuery('select#dragonecommerce_user_itemsperpage').val());
            if(amountperpage === -1) {amountperpage = parseInt(USER_ITEMS_PER_PAGE_PRESET_VALUE);}
            if(amountperpage > 0) {
                totalpagenumber_onload_admin_user = Math.ceil(totalUserQuantity / amountperpage);
                dragonecommercereservezyx987_createPagination(totalpagenumber_onload_admin_user, pagenumber , 'user');        
            }            
            jQuery('img#admin_userlist_loader').hide();                        
        }).fail(function( jqXHR, textStatus ) {
            //alert( "Get user list request failed: " + textStatus );
        });
    }
    
    function dragonecommercereservezyx987_resetUsersSearchParameters() {    
        jQuery('input#dragonecommerce_user_username').val('');        
        jQuery('input#dragonecommerce_user_email').val('');
        jQuery('input#dragonecommerce_user_fromdate').val('');
        jQuery('input#dragonecommerce_user_todate').val('');
        jQuery('select#dragonecommerce_user_status').val('-1');
        jQuery('select#dragonecommerce_user_itemsperpage').val('-1');
        jQuery('select#dragonecommerce_user_sortby').val('-1');
    }
    
    function dragonecommercereservezyx987_getCountriesList(pagenumber) {
        var dataObj = {dragonecommercereservezyx987_hidden_security_getcountries:"<?php echo wp_create_nonce('dragonecommercereservezyx987_getCountries'); ?>",dragonecommercereservezyx987_hidden:"Y",action:"dragonecommercereservezyx987_getCountries"};
        dataObj.searchwords = jQuery('input#dragonecommerce_country_name').val();        
        dataObj.countrystatus = jQuery('select#dragonecommerce_country_status').val();
        dataObj.amountperpage = jQuery('select#dragonecommerce_country_itemsperpage').val();
        if(typeof pagenumber === 'undefined') {pagenumber = 1;}
        dataObj.pagenumber = pagenumber;

        var sortby = jQuery('select#dragonecommerce_country_sortby').val();
        if(sortby === 'id|asc') {
            dataObj.sortby = 'id';
            dataObj.order = 'asc';                  
        } else if(sortby === 'id|desc') {
            dataObj.sortby = 'id';
            dataObj.order = 'desc';                  
        } else if(sortby === 'name|asc') {
            dataObj.sortby = 'name';
            dataObj.order = 'asc';                  
        } else if(sortby === 'name|desc') {
            dataObj.sortby = 'name';
            dataObj.order = 'desc';                      
        } else if(sortby === 'abbreviation|asc') {
            dataObj.sortby = 'abbreviation';
            dataObj.order = 'asc';      
        } else if(sortby === 'abbreviation|desc') {
            dataObj.sortby = 'abbreviation';
            dataObj.order = 'desc';                  
        } else if(sortby === 'createtimeutc|asc') {
            dataObj.sortby = 'createtimeutc';
            dataObj.order = 'asc';      
        } else if(sortby === 'createtimeutc|desc') {
            dataObj.sortby = 'createtimeutc';
            dataObj.order = 'desc';                  
        }
                
        jQuery('tbody#dragonecommerce_country').html('');
        jQuery('span#totalcountryquantity').text('');
        jQuery('img#admin_countrylist_loader').show();        
        
        jQuery.ajax({
            type: "POST",
            async: true,
            url: ajaxurl,
            data: dataObj
        }).done(function (mydata) {
            var objArr = mydata["country"];
            var tempRows = '';
            for (var i = 0; i < objArr.length; i++) {
                var temp_button = '';
                temp_button = '<a href="javascript:void(0);" class="btn btn-primary" onclick="dragonecommercereservezyx987_editCountry(' + dragonecommercereservezyx987_validString(objArr[i].id) + ', \'dragonecommerce_country_container_\');">Edit</a>';                    
                temp_button += '<a href="javascript:void(0);" style="display:none;" class="btn btn-primary dragonecommerce_country_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" onclick="dragonecommercereservezyx987_saveCountry(' + dragonecommercereservezyx987_validString(objArr[i].id) + ', \'dragonecommerce_country_\');">Save</a>';                    

                tempRows += '<tr><td>'+ temp_button + '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].id) + '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].name);
                tempRows += '<div style="display:none;" class="dragonecommerce_country_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_country_name_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_country_name_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].name).replace(/"/g, '\\&#34;') + '" /></div>';

                tempRows += '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].abbreviation);
                tempRows += '<div style="display:none;" class="dragonecommerce_country_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_country_abbreviation_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_country_abbreviation_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].abbreviation) + '" /></div>';                
                tempRows += '</td>';
                
                tempRows += '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].description);
                tempRows += '<div style="display:none;" class="dragonecommerce_country_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_country_description_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_country_description_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].description).replace(/"/g, '\\&#34;') + '" /></div>';                
                tempRows += '</td>';
                                
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].createtimeutc) + '</td><td>' + (dragonecommercereservezyx987_validString(objArr[i].status) === 1 ? '<span style="color:green;">ACTIVE</span>' : '<span style="color:red;">INACTIVE</span>');
                tempRows += '<div style="display:none;" class="dragonecommerce_country_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<select name="dragonecommerce_country_status_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_country_status_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<option value="-1">Choose one...</option>';
                tempRows += '<option value="1"' + (dragonecommercereservezyx987_validString(objArr[i].status) === 1 ? 'selected' : '') + '>Active</option>';
                tempRows += '<option value="0"' + (dragonecommercereservezyx987_validString(objArr[i].status) === 0 ? 'selected' : '') + '>Not Active</option>';
                tempRows += '</select></div>';

                tempRows += '</td></tr>';
            }                                    
            jQuery('tbody#dragonecommerce_country').html(tempRows);
            var totalcountryquantity = mydata["total"] == null ? '0' : mydata["total"];
            jQuery('span#totalcountryquantity').text(totalcountryquantity);
            totalcountryquantity = parseInt(mydata["total"]);
            var amountperpage = parseInt(jQuery('select#dragonecommerce_country_itemsperpage').val());
            if(amountperpage === -1) {amountperpage = parseInt(COUNTRY_ITEMS_PER_PAGE_PRESET_VALUE);}
            if(amountperpage > 0) {
                totalpagenumber_onload_admin_country = Math.ceil(totalcountryquantity / amountperpage);
                dragonecommercereservezyx987_createPagination(totalpagenumber_onload_admin_country, pagenumber , 'country');        
            }                    
            jQuery('img#admin_countrylist_loader').hide();
        }).fail(function( jqXHR, textStatus ) {
            //alert( "Request country list failed: " + textStatus );
        });
    }
    
    function dragonecommercereservezyx987_resetCountriesSearchParameters() {    
        jQuery('input#dragonecommerce_country_name').val('');        
        jQuery('input#dragonecommerce_country_abbreviation').val('');
        jQuery('select#dragonecommerce_country_status').val('-1');
        jQuery('select#dragonecommerce_country_itemsperpage').val('-1');    
        jQuery('select#dragonecommerce_country_sortby').val('-1');
    }
    
    function dragonecommercereservezyx987_getProvincesList(pagenumber) {
        var dataObj = {dragonecommercereservezyx987_hidden_security_getprovinces:"<?php echo wp_create_nonce('dragonecommercereservezyx987_getProvinces'); ?>",dragonecommercereservezyx987_hidden:"Y",action:"dragonecommercereservezyx987_getProvinces"};
        dataObj.searchwords = jQuery('input#dragonecommerce_province_name').val();        
        dataObj.countryid = jQuery('select#dragonecommerce_province_countryid').val();        
        dataObj.provincestatus = jQuery('select#dragonecommerce_province_status').val();
        dataObj.amountperpage = jQuery('select#dragonecommerce_province_itemsperpage').val();
        if(typeof pagenumber === 'undefined') {pagenumber = 1;}
        dataObj.pagenumber = pagenumber;

        var sortby = jQuery('select#dragonecommerce_province_sortby').val();
        if(sortby === 'id|asc') {
            dataObj.sortby = 'id';
            dataObj.order = 'asc';                  
        } else if(sortby === 'id|desc') {
            dataObj.sortby = 'id';
            dataObj.order = 'desc';                  
        } else if(sortby === 'name|asc') {
            dataObj.sortby = 'name';
            dataObj.order = 'asc';                  
        } else if(sortby === 'name|desc') {
            dataObj.sortby = 'name';
            dataObj.order = 'desc';                      
        } else if(sortby === 'countryname|asc') {
            dataObj.sortby = 'countryname';
            dataObj.order = 'asc';      
        } else if(sortby === 'countryname|desc') {
            dataObj.sortby = 'countryname';
            dataObj.order = 'desc';                  
        } else if(sortby === 'createtimeutc|asc') {
            dataObj.sortby = 'createtimeutc';
            dataObj.order = 'asc';      
        } else if(sortby === 'createtimeutc|desc') {
            dataObj.sortby = 'createtimeutc';
            dataObj.order = 'desc';                  
        }
                
        jQuery('tbody#dragonecommerce_province').html('');
        jQuery('span#totalprovincequantity').text('');
        jQuery('img#admin_provincelist_loader').show();        
        
        jQuery.ajax({
            type: "POST",
            async: true,
            url: ajaxurl,
            data: dataObj
        }).done(function (mydata) {
            var objArr = mydata["province"];
            var tempRows = '';
            for (var i = 0; i < objArr.length; i++) {
                var temp_button = '';
                temp_button = '<a href="javascript:void(0);" class="btn btn-primary" onclick="dragonecommercereservezyx987_editProvince(' + dragonecommercereservezyx987_validString(objArr[i].id) + ', \'dragonecommerce_province_container_\');">Edit</a>';                    
                temp_button += '<a href="javascript:void(0);" style="display:none;" class="btn btn-primary dragonecommerce_province_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" onclick="dragonecommercereservezyx987_saveProvince(' + dragonecommercereservezyx987_validString(objArr[i].id) + ', \'dragonecommerce_province_\');">Save</a>';                    
                
                tempRows += '<tr><td>'+ temp_button + '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].id) + '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].name);
                tempRows += '<div style="display:none;" class="dragonecommerce_province_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_province_name_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_province_name_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].name).replace(/"/g, '\\&#34;') + '" /></div>';
                tempRows += '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].description);
                tempRows += '<div style="display:none;" class="dragonecommerce_province_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_province_description_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_province_description_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].description).replace(/"/g, '\\&#34;') + '" /></div>';
                                                
                tempRows += '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].countryname);
                tempRows += '<div style="display:none;" class="dragonecommerce_province_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<select name="dragonecommerce_province_countryid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_province_countryid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<option value="-1">Please choose one...</option>';
                <?php foreach ($allcountries as $country) { ?>
                <?php $country_status_temp = $country->status === '1' ? '' : 'color:grey;'; ?>
                tempRows += "<option " + (dragonecommercereservezyx987_validString(objArr[i].countryid) === <?php echo $country->id === null ? 0 : intval($country->id); ?> ? 'selected' : '') + " value='<?php echo intval($country->id); ?>' style='<?php echo esc_html($country_status_temp); ?>'><?php echo esc_html($country->name); ?></option>";
                <?php } ?>                
                tempRows += '</select></div>';                
                tempRows += '</td>';
                
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].createtimeutc) + '</td><td>' + (dragonecommercereservezyx987_validString(objArr[i].status) === 1 ? '<span style="color:green;">ACTIVE</span>' : '<span style="color:red;">INACTIVE</span>');
                tempRows += '<div style="display:none;" class="dragonecommerce_province_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<select name="dragonecommerce_province_status_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_province_status_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<option value="-1">Choose one...</option>';
                tempRows += '<option value="1"' + (dragonecommercereservezyx987_validString(objArr[i].status) === 1 ? 'selected' : '') + '>Active</option>';
                tempRows += '<option value="0"' + (dragonecommercereservezyx987_validString(objArr[i].status) === 0 ? 'selected' : '') + '>Not Active</option>';
                tempRows += '</select></div>';
                tempRows += '</td></tr>';
            }                    
            jQuery('tbody#dragonecommerce_province').html(tempRows);
            var totalprovincequantity = mydata["total"] == null ? '0' : mydata["total"];
            jQuery('span#totalprovincequantity').text(totalprovincequantity);
            totalprovincequantity = parseInt(mydata["total"]);
            var amountperpage = parseInt(jQuery('select#dragonecommerce_province_itemsperpage').val());
            if(amountperpage === -1) {amountperpage = parseInt(PROVINCE_ITEMS_PER_PAGE_PRESET_VALUE);}
            if(amountperpage > 0) {
                totalpagenumber_onload_admin_province = Math.ceil(totalprovincequantity / amountperpage);
                dragonecommercereservezyx987_createPagination(totalpagenumber_onload_admin_province, pagenumber , 'province');        
            }                    
            jQuery('img#admin_provincelist_loader').hide();
        }).fail(function( jqXHR, textStatus ) {
            //alert( "Request province list failed: " + textStatus );
        });
    }
    
    function dragonecommercereservezyx987_resetProvincesSearchParameters() {    
        jQuery('input#dragonecommerce_province_name').val('');        
        jQuery('select#dragonecommerce_province_countryid').val('-1');
        jQuery('select#dragonecommerce_province_status').val('-1');
        jQuery('select#dragonecommerce_province_itemsperpage').val('-1');
        jQuery('select#dragonecommerce_province_sortby').val('-1');
    }

    function dragonecommercereservezyx987_getCitiesList(pagenumber) {
        var dataObj = {dragonecommercereservezyx987_hidden_security_getcities:"<?php echo wp_create_nonce('dragonecommercereservezyx987_getCities'); ?>",dragonecommercereservezyx987_hidden:"Y",action:"dragonecommercereservezyx987_getCities"};
        dataObj.searchwords = jQuery('input#dragonecommerce_city_name').val();        
        dataObj.countryid = jQuery('select#dragonecommerce_city_countryid').val();        
        dataObj.provinceid = jQuery('select#dragonecommerce_city_provinceid').val();
        dataObj.citystatus = jQuery('select#dragonecommerce_city_status').val();
        dataObj.amountperpage = jQuery('select#dragonecommerce_city_itemsperpage').val();
        if(typeof pagenumber === 'undefined') {pagenumber = 1;}
        dataObj.pagenumber = pagenumber;

        var sortby = jQuery('select#dragonecommerce_city_sortby').val();
        if(sortby === 'id|asc') {
            dataObj.sortby = 'id';
            dataObj.order = 'asc';                  
        } else if(sortby === 'id|desc') {
            dataObj.sortby = 'id';
            dataObj.order = 'desc';                  
        } else if(sortby === 'name|asc') {
            dataObj.sortby = 'name';
            dataObj.order = 'asc';                  
        } else if(sortby === 'name|desc') {
            dataObj.sortby = 'name';
            dataObj.order = 'desc';                      
        } else if(sortby === 'countryname|asc') {
            dataObj.sortby = 'countryname';
            dataObj.order = 'asc';      
        } else if(sortby === 'countryname|desc') {
            dataObj.sortby = 'countryname';
            dataObj.order = 'desc';                  
        } else if(sortby === 'createtimeutc|asc') {
            dataObj.sortby = 'createtimeutc';
            dataObj.order = 'asc';      
        } else if(sortby === 'createtimeutc|desc') {
            dataObj.sortby = 'createtimeutc';
            dataObj.order = 'desc';                  
        }
                
        jQuery('tbody#dragonecommerce_city').html('');
        jQuery('span#totalcityquantity').text('');
        jQuery('img#admin_citylist_loader').show();        
        
        jQuery.ajax({
            type: "POST",
            async: true,
            url: ajaxurl,
            data: dataObj
        }).done(function (mydata) {
            var objArr = mydata["city"];
            var tempRows = '';
            for (var i = 0; i < objArr.length; i++) {
                var temp_button = '';
                temp_button = '<a href="javascript:void(0);" class="btn btn-primary" onclick="dragonecommercereservezyx987_editCity(' + dragonecommercereservezyx987_validString(objArr[i].id) + ', \'dragonecommerce_city_container_\');">Edit</a>';                    
                temp_button += '<a href="javascript:void(0);" style="display:none;" class="btn btn-primary dragonecommerce_city_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" onclick="dragonecommercereservezyx987_saveCity(' + dragonecommercereservezyx987_validString(objArr[i].id) + ', \'dragonecommerce_city_\');">Save</a>';                    
                
                tempRows += '<tr><td>'+ temp_button + '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].id) + '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].name);
                tempRows += '<div style="display:none;" class="dragonecommerce_city_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_city_name_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_city_name_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].name).replace(/"/g, '\\&#34;') + '" /></div>';
                tempRows += '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].description);
                tempRows += '<div style="display:none;" class="dragonecommerce_city_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_city_description_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_city_description_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].description).replace(/"/g, '\\&#34;') + '" /></div>';

                tempRows += '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].countryname);
                tempRows += '<div style="display:none;" class="dragonecommerce_city_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<select name="dragonecommerce_city_countryid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_city_countryid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" onchange="dragonecommercereservezyx987_updateProvincesDropdownList_forTableRow(this);" >';
                tempRows += '<option value="-1">Please choose one...</option>';
                <?php foreach ($allcountries as $country) { ?>
                <?php $country_status_temp = $country->status === '1' ? '' : 'color:grey;'; ?>
                tempRows += "<option " + (dragonecommercereservezyx987_validString(objArr[i].countryid) === <?php echo $country->id === null ? 0 : intval($country->id); ?> ? 'selected' : '') + " value='<?php echo intval($country->id); ?>' style='<?php echo esc_html($country_status_temp); ?>'><?php echo esc_html($country->name); ?></option>";
                <?php } ?>                
                tempRows += '</select></div>';                                
                tempRows += '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].provincename);
                tempRows += '<div style="display:none;" class="dragonecommerce_city_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<select name="dragonecommerce_city_provinceid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_city_provinceid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<option value="-1">Please choose one...</option>';
                <?php foreach ($allprovinces as $province) { ?>
                <?php $country_status_temp = $province->status === '1' ? '' : 'color:grey;'; ?>
                tempRows += "<option " + (dragonecommercereservezyx987_validString(objArr[i].provinceid) === <?php echo $province->id === null ? 0 : intval($province->id); ?> ? 'selected' : '') + " class='<?php echo intval($province->countryid); ?>' value='<?php echo intval($province->id); ?>' style='<?php echo esc_html($country_status_temp); ?>'><?php echo esc_html($province->name); ?></option>";
                <?php } ?>                
                tempRows += '</select></div>';            
                tempRows += '</td>';
                
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].createtimeutc) + '</td><td>' + (dragonecommercereservezyx987_validString(objArr[i].status) === 1 ? '<span style="color:green;">ACTIVE</span>' : '<span style="color:red;">INACTIVE</span>');
                tempRows += '<div style="display:none;" class="dragonecommerce_city_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<select name="dragonecommerce_city_status_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_city_status_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<option value="-1">Choose one...</option>';
                tempRows += '<option value="1"' + (dragonecommercereservezyx987_validString(objArr[i].status) === 1 ? 'selected' : '') + '>Active</option>';
                tempRows += '<option value="0"' + (dragonecommercereservezyx987_validString(objArr[i].status) === 0 ? 'selected' : '') + '>Not Active</option>';
                tempRows += '</select></div>';
                tempRows += '</td></tr>';
            }                                    
            jQuery('tbody#dragonecommerce_city').html(tempRows);
            var totalcityquantity = mydata["total"] == null ? '0' : mydata["total"];
            jQuery('span#totalcityquantity').text(totalcityquantity);
            totalcityquantity = parseInt(mydata["total"]);
            var amountperpage = parseInt(jQuery('select#dragonecommerce_city_itemsperpage').val());
            if(amountperpage === -1) {amountperpage = parseInt(CITY_ITEMS_PER_PAGE_PRESET_VALUE);}
            if(amountperpage > 0) {
                totalpagenumber_onload_admin_city = Math.ceil(totalcityquantity / amountperpage);
                dragonecommercereservezyx987_createPagination(totalpagenumber_onload_admin_city, pagenumber , 'city');        
            }                    
            jQuery('img#admin_citylist_loader').hide();
        }).fail(function( jqXHR, textStatus ) {
            //alert( "Request city list failed: " + textStatus );
        });
    }
    
    function dragonecommercereservezyx987_resetCitiesSearchParameters() {    
        jQuery('input#dragonecommerce_city_name').val('');        
        jQuery('select#dragonecommerce_city_countryid').val('-1');
        jQuery('select#dragonecommerce_city_provinceid').val('-1');
        jQuery('select#dragonecommerce_city_status').val('-1');
        jQuery('select#dragonecommerce_city_itemsperpage').val('-1');
        jQuery('select#dragonecommerce_city_sortby').val('-1');
    }    
    
    function dragonecommercereservezyx987_getDepartmentsList(pagenumber) {
        var dataObj = {dragonecommercereservezyx987_hidden_security_getdepartments:"<?php echo wp_create_nonce('dragonecommercereservezyx987_getDepartments'); ?>",dragonecommercereservezyx987_hidden:"Y",action:"dragonecommercereservezyx987_getDepartments"};
        dataObj.searchwords = jQuery('input#dragonecommerce_department_name').val();
        dataObj.departmentstatus = jQuery('select#dragonecommerce_department_status').val();
        dataObj.amountperpage = jQuery('select#dragonecommerce_department_itemsperpage').val();
        if(typeof pagenumber === 'undefined') {pagenumber = 1;}
        dataObj.pagenumber = pagenumber;

        var sortby = jQuery('select#dragonecommerce_department_sortby').val();
        if(sortby === 'id|asc') {
            dataObj.sortby = 'id';
            dataObj.order = 'asc';                  
        } else if(sortby === 'id|desc') {
            dataObj.sortby = 'id';
            dataObj.order = 'desc';                  
        } else if(sortby === 'name|asc') {
            dataObj.sortby = 'name';
            dataObj.order = 'asc';                  
        } else if(sortby === 'name|desc') {
            dataObj.sortby = 'name';
            dataObj.order = 'desc';                      
        } else if(sortby === 'createtimeutc|asc') {
            dataObj.sortby = 'createtimeutc';
            dataObj.order = 'asc';      
        } else if(sortby === 'createtimeutc|desc') {
            dataObj.sortby = 'createtimeutc';
            dataObj.order = 'desc';                  
        }
                
        jQuery('tbody#dragonecommerce_department').html('');
        jQuery('span#totaldepartmentquantity').text('');
        jQuery('img#admin_departmentlist_loader').show();        
        
        jQuery.ajax({
            type: "POST",
            async: true,
            url: ajaxurl,
            data: dataObj
        }).done(function (mydata) {
            var objArr = mydata["department"];
            var tempRows = '';
            for (var i = 0; i < objArr.length; i++) {
                var temp_button = '';
                temp_button = '<a href="javascript:void(0);" class="btn btn-primary" onclick="dragonecommercereservezyx987_editDepartment(' + dragonecommercereservezyx987_validString(objArr[i].id) + ', \'dragonecommerce_department_container_\');">Edit</a>';
                temp_button += '<a href="javascript:void(0);" style="display:none;" class="btn btn-primary dragonecommerce_department_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" onclick="dragonecommercereservezyx987_saveDepartment(' + dragonecommercereservezyx987_validString(objArr[i].id) + ', \'dragonecommerce_department_\');">Save</a>';                    
                
                tempRows += '<tr><td>'+ temp_button + '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].id) + '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].name);
                tempRows += '<div style="display:none;" class="dragonecommerce_department_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_department_name_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_department_name_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].name).replace(/"/g, '\\&#34;') + '" /></div>';

                tempRows += '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].description);
                tempRows += '<div style="display:none;" class="dragonecommerce_department_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_department_description_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_department_description_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].description).replace(/"/g, '\\&#34;') + '" /></div>';                
                tempRows += '</td>';
                
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].createtimeutc) + '</td><td>' + (dragonecommercereservezyx987_validString(objArr[i].status) === 1 ? '<span style="color:green;">ACTIVE</span>' : '<span style="color:red;">INACTIVE</span>');
                tempRows += '<div style="display:none;" class="dragonecommerce_department_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<select name="dragonecommerce_department_status_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_department_status_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<option value="-1">Choose one...</option>';
                tempRows += '<option value="1"' + (dragonecommercereservezyx987_validString(objArr[i].status) === 1 ? 'selected' : '') + '>Active</option>';
                tempRows += '<option value="0"' + (dragonecommercereservezyx987_validString(objArr[i].status) === 0 ? 'selected' : '') + '>Not Active</option>';
                tempRows += '</select></div>';

                tempRows += '</td></tr>';
            }                                    
            jQuery('tbody#dragonecommerce_department').html(tempRows);
            var totaldepartmentquantity = mydata["total"] == null ? '0' : mydata["total"];
            jQuery('span#totaldepartmentquantity').text(totaldepartmentquantity);
            totaldepartmentquantity = parseInt(mydata["total"]);
            var amountperpage = parseInt(jQuery('select#dragonecommerce_department_itemsperpage').val());
            if(amountperpage === -1) {amountperpage = parseInt(DEPARTMENT_ITEMS_PER_PAGE_PRESET_VALUE);}
            if(amountperpage > 0) {
                totalpagenumber_onload_admin_department = Math.ceil(totaldepartmentquantity / amountperpage);
                dragonecommercereservezyx987_createPagination(totalpagenumber_onload_admin_department, pagenumber , 'department');        
            }                    
            jQuery('img#admin_departmentlist_loader').hide();
        }).fail(function( jqXHR, textStatus ) {
            //alert( "Request department list failed: " + textStatus );
        });
    }
    
    function dragonecommercereservezyx987_resetDepartmentsSearchParameters() {    
        jQuery('input#dragonecommerce_department_name').val('');        
        jQuery('select#dragonecommerce_department_status').val('-1');
        jQuery('select#dragonecommerce_department_itemsperpage').val('-1');
        jQuery('select#dragonecommerce_department_sortby').val('-1');
    }
    
    function dragonecommercereservezyx987_getCurrenciesList(pagenumber) {
        var dataObj = {dragonecommercereservezyx987_hidden_security_getcurrencies:"<?php echo wp_create_nonce('dragonecommercereservezyx987_getCurrencies'); ?>",dragonecommercereservezyx987_hidden:"Y",action:"dragonecommercereservezyx987_getCurrencies"};
        dataObj.searchwords = jQuery('input#dragonecommerce_currency_name').val();
        dataObj.currencystatus = jQuery('select#dragonecommerce_currency_status').val();
        dataObj.amountperpage = jQuery('select#dragonecommerce_currency_itemsperpage').val();
        if(typeof pagenumber === 'undefined') {pagenumber = 1;}
        dataObj.pagenumber = pagenumber;

        var sortby = jQuery('select#dragonecommerce_currency_sortby').val();
        if(sortby === 'id|asc') {
            dataObj.sortby = 'id';
            dataObj.order = 'asc';                  
        } else if(sortby === 'id|desc') {
            dataObj.sortby = 'id';
            dataObj.order = 'desc';                  
        } else if(sortby === 'name|asc') {
            dataObj.sortby = 'name';
            dataObj.order = 'asc';                  
        } else if(sortby === 'name|desc') {
            dataObj.sortby = 'name';
            dataObj.order = 'desc';                      
        } else if(sortby === 'createtimeutc|asc') {
            dataObj.sortby = 'createtimeutc';
            dataObj.order = 'asc';      
        } else if(sortby === 'createtimeutc|desc') {
            dataObj.sortby = 'createtimeutc';
            dataObj.order = 'desc';                  
        }            
        jQuery('tbody#dragonecommerce_currency').html('');
        jQuery('span#totalcurrencyquantity').text('');
        jQuery('img#admin_currencylist_loader').show();
        jQuery.ajax({
            type: "POST",
            async: true,
            url: ajaxurl,
            data: dataObj
        }).done(function (mydata) {
            var objArr = mydata["currency"];
            var tempRows = '';
            for (var i = 0; i < objArr.length; i++) {
                var temp_button = '';
                temp_button = '<a href="javascript:void(0);" class="btn btn-primary" onclick="dragonecommercereservezyx987_editCurrency(' + dragonecommercereservezyx987_validString(objArr[i].id) + ', \'dragonecommerce_currency_container_\');">Edit</a>';                    
                temp_button += '<a href="javascript:void(0);" style="display:none;" class="btn btn-primary dragonecommerce_currency_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" onclick="dragonecommercereservezyx987_saveCurrency(' + dragonecommercereservezyx987_validString(objArr[i].id) + ', \'dragonecommerce_currency_\');">Save</a>';                    
                
                tempRows += '<tr><td>'+ temp_button + '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].id) + '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].name);
                tempRows += '<div style="display:none;" class="dragonecommerce_currency_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_currency_name_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_currency_name_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].name).replace(/"/g, '\\&#34;') + '" /></div>';

                tempRows += '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].sign);
                tempRows += '<div style="display:none;" class="dragonecommerce_currency_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_currency_sign_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_currency_sign_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].sign).replace(/"/g, '\\&#34;') + '" /></div>';
                tempRows += '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].isocurrencycode);
                tempRows += '<div style="display:none;" class="dragonecommerce_currency_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_currency_isocurrencycode_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_currency_isocurrencycode_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].isocurrencycode).replace(/"/g, '\\&#34;') + '" /></div>';
                tempRows += '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].description);
                tempRows += '<div style="display:none;" class="dragonecommerce_currency_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_currency_description_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_currency_description_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].description).replace(/"/g, '\\&#34;') + '" /></div>';            
                tempRows += '</td>';
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].createtimeutc) + '</td><td>' + (dragonecommercereservezyx987_validString(objArr[i].status) === 1 ? '<span style="color:green;">ACTIVE</span>' : '<span style="color:red;">INACTIVE</span>');
                tempRows += '<div style="display:none;" class="dragonecommerce_currency_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<select name="dragonecommerce_currency_status_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_currency_status_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<option value="-1">Choose one...</option>';
                tempRows += '<option value="1"' + (dragonecommercereservezyx987_validString(objArr[i].status) === 1 ? 'selected' : '') + '>Active</option>';
                tempRows += '<option value="0"' + (dragonecommercereservezyx987_validString(objArr[i].status) === 0 ? 'selected' : '') + '>Not Active</option>';
                tempRows += '</select></div>';
                tempRows += '</td></tr>';
            }                                    
            jQuery('tbody#dragonecommerce_currency').html(tempRows);
            var totalcurrencyquantity = mydata["total"] == null ? '0' : mydata["total"];
            jQuery('span#totalcurrencyquantity').text(totalcurrencyquantity);
            totalcurrencyquantity = parseInt(mydata["total"]);
            var amountperpage = parseInt(jQuery('select#dragonecommerce_currency_itemsperpage').val());
            if(amountperpage === -1) {amountperpage = parseInt(CURRENCY_ITEMS_PER_PAGE_PRESET_VALUE);}
            if(amountperpage > 0) {
                totalpagenumber_onload_admin_currency = Math.ceil(totalcurrencyquantity / amountperpage);
                dragonecommercereservezyx987_createPagination(totalpagenumber_onload_admin_currency, pagenumber , 'currency');        
            }                    
            jQuery('img#admin_currencylist_loader').hide();
        }).fail(function( jqXHR, textStatus ) {
            //alert( "Request currency list failed: " + textStatus );
        });
    }
    
    function dragonecommercereservezyx987_resetCurrenciesSearchParameters() {    
        jQuery('input#dragonecommerce_currency_name').val('');        
        jQuery('select#dragonecommerce_currency_status').val('-1');
        jQuery('select#dragonecommerce_currency_itemsperpage').val('-1');
        jQuery('select#dragonecommerce_currency_sortby').val('-1');
    }
    
    function dragonecommercereservezyx987_getGroupcategoriesList(pagenumber) {
        var dataObj = {dragonecommercereservezyx987_hidden_security_getgroupcategories:"<?php echo wp_create_nonce('dragonecommercereservezyx987_getGroupcategories'); ?>",dragonecommercereservezyx987_hidden:"Y",action:"dragonecommercereservezyx987_getGroupcategories"};
        dataObj.searchwords = jQuery('input#dragonecommerce_groupcategory_name').val();        
        dataObj.groupcategorystatus = jQuery('select#dragonecommerce_groupcategory_status').val();
        dataObj.amountperpage = jQuery('select#dragonecommerce_groupcategory_itemsperpage').val();
        if(typeof pagenumber === 'undefined') {pagenumber = 1;}
        dataObj.pagenumber = pagenumber;

        var sortby = jQuery('select#dragonecommerce_groupcategory_sortby').val();
        if(sortby === 'id|asc') {
            dataObj.sortby = 'id';
            dataObj.order = 'asc';                  
        } else if(sortby === 'id|desc') {
            dataObj.sortby = 'id';
            dataObj.order = 'desc';                  
        } else if(sortby === 'name|asc') {
            dataObj.sortby = 'name';
            dataObj.order = 'asc';                  
        } else if(sortby === 'name|desc') {
            dataObj.sortby = 'name';
            dataObj.order = 'desc';                      
        } else if(sortby === 'createtimeutc|asc') {
            dataObj.sortby = 'createtimeutc';
            dataObj.order = 'asc';      
        } else if(sortby === 'createtimeutc|desc') {
            dataObj.sortby = 'createtimeutc';
            dataObj.order = 'desc';                  
        }
                
        jQuery('tbody#dragonecommerce_groupcategory').html('');
        jQuery('span#totalgroupcategoryquantity').text('');
        jQuery('img#admin_groupcategorylist_loader').show();        
        
        jQuery.ajax({
            type: "POST",
            async: true,
            url: ajaxurl,
            data: dataObj
        }).done(function (mydata) {
            var objArr = mydata["groupcategory"];
            var tempRows = '';
            for (var i = 0; i < objArr.length; i++) {
                var temp_button = '';
                temp_button = '<a href="javascript:void(0);" class="btn btn-primary" onclick="dragonecommercereservezyx987_editGroupcategory(' + dragonecommercereservezyx987_validString(objArr[i].id) + ', \'dragonecommerce_groupcategory_container_\');">Edit</a>';
                temp_button += '<a href="javascript:void(0);" style="display:none;" class="btn btn-primary dragonecommerce_groupcategory_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" onclick="dragonecommercereservezyx987_saveGroupcategory(' + dragonecommercereservezyx987_validString(objArr[i].id) + ', \'dragonecommerce_groupcategory_\');">Save</a>';                    
                
                tempRows += '<tr><td>'+ temp_button + '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].id) + '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].name);
                tempRows += '<div style="display:none;" class="dragonecommerce_groupcategory_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_groupcategory_name_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_groupcategory_name_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].name).replace(/"/g, '\\&#34;') + '" /></div>';

                tempRows += '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].description);
                tempRows += '<div style="display:none;" class="dragonecommerce_groupcategory_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_groupcategory_description_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_groupcategory_description_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].description).replace(/"/g, '\\&#34;') + '" /></div>';                
                tempRows += '</td>';

                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].priority);
                tempRows += '<div style="display:none;" class="dragonecommerce_groupcategory_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_groupcategory_priority_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_groupcategory_priority_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].priority) + '" /></div>';                
                tempRows += '</td>';
                
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].createtimeutc) + '</td>';
                
                tempRows += '<td>' + (dragonecommercereservezyx987_validString(objArr[i].mandatory) === 1 ? '<span style="color:green;">Yes</span>' : '<span style="color:red;">No</span>');
                tempRows += '<div style="display:none;" class="dragonecommerce_groupcategory_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<select name="dragonecommerce_groupcategory_mandatory_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_groupcategory_mandatory_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<option value="-1">Choose one...</option>';
                tempRows += '<option value="1"' + (dragonecommercereservezyx987_validString(objArr[i].mandatory) === 1 ? 'selected' : '') + '>Yes</option>';
                tempRows += '<option value="0"' + (dragonecommercereservezyx987_validString(objArr[i].mandatory) === 0 ? 'selected' : '') + '>No</option>';
                tempRows += '</select></div></td>';

                tempRows += '<td>' + (dragonecommercereservezyx987_validString(objArr[i].status) === 1 ? '<span style="color:green;">ACTIVE</span>' : '<span style="color:red;">INACTIVE</span>');
                tempRows += '<div style="display:none;" class="dragonecommerce_groupcategory_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<select name="dragonecommerce_groupcategory_status_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_groupcategory_status_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<option value="-1">Choose one...</option>';
                tempRows += '<option value="1"' + (dragonecommercereservezyx987_validString(objArr[i].status) === 1 ? 'selected' : '') + '>Active</option>';
                tempRows += '<option value="0"' + (dragonecommercereservezyx987_validString(objArr[i].status) === 0 ? 'selected' : '') + '>Not Active</option>';
                tempRows += '</select></div></td>';
                
                tempRows += '</tr>';
            }                                    
            jQuery('tbody#dragonecommerce_groupcategory').html(tempRows);
            var totalgroupcategoryquantity = mydata["total"] == null ? '0' : mydata["total"];
            jQuery('span#totalgroupcategoryquantity').text(totalgroupcategoryquantity);
            totalgroupcategoryquantity = parseInt(mydata["total"]);
            var amountperpage = parseInt(jQuery('select#dragonecommerce_groupcategory_itemsperpage').val());
            if(amountperpage === -1) {amountperpage = parseInt(GROUPCATEGORY_ITEMS_PER_PAGE_PRESET_VALUE);}
            if(amountperpage > 0) {
                totalpagenumber_onload_admin_groupcategory = Math.ceil(totalgroupcategoryquantity / amountperpage);
                dragonecommercereservezyx987_createPagination(totalpagenumber_onload_admin_groupcategory, pagenumber , 'groupcategory');        
            }                    
            jQuery('img#admin_groupcategorylist_loader').hide();
        }).fail(function( jqXHR, textStatus ) {
            //alert( "Request group category list failed: " + textStatus );
        });
    }
    
    function dragonecommercereservezyx987_resetGroupcategoriesSearchParameters() {    
        jQuery('input#dragonecommerce_groupcategory_name').val('');
        jQuery('select#dragonecommerce_groupcategory_status').val('-1');
        jQuery('select#dragonecommerce_groupcategory_itemsperpage').val('-1');
        jQuery('select#dragonecommerce_groupcategory_sortby').val('-1');
    }
    
    function dragonecommercereservezyx987_getProcessstatusesList(pagenumber) {
        var dataObj = {dragonecommercereservezyx987_hidden_security_getprocessstatuses:"<?php echo wp_create_nonce('dragonecommercereservezyx987_getProcessstatuses'); ?>",dragonecommercereservezyx987_hidden:"Y",action:"dragonecommercereservezyx987_getProcessstatuses"};
        dataObj.searchwords = jQuery('input#dragonecommerce_processstatus_name').val();
        dataObj.processstatusstatus = jQuery('select#dragonecommerce_processstatus_status').val();
        dataObj.amountperpage = jQuery('select#dragonecommerce_processstatus_itemsperpage').val();
        if(typeof pagenumber === 'undefined') {pagenumber = 1;}
        dataObj.pagenumber = pagenumber;

        var sortby = jQuery('select#dragonecommerce_processstatus_sortby').val();
        if(sortby === 'id|asc') {
            dataObj.sortby = 'id';
            dataObj.order = 'asc';                  
        } else if(sortby === 'id|desc') {
            dataObj.sortby = 'id';
            dataObj.order = 'desc';                  
        } else if(sortby === 'name|asc') {
            dataObj.sortby = 'name';
            dataObj.order = 'asc';                  
        } else if(sortby === 'name|desc') {
            dataObj.sortby = 'name';
            dataObj.order = 'desc';                      
        } else if(sortby === 'createtimeutc|asc') {
            dataObj.sortby = 'createtimeutc';
            dataObj.order = 'asc';      
        } else if(sortby === 'createtimeutc|desc') {
            dataObj.sortby = 'createtimeutc';
            dataObj.order = 'desc';                  
        }
                
        jQuery('tbody#dragonecommerce_processstatus').html('');
        jQuery('span#totalprocessstatusquantity').text('');
        jQuery('img#admin_processstatuslist_loader').show();        

        jQuery.ajax({
            type: "POST",
            async: true,
            url: ajaxurl,
            data: dataObj
        }).done(function (mydata) {
            var objArr = mydata["processstatus"];
            var tempRows = '';
            for (var i = 0; i < objArr.length; i++) {
                var temp_button = '';
                temp_button = '<a href="javascript:void(0);" class="btn btn-primary" onclick="dragonecommercereservezyx987_editProcessstatus(' + dragonecommercereservezyx987_validString(objArr[i].id) + ', \'dragonecommerce_processstatus_container_\');">Edit</a>';
                temp_button += '<a href="javascript:void(0);" style="display:none;" class="btn btn-primary dragonecommerce_processstatus_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" onclick="dragonecommercereservezyx987_saveProcessstatus(' + dragonecommercereservezyx987_validString(objArr[i].id) + ', \'dragonecommerce_processstatus_\');">Save</a>';
                
                tempRows += '<tr><td>'+ temp_button + '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].id) + '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].name);
                tempRows += '<div style="display:none;" class="dragonecommerce_processstatus_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_processstatus_name_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_processstatus_name_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].name).replace(/"/g, '\\&#34;') + '" /></div>';

                tempRows += '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].description);
                tempRows += '<div style="display:none;" class="dragonecommerce_processstatus_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_processstatus_description_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_processstatus_description_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].description).replace(/"/g, '\\&#34;') + '" /></div>';
                
                tempRows += '</td>';
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].createtimeutc) + '</td><td>' + (dragonecommercereservezyx987_validString(objArr[i].status) === 1 ? '<span style="color:green;">ACTIVE</span>' : '<span style="color:red;">INACTIVE</span>');
                tempRows += '<div style="display:none;" class="dragonecommerce_processstatus_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<select name="dragonecommerce_processstatus_status_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_processstatus_status_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<option value="-1">Choose one...</option>';
                tempRows += '<option value="1" ' + (dragonecommercereservezyx987_validString(objArr[i].status) === 1 ? 'selected' : '') + '>Active</option>';
                tempRows += '<option value="0" ' + (dragonecommercereservezyx987_validString(objArr[i].status) === 0 ? 'selected' : '') + '>Not Active</option>';
                tempRows += '</select></div>';
                tempRows += '</td></tr>';
            }                                    
            jQuery('tbody#dragonecommerce_processstatus').html(tempRows);
            var totalprocessstatusquantity = mydata["total"] == null ? '0' : mydata["total"];
            jQuery('span#totalprocessstatusquantity').text(totalprocessstatusquantity);
            totalprocessstatusquantity = parseInt(mydata["total"]);
            var amountperpage = parseInt(jQuery('select#dragonecommerce_processstatus_itemsperpage').val());
            if(amountperpage === -1) {amountperpage = parseInt(PROCESSSTATUS_ITEMS_PER_PAGE_PRESET_VALUE);}
            if(amountperpage > 0) {
                totalpagenumber_onload_admin_processstatus = Math.ceil(totalprocessstatusquantity / amountperpage);
                dragonecommercereservezyx987_createPagination(totalpagenumber_onload_admin_processstatus, pagenumber , 'processstatus');        
            }                    
            jQuery('img#admin_processstatuslist_loader').hide();
        }).fail(function( jqXHR, textStatus ) {
            //alert( "Request process status list failed: " + textStatus );
        });
    }
    
    function dragonecommercereservezyx987_resetProcessstatusesSearchParameters() {    
        jQuery('input#dragonecommerce_processstatus_name').val('');        
        jQuery('select#dragonecommerce_processstatus_status').val('-1');
        jQuery('select#dragonecommerce_processstatus_itemsperpage').val('-1');    
        jQuery('select#dragonecommerce_processstatus_sortby').val('-1');
    }
    
    function dragonecommercereservezyx987_getGroupsList(pagenumber) {
        var dataObj = {dragonecommercereservezyx987_hidden_security_getgroups:"<?php echo wp_create_nonce('dragonecommercereservezyx987_getGroups'); ?>",dragonecommercereservezyx987_hidden:"Y",action:"dragonecommercereservezyx987_getGroups"};
        dataObj.searchwords = jQuery('input#dragonecommerce_group_name').val();        
        dataObj.groupcategoryname = jQuery('input#dragonecommerce_group_groupcategoryname').val();
        dataObj.groupstatus = jQuery('select#dragonecommerce_group_status').val();
        dataObj.amountperpage = jQuery('select#dragonecommerce_group_itemsperpage').val();
        if(typeof pagenumber === 'undefined') {pagenumber = 1;}
        dataObj.pagenumber = pagenumber;

        var sortby = jQuery('select#dragonecommerce_group_sortby').val();
        if(sortby === 'id|asc') {
            dataObj.sortby = 'id';
            dataObj.order = 'asc';                  
        } else if(sortby === 'id|desc') {
            dataObj.sortby = 'id';
            dataObj.order = 'desc';                  
        } else if(sortby === 'name|asc') {
            dataObj.sortby = 'name';
            dataObj.order = 'asc';                  
        } else if(sortby === 'name|desc') {
            dataObj.sortby = 'name';
            dataObj.order = 'desc';                      
        } else if(sortby === 'groupcategoryname|asc') {
            dataObj.sortby = 'groupcategoryname';
            dataObj.order = 'asc';      
        } else if(sortby === 'groupcategoryname|desc') {
            dataObj.sortby = 'groupcategoryname';
            dataObj.order = 'desc';                  
        } else if(sortby === 'createtimeutc|asc') {
            dataObj.sortby = 'createtimeutc';
            dataObj.order = 'asc';      
        } else if(sortby === 'createtimeutc|desc') {
            dataObj.sortby = 'createtimeutc';
            dataObj.order = 'desc';                  
        }
                
        jQuery('tbody#dragonecommerce_group').html('');
        jQuery('span#totalgroupquantity').text('');
        jQuery('img#admin_grouplist_loader').show();        
        
        jQuery.ajax({
            type: "POST",
            async: true,
            url: ajaxurl,
            data: dataObj
        }).done(function (mydata) {
            var objArr = mydata["group"];
            var tempRows = '';
            for (var i = 0; i < objArr.length; i++) {
                var temp_button = '';
                temp_button = '<a href="javascript:void(0);" class="btn btn-primary" onclick="dragonecommercereservezyx987_editGroup(' + dragonecommercereservezyx987_validString(objArr[i].id) + ', \'dragonecommerce_group_container_\');">Edit</a>';
                temp_button += '<a href="javascript:void(0);" style="display:none;" class="btn btn-primary dragonecommerce_group_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" onclick="dragonecommercereservezyx987_saveGroup(' + dragonecommercereservezyx987_validString(objArr[i].id) + ', \'dragonecommerce_group_\');">Save</a>';                    
                
                tempRows += '<tr><td>'+ temp_button + '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].id) + '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].name);
                tempRows += '<div style="display:none;" class="dragonecommerce_group_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_group_name_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_group_name_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].name).replace(/"/g, '\\&#34;') + '" /></div>';

                tempRows += '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].description);
                tempRows += '<div style="display:none;" class="dragonecommerce_group_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_group_description_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_group_description_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].description).replace(/"/g, '\\&#34;') + '" /></div>';                
                tempRows += '</td>';
                                                            
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].groupcategoryname) + '(' + dragonecommercereservezyx987_validString(objArr[i].groupcategoryid) + ')';
                tempRows += '<div style="display:none;" class="dragonecommerce_group_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';

                tempRows += '<select name="dragonecommerce_group_groupcategoryid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_group_groupcategoryid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';

                tempRows += '<option value="-1">Please choose one...</option>';
                <?php foreach ($allgroupcategories as $groupcategory) { ?>
                <?php $groupcategory_status_temp = $groupcategory->status === '1' ? '' : 'color:grey;'; ?>
                tempRows += "<option " + (dragonecommercereservezyx987_validString(objArr[i].groupcategoryid) === <?php echo $groupcategory->id === null ? 0 : intval($groupcategory->id); ?> ? 'selected' : '') + " value='<?php echo intval($groupcategory->id); ?>' style='<?php echo esc_html($groupcategory_status_temp); ?>'><?php echo esc_html($groupcategory->name); ?></option>";
                <?php } ?>                
                tempRows += '</select></div></td>';                
                                                    
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].priority);
                tempRows += '<div style="display:none;" class="dragonecommerce_group_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_group_priority_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_group_priority_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].priority) + '" /></div>';                
                tempRows += '</td>';
                                
                tempRows += '<td>' + (dragonecommercereservezyx987_validString(objArr[i].searchable) === 1 ? '<span style="color:green;">Yes</span>' : '<span style="color:red;">No</span>');
                tempRows += '<div style="display:none;" class="dragonecommerce_group_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<select name="dragonecommerce_group_searchable_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_group_searchable_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<option value="-1">Choose one...</option>';
                tempRows += '<option value="1"' + (dragonecommercereservezyx987_validString(objArr[i].searchable) === 1 ? 'selected' : '') + '>Yes</option>';
                tempRows += '<option value="0"' + (dragonecommercereservezyx987_validString(objArr[i].searchable) === 0 ? 'selected' : '') + '>No</option>';
                tempRows += '</select></div></td>';

                tempRows += '<td>' + (dragonecommercereservezyx987_validString(objArr[i].forallproduct) === 1 ? '<span style="color:green;">Yes</span>' : '<span style="color:red;">No</span>');
                tempRows += '<div style="display:none;" class="dragonecommerce_group_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<select name="dragonecommerce_group_forallproduct_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_group_forallproduct_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<option value="-1">Choose one...</option>';
                tempRows += '<option value="1"' + (dragonecommercereservezyx987_validString(objArr[i].forallproduct) === 1 ? 'selected' : '') + '>Yes</option>';
                tempRows += '<option value="0"' + (dragonecommercereservezyx987_validString(objArr[i].forallproduct) === 0 ? 'selected' : '') + '>No</option>';
                tempRows += '</select></div></td>';
                
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].createtimeutc) + '</td>';
                
                tempRows += '<td>' + (dragonecommercereservezyx987_validString(objArr[i].status) === 1 ? '<span style="color:green;">ACTIVE</span>' : '<span style="color:red;">INACTIVE</span>');
                tempRows += '<div style="display:none;" class="dragonecommerce_group_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<select name="dragonecommerce_group_status_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_group_status_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<option value="-1">Choose one...</option>';
                tempRows += '<option value="1"' + (dragonecommercereservezyx987_validString(objArr[i].status) === 1 ? 'selected' : '') + '>Active</option>';
                tempRows += '<option value="0"' + (dragonecommercereservezyx987_validString(objArr[i].status) === 0 ? 'selected' : '') + '>Not Active</option>';
                tempRows += '</select></div></td>';
                
                tempRows += '</tr>';
            }                                    
            jQuery('tbody#dragonecommerce_group').html(tempRows);
            var totalgroupquantity = mydata["total"] == null ? '0' : mydata["total"];
            jQuery('span#totalgroupquantity').text(totalgroupquantity);
            totalgroupquantity = parseInt(mydata["total"]);
            var amountperpage = parseInt(jQuery('select#dragonecommerce_group_itemsperpage').val());
            if(amountperpage === -1) {amountperpage = parseInt(GROUP_ITEMS_PER_PAGE_PRESET_VALUE);}
            if(amountperpage > 0) {
                totalpagenumber_onload_admin_group = Math.ceil(totalgroupquantity / amountperpage);
                dragonecommercereservezyx987_createPagination(totalpagenumber_onload_admin_group, pagenumber , 'group');        
            }                    
            jQuery('img#admin_grouplist_loader').hide();
        }).fail(function( jqXHR, textStatus ) {
            //alert( "Request group list failed: " + textStatus );
        });
    }
    
    function dragonecommercereservezyx987_resetGroupsSearchParameters() {    
        jQuery('input#dragonecommerce_group_name').val('');        
        jQuery('input#dragonecommerce_group_groupcategoryname').val('');
        jQuery('select#dragonecommerce_group_status').val('-1');
        jQuery('select#dragonecommerce_group_itemsperpage').val('-1');    
        jQuery('select#dragonecommerce_group_sortby').val('-1');
    }
    
    function dragonecommercereservezyx987_getChargetypesList(pagenumber) {
        var dataObj = {dragonecommercereservezyx987_hidden_security_getchargetypes:"<?php echo wp_create_nonce('dragonecommercereservezyx987_getChargetypes'); ?>",dragonecommercereservezyx987_hidden:"Y",action:"dragonecommercereservezyx987_getChargetypes"};
        dataObj.searchwords = jQuery('input#dragonecommerce_chargetype_name').val();
        dataObj.chargetypestatus = jQuery('select#dragonecommerce_chargetype_status').val();
        dataObj.amountperpage = jQuery('select#dragonecommerce_chargetype_itemsperpage').val();
        if(typeof pagenumber === 'undefined') {pagenumber = 1;}
        dataObj.pagenumber = pagenumber;

        var sortby = jQuery('select#dragonecommerce_chargetype_sortby').val();
        if(sortby === 'id|asc') {
            dataObj.sortby = 'id';
            dataObj.order = 'asc';                  
        } else if(sortby === 'id|desc') {
            dataObj.sortby = 'id';
            dataObj.order = 'desc';                  
        } else if(sortby === 'name|asc') {
            dataObj.sortby = 'name';
            dataObj.order = 'asc';                  
        } else if(sortby === 'name|desc') {
            dataObj.sortby = 'name';
            dataObj.order = 'desc';                      
        } else if(sortby === 'createtimeutc|asc') {
            dataObj.sortby = 'createtimeutc';
            dataObj.order = 'asc';      
        } else if(sortby === 'createtimeutc|desc') {
            dataObj.sortby = 'createtimeutc';
            dataObj.order = 'desc';                  
        }
                
        jQuery('tbody#dragonecommerce_chargetype').html('');
        jQuery('span#totalchargetypequantity').text('');
        jQuery('img#admin_chargetypelist_loader').show();        
        
        jQuery.ajax({
            type: "POST",
            async: true,
            url: ajaxurl,
            data: dataObj
        }).done(function (mydata) {
            var objArr = mydata["chargetype"];
            var tempRows = '';
            for (var i = 0; i < objArr.length; i++) {
                var temp_button = '';
                temp_button = '<a href="javascript:void(0);" class="btn btn-primary" onclick="dragonecommercereservezyx987_editChargetype(' + dragonecommercereservezyx987_validString(objArr[i].id) + ', \'dragonecommerce_chargetype_container_\');">Edit</a>';
                temp_button += '<a href="javascript:void(0);" style="display:none;" class="btn btn-primary dragonecommerce_chargetype_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" onclick="dragonecommercereservezyx987_saveChargetype(' + dragonecommercereservezyx987_validString(objArr[i].id) + ', \'dragonecommerce_chargetype_\');">Save</a>';                    
                
                tempRows += '<tr><td>'+ temp_button + '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].id) + '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].name);
                tempRows += '<div style="display:none;" class="dragonecommerce_chargetype_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_chargetype_name_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_chargetype_name_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].name).replace(/"/g, '\\&#34;') + '" /></div>';

                tempRows += '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].description);
                tempRows += '<div style="display:none;" class="dragonecommerce_chargetype_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_chargetype_description_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_chargetype_description_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].description).replace(/"/g, '\\&#34;') + '" /></div>';                
                tempRows += '</td>';

                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].priority);
                tempRows += '<div style="display:none;" class="dragonecommerce_chargetype_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_chargetype_priority_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_chargetype_priority_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].priority) + '" /></div>';                
                tempRows += '</td>';
                
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].createtimeutc) + '</td>';
                
                tempRows += '<td>' + (dragonecommercereservezyx987_validString(objArr[i].status) === 1 ? '<span style="color:green;">ACTIVE</span>' : '<span style="color:red;">INACTIVE</span>');
                tempRows += '<div style="display:none;" class="dragonecommerce_chargetype_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<select name="dragonecommerce_chargetype_status_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_chargetype_status_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<option value="-1">Choose one...</option>';
                tempRows += '<option value="1"' + (dragonecommercereservezyx987_validString(objArr[i].status) === 1 ? 'selected' : '') + '>Active</option>';
                tempRows += '<option value="0"' + (dragonecommercereservezyx987_validString(objArr[i].status) === 0 ? 'selected' : '') + '>Not Active</option>';
                tempRows += '</select></div></td>';
                
                tempRows += '</tr>';
            }                                    
            jQuery('tbody#dragonecommerce_chargetype').html(tempRows);
            var totalchargetypequantity = mydata["total"] == null ? '0' : mydata["total"];
            jQuery('span#totalchargetypequantity').text(totalchargetypequantity);
            totalchargetypequantity = parseInt(mydata["total"]);
            var amountperpage = parseInt(jQuery('select#dragonecommerce_chargetype_itemsperpage').val());
            if(amountperpage === -1) {amountperpage = parseInt(CHARGETYPE_ITEMS_PER_PAGE_PRESET_VALUE);}
            if(amountperpage > 0) {
                totalpagenumber_onload_admin_chargetype = Math.ceil(totalchargetypequantity / amountperpage);
                dragonecommercereservezyx987_createPagination(totalpagenumber_onload_admin_chargetype, pagenumber , 'chargetype');        
            }                    
            jQuery('img#admin_chargetypelist_loader').hide();
        }).fail(function( jqXHR, textStatus ) {
            //alert( "Request charge type list failed: " + textStatus );
        });
    }
    
    function dragonecommercereservezyx987_resetChargetypesSearchParameters() {    
        jQuery('input#dragonecommerce_chargetype_name').val('');
        jQuery('select#dragonecommerce_chargetype_status').val('-1');
        jQuery('select#dragonecommerce_chargetype_itemsperpage').val('-1');
        jQuery('select#dragonecommerce_chargetype_sortby').val('-1');
    }

    function dragonecommercereservezyx987_getDistancesList(pagenumber) {
        var dataObj = {dragonecommercereservezyx987_hidden_security_getdistances:"<?php echo wp_create_nonce('dragonecommercereservezyx987_getDistances'); ?>",dragonecommercereservezyx987_hidden:"Y",action:"dragonecommercereservezyx987_getDistances"};
        dataObj.status = jQuery('select#dragonecommerce_distance_status').val();
        dataObj.amountperpage = jQuery('select#dragonecommerce_distance_itemsperpage').val();
        if(typeof pagenumber === 'undefined') {pagenumber = 1;}
        dataObj.pagenumber = pagenumber;
                    
        var sortby = jQuery('select#dragonecommerce_distance_sortby').val();
        if(sortby === 'id|asc') {
            dataObj.sortby = 'id';
            dataObj.order = 'asc';                  
        } else if(sortby === 'id|desc') {
            dataObj.sortby = 'id';
            dataObj.order = 'desc';                  
        } else if(sortby === 'name|asc') {
            dataObj.sortby = 'name';
            dataObj.order = 'asc';      
        } else if(sortby === 'name|desc') {
            dataObj.sortby = 'name';
            dataObj.order = 'desc';                  
        } else if(sortby === 'createtimeutc|asc') {
            dataObj.sortby = 'createtimeutc';
            dataObj.order = 'asc';      
        } else if(sortby === 'createtimeutc|desc') {
            dataObj.sortby = 'createtimeutc';
            dataObj.order = 'desc';                  
        }
                
        jQuery('tbody#dragonecommerce_distance').html('');
        jQuery('span#totaldistancequantity').text('');
        jQuery('img#admin_distancelist_loader').show();        
        
        jQuery.ajax({
            type: "POST",
            async: true,
            url: ajaxurl,
            data: dataObj
        }).done(function (mydata) {
            var objArr = mydata["distance"];
            var tempRows = '';
            for (var i = 0; i < objArr.length; i++) {        
                tempRows += '<tr><td>' + dragonecommercereservezyx987_validString(objArr[i].id) + '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].name) + '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].sign) + '</td>';
                tempRows += '<td><span class="distancespan" >' + dragonecommercereservezyx987_validString(objArr[i].description) + '</span><input class="distanceedittextbox" style="display:none;" name="distance_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="distance_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].description) + '" /><input class="distanceedittextbox" style="display:none;" type="button" value="Update" name="distanceeditsubmitbutton_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="distanceeditsubmitbutton_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" onclick="dragonecommercereservezyx987_submitDistanceValue(\'distance_' + dragonecommercereservezyx987_validString(objArr[i].id) + '\', ' + dragonecommercereservezyx987_validString(objArr[i].id) + ');" /></td>';
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].createtimeutc) + '</td><td>' + (dragonecommercereservezyx987_validString(objArr[i].status) === 1 ? '<span style="color:green;">ACTIVE</span>' : '<span style="color:red;">INACTIVE</span>') + '</td></tr>';
            }                                    
            jQuery('tbody#dragonecommerce_distance').html(tempRows);
            var totaldistancequantity = mydata["total"] == null ? '0' : mydata["total"];
            jQuery('span#totaldistancequantity').text(totaldistancequantity);
            totaldistancequantity = parseInt(mydata["total"]);
            var amountperpage = parseInt(jQuery('select#dragonecommerce_distance_itemsperpage').val());
            if(amountperpage === -1) {amountperpage = parseInt(DISTANCE_ITEMS_PER_PAGE_PRESET_VALUE);}
            if(amountperpage > 0) {
                totalpagenumber_onload_admin_distance = Math.ceil(totaldistancequantity / amountperpage);
                dragonecommercereservezyx987_createPagination(totalpagenumber_onload_admin_distance, pagenumber , 'distance');        
            }                    
            jQuery('img#admin_distancelist_loader').hide();
        }).fail(function( jqXHR, textStatus ) {
            //alert( "Request distance list failed: " + textStatus );
        });
    }

    function dragonecommercereservezyx987_getWeightsList(pagenumber) {
        var dataObj = {dragonecommercereservezyx987_hidden_security_getweights:"<?php echo wp_create_nonce('dragonecommercereservezyx987_getWeights'); ?>",dragonecommercereservezyx987_hidden:"Y",action:"dragonecommercereservezyx987_getWeights"};
        dataObj.status = jQuery('select#dragonecommerce_weight_status').val();
        dataObj.amountperpage = jQuery('select#dragonecommerce_weight_itemsperpage').val();
        if(typeof pagenumber === 'undefined') {pagenumber = 1;}
        dataObj.pagenumber = pagenumber;
                    
        var sortby = jQuery('select#dragonecommerce_weight_sortby').val();
        if(sortby === 'id|asc') {
            dataObj.sortby = 'id';
            dataObj.order = 'asc';                  
        } else if(sortby === 'id|desc') {
            dataObj.sortby = 'id';
            dataObj.order = 'desc';                  
        } else if(sortby === 'name|asc') {
            dataObj.sortby = 'name';
            dataObj.order = 'asc';      
        } else if(sortby === 'name|desc') {
            dataObj.sortby = 'name';
            dataObj.order = 'desc';                  
        } else if(sortby === 'createtimeutc|asc') {
            dataObj.sortby = 'createtimeutc';
            dataObj.order = 'asc';      
        } else if(sortby === 'createtimeutc|desc') {
            dataObj.sortby = 'createtimeutc';
            dataObj.order = 'desc';                  
        }
                
        jQuery('tbody#dragonecommerce_weight').html('');
        jQuery('span#totalweightquantity').text('');
        jQuery('img#admin_weightlist_loader').show();        
        
        jQuery.ajax({
            type: "POST",
            async: true,
            url: ajaxurl,
            data: dataObj
        }).done(function (mydata) {
            var objArr = mydata["weight"];
            var tempRows = '';
            for (var i = 0; i < objArr.length; i++) {        
                tempRows += '<tr><td>' + dragonecommercereservezyx987_validString(objArr[i].id) + '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].name) + '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].sign) + '</td>';
                tempRows += '<td><span class="weightspan" >' + dragonecommercereservezyx987_validString(objArr[i].description) + '</span><input class="weightedittextbox" style="display:none;" name="weight_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="weight_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].description) + '" /><input class="weightedittextbox" style="display:none;" type="button" value="Update" name="weighteditsubmitbutton_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="weighteditsubmitbutton_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" onclick="dragonecommercereservezyx987_submitWeightValue(\'weight_' + dragonecommercereservezyx987_validString(objArr[i].id) + '\', ' + dragonecommercereservezyx987_validString(objArr[i].id) + ');" /></td>';
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].createtimeutc) + '</td><td>' + (dragonecommercereservezyx987_validString(objArr[i].status) === 1 ? '<span style="color:green;">ACTIVE</span>' : '<span style="color:red;">INACTIVE</span>') + '</td></tr>';
            }                                    
            jQuery('tbody#dragonecommerce_weight').html(tempRows);
            var totalweightquantity = mydata["total"] == null ? '0' : mydata["total"];
            jQuery('span#totalweightquantity').text(totalweightquantity);
            totalweightquantity = parseInt(mydata["total"]);
            var amountperpage = parseInt(jQuery('select#dragonecommerce_weight_itemsperpage').val());
            if(amountperpage === -1) {amountperpage = parseInt(WEIGHT_ITEMS_PER_PAGE_PRESET_VALUE);}
            if(amountperpage > 0) {
                totalpagenumber_onload_admin_weight = Math.ceil(totalweightquantity / amountperpage);
                dragonecommercereservezyx987_createPagination(totalpagenumber_onload_admin_weight, pagenumber , 'weight');        
            }                    
            jQuery('img#admin_weightlist_loader').hide();
        }).fail(function( jqXHR, textStatus ) {
            //alert( "Request weight list failed: " + textStatus );
        });
    }
    
    function dragonecommercereservezyx987_getEmailmethodsList(pagenumber) {
        var dataObj = {dragonecommercereservezyx987_hidden_security_getemailmethods:"<?php echo wp_create_nonce('dragonecommercereservezyx987_getEmailmethods'); ?>",dragonecommercereservezyx987_hidden:"Y",action:"dragonecommercereservezyx987_getEmailmethods"};
        dataObj.status = jQuery('select#dragonecommerce_emailmethod_status').val();
        dataObj.amountperpage = jQuery('select#dragonecommerce_emailmethod_itemsperpage').val();
        if(typeof pagenumber === 'undefined') {pagenumber = 1;}
        dataObj.pagenumber = pagenumber;
                    
        var sortby = jQuery('select#dragonecommerce_emailmethod_sortby').val();
        if(sortby === 'id|asc') {
            dataObj.sortby = 'id';
            dataObj.order = 'asc';                  
        } else if(sortby === 'id|desc') {
            dataObj.sortby = 'id';
            dataObj.order = 'desc';                  
        } else if(sortby === 'name|asc') {
            dataObj.sortby = 'name';
            dataObj.order = 'asc';      
        } else if(sortby === 'name|desc') {
            dataObj.sortby = 'name';
            dataObj.order = 'desc';                  
        } else if(sortby === 'createtimeutc|asc') {
            dataObj.sortby = 'createtimeutc';
            dataObj.order = 'asc';      
        } else if(sortby === 'createtimeutc|desc') {
            dataObj.sortby = 'createtimeutc';
            dataObj.order = 'desc';                  
        }
                
        jQuery('tbody#dragonecommerce_emailmethod').html('');
        jQuery('span#totalemailmethodquantity').text('');
        jQuery('img#admin_emailmethodlist_loader').show();        
        
        jQuery.ajax({
            type: "POST",
            async: true,
            url: ajaxurl,
            data: dataObj
        }).done(function (mydata) {
            var objArr = mydata["emailmethod"];
            var tempRows = '';
            for (var i = 0; i < objArr.length; i++) {        
                tempRows += '<tr><td>' + dragonecommercereservezyx987_validString(objArr[i].id) + '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].name) + '</td>';
                tempRows += '<td><span class="emailmethodspan" >' + dragonecommercereservezyx987_validString(objArr[i].description) + '</span><input class="emailmethodedittextbox" style="display:none;" name="emailmethod_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="emailmethod_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].description) + '" /><input class="emailmethodedittextbox" style="display:none;" type="button" value="Update" name="emailmethodeditsubmitbutton_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="emailmethodeditsubmitbutton_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" onclick="dragonecommercereservezyx987_submitEmailmethodValue(\'emailmethod_' + dragonecommercereservezyx987_validString(objArr[i].id) + '\', ' + dragonecommercereservezyx987_validString(objArr[i].id) + ');" /></td>';
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].createtimeutc) + '</td><td>' + (dragonecommercereservezyx987_validString(objArr[i].status) === 1 ? '<span style="color:green;">ACTIVE</span>' : '<span style="color:red;">INACTIVE</span>') + '</td></tr>';
            }                                    
            jQuery('tbody#dragonecommerce_emailmethod').html(tempRows);
            var totalemailmethodquantity = mydata["total"] == null ? '0' : mydata["total"];
            jQuery('span#totalemailmethodquantity').text(totalemailmethodquantity);
            totalemailmethodquantity = parseInt(mydata["total"]);
            var amountperpage = parseInt(jQuery('select#dragonecommerce_emailmethod_itemsperpage').val());
            if(amountperpage === -1) {amountperpage = parseInt(EMAILMETHOD_ITEMS_PER_PAGE_PRESET_VALUE);}
            if(amountperpage > 0) {
                totalpagenumber_onload_admin_emailmethod = Math.ceil(totalemailmethodquantity / amountperpage);
                dragonecommercereservezyx987_createPagination(totalpagenumber_onload_admin_emailmethod, pagenumber , 'emailmethod');        
            }                    
            jQuery('img#admin_emailmethodlist_loader').hide();
        }).fail(function( jqXHR, textStatus ) {
            //alert( "Request email method list failed: " + textStatus );
        });
    }

    function dragonecommercereservezyx987_getLogsList(pagenumber) {
        var dataObj = {dragonecommercereservezyx987_hidden_security_getlogs:"<?php echo wp_create_nonce('dragonecommercereservezyx987_getLogs'); ?>",dragonecommercereservezyx987_hidden:"Y",action:"dragonecommercereservezyx987_getLogs"};
        dataObj.searchwords = jQuery('input#dragonecommerce_log_description').val();
        dataObj.searchtype = jQuery.trim(jQuery('select#dragonecommerce_log_type').val());
        dataObj.processname = jQuery.trim(jQuery('select#dragonecommerce_log_processname').val());    
        dataObj.userid = jQuery('select#dragonecommerce_log_userid').val();
        dataObj.logstatus = jQuery('select#dragonecommerce_log_status').val();
        dataObj.amountperpage = jQuery('select#dragonecommerce_log_itemsperpage').val();
        if(typeof pagenumber === 'undefined') {pagenumber = 1;}
        dataObj.pagenumber = pagenumber;
                    
        var sortby = jQuery('select#dragonecommerce_log_sortby').val();
        if(sortby === 'id|asc') {
            dataObj.sortby = 'id';
            dataObj.order = 'asc';                  
        } else if(sortby === 'id|desc') {
            dataObj.sortby = 'id';
            dataObj.order = 'desc';                  
        } else if(sortby === 'type|asc') {
            dataObj.sortby = 'type';
            dataObj.order = 'asc';                  
        } else if(sortby === 'type|desc') {
            dataObj.sortby = 'type';
            dataObj.order = 'desc';                      
        } else if(sortby === 'createtimeutc|asc') {
            dataObj.sortby = 'createtimeutc';
            dataObj.order = 'asc';      
        } else if(sortby === 'createtimeutc|desc') {
            dataObj.sortby = 'createtimeutc';
            dataObj.order = 'desc';                  
        }
                
        jQuery('tbody#dragonecommerce_log').html('');
        jQuery('span#totallogquantity').text('');
        jQuery('img#admin_loglist_loader').show();        
        
        jQuery.ajax({
            type: "POST",
            async: true,
            url: ajaxurl,
            data: dataObj
        }).done(function (mydata) {
            var objArr = mydata["log"];
            var tempRows = '';
            for (var i = 0; i < objArr.length; i++) {        
                tempRows += '<tr><td>' + dragonecommercereservezyx987_validString(objArr[i].id) + '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].type) + '</td>';
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].processname) + '</td>';
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].userid) + '</td>';
                tempRows += '<td><span class="logspan" >' + dragonecommercereservezyx987_validString(objArr[i].description) + '</span><input class="logedittextbox" style="display:none;" name="log_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="log_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].description).replace(/"/g, '&#34;') + '" /><input class="logedittextbox" style="display:none;" type="button" value="Update" name="logeditsubmitbutton_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="logeditsubmitbutton_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" onclick="dragonecommercereservezyx987_submitLogValue(\'log_' + dragonecommercereservezyx987_validString(objArr[i].id) + '\', ' + dragonecommercereservezyx987_validString(objArr[i].id) + ');" /></td>';
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].createtimeutc) + '</td><td>' + (dragonecommercereservezyx987_validString(objArr[i].status) === 1 ? '<span style="color:green;">ACTIVE</span>' : '<span style="color:red;">INACTIVE</span>') + '</td></tr>';
            }                                    
            jQuery('tbody#dragonecommerce_log').html(tempRows);
            var totallogquantity = mydata["total"] == null ? '0' : mydata["total"];
            jQuery('span#totallogquantity').text(totallogquantity);
            totallogquantity = parseInt(mydata["total"]);
            var amountperpage = parseInt(jQuery('select#dragonecommerce_log_itemsperpage').val());
            if(amountperpage === -1) {amountperpage = parseInt(LOG_ITEMS_PER_PAGE_PRESET_VALUE);}
            if(amountperpage > 0) {
                totalpagenumber_onload_admin_log = Math.ceil(totallogquantity / amountperpage);
                dragonecommercereservezyx987_createPagination(totalpagenumber_onload_admin_log, pagenumber , 'log');        
            }                    
            jQuery('img#admin_loglist_loader').hide();
        }).fail(function( jqXHR, textStatus ) {
            //alert( "Request log list failed: " + textStatus );
        });
    }
    
    function dragonecommercereservezyx987_resetLogsSearchParameters() {    
        jQuery('select#dragonecommerce_log_type').val('-1');        
        jQuery('select#dragonecommerce_log_processname').val('-1');                
        jQuery('select#dragonecommerce_log_userid').val('-1');
        jQuery('input#dragonecommerce_log_description').val('');
        jQuery('select#dragonecommerce_log_status').val('-1');
        jQuery('select#dragonecommerce_log_itemsperpage').val('-1');    
        jQuery('select#dragonecommerce_log_sortby').val('-1');
        
    }

    function dragonecommercereservezyx987_getSlideshowsList(pagenumber) {
        var dataObj = {dragonecommercereservezyx987_hidden_security_getslideshows:"<?php echo wp_create_nonce('dragonecommercereservezyx987_getSlideshows'); ?>",dragonecommercereservezyx987_hidden:"Y",action:"dragonecommercereservezyx987_getSlideshows"};
        dataObj.searchwords = jQuery('input#dragonecommerce_slideshow_name').val();
        dataObj.searchdescription = jQuery.trim(jQuery('input#dragonecommerce_slideshow_description').val());
        dataObj.slideshowstatus = jQuery('select#dragonecommerce_slideshow_status').val();
        dataObj.amountperpage = jQuery('select#dragonecommerce_slideshow_itemsperpage').val();
        if(typeof pagenumber === 'undefined') {pagenumber = 1;}
        dataObj.pagenumber = pagenumber;

        var sortby = jQuery('select#dragonecommerce_slideshow_sortby').val();
        if(sortby === 'id|asc') {
            dataObj.sortby = 'id';
            dataObj.order = 'asc';                  
        } else if(sortby === 'id|desc') {
            dataObj.sortby = 'id';
            dataObj.order = 'desc';                  
        } else if(sortby === 'name|asc') {
            dataObj.sortby = 'name';
            dataObj.order = 'asc';                  
        } else if(sortby === 'name|desc') {
            dataObj.sortby = 'name';
            dataObj.order = 'desc';                      
        } else if(sortby === 'createtimeutc|asc') {
            dataObj.sortby = 'createtimeutc';
            dataObj.order = 'asc';      
        } else if(sortby === 'createtimeutc|desc') {
            dataObj.sortby = 'createtimeutc';
            dataObj.order = 'desc';                  
        }
                
        jQuery('tbody#dragonecommerce_slideshow').html('');
        jQuery('span#totalslideshowquantity').text('');
        jQuery('img#admin_slideshowlist_loader').show();        
        
        jQuery.ajax({
            type: "POST",
            async: true,
            url: ajaxurl,
            data: dataObj
        }).done(function (mydata) {
            var objArr = mydata["slideshow"];
            var tempRows = '';
            for (var i = 0; i < objArr.length; i++) {
                var temp_button = '<a href="javascript:void(0);" class="btn btn-primary" onclick="dragonecommercereservezyx987_editSlideshow(' + dragonecommercereservezyx987_validString(objArr[i].id) + ', \'dragonecommerce_slideshow_container_\');">Edit</a>';

                temp_button += '<a href="javascript:void(0);" style="display:none;" class="btn btn-primary dragonecommerce_slideshow_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" onclick="dragonecommercereservezyx987_saveSlideshow(' + dragonecommercereservezyx987_validString(objArr[i].id) + ', \'dragonecommerce_slideshow_\');">Save</a>';                    
                temp_button += '<br/><a href="javascript:void(0);" class="btn btn-danger" onclick="dragonecommercereservezyx987_deleteSlideshow(' + dragonecommercereservezyx987_validString(objArr[i].id) + ');">Delete</a>';
                
                tempRows += '<tr><td>'+ temp_button + '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].id) + '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].name);
                tempRows += '<div style="display:none;" class="dragonecommerce_slideshow_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_slideshow_name_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_slideshow_name_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].name).replace(/"/g, '\\&#34;') + '" /></div>';

                tempRows += '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].description);
                tempRows += '<div style="display:none;" class="dragonecommerce_slideshow_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_slideshow_description_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_slideshow_description_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].description).replace(/"/g, '\\&#34;') + '" /></div>';                
                tempRows += '</td>';
                                
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].filename) + '</td>';                
                
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].sequencenumber);
                tempRows += '<div style="display:none;" class="dragonecommerce_slideshow_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_slideshow_sequencenumber_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_slideshow_sequencenumber_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].sequencenumber) + '" /></div>';                
                tempRows += '</td>';

                tempRows += '<td>' + (dragonecommercereservezyx987_validString(objArr[i].showname) === 1 ? '<span style="color:green;">Yes</span>' : '<span style="color:red;">No</span>');
                tempRows += '<div style="display:none;" class="dragonecommerce_slideshow_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<select name="dragonecommerce_slideshow_showname_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_slideshow_showname_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<option value="-1">Choose one...</option>';
                tempRows += '<option value="1"' + (dragonecommercereservezyx987_validString(objArr[i].showname) === 1 ? 'selected' : '') + '>Yes</option>';
                tempRows += '<option value="0"' + (dragonecommercereservezyx987_validString(objArr[i].showname) === 0 ? 'selected' : '') + '>No</option>';
                tempRows += '</select></div></td>';

                tempRows += '<td>' + (dragonecommercereservezyx987_validString(objArr[i].showdescription) === 1 ? '<span style="color:green;">Yes</span>' : '<span style="color:red;">No</span>');
                tempRows += '<div style="display:none;" class="dragonecommerce_slideshow_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<select name="dragonecommerce_slideshow_showdescription_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_slideshow_showdescription_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<option value="-1">Choose one...</option>';
                tempRows += '<option value="1"' + (dragonecommercereservezyx987_validString(objArr[i].showdescription) === 1 ? 'selected' : '') + '>Yes</option>';
                tempRows += '<option value="0"' + (dragonecommercereservezyx987_validString(objArr[i].showdescription) === 0 ? 'selected' : '') + '>No</option>';
                tempRows += '</select></div></td>';
                
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].createtimeutc) + '</td>';
                
                tempRows += '<td>' + (dragonecommercereservezyx987_validString(objArr[i].status) === 1 ? '<span style="color:green;">ACTIVE</span>' : '<span style="color:red;">INACTIVE</span>');
                tempRows += '<div style="display:none;" class="dragonecommerce_slideshow_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<select name="dragonecommerce_slideshow_status_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_slideshow_status_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<option value="-1">Choose one...</option>';
                tempRows += '<option value="1"' + (dragonecommercereservezyx987_validString(objArr[i].status) === 1 ? 'selected' : '') + '>Active</option>';
                tempRows += '<option value="0"' + (dragonecommercereservezyx987_validString(objArr[i].status) === 0 ? 'selected' : '') + '>Not Active</option>';
                tempRows += '</select></div></td>';
                
                tempRows += '</tr>';
            }                                    
            jQuery('tbody#dragonecommerce_slideshow').html(tempRows);
            var totalslideshowquantity = mydata["total"] == null ? '0' : mydata["total"];
            jQuery('span#totalslideshowquantity').text(totalslideshowquantity);
            totalslideshowquantity = parseInt(mydata["total"]);
            var amountperpage = parseInt(jQuery('select#dragonecommerce_slideshow_itemsperpage').val());
            if(amountperpage === -1) {amountperpage = parseInt(SLIDESHOW_ITEMS_PER_PAGE_PRESET_VALUE);}
            if(amountperpage > 0) {
                totalpagenumber_onload_admin_slideshow = Math.ceil(totalslideshowquantity / amountperpage);
                dragonecommercereservezyx987_createPagination(totalpagenumber_onload_admin_slideshow, pagenumber , 'slideshow');        
            }                    
            jQuery('img#admin_slideshowlist_loader').hide();
        }).fail(function( jqXHR, textStatus ) {
            //alert( "Request slideshow list failed: " + textStatus );
        });
    }
    
    function dragonecommercereservezyx987_resetSlideshowsSearchParameters() {    
        jQuery('input#dragonecommerce_slideshow_name').val('');
        jQuery('input#dragonecommerce_slideshow_description').val('');
        jQuery('select#dragonecommerce_slideshow_status').val('-1');
        jQuery('select#dragonecommerce_slideshow_itemsperpage').val('-1');
        jQuery('select#dragonecommerce_slideshow_sortby').val('-1');
    }
    
    function dragonecommercereservezyx987_getDiscountsList(pagenumber) {
        var dataObj = {dragonecommercereservezyx987_hidden_security_getdiscounts:"<?php echo wp_create_nonce('dragonecommercereservezyx987_getDiscounts'); ?>",dragonecommercereservezyx987_hidden:"Y",action:"dragonecommercereservezyx987_getDiscounts"};
        dataObj.searchwords = jQuery('input#dragonecommerce_discount_name').val();
        dataObj.searchshownname = jQuery('input#dragonecommerce_discount_shownname').val();
        dataObj.searchdescription = jQuery('input#dragonecommerce_discount_description').val();        
        
        dataObj.fromdate = jQuery('input#dragonecommerce_discount_fromdate').val();
        dataObj.todate = jQuery('input#dragonecommerce_discount_todate').val();
        if(dataObj.fromdate > dataObj.todate) {
            return alert("Error. From date is later than to date.");            
        }
        dataObj.discountstatus = jQuery('select#dragonecommerce_discount_status').val();
        dataObj.amountperpage = jQuery('select#dragonecommerce_discount_itemsperpage').val();
        if(typeof pagenumber === 'undefined') {pagenumber = 1;}
        dataObj.pagenumber = pagenumber;

        var sortby = jQuery('select#dragonecommerce_discount_sortby').val();
        if(sortby === 'id|asc') {
            dataObj.sortby = 'id';
            dataObj.order = 'asc';                  
        } else if(sortby === 'id|desc') {
            dataObj.sortby = 'id';
            dataObj.order = 'desc';                  
        } else if(sortby === 'name|asc') {
            dataObj.sortby = 'name';
            dataObj.order = 'asc';                  
        } else if(sortby === 'name|desc') {
            dataObj.sortby = 'name';
            dataObj.order = 'desc';                      
        } else if(sortby === 'shownname|asc') {
            dataObj.sortby = 'shownname';
            dataObj.order = 'asc';                  
        } else if(sortby === 'shownname|desc') {
            dataObj.sortby = 'shownname';
            dataObj.order = 'desc';                      
        } else if(sortby === 'description|asc') {
            dataObj.sortby = 'description';
            dataObj.order = 'asc';                  
        } else if(sortby === 'description|desc') {
            dataObj.sortby = 'description';
            dataObj.order = 'desc';                      
        } else if(sortby === 'createtimeutc|asc') {
            dataObj.sortby = 'createtimeutc';
            dataObj.order = 'asc';      
        } else if(sortby === 'createtimeutc|desc') {
            dataObj.sortby = 'createtimeutc';
            dataObj.order = 'desc';                  
        }
                
        jQuery('tbody#dragonecommerce_discount').html('');
        jQuery('span#totaldiscountquantity').text('');
        jQuery('img#admin_discountlist_loader').show();        
        
        jQuery.ajax({
            type: "POST",
            async: true,
            url: ajaxurl,
            data: dataObj
        }).done(function (mydata) {
            var objArr = mydata["discount"];
            var tempRows = '';
            for (var i = 0; i < objArr.length; i++) {
                var temp_button = '';
                temp_button = '<a href="javascript:void(0);" class="btn btn-primary" onclick="dragonecommercereservezyx987_editDiscount(' + dragonecommercereservezyx987_validString(objArr[i].id) + ', \'dragonecommerce_discount_container_\');">Edit</a>';
                temp_button += '<a href="javascript:void(0);" style="display:none;" class="btn btn-primary dragonecommerce_discount_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" onclick="dragonecommercereservezyx987_saveDiscount(' + dragonecommercereservezyx987_validString(objArr[i].id) + ', \'dragonecommerce_discount_\');">Save</a>';                    

                tempRows += '<tr><td>'+ temp_button + '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].id) + '</td>';                

                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].name);
                tempRows += '<div style="display:none;" class="dragonecommerce_discount_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_discount_name_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_discount_name_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].name).replace(/"/g, '\\&#34;') + '" /></div>';
                tempRows += '</td>';

                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].shownname);
                tempRows += '<div style="display:none;" class="dragonecommerce_discount_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_discount_shownname_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_discount_shownname_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].shownname).replace(/"/g, '\\&#34;') + '" /></div>';                
                tempRows += '</td>';
                
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].description);
                tempRows += '<div style="display:none;" class="dragonecommerce_discount_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_discount_description_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_discount_description_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].description).replace(/"/g, '\\&#34;') + '" /></div>';                
                tempRows += '</td>';
                
                tempRows += '<td>' + (dragonecommercereservezyx987_validString(objArr[i].userate) === 1 ? '<span style="color:green;">Yes</span>' : '<span style="color:red;">No</span>');
                tempRows += '<div style="display:none;" class="dragonecommerce_discount_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<select name="dragonecommerce_handling_userate_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_discount_userate_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<option value="-1">Choose one...</option>';
                tempRows += '<option value="1"' + (dragonecommercereservezyx987_validString(objArr[i].userate) === 1 ? 'selected' : '') + '>Yes</option>';
                tempRows += '<option value="0"' + (dragonecommercereservezyx987_validString(objArr[i].userate) === 0 ? 'selected' : '') + '>No</option>';
                tempRows += '</select></div></td>';                
                
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].rate);
                tempRows += '<div style="display:none;" class="dragonecommerce_discount_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_discount_rate_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_discount_rate_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].rate) + '" /></div>';                
                tempRows += '</td>';

                tempRows += '<td>' + (dragonecommercereservezyx987_validString(objArr[i].usefee) === 1 ? '<span style="color:green;">Yes</span>' : '<span style="color:red;">No</span>');
                tempRows += '<div style="display:none;" class="dragonecommerce_discount_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<select name="dragonecommerce_handling_usefee_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_discount_usefee_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<option value="-1">Choose one...</option>';
                tempRows += '<option value="1"' + (dragonecommercereservezyx987_validString(objArr[i].usefee) === 1 ? 'selected' : '') + '>Yes</option>';
                tempRows += '<option value="0"' + (dragonecommercereservezyx987_validString(objArr[i].usefee) === 0 ? 'selected' : '') + '>No</option>';
                tempRows += '</select></div></td>';    

                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].fee);
                tempRows += '<div style="display:none;" class="dragonecommerce_discount_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_discount_fee_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_discount_fee_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].fee) + '" /></div>';                
                tempRows += '</td>';
                
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].minordersubtotal);
                tempRows += '<div style="display:none;" class="dragonecommerce_discount_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_discount_minordersubtotal_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_discount_minordersubtotal_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].minordersubtotal) + '" /></div>';                
                tempRows += '</td>';

                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].start);
                tempRows += '<div style="display:none;" class="dragonecommerce_discount_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" class="dragonecommercereservezyx987_datetimepicker" name="dragonecommerce_discount_start_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_discount_start_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].start) + '" /></div>';                
                tempRows += '</td>';
                
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].end);
                tempRows += '<div style="display:none;" class="dragonecommerce_discount_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" class="dragonecommercereservezyx987_datetimepicker" name="dragonecommerce_discount_end_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_discount_end_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].end) + '" /></div>';                
                tempRows += '</td>';
                                
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].fromcountry);
                tempRows += '<div style="display:none;" class="dragonecommerce_discount_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';

                tempRows += '<select name="dragonecommerce_discount_fromcountryid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_discount_fromcountryid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" onchange="dragonecommercereservezyx987_updateProvincesDropdownList_forTableRow(this);" >';

                tempRows += '<option value="-1">Please choose one...</option>';
                <?php foreach ($allcountries as $country) { ?>
                <?php $country_status_temp = $country->status === '1' ? '' : 'color:grey;'; ?>
                tempRows += "<option " + (dragonecommercereservezyx987_validString(objArr[i].fromcountryid) === <?php echo $country->id === null ? 0 : intval($country->id); ?> ? 'selected' : '') + " value='<?php echo intval($country->id); ?>' style='<?php echo esc_html($country_status_temp); ?>'><?php echo esc_html($country->name); ?></option>";
                <?php } ?>
                tempRows += '</select></div></td>';    

                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].fromprovince);
                tempRows += '<div style="display:none;" class="dragonecommerce_discount_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';

                tempRows += '<select name="dragonecommerce_discount_fromstateprovinceid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_discount_fromstateprovinceid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';

                tempRows += '<option value="-1">Please choose one...</option>';
                <?php foreach ($allprovinces as $province) { ?>
                <?php $country_status_temp = $province->status === '1' ? '' : 'color:grey;'; ?>
                tempRows += "<option " + (dragonecommercereservezyx987_validString(objArr[i].fromstateprovinceid) === <?php echo $province->id === null ? 0 : intval($province->id); ?> ? 'selected' :'') + " class='<?php echo intval($province->countryid); ?>' value='<?php echo intval($province->id); ?>' style='<?php echo esc_html($country_status_temp); ?>'><?php echo esc_html($province->name); ?></option>";
                <?php } ?>
                tempRows += '</select></div></td>';

                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].tocountry);
                tempRows += '<div style="display:none;" class="dragonecommerce_discount_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';

                tempRows += '<select name="dragonecommerce_discount_tocountryid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_discount_tocountryid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" onchange="dragonecommercereservezyx987_updateProvincesDropdownList_forTableRow(this);" >';

                tempRows += '<option value="-1">Please choose one...</option>';
                <?php foreach ($allcountries as $country) { ?>
                <?php $country_status_temp = $country->status === '1' ? '' : 'color:grey;'; ?>
                tempRows += "<option " + (dragonecommercereservezyx987_validString(objArr[i].tocountryid) === <?php echo $country->id === null ? 0 : intval($country->id); ?> ? 'selected' : '') + " value='<?php echo intval($country->id); ?>' style='<?php echo esc_html($country_status_temp); ?>'><?php echo esc_html($country->name); ?></option>";
                <?php } ?>
                tempRows += '</select></div></td>';    
                                
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].toprovince);
                tempRows += '<div style="display:none;" class="dragonecommerce_discount_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';

                tempRows += '<select name="dragonecommerce_discount_tostateprovinceid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_discount_tostateprovinceid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';

                tempRows += '<option value="-1">Please choose one...</option>';
                <?php foreach ($allprovinces as $province) { ?>
                <?php $country_status_temp = $province->status === '1' ? '' : 'color:grey;'; ?>
                tempRows += "<option " + (dragonecommercereservezyx987_validString(objArr[i].tostateprovinceid) === <?php echo $province->id === null ? 0 : intval($province->id); ?> ? 'selected' : '') + " class='<?php echo intval($province->countryid); ?>' value='<?php echo intval($province->id); ?>' style='<?php echo esc_html($country_status_temp); ?>'><?php echo esc_html($province->name); ?></option>";
                <?php } ?>
                tempRows += '</select></div></td>';                
                                                                                                                                    
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].priority);
                tempRows += '<div style="display:none;" class="dragonecommerce_discount_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_discount_priority_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_discount_priority_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].priority) + '" /></div>';                
                tempRows += '</td>';                                
                                
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].createtimeutc) + '</td>';
                
                tempRows += '<td>' + (dragonecommercereservezyx987_validString(objArr[i].status) === 1 ? '<span style="color:green;">ACTIVE</span>' : '<span style="color:red;">INACTIVE</span>');
                tempRows += '<div style="display:none;" class="dragonecommerce_discount_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<select name="dragonecommerce_discount_status_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_discount_status_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<option value="-1">Choose one...</option>';
                tempRows += '<option value="1"' + (dragonecommercereservezyx987_validString(objArr[i].status) === 1 ? 'selected' : '') + '>Active</option>';
                tempRows += '<option value="0"' + (dragonecommercereservezyx987_validString(objArr[i].status) === 0 ? 'selected' : '') + '>Not Active</option>';
                tempRows += '</select></div></td>';
                
                tempRows += '</tr>';
            }                                    
            jQuery('tbody#dragonecommerce_discount').html(tempRows);
            jQuery(".dragonecommercereservezyx987_datetimepicker" ).datetimepicker({ format:'Y-m-d H:i:s' });        
            var totaldiscountquantity = mydata["total"] == null ? '0' : mydata["total"];
            jQuery('span#totaldiscountquantity').text(totaldiscountquantity);
            totaldiscountquantity = parseInt(mydata["total"]);
            var amountperpage = parseInt(jQuery('select#dragonecommerce_discount_itemsperpage').val());
            if(amountperpage === -1) {amountperpage = parseInt(DISCOUNT_ITEMS_PER_PAGE_PRESET_VALUE);}
            if(amountperpage > 0) {
                totalpagenumber_onload_admin_discount = Math.ceil(totaldiscountquantity / amountperpage);
                dragonecommercereservezyx987_createPagination(totalpagenumber_onload_admin_discount, pagenumber , 'discount');        
            }                    
            jQuery('img#admin_discountlist_loader').hide();
        }).fail(function( jqXHR, textStatus ) {
            //alert( "Request discount list failed: " + textStatus );
        });
    }
    
    function dragonecommercereservezyx987_resetDiscountsSearchParameters() {    
        jQuery('input#dragonecommerce_discount_name').val('');
        jQuery('input#dragonecommerce_discount_shownname').val('');
        jQuery('input#dragonecommerce_discount_description').val('');
        jQuery('input#dragonecommerce_discount_fromdate').val('');
        jQuery('input#dragonecommerce_discount_todate').val('');
        jQuery('select#dragonecommerce_discount_status').val('-1');
        jQuery('select#dragonecommerce_discount_itemsperpage').val('-1');
        jQuery('select#dragonecommerce_discount_sortby').val('-1');
    }
    
    function dragonecommercereservezyx987_getCouponsList(pagenumber) {
        var dataObj = {dragonecommercereservezyx987_hidden_security_getcoupons:"<?php echo wp_create_nonce('dragonecommercereservezyx987_getCoupons'); ?>",dragonecommercereservezyx987_hidden:"Y",action:"dragonecommercereservezyx987_getCoupons"};
        dataObj.searchwords = jQuery('input#dragonecommerce_coupon_name').val();
        dataObj.searchshownname = jQuery('input#dragonecommerce_coupon_shownname').val();
        dataObj.searchdescription = jQuery('input#dragonecommerce_coupon_description').val();        
        
        dataObj.fromdate = jQuery('input#dragonecommerce_coupon_fromdate').val();
        dataObj.todate = jQuery('input#dragonecommerce_coupon_todate').val();
        if(dataObj.fromdate > dataObj.todate) {
            return alert("Error. From date is later than to date.");            
        }
        dataObj.couponstatus = jQuery('select#dragonecommerce_coupon_status').val();
        dataObj.amountperpage = jQuery('select#dragonecommerce_coupon_itemsperpage').val();
        if(typeof pagenumber === 'undefined') {pagenumber = 1;}
        dataObj.pagenumber = pagenumber;

        var sortby = jQuery('select#dragonecommerce_coupon_sortby').val();
        if(sortby === 'id|asc') {
            dataObj.sortby = 'id';
            dataObj.order = 'asc';                  
        } else if(sortby === 'id|desc') {
            dataObj.sortby = 'id';
            dataObj.order = 'desc';                  
        } else if(sortby === 'name|asc') {
            dataObj.sortby = 'name';
            dataObj.order = 'asc';                  
        } else if(sortby === 'name|desc') {
            dataObj.sortby = 'name';
            dataObj.order = 'desc';                      
        } else if(sortby === 'shownname|asc') {
            dataObj.sortby = 'shownname';
            dataObj.order = 'asc';                  
        } else if(sortby === 'shownname|desc') {
            dataObj.sortby = 'shownname';
            dataObj.order = 'desc';                      
        } else if(sortby === 'description|asc') {
            dataObj.sortby = 'description';
            dataObj.order = 'asc';                  
        } else if(sortby === 'description|desc') {
            dataObj.sortby = 'description';
            dataObj.order = 'desc';                      
        } else if(sortby === 'createtimeutc|asc') {
            dataObj.sortby = 'createtimeutc';
            dataObj.order = 'asc';      
        } else if(sortby === 'createtimeutc|desc') {
            dataObj.sortby = 'createtimeutc';
            dataObj.order = 'desc';                  
        }
                
        jQuery('tbody#dragonecommerce_coupon').html('');
        jQuery('span#totalcouponquantity').text('');
        jQuery('img#admin_couponlist_loader').show();        
                
        jQuery.ajax({
            type: "POST",
            async: true,
            url: ajaxurl,
            data: dataObj
        }).done(function (mydata) {
            var objArr = mydata["coupon"];
            var tempRows = '';
            for (var i = 0; i < objArr.length; i++) {
                var temp_button = '<a href="javascript:void(0);" class="btn btn-primary" onclick="dragonecommercereservezyx987_editCoupon(' + dragonecommercereservezyx987_validString(objArr[i].id) + ', \'dragonecommerce_coupon_container_\');">Edit</a>';
                temp_button += '<a href="javascript:void(0);" style="display:none;" class="btn btn-primary dragonecommerce_coupon_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" onclick="dragonecommercereservezyx987_saveCoupon(' + dragonecommercereservezyx987_validString(objArr[i].id) + ', \'dragonecommerce_coupon_\');">Save</a>';                    

                tempRows += '<tr><td>'+ temp_button + '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].id) + '</td>';                

                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].name);
                tempRows += '<div style="display:none;" class="dragonecommerce_coupon_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_coupon_name_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_coupon_name_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].name).replace(/"/g, '\\&#34;') + '" /></div>';
                tempRows += '</td>';

                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].shownname);
                tempRows += '<div style="display:none;" class="dragonecommerce_coupon_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_coupon_shownname_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_coupon_shownname_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].shownname).replace(/"/g, '\\&#34;') + '" /></div>';                
                tempRows += '</td>';
                
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].description);
                tempRows += '<div style="display:none;" class="dragonecommerce_coupon_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_coupon_description_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_coupon_description_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].description).replace(/"/g, '\\&#34;') + '" /></div>';                
                tempRows += '</td>';

                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].code);
                tempRows += '<div style="display:none;" class="dragonecommerce_coupon_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_coupon_code_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_coupon_code_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].code).replace(/"/g, '\\&#34;') + '" /></div>';                
                tempRows += '</td>';
                
                tempRows += '<td>' + (dragonecommercereservezyx987_validString(objArr[i].userate) === 1 ? '<span style="color:green;">Yes</span>' : '<span style="color:red;">No</span>');
                tempRows += '<div style="display:none;" class="dragonecommerce_coupon_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<select name="dragonecommerce_coupon_userate_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_coupon_userate_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<option value="-1">Choose one...</option>';
                tempRows += '<option value="1"' + (dragonecommercereservezyx987_validString(objArr[i].userate) === 1 ? 'selected' : '') + '>Yes</option>';
                tempRows += '<option value="0"' + (dragonecommercereservezyx987_validString(objArr[i].userate) === 0 ? 'selected' : '') + '>No</option>';
                tempRows += '</select></div></td>';                
                
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].rate);
                tempRows += '<div style="display:none;" class="dragonecommerce_coupon_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_coupon_rate_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_coupon_rate_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].rate) + '" /></div>';                
                tempRows += '</td>';

                tempRows += '<td>' + (dragonecommercereservezyx987_validString(objArr[i].usefee) === 1 ? '<span style="color:green;">Yes</span>' : '<span style="color:red;">No</span>');
                tempRows += '<div style="display:none;" class="dragonecommerce_coupon_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<select name="dragonecommerce_coupon_usefee_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_coupon_usefee_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<option value="-1">Choose one...</option>';
                tempRows += '<option value="1"' + (dragonecommercereservezyx987_validString(objArr[i].usefee) === 1 ? 'selected' : '') + '>Yes</option>';
                tempRows += '<option value="0"' + (dragonecommercereservezyx987_validString(objArr[i].usefee) === 0 ? 'selected' : '') + '>No</option>';
                tempRows += '</select></div></td>';    

                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].fee);
                tempRows += '<div style="display:none;" class="dragonecommerce_coupon_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_coupon_fee_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_coupon_fee_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].fee) + '" /></div>';                
                tempRows += '</td>';
                
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].minordersubtotal);
                tempRows += '<div style="display:none;" class="dragonecommerce_coupon_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_coupon_minordersubtotal_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_coupon_minordersubtotal_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].minordersubtotal) + '" /></div>';                
                tempRows += '</td>';

                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].start);
                tempRows += '<div style="display:none;" class="dragonecommerce_coupon_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" class="dragonecommercereservezyx987_datetimepicker" name="dragonecommerce_coupon_start_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_coupon_start_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].start) + '" /></div>';                
                tempRows += '</td>';
                
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].end);
                tempRows += '<div style="display:none;" class="dragonecommerce_coupon_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" class="dragonecommercereservezyx987_datetimepicker" name="dragonecommerce_coupon_end_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_coupon_end_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].end) + '" /></div>';                
                tempRows += '</td>';
                                
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].fromcountry);
                tempRows += '<div style="display:none;" class="dragonecommerce_coupon_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';

                tempRows += '<select name="dragonecommerce_coupon_fromcountryid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_coupon_fromcountryid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" onchange="dragonecommercereservezyx987_updateProvincesDropdownList_forTableRow(this);" >';

                tempRows += '<option value="-1">Please choose one...</option>';
                <?php foreach ($allcountries as $country) { ?>
                <?php $country_status_temp = $country->status === '1' ? '' : 'color:grey;'; ?>
                tempRows += "<option " + (dragonecommercereservezyx987_validString(objArr[i].fromcountryid) === <?php echo $country->id === null ? 0 : intval($country->id); ?> ? 'selected' : '') + " value='<?php echo intval($country->id); ?>' style='<?php echo esc_html($country_status_temp); ?>'><?php echo esc_html($country->name); ?></option>";
                <?php } ?>
                tempRows += '</select></div></td>';    

                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].fromprovince);
                tempRows += '<div style="display:none;" class="dragonecommerce_coupon_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';

                tempRows += '<select name="dragonecommerce_coupon_fromstateprovinceid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_coupon_fromstateprovinceid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';

                tempRows += '<option value="-1">Please choose one...</option>';
                <?php foreach ($allprovinces as $province) { ?>
                <?php $country_status_temp = $province->status === '1' ? '' : 'color:grey;'; ?>
                tempRows += "<option " + (dragonecommercereservezyx987_validString(objArr[i].fromstateprovinceid) === <?php echo $province->id === null ? 0 : intval($province->id); ?> ? '' : '') + " class='<?php echo intval($province->countryid); ?>' value='<?php echo intval($province->id); ?>' style='<?php echo esc_html($country_status_temp); ?>'><?php echo esc_html($province->name); ?></option>";
                <?php } ?>
                tempRows += '</select></div></td>';

                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].tocountry);
                tempRows += '<div style="display:none;" class="dragonecommerce_coupon_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';

                tempRows += '<select name="dragonecommerce_coupon_tocountryid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_coupon_tocountryid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" onchange="dragonecommercereservezyx987_updateProvincesDropdownList_forTableRow(this);" >';

                tempRows += '<option value="-1">Please choose one...</option>';
                <?php foreach ($allcountries as $country) { ?>
                <?php $country_status_temp = $country->status === '1' ? '' : 'color:grey;'; ?>
                tempRows += "<option " + (dragonecommercereservezyx987_validString(objArr[i].tocountryid) === <?php echo $country->id === null ? 0 : intval($country->id); ?> ? 'selected' : '') + " value='<?php echo intval($country->id); ?>' style='<?php echo esc_html($country_status_temp); ?>'><?php echo esc_html($country->name); ?></option>";
                <?php } ?>
                tempRows += '</select></div></td>';    
                                
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].toprovince);
                tempRows += '<div style="display:none;" class="dragonecommerce_coupon_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';

                tempRows += '<select name="dragonecommerce_coupon_tostateprovinceid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_coupon_tostateprovinceid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';

                tempRows += '<option value="-1">Please choose one...</option>';
                <?php foreach ($allprovinces as $province) { ?>
                <?php $country_status_temp = $province->status === '1' ? '' : 'color:grey;'; ?>
                tempRows += "<option " + (dragonecommercereservezyx987_validString(objArr[i].tostateprovinceid) === <?php echo $province->id === null ? 0 : intval($province->id); ?> ? 'selected' : '') + " class='<?php echo intval($province->countryid); ?>' value='<?php echo intval($province->id); ?>' style='<?php echo esc_html($country_status_temp); ?>'><?php echo esc_html($province->name); ?></option>";
                <?php } ?>
                tempRows += '</select></div></td>';            
                                                                                                                                    
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].priority);
                tempRows += '<div style="display:none;" class="dragonecommerce_coupon_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_coupon_priority_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_coupon_priority_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].priority) + '" /></div>';                
                tempRows += '</td>';                
                
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].createtimeutc) + '</td>';
                
                tempRows += '<td>' + (dragonecommercereservezyx987_validString(objArr[i].status) === 1 ? '<span style="color:green;">ACTIVE</span>' : '<span style="color:red;">INACTIVE</span>');
                tempRows += '<div style="display:none;" class="dragonecommerce_coupon_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<select name="dragonecommerce_coupon_status_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_coupon_status_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<option value="-1">Choose one...</option>';
                tempRows += '<option value="1"' + (dragonecommercereservezyx987_validString(objArr[i].status) === 1 ? 'selected' : '') + '>Active</option>';
                tempRows += '<option value="0"' + (dragonecommercereservezyx987_validString(objArr[i].status) === 0 ? 'selected' : '') + '>Not Active</option>';
                tempRows += '</select></div></td>';
                
                tempRows += '</tr>';
            }                                    
            jQuery('tbody#dragonecommerce_coupon').html(tempRows);
            jQuery(".dragonecommercereservezyx987_datetimepicker").datetimepicker({ format:'Y-m-d H:i:s' });            
            var totalcouponquantity = mydata["total"] == null ? '0' : mydata["total"];
            jQuery('span#totalcouponquantity').text(totalcouponquantity);
            totalcouponquantity = parseInt(mydata["total"]);
            var amountperpage = parseInt(jQuery('select#dragonecommerce_coupon_itemsperpage').val());
            if(amountperpage === -1) {amountperpage = parseInt(COUPON_ITEMS_PER_PAGE_PRESET_VALUE);}
            if(amountperpage > 0) {
                totalpagenumber_onload_admin_coupon = Math.ceil(totalcouponquantity / amountperpage);
                dragonecommercereservezyx987_createPagination(totalpagenumber_onload_admin_coupon, pagenumber , 'coupon');        
            }                    
            jQuery('img#admin_couponlist_loader').hide();
        }).fail(function( jqXHR, textStatus ) {
            //alert( "Request coupon list failed: " + textStatus );
        });
    }
    
    function dragonecommercereservezyx987_resetCouponsSearchParameters() {    
        jQuery('input#dragonecommerce_coupon_name').val('');
        jQuery('input#dragonecommerce_coupon_shownname').val('');
        jQuery('input#dragonecommerce_coupon_description').val('');
        jQuery('input#dragonecommerce_coupon_fromdate').val('');
        jQuery('input#dragonecommerce_coupon_todate').val('');
        jQuery('select#dragonecommerce_coupon_status').val('-1');
        jQuery('select#dragonecommerce_coupon_itemsperpage').val('-1');
        jQuery('select#dragonecommerce_coupon_sortby').val('-1');
    }
    
    function dragonecommercereservezyx987_getPropertyvaluesList(pagenumber) {
        var dataObj = {dragonecommercereservezyx987_hidden_security_getpropertyvalues:"<?php echo wp_create_nonce('dragonecommercereservezyx987_getPropertyvalues'); ?>",dragonecommercereservezyx987_hidden:"Y",action:"dragonecommercereservezyx987_getPropertyvalues"};
        dataObj.searchwords = jQuery('input#dragonecommerce_propertyvalue_name').val();
        dataObj.searchshownname = jQuery('input#dragonecommerce_propertyvalue_shownname').val();
        dataObj.searchdescription = jQuery('input#dragonecommerce_propertyvalue_description').val();        
        
        dataObj.fromdate = jQuery('input#dragonecommerce_propertyvalue_fromdate').val();
        dataObj.todate = jQuery('input#dragonecommerce_propertyvalue_todate').val();
        if(dataObj.fromdate > dataObj.todate) {
            return alert("Error. From date is later than to date.");            
        }
        
        dataObj.propertyvaluepropertyid = jQuery('select#dragonecommerce_propertyvalue_property').val();        
        dataObj.propertyvaluestatus = jQuery('select#dragonecommerce_propertyvalue_status').val();
        dataObj.amountperpage = jQuery('select#dragonecommerce_propertyvalue_itemsperpage').val();
        if(typeof pagenumber === 'undefined') {pagenumber = 1;}
        dataObj.pagenumber = pagenumber;

        var sortby = jQuery('select#dragonecommerce_propertyvalue_sortby').val();
        if(sortby === 'id|asc') {
            dataObj.sortby = 'id';
            dataObj.order = 'asc';                  
        } else if(sortby === 'id|desc') {
            dataObj.sortby = 'id';
            dataObj.order = 'desc';                  
        } else if(sortby === 'name|asc') {
            dataObj.sortby = 'name';
            dataObj.order = 'asc';                  
        } else if(sortby === 'name|desc') {
            dataObj.sortby = 'name';
            dataObj.order = 'desc';                      
        } else if(sortby === 'shownname|asc') {
            dataObj.sortby = 'shownname';
            dataObj.order = 'asc';                  
        } else if(sortby === 'shownname|desc') {
            dataObj.sortby = 'shownname';
            dataObj.order = 'desc';                      
        } else if(sortby === 'description|asc') {
            dataObj.sortby = 'description';
            dataObj.order = 'asc';                  
        } else if(sortby === 'description|desc') {
            dataObj.sortby = 'description';
            dataObj.order = 'desc';                      
        } else if(sortby === 'createtimeutc|asc') {
            dataObj.sortby = 'createtimeutc';
            dataObj.order = 'asc';      
        } else if(sortby === 'createtimeutc|desc') {
            dataObj.sortby = 'createtimeutc';
            dataObj.order = 'desc';                  
        }
                
        jQuery('tbody#dragonecommerce_propertyvalue').html('');
        jQuery('span#totalpropertyvaluequantity').text('');
        jQuery('img#admin_propertyvaluelist_loader').show();        
                        
        jQuery.ajax({
            type: "POST",
            async: true,
            url: ajaxurl,
            data: dataObj
        }).done(function (mydata) {
            var objArr = mydata["propertyvalue"];
            var tempRows = '';
            for (var i = 0; i < objArr.length; i++) {
                var temp_button = '<a href="javascript:void(0);" class="btn btn-primary" onclick="dragonecommercereservezyx987_editPropertyvalue(' + dragonecommercereservezyx987_validString(objArr[i].id) + ', \'dragonecommerce_propertyvalue_container_\');">Edit</a>';
                temp_button += '<a href="javascript:void(0);" style="display:none;" class="btn btn-primary dragonecommerce_propertyvalue_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" onclick="dragonecommercereservezyx987_savePropertyvalue(' + dragonecommercereservezyx987_validString(objArr[i].id) + ', \'dragonecommerce_propertyvalue_\');">Save</a>';                    
            
                tempRows += '<tr><td>'+ temp_button + '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].id) + '<input type="hidden" name="dragonecommerce_propertyvalue_propertyid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_propertyvalue_propertyid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].propertyid) + '" /></td>';
                
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].name);
                tempRows += '<div style="display:none;" class="dragonecommerce_propertyvalue_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_propertyvalue_name_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_propertyvalue_name_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].name).replace(/"/g, '\\&#34;') + '" /></div>';
                tempRows += '</td>';

                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].shownname);
                tempRows += '<div style="display:none;" class="dragonecommerce_propertyvalue_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_propertyvalue_shownname_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_propertyvalue_shownname_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].shownname).replace(/"/g, '\\&#34;') + '" /></div>';                
                tempRows += '</td>';
                
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].description);
                tempRows += '<div style="display:none;" class="dragonecommerce_propertyvalue_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_propertyvalue_description_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_propertyvalue_description_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].description).replace(/"/g, '\\&#34;') + '" /></div>';                
                tempRows += '</td>';
                
                tempRows += '<td>' + (dragonecommercereservezyx987_validString(objArr[i].userate) === 1 ? '<span style="color:green;">Yes</span>' : '<span style="color:red;">No</span>');
                tempRows += '<div style="display:none;" class="dragonecommerce_propertyvalue_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<select name="dragonecommerce_propertyvalue_userate_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_propertyvalue_userate_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<option value="-1">Choose one...</option>';
                tempRows += '<option value="1"' + (dragonecommercereservezyx987_validString(objArr[i].userate) === 1 ? 'selected' : '') + '>Yes</option>';
                tempRows += '<option value="0"' + (dragonecommercereservezyx987_validString(objArr[i].userate) === 0 ? 'selected' : '') + '>No</option>';
                tempRows += '</select></div></td>';                
                
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].rate);
                tempRows += '<div style="display:none;" class="dragonecommerce_propertyvalue_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_propertyvalue_rate_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_propertyvalue_rate_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].rate) + '" /></div>';                
                tempRows += '</td>';

                tempRows += '<td>' + (dragonecommercereservezyx987_validString(objArr[i].usefee) === 1 ? '<span style="color:green;">Yes</span>' : '<span style="color:red;">No</span>');
                tempRows += '<div style="display:none;" class="dragonecommerce_propertyvalue_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<select name="dragonecommerce_propertyvalue_usefee_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_propertyvalue_usefee_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<option value="-1">Choose one...</option>';
                tempRows += '<option value="1"' + (dragonecommercereservezyx987_validString(objArr[i].usefee) === 1 ? 'selected' : '') + '>Yes</option>';
                tempRows += '<option value="0"' + (dragonecommercereservezyx987_validString(objArr[i].usefee) === 0 ? 'selected' : '') + '>No</option>';
                tempRows += '</select></div></td>';    

                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].fee);
                tempRows += '<div style="display:none;" class="dragonecommerce_propertyvalue_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_propertyvalue_fee_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_propertyvalue_fee_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].fee) + '" /></div>';                
                tempRows += '</td>';
                
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].minordersubtotal);
                tempRows += '<div style="display:none;" class="dragonecommerce_propertyvalue_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_propertyvalue_minordersubtotal_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_propertyvalue_minordersubtotal_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].minordersubtotal) + '" /></div>';                
                tempRows += '</td>';

                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].start);
                tempRows += '<div style="display:none;" class="dragonecommerce_propertyvalue_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" class="dragonecommercereservezyx987_datetimepicker" name="dragonecommerce_propertyvalue_start_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_propertyvalue_start_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].start) + '" /></div>';                
                tempRows += '</td>';
                
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].end);
                tempRows += '<div style="display:none;" class="dragonecommerce_propertyvalue_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" class="dragonecommercereservezyx987_datetimepicker" name="dragonecommerce_propertyvalue_end_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_propertyvalue_end_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].end) + '" /></div>';                
                tempRows += '</td>';
                                
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].fromcountry);
                tempRows += '<div style="display:none;" class="dragonecommerce_propertyvalue_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';

                tempRows += '<select name="dragonecommerce_propertyvalue_fromcountryid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_propertyvalue_fromcountryid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" onchange="dragonecommercereservezyx987_updateProvincesDropdownList_forTableRow(this);" >';

                tempRows += '<option value="-1">Please choose one...</option>';
                <?php foreach ($allcountries as $country) { ?>
                <?php $country_status_temp = $country->status === '1' ? '' : 'color:grey;'; ?>
                tempRows += "<option " + (dragonecommercereservezyx987_validString(objArr[i].fromcountryid) === <?php echo $country->id === null ? 0 : intval($country->id); ?> ? 'selected' : '') + " value='<?php echo intval($country->id); ?>' style='<?php echo esc_html($country_status_temp); ?>'><?php echo esc_html($country->name); ?></option>";
                <?php } ?>
                tempRows += '</select></div></td>';    

                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].fromprovince);
                tempRows += '<div style="display:none;" class="dragonecommerce_propertyvalue_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';

                tempRows += '<select name="dragonecommerce_propertyvalue_fromstateprovinceid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_propertyvalue_fromstateprovinceid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';

                tempRows += '<option value="-1">Please choose one...</option>';
                <?php foreach ($allprovinces as $province) { ?>
                <?php $country_status_temp = $province->status === '1' ? '' : 'color:grey;'; ?>
                tempRows += "<option " + (dragonecommercereservezyx987_validString(objArr[i].fromstateprovinceid) === <?php echo $province->id === null ? 0 : intval($province->id); ?> ? 'selected' : '') + " class='<?php echo intval($province->countryid); ?>' value='<?php echo intval($province->id); ?>' style='<?php echo esc_html($country_status_temp); ?>'><?php echo esc_html($province->name); ?></option>";
                <?php } ?>
                tempRows += '</select></div></td>';

                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].tocountry);
                tempRows += '<div style="display:none;" class="dragonecommerce_propertyvalue_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';

                tempRows += '<select name="dragonecommerce_propertyvalue_tocountryid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_propertyvalue_tocountryid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" onchange="dragonecommercereservezyx987_updateProvincesDropdownList_forTableRow(this);" >';

                tempRows += '<option value="-1">Please choose one...</option>';
                <?php foreach ($allcountries as $country) { ?>
                <?php $country_status_temp = $country->status === '1' ? '' : 'color:grey;'; ?>
                tempRows += "<option " + (dragonecommercereservezyx987_validString(objArr[i].tocountryid) === <?php echo $country->id === null ? 0 : intval($country->id); ?> ? 'selected' : '') + " value='<?php echo intval($country->id); ?>' style='<?php echo esc_html($country_status_temp); ?>'><?php echo esc_html($country->name); ?></option>";
                <?php } ?>
                tempRows += '</select></div></td>';    
                                
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].toprovince);
                tempRows += '<div style="display:none;" class="dragonecommerce_propertyvalue_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';

                tempRows += '<select name="dragonecommerce_propertyvalue_tostateprovinceid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_propertyvalue_tostateprovinceid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';

                tempRows += '<option value="-1">Please choose one...</option>';
                <?php foreach ($allprovinces as $province) { ?>
                <?php $country_status_temp = $province->status === '1' ? '' : 'color:grey;'; ?>
                tempRows += "<option " + (dragonecommercereservezyx987_validString(objArr[i].tostateprovinceid) === <?php echo $province->id === null ? 0 : intval($province->id); ?> ? 'selected' : '') + " class='<?php echo intval($province->countryid); ?>' value='<?php echo intval($province->id); ?>' style='<?php echo esc_html($country_status_temp); ?>'><?php echo esc_html($province->name); ?></option>";
                <?php } ?>
                tempRows += '</select></div></td>';            
                                                                                                                                    
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].priority);
                tempRows += '<div style="display:none;" class="dragonecommerce_propertyvalue_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_propertyvalue_priority_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_propertyvalue_priority_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].priority) + '" /></div>';                
                tempRows += '</td>';
                                                
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].propertyname);
                tempRows += '<div style="display:none;" class="dragonecommerce_propertyvalue_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';

                tempRows += '<select name="dragonecommerce_propertyvalue_propertyid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_propertyvalue_propertyid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';

                tempRows += '<option value="-1">Please choose one...</option>';
                <?php foreach ($allproperties as $property) { ?>
                <?php $property_status_temp = $property->status === '1' ? '' : 'color:grey;'; ?>
                tempRows += "<option " + (dragonecommercereservezyx987_validString(objArr[i].propertyid) === <?php echo $property->id === null ? 0 : intval($property->id); ?> ? 'selected' : '') + " value='<?php echo intval($property->id); ?>' style='<?php echo esc_html($property_status_temp); ?>'><?php echo esc_html($property->name); ?></option>";
                <?php } ?>
                tempRows += '</select></div></td>';            
                
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].createtimeutc) + '</td>';
                
                tempRows += '<td>' + (dragonecommercereservezyx987_validString(objArr[i].status) === 1 ? '<span style="color:green;">ACTIVE</span>' : '<span style="color:red;">INACTIVE</span>');
                tempRows += '<div style="display:none;" class="dragonecommerce_propertyvalue_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<select name="dragonecommerce_propertyvalue_status_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_propertyvalue_status_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<option value="-1">Choose one...</option>';
                tempRows += '<option value="1"' + (dragonecommercereservezyx987_validString(objArr[i].status) === 1 ? 'selected' : '') + '>Active</option>';
                tempRows += '<option value="0"' + (dragonecommercereservezyx987_validString(objArr[i].status) === 0 ? 'selected' : '') + '>Not Active</option>';
                tempRows += '</select></div></td>';
                
                tempRows += '</tr>';
            }                                    
            jQuery('tbody#dragonecommerce_propertyvalue').html(tempRows);
            jQuery(".dragonecommercereservezyx987_datetimepicker" ).datetimepicker({ format:'Y-m-d H:i:s' });        
            var totalpropertyvaluequantity = mydata["total"] == null ? '0' : mydata["total"];
            jQuery('span#totalpropertyvaluequantity').text(totalpropertyvaluequantity);
            totalpropertyvaluequantity = parseInt(mydata["total"]);
            var amountperpage = parseInt(jQuery('select#dragonecommerce_propertyvalue_itemsperpage').val());
            if(amountperpage === -1) {amountperpage = parseInt(PROPERTYVALUE_ITEMS_PER_PAGE_PRESET_VALUE);}
            if(amountperpage > 0) {
                totalpagenumber_onload_admin_propertyvalue = Math.ceil(totalpropertyvaluequantity / amountperpage);
                dragonecommercereservezyx987_createPagination(totalpagenumber_onload_admin_propertyvalue, pagenumber , 'propertyvalue');        
            }                    
            jQuery('img#admin_propertyvaluelist_loader').hide();
        }).fail(function( jqXHR, textStatus ) {
            //alert( "Request property value list failed: " + textStatus );
        });
    }
    
    function dragonecommercereservezyx987_resetPropertyvaluesSearchParameters() {    
        jQuery('input#dragonecommerce_propertyvalue_name').val('');
        jQuery('input#dragonecommerce_propertyvalue_shownname').val('');
        jQuery('input#dragonecommerce_propertyvalue_description').val('');
        jQuery('input#dragonecommerce_propertyvalue_fromdate').val('');
        jQuery('input#dragonecommerce_propertyvalue_todate').val('');
        jQuery('select#dragonecommerce_propertyvalue_status').val('-1');
        jQuery('select#dragonecommerce_propertyvalue_property').val('-1');        
        jQuery('select#dragonecommerce_propertyvalue_itemsperpage').val('-1');    
        jQuery('select#dragonecommerce_propertyvalue_sortby').val('-1');
    }
    
    function dragonecommercereservezyx987_getHandlingsList(pagenumber) {
        var dataObj = {dragonecommercereservezyx987_hidden_security_gethandlings:"<?php echo wp_create_nonce('dragonecommercereservezyx987_getHandlings'); ?>",dragonecommercereservezyx987_hidden:"Y",action:"dragonecommercereservezyx987_getHandlings"};
        dataObj.searchwords = jQuery('input#dragonecommerce_handling_name').val();
        dataObj.searchshownname = jQuery('input#dragonecommerce_handling_shownname').val();
        dataObj.searchdescription = jQuery('input#dragonecommerce_handling_description').val();        
        
        dataObj.fromdate = jQuery('input#dragonecommerce_handling_fromdate').val();
        dataObj.todate = jQuery('input#dragonecommerce_handling_todate').val();
        if(dataObj.fromdate > dataObj.todate) {
            return alert("Error. From date is later than to date.");            
        }
        dataObj.handlingstatus = jQuery('select#dragonecommerce_handling_status').val();
        dataObj.amountperpage = jQuery('select#dragonecommerce_handling_itemsperpage').val();
        if(typeof pagenumber === 'undefined') {pagenumber = 1;}
        dataObj.pagenumber = pagenumber;

        var sortby = jQuery('select#dragonecommerce_handling_sortby').val();
        if(sortby === 'id|asc') {
            dataObj.sortby = 'id';
            dataObj.order = 'asc';                  
        } else if(sortby === 'id|desc') {
            dataObj.sortby = 'id';
            dataObj.order = 'desc';                  
        } else if(sortby === 'name|asc') {
            dataObj.sortby = 'name';
            dataObj.order = 'asc';                  
        } else if(sortby === 'name|desc') {
            dataObj.sortby = 'name';
            dataObj.order = 'desc';                      
        } else if(sortby === 'shownname|asc') {
            dataObj.sortby = 'shownname';
            dataObj.order = 'asc';                  
        } else if(sortby === 'shownname|desc') {
            dataObj.sortby = 'shownname';
            dataObj.order = 'desc';                      
        } else if(sortby === 'description|asc') {
            dataObj.sortby = 'description';
            dataObj.order = 'asc';                  
        } else if(sortby === 'description|desc') {
            dataObj.sortby = 'description';
            dataObj.order = 'desc';                      
        } else if(sortby === 'createtimeutc|asc') {
            dataObj.sortby = 'createtimeutc';
            dataObj.order = 'asc';      
        } else if(sortby === 'createtimeutc|desc') {
            dataObj.sortby = 'createtimeutc';
            dataObj.order = 'desc';                  
        }
                
        jQuery('tbody#dragonecommerce_handling').html('');
        jQuery('span#totalhandlingquantity').text('');
        jQuery('img#admin_handlinglist_loader').show();        
        
        jQuery.ajax({
            type: "POST",
            async: true,
            url: ajaxurl,
            data: dataObj
        }).done(function (mydata) {
            var objArr = mydata["handling"];
            var tempRows = '';
            for (var i = 0; i < objArr.length; i++) {
                var temp_button = '<a href="javascript:void(0);" class="btn btn-primary" onclick="dragonecommercereservezyx987_editHandling(' + dragonecommercereservezyx987_validString(objArr[i].id) + ', \'dragonecommerce_handling_container_\');">Edit</a>';
                temp_button += '<a href="javascript:void(0);" style="display:none;" class="btn btn-primary dragonecommerce_handling_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" onclick="dragonecommercereservezyx987_saveHandling(' + dragonecommercereservezyx987_validString(objArr[i].id) + ', \'dragonecommerce_handling_\');">Save</a>';                    

                tempRows += '<tr><td>'+ temp_button + '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].id) + '</td>';                

                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].name);
                tempRows += '<div style="display:none;" class="dragonecommerce_handling_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_handling_name_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_handling_name_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].name).replace(/"/g, '\\&#34;') + '" /></div>';
                tempRows += '</td>';

                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].shownname);
                tempRows += '<div style="display:none;" class="dragonecommerce_handling_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_handling_shownname_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_handling_shownname_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].shownname).replace(/"/g, '\\&#34;') + '" /></div>';                
                tempRows += '</td>';
                
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].description);
                tempRows += '<div style="display:none;" class="dragonecommerce_handling_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_handling_description_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_handling_description_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].description).replace(/"/g, '\\&#34;') + '" /></div>';                
                tempRows += '</td>';
                
                tempRows += '<td>' + (dragonecommercereservezyx987_validString(objArr[i].userate) === 1 ? '<span style="color:green;">Yes</span>' : '<span style="color:red;">No</span>');
                tempRows += '<div style="display:none;" class="dragonecommerce_handling_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<select name="dragonecommerce_handling_userate_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_handling_userate_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<option value="-1">Choose one...</option>';
                tempRows += '<option value="1"' + (dragonecommercereservezyx987_validString(objArr[i].userate) === 1 ? 'selected' : '') + '>Yes</option>';
                tempRows += '<option value="0"' + (dragonecommercereservezyx987_validString(objArr[i].userate) === 0 ? 'selected' : '') + '>No</option>';
                tempRows += '</select></div></td>';                
                
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].rate);
                tempRows += '<div style="display:none;" class="dragonecommerce_handling_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_handling_rate_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_handling_rate_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].rate) + '" /></div>';                
                tempRows += '</td>';

                tempRows += '<td>' + (dragonecommercereservezyx987_validString(objArr[i].usefee) === 1 ? '<span style="color:green;">Yes</span>' : '<span style="color:red;">No</span>');
                tempRows += '<div style="display:none;" class="dragonecommerce_handling_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<select name="dragonecommerce_handling_usefee_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_handling_usefee_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<option value="-1">Choose one...</option>';
                tempRows += '<option value="1"' + (dragonecommercereservezyx987_validString(objArr[i].usefee) === 1 ? 'selected' : '') + '>Yes</option>';
                tempRows += '<option value="0"' + (dragonecommercereservezyx987_validString(objArr[i].usefee) === 0 ? 'selected' : '') + '>No</option>';
                tempRows += '</select></div></td>';    

                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].fee);
                tempRows += '<div style="display:none;" class="dragonecommerce_handling_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_handling_fee_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_handling_fee_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].fee) + '" /></div>';                
                tempRows += '</td>';
                
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].minordersubtotal);
                tempRows += '<div style="display:none;" class="dragonecommerce_handling_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_handling_minordersubtotal_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_handling_minordersubtotal_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].minordersubtotal) + '" /></div>';                
                tempRows += '</td>';

                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].start);
                tempRows += '<div style="display:none;" class="dragonecommerce_handling_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" class="dragonecommercereservezyx987_datetimepicker" name="dragonecommerce_handling_start_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_handling_start_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].start) + '" /></div>';                
                tempRows += '</td>';
                
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].end);
                tempRows += '<div style="display:none;" class="dragonecommerce_handling_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" class="dragonecommercereservezyx987_datetimepicker" name="dragonecommerce_handling_end_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_handling_end_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].end) + '" /></div>';                
                tempRows += '</td>';
                                
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].fromcountry);
                tempRows += '<div style="display:none;" class="dragonecommerce_handling_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';

                tempRows += '<select name="dragonecommerce_handling_fromcountryid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_handling_fromcountryid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" onchange="dragonecommercereservezyx987_updateProvincesDropdownList_forTableRow(this);" >';

                tempRows += '<option value="-1">Please choose one...</option>';
                <?php foreach ($allcountries as $country) { ?>
                <?php $country_status_temp = $country->status === '1' ? '' : 'color:grey;'; ?>
                tempRows += "<option " + (dragonecommercereservezyx987_validString(objArr[i].fromcountryid) === <?php echo $country->id === null ? 0 : intval($country->id); ?> ? 'selected' : '') + " value='<?php echo intval($country->id); ?>' style='<?php echo esc_html($country_status_temp); ?>'><?php echo esc_html($country->name); ?></option>";
                <?php } ?>
                tempRows += '</select></div></td>';    

                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].fromprovince);
                tempRows += '<div style="display:none;" class="dragonecommerce_handling_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';

                tempRows += '<select name="dragonecommerce_handling_fromstateprovinceid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_handling_fromstateprovinceid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';

                tempRows += '<option value="-1">Please choose one...</option>';
                <?php foreach ($allprovinces as $province) { ?>
                <?php $country_status_temp = $province->status === '1' ? '' : 'color:grey;'; ?>
                tempRows += "<option " + (dragonecommercereservezyx987_validString(objArr[i].fromstateprovinceid) === <?php echo $province->id === null ? 0 : intval($province->id); ?> ? 'selected' : '') + " class='<?php echo intval($province->countryid); ?>' value='<?php echo intval($province->id); ?>' style='<?php echo esc_html($country_status_temp); ?>'><?php echo esc_html($province->name); ?></option>";
                <?php } ?>
                tempRows += '</select></div></td>';

                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].tocountry);
                tempRows += '<div style="display:none;" class="dragonecommerce_handling_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';

                tempRows += '<select name="dragonecommerce_handling_tocountryid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_handling_tocountryid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" onchange="dragonecommercereservezyx987_updateProvincesDropdownList_forTableRow(this);">';

                tempRows += '<option value="-1">Please choose one...</option>';
                <?php foreach ($allcountries as $country) { ?>
                <?php $country_status_temp = $country->status === '1' ? '' : 'color:grey;'; ?>
                tempRows += "<option " + (dragonecommercereservezyx987_validString(objArr[i].tocountryid) === <?php echo $country->id === null ? 0 : intval($country->id); ?> ? 'selected' : '') + " value='<?php echo intval($country->id); ?>' style='<?php echo esc_html($country_status_temp); ?>'><?php echo esc_html($country->name); ?></option>";
                <?php } ?>
                tempRows += '</select></div></td>';    
                                
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].toprovince);
                tempRows += '<div style="display:none;" class="dragonecommerce_handling_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';

                tempRows += '<select name="dragonecommerce_handling_tostateprovinceid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_handling_tostateprovinceid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';

                tempRows += '<option value="-1">Please choose one...</option>';
                <?php foreach ($allprovinces as $province) { ?>
                <?php $country_status_temp = $province->status === '1' ? '' : 'color:grey;'; ?>
                tempRows += "<option " + (dragonecommercereservezyx987_validString(objArr[i].tostateprovinceid) === <?php echo $province->id === null ? 0 : intval($province->id); ?> ? 'selected' : '') + " class='<?php echo intval($province->countryid); ?>' value='<?php echo intval($province->id); ?>' style='<?php echo esc_html($country_status_temp); ?>'><?php echo esc_html($province->name); ?></option>";
                <?php } ?>
                tempRows += '</select></div></td>';            
                                                                                                                                    
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].priority);
                tempRows += '<div style="display:none;" class="dragonecommerce_handling_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_handling_priority_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_handling_priority_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].priority) + '" /></div>';                
                tempRows += '</td>';
                                
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].createtimeutc) + '</td>';
                
                tempRows += '<td>' + (dragonecommercereservezyx987_validString(objArr[i].status) === 1 ? '<span style="color:green;">ACTIVE</span>' : '<span style="color:red;">INACTIVE</span>');
                tempRows += '<div style="display:none;" class="dragonecommerce_handling_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<select name="dragonecommerce_handling_status_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_handling_status_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<option value="-1">Choose one...</option>';
                tempRows += '<option value="1"' + (dragonecommercereservezyx987_validString(objArr[i].status) === 1 ? 'selected' : '') + '>Active</option>';
                tempRows += '<option value="0"' + (dragonecommercereservezyx987_validString(objArr[i].status) === 0 ? 'selected' : '') + '>Not Active</option>';
                tempRows += '</select></div></td>';
                
                tempRows += '</tr>';
            }                                    
            jQuery('tbody#dragonecommerce_handling').html(tempRows);
            jQuery(".dragonecommercereservezyx987_datetimepicker" ).datetimepicker({ format:'Y-m-d H:i:s' });
            var totalhandlingquantity = mydata["total"] == null ? '0' : mydata["total"];
            jQuery('span#totalhandlingquantity').text(totalhandlingquantity);
            totalhandlingquantity = parseInt(mydata["total"]);
            var amountperpage = parseInt(jQuery('select#dragonecommerce_handling_itemsperpage').val());
            if(amountperpage === -1) {amountperpage = parseInt(HANDLING_ITEMS_PER_PAGE_PRESET_VALUE);}
            if(amountperpage > 0) {
                totalpagenumber_onload_admin_handling = Math.ceil(totalhandlingquantity / amountperpage);
                dragonecommercereservezyx987_createPagination(totalpagenumber_onload_admin_handling, pagenumber , 'handling');        
            }                    
            jQuery('img#admin_handlinglist_loader').hide();
        }).fail(function( jqXHR, textStatus ) {
            //alert( "Request handling list failed: " + textStatus );
        });
    }
    
    function dragonecommercereservezyx987_resetHandlingsSearchParameters() {    
        jQuery('input#dragonecommerce_handling_name').val('');
        jQuery('input#dragonecommerce_handling_shownname').val('');
        jQuery('input#dragonecommerce_handling_description').val('');        
        jQuery('input#dragonecommerce_handling_fromdate').val('');
        jQuery('input#dragonecommerce_handling_todate').val('');
        jQuery('select#dragonecommerce_handling_status').val('-1');
        jQuery('select#dragonecommerce_handling_itemsperpage').val('-1');
        jQuery('select#dragonecommerce_handling_sortby').val('-1');
    }
    
    function dragonecommercereservezyx987_getShippingsList(pagenumber) {
        var dataObj = {dragonecommercereservezyx987_hidden_security_getshippings:"<?php echo wp_create_nonce('dragonecommercereservezyx987_getShippings'); ?>",dragonecommercereservezyx987_hidden:"Y",action:"dragonecommercereservezyx987_getShippings"};
        dataObj.searchwords = jQuery('input#dragonecommerce_shipping_name').val();
        dataObj.searchshownname = jQuery('input#dragonecommerce_shipping_shownname').val();
        dataObj.searchdescription = jQuery('input#dragonecommerce_shipping_description').val();        
        
        dataObj.fromdate = jQuery('input#dragonecommerce_shipping_fromdate').val();
        dataObj.todate = jQuery('input#dragonecommerce_shipping_todate').val();
        if(dataObj.fromdate > dataObj.todate) {
            return alert("Error. From date is later than to date.");            
        }
        dataObj.shippingstatus = jQuery('select#dragonecommerce_shipping_status').val();
        dataObj.amountperpage = jQuery('select#dragonecommerce_shipping_itemsperpage').val();
        if(typeof pagenumber === 'undefined') {pagenumber = 1;}
        dataObj.pagenumber = pagenumber;

        var sortby = jQuery('select#dragonecommerce_shipping_sortby').val();
        if(sortby === 'id|asc') {
            dataObj.sortby = 'id';
            dataObj.order = 'asc';                  
        } else if(sortby === 'id|desc') {
            dataObj.sortby = 'id';
            dataObj.order = 'desc';                  
        } else if(sortby === 'name|asc') {
            dataObj.sortby = 'name';
            dataObj.order = 'asc';                  
        } else if(sortby === 'name|desc') {
            dataObj.sortby = 'name';
            dataObj.order = 'desc';                      
        } else if(sortby === 'shownname|asc') {
            dataObj.sortby = 'shownname';
            dataObj.order = 'asc';                  
        } else if(sortby === 'shownname|desc') {
            dataObj.sortby = 'shownname';
            dataObj.order = 'desc';                      
        } else if(sortby === 'description|asc') {
            dataObj.sortby = 'description';
            dataObj.order = 'asc';                  
        } else if(sortby === 'description|desc') {
            dataObj.sortby = 'description';
            dataObj.order = 'desc';                      
        } else if(sortby === 'createtimeutc|asc') {
            dataObj.sortby = 'createtimeutc';
            dataObj.order = 'asc';      
        } else if(sortby === 'createtimeutc|desc') {
            dataObj.sortby = 'createtimeutc';
            dataObj.order = 'desc';                  
        }
                
        jQuery('tbody#dragonecommerce_shipping').html('');
        jQuery('span#totalshippingquantity').text('');
        jQuery('img#admin_shippinglist_loader').show();        

        jQuery.ajax({
            type: "POST",
            async: true,
            url: ajaxurl,
            data: dataObj
        }).done(function (mydata) {
            var objArr = mydata["shipping"];
            var tempRows = '';
            for (var i = 0; i < objArr.length; i++) {
                var temp_button = '<a href="javascript:void(0);" class="btn btn-primary" onclick="dragonecommercereservezyx987_editShipping(' + dragonecommercereservezyx987_validString(objArr[i].id) + ', \'dragonecommerce_shipping_container_\');">Edit</a>';
                temp_button += '<a href="javascript:void(0);" style="display:none;" class="btn btn-primary dragonecommerce_shipping_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" onclick="dragonecommercereservezyx987_saveShipping(' + dragonecommercereservezyx987_validString(objArr[i].id) + ', \'dragonecommerce_shipping_\');">Save</a>';                    

                tempRows += '<tr><td>'+ temp_button + '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].id) + '</td>';                

                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].name);
                tempRows += '<div style="display:none;" class="dragonecommerce_shipping_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_shipping_name_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_shipping_name_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].name).replace(/"/g, '\\&#34;') + '" /></div>';
                tempRows += '</td>';

                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].shownname);
                tempRows += '<div style="display:none;" class="dragonecommerce_shipping_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_shipping_shownname_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_shipping_shownname_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].shownname).replace(/"/g, '\\&#34;') + '" /></div>';                
                tempRows += '</td>';
                
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].description);
                tempRows += '<div style="display:none;" class="dragonecommerce_shipping_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_shipping_description_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_shipping_description_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].description).replace(/"/g, '\\&#34;') + '" /></div>';                
                tempRows += '</td>';
                
                tempRows += '<td>' + (dragonecommercereservezyx987_validString(objArr[i].userate) === 1 ? '<span style="color:green;">Yes</span>' : '<span style="color:red;">No</span>');
                tempRows += '<div style="display:none;" class="dragonecommerce_shipping_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<select name="dragonecommerce_shipping_userate_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_shipping_userate_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<option value="-1">Choose one...</option>';
                tempRows += '<option value="1"' + (dragonecommercereservezyx987_validString(objArr[i].userate) === 1 ? 'selected' : '') + '>Yes</option>';
                tempRows += '<option value="0"' + (dragonecommercereservezyx987_validString(objArr[i].userate) === 0 ? 'selected' : '') + '>No</option>';
                tempRows += '</select></div></td>';                
                
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].rate);
                tempRows += '<div style="display:none;" class="dragonecommerce_shipping_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_shipping_rate_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_shipping_rate_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].rate) + '" /></div>';                
                tempRows += '</td>';

                tempRows += '<td>' + (dragonecommercereservezyx987_validString(objArr[i].usefee) === 1 ? '<span style="color:green;">Yes</span>' : '<span style="color:red;">No</span>');
                tempRows += '<div style="display:none;" class="dragonecommerce_shipping_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<select name="dragonecommerce_shipping_usefee_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_shipping_usefee_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<option value="-1">Choose one...</option>';
                tempRows += '<option value="1"' + (dragonecommercereservezyx987_validString(objArr[i].usefee) === 1 ? 'selected' : '') + '>Yes</option>';
                tempRows += '<option value="0"' + (dragonecommercereservezyx987_validString(objArr[i].usefee) === 0 ? 'selected' : '') + '>No</option>';
                tempRows += '</select></div></td>';    

                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].fee);
                tempRows += '<div style="display:none;" class="dragonecommerce_shipping_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_shipping_fee_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_shipping_fee_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].fee) + '" /></div>';                
                tempRows += '</td>';
                
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].minordersubtotal);
                tempRows += '<div style="display:none;" class="dragonecommerce_shipping_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_shipping_minordersubtotal_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_shipping_minordersubtotal_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].minordersubtotal) + '" /></div>';                
                tempRows += '</td>';

                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].start);
                tempRows += '<div style="display:none;" class="dragonecommerce_shipping_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" class="dragonecommercereservezyx987_datetimepicker" name="dragonecommerce_shipping_start_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_shipping_start_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].start) + '" /></div>';                
                tempRows += '</td>';
                
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].end);
                tempRows += '<div style="display:none;" class="dragonecommerce_shipping_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" class="dragonecommercereservezyx987_datetimepicker" name="dragonecommerce_shipping_end_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_shipping_end_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].end) + '" /></div>';                
                tempRows += '</td>';
                                
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].fromcountry);
                tempRows += '<div style="display:none;" class="dragonecommerce_shipping_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';

                tempRows += '<select name="dragonecommerce_shipping_fromcountryid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_shipping_fromcountryid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" onchange="dragonecommercereservezyx987_updateProvincesDropdownList_forTableRow(this);" >';

                tempRows += '<option value="-1">Please choose one...</option>';
                <?php foreach ($allcountries as $country) { ?>
                <?php $country_status_temp = $country->status === '1' ? '' : 'color:grey;'; ?>
                tempRows += "<option " + (dragonecommercereservezyx987_validString(objArr[i].fromcountryid) === <?php echo $country->id === null ? 0 : intval($country->id); ?> ? 'selected' : '') + " value='<?php echo intval($country->id); ?>' style='<?php echo esc_html($country_status_temp); ?>'><?php echo esc_html($country->name); ?></option>";
                <?php } ?>
                tempRows += '</select></div></td>';    

                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].fromprovince);
                tempRows += '<div style="display:none;" class="dragonecommerce_shipping_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';

                tempRows += '<select name="dragonecommerce_shipping_fromstateprovinceid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_shipping_fromstateprovinceid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';

                tempRows += '<option value="-1">Please choose one...</option>';
                <?php foreach ($allprovinces as $province) { ?>
                <?php $country_status_temp = $province->status === '1' ? '' : 'color:grey;'; ?>
                tempRows += "<option " + (dragonecommercereservezyx987_validString(objArr[i].fromstateprovinceid) === <?php echo $province->id === null ? 0 : intval($province->id); ?> ? 'selected' : '') + " class='<?php echo intval($province->countryid); ?>' value='<?php echo intval($province->id); ?>' style='<?php echo esc_html($country_status_temp); ?>'><?php echo esc_html($province->name); ?></option>";
                <?php } ?>
                tempRows += '</select></div></td>';

                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].tocountry);
                tempRows += '<div style="display:none;" class="dragonecommerce_shipping_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';

                tempRows += '<select name="dragonecommerce_shipping_tocountryid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_shipping_tocountryid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" onchange="dragonecommercereservezyx987_updateProvincesDropdownList_forTableRow(this);" >';

                tempRows += '<option value="-1">Please choose one...</option>';
                <?php foreach ($allcountries as $country) { ?>
                <?php $country_status_temp = $country->status === '1' ? '' : 'color:grey;'; ?>
                tempRows += "<option " + (dragonecommercereservezyx987_validString(objArr[i].tocountryid) === <?php echo $country->id === null ? 0 : intval($country->id); ?> ? 'selected' : '') + " value='<?php echo intval($country->id); ?>' style='<?php echo esc_html($country_status_temp); ?>'><?php echo esc_html($country->name); ?></option>";
                <?php } ?>
                tempRows += '</select></div></td>';
                                
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].toprovince);
                tempRows += '<div style="display:none;" class="dragonecommerce_shipping_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';

                tempRows += '<select name="dragonecommerce_shipping_tostateprovinceid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_shipping_tostateprovinceid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';

                tempRows += '<option value="-1">Please choose one...</option>';
                <?php foreach ($allprovinces as $province) { ?>
                <?php $country_status_temp = $province->status === '1' ? '' : 'color:grey;'; ?>
                tempRows += "<option " + (dragonecommercereservezyx987_validString(objArr[i].tostateprovinceid) === <?php echo $province->id === null ? 0 : intval($province->id); ?> ? 'selected' : '') + " class='<?php echo intval($province->countryid); ?>' value='<?php echo intval($province->id); ?>' style='<?php echo esc_html($country_status_temp); ?>'><?php echo esc_html($province->name); ?></option>";
                <?php } ?>
                tempRows += '</select></div></td>';            
                                                                                                                                    
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].priority);
                tempRows += '<div style="display:none;" class="dragonecommerce_shipping_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_shipping_priority_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_shipping_priority_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].priority) + '" /></div>';                
                tempRows += '</td>';
                                
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].createtimeutc) + '</td>';
                
                tempRows += '<td>' + (dragonecommercereservezyx987_validString(objArr[i].status) === 1 ? '<span style="color:green;">ACTIVE</span>' : '<span style="color:red;">INACTIVE</span>');
                tempRows += '<div style="display:none;" class="dragonecommerce_shipping_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<select name="dragonecommerce_shipping_status_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_shipping_status_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<option value="-1">Choose one...</option>';
                tempRows += '<option value="1"' + (dragonecommercereservezyx987_validString(objArr[i].status) === 1 ? 'selected' : '') + '>Active</option>';
                tempRows += '<option value="0"' + (dragonecommercereservezyx987_validString(objArr[i].status) === 0 ? 'selected' : '') + '>Not Active</option>';
                tempRows += '</select></div></td>';
                
                tempRows += '</tr>';
            }                                    
            jQuery('tbody#dragonecommerce_shipping').html(tempRows);
            jQuery(".dragonecommercereservezyx987_datetimepicker" ).datetimepicker({ format:'Y-m-d H:i:s' });        
            var totalshippingquantity = mydata["total"] == null ? '0' : mydata["total"];
            jQuery('span#totalshippingquantity').text(totalshippingquantity);
            totalshippingquantity = parseInt(mydata["total"]);
            var amountperpage = parseInt(jQuery('select#dragonecommerce_shipping_itemsperpage').val());
            if(amountperpage === -1) {amountperpage = parseInt(SHIPPING_ITEMS_PER_PAGE_PRESET_VALUE);}
            if(amountperpage > 0) {
                totalpagenumber_onload_admin_shipping = Math.ceil(totalshippingquantity / amountperpage);
                dragonecommercereservezyx987_createPagination(totalpagenumber_onload_admin_shipping, pagenumber , 'shipping');        
            }                    
            jQuery('img#admin_shippinglist_loader').hide();
        }).fail(function( jqXHR, textStatus ) {
            //alert( "Request shipping list failed: " + textStatus );
        });
    }
    
    function dragonecommercereservezyx987_resetShippingsSearchParameters() {    
        jQuery('input#dragonecommerce_shipping_name').val('');
        jQuery('input#dragonecommerce_shipping_shownname').val('');
        jQuery('input#dragonecommerce_shipping_description').val('');
        jQuery('input#dragonecommerce_shipping_fromdate').val('');
        jQuery('input#dragonecommerce_shipping_todate').val('');
        jQuery('select#dragonecommerce_shipping_status').val('-1');
        jQuery('select#dragonecommerce_shipping_itemsperpage').val('-1');    
        jQuery('select#dragonecommerce_shipping_sortby').val('-1');
    }
    
    function dragonecommercereservezyx987_getTaxesList(pagenumber) {
        var dataObj = {dragonecommercereservezyx987_hidden_security_gettaxes:"<?php echo wp_create_nonce('dragonecommercereservezyx987_getTaxes'); ?>",dragonecommercereservezyx987_hidden:"Y",action:"dragonecommercereservezyx987_getTaxes"};
        dataObj.searchwords = jQuery('input#dragonecommerce_tax_name').val();
        dataObj.searchshownname = jQuery('input#dragonecommerce_tax_shownname').val();
        dataObj.searchdescription = jQuery('input#dragonecommerce_tax_description').val();        
        
        dataObj.fromdate = jQuery('input#dragonecommerce_tax_fromdate').val();
        dataObj.todate = jQuery('input#dragonecommerce_tax_todate').val();
        if(dataObj.fromdate > dataObj.todate) {
            return alert("Error. From date is later than to date.");            
        }
        dataObj.taxstatus = jQuery('select#dragonecommerce_tax_status').val();
        dataObj.amountperpage = jQuery('select#dragonecommerce_tax_itemsperpage').val();
        if(typeof pagenumber === 'undefined') {pagenumber = 1;}
        dataObj.pagenumber = pagenumber;

        var sortby = jQuery('select#dragonecommerce_tax_sortby').val();
        if(sortby === 'id|asc') {
            dataObj.sortby = 'id';
            dataObj.order = 'asc';                  
        } else if(sortby === 'id|desc') {
            dataObj.sortby = 'id';
            dataObj.order = 'desc';                  
        } else if(sortby === 'name|asc') {
            dataObj.sortby = 'name';
            dataObj.order = 'asc';                  
        } else if(sortby === 'name|desc') {
            dataObj.sortby = 'name';
            dataObj.order = 'desc';                      
        } else if(sortby === 'shownname|asc') {
            dataObj.sortby = 'shownname';
            dataObj.order = 'asc';                  
        } else if(sortby === 'shownname|desc') {
            dataObj.sortby = 'shownname';
            dataObj.order = 'desc';                      
        } else if(sortby === 'description|asc') {
            dataObj.sortby = 'description';
            dataObj.order = 'asc';                  
        } else if(sortby === 'description|desc') {
            dataObj.sortby = 'description';
            dataObj.order = 'desc';                      
        } else if(sortby === 'createtimeutc|asc') {
            dataObj.sortby = 'createtimeutc';
            dataObj.order = 'asc';      
        } else if(sortby === 'createtimeutc|desc') {
            dataObj.sortby = 'createtimeutc';
            dataObj.order = 'desc';                  
        }
                
        jQuery('tbody#dragonecommerce_tax').html('');
        jQuery('span#totaltaxquantity').text('');
        jQuery('img#admin_taxlist_loader').show();        
                
        jQuery.ajax({
            type: "POST",
            async: true,
            url: ajaxurl,
            data: dataObj
        }).done(function (mydata) {
            var objArr = mydata["tax"];
            var tempRows = '';
            for (var i = 0; i < objArr.length; i++) {
                var temp_button = '<a href="javascript:void(0);" class="btn btn-primary" onclick="dragonecommercereservezyx987_editTax(' + dragonecommercereservezyx987_validString(objArr[i].id) + ', \'dragonecommerce_tax_container_\');">Edit</a>';
                temp_button += '<a href="javascript:void(0);" style="display:none;" class="btn btn-primary dragonecommerce_tax_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" onclick="dragonecommercereservezyx987_saveTax(' + dragonecommercereservezyx987_validString(objArr[i].id) + ', \'dragonecommerce_tax_\');">Save</a>';                    

                tempRows += '<tr><td>'+ temp_button + '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].id) + '</td>';                

                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].name);
                tempRows += '<div style="display:none;" class="dragonecommerce_tax_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_tax_name_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_tax_name_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].name).replace(/"/g, '\\&#34;') + '" /></div>';
                tempRows += '</td>';

                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].shownname);
                tempRows += '<div style="display:none;" class="dragonecommerce_tax_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_tax_shownname_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_tax_shownname_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].shownname).replace(/"/g, '\\&#34;') + '" /></div>';                
                tempRows += '</td>';
                
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].description);
                tempRows += '<div style="display:none;" class="dragonecommerce_tax_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_tax_description_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_tax_description_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].description).replace(/"/g, '\\&#34;') + '" /></div>';                
                tempRows += '</td>';
                
                tempRows += '<td>' + (dragonecommercereservezyx987_validString(objArr[i].userate) === 1 ? '<span style="color:green;">Yes</span>' : '<span style="color:red;">No</span>');
                tempRows += '<div style="display:none;" class="dragonecommerce_tax_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<select name="dragonecommerce_tax_userate_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_tax_userate_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<option value="-1">Choose one...</option>';
                tempRows += '<option value="1"' + (dragonecommercereservezyx987_validString(objArr[i].userate) === 1 ? 'selected' : '') + '>Yes</option>';
                tempRows += '<option value="0"' + (dragonecommercereservezyx987_validString(objArr[i].userate) === 0 ? 'selected' : '') + '>No</option>';
                tempRows += '</select></div></td>';                
                
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].rate);
                tempRows += '<div style="display:none;" class="dragonecommerce_tax_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_tax_rate_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_tax_rate_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].rate) + '" /></div>';                
                tempRows += '</td>';

                tempRows += '<td>' + (dragonecommercereservezyx987_validString(objArr[i].usefee) === 1 ? '<span style="color:green;">Yes</span>' : '<span style="color:red;">No</span>');
                tempRows += '<div style="display:none;" class="dragonecommerce_tax_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<select name="dragonecommerce_tax_usefee_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_tax_usefee_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<option value="-1">Choose one...</option>';
                tempRows += '<option value="1"' + (dragonecommercereservezyx987_validString(objArr[i].usefee) === 1 ? 'selected' : '') + '>Yes</option>';
                tempRows += '<option value="0"' + (dragonecommercereservezyx987_validString(objArr[i].usefee) === 0 ? 'selected' : '') + '>No</option>';
                tempRows += '</select></div></td>';    

                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].fee);
                tempRows += '<div style="display:none;" class="dragonecommerce_tax_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_tax_fee_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_tax_fee_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].fee) + '" /></div>';                
                tempRows += '</td>';
                
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].minordersubtotal);
                tempRows += '<div style="display:none;" class="dragonecommerce_tax_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_tax_minordersubtotal_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_tax_minordersubtotal_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].minordersubtotal) + '" /></div>';                
                tempRows += '</td>';

                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].start);
                tempRows += '<div style="display:none;" class="dragonecommerce_tax_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" class="dragonecommercereservezyx987_datetimepicker" name="dragonecommerce_tax_start_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_tax_start_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].start) + '" /></div>';                
                tempRows += '</td>';
                
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].end);
                tempRows += '<div style="display:none;" class="dragonecommerce_tax_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" class="dragonecommercereservezyx987_datetimepicker" name="dragonecommerce_tax_end_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_tax_end_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].end) + '" /></div>';                
                tempRows += '</td>';
                                
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].fromcountry);
                tempRows += '<div style="display:none;" class="dragonecommerce_tax_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';

                tempRows += '<select name="dragonecommerce_tax_fromcountryid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_tax_fromcountryid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" onchange="dragonecommercereservezyx987_updateProvincesDropdownList_forTableRow(this);" >';

                tempRows += '<option value="-1">Please choose one...</option>';
                <?php foreach ($allcountries as $country) { ?>
                <?php $country_status_temp = $country->status === '1' ? '' : 'color:grey;'; ?>
                tempRows += "<option " + (dragonecommercereservezyx987_validString(objArr[i].fromcountryid) === <?php echo $country->id === null ? 0 : intval($country->id); ?> ? 'selected' : '') + " value='<?php echo intval($country->id); ?>' style='<?php echo esc_html($country_status_temp); ?>'><?php echo esc_html($country->name); ?></option>";
                <?php } ?>
                tempRows += '</select></div></td>';    

                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].fromprovince);
                tempRows += '<div style="display:none;" class="dragonecommerce_tax_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';

                tempRows += '<select name="dragonecommerce_tax_fromstateprovinceid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_tax_fromstateprovinceid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';

                tempRows += '<option value="-1">Please choose one...</option>';
                <?php foreach ($allprovinces as $province) { ?>
                <?php $country_status_temp = $province->status === '1' ? '' : 'color:grey;'; ?>
                tempRows += "<option " + (dragonecommercereservezyx987_validString(objArr[i].fromstateprovinceid) === <?php echo $province->id === null ? 0 : intval($province->id); ?> ? 'selected' : '') + " class='<?php echo intval($province->countryid); ?>' value='<?php echo intval($province->id); ?>' style='<?php echo esc_html($country_status_temp); ?>'><?php echo esc_html($province->name); ?></option>";
                <?php } ?>
                tempRows += '</select></div></td>';

                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].tocountry);
                tempRows += '<div style="display:none;" class="dragonecommerce_tax_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';

                tempRows += '<select name="dragonecommerce_tax_tocountryid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_tax_tocountryid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" onchange="dragonecommercereservezyx987_updateProvincesDropdownList_forTableRow(this);" >';

                tempRows += '<option value="-1">Please choose one...</option>';
                <?php foreach ($allcountries as $country) { ?>
                <?php $country_status_temp = $country->status === '1' ? '' : 'color:grey;'; ?>
                tempRows += "<option " + (dragonecommercereservezyx987_validString(objArr[i].tocountryid) === <?php echo $country->id === null ? 0 : intval($country->id); ?> ? 'selected' : '') + " value='<?php echo intval($country->id); ?>' style='<?php echo esc_html($country_status_temp); ?>'><?php echo esc_html($country->name); ?></option>";
                <?php } ?>
                tempRows += '</select></div></td>';    
                                
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].toprovince);
                tempRows += '<div style="display:none;" class="dragonecommerce_tax_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';

                tempRows += '<select name="dragonecommerce_tax_tostateprovinceid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_tax_tostateprovinceid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';

                tempRows += '<option value="-1">Please choose one...</option>';
                <?php foreach ($allprovinces as $province) { ?>
                <?php $country_status_temp = $province->status === '1' ? '' : 'color:grey;'; ?>
                tempRows += "<option " + (dragonecommercereservezyx987_validString(objArr[i].tostateprovinceid) === <?php echo $province->id === null ? 0 : intval($province->id); ?> ? 'selected' : '') + " class='<?php echo intval($province->countryid); ?>' value='<?php echo intval($province->id); ?>' style='<?php echo esc_html($country_status_temp); ?>'><?php echo esc_html($province->name); ?></option>";
                <?php } ?>
                tempRows += '</select></div></td>';

                tempRows += '<td>' + (dragonecommercereservezyx987_validString(objArr[i].taxincludeshipping) === 1 ? '<span style="color:green;">Yes</span>' : '<span style="color:red;">No</span>');
                tempRows += '<div style="display:none;" class="dragonecommerce_tax_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<select name="dragonecommerce_tax_taxincludeshipping_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_tax_taxincludeshipping_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<option value="-1">Choose one...</option>';
                tempRows += '<option value="1"' + (dragonecommercereservezyx987_validString(objArr[i].taxincludeshipping) === 1 ? 'selected' : '') + '>Yes</option>';
                tempRows += '<option value="0"' + (dragonecommercereservezyx987_validString(objArr[i].taxincludeshipping) === 0 ? 'selected' : '') + '>No</option>';
                tempRows += '</select></div></td>';
                
                tempRows += '<td>' + (dragonecommercereservezyx987_validString(objArr[i].taxincludehandling) === 1 ? '<span style="color:green;">Yes</span>' : '<span style="color:red;">No</span>');
                tempRows += '<div style="display:none;" class="dragonecommerce_tax_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<select name="dragonecommerce_tax_taxincludehandling_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_tax_taxincludehandling_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<option value="-1">Choose one...</option>';
                tempRows += '<option value="1"' + (dragonecommercereservezyx987_validString(objArr[i].taxincludehandling) === 1 ? 'selected' : '') + '>Yes</option>';
                tempRows += '<option value="0"' + (dragonecommercereservezyx987_validString(objArr[i].taxincludehandling) === 0 ? 'selected' : '') + '>No</option>';
                tempRows += '</select></div></td>';
                                                                                                                                                    
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].priority);
                tempRows += '<div style="display:none;" class="dragonecommerce_tax_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_tax_priority_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_tax_priority_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].priority) + '" /></div>';                
                tempRows += '</td>';                
                
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].createtimeutc) + '</td>';
                
                tempRows += '<td>' + (dragonecommercereservezyx987_validString(objArr[i].status) === 1 ? '<span style="color:green;">ACTIVE</span>' : '<span style="color:red;">INACTIVE</span>');
                tempRows += '<div style="display:none;" class="dragonecommerce_tax_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<select name="dragonecommerce_tax_status_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_tax_status_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<option value="-1">Choose one...</option>';
                tempRows += '<option value="1"' + (dragonecommercereservezyx987_validString(objArr[i].status) === 1 ? 'selected' : '') + '>Active</option>';
                tempRows += '<option value="0"' + (dragonecommercereservezyx987_validString(objArr[i].status) === 0 ? 'selected' : '') + '>Not Active</option>';
                tempRows += '</select></div></td>';
                
                tempRows += '</tr>';
            }                                    
            jQuery('tbody#dragonecommerce_tax').html(tempRows);
            jQuery(".dragonecommercereservezyx987_datetimepicker" ).datetimepicker({ format:'Y-m-d H:i:s' });            
            var totaltaxquantity = mydata["total"] == null ? '0' : mydata["total"];
            jQuery('span#totaltaxquantity').text(totaltaxquantity);
            totaltaxquantity = parseInt(mydata["total"]);
            var amountperpage = parseInt(jQuery('select#dragonecommerce_tax_itemsperpage').val());
            if(amountperpage === -1) {amountperpage = parseInt(TAX_ITEMS_PER_PAGE_PRESET_VALUE);}
            if(amountperpage > 0) {
                totalpagenumber_onload_admin_tax = Math.ceil(totaltaxquantity / amountperpage);
                dragonecommercereservezyx987_createPagination(totalpagenumber_onload_admin_tax, pagenumber , 'tax');        
            }                    
            jQuery('img#admin_taxlist_loader').hide();
        }).fail(function( jqXHR, textStatus ) {
            //alert( "Request tax list failed: " + textStatus );
        });
    }
    
    function dragonecommercereservezyx987_resetTaxesSearchParameters() {    
        jQuery('input#dragonecommerce_tax_name').val('');
        jQuery('input#dragonecommerce_tax_shownname').val('');
        jQuery('input#dragonecommerce_tax_description').val('');
        jQuery('input#dragonecommerce_tax_fromdate').val('');
        jQuery('input#dragonecommerce_tax_todate').val('');
        jQuery('select#dragonecommerce_tax_status').val('-1');
        jQuery('select#dragonecommerce_tax_itemsperpage').val('-1');
        jQuery('select#dragonecommerce_tax_sortby').val('-1');
    }
    
    function dragonecommercereservezyx987_getPropertiesList(pagenumber) {
        var dataObj = {dragonecommercereservezyx987_hidden_security_getproperties:"<?php echo wp_create_nonce('dragonecommercereservezyx987_getProperties'); ?>",dragonecommercereservezyx987_hidden:"Y",action:"dragonecommercereservezyx987_getProperties"};
        dataObj.searchwords = jQuery('input#dragonecommerce_property_name').val();        
        dataObj.chargetypeid = jQuery('select#dragonecommerce_property_chargetypeid').val();        
        dataObj.propertystatus = jQuery('select#dragonecommerce_property_status').val();
        dataObj.amountperpage = jQuery('select#dragonecommerce_property_itemsperpage').val();
        if(typeof pagenumber === 'undefined') {pagenumber = 1;}
        dataObj.pagenumber = pagenumber;

        var sortby = jQuery('select#dragonecommerce_property_sortby').val();
        if(sortby === 'id|asc') {
            dataObj.sortby = 'id';
            dataObj.order = 'asc';                  
        } else if(sortby === 'id|desc') {
            dataObj.sortby = 'id';
            dataObj.order = 'desc';                  
        } else if(sortby === 'name|asc') {
            dataObj.sortby = 'name';
            dataObj.order = 'asc';                  
        } else if(sortby === 'name|desc') {
            dataObj.sortby = 'name';
            dataObj.order = 'desc';                      
        } else if(sortby === 'chargetypename|asc') {
            dataObj.sortby = 'chargetypename';
            dataObj.order = 'asc';      
        } else if(sortby === 'chargetypename|desc') {
            dataObj.sortby = 'chargetypename';
            dataObj.order = 'desc';                  
        } else if(sortby === 'createtimeutc|asc') {
            dataObj.sortby = 'createtimeutc';
            dataObj.order = 'asc';      
        } else if(sortby === 'createtimeutc|desc') {
            dataObj.sortby = 'createtimeutc';
            dataObj.order = 'desc';                  
        }
                
        jQuery('tbody#dragonecommerce_property').html('');
        jQuery('span#totalpropertyquantity').text('');
        jQuery('img#admin_propertylist_loader').show();        
        
        jQuery.ajax({
            type: "POST",
            async: true,
            url: ajaxurl,
            data: dataObj
        }).done(function (mydata) {
            var objArr = mydata["property"];
            var tempRows = '';
            for (var i = 0; i < objArr.length; i++) {
                var temp_button = '<a href="javascript:void(0);" class="btn btn-primary" onclick="dragonecommercereservezyx987_editProperty(' + dragonecommercereservezyx987_validString(objArr[i].id) + ', \'dragonecommerce_property_container_\');">Edit</a>';
                temp_button += '<a href="javascript:void(0);" style="display:none;" class="btn btn-primary dragonecommerce_property_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" onclick="dragonecommercereservezyx987_saveProperty(' + dragonecommercereservezyx987_validString(objArr[i].id) + ', \'dragonecommerce_property_\');">Save</a>';                    
                
                tempRows += '<tr><td>'+ temp_button + '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].id) + '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].name);
                tempRows += '<div style="display:none;" class="dragonecommerce_property_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_property_name_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_property_name_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].name).replace(/"/g, '\\&#34;') + '" /></div>';

                tempRows += '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].shownname);
                tempRows += '<div style="display:none;" class="dragonecommerce_property_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_property_shownname_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_property_shownname_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].shownname).replace(/"/g, '\\&#34;') + '" /></div>';
                
                tempRows += '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].description);
                tempRows += '<div style="display:none;" class="dragonecommerce_property_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_property_description_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_property_description_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].description).replace(/"/g, '\\&#34;') + '" /></div>';                
                tempRows += '</td>';
                                                            
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].chargetypename);
                tempRows += '<div style="display:none;" class="dragonecommerce_property_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';

                tempRows += '<select name="dragonecommerce_property_chargetypeid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_property_chargetypeid_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';

                tempRows += '<option value="-1">Please choose one...</option>';
                <?php foreach ($allchargetypes as $chargetype) { ?>
                <?php $chargetype_status_temp = $chargetype->status === '1' ? '' : 'color:grey;'; ?>
                tempRows += "<option " + (dragonecommercereservezyx987_validString(objArr[i].chargetypeid) === <?php echo $chargetype->id === null ? 0 : intval($chargetype->id); ?> ? 'selected' : '') + " value='<?php echo intval($chargetype->id); ?>' style='<?php echo esc_html($chargetype_status_temp); ?>'><?php echo esc_html($chargetype->name); ?></option>";
                <?php } ?>                
                tempRows += '</select></div></td>';            
                                                                                                    
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].priority);
                tempRows += '<div style="display:none;" class="dragonecommerce_property_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" ><input type="text" name="dragonecommerce_property_priority_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_property_priority_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].priority) + '" /></div>';                
                tempRows += '</td>';
                                
                tempRows += '<td>' + (dragonecommercereservezyx987_validString(objArr[i].forallproduct) === 1 ? '<span style="color:green;">Yes</span>' : '<span style="color:red;">No</span>');
                tempRows += '<div style="display:none;" class="dragonecommerce_property_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<select name="dragonecommerce_property_forallproduct_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_property_forallproduct_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<option value="-1">Choose one...</option>';
                tempRows += '<option value="1"' + (dragonecommercereservezyx987_validString(objArr[i].forallproduct) === 1 ? 'selected' : '') + '>Yes</option>';
                tempRows += '<option value="0"' + (dragonecommercereservezyx987_validString(objArr[i].forallproduct) === 0 ? 'selected' : '') + '>No</option>';
                tempRows += '</select></div></td>';
                
                tempRows += '<td>' + (dragonecommercereservezyx987_validString(objArr[i].mandatory) === 1 ? '<span style="color:green;">Yes</span>' : '<span style="color:red;">No</span>');
                tempRows += '<div style="display:none;" class="dragonecommerce_property_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<select name="dragonecommerce_property_mandatory_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_property_mandatory_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<option value="-1">Choose one...</option>';
                tempRows += '<option value="1"' + (dragonecommercereservezyx987_validString(objArr[i].mandatory) === 1 ? 'selected' : '') + '>Yes</option>';
                tempRows += '<option value="0"' + (dragonecommercereservezyx987_validString(objArr[i].mandatory) === 0 ? 'selected' : '') + '>No</option>';
                tempRows += '</select></div></td>';
                                
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].createtimeutc) + '</td>';
                
                tempRows += '<td>' + (dragonecommercereservezyx987_validString(objArr[i].status) === 1 ? '<span style="color:green;">ACTIVE</span>' : '<span style="color:red;">INACTIVE</span>');
                tempRows += '<div style="display:none;" class="dragonecommerce_property_container_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<select name="dragonecommerce_property_status_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="dragonecommerce_property_status_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                tempRows += '<option value="-1">Choose one...</option>';
                tempRows += '<option value="1"' + (dragonecommercereservezyx987_validString(objArr[i].status) === 1 ? 'selected' : '') + '>Active</option>';
                tempRows += '<option value="0"' + (dragonecommercereservezyx987_validString(objArr[i].status) === 0 ? 'selected' : '') + '>Not Active</option>';
                tempRows += '</select></div></td>';
                
                tempRows += '</tr>';
            }                                    
            jQuery('tbody#dragonecommerce_property').html(tempRows);
            var totalpropertyquantity = mydata["total"] == null ? '0' : mydata["total"];
            jQuery('span#totalpropertyquantity').text(totalpropertyquantity);
            totalpropertyquantity = parseInt(mydata["total"]);
            var amountperpage = parseInt(jQuery('select#dragonecommerce_property_itemsperpage').val());
            if(amountperpage === -1) {amountperpage = parseInt(PROPERTY_ITEMS_PER_PAGE_PRESET_VALUE);}
            if(amountperpage > 0) {
                totalpagenumber_onload_admin_property = Math.ceil(totalpropertyquantity / amountperpage);
                dragonecommercereservezyx987_createPagination(totalpagenumber_onload_admin_property, pagenumber , 'property');        
            }                    
            jQuery('img#admin_propertylist_loader').hide();
        }).fail(function( jqXHR, textStatus ) {
            //alert( "Request property list failed: " + textStatus );
        });
    }
    
    function dragonecommercereservezyx987_resetPropertiesSearchParameters() {    
        jQuery('input#dragonecommerce_property_name').val('');        
        jQuery('input#dragonecommerce_property_countryname').val('');
        jQuery('select#dragonecommerce_property_chargetypeid').val('-1');
        jQuery('select#dragonecommerce_property_status').val('-1');
        jQuery('select#dragonecommerce_property_itemsperpage').val('-1');
        jQuery('select#dragonecommerce_property_sortby').val('-1');
    }

    function dragonecommercereservezyx987_getGroupPropertiesList(pagenumber) {
        var dataObj = {dragonecommercereservezyx987_hidden_security_getgroupproperties:"<?php echo wp_create_nonce('dragonecommercereservezyx987_getGroupProperties'); ?>",dragonecommercereservezyx987_hidden:"Y",action:"dragonecommercereservezyx987_getGroupProperties"};
        dataObj.groupid = jQuery('select#dragonecommerce_groupproperty_groupid').val();        
        dataObj.propertyid = jQuery('select#dragonecommerce_groupproperty_propertyid').val();        
        dataObj.grouppropertystatus = jQuery('select#dragonecommerce_groupproperty_status').val();
        dataObj.amountperpage = jQuery('select#dragonecommerce_groupproperty_itemsperpage').val();
        if(typeof pagenumber === 'undefined') {pagenumber = 1;}
        dataObj.pagenumber = pagenumber;
        var sortby = jQuery('select#dragonecommerce_groupproperty_sortby').val();
        if(sortby === 'id|asc') {
            dataObj.sortby = 'id';
            dataObj.order = 'asc';                  
        } else if(sortby === 'id|desc') {
            dataObj.sortby = 'id';
            dataObj.order = 'desc';                  
        } else if(sortby === 'groupid|asc') {
            dataObj.sortby = 'groupid';
            dataObj.order = 'asc';                  
        } else if(sortby === 'groupid|desc') {
            dataObj.sortby = 'groupid';
            dataObj.order = 'desc';                  
        } else if(sortby === 'propertyid|asc') {
            dataObj.sortby = 'propertyid';
            dataObj.order = 'asc';                  
        } else if(sortby === 'propertyid|desc') {
            dataObj.sortby = 'propertyid';
            dataObj.order = 'desc';                  
        }                
        jQuery('tbody#dragonecommerce_groupproperty').html('');
        jQuery('span#totalgrouppropertyquantity').text('');
        jQuery('img#admin_grouppropertylist_loader').show();        
        jQuery.ajax({
            type: "POST",
            async: true,
            url: ajaxurl,
            data: dataObj
        }).done(function (mydata) {
            var objArr = mydata["groupproperty"];
            var tempRows = '';
            for (var i = 0; i < objArr.length; i++) {                
                tempRows += '<tr><td>' + dragonecommercereservezyx987_validString(objArr[i].id) + '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].groupid) + '</td>';                
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].propertyid) + '</td>';                                
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].createtimeutc) + '</td>';                
                tempRows += '<td>' + (dragonecommercereservezyx987_validString(objArr[i].status) === 1 ? '<span style="color:green;">ACTIVE</span>' : '<span style="color:red;">INACTIVE</span>');                
                tempRows += '</td></tr>';
            }                                    
            jQuery('tbody#dragonecommerce_groupproperty').html(tempRows);
            var totalgrouppropertyquantity = mydata["total"] == null ? '0' : mydata["total"];
            jQuery('span#totalgrouppropertyquantity').text(totalgrouppropertyquantity);
            totalgrouppropertyquantity = parseInt(mydata["total"]);
            var amountperpage = parseInt(jQuery('select#dragonecommerce_groupproperty_itemsperpage').val());
            if(amountperpage === -1) {amountperpage = parseInt(GROUPPROPERTY_ITEMS_PER_PAGE_PRESET_VALUE);}
            if(amountperpage > 0) {
                totalpagenumber_onload_admin_groupproperty = Math.ceil(totalgrouppropertyquantity / amountperpage);
                dragonecommercereservezyx987_createPagination(totalpagenumber_onload_admin_groupproperty, pagenumber , 'groupproperty');        
            }                    
            jQuery('img#admin_grouppropertylist_loader').hide();
        }).fail(function( jqXHR, textStatus ) {
            //alert( "Request group property mapping list failed: " + textStatus );
        });
    }
    
    function dragonecommercereservezyx987_resetGroupPropertiesSearchParameters() {    
        jQuery('select#dragonecommerce_groupproperty_groupid').val('-1');        
        jQuery('select#dragonecommerce_groupproperty_propertyid').val('-1');
        jQuery('select#dragonecommerce_groupproperty_status').val('-1');
        jQuery('select#dragonecommerce_groupproperty_itemsperpage').val('-1');
        jQuery('select#dragonecommerce_groupproperty_sortby').val('-1');
    }
    
    function dragonecommercereservezyx987_getSettingsList() {
        jQuery('tbody#dragonecommerce_setting').html('');
        jQuery('span#totalsettingquantity').text('');
        jQuery('img#admin_settinglist_loader').show();
        jQuery.ajax({
            type: "POST",
            async: true,
            url: ajaxurl,
            data: {dragonecommercereservezyx987_hidden_security_getsettings:"<?php echo wp_create_nonce('dragonecommercereservezyx987_getSettings'); ?>",dragonecommercereservezyx987_hidden:"Y",action:"dragonecommercereservezyx987_getSettings"}
        }).done(function (mydata) {
            var objArr = mydata["setting"];
            var tempRows = '';
            for (var i = 0; i < objArr.length; i++) {
                var temp_name = dragonecommercereservezyx987_validString(objArr[i].name);
                if(temp_name === 'MAX_PROMOTION_PER_ORDER') {
                    temp_name += '&nbsp;(set to -1 to get unlimited valid discounts and coupons)';;
                }
                if(temp_name === 'MAX_DISCOUNT_PER_ORDER') {
                    temp_name += '&nbsp;(set to -1 to get unlimited valid discounts)';;
                }
                if(temp_name === 'MAX_COUPON_PER_ORDER') {
                    temp_name += '&nbsp;(set to -1 to get unlimited valid coupons)';;
                }                
                if(temp_name === 'GOOGLE_ANALYTICS_MEASUREMENT_ID') {
                    temp_name += '&nbsp;(e.g. G-298CWAB8K1)';;
                }
                if(temp_name === 'GOOGLE_RECAPTCHA_SITEKEY') {
                    temp_name += '&nbsp;(e.g. 6LcKkyscABCDEF-GH66kF88lmnP9QRsTUvw9lX4Y)';;
                }
                if(temp_name === 'COMPANY_TIMEZONE_HOURS') {
                    temp_name += '&nbsp;(manually change it for daylight savings time)';;
                }                
                var temp_button = '<a href="javascript:void(0);" class="btn btn-primary" onclick="dragonecommercereservezyx987_editSetting(this, ' + dragonecommercereservezyx987_validString(objArr[i].id) + ');">Edit</a>';                                    
                if(temp_name === 'DBBACKUP_DETAILS' || temp_name === 'PAYMENT_METHOD') {
                    temp_button = '';
                }
                tempRows += '<tr><td>'+ temp_button + '</td><td>' + dragonecommercereservezyx987_validString(objArr[i].id) + '</td><td>' + temp_name + '</td>';
                if(temp_name === 'COMPANY_TIMEZONE') {
                    /*tempRows += '<td><span class="settingspan" >' + dragonecommercereservezyx987_validString(objArr[i].value) + '</span>';
                    tempRows += '<select class="settingedittextbox" style="display:none;" name="setting_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="setting_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                    
                    //tempRows += '<option value="-1">Please choose one...</option>';
                    tempRows += '<option value="Etc/GMT+12|-12:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'Etc/GMT+12' ? 'selected' : '') + '>(GMT-12:00) International Date Line West</option>';
                    tempRows += '<option value="Pacific/Midway|-11:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'Pacific/Midway' ? 'selected' : '') + '>(GMT-11:00) Midway Island, Samoa</option>';
                    tempRows += '<option value="Pacific/Honolulu|-10:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'Pacific/Honolulu' ? 'selected' : '') + '>(GMT-10:00) Hawaii</option>';
                    tempRows += '<option value="America/Anchorage|-09:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'America/Anchorage' ? 'selected' : '') + '>(GMT-09:00) Alaska</option>';
                    tempRows += '<option value="America/Los_Angeles|-08:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'America/Los_Angeles' ? 'selected' : '') + '>(GMT-08:00) Pacific Time (US & Canada)</option>';
                    tempRows += '<option value="America/Tijuana|-08:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'America/Tijuana' ? 'selected' : '') + '>(GMT-08:00) Tijuana, Baja California</option>';
                    tempRows += '<option value="America/Phoenix|-07:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'America/Phoenix' ? 'selected' : '') + '>(GMT-07:00) Arizona</option>';
                    tempRows += '<option value="America/Chihuahua|-07:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'America/Chihuahua' ? 'selected' : '') + '>(GMT-07:00) Chihuahua, La Paz, Mazatlan</option>';
                    tempRows += '<option value="America/Denver|-07:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'America/Denver' ? 'selected' : '') + '>(GMT-07:00) Mountain Time (US & Canada)</option>';
                    tempRows += '<option value="America/Managua|-06:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'America/Managua' ? 'selected' : '') + '>(GMT-06:00) Central America</option>';
                    tempRows += '<option value="America/Chicago|-06:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'America/Chicago' ? 'selected' : '') + '>(GMT-06:00) Central Time (US & Canada)</option>';
                    tempRows += '<option value="America/Mexico_City|-06:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'America/Mexico_City' ? 'selected' : '') + '>(GMT-06:00) Guadalajara, Mexico City, Monterrey</option>';
                    tempRows += '<option value="America/Regina|-06:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'America/Regina' ? 'selected' : '') + '>(GMT-06:00) Saskatchewan</option>';
                    tempRows += '<option value="America/Bogota|-05:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'America/Bogota' ? 'selected' : '') + '>(GMT-05:00) Bogota, Lima, Quito, Rio Branco</option>';
                    tempRows += '<option value="America/New_York|-05:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'America/New_York' ? 'selected' : '') + '>(GMT-05:00) Eastern Time (US & Canada)</option>';
                    tempRows += '<option value="America/Indiana/Indianapolis|-05:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'America/Indiana/Indianapolis' ? 'selected' : '') + '>(GMT-05:00) Indiana (East)</option>';
                    tempRows += '<option value="America/Halifax|-04:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'America/Halifax' ? 'selected' : '') + '>(GMT-04:00) Atlantic Time (Canada)</option>';
                    tempRows += '<option value="America/Caracas|-04:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'America/Caracas' ? 'selected' : '') + '>(GMT-04:00) Caracas, La Paz</option>';
                    tempRows += '<option value="America/Manaus|-04:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'America/Manaus' ? 'selected' : '') + '>(GMT-04:00) Manaus</option>';
                    tempRows += '<option value="America/Santiago|-04:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'America/Santiago' ? 'selected' : '') + '>(GMT-04:00) Santiago</option>';
                    tempRows += '<option value="America/St_Johns|-03:30" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'America/St_Johns' ? 'selected' : '') + '>(GMT-03:30) Newfoundland</option>';
                    tempRows += '<option value="America/Sao_Paulo|-03:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'America/Sao_Paulo' ? 'selected' : '') + '>(GMT-03:00) Brasilia</option>';
                    tempRows += '<option value="America/Argentina/Buenos_Aires|-03:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'America/Argentina/Buenos_Aires' ? 'selected' : '') + '>(GMT-03:00) Buenos Aires, Georgetown</option>';
                    tempRows += '<option value="America/Godthab|-03:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'America/Godthab' ? 'selected' : '') + '>(GMT-03:00) Greenland</option>';
                    tempRows += '<option value="America/Montevideo|-03:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'America/Montevideo' ? 'selected' : '') + '>(GMT-03:00) Montevideo</option>';
                    tempRows += '<option value="America/Noronha|-02:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'America/Noronha' ? 'selected' : '') + '>(GMT-02:00) Mid-Atlantic</option>';
                    tempRows += '<option value="Atlantic/Cape_Verde|-01:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'Atlantic/Cape_Verde' ? 'selected' : '') + '>(GMT-01:00) Cape Verde Is.</option>';
                    tempRows += '<option value="Atlantic/Azores|-01:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'Atlantic/Azores' ? 'selected' : '') + '>(GMT-01:00) Azores</option>';
                    tempRows += '<option value="Africa/Casablanca|+00:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'Africa/Casablanca' ? 'selected' : '') + '>(GMT+00:00) Casablanca, Monrovia, Reykjavik</option>';
                    tempRows += '<option value="Etc/Greenwich|+00:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'Etc/Greenwich' ? 'selected' : '') + '>(GMT+00:00) Greenwich Mean Time : Dublin, Edinburgh, Lisbon, London</option>';
                    tempRows += '<option value="Europe/Amsterdam|+01:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'Europe/Amsterdam' ? 'selected' : '') + '>(GMT+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna</option>';
                    tempRows += '<option value="Europe/Belgrade|+01:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'Europe/Belgrade' ? 'selected' : '') + '>(GMT+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague</option>';
                    tempRows += '<option value="Europe/Brussels|+01:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'Europe/Brussels' ? 'selected' : '') + '>(GMT+01:00) Brussels, Copenhagen, Madrid, Paris</option>';
                    tempRows += '<option value="Europe/Sarajevo|+01:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'Europe/Sarajevo' ? 'selected' : '') + '>(GMT+01:00) Sarajevo, Skopje, Warsaw, Zagreb</option>';
                    tempRows += '<option value="Africa/Lagos|+01:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'Africa/Lagos' ? 'selected' : '') + '>(GMT+01:00) West Central Africa</option>';
                    tempRows += '<option value="Asia/Amman|+02:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'Asia/Amman' ? 'selected' : '') + '>(GMT+02:00) Amman</option>';
                    tempRows += '<option value="Europe/Athens|+02:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'Europe/Athens' ? 'selected' : '') + '>(GMT+02:00) Athens, Bucharest, Istanbul</option>';
                    tempRows += '<option value="Asia/Beirut|+02:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'Asia/Beirut' ? 'selected' : '') + '>(GMT+02:00) Beirut</option>';
                    tempRows += '<option value="Africa/Cairo|+02:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'Africa/Cairo' ? 'selected' : '') + '>(GMT+02:00) Cairo</option>';
                    tempRows += '<option value="Africa/Harare|+02:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'Africa/Harare' ? 'selected' : '') + '>(GMT+02:00) Harare, Pretoria</option>';
                    tempRows += '<option value="Europe/Helsinki|+02:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'Europe/Helsinki' ? 'selected' : '') + '>(GMT+02:00) Helsinki, Kyiv, Riga, Sofia, Tallinn, Vilnius</option>';
                    tempRows += '<option value="Asia/Jerusalem|+02:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'Asia/Jerusalem' ? 'selected' : '') + '>(GMT+02:00) Jerusalem</option>';
                    tempRows += '<option value="Europe/Minsk|+02:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'Europe/Minsk' ? 'selected' : '') + '>(GMT+02:00) Minsk</option>';
                    tempRows += '<option value="Africa/Windhoek|+02:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'Africa/Windhoek' ? 'selected' : '') + '>(GMT+02:00) Windhoek</option>';
                    tempRows += '<option value="Asia/Kuwait|+03:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'Asia/Kuwait' ? 'selected' : '') + '>(GMT+03:00) Kuwait, Riyadh, Baghdad</option>';
                    tempRows += '<option value="Europe/Moscow|+03:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'Europe/Moscow' ? 'selected' : '') + '>(GMT+03:00) Moscow, St. Petersburg, Volgograd</option>';
                    tempRows += '<option value="Africa/Nairobi|+03:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'Africa/Nairobi' ? 'selected' : '') + '>(GMT+03:00) Nairobi</option>';
                    tempRows += '<option value="Asia/Tbilisi|+03:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'Asia/Tbilisi' ? 'selected' : '') + '>(GMT+03:00) Tbilisi</option>';
                    tempRows += '<option value="Asia/Tehran|+03:30" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'Asia/Tehran' ? 'selected' : '') + '>(GMT+03:30) Tehran</option>';
                    tempRows += '<option value="Asia/Muscat|+04:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'Asia/Muscat' ? 'selected' : '') + '>(GMT+04:00) Abu Dhabi, Muscat</option>';
                    tempRows += '<option value="Asia/Baku|+04:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'Asia/Baku' ? 'selected' : '') + '>(GMT+04:00) Baku</option>';
                    tempRows += '<option value="Asia/Yerevan|+04:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'Asia/Yerevan' ? 'selected' : '') + '>(GMT+04:00) Yerevan</option>';
                    tempRows += '<option value="Asia/Kabul|+04:30" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'Asia/Kabul' ? 'selected' : '') + '>(GMT+04:30) Kabul</option>';
                    tempRows += '<option value="Asia/Yekaterinburg|+05:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'Asia/Yekaterinburg' ? 'selected' : '') + '>(GMT+05:00) Yekaterinburg</option>';
                    tempRows += '<option value="Asia/Karachi|+05:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'Asia/Karachi' ? 'selected' : '') + '>(GMT+05:00) Islamabad, Karachi, Tashkent</option>';
                    tempRows += '<option value="Asia/Calcutta|+05:30" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'Asia/Calcutta' ? 'selected' : '') + '>(GMT+05:30) Chennai, Kolkata, Mumbai, New Delhi, Sri Jayawardenapura</option>';
                    tempRows += '<option value="Asia/Katmandu|+05:45" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'Asia/Katmandu' ? 'selected' : '') + '>(GMT+05:45) Kathmandu</option>';
                    tempRows += '<option value="Asia/Almaty|+06:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'Asia/Almaty' ? 'selected' : '') + '>(GMT+06:00) Almaty, Novosibirsk</option>';
                    tempRows += '<option value="Asia/Dhaka|+06:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'Asia/Dhaka' ? 'selected' : '') + '>(GMT+06:00) Astana, Dhaka</option>';
                    tempRows += '<option value="Asia/Rangoon|+06:30" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'Asia/Rangoon' ? 'selected' : '') + '>(GMT+06:30) Yangon (Rangoon)</option>';
                    tempRows += '<option value="Asia/Bangkok|+07:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'Asia/Bangkok' ? 'selected' : '') + '>(GMT+07:00) Bangkok, Hanoi, Jakarta</option>';
                    tempRows += '<option value="Asia/Krasnoyarsk|+07:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'Asia/Krasnoyarsk' ? 'selected' : '') + '>(GMT+07:00) Krasnoyarsk</option>';
                    tempRows += '<option value="Asia/Hong_Kong|+08:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'Asia/Hong_Kong' ? 'selected' : '') + '>(GMT+08:00) Beijing, Chongqing, Hong Kong, Urumqi</option>';
                    tempRows += '<option value="Asia/Kuala_Lumpur|+08:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'Asia/Kuala_Lumpur' ? 'selected' : '') + '>(GMT+08:00) Kuala Lumpur, Singapore</option>';
                    tempRows += '<option value="Asia/Irkutsk|+08:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'Asia/Irkutsk' ? 'selected' : '') + '>(GMT+08:00) Irkutsk, Ulaan Bataar</option>';
                    tempRows += '<option value="Australia/Perth|+08:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'Australia/Perth' ? 'selected' : '') + '>(GMT+08:00) Perth</option>';
                    tempRows += '<option value="Asia/Taipei|+08:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'Asia/Taipei' ? 'selected' : '') + '>(GMT+08:00) Taipei</option>';
                    tempRows += '<option value="Asia/Tokyo|+09:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'Asia/Tokyo' ? 'selected' : '') + '>(GMT+09:00) Osaka, Sapporo, Tokyo</option>';
                    tempRows += '<option value="Asia/Seoul|+09:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'Asia/Seoul' ? 'selected' : '') + '>(GMT+09:00) Seoul</option>';
                    tempRows += '<option value="Asia/Yakutsk|+09:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'Asia/Yakutsk' ? 'selected' : '') + '>(GMT+09:00) Yakutsk</option>';
                    tempRows += '<option value="Australia/Adelaide|+09:30" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'Australia/Adelaide' ? 'selected' : '') + '>(GMT+09:30) Adelaide</option>';
                    tempRows += '<option value="Australia/Darwin|+09:30" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'Australia/Darwin' ? 'selected' : '') + '>(GMT+09:30) Darwin</option>';
                    tempRows += '<option value="Australia/Brisbane|+10:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'Australia/Brisbane' ? 'selected' : '') + '>(GMT+10:00) Brisbane</option>';
                    tempRows += '<option value="Australia/Canberra|+10:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'Australia/Canberra' ? 'selected' : '') + '>(GMT+10:00) Canberra, Melbourne, Sydney</option>';
                    tempRows += '<option value="Australia/Hobart|+10:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'Australia/Hobart' ? 'selected' : '') + '>(GMT+10:00) Hobart</option>';
                    tempRows += '<option value="Pacific/Guam|+10:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'Pacific/Guam' ? 'selected' : '') + '>(GMT+10:00) Guam, Port Moresby</option>';
                    tempRows += '<option value="Asia/Vladivostok|+10:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'Asia/Vladivostok' ? 'selected' : '') + '>(GMT+10:00) Vladivostok</option>';
                    tempRows += '<option value="Asia/Magadan|+11:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'Asia/Magadan' ? 'selected' : '') + '>(GMT+11:00) Magadan, Solomon Is., New Caledonia</option>';
                    tempRows += '<option value="Pacific/Auckland|+12:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'Pacific/Auckland' ? 'selected' : '') + '>(GMT+12:00) Auckland, Wellington</option>';
                    tempRows += '<option value="Pacific/Fiji|+12:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'Pacific/Fiji' ? 'selected' : '') + '>(GMT+12:00) Fiji, Kamchatka, Marshall Is.</option>';
                    tempRows += '<option value="Pacific/Tongatapu|+13:00" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === 'Pacific/Tongatapu' ? 'selected' : '') + '>(GMT+13:00) Nuku\'alofa</option>';                
                    tempRows += '</select>';                    
                    
                    tempRows += '<input class="settingedittextbox" style="display:none;" type="button" value="Update" name="settingeditsubmitbutton_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="settingeditsubmitbutton_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" onclick="dragonecommercereservezyx987_submitSettingValue(\'setting_' + dragonecommercereservezyx987_validString(objArr[i].id) + '\', ' + dragonecommercereservezyx987_validString(objArr[i].id) + ',\'COMPANY_TIMEZONE\');" /></td>';                    
                    jQuery('span#dragonecommerce_form_3_5_1_backup_timezone').text(dragonecommercereservezyx987_validString(objArr[i].value));*/
                } else if(temp_name === 'ENABLE_HANDLING_CHARGE' || temp_name === 'ENABLE_SHIPPING_CHARGE' || temp_name === 'RESERVE_NEED_ADMIN_APPROVE' || temp_name === 'ENABLE_PRODUCT_QUANTITY_AUTO_DEDUCT' || temp_name === 'USE_GOOGLE_ANALYTICS' || temp_name === 'USE_GOOGLE_RECAPTCHA') {
                    tempRows += '<td><span class="settingspan" >' + dragonecommercereservezyx987_validString(objArr[i].value) + '</span>';
                    tempRows += '<select class="settingedittextbox" style="display:none;" name="setting_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="setting_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                    
                    tempRows += '<option value="-1">Please choose one...</option>';
                    tempRows += '<option value="1" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === '1' ? 'selected' : '') + '>Yes</option>';
                    tempRows += '<option value="0" ' + (dragonecommercereservezyx987_validString(objArr[i].value) === '0' ? 'selected' : '') + '>No</option>';
                    tempRows += '</select>';                    
                    
                    tempRows += '<input class="settingedittextbox" style="display:none;" type="button" value="Update" name="settingeditsubmitbutton_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="settingeditsubmitbutton_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" onclick="dragonecommercereservezyx987_submitSettingValue(\'setting_' + dragonecommercereservezyx987_validString(objArr[i].id) + '\', ' + dragonecommercereservezyx987_validString(objArr[i].id) + ');" /></td>';                    
                    
                } else if(temp_name === 'DBBACKUP_LOCALTIME') {
                    tempRows += '<td><span class="settingspan" >' + dragonecommercereservezyx987_validString(objArr[i].value) + '</span>';
                    tempRows += '<input class="settingedittextbox dragonecommercereservezyx987_datetimepicker" style="display:none;" name="setting_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="setting_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].value) + '"/>';                    
                    tempRows += '<input class="settingedittextbox" style="display:none;" type="button" value="Update" name="settingeditsubmitbutton_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="settingeditsubmitbutton_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" onclick="dragonecommercereservezyx987_submitSettingValue(\'setting_' + dragonecommercereservezyx987_validString(objArr[i].id) + '\', ' + dragonecommercereservezyx987_validString(objArr[i].id) + ');" /></td>';                    
                } else if(temp_name === 'DBBACKUP_DETAILS') {
                    if(dragonecommercereservezyx987_validString(objArr[i].value) === '') {
                        tempRows += '<td><span class="settingspan" >VALUE IS NOT SET</span>';    
                    } else {
                        tempRows += '<td><span class="settingspan" >HAS VALUE, CONFIDENTIAL</span>';    
                    }                        
                    tempRows += '</td>';                    
                } else if(temp_name === 'EMAIL_METHOD') {
                    tempRows += '<td><span class="settingspan" >';
                    <?php foreach ($activeemailmethods as $emailmethod) { ?>
                    if(dragonecommercereservezyx987_validString(objArr[i].value) === "<?php echo $emailmethod->id === null ? 0 : intval($emailmethod->id); ?>") {
                    tempRows += "<?php echo esc_html($emailmethod->name); ?>";
                    }
                    <?php } ?>                    
                    tempRows += '</span>';
                    tempRows += '<select class="settingedittextbox" style="display:none;" name="setting_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="setting_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" >';
                    
                    //tempRows += '<option value="-1">Please choose one...</option>';
                    <?php foreach ($activeemailmethods as $emailmethod) { ?>
                    <?php $emailmethod_status_temp = $emailmethod->status === '1' ? '' : 'color:grey;'; ?>
                    tempRows += "<option " + (dragonecommercereservezyx987_validString(objArr[i].value) === "<?php echo $emailmethod->id === null ? 0 : intval($emailmethod->id); ?>" ? 'selected' : '') + " value='<?php echo intval($emailmethod->id); ?>' style='<?php echo esc_html($emailmethod_status_temp); ?>'><?php echo esc_html($emailmethod->name); ?></option>";
                    <?php } ?>        
                    tempRows += '</select>';            
                    
                    tempRows += '<input class="settingedittextbox" style="display:none;" type="button" value="Update" name="settingeditsubmitbutton_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="settingeditsubmitbutton_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" onclick="dragonecommercereservezyx987_submitSettingValue(\'setting_' + dragonecommercereservezyx987_validString(objArr[i].id) + '\', ' + dragonecommercereservezyx987_validString(objArr[i].id) + ',\'EMAIL_METHOD\');" /></td>';                    
                    jQuery('span#dragonecommerce_form_3_5_1_email_method').text(dragonecommercereservezyx987_validString(objArr[i].value));
                            
                } else {
                    tempRows += '<td><span class="settingspan" >' + dragonecommercereservezyx987_validString(objArr[i].value) + '</span><input class="settingedittextbox" style="display:none;" name="setting_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="setting_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" value="' + dragonecommercereservezyx987_validString(objArr[i].value) + '" /><input class="settingedittextbox" style="display:none;" type="button" value="Update" name="settingeditsubmitbutton_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" id="settingeditsubmitbutton_' + dragonecommercereservezyx987_validString(objArr[i].id) + '" onclick="dragonecommercereservezyx987_submitSettingValue(\'setting_' + dragonecommercereservezyx987_validString(objArr[i].id) + '\', ' + dragonecommercereservezyx987_validString(objArr[i].id) + ');" /></td>';
                }
                tempRows += '<td>' + dragonecommercereservezyx987_validString(objArr[i].createtimeutc) + '</td><td>' + (dragonecommercereservezyx987_validString(objArr[i].status) === 1 ? 'ACTIVE' : 'INACTIVE') + '</td></tr>';
            }                                    
            jQuery('tbody#dragonecommerce_setting').html(tempRows);
            var totalsettingquantity = mydata["total"] == null ? '0' : mydata["total"];
            jQuery('span#totalsettingquantity').text(totalsettingquantity);                    
            jQuery('img#admin_settinglist_loader').hide();    
            jQuery(".dragonecommercereservezyx987_datetimepicker").datetimepicker({ format:'Y-m-d H:i:s' });            
            jQuery(".dragonecommercereservezyx987_datetimepicker2").datetimepicker({ datepicker:false, format:'H:i:s' });            
        }).fail(function( jqXHR, textStatus ) {
            //alert( "Request setting list failed: " + textStatus );
        });
    }
    
    jQuery(document).ready(function(){
        jQuery("select.presetto_1").val('-1');        
        jQuery('div#dragonecommerce_tabs').tabs();    
        jQuery('div#dragonecommerce_tabs_1 select').val('14days');
        jQuery("body").append(mediummodalElementContainer);
        jQuery('div#mymediummodal').html('');
        jQuery("body").append(largemodalElementContainer);
        jQuery('div#mylargemodal').html('');
        document.getElementById('mymediummodal').title = '';        
        document.getElementById('mylargemodal').title = '';
        jQuery(".datepicker").val('');
        jQuery(".datepicker").datepicker({ changeMonth:true,changeYear:true,yearRange:"1900:c+10",dateFormat:'yy-mm-dd' });
        jQuery(".dragonecommercereservezyx987_datetimepicker").datetimepicker({ format:'Y-m-d H:i:s' });
        jQuery(".dragonecommercereservezyx987_datetimepicker2").datetimepicker({ datepicker:false, format:'H:i:s' });        
        jQuery("input:text").val('');        
        jQuery("select#dragonecommerce_order_itemsperpage").val(ORDER_ITEMS_PER_PAGE_PRESET_VALUE);
        jQuery("select#dragonecommerce_product_itemsperpage").val(PRODUCT_ITEMS_PER_PAGE_PRESET_VALUE);
        
        jQuery(window).resize(function() {
            jQuery("div#mylargemodal").parent().css("width", jQuery(window).width()).css("height", jQuery(window).height()).css("top", 0);
            jQuery("div#mylargemodal").css("width", jQuery(window).width());
            jQuery("div#mylargemodal").css("overflow", "auto");
            if(jQuery("div#mylargemodal").height() > jQuery(window).height()) {
                jQuery("div#mylargemodal").css("overflow-y", "scroll");
            } else {
                jQuery("div#mylargemodal").css("overflow-y", "auto");
            }
            if(jQuery("div#mylargemodal").width() > jQuery(window).width()) {
                jQuery("div#mylargemodal").css("overflow-x", "scroll");
            } else {
                jQuery("div#mylargemodal").css("overflow-x", "auto");
            }
            
            //jQuery("div#mylargemodal").parent().css("width", jQuery(window).width()).css("height", jQuery(window).height()).css("top", 0);
            //jQuery("div#mylargemodal").css("width", jQuery(window).width());
        });

        dragonecommercereservezyx987_createChart1();
        dragonecommercereservezyx987_createChart2();
        dragonecommercereservezyx987_createChart3();        
        dragonecommercereservezyx987_createChart4();        
        dragonecommercereservezyx987_createChart5();
        
        dragonecommercereservezyx987_getOrdersList();        
        dragonecommercereservezyx987_getProductsList();
        dragonecommercereservezyx987_getDisabledproductsList();
        dragonecommercereservezyx987_getUsersList();
        dragonecommercereservezyx987_getShippingsList();
        dragonecommercereservezyx987_getSettingsList();
        dragonecommercereservezyx987_getHandlingsList();
        dragonecommercereservezyx987_getTaxesList();
        dragonecommercereservezyx987_getDiscountsList();
        dragonecommercereservezyx987_getCouponsList();
        dragonecommercereservezyx987_getPropertyvaluesList();        
        dragonecommercereservezyx987_getDepartmentsList();
        dragonecommercereservezyx987_getGroupcategoriesList();
        dragonecommercereservezyx987_getProcessstatusesList();
        dragonecommercereservezyx987_getGroupsList();
        dragonecommercereservezyx987_getPropertiesList();
        dragonecommercereservezyx987_getGroupPropertiesList();
        dragonecommercereservezyx987_getChargetypesList();
        dragonecommercereservezyx987_getLogsList();
        dragonecommercereservezyx987_getEmailmethodsList();        
        dragonecommercereservezyx987_getCountriesList();
        dragonecommercereservezyx987_getProvincesList();
        dragonecommercereservezyx987_getCitiesList();
        dragonecommercereservezyx987_getCurrenciesList();
        dragonecommercereservezyx987_getDistancesList();
        dragonecommercereservezyx987_getWeightsList();
        dragonecommercereservezyx987_getSlideshowsList();
    
        
        if(jQuery('div.master_pwrapper').length > 0) {
            jQuery('div.master_pwrapper').on( 'click keydown', 'div.master_mypagination.master_mypagination_admin_order > ul.pagination > li:not(.noborder):not(.disabled)', function (event) {
                if(dragonecommercereservezyx987_isClickEnterSpaceEvent(event) === true) {
                    var topagenumber = isNaN(parseInt(jQuery(this).children().first().text())) ? 0 : parseInt(jQuery(this).children().first().text());
                    var currentpage;
                    if(jQuery(this).hasClass('prev')){
                        currentpage = isNaN(parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_order > ul.pagination > li.active > a').first().text())) ? 0 : parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_order > ul.pagination > li.active > a').first().text());
                        topagenumber = Math.max(1, (currentpage-1));
                    } else if (jQuery(this).hasClass('next')){ 
                        currentpage = isNaN(parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_order > ul.pagination > li.active > a').first().text())) ? 0 : parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_order > ul.pagination > li.active > a').first().text());
                        topagenumber = Math.min(totalpagenumber_onload_admin_order, (currentpage+1));
                    }
                    var sortby = jQuery("select#dragonecommerce_order_sortby").val();
                    dragonecommercereservezyx987_showResultOnAjaxReloadedPage('', topagenumber, 'order', sortby);
                }
            });

            jQuery('div.master_pwrapper').on( 'click keydown', 'div.master_mypagination.master_mypagination_admin_orderdetails > ul.pagination > li:not(.noborder):not(.disabled)', function (event) {
                if(dragonecommercereservezyx987_isClickEnterSpaceEvent(event) === true) {
                    var topagenumber = isNaN(parseInt(jQuery(this).children().first().text())) ? 0 : parseInt(jQuery(this).children().first().text());
                    var currentpage;
                    if(jQuery(this).hasClass('prev')){
                        currentpage = isNaN(parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_orderdetails > ul.pagination > li.active > a').first().text())) ? 0 : parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_orderdetails > ul.pagination > li.active > a').first().text());
                        topagenumber = Math.max(1, (currentpage-1));
                    } else if (jQuery(this).hasClass('next')){ 
                        currentpage = isNaN(parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_orderdetails > ul.pagination > li.active > a').first().text())) ? 0 : parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_orderdetails > ul.pagination > li.active > a').first().text());
                        topagenumber = Math.min(totalpagenumber_onload_admin_orderdetails, (currentpage+1));
                    }
                    var sortby = jQuery("select#dragonecommerce_orderdetails_sortby").val();
                    dragonecommercereservezyx987_showResultOnAjaxReloadedPage('', topagenumber, 'orderdetails', sortby);
                }
            });
            
            jQuery('div.master_pwrapper').on( 'click keydown', 'div.master_mypagination.master_mypagination_admin_product > ul.pagination > li:not(.noborder):not(.disabled)', function (event) {
                if(dragonecommercereservezyx987_isClickEnterSpaceEvent(event) === true) {
                    var topagenumber = isNaN(parseInt(jQuery(this).children().first().text())) ? 0 : parseInt(jQuery(this).children().first().text());
                    var currentpage2;
                    if(jQuery(this).hasClass('prev')){
                        currentpage2 = isNaN(parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_product > ul.pagination > li.active > a').first().text())) ? 0 : parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_product > ul.pagination > li.active > a').first().text());
                        topagenumber = Math.max(1, (currentpage2-1));
                    } else if (jQuery(this).hasClass('next')){ 
                        currentpage2 = isNaN(parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_product > ul.pagination > li.active > a').first().text())) ? 0 : parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_product > ul.pagination > li.active > a').first().text());
                        topagenumber = Math.min(totalpagenumber_onload_admin_product, (currentpage2+1));
                    }
                    var sortby = jQuery("select#dragonecommerce_product_sortby").val();
                    dragonecommercereservezyx987_showResultOnAjaxReloadedPage('', topagenumber, 'product', sortby);
                }
            });

            jQuery('div.master_pwrapper').on( 'click keydown', 'div.master_mypagination.master_mypagination_admin_productdetails > ul.pagination > li:not(.noborder):not(.disabled)', function (event) {
                if(dragonecommercereservezyx987_isClickEnterSpaceEvent(event) === true) {
                    var topagenumber = isNaN(parseInt(jQuery(this).children().first().text())) ? 0 : parseInt(jQuery(this).children().first().text());
                    var currentpage2;
                    if(jQuery(this).hasClass('prev')){
                        currentpage2 = isNaN(parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_productdetails > ul.pagination > li.active > a').first().text())) ? 0 : parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_productdetails > ul.pagination > li.active > a').first().text());
                        topagenumber = Math.max(1, (currentpage2-1));
                    } else if (jQuery(this).hasClass('next')){ 
                        currentpage2 = isNaN(parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_productdetails > ul.pagination > li.active > a').first().text())) ? 0 : parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_productdetails > ul.pagination > li.active > a').first().text());
                        topagenumber = Math.min(totalpagenumber_onload_admin_productdetails, (currentpage2+1));
                    }
                    var sortby = jQuery("select#dragonecommerce_productdetails_sortby").val();
                    dragonecommercereservezyx987_showResultOnAjaxReloadedPage('', topagenumber, 'productdetails', sortby);
                }
            });
            
            jQuery('div.master_pwrapper').on( 'click keydown', 'div.master_mypagination.master_mypagination_admin_disabledproduct > ul.pagination > li:not(.noborder):not(.disabled)', function (event) {
                if(dragonecommercereservezyx987_isClickEnterSpaceEvent(event) === true) {
                    var topagenumber = isNaN(parseInt(jQuery(this).children().first().text())) ? 0 : parseInt(jQuery(this).children().first().text());
                    var currentpage2;
                    if(jQuery(this).hasClass('prev')){
                        currentpage2 = isNaN(parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_disabledproduct > ul.pagination > li.active > a').first().text())) ? 0 : parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_disabledproduct > ul.pagination > li.active > a').first().text());
                        topagenumber = Math.max(1, (currentpage2-1));
                    } else if (jQuery(this).hasClass('next')){ 
                        currentpage2 = isNaN(parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_disabledproduct > ul.pagination > li.active > a').first().text())) ? 0 : parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_disabledproduct > ul.pagination > li.active > a').first().text());
                        topagenumber = Math.min(totalpagenumber_onload_admin_disabledproduct, (currentpage2+1));
                    }
                    var sortby = jQuery("select#dragonecommerce_disabledproduct_sortby").val();
                    dragonecommercereservezyx987_showResultOnAjaxReloadedPage('', topagenumber, 'disabledproduct', sortby);
                }
            });
            
            jQuery('div.master_pwrapper').on( 'click keydown', 'div.master_mypagination.master_mypagination_admin_user > ul.pagination > li:not(.noborder):not(.disabled)', function (event) {
                if(dragonecommercereservezyx987_isClickEnterSpaceEvent(event) === true) {
                    var topagenumber = isNaN(parseInt(jQuery(this).children().first().text())) ? 0 : parseInt(jQuery(this).children().first().text());
                    var currentpage2;
                    if(jQuery(this).hasClass('prev')){
                        currentpage2 = isNaN(parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_user > ul.pagination > li.active > a').first().text())) ? 0 : parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_user > ul.pagination > li.active > a').first().text());
                        topagenumber = Math.max(1, (currentpage2-1));
                    } else if (jQuery(this).hasClass('next')){ 
                        currentpage2 = isNaN(parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_user > ul.pagination > li.active > a').first().text())) ? 0 : parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_user > ul.pagination > li.active > a').first().text());
                        topagenumber = Math.min(totalpagenumber_onload_admin_user, (currentpage2+1));
                    }
                    var sortby = jQuery("select#dragonecommerce_user_sortby").val();
                    dragonecommercereservezyx987_showResultOnAjaxReloadedPage('', topagenumber, 'user', sortby);
                }
            });

            jQuery('div.master_pwrapper').on( 'click keydown', 'div.master_mypagination.master_mypagination_admin_country > ul.pagination > li:not(.noborder):not(.disabled)', function (event) {
                if(dragonecommercereservezyx987_isClickEnterSpaceEvent(event) === true) {
                    var topagenumber = isNaN(parseInt(jQuery(this).children().first().text())) ? 0 : parseInt(jQuery(this).children().first().text());
                    var currentpage2;
                    if(jQuery(this).hasClass('prev')){
                        currentpage2 = isNaN(parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_country > ul.pagination > li.active > a').first().text())) ? 0 : parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_country > ul.pagination > li.active > a').first().text());
                        topagenumber = Math.max(1, (currentpage2-1));
                    } else if (jQuery(this).hasClass('next')){ 
                        currentpage2 = isNaN(parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_country > ul.pagination > li.active > a').first().text())) ? 0 : parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_country > ul.pagination > li.active > a').first().text());
                        topagenumber = Math.min(totalpagenumber_onload_admin_country, (currentpage2+1));
                    }
                    var sortby = jQuery("select#dragonecommerce_country_sortby").val();
                    dragonecommercereservezyx987_showResultOnAjaxReloadedPage('', topagenumber, 'country', sortby);
                }
            });

            jQuery('div.master_pwrapper').on( 'click keydown', 'div.master_mypagination.master_mypagination_admin_province > ul.pagination > li:not(.noborder):not(.disabled)', function (event) {
                if(dragonecommercereservezyx987_isClickEnterSpaceEvent(event) === true) {
                    var topagenumber = isNaN(parseInt(jQuery(this).children().first().text())) ? 0 : parseInt(jQuery(this).children().first().text());
                    var currentpage2;
                    if(jQuery(this).hasClass('prev')){
                        currentpage2 = isNaN(parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_province > ul.pagination > li.active > a').first().text())) ? 0 : parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_province > ul.pagination > li.active > a').first().text());
                        topagenumber = Math.max(1, (currentpage2-1));
                    } else if (jQuery(this).hasClass('next')){ 
                        currentpage2 = isNaN(parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_province > ul.pagination > li.active > a').first().text())) ? 0 : parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_province > ul.pagination > li.active > a').first().text());
                        topagenumber = Math.min(totalpagenumber_onload_admin_province, (currentpage2+1));
                    }
                    var sortby = jQuery("select#dragonecommerce_province_sortby").val();
                    dragonecommercereservezyx987_showResultOnAjaxReloadedPage('', topagenumber, 'province', sortby);
                }
            });

            jQuery('div.master_pwrapper').on( 'click keydown', 'div.master_mypagination.master_mypagination_admin_department > ul.pagination > li:not(.noborder):not(.disabled)', function (event) {
                if(dragonecommercereservezyx987_isClickEnterSpaceEvent(event) === true) {
                    var topagenumber = isNaN(parseInt(jQuery(this).children().first().text())) ? 0 : parseInt(jQuery(this).children().first().text());
                    var currentpage2;
                    if(jQuery(this).hasClass('prev')){
                        currentpage2 = isNaN(parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_department > ul.pagination > li.active > a').first().text())) ? 0 : parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_department > ul.pagination > li.active > a').first().text());
                        topagenumber = Math.max(1, (currentpage2-1));
                    } else if (jQuery(this).hasClass('next')){ 
                        currentpage2 = isNaN(parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_department > ul.pagination > li.active > a').first().text())) ? 0 : parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_department > ul.pagination > li.active > a').first().text());
                        topagenumber = Math.min(totalpagenumber_onload_admin_department, (currentpage2+1));
                    }
                    var sortby = jQuery("select#dragonecommerce_department_sortby").val();
                    dragonecommercereservezyx987_showResultOnAjaxReloadedPage('', topagenumber, 'department', sortby);
                }
            });

            jQuery('div.master_pwrapper').on( 'click keydown', 'div.master_mypagination.master_mypagination_admin_groupcategory > ul.pagination > li:not(.noborder):not(.disabled)', function (event) {
                if(dragonecommercereservezyx987_isClickEnterSpaceEvent(event) === true) {
                    var topagenumber = isNaN(parseInt(jQuery(this).children().first().text())) ? 0 : parseInt(jQuery(this).children().first().text());
                    var currentpage2;
                    if(jQuery(this).hasClass('prev')){
                        currentpage2 = isNaN(parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_groupcategory > ul.pagination > li.active > a').first().text())) ? 0 : parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_groupcategory > ul.pagination > li.active > a').first().text());
                        topagenumber = Math.max(1, (currentpage2-1));
                    } else if (jQuery(this).hasClass('next')){ 
                        currentpage2 = isNaN(parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_groupcategory > ul.pagination > li.active > a').first().text())) ? 0 : parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_groupcategory > ul.pagination > li.active > a').first().text());
                        topagenumber = Math.min(totalpagenumber_onload_admin_groupcategory, (currentpage2+1));
                    }
                    var sortby = jQuery("select#dragonecommerce_groupcategory_sortby").val();
                    dragonecommercereservezyx987_showResultOnAjaxReloadedPage('', topagenumber, 'groupcategory', sortby);
                }
            });

            jQuery('div.master_pwrapper').on( 'click keydown', 'div.master_mypagination.master_mypagination_admin_processstatus > ul.pagination > li:not(.noborder):not(.disabled)', function (event) {
                if(dragonecommercereservezyx987_isClickEnterSpaceEvent(event) === true) {
                    var topagenumber = isNaN(parseInt(jQuery(this).children().first().text())) ? 0 : parseInt(jQuery(this).children().first().text());
                    var currentpage2;
                    if(jQuery(this).hasClass('prev')){
                        currentpage2 = isNaN(parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_processstatus > ul.pagination > li.active > a').first().text())) ? 0 : parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_processstatus > ul.pagination > li.active > a').first().text());
                        topagenumber = Math.max(1, (currentpage2-1));
                    } else if (jQuery(this).hasClass('next')){ 
                        currentpage2 = isNaN(parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_processstatus > ul.pagination > li.active > a').first().text())) ? 0 : parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_processstatus > ul.pagination > li.active > a').first().text());
                        topagenumber = Math.min(totalpagenumber_onload_admin_processstatus, (currentpage2+1));
                    }
                    var sortby = jQuery("select#dragonecommerce_processstatus_sortby").val();
                    dragonecommercereservezyx987_showResultOnAjaxReloadedPage('', topagenumber, 'processstatus', sortby);
                }
            });

            jQuery('div.master_pwrapper').on( 'click keydown', 'div.master_mypagination.master_mypagination_admin_group > ul.pagination > li:not(.noborder):not(.disabled)', function (event) {
                if(dragonecommercereservezyx987_isClickEnterSpaceEvent(event) === true) {
                    var topagenumber = isNaN(parseInt(jQuery(this).children().first().text())) ? 0 : parseInt(jQuery(this).children().first().text());
                    var currentpage2;
                    if(jQuery(this).hasClass('prev')){
                        currentpage2 = isNaN(parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_group > ul.pagination > li.active > a').first().text())) ? 0 : parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_group > ul.pagination > li.active > a').first().text());
                        topagenumber = Math.max(1, (currentpage2-1));
                    } else if (jQuery(this).hasClass('next')){ 
                        currentpage2 = isNaN(parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_group > ul.pagination > li.active > a').first().text())) ? 0 : parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_group > ul.pagination > li.active > a').first().text());
                        topagenumber = Math.min(totalpagenumber_onload_admin_group, (currentpage2+1));
                    }
                    var sortby = jQuery("select#dragonecommerce_group_sortby").val();
                    dragonecommercereservezyx987_showResultOnAjaxReloadedPage('', topagenumber, 'group', sortby);
                }
            });

            jQuery('div.master_pwrapper').on( 'click keydown', 'div.master_mypagination.master_mypagination_admin_chargetype > ul.pagination > li:not(.noborder):not(.disabled)', function (event) {
                if(dragonecommercereservezyx987_isClickEnterSpaceEvent(event) === true) {
                    var topagenumber = isNaN(parseInt(jQuery(this).children().first().text())) ? 0 : parseInt(jQuery(this).children().first().text());
                    var currentpage2;
                    if(jQuery(this).hasClass('prev')){
                        currentpage2 = isNaN(parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_chargetype > ul.pagination > li.active > a').first().text())) ? 0 : parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_chargetype > ul.pagination > li.active > a').first().text());
                        topagenumber = Math.max(1, (currentpage2-1));
                    } else if (jQuery(this).hasClass('next')){ 
                        currentpage2 = isNaN(parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_chargetype > ul.pagination > li.active > a').first().text())) ? 0 : parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_chargetype > ul.pagination > li.active > a').first().text());
                        topagenumber = Math.min(totalpagenumber_onload_admin_chargetype, (currentpage2+1));
                    }
                    var sortby = jQuery("select#dragonecommerce_chargetype_sortby").val();
                    dragonecommercereservezyx987_showResultOnAjaxReloadedPage('', topagenumber, 'chargetype', sortby);
                }
            });

            jQuery('div.master_pwrapper').on( 'click keydown', 'div.master_mypagination.master_mypagination_admin_log > ul.pagination > li:not(.noborder):not(.disabled)', function (event) {
                if(dragonecommercereservezyx987_isClickEnterSpaceEvent(event) === true) {
                    var topagenumber = isNaN(parseInt(jQuery(this).children().first().text())) ? 0 : parseInt(jQuery(this).children().first().text());
                    var currentpage2;
                    if(jQuery(this).hasClass('prev')){
                        currentpage2 = isNaN(parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_log > ul.pagination > li.active > a').first().text())) ? 0 : parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_log > ul.pagination > li.active > a').first().text());
                        topagenumber = Math.max(1, (currentpage2-1));
                    } else if (jQuery(this).hasClass('next')){ 
                        currentpage2 = isNaN(parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_log > ul.pagination > li.active > a').first().text())) ? 0 : parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_log > ul.pagination > li.active > a').first().text());
                        topagenumber = Math.min(totalpagenumber_onload_admin_log, (currentpage2+1));
                    }
                    var sortby = jQuery("select#dragonecommerce_log_sortby").val();
                    dragonecommercereservezyx987_showResultOnAjaxReloadedPage('', topagenumber, 'log', sortby);
                }
            });        

            jQuery('div.master_pwrapper').on( 'click keydown', 'div.master_mypagination.master_mypagination_admin_slideshow > ul.pagination > li:not(.noborder):not(.disabled)', function (event) {
                if(dragonecommercereservezyx987_isClickEnterSpaceEvent(event) === true) {
                    var topagenumber = isNaN(parseInt(jQuery(this).children().first().text())) ? 0 : parseInt(jQuery(this).children().first().text());
                    var currentpage2;
                    if(jQuery(this).hasClass('prev')){
                        currentpage2 = isNaN(parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_slideshow > ul.pagination > li.active > a').first().text())) ? 0 : parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_slideshow > ul.pagination > li.active > a').first().text());
                        topagenumber = Math.max(1, (currentpage2-1));
                    } else if (jQuery(this).hasClass('next')){ 
                        currentpage2 = isNaN(parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_slideshow > ul.pagination > li.active > a').first().text())) ? 0 : parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_slideshow > ul.pagination > li.active > a').first().text());
                        topagenumber = Math.min(totalpagenumber_onload_admin_slideshow, (currentpage2+1));
                    }
                    var sortby = jQuery("select#dragonecommerce_slideshow_sortby").val();
                    dragonecommercereservezyx987_showResultOnAjaxReloadedPage('', topagenumber, 'slideshow', sortby);
                }
            });            

            jQuery('div.master_pwrapper').on( 'click keydown', 'div.master_mypagination.master_mypagination_admin_discount > ul.pagination > li:not(.noborder):not(.disabled)', function (event) {
                if(dragonecommercereservezyx987_isClickEnterSpaceEvent(event) === true) {
                    var topagenumber = isNaN(parseInt(jQuery(this).children().first().text())) ? 0 : parseInt(jQuery(this).children().first().text());
                    var currentpage2;
                    if(jQuery(this).hasClass('prev')){
                        currentpage2 = isNaN(parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_discount > ul.pagination > li.active > a').first().text())) ? 0 : parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_discount > ul.pagination > li.active > a').first().text());
                        topagenumber = Math.max(1, (currentpage2-1));
                    } else if (jQuery(this).hasClass('next')){ 
                        currentpage2 = isNaN(parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_discount > ul.pagination > li.active > a').first().text())) ? 0 : parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_discount > ul.pagination > li.active > a').first().text());
                        topagenumber = Math.min(totalpagenumber_onload_admin_discount, (currentpage2+1));
                    }
                    var sortby = jQuery("select#dragonecommerce_discount_sortby").val();
                    dragonecommercereservezyx987_showResultOnAjaxReloadedPage('', topagenumber, 'discount', sortby);
                }
            });

            jQuery('div.master_pwrapper').on( 'click keydown', 'div.master_mypagination.master_mypagination_admin_coupon > ul.pagination > li:not(.noborder):not(.disabled)', function (event) {
                if(dragonecommercereservezyx987_isClickEnterSpaceEvent(event) === true) {
                    var topagenumber = isNaN(parseInt(jQuery(this).children().first().text())) ? 0 : parseInt(jQuery(this).children().first().text());
                    var currentpage2;
                    if(jQuery(this).hasClass('prev')){
                        currentpage2 = isNaN(parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_coupon > ul.pagination > li.active > a').first().text())) ? 0 : parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_coupon > ul.pagination > li.active > a').first().text());
                        topagenumber = Math.max(1, (currentpage2-1));
                    } else if (jQuery(this).hasClass('next')){ 
                        currentpage2 = isNaN(parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_coupon > ul.pagination > li.active > a').first().text())) ? 0 : parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_coupon > ul.pagination > li.active > a').first().text());
                        topagenumber = Math.min(totalpagenumber_onload_admin_coupon, (currentpage2+1));
                    }
                    var sortby = jQuery("select#dragonecommerce_coupon_sortby").val();
                    dragonecommercereservezyx987_showResultOnAjaxReloadedPage('', topagenumber, 'coupon', sortby);
                }
            });

            jQuery('div.master_pwrapper').on( 'click keydown', 'div.master_mypagination.master_mypagination_admin_propertyvalue > ul.pagination > li:not(.noborder):not(.disabled)', function (event) {
                if(dragonecommercereservezyx987_isClickEnterSpaceEvent(event) === true) {
                    var topagenumber = isNaN(parseInt(jQuery(this).children().first().text())) ? 0 : parseInt(jQuery(this).children().first().text());
                    var currentpage2;
                    if(jQuery(this).hasClass('prev')){
                        currentpage2 = isNaN(parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_propertyvalue > ul.pagination > li.active > a').first().text())) ? 0 : parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_propertyvalue > ul.pagination > li.active > a').first().text());
                        topagenumber = Math.max(1, (currentpage2-1));
                    } else if (jQuery(this).hasClass('next')){ 
                        currentpage2 = isNaN(parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_propertyvalue > ul.pagination > li.active > a').first().text())) ? 0 : parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_propertyvalue > ul.pagination > li.active > a').first().text());
                        topagenumber = Math.min(totalpagenumber_onload_admin_propertyvalue, (currentpage2+1));
                    }
                    var sortby = jQuery("select#dragonecommerce_propertyvalue_sortby").val();
                    dragonecommercereservezyx987_showResultOnAjaxReloadedPage('', topagenumber, 'propertyvalue', sortby);
                }
            });

            jQuery('div.master_pwrapper').on( 'click keydown', 'div.master_mypagination.master_mypagination_admin_handling > ul.pagination > li:not(.noborder):not(.disabled)', function (event) {
                if(dragonecommercereservezyx987_isClickEnterSpaceEvent(event) === true) {
                    var topagenumber = isNaN(parseInt(jQuery(this).children().first().text())) ? 0 : parseInt(jQuery(this).children().first().text());
                    var currentpage2;
                    if(jQuery(this).hasClass('prev')){
                        currentpage2 = isNaN(parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_handling > ul.pagination > li.active > a').first().text())) ? 0 : parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_handling > ul.pagination > li.active > a').first().text());
                        topagenumber = Math.max(1, (currentpage2-1));
                    } else if (jQuery(this).hasClass('next')){ 
                        currentpage2 = isNaN(parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_handling > ul.pagination > li.active > a').first().text())) ? 0 : parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_handling > ul.pagination > li.active > a').first().text());
                        topagenumber = Math.min(totalpagenumber_onload_admin_handling, (currentpage2+1));
                    }
                    var sortby = jQuery("select#dragonecommerce_handling_sortby").val();
                    dragonecommercereservezyx987_showResultOnAjaxReloadedPage('', topagenumber, 'handling', sortby);
                }
            });

            jQuery('div.master_pwrapper').on( 'click keydown', 'div.master_mypagination.master_mypagination_admin_shipping > ul.pagination > li:not(.noborder):not(.disabled)', function (event) {
                if(dragonecommercereservezyx987_isClickEnterSpaceEvent(event) === true) {
                    var topagenumber = isNaN(parseInt(jQuery(this).children().first().text())) ? 0 : parseInt(jQuery(this).children().first().text());
                    var currentpage2;
                    if(jQuery(this).hasClass('prev')){
                        currentpage2 = isNaN(parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_shipping > ul.pagination > li.active > a').first().text())) ? 0 : parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_shipping > ul.pagination > li.active > a').first().text());
                        topagenumber = Math.max(1, (currentpage2-1));
                    } else if (jQuery(this).hasClass('next')){ 
                        currentpage2 = isNaN(parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_shipping > ul.pagination > li.active > a').first().text())) ? 0 : parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_shipping > ul.pagination > li.active > a').first().text());
                        topagenumber = Math.min(totalpagenumber_onload_admin_shipping, (currentpage2+1));
                    }
                    var sortby = jQuery("select#dragonecommerce_shipping_sortby").val();
                    dragonecommercereservezyx987_showResultOnAjaxReloadedPage('', topagenumber, 'shipping', sortby);
                }
            });

            jQuery('div.master_pwrapper').on( 'click keydown', 'div.master_mypagination.master_mypagination_admin_tax > ul.pagination > li:not(.noborder):not(.disabled)', function (event) {
                if(dragonecommercereservezyx987_isClickEnterSpaceEvent(event) === true) {
                    var topagenumber = isNaN(parseInt(jQuery(this).children().first().text())) ? 0 : parseInt(jQuery(this).children().first().text());
                    var currentpage2;
                    if(jQuery(this).hasClass('prev')){
                        currentpage2 = isNaN(parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_tax > ul.pagination > li.active > a').first().text())) ? 0 : parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_tax > ul.pagination > li.active > a').first().text());
                        topagenumber = Math.max(1, (currentpage2-1));
                    } else if (jQuery(this).hasClass('next')){ 
                        currentpage2 = isNaN(parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_tax > ul.pagination > li.active > a').first().text())) ? 0 : parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_tax > ul.pagination > li.active > a').first().text());
                        topagenumber = Math.min(totalpagenumber_onload_admin_tax, (currentpage2+1));
                    }
                    var sortby = jQuery("select#dragonecommerce_tax_sortby").val();
                    dragonecommercereservezyx987_showResultOnAjaxReloadedPage('', topagenumber, 'tax', sortby);
                }
            });

            jQuery('div.master_pwrapper').on( 'click keydown', 'div.master_mypagination.master_mypagination_admin_property > ul.pagination > li:not(.noborder):not(.disabled)', function (event) {
                if(dragonecommercereservezyx987_isClickEnterSpaceEvent(event) === true) {
                    var topagenumber = isNaN(parseInt(jQuery(this).children().first().text())) ? 0 : parseInt(jQuery(this).children().first().text());
                    var currentpage2;
                    if(jQuery(this).hasClass('prev')){
                        currentpage2 = isNaN(parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_property > ul.pagination > li.active > a').first().text())) ? 0 : parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_property > ul.pagination > li.active > a').first().text());
                        topagenumber = Math.max(1, (currentpage2-1));
                    } else if (jQuery(this).hasClass('next')){ 
                        currentpage2 = isNaN(parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_property > ul.pagination > li.active > a').first().text())) ? 0 : parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_property > ul.pagination > li.active > a').first().text());
                        topagenumber = Math.min(totalpagenumber_onload_admin_property, (currentpage2+1));
                    }
                    var sortby = jQuery("select#dragonecommerce_property_sortby").val();
                    dragonecommercereservezyx987_showResultOnAjaxReloadedPage('', topagenumber, 'property', sortby);
                }
            });    

            jQuery('div.master_pwrapper').on( 'click keydown', 'div.master_mypagination.master_mypagination_admin_currency > ul.pagination > li:not(.noborder):not(.disabled)', function (event) {
                if(dragonecommercereservezyx987_isClickEnterSpaceEvent(event) === true) {
                    var topagenumber = isNaN(parseInt(jQuery(this).children().first().text())) ? 0 : parseInt(jQuery(this).children().first().text());
                    var currentpage2;
                    if(jQuery(this).hasClass('prev')){
                        currentpage2 = isNaN(parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_currency > ul.pagination > li.active > a').first().text())) ? 0 : parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_currency > ul.pagination > li.active > a').first().text());
                        topagenumber = Math.max(1, (currentpage2-1));
                    } else if (jQuery(this).hasClass('next')){ 
                        currentpage2 = isNaN(parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_currency > ul.pagination > li.active > a').first().text())) ? 0 : parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_currency > ul.pagination > li.active > a').first().text());
                        topagenumber = Math.min(totalpagenumber_onload_admin_currency, (currentpage2+1));
                    }
                    var sortby = jQuery("select#dragonecommerce_currency_sortby").val();
                    dragonecommercereservezyx987_showResultOnAjaxReloadedPage('', topagenumber, 'currency', sortby);
                }
            });

            jQuery('div.master_pwrapper').on( 'click keydown', 'div.master_mypagination.master_mypagination_admin_city > ul.pagination > li:not(.noborder):not(.disabled)', function (event) {
                if(dragonecommercereservezyx987_isClickEnterSpaceEvent(event) === true) {
                    var topagenumber = isNaN(parseInt(jQuery(this).children().first().text())) ? 0 : parseInt(jQuery(this).children().first().text());
                    var currentpage2;
                    if(jQuery(this).hasClass('prev')){
                        currentpage2 = isNaN(parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_city > ul.pagination > li.active > a').first().text())) ? 0 : parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_city > ul.pagination > li.active > a').first().text());
                        topagenumber = Math.max(1, (currentpage2-1));
                    } else if (jQuery(this).hasClass('next')){ 
                        currentpage2 = isNaN(parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_city > ul.pagination > li.active > a').first().text())) ? 0 : parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_city > ul.pagination > li.active > a').first().text());
                        topagenumber = Math.min(totalpagenumber_onload_admin_city, (currentpage2+1));
                    }
                    var sortby = jQuery("select#dragonecommerce_city_sortby").val();
                    dragonecommercereservezyx987_showResultOnAjaxReloadedPage('', topagenumber, 'city', sortby);
                }
            });
            
            jQuery('div.master_pwrapper').on( 'click keydown', 'div.master_mypagination.master_mypagination_admin_emailmethod > ul.pagination > li:not(.noborder):not(.disabled)', function (event) {
                if(dragonecommercereservezyx987_isClickEnterSpaceEvent(event) === true) {
                    var topagenumber = isNaN(parseInt(jQuery(this).children().first().text())) ? 0 : parseInt(jQuery(this).children().first().text());
                    var currentpage2;
                    if(jQuery(this).hasClass('prev')){
                        currentpage2 = isNaN(parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_emailmethod > ul.pagination > li.active > a').first().text())) ? 0 : parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_emailmethod > ul.pagination > li.active > a').first().text());
                        topagenumber = Math.max(1, (currentpage2-1));
                    } else if (jQuery(this).hasClass('next')){ 
                        currentpage2 = isNaN(parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_emailmethod > ul.pagination > li.active > a').first().text())) ? 0 : parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_emailmethod > ul.pagination > li.active > a').first().text());
                        topagenumber = Math.min(totalpagenumber_onload_admin_emailmethod, (currentpage2+1));
                    }
                    var sortby = jQuery("select#dragonecommerce_emailmethod_sortby").val();
                    dragonecommercereservezyx987_showResultOnAjaxReloadedPage('', topagenumber, 'emailmethod', sortby);
                }
            });    
            
            jQuery('div.master_pwrapper').on( 'click keydown', 'div.master_mypagination.master_mypagination_admin_distance > ul.pagination > li:not(.noborder):not(.disabled)', function (event) {
                if(dragonecommercereservezyx987_isClickEnterSpaceEvent(event) === true) {
                    var topagenumber = isNaN(parseInt(jQuery(this).children().first().text())) ? 0 : parseInt(jQuery(this).children().first().text());
                    var currentpage2;
                    if(jQuery(this).hasClass('prev')){
                        currentpage2 = isNaN(parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_distance > ul.pagination > li.active > a').first().text())) ? 0 : parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_distance > ul.pagination > li.active > a').first().text());
                        topagenumber = Math.max(1, (currentpage2-1));
                    } else if (jQuery(this).hasClass('next')){ 
                        currentpage2 = isNaN(parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_distance > ul.pagination > li.active > a').first().text())) ? 0 : parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_distance > ul.pagination > li.active > a').first().text());
                        topagenumber = Math.min(totalpagenumber_onload_admin_distance, (currentpage2+1));
                    }
                    var sortby = jQuery("select#dragonecommerce_distance_sortby").val();
                    dragonecommercereservezyx987_showResultOnAjaxReloadedPage('', topagenumber, 'distance', sortby);
                }
            });    
            
            jQuery('div.master_pwrapper').on( 'click keydown', 'div.master_mypagination.master_mypagination_admin_paymentmethod > ul.pagination > li:not(.noborder):not(.disabled)', function (event) {
                if(dragonecommercereservezyx987_isClickEnterSpaceEvent(event) === true) {
                    var topagenumber = isNaN(parseInt(jQuery(this).children().first().text())) ? 0 : parseInt(jQuery(this).children().first().text());
                    var currentpage2;
                    if(jQuery(this).hasClass('prev')){
                        currentpage2 = isNaN(parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_paymentmethod > ul.pagination > li.active > a').first().text())) ? 0 : parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_paymentmethod > ul.pagination > li.active > a').first().text());
                        topagenumber = Math.max(1, (currentpage2-1));
                    } else if (jQuery(this).hasClass('next')){ 
                        currentpage2 = isNaN(parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_paymentmethod > ul.pagination > li.active > a').first().text())) ? 0 : parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_paymentmethod > ul.pagination > li.active > a').first().text());
                        topagenumber = Math.min(totalpagenumber_onload_admin_paymentmethod, (currentpage2+1));
                    }
                    var sortby = jQuery("select#dragonecommerce_paymentmethod_sortby").val();
                    dragonecommercereservezyx987_showResultOnAjaxReloadedPage('', topagenumber, 'paymentmethod', sortby);
                }
            });        

            jQuery('div.master_pwrapper').on( 'click keydown', 'div.master_mypagination.master_mypagination_admin_groupproperty > ul.pagination > li:not(.noborder):not(.disabled)', function (event) {
                if(dragonecommercereservezyx987_isClickEnterSpaceEvent(event) === true) {
                    var topagenumber = isNaN(parseInt(jQuery(this).children().first().text())) ? 0 : parseInt(jQuery(this).children().first().text());
                    var currentpage2;
                    if(jQuery(this).hasClass('prev')){
                        currentpage2 = isNaN(parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_groupproperty > ul.pagination > li.active > a').first().text())) ? 0 : parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_groupproperty > ul.pagination > li.active > a').first().text());
                        topagenumber = Math.max(1, (currentpage2-1));
                    } else if (jQuery(this).hasClass('next')){ 
                        currentpage2 = isNaN(parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_groupproperty > ul.pagination > li.active > a').first().text())) ? 0 : parseInt(jQuery('div.master_pwrapper > div.master_mypagination.master_mypagination_admin_groupproperty > ul.pagination > li.active > a').first().text());
                        topagenumber = Math.min(totalpagenumber_onload_admin_groupproperty, (currentpage2+1));
                    }
                    var sortby = jQuery("select#dragonecommerce_groupproperty_sortby").val();
                    dragonecommercereservezyx987_showResultOnAjaxReloadedPage('', topagenumber, 'groupproperty', sortby);
                }
            });            
        }        
    }); //end of jQuery(document).ready
    
    function dragonecommercereservezyx987_editProduct(productid) {
        jQuery('div#mylargemodal').html('');
        jQuery.ajax({
            type: "POST",
            url: ajaxurl,
            data: {dragonecommercereservezyx987_hidden_security_getoneproductadmin:"<?php echo wp_create_nonce('dragonecommercereservezyx987_getoneproductadmin'); ?>",dragonecommercereservezyx987_hidden:"Y",action:"dragonecommercereservezyx987_getoneproductadmin", id:productid}
        }).done(function (mydata) {
            var productObj = mydata["productdetails1"][0];
            var locationsArr_temp = productObj["locations"] === null? [] : productObj["locations"].split(","), locationsArr = [], i, j;
            for (i = 0; i < locationsArr_temp.length; i++) {
               var temp = locationsArr_temp[i].split("|");
               locationsArr.push(temp);
            }
            
            var modalElement = '<div class="modal-dialog modal-fullscreen"><div class="modal-content" style="height:100% !important;">';                                
            modalElement += '<div class="modal-header" style="padding:15px 65px;">';
            modalElement += '<h5 class="modal-title" >' + 'Edit Product ' + productid + ": " + productObj["name"] + '</h5>';
            modalElement += '<button type="button" aria-label="close the pop up window" class="btn-close" tabindex="0" data-bs-dismiss="modal"></button>';
            modalElement += '</div>';
            
            modalElement += '<div class="modal-body">';            
            modalElement += '<div id="dragonecommerce_editproduct_container" class="row" style="padding-left: 25px;" >';
            
            modalElement += '<div class="editproduct_container col-12 col-sm-12 col-md-12 col-lg-12"><div class="row-container"><div class="editproduct-details-container row">';
            modalElement += "<div class='editproduct_content col-12 col-sm-12 col-md-12 col-lg-12'>";

            modalElement += '<div class="editproduct_form_container"><br/>';
                        
            modalElement += '<form name="dragonecommerce_form_updateproduct" method="post" action="' + <?php echo "'". str_replace( '%7E', '~', esc_html($_SERVER['REQUEST_URI'])) . "'"; ?> + '" enctype="multipart/form-data">' + 
            '<p><?php _e("Name *: " ); ?><input type="text" name="dragonecommercereservezyx987_editproductname" value="' + productObj["name"].replace(/"/g, '&#34;') + '" size="100"><?php _e(" e.g. Camera" ); ?></p>' + 
            '<p><?php _e("Price *: " ); ?><input type="text" name="dragonecommercereservezyx987_editproductprice" value="' + productObj["price"] + '" size="100"><?php _e(" e.g. 32.50" ); ?></p>' + 
            
            '<p><?php _e("Sale Price : " ); ?><input type="text" name="dragonecommercereservezyx987_editproductsaleprice" value="' + dragonecommercereservezyx987_validString(productObj["saleprice"]) + '" size="100"><?php _e(" e.g. 16.50" ); ?></p>' + 

            '<p><?php _e("Is On Sale? : " ); ?><select id="dragonecommercereservezyx987_editproductisonsale" name="dragonecommercereservezyx987_editproductisonsale">' + 
               '<option value="-1">Please select one...</option>' + 
               '<option value="1" ' + (dragonecommercereservezyx987_validString(productObj["isonsale"]) === 1 ? 'selected' : '') + '>Yes</option>' + 
               '<option value="0" ' + (dragonecommercereservezyx987_validString(productObj["isonsale"]) === 0 ? 'selected' : '') + '>No</option>' + 
            '</select></p>' +
            '<p><?php _e("Is Tax Free? : " ); ?><select id="dragonecommercereservezyx987_editproductistaxfree" name="dragonecommercereservezyx987_editproductistaxfree">' + 
               '<option value="-1">Please select one...</option>' + 
               '<option value="1" ' + (dragonecommercereservezyx987_validString(productObj["istaxfree"]) === 1 ? 'selected' : '') + '>Yes</option>' + 
               '<option value="0" ' + (dragonecommercereservezyx987_validString(productObj["istaxfree"]) === 0 ? 'selected' : '') + '>No</option>' + 
            '</select></p>' + 
            '<p><?php _e("On sale start date(UTC): " ); ?><input type="text" class="dragonecommercereservezyx987_datetimepicker" name="dragonecommercereservezyx987_editproductonsalestartdateutc" value="' + dragonecommercereservezyx987_validString(productObj["onsalestartdateutc"]) + '" size="50"><?php _e(" e.g. 2020-01-01 14:00:00" ); ?></p>' + 
            '<p><?php _e("On sale end date(UTC): " ); ?><input type="text" class="dragonecommercereservezyx987_datetimepicker" name="dragonecommercereservezyx987_editproductonsaleenddateutc" value="' + dragonecommercereservezyx987_validString(productObj["onsaleenddateutc"]) + '" size="50"><?php _e(" e.g. 2020-01-01 14:00:00" ); ?></p>' +                                     
            '<p><?php _e("Quantity: " ); ?><input type="text" name="dragonecommercereservezyx987_editproductquantity" value="' + dragonecommercereservezyx987_validString(productObj["quantity"]) + '" size="100"><?php _e(" e.g. 50" ); ?></p>' + 
            '<p><?php _e("Original Quantity: " ); ?><input type="text" name="dragonecommercereservezyx987_editproductoriginalquantity" value="' + dragonecommercereservezyx987_validString(productObj["originalquantity"]) + '" size="100"><?php _e(" e.g. 50" ); ?></p>' + 
            '<p><?php _e("Department *: " ); ?>' + 
            '<select id="dragonecommercereservezyx987_department" name="dragonecommercereservezyx987_editproductdepartment">' + 
               '<option value="-1">Please select one...</option>' + 
               '<?php foreach ($alldepartments as $department) { ?>' + 
               '<option value="<?php echo $department->id; ?>" ' + (<?php echo $department->id === null ? 0 : intval($department->id); ?> === parseInt(productObj["departmentid"]) ? 'selected' : '') + '><?php echo wp_slash(esc_html($department->name)) . "(" . intval($department->id) . ")"; ?></option>' + 
               '<?php } ?>' + 
            '</select></p>' + 
            '<p><?php _e("Weight(lb): " ); ?><input type="text" name="dragonecommercereservezyx987_editproductweightlb" value="' + dragonecommercereservezyx987_validString(productObj["weightlb"]) + '" size="100"><?php _e(" e.g. 12.50" ); ?></p>' + 
            '<p><?php _e("Bar code: " ); ?><input type="text" name="dragonecommercereservezyx987_editproductbarcode" value="' + dragonecommercereservezyx987_validString(productObj["barcode"]) + '" size="100"><?php _e(" e.g. 012345678912" ); ?></p>';
            
            modalElement += '<p><?php _e("Description: " ); ?><br/><textarea name="dragonecommercereservezyx987_editproductdescription" rows="4" cols="100">' + dragonecommercereservezyx987_validString(productObj["description"]) + '</textarea><br/></p>' + 
            '<p><?php _e("Group: " ); ?>' +
            '<select id="dragonecommercereservezyx987_editproductgroup" name="dragonecommercereservezyx987_editproductgroup" >' + 
               '<option value="-1">Please select one...</option>' + 
               '<?php foreach ($allgroups as $group) { ?>' + 
               '<option value="<?php echo intval($group->id); ?>" ' + (dragonecommercereservezyx987_containElement(productObj["groups"], '<?php echo intval($group->id); ?>') ? 'selected' : '') + '><?php echo esc_html($group->name) . "(" . intval($group->id) . ")"; ?></option>' + 
               '<?php } ?>' + 
            '</select></p>' +     
            
            '<p><?php _e("Image File Names: " ); ?><input type="text" name="dragonecommercereservezyx987_editproductimagefilenames" value="' + (productObj["imagefilenames"] === null ? '' : productObj["imagefilenames"]) + '" size="100" readonly></p>' + 
            
            '<p><span>Upload Product Images (a .zip file of jpeg, jpg, png files)(If there is only one image file, zip it and upload)(Old files will be removed):</span>' +
            
            '<input type="file" name="dragonecommercereservezyx987_editproductuploadproductimages" id="dragonecommercereservezyx987_editproductuploadproductimages" accept=".jpeg,.jpg,.png,.zip">' +
            
            '</p>' + 
            
            '<p>' + 
            
            '<input type="checkbox" name="dragonecommercereservezyx987_editproductremoveimages" value="removeimages" />&nbsp;&nbsp;&nbsp;<span>Remove all images for the product</span>' +
            
            '</p><br/>' +
            
            '<input type="hidden" name="dragonecommercereservezyx987_hidden" value="Y">' + 
            '<input type="hidden" name="dragonecommercereservezyx987_hidden_security" value="<?php echo wp_create_nonce("dragonecommercereservezyx987_editProduct"); ?>">' +            
            '<input type="hidden" id="dragonecommercereservezyx987_editproductid" name="dragonecommercereservezyx987_editproductid" value="' + (productid == null ? '' : productid) + '">' + 
            '<input type="hidden" id="dragonecommercereservezyx987_editproductlocationarray" name="dragonecommercereservezyx987_editproductlocationarray" value="">' +                 
            '<input type="submit" name="Submit" style="padding: 0.6rem 1rem;" onclick="return dragonecommercereservezyx987_validateInput(dragonecommercereservezyx987_editProductLocationsandGroups);" value="<?php _e('Update Product', 'dragonecommerce_trdom' ) ?>" /><br/><br/>' +         
            '<script src="' + jsurl2 + '"><\/script>' +
            '<script>jQuery(document).ready(function(){jQuery(".dragonecommercereservezyx987_datetimepicker").datetimepicker({format:"Y-m-d H:i:s"});});<\/script></form>';
                        
            modalElement += '</div>';
            modalElement += "</div>";                    
            modalElement += '</div></div></div>';            
            modalElement += '</div>';
        modalElement += '<button type="button" style="float: right;" aria-label="close the pop up window" class="btn-close" tabindex="0" data-bs-dismiss="modal"></button>';
            modalElement += '</div>';
            
            //modalElement += '<div class="modal-footer" style="padding:15px 65px;">';
            //modalElement += '</div>';    
            modalElement += '</div></div>';

            jQuery('div#mylargemodal').html(modalElement);            
            
            var mylargemodal = new bootstrap.Modal(document.getElementById('mylargemodal'));
            mylargemodal.show();
            jQuery("div#mylargemodal").parent().css("width", jQuery(window).width()).css("height", jQuery(window).height()).css("top", 0);
            jQuery("div#mylargemodal").css("width", jQuery(window).width());
        }).fail(function( jqXHR, textStatus ) {
            alert( "Request failed: " + textStatus );                        
        });
    }
        
    function dragonecommercereservezyx987_containElement(mystring, myelement) {
        var res = mystring === null ? []: mystring.split(",");
        for (var i = 0; i < res.length; i++) {
            if (res[i] === myelement) {
                return true;
            }
        }
        return false;
    }
    
    function dragonecommercereservezyx987_disableProduct(productid) {
        if(confirm("Are you sure you want to disable this product?") == true) {
            jQuery.ajax({
                type: "POST",
                url: ajaxurl,
                data: {dragonecommercereservezyx987_hidden_security_disableproduct:"<?php echo wp_create_nonce('dragonecommercereservezyx987_disableProduct'); ?>",dragonecommercereservezyx987_hidden:"Y",action:"dragonecommercereservezyx987_disableProduct",id:productid}
            }).done(function (mydata) {
                if(mydata === 'success') {
                    alert('Product is disabled successfully.');                    
                } else {
                    alert(mydata);
                }
                location.reload();
            }).fail(function( jqXHR, textStatus ) {
                alert( "Request failed: " + textStatus );
            });
            return true;
        }
        return false;
    }
    
    function dragonecommercereservezyx987_enableProduct(productid) {
        if(confirm("Are you sure you want to enable this product?") == true) {
            jQuery.ajax({
                type: "POST",
                url: ajaxurl,
                data: {dragonecommercereservezyx987_hidden_security_enableproduct:"<?php echo wp_create_nonce('dragonecommercereservezyx987_enableProduct'); ?>",dragonecommercereservezyx987_hidden:"Y",action:"dragonecommercereservezyx987_enableProduct",id:productid}
            }).done(function (mydata) {
                if(mydata === 'success') {
                    alert('Product is enabled successfully.');                    
                } else {
                    alert(mydata);
                }
                location.reload();
            }).fail(function( jqXHR, textStatus ) {
                alert( "Request failed: " + textStatus );
            });                                    
            return true;
        }
        return false;
    }
        
    function dragonecommercereservezyx987_validateInput(callback) {
        if(typeof callback !== 'undefined'){
            if(jQuery.isFunction(callback) && callback.name === 'dragonecommercereservezyx987_addProductLocationsandGroups') {
                var temp = callback();
                if(temp !== null && typeof temp["error"] !== "undefined" && temp["error"] !== '') {
                    dragonecommercereservezyx987_addproductlocationarray = [];
                    jQuery("input#dragonecommercereservezyx987_addproductlocationarray").val('');
                    alert(temp["error"]);
                    return false;
                } else {
                    dragonecommercereservezyx987_addproductlocationarray = temp["locationArray"];
                    var temp2 = JSON.stringify(temp["locationArray"]);
                    jQuery("input#dragonecommercereservezyx987_addproductlocationarray").val(temp2);
                    return true;
                }
            } else if(jQuery.isFunction(callback) && callback.name === 'dragonecommercereservezyx987_editProductLocationsandGroups') {
                var temp = callback();
                if(temp !== null && typeof temp["error"] !== "undefined" && temp["error"] !== '') {
                    dragonecommercereservezyx987_editproductlocationarray = [];
                    jQuery("input#dragonecommercereservezyx987_editproductlocationarray").val('');
                    alert(temp["error"]);
                    return false;
                } else {
                    dragonecommercereservezyx987_editproductlocationarray = temp["locationArray"];
                    var temp2 = JSON.stringify(temp["locationArray"]);
                    jQuery("input#dragonecommercereservezyx987_editproductlocationarray").val(temp2);
                    return true;
                }
            } else if(jQuery.isFunction(callback) && callback.name === 'dragonecommercereservezyx987_addShippingpolicyLocationsandGroups') {
                var temp = callback();
                if(temp !== null && typeof temp["error"] !== "undefined" && temp["error"] !== '') {
                    dragonecommercereservezyx987_addshippingpolicylocationarray = [];
                    jQuery("input#dragonecommercereservezyx987_addshippingpolicylocationarray").val('');
                    alert(temp["error"]);
                    return false;
                } else {
                    dragonecommercereservezyx987_addshippingpolicylocationarray = temp["locationArray"];
                    var temp2 = JSON.stringify(temp["locationArray"]);
                    jQuery("input#dragonecommercereservezyx987_addshippingpolicylocationarray").val(temp2);
                    return true;
                }
            } else if(jQuery.isFunction(callback) && callback.name === 'dragonecommercereservezyx987_addTaxLocationsandGroups') {
                var temp = callback();
                if(temp !== null && typeof temp["error"] !== "undefined" && temp["error"] !== '') {
                    dragonecommercereservezyx987_addtaxlocationarray = [];
                    jQuery("input#dragonecommercereservezyx987_addtaxlocationarray").val('');
                    alert(temp["error"]);
                    return false;
                } else {
                    dragonecommercereservezyx987_addtaxlocationarray = temp["locationArray"];
                    var temp2 = JSON.stringify(temp["locationArray"]);
                    jQuery("input#dragonecommercereservezyx987_addtaxlocationarray").val(temp2);
                    return true;
                }
            }
        } else {
            return true;
        }
    }
   
    function dragonecommercereservezyx987_confirmDeleteEvent() {
        if(confirm("Are you sure you want to delete this ecommerce event?") == true) {           
            return true;
        }
        return false;
    }
   
    function dragonecommercereservezyx987_confirmDisable(dropdownlistid, disableitemname) {
        if(jQuery('#' + dropdownlistid).val() === '0') {
            alert('Please choose a ' + disableitemname + '.');
            return false;
        }
        if(confirm("Are you sure you want to disable this " + disableitemname + "?") == true) {           
            return true;
        }
        return false;
    }
    
    function dragonecommercereservezyx987_confirmUpload(dropdownlistid) {
        if(jQuery('#' + dropdownlistid).val() === '0') {
            alert('Please choose an excel file.');
            return false;
        }
        if(confirm("Are you sure you want to upload this excel file?") == true) {           
            return true;
        }
        return false;
    }
    
    function dragonecommercereservezyx987_confirmDrop(dropitemname, includeRelatedTables) {
        var temp = '';
        if(typeof includeRelatedTables !== 'undefined') {
            if(includeRelatedTables === true) {
                temp = ' and related tables';
            }            
        } else {
            temp = ' and related tables';
        }
        if(dropitemname !== 'all') {
            if(confirm("Are you sure you want to drop the " + dropitemname + " table" + temp + "?") == true) {           
                return true;
            }
        } else {
            if(confirm("Are you sure you want to drop all the ecommerce tables?") == true) {           
                return true;
            }
        }
        return false;
    }
    
    function dragonecommercereservezyx987_confirmEnableAutoBackupDatabaseEveryday() {
        if(confirm("Are you sure you want to enable automatically backup database everyday?") == true) {           
            return true;
        }
        return false;
    }

    function dragonecommercereservezyx987_confirmDisableAutoBackupDatabaseEveryday() {
        if(confirm("Are you sure you want to disable automatically backup database everyday?") == true) {           
            return true;
        }
        return false;
    }
    
    function dragonecommercereservezyx987_updateProvincesDropdownList(element, levelamount) {
        var className = jQuery(element).val();
        if(className !== '') {
            jQuery(element).parent().next('p').find('select').children().hide();
            jQuery(element).parent().next('p').find('select').find('.' + className).show();
            jQuery(element).parent().next('p').find('select').val('-1');
            if(typeof levelamount !== 'undefined' && parseInt(levelamount) === 2) {
                jQuery(element).parent().next('p').next('p').find('select').children().hide();
                jQuery(element).parent().next('p').next('p').find('select').find('.' + className).show();
                jQuery(element).parent().next('p').next('p').find('select').val('-1');                
            }
        }
    }
    
    function dragonecommercereservezyx987_updateProvincesDropdownList_forTableRow(element, levelamount) {
        var className = jQuery(element).val();
        if(className !== '') {
            jQuery(element).parent().parent().next('td').find('select').children().hide();
            jQuery(element).parent().parent().next('td').find('select').find('.' + className).show();
            jQuery(element).parent().parent().next('td').find('select').val('-1');
            if(typeof levelamount !== 'undefined' && parseInt(levelamount) === 2) {
                jQuery(element).parent().parent().next('td').next('td').find('select').children().hide();
                jQuery(element).parent().parent().next('td').next('td').find('select').find('.' + className).show();
                jQuery(element).parent().parent().next('td').next('td').find('select').val('-1');                
            }
        }
    }
    
    function dragonecommercereservezyx987_updateProvincesDropdownListForAddProductLocation(element, levelamount) {
        var className = jQuery(element).val();
        if(className !== '') {
            jQuery(element).next('select').children().hide();
            jQuery(element).next('select').find('.' + className).show();
            jQuery(element).next('select').val('-1');
            if(typeof levelamount !== 'undefined' && parseInt(levelamount) === 2) {
                jQuery(element).next('select').next('select').children().hide();
                jQuery(element).next('select').next('select').find('.' + className).show();
                jQuery(element).next('select').next('select').val('-1');                
            }
        }
    }
            
    function dragonecommercereservezyx987_updateCitiesDropdownList(element) {
        var className = jQuery(element).val();
        if(className !== '') {
            jQuery(element).parent().next('p').find('select').children().hide();
            jQuery(element).parent().next('p').find('select').find('.' + className).show();
            jQuery(element).parent().next('p').find('select').val('-1');
        }
    }
    
    function dragonecommercereservezyx987_updateCitiesDropdownListForAddProductLocation(element) {
        var className = jQuery(element).val();
        if(className !== '') {
            jQuery(element).next('select').children().hide();
            jQuery(element).next('select').find('.' + className).show();
            jQuery(element).next('select').val('-1');
        }
    }

    function dragonecommercereservezyx987_removeCountryProvinceCityQuantity(element) {
        jQuery(element).parent().parent().remove();
    }
            
    function dragonecommercereservezyx987_addProductLocationsandGroups() {
        var result = {"error":"", locationArray:[]};
        jQuery("div#addproduct_addlocation_container div.addproduct_addlocation").each(function( index ) {
            var locationObject = {};
            locationObject["country"]  = parseInt(jQuery.trim(jQuery(this).find("select.dragonecommercereservezyx987_addproductcountrydropdownlist").val()));
            if(locationObject["country"] === '-1') {locationObject["country"] = -1;result["error"] += "Country is required. ";}
            locationObject["province"] = parseInt(jQuery.trim(jQuery(this).find("select.dragonecommercereservezyx987_addproductprovincedropdownlist").val()));
            if(locationObject["province"] === '-1') {locationObject["province"] = -1;}            
            locationObject["city"] = parseInt(jQuery.trim(jQuery(this).find("select.dragonecommercereservezyx987_addproductcitydropdownlist").val()));
            if(locationObject["city"] === '-1') {locationObject["city"] = -1;}    
            locationObject["shippingpolicy"] = parseInt(jQuery.trim(jQuery(this).find("select.dragonecommercereservezyx987_addproductshippingpolicydropdownlist").val()));
            if(locationObject["shippingpolicy"] === '-1') {locationObject["shippingpolicy"] = -1;}            
            locationObject["quantity"] = parseInt(jQuery.trim(jQuery(this).find("input.dragonecommercereservezyx987_addproductquantity").val()));
            result["locationArray"].push(locationObject);
        });
        return result;
    }

    function dragonecommercereservezyx987_editProductLocationsandGroups() {
        var result = {"error":"", locationArray:[]};
        jQuery("div#editproduct_editlocation_container div.editproduct_editlocation").each(function( index ) {
            var locationObject = {};
            locationObject["country"]  = parseInt(jQuery.trim(jQuery(this).find("select.dragonecommercereservezyx987_editproductcountrydropdownlist").val()));
            if(locationObject["country"] === '-1') {locationObject["country"] = -1;result["error"] += "Country is required. ";}
            locationObject["province"] = parseInt(jQuery.trim(jQuery(this).find("select.dragonecommercereservezyx987_editproductprovincedropdownlist").val()));
            if(locationObject["province"] === '-1') {locationObject["province"] = -1;}            
            locationObject["city"] = parseInt(jQuery.trim(jQuery(this).find("select.dragonecommercereservezyx987_editproductcitydropdownlist").val()));
            if(locationObject["city"] === '-1') {locationObject["city"] = -1;}    
            locationObject["shippingpolicy"] = parseInt(jQuery.trim(jQuery(this).find("select.dragonecommercereservezyx987_editproductshippingpolicydropdownlist").val()));
            if(locationObject["shippingpolicy"] === '-1') {locationObject["shippingpolicy"] = -1;}            
            locationObject["quantity"] = parseInt(jQuery.trim(jQuery(this).find("input.dragonecommercereservezyx987_editproductquantity").val()));
            result["locationArray"].push(locationObject);
        });
        return result;
    }    
    
    function dragonecommercereservezyx987_updateProvincesDropdownListForAddShippingpolicyLocation(element, levelamount) {
        var className = jQuery(element).val();
        if(className !== '') {
            jQuery(element).next('select').children().hide();
            jQuery(element).next('select').find('.' + className).show();
            jQuery(element).next('select').val('-1');
            if(typeof levelamount !== 'undefined' && parseInt(levelamount) === 2) {
                jQuery(element).next('select').next('select').children().hide();
                jQuery(element).next('select').next('select').find('.' + className).show();
                jQuery(element).next('select').next('select').val('-1');                
            }
        }
    }
    
    function dragonecommercereservezyx987_updateCitiesDropdownListForAddShippingpolicyLocation(element) {
        var className = jQuery(element).val();
        if(className !== '') {
            jQuery(element).next('select').children().hide();
            jQuery(element).next('select').find('.' + className).show();
            jQuery(element).next('select').val('-1');
        }
    }
    
    function dragonecommercereservezyx987_addShippingpolicyCountryProvince() {
        var temp = '<div class="addshippingpolicy_addlocation">' +
                '<p>' + <?php _e("'From Country *: '"); ?> +
                '<select class="dragonecommercereservezyx987_addshippingpolicyfromcountrydropdownlist" onchange="dragonecommercereservezyx987_updateProvincesDropdownListForAddShippingpolicyLocation(this, 2);">' +
                   '<option value="-1">Please choose one...</option>' +
                   <?php foreach ($activecountries as $country) { ?>
                   '<option value="<?php echo intval($country->id); ?>" >' + <?php echo "\"" . esc_html($country->name) . "\""; ?> + '</option>' +
                   <?php } ?>
                '</select>&nbsp;&nbsp;' + <?php _e("'From Province: '"); ?> +
                '<select class="dragonecommercereservezyx987_addshippingpolicyfromprovincedropdownlist" onchange="dragonecommercereservezyx987_updateCitiesDropdownListForAddShippingpolicyLocation(this);">' +
                   '<option value="-1">Please choose one...</option>' +
                   <?php foreach ($activeprovinces as $province) { ?>
                   '<option class="' + <?php echo intval($province->countryid); ?> + '" value="' + <?php echo intval($province->id); ?> + '" style="display:none;' + <?php echo $province->status === '1' ? "''" : 'color:grey;'; ?> + '">' + <?php echo "\"" . esc_html($province->name) . "\""; ?> + '</option>' +
                   <?php } ?>
                '</select>&nbsp;&nbsp;' + <?php _e("'From City: '"); ?> +
                '<select class="dragonecommercereservezyx987_addshippingpolicyfromcitydropdownlist">' +
                   '<option value="-1">Please choose one...</option>' +
                   <?php foreach ($activecities as $city) { ?>
                   '<option class="' + <?php echo intval($city->provinceid); ?> + '" value="' + <?php echo intval($city->id); ?> + '" style="' + <?php echo $city->status === '1' ? "''" : 'color:grey;'; ?> + '">' + <?php echo "\"" . esc_html($city->name) . "\""; ?> + '</option>' +
                   <?php } ?>
                '</select>&nbsp;&nbsp;' + <?php _e("'To Country *: '"); ?> +
                '<select class="dragonecommercereservezyx987_addshippingpolicytocountrydropdownlist" onchange="dragonecommercereservezyx987_updateProvincesDropdownListForAddShippingpolicyLocation(this, 2);">' +
                   '<option value="-1">Please choose one...</option>' +
                   <?php foreach ($activecountries as $country) { ?>
                   '<option value="' + <?php echo intval($country->id); ?> + '" >' + <?php echo "\"" . esc_html($country->name) . "\""; ?> + '</option>' +
                   <?php } ?>
                '</select>&nbsp;&nbsp;' + <?php _e("'To Province: '"); ?> +
                '<select class="dragonecommercereservezyx987_addshippingpolicytoprovincedropdownlist" onchange="dragonecommercereservezyx987_updateCitiesDropdownListForAddShippingpolicyLocation(this);">' +
                   '<option value="-1">Please choose one...</option>' +
                   <?php foreach ($activeprovinces as $province) { ?>
                   '<option class="' + <?php echo intval($province->countryid); ?> + '" value="' + <?php echo intval($province->id); ?> + '" style="display:none;' + <?php echo $province->status === '1' ? "''" : 'color:grey;'; ?> + '">' + <?php echo "\"" . esc_html($province->name) . "\""; ?> + '</option>' +
                   <?php } ?>
                '</select>&nbsp;&nbsp;' + <?php _e("'To City: '"); ?> +
                '<select class="dragonecommercereservezyx987_addshippingpolicytocitydropdownlist">' +
                   '<option value="-1">Please choose one...</option>' +
                   <?php foreach ($activecities as $city) { ?>
                   '<option class="' + <?php echo intval($city->provinceid); ?> + '" value="' + <?php echo intval($city->id); ?> + '" style="' + <?php echo $city->status === '1' ? "''" : 'color:grey;'; ?> + '">' + <?php echo "\"" . esc_html($city->name) . "\""; ?> + '</option>' +
                   <?php } ?>
                '</select><input type="button" class="delete-danger" value="Remove location" onclick="dragonecommercereservezyx987_removeShippingpolicyCountryProvince(this);">' +
                '</p>' +
            '</div>';
        jQuery('div#addshippingpolicy_addlocation_container').append(temp);
    }

    function dragonecommercereservezyx987_removeShippingpolicyCountryProvince(element) {
        jQuery(element).parent().parent().remove();
    }
    
    function dragonecommercereservezyx987_addShippingpolicyLocationsandGroups() {
        var result = {"error":"", locationArray:[]};
        jQuery("div#addshippingpolicy_addlocation_container div.addshippingpolicy_addlocation").each(function( index ) {
            var locationObject = {};
            locationObject["fromcountry"]  = parseInt(jQuery.trim(jQuery(this).find("select.dragonecommercereservezyx987_addshippingpolicyfromcountrydropdownlist").val()));
            if(locationObject["fromcountry"] === '-1') {locationObject["fromcountry"] = -1;result["error"] += "Country is required. ";}
            locationObject["fromprovince"] = parseInt(jQuery.trim(jQuery(this).find("select.dragonecommercereservezyx987_addshippingpolicyfromprovincedropdownlist").val()));
            if(locationObject["fromprovince"] === '-1') {locationObject["fromprovince"] = -1;}
            locationObject["fromcity"] = parseInt(jQuery.trim(jQuery(this).find("select.dragonecommercereservezyx987_addshippingpolicyfromcitydropdownlist").val()));
            if(locationObject["fromcity"] === '-1') {locationObject["fromcity"] = -1;}
            
            locationObject["tocountry"]  = parseInt(jQuery.trim(jQuery(this).find("select.dragonecommercereservezyx987_addshippingpolicytocountrydropdownlist").val()));
            if(locationObject["tocountry"] === '-1') {locationObject["tocountry"] = -1;result["error"] += "Country is required. ";}
            locationObject["toprovince"] = parseInt(jQuery.trim(jQuery(this).find("select.dragonecommercereservezyx987_addshippingpolicytoprovincedropdownlist").val()));
            if(locationObject["toprovince"] === '-1') {locationObject["toprovince"] = -1;}
            locationObject["tocity"] = parseInt(jQuery.trim(jQuery(this).find("select.dragonecommercereservezyx987_addshippingpolicytocitydropdownlist").val()));
            if(locationObject["tocity"] === '-1') {locationObject["tocity"] = -1;}
            
            result["locationArray"].push(locationObject);
        });
        return result;
    }
    
    function dragonecommercereservezyx987_updateProvincesDropdownListForAddTaxLocation(element) {
        var className = jQuery(element).val();
        if(className !== '') {
            jQuery(element).next('select').children().hide();
            jQuery(element).next('select').find('.' + className).show();
            jQuery(element).next('select').val('-1');
        }
    }
    
    function dragonecommercereservezyx987_addTaxCountryProvince() {
        var temp = '<div class="addtax_addlocation">' + 
                    '<p>' + <?php _e("'Country *: '"); ?> +
                    '<select class="dragonecommercereservezyx987_addtaxcountrydropdownlist" onchange="dragonecommercereservezyx987_updateProvincesDropdownListForAddTaxLocation(this)">' +
                       '<option value="-1">Please choose one...</option>' + 
                       <?php foreach ($activecountries as $country) { ?>
                           '<option value="<?php echo intval($country->id); ?>" >' + <?php echo "\"" . esc_html($country->name) . "\""; ?> + '</option>' +
                       <?php } ?>
                    '</select>' +    
                    '&nbsp;&nbsp;' + <?php _e("'Province: '"); ?>  +
                    '<select class="dragonecommercereservezyx987_addtaxprovincedropdownlist">' +
                       '<option value="-1">Please choose one...</option>' + 
                       <?php foreach ($activeprovinces as $province) { ?>
                           '<option class="' + <?php echo "'" . intval($province->countryid) . "'"; ?>  + '" value="' + <?php echo "'" . intval($province->id) . "'"; ?> + '" style="display:none;' + <?php echo $province->status === '1' ? "''" : "'color:grey;'"; ?> + '"><?php echo deslash(esc_html($province->name)); ?></option>' +
                       <?php } ?>
                    '</select>' + 
                    '<input type="button" class="delete-danger" value="Remove location" onclick="dragonecommercereservezyx987_removeTaxCountryProvince(this);"></p>' +
                '</div>';
        jQuery('div#addtax_addlocation_container').append(temp);
    }

    function dragonecommercereservezyx987_removeTaxCountryProvince(element) {
        jQuery(element).parent().parent().remove();
    }
    
    
    function dragonecommercereservezyx987_addTaxLocationsandGroups() {
        var result = {"error":"", locationArray:[]};
        jQuery("div#addtax_addlocation_container div.addtax_addlocation").each(function( index ) {
            var locationObject = {};
            locationObject["country"]  = parseInt(jQuery.trim(jQuery(this).find("select.dragonecommercereservezyx987_addtaxcountrydropdownlist").val()));
            if(locationObject["country"] === '-1') {locationObject["country"] = -1;result["error"] += "Country is required. ";}
            locationObject["province"] = parseInt(jQuery.trim(jQuery(this).find("select.dragonecommercereservezyx987_addtaxprovincedropdownlist").val()));
            if(locationObject["province"] === '-1') {locationObject["province"] = -1;}            
            
            result["locationArray"].push(locationObject);
        });
        return result;
    }
    
    function dragonecommercereservezyx987_updatedepartmentproducts_getProductsForDepartment() {
        jQuery('p#dragonecommercereservezyx987_updatedepartmentproductscheckboxes').hide();
        jQuery('p#dragonecommercereservezyx987_updatedepartmentproductscheckboxes').html('');
        var departmentid = parseInt(jQuery('select#dragonecommercereservezyx987_updatedepartmentproductsdepartment').val());
        if(departmentid <= 0) { return alert('Please choose a department.');}
        jQuery('input#dragonecommercereservezyx987_updatedepartmentproductssubmit').hide();        
        jQuery.ajax({
            type: "POST",
            url: ajaxurl,
            data: {dragonecommercereservezyx987_hidden_security_getproductsfordepartment:"<?php echo wp_create_nonce('dragonecommercereservezyx987_getproductsfordepartment'); ?>",dragonecommercereservezyx987_hidden:"Y",action:"dragonecommercereservezyx987_getproductsfordepartment", id:departmentid}
        }).done(function (mydata) {
            jQuery('p#dragonecommercereservezyx987_updatedepartmentproductscheckboxes').show();
            jQuery('input#dragonecommercereservezyx987_updatedepartmentproductssubmit').show();    
            if(mydata.length > 0) {
                var temp = '';
                for (var i = 0; i < mydata.length; i++) {
                    temp += '<input type="checkbox" id="dragonecommercereservezyx987_updatedepartmentproducts_product_' + mydata[i]["id"] + '" name="dragonecommercereservezyx987_updatedepartmentproducts_product[]" value="' + mydata[i]["id"] + '" ' + (mydata[i]["departmentid"] === departmentid ? 'checked' : '') + '><span style="">' + mydata[i]["name"] + '</span>&nbsp;&nbsp;&nbsp;&nbsp;';
                }
                jQuery('p#dragonecommercereservezyx987_updatedepartmentproductscheckboxes').html(temp);
            }                        
        });
    }
    
    function dragonecommercereservezyx987_addproductpropertyvalues_getProductPropertyvaluesForProduct() {
        jQuery('input.dragonecommercereservezyx987_addproductpropertyvalues_lastpropertyvalue').prop('checked', false);
        var productid = parseInt(jQuery('select#dragonecommercereservezyx987_addproductpropertyvaluesproduct').val());
        if(productid <= 0) { return alert('Please choose a product.');}
        
        var allchosen = true;
        var haserror = false;
        var haserrorvalues = [];
        var chosenpropertyids = [];        
        jQuery('select.dragonecommercereservezyx987_addproductpropertyvalues').each(function( index ) {            
            if(jQuery( this ).val() === '-1' ){ 
                allchosen = false; 
            } else {
                var temp = parseInt(jQuery( this ).val());
                if(temp > 0) {
                    chosenpropertyids.push(temp);
                } else {
                    haserror = true;
                    haserrorvalues.push(jQuery( this ).val())
                }
            }              
        });
        if(!allchosen) {
            //hide last property and check boxes
            jQuery('p#dragonecommercereservezyx987_addproductpropertyvalues_lastproperty').hide();
            jQuery('input#dragonecommercereservezyx987_addproductpropertyvaluessubmit').hide();
            return;
        } else {
            jQuery('p#dragonecommercereservezyx987_addproductpropertyvalues_lastproperty').show();
            jQuery('input#dragonecommercereservezyx987_addproductpropertyvaluessubmit').show();
        }
        if(haserror) { alert("These drop down list values are wrong: " + haserrorvalues); }
        chosenpropertyids.sort();
        var sortedvalues = chosenpropertyids.join('|');
        
        jQuery('input#dragonecommercereservezyx987_addproductpropertyvaluessubmit').hide();        
        jQuery.ajax({
            type: "POST",
            url: ajaxurl,
            data: {dragonecommercereservezyx987_hidden_security_getproductpropertyvaluesforproduct:"<?php echo wp_create_nonce('dragonecommercereservezyx987_getproductpropertyvaluesforproduct'); ?>",dragonecommercereservezyx987_hidden:"Y",action:"dragonecommercereservezyx987_getproductpropertyvaluesforproduct", id:productid, values: sortedvalues}
        }).done(function (mydata) {
            if(mydata.length > 0) {
                for (var i = 0; i < mydata.length; i++) {
                    var temp = mydata[i]["propertyvalueids"];
                    var tempArr = temp.split('|');
                    var found = false;
                    var notmatchArr = [];
                    for(var j=0; j < tempArr.length; j++) {
                        found = false;
                        for(var k=0; k < chosenpropertyids.length; k++) {
                            if(parseInt(tempArr[j]) === chosenpropertyids[k]) {
                                found = true;
                                break;
                            }                        
                        }
                        if(found === false && tempArr[j] !== '') {
                            notmatchArr.push(tempArr[j]);
                        }
                    }
                    if(notmatchArr.length === 1) {
                        var checkedvalue = notmatchArr[0];
                        jQuery('input#dragonecommercereservezyx987_addproductpropertyvalues_propertyvalue_' + checkedvalue).prop('checked', true);                        
                    } else {
                        alert('Something wrong with database data: we got ' + tempArr.length + ' values from database.');
                    }
                }
            }
            jQuery('input#dragonecommercereservezyx987_addproductpropertyvaluessubmit').show();
        });        
    }
    
    function dragonecommercereservezyx987_addproductpropertyvalues_getProductPropertyvaluesForProductForOneProperty() {
        jQuery('input.dragonecommercereservezyx987_addproductpropertyvalues_lastpropertyvalue').prop('checked', false);
        var productid = parseInt(jQuery('select#dragonecommercereservezyx987_addproductpropertyvaluesproduct').val());
        if(productid <= 0) { return alert('Please choose a product.');}
        
        /*var allchosen = true;
        var haserror = false;
        var haserrorvalues = [];
        var chosenpropertyids = [];        
        jQuery('select.dragonecommercereservezyx987_addproductpropertyvalues').each(function( index ) {            
            if(jQuery( this ).val() === '-1' ){ 
                allchosen = false; 
            } else {
                var temp = parseInt(jQuery( this ).val());
                if(temp > 0) {
                    chosenpropertyids.push(temp);
                } else {
                    haserror = true;
                    haserrorvalues.push(jQuery( this ).val())
                }
            }              
        });*/
        //if(!allchosen) {
            //hide last property and check boxes
        //    jQuery('p#dragonecommercereservezyx987_addproductpropertyvalues_lastproperty').hide();
        //    jQuery('input#dragonecommercereservezyx987_addproductpropertyvaluessubmit').hide();
        //    return;
        //} else {
            jQuery('p#dragonecommercereservezyx987_addproductpropertyvalues_lastproperty').show();
            //jQuery('input#dragonecommercereservezyx987_addproductpropertyvaluessubmit').show();
        //}
        //if(haserror) { alert("These drop down list values are wrong: " + haserrorvalues); }
        //chosenpropertyids.sort();
        //var sortedvalues = chosenpropertyids.join('|');
        
        jQuery('input#dragonecommercereservezyx987_addproductpropertyvaluessubmit').hide();        
        jQuery.ajax({
            type: "POST",
            url: ajaxurl,
            data: {dragonecommercereservezyx987_hidden_security_getproductpropertyvaluesforproductforoneproperty:"<?php echo wp_create_nonce('dragonecommercereservezyx987_getproductpropertyvaluesforproductforoneproperty'); ?>",dragonecommercereservezyx987_hidden:"Y",action:"dragonecommercereservezyx987_getproductpropertyvaluesforproductforoneproperty", id:productid}
        }).done(function (mydata) {
            if(mydata.length > 0) {
                for (var i = 0; i < mydata.length; i++) {
                    var temp = mydata[i]["propertyvalueids"];
                    //var tempArr = temp.split('|');
                    //var found = false;
                    //var notmatchArr = [];
                    /*for(var j=0; j < tempArr.length; j++) {
                        found = false;
                        for(var k=0; k < chosenpropertyids.length; k++) {
                            if(parseInt(tempArr[j]) === chosenpropertyids[k]) {
                                found = true;
                                break;
                            }                        
                        }
                        if(found === false && tempArr[j] !== '') {
                            notmatchArr.push(tempArr[j]);
                        }
                    }*/
                    //if(notmatchArr.length === 1) {
                        //var checkedvalue = notmatchArr[0];
                        jQuery('input#dragonecommercereservezyx987_addproductpropertyvalues_propertyvalue_' + temp).prop('checked', true);                        
                    //} else {
                    //    alert('Something wrong with database data: we got ' + tempArr.length + ' values from database.');
                    //}
                }            
                jQuery('input#dragonecommercereservezyx987_addproductpropertyvaluessubmit').show();
            }
        });        
    }

    function dragonecommercereservezyx987_updatePropertyvalueDropdownList(element, targetid) {
        jQuery('select#' + targetid + ' option').hide();
        if(jQuery(element).val() !== '-1' && parseInt(jQuery(element).val()) > 0) {
            jQuery('select#' + targetid + ' option.' + jQuery(element).val()).show();            
        }        
    }
    
    function dragonecommercereservezyx987_updateGroupDropdownList(element, targetid) {
        jQuery('select#' + targetid + ' option').hide();
        if(jQuery(element).val() !== '-1' && parseInt(jQuery(element).val()) > 0) {
            jQuery('select#' + targetid + ' option.' + jQuery(element).val()).show();            
        }        
    }
    
    function dragonecommercereservezyx987_approveUser(userid) {
        if(confirm("Are you sure you want to approve this user?") == true) {
        var mypluginurl = "<?php $protocol = is_ssl() ? 'https://' : 'http://'; $urlparts = wp_parse_url(home_url()); $protocol = esc_html($urlparts['scheme']) . '://'; $domain = esc_html($urlparts['host']); $myurl = strtok($protocol . $domain . esc_html($_SERVER['REQUEST_URI']), '?'); if(substr($myurl, -1) === '/') {$myurl = substr($myurl, 0, -1);} echo esc_html($myurl); ?>";                    
        jQuery.ajax({
            type: "POST",
            url: ajaxurl,
            data: {dragonecommercereservezyx987_hidden_security_approveuser:"<?php echo wp_create_nonce('dragonecommercereservezyx987_approveUser'); ?>",dragonecommercereservezyx987_hidden:"Y",action:"dragonecommercereservezyx987_approveUser", id: userid, pluginurl: mypluginurl}
        }).done(function (mydata) {
            if(mydata === 'Success') {
                alert(mydata);
                dragonecommercereservezyx987_getUsersList();                                
            } else {
                var myresult = mydata === "" ? 'fail' : mydata;
                alert(myresult);
            }
        }).fail(function( jqXHR, textStatus ) {
            alert( "Request failed: " + textStatus );
        });
            return true;
        }
        return false;
    }
    
    function dragonecommercereservezyx987_disapproveUser(userid) {
        if(confirm("Are you sure you want to disapprove this user?") == true) {
        var mypluginurl = "<?php $protocol = is_ssl() ? 'https://' : 'http://'; $urlparts = wp_parse_url(home_url()); $protocol = esc_html($urlparts['scheme']) . '://'; $domain = esc_html($urlparts['host']); $myurl = strtok($protocol . $domain . esc_html($_SERVER['REQUEST_URI']), '?'); if(substr($myurl, -1) === '/') {$myurl = substr($myurl, 0, -1);} echo esc_html($myurl); ?>";                
        jQuery.ajax({
            type: "POST",
            url: ajaxurl,
            data: {dragonecommercereservezyx987_hidden_security_disapproveuser:"<?php echo wp_create_nonce('dragonecommercereservezyx987_disapproveUser'); ?>",dragonecommercereservezyx987_hidden:"Y",action:"dragonecommercereservezyx987_disapproveUser", id: userid, pluginurl: mypluginurl}
        }).done(function (mydata) {
            if(mydata === 'Success') {
                alert(mydata);
                dragonecommercereservezyx987_getUsersList();                                
            } else {
                var myresult = mydata === "" ? 'fail' : mydata;
                alert(myresult);
            }
        }).fail(function( jqXHR, textStatus ) {
            alert( "Request failed: " + textStatus );
        });
            return true;
        }
        return false;
    }
    
    function dragonecommercereservezyx987_editSetting(element, settingid) {
        jQuery(element).parent().parent().find('span.settingspan').toggle();
        jQuery(element).parent().parent().find('.settingedittextbox').toggle();
    }

    function dragonecommercereservezyx987_submitSettingValue(textboxid, settingid, settingname) {
        if(textboxid === '' || jQuery('#' + textboxid).length === 0) {return "Text box does not exist";}
        var myvalue = jQuery('#' + textboxid).val();
        var myname = ((typeof settingname === 'undefined') ? '' : (settingname === null ? '' : settingname));
        
        var mypluginurl = "<?php $protocol = is_ssl() ? 'https://' : 'http://'; $urlparts = wp_parse_url(home_url()); $protocol = esc_html($urlparts['scheme']) . '://'; $domain = esc_html($urlparts['host']); $myurl = strtok($protocol . $domain . esc_html($_SERVER['REQUEST_URI']), '?'); if(substr($myurl, -1) === '/') {$myurl = substr($myurl, 0, -1);} echo esc_html($myurl); ?>";                
        jQuery.ajax({
            type: "POST",
            url: ajaxurl,
            data: {dragonecommercereservezyx987_hidden_security_editsettingvalue:"<?php echo wp_create_nonce('dragonecommercereservezyx987_editSettingvalue'); ?>",dragonecommercereservezyx987_hidden:"Y",action:"dragonecommercereservezyx987_editSettingvalue", id: settingid, name: myname, value: myvalue, pluginurl: mypluginurl}
        }).done(function (mydata) {
            if(mydata === 'Success') {
                alert(mydata);
                dragonecommercereservezyx987_getSettingsList();                        
            } else {
                var myresult = mydata === "" ? 'fail' : mydata;
                alert(myresult);
            }
        }).fail(function( jqXHR, textStatus ) {
            alert( "Request failed: " + textStatus );
        });
    }
    
    function dragonecommercereservezyx987_updateproductpropertyvaluesproductto_filter(element) {
        if(jQuery(element).length > 0 && jQuery('p#dragonecommercereservezyx987_updateproductpropertyvaluesproductto_list > span').length > 0) {
            if(jQuery(element).val() !== '') {
                jQuery('p#dragonecommercereservezyx987_updateproductpropertyvaluesproductto_list > span').each(function(index){
                    if(jQuery(this).text().toLowerCase().indexOf(jQuery(element).val().toLowerCase()) >= 0) {
                        jQuery(this).show();
                        jQuery(this).prev('input').show();
                    } else {
                        jQuery(this).hide();
                        jQuery(this).prev('input').hide();
                    }
                });
            } else {
                jQuery('p#dragonecommercereservezyx987_updateproductpropertyvaluesproductto_list > input').show();
                jQuery('p#dragonecommercereservezyx987_updateproductpropertyvaluesproductto_list > span').show();
            }
        }
    }
    
    function dragonecommercereservezyx987_validateDateInput(dateString) {
        var re = /^\d{4}-\d{2}-\d{2}$/;
        var re2 = /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}$/;
        var re3 = /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/;
        return (dateString==="") || re.test(dateString) || re2.test(dateString) || re3.test(dateString);    
    }    
</script>
<div class="wrap">
<?php echo "<h2>" . __( 'Dragon Ecommerce Reserve Without Online Payment', 'dragonecommerce_trdom' ) . "</h2>"; ?>
<p>Although customers do not pay online, this plugin still calculates subtotal, shipping fee, handling fee, discount fee, coupon fee, and tax, and save to database. For usage instructions and calculation details, please go to the Documents tab and read the <a style="color:blue;" href="<?php echo plugins_url('documentation_dragonecommercereservefree.pdf', __FILE__ ); ?>" target="_blank">manual file</a>.</p>
<div id="dragonecommerce_tabs">
    <ul>
        <li><a href="#dragonecommerce_tabs_1"><?php echo "<h3>" . __( 'Charts', 'dragonecommerce_trdom' ) . "</h3>"; ?></a></li>
        <li><a href="#dragonecommerce_tabs_2"><?php echo "<h3>" . __( 'Tables 1', 'dragonecommerce_trdom' ) . "</h3>"; ?></a></li>
        <li><a href="#dragonecommerce_tabs_3"><?php echo "<h3>" . __( 'Tables 2', 'dragonecommerce_trdom' ) . "</h3>"; ?></a></li>
        <li><a href="#dragonecommerce_tabs_4"><?php echo "<h3>" . __( 'Tables 3', 'dragonecommerce_trdom' ) . "</h3>"; ?></a></li>
        <li><a href="#dragonecommerce_tabs_5"><?php echo "<h3>" . __( 'Actions', 'dragonecommerce_trdom' ) . "</h3>"; ?></a></li>
        <li><a href="#dragonecommerce_tabs_6"><?php echo "<h3>" . __( 'Re-create tables', 'dragonecommerce_trdom' ) . "</h3>" ?></a></li>
        <li><a href="#dragonecommerce_tabs_7"><?php echo "<h3>" . __( 'Documents', 'dragonecommerce_trdom' ) . "</h3>" ?></a></li>
    </ul>
    <div id="dragonecommerce_tabs_1">
<?php echo "<h3>" . __( '1. Total reserve money in the past 14 days/16 weeks/12 months/10 years:', 'dragonecommerce_trdom' ) . "</h3>"; ?>    
<div id="dragonecommerce_chart_totalreservemoney" class="dragonecommerce_chart money">
    <p>In this chart, Monday is used as the first day of a week. Only orders having status "reserved", "shipped", or "received" are included in the chart. The setting table's COMPANY_TIMEZONE_HOURS is used to make this chart based on your local time.</p>
    <select id="dragonecommerce_chart_totalreservemoney_frequency" name="dragonecommerce_chart_totalreservemoney_frequency" onchange="dragonecommercereservezyx987_createChart1();">
        <option value="-1">Please choose one ...</option>
        <option value="14days" selected>in the past 14 days (including today)</option>
        <option value="16weeks">in the past 16 weeks (including this week)</option>
        <option value="12months">in the past 12 months (including this month)</option>
        <option value="10years">in the past 10 years (including this year)</option>        
    </select><img src="<?php echo plugin_dir_url( __FILE__ );  ?>images/loading.gif" id="admin_chart_totalreservemoney_loader" alt="loading" style="display:none;" />
    <svg width="1200" height="500"></svg>
</div><br/><hr/>
<?php echo "<h3>" . __( '2. Total reserve quantity in the past 14 days/16 weeks/12 months/10 years:', 'dragonecommerce_trdom' ) . "</h3>"; ?>    
<div id="dragonecommerce_chart_totalreservequantity" class="dragonecommerce_chart">
    <p>In this chart, Monday is used as the first day of a week. Only orders having status "reserved", "shipped", or "received" are included in the chart. The setting table's COMPANY_TIMEZONE_HOURS is used to make this chart based on your local time.</p>
    <select id="dragonecommerce_chart_totalreservequantity_frequency" name="dragonecommerce_chart_totalreservequantity_frequency" onchange="dragonecommercereservezyx987_createChart2();">
        <option value="-1">Please choose one...</option>
        <option value="14days" selected>in the past 14 days (including today)</option>
        <option value="16weeks">in the past 16 weeks (including this week)</option>
        <option value="12months">in the past 12 months (including this month)</option>
        <option value="10years">in the past 10 years (including this year)</option>                
    </select><img src="<?php echo plugin_dir_url( __FILE__ );  ?>images/loading.gif" id="admin_chart_totalreservequantity_loader" alt="loading" style="display:none;" />
    <svg width="1200" height="500"></svg>
</div><br/><hr/>
<?php echo "<h3>" . __( '3. Top 10 product reserve by money in the past 14 days/16 weeks/12 months/10 years:', 'dragonecommerce_trdom' ) . "</h3>"; ?>
<div id="dragonecommerce_chart_top10productreservemoney" class="dragonecommerce_chart money">
    <p>In this chart, Monday is used as the first day of a week. Only orders having status "reserved", "shipped", or "received" are included in the chart. The setting table's COMPANY_TIMEZONE_HOURS is used to make this chart based on your local time.</p>
    <p>Product reserve money amount is calculated by quantity * price. No shipping fee, handling fee, tax, discount, and coupon are included.</p>
    <select id="dragonecommerce_chart_top10productreservemoney_frequency" name="dragonecommerce_chart_top10productreservemoney_frequency" onchange="dragonecommercereservezyx987_createChart3();">
        <option value="-1">Please choose one...</option>
        <option value="14days" selected>in the past 14 days (including today)</option>
        <option value="16weeks">in the past 16 weeks (including this week)</option>
        <option value="12months">in the past 12 months (including this month)</option>
        <option value="10years">in the past 10 years (including this year)</option>                
    </select><img src="<?php echo plugin_dir_url( __FILE__ );  ?>images/loading.gif" id="admin_chart_top10productreservemoney_loader" alt="loading" style="display:none;" />
    <svg width="1800" height="500"></svg>
</div><br/><br/><hr/>
<?php echo "<h3>" . __( '4. Top 10 product reserve by quantity in the past 14 days/16 weeks/12 months/10 years:', 'dragonecommerce_trdom' ) . "</h3>"; ?>
<div id="dragonecommerce_chart_top10productreservequantity" class="dragonecommerce_chart">
    <p>In this chart, Monday is used as the first day of a week. Only orders having status "reserved", "shipped", or "received" are included in the chart. The setting table's COMPANY_TIMEZONE_HOURS is used to make this chart based on your local time.</p>
    <select id="dragonecommerce_chart_top10productreservequantity_frequency" name="dragonecommerce_chart_top10productreservequantity_frequency" onchange="dragonecommercereservezyx987_createChart4();">
        <option value="-1">Please choose one...</option>
        <option value="14days" selected>in the past 14 days (including today)</option>
        <option value="16weeks">in the past 16 weeks (including this week)</option>
        <option value="12months">in the past 12 months (including this month)</option>
        <option value="10years">in the past 10 years (including this year)</option>                
    </select><img src="<?php echo plugin_dir_url( __FILE__ );  ?>images/loading.gif" id="admin_chart_top10productreservequantity_loader" alt="loading" style="display:none;" />
    <svg width="1800" height="500"></svg>
</div><br/><hr/>
<?php echo "<h3>" . __( '5. Top 10 customers by money in the past 14 days/16 weeks/12 months/10 years:', 'dragonecommerce_trdom' ) . "</h3>"; ?>    
<div id="dragonecommerce_chart_top10clientsmoney" class="dragonecommerce_chart money">
    <p>In this chart, Monday is used as the first day of a week. Only orders having status "reserved", "shipped", or "received" are included in the chart. The setting table's COMPANY_TIMEZONE_HOURS is used to make this chart based on your local time.</p>
    <select id="dragonecommerce_chart_top10clientsmoney_frequency" name="dragonecommerce_chart_top10clientsmoney_frequency" onchange="dragonecommercereservezyx987_createChart5();">
        <option value="-1">Please choose one...</option>
        <option value="14days" selected>in the past 14 days (including today)</option>
        <option value="16weeks">in the past 16 weeks (including this week)</option>
        <option value="12months">in the past 12 months (including this month)</option>
        <option value="10years">in the past 10 years (including this year)</option>        
    </select><img src="<?php echo plugin_dir_url( __FILE__ );  ?>images/loading.gif" id="admin_chart_top10clientsmoney_loader" alt="loading" style="display:none;" />
    <svg width="1800" height="500"></svg>
</div><br/>
</div>
<div id="dragonecommerce_tabs_2">
<?php echo "<h3>" . __( '1. Reservation:', 'dragonecommerce_trdom' ) . "</h3>"; ?>
    <div id="dragonecommerce_order_container">
        <p>Search Product Name: <input type="text" id="dragonecommerce_order_productname" name="dragonecommerce_order_productname" class="" value="" size="50" /></p>
        <p>Search Username: <input type="text" id="dragonecommerce_order_username" name="dragonecommerce_order_username" class="" value="" size="50" /></p>    

        <p>Search Min Price: <input type="text" id="dragonecommerce_order_minprice" name="dragonecommerce_order_minprice" class="" value="" size="50" /></p>    
        <p>Search Max Price: <input type="text" id="dragonecommerce_order_maxprice" name="dragonecommerce_order_maxprice" class="" value="" size="50" /></p>    

        <p>Search From Date (UTC Time): <input type="text" id="dragonecommerce_order_fromdate" name="dragonecommerce_order_fromdate" class="dragonecommercereservezyx987_datetimepicker" value="" size="50" /></p>    
        <p>Search To Date (UTC Time): <input type="text" id="dragonecommerce_order_todate" name="dragonecommerce_order_todate" class="dragonecommercereservezyx987_datetimepicker" value="" size="50" /></p>    

        <p>Search Reservation Status: 
            <select id="dragonecommerce_order_status" name="dragonecommerce_order_status">
                <option value="-1">Please choose one...</option>
           <?php foreach ($activeprocessstatuses as $processstatus) { ?>
           <option value="<?php echo intval($processstatus->id); ?>" ><?php echo esc_html($processstatus->name); ?></option>
           <?php } ?>                
            </select>    
        </p>        
        
        <p>
        <input type="button" id="dragonecommerce_order_search" name="dragonecommerce_order_search" class="" value="Search" onclick="dragonecommercereservezyx987_getOrdersList();" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <input type="button" id="dragonecommerce_order_searchreset" name="dragonecommerce_order_searchreset" class="" value="Reset" onclick="dragonecommercereservezyx987_resetOrdersSearchParameters();" style="background-color:grey;"/>

        </p>    
        
        <p>Items per Page: 
            <select id="dragonecommerce_order_itemsperpage" name="dragonecommerce_order_itemsperpage" onchange="dragonecommercereservezyx987_getOrdersList();" class="">
                <option value="-1">Please choose one...</option>
                <option value="10" >10</option>
                <option value="20" >20</option>    
                <option value="40" >40</option>    
                <option value="60" >60</option>    
                <option value="80" >80</option>    
                <option value="100" >100</option>                    
            </select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            
            Sort By:
            <select id="dragonecommerce_order_sortby" name="dragonecommerce_order_sortby" onchange="dragonecommercereservezyx987_getOrdersList();" class="">
                <option value="-1">Please choose one...</option>
                <option value="id|asc" >ID low-high</option>
                <option value="id|desc" >ID high-low</option>    
                <option value="description|asc" >Description a-z</option>
                <option value="description|desc" >Description z-a</option>    
                <option value="total|asc" >Total Price low-high</option>    
                <option value="total|desc" >Total Price high-low</option>                
            </select>    
        </p>
    
        Total reservations: <span id="totalorderquantity"></span><img src="<?php echo plugin_dir_url( __FILE__ );  ?>images/loading.gif" id="admin_orderlist_loader" alt="loading" style="display:none;" />
        
        <div class="row master_pwrapper">
            <div class="col-xs-12 master_mypagination master_mypagination_admin_order" style="display: inline-block;"></div>
        </div>
        
        <table class="table table-bordered table-striped table-hover">
            <thead>
              <tr>
                  <th></th>
                <th>ID</th>
                <th>total</th>
                <th>status</th>
                <th>date(UTC)</th>
                <th>username</th>
                <th>details</th>
                <th>subtotal</th>
                <th>discount</th>
                <th>coupon</th>
                <th>shipping</th>
                <th>handling</th>
                <th>tax</th>    
                <th>discountfee</th>
                <th>couponfee</th>                
                <th>reserve email sent?</th>
                <th>cancel reserve email sent?</th>
                <th>cancel reserve time(UTC)</th>
                <th>cancel reserve refunded?</th>
                <th>cancel reserve refund time(UTC)</th>
                <th>description</th>                
              </tr>
            </thead>
            <tbody id="dragonecommerce_order">
            </tbody>
        </table>

        <div class="row master_pwrapper">
            <div class="col-xs-12 master_mypagination master_mypagination_admin_order" style="display: inline-block;"></div>
        </div>
        
    </div><hr/>
    
    <?php echo "<h3>" . __( '2. Process status:', 'dragonecommerce_trdom' ) . "</h3>"; ?>
    <?php echo "<h3>" .  __( '2.1 Create a new process status', 'dragonecommerce_trdom' ) . "</h3>" ?>
    <form name="dragonecommerce_form2_1" method="post" action="<?php echo str_replace( '%7E', '~', esc_html($_SERVER['REQUEST_URI'])); ?>" enctype="multipart/form-data">
        <input type="hidden" name="dragonecommercereservezyx987_hidden" value="Y">
        <input type="hidden" name="dragonecommercereservezyx987_hidden_security" value="<?php echo wp_create_nonce("dragonecommercereservezyx987_addProcessstatus"); ?>">
                
        <p><?php _e("Process Status Name *: " ); ?><input type="text" name="dragonecommercereservezyx987_addprocessstatusname" value="" size="100"><?php _e(" e.g. Cancelled" ); ?></p>
        <p><?php _e("Description: " ); ?><br/><textarea name="dragonecommercereservezyx987_addprocessstatusdescription" rows="4" cols="100"></textarea><br/></p>
               
        <p class="submit">
            <input type="submit" name="Submit" onclick="return dragonecommercereservezyx987_validateInput();" value="<?php _e('Create Process Status', 'dragonecommerce_trdom' ) ?>" />
        </p>
    </form>    
        <hr />
    <?php echo "<h3>" .  __( '2.2 Process status list', 'dragonecommerce_trdom' ) . "</h3>" ?>        
    <div id="dragonecommerce_processstatus_container">
        <p>Search Name: <input type="text" id="dragonecommerce_processstatus_name" name="dragonecommerce_processstatus_name" class="" value="" size="50" /></p>
        <p>Search Process Status Status: 
            <select id="dragonecommerce_processstatus_status" name="dragonecommerce_processstatus_status">
                <option value="-1">Please choose one...</option>
                <option value="0" >Not active</option>
                   <option value="1" >Active</option>            
            </select>    
        </p>
        
        <p>
        <input type="button" id="dragonecommerce_processstatus_search" name="dragonecommerce_processstatus_search" class="" value="Search" onclick="dragonecommercereservezyx987_getProcessstatusesList();" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <input type="button" id="dragonecommerce_processstatus_searchreset" name="dragonecommerce_processstatus_searchreset" class="" value="Reset" onclick="dragonecommercereservezyx987_resetProcessstatusesSearchParameters();" style="background-color:grey;"/>
        </p>    
        
        <p>Items per Page: 
            <select id="dragonecommerce_processstatus_itemsperpage" name="dragonecommerce_processstatus_itemsperpage" onchange="dragonecommercereservezyx987_getProcessstatusesList();" class="">
                <option value="-1">Please choose one...</option>
                <option value="10" >10</option>
                <option value="20" >20</option>    
                <option value="40" >40</option>    
                <option value="60" >60</option>    
                <option value="80" >80</option>    
                <option value="100" >100</option>                    
            </select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            
            Sort By:
            <select id="dragonecommerce_processstatus_sortby" name="dragonecommerce_processstatus_sortby" onchange="dragonecommercereservezyx987_getProcessstatusesList();" class="">
                <option value="-1">Please choose one...</option>
                <option value="id|asc" >ID low-high</option>
                <option value="id|desc" >ID high-low</option>
                <option value="name|asc" >Name a-z</option>
                <option value="name|desc" >Name z-a</option>
                <option value="createtimeutc|asc" >Created Date old-new</option>
                <option value="createtimeutc|desc" >Created Date new-old</option>                
            </select>    
        </p>    
        
        Total process statuses: <span id="totalprocessstatusquantity"></span><img src="<?php echo plugin_dir_url( __FILE__ );  ?>images/loading.gif" id="admin_processstatuslist_loader" alt="loading" style="display:none;" />
        
        <div class="row master_pwrapper">
            <div class="col-xs-12 master_mypagination master_mypagination_admin_processstatus" style="display: inline-block;"></div>
        </div>

        <table class="table table-bordered table-striped table-hover">
            <thead>
              <tr>
                <th></th>
                <th>ID</th>
                <th>Name</th>
                <th>Description</th>
                <th>Created Date(UTC)</th>
                <th>Status</th>
              </tr>
            </thead>
            <tbody id="dragonecommerce_processstatus">
            </tbody>
        </table>

        <div class="row master_pwrapper">
            <div class="col-xs-12 master_mypagination master_mypagination_admin_processstatus" style="display: inline-block;"></div>
        </div>        
    </div><hr/>
    
    <?php echo "<h3>" . __( '3. Product:', 'dragonecommerce_trdom' ) . "</h3>"; ?>

    <?php echo "<h3>" . __( '3.1 Add a new product', 'dragonecommerce_trdom' ) . "</h3>" ?>
    <form name="dragonecommerce_form3_1" method="post" action="<?php echo str_replace( '%7E', '~', esc_html($_SERVER['REQUEST_URI'])); ?>" enctype="multipart/form-data">
        <input type="hidden" name="dragonecommercereservezyx987_hidden" value="Y">
        <input type="hidden" name="dragonecommercereservezyx987_hidden_security" value="<?php echo wp_create_nonce("dragonecommercereservezyx987_addProduct"); ?>">
        
        <p><?php _e("Name *: " ); ?><input type="text" name="dragonecommercereservezyx987_addproductname" value="" size="100"><?php _e(" e.g. Camera" ); ?></p>
        <p><?php _e("Price *: " ); ?><input type="text" name="dragonecommercereservezyx987_addproductprice" value="" size="100"><?php _e(" e.g. 32.50" ); ?></p>
        <p><?php _e("Department *: " ); ?>
        <select id="dragonecommercereservezyx987_department" name="dragonecommercereservezyx987_addproductdepartment" class="presetto_1">
           <option value="-1">Please select one...</option>
           <?php foreach ($alldepartments as $department) { ?>
           <option value="<?php echo intval($department->id); ?>" ><?php echo esc_html($department->name) . "(" . intval($department->id) . ")"; ?></option>
           <?php } ?>
         </select></p>

        <p><?php _e("Quantity: " ); ?><input type="text" name="dragonecommercereservezyx987_addproductquantity" value="" size="100"><?php _e(" e.g. 300" ); ?></p>

        <p><?php _e("Weight(lb): " ); ?><input type="text" name="dragonecommercereservezyx987_addproductweightlb" value="" size="100"><?php _e(" e.g. 12.50" ); ?></p>
        <p><?php _e("Barcode: " ); ?><input type="text" name="dragonecommercereservezyx987_addproductbarcode" value="" size="100"><?php _e(" e.g. 012345678912" ); ?></p> 
        <p><?php _e("UUID: " ); ?><input type="text" name="dragonecommercereservezyx987_addproductuuid" value="" size="100"><?php _e(" e.g. 012-345-6789-12" ); ?></p> 

        <p><?php _e("Description: " ); ?><br/><textarea name="dragonecommercereservezyx987_addproductdescription" rows="4" cols="100"></textarea><br/></p>

        <p><?php _e("Group: " ); ?>
        <select id="dragonecommercereservezyx987_addproductgroup" class="presetto_1" name="dragonecommercereservezyx987_addproductgroup" >
           <option value="-1">Please select one...</option>
           <?php foreach ($allgroups as $group) { ?>
           <option value="<?php echo intval($group->id); ?>" ><?php echo esc_html($group->name) . "(" . intval($group->id) . ")"; ?></option>
           <?php } ?>
         </select></p>
        
        <input type="hidden" id="dragonecommercereservezyx987_addproductlocationarray" name="dragonecommercereservezyx987_addproductlocationarray" value="">  
                
        <input type="submit" name="Submit" onclick="return dragonecommercereservezyx987_validateInput(dragonecommercereservezyx987_addProductLocationsandGroups);" value="<?php _e('Create Product', 'dragonecommerce_trdom' ) ?>" />
    </form><hr />
        
    <?php echo "<h3>" . __( '3.2 Product list', 'dragonecommerce_trdom' ) . "</h3>" ?>    
    <div id="dragonecommerce_product_container">
        <p>Search Name: <input type="text" id="dragonecommerce_product_name" name="dragonecommerce_product_name" class="" value="" size="50" /></p>
        <p>Search Department: 
        <select id="dragonecommerce_product_department" name="dragonecommerce_product_department" class="presetto_1">
           <option value="-1">Please choose one...</option>
           <?php foreach ($alldepartments as $department) { ?>
           <option value="<?php echo intval($department->id); ?>" style="<?php echo $department->status === '1' ? '' : 'color:grey;'; ?>"><?php echo esc_html($department->name) . "(" . intval($department->id) . ")"; ?></option>
           <?php } ?>
         </select></p>

        <p>Search Barcode: <input type="text" id="dragonecommerce_product_barcode" name="dragonecommerce_product_barcode" class="" value="" size="50" /></p>    

        <p>Search Min Price: <input type="text" id="dragonecommerce_product_minprice" name="dragonecommerce_product_minprice" class="" value="" size="50" /></p>    
        <p>Search Max Price: <input type="text" id="dragonecommerce_product_maxprice" name="dragonecommerce_product_maxprice" class="" value="" size="50" /></p>    

        <p>Search Created From Date (UTC Time): <input type="text" id="dragonecommerce_product_fromdate" name="dragonecommerce_product_fromdate" class="dragonecommercereservezyx987_datetimepicker" value="" size="50" /></p>    
        <p>Search Created To Date (UTC Time): <input type="text" id="dragonecommerce_product_todate" name="dragonecommerce_product_todate" class="dragonecommercereservezyx987_datetimepicker" value="" size="50" /></p>            

        <p>Search Is On Sale: 
            <select id="dragonecommerce_product_isonsale" name="dragonecommerce_product_isonsale">
                <option value="-1">Please choose one...</option>
                <option value="1" >Yes</option>
                <option value="0" >No</option>
            </select>    
        </p>    

        <p>Search Is Tax Free: 
            <select id="dragonecommerce_product_istaxfree" name="dragonecommerce_product_istaxfree">
                <option value="-1">Please choose one...</option>
                <option value="1" >Yes</option>
                <option value="0" >No</option>        
            </select>    
        </p>    
        
        <p>
        <input type="button" id="dragonecommerce_product_search" name="dragonecommerce_product_search" class="" value="Search" onclick="dragonecommercereservezyx987_getProductsList();" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <input type="button" id="dragonecommerce_product_searchreset" name="dragonecommerce_product_searchreset" class="" value="Reset" onclick="dragonecommercereservezyx987_resetProductsSearchParameters();" style="background-color:grey;"/>
        </p>    
        
        <p>Items per Page: 
            <select id="dragonecommerce_product_itemsperpage" name="dragonecommerce_product_itemsperpage" onchange="dragonecommercereservezyx987_getProductsList();" class="">
                <option value="-1">Please choose one...</option>
                <option value="10" >10</option>
                <option value="20" >20</option>    
                <option value="40" >40</option>    
                <option value="60" >60</option>    
                <option value="80" >80</option>    
                <option value="100" >100</option>                    
            </select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            
            Sort By:
            <select id="dragonecommerce_product_sortby" name="dragonecommerce_product_sortby" onchange="dragonecommercereservezyx987_getProductsList();" class="">
                <option value="-1">Please choose one...</option>
                <option value="id|asc" >ID low-high</option>
                <option value="id|desc" >ID high-low</option>    
                <option value="name|asc" >Name a-z</option>
                <option value="name|desc" >Name z-a</option>    
                <option value="price|asc" >Price low-high</option>    
                <option value="price|desc" >Price high-low</option>
                <option value="createtimeutc|asc" >Created Date old-new</option>    
                <option value="createtimeutc|desc" >Created Date new-old</option>                    
            </select>    
        </p>
        
        Total active products: <span id="totalproductquantity"></span><img src="<?php echo plugin_dir_url( __FILE__ );  ?>images/loading.gif" id="admin_productlist_loader" alt="loading" style="display:none;" />
        <p style="color:brown;">To use sale price, you must set "Is On Sale" to "Yes".</p>
        <div class="row master_pwrapper">
            <div class="col-xs-12 master_mypagination master_mypagination_admin_product" style="display: inline-block;"></div>
        </div>
        
        <table class="table table-bordered table-striped table-hover">
            <thead>
              <tr>
                <th></th>
                <th>ID</th>
                <th>name</th>
                <th>description</th>
                <th>department</th>
                <th>weight(lb)</th>
                <th>price</th>
                <th>sale price</th>
                <th>on sale</th>
                <th>tax free</th>
                <th>on sale start date(UTC)</th>
                <th>on sale end date(UTC)</th>                
                <th>quantity</th>
                <th>original quantity</th>
                <th>barcode</th>
                <th>created(UTC)</th>
              </tr>
            </thead>
            <tbody id="dragonecommerce_product">
            </tbody>
        </table>
         
        <div class="row master_pwrapper">
            <div class="col-xs-12 master_mypagination master_mypagination_admin_product" style="display: inline-block;"></div>
        </div>        
    </div><hr/>
    
    <?php echo "<h3>" . __( '4. DISABLED product:', 'dragonecommerce_trdom' ) . "</h3>"; ?>
    <div id="dragonecommerce_disabledproduct_container">
        <p>Search Name: <input type="text" id="dragonecommerce_disabledproduct_name" name="dragonecommerce_disabledproduct_name" class="" value="" size="50" /></p>
        <p>Search Department: 
        <select id="dragonecommerce_disabledproduct_department" name="dragonecommerce_disabledproduct_department" class="presetto_1">
           <option value="-1">Please choose one...</option>
           <?php foreach ($alldepartments as $department) { ?>
           <option value="<?php echo intval($department->id); ?>" style="<?php echo $department->status === '1' ? '' : 'color:grey;'; ?>"><?php echo esc_html($department->name) . "(" . intval($department->id) . ")"; ?></option>
           <?php } ?>
         </select></p>

        <p>Search Barcode: <input type="text" id="dragonecommerce_disabledproduct_barcode" name="dragonecommerce_disabledproduct_barcode" class="" value="" size="50" /></p>    

        <p>Search Min Price: <input type="text" id="dragonecommerce_disabledproduct_minprice" name="dragonecommerce_disabledproduct_minprice" class="" value="" size="50" /></p>    
        <p>Search Max Price: <input type="text" id="dragonecommerce_disabledproduct_maxprice" name="dragonecommerce_disabledproduct_maxprice" class="" value="" size="50" /></p>    

        <p>Search Created From Date (UTC Time): <input type="text" id="dragonecommerce_disabledproduct_fromdate" name="dragonecommerce_disabledproduct_fromdate" class="dragonecommercereservezyx987_datetimepicker" value="" size="50" /></p>    
        <p>Search Created To Date (UTC Time): <input type="text" id="dragonecommerce_disabledproduct_todate" name="dragonecommerce_disabledproduct_todate" class="dragonecommercereservezyx987_datetimepicker" value="" size="50" /></p>            

        <p>Search Is On Sale: 
            <select id="dragonecommerce_disabledproduct_isonsale" name="dragonecommerce_disabledproduct_isonsale">
                <option value="-1">Please choose one...</option>
                <option value="1" >Yes</option>
                <option value="0" >No</option>
            </select>    
        </p>    

        <p>Search Is Tax Free: 
            <select id="dragonecommerce_disabledproduct_istaxfree" name="dragonecommerce_disabledproduct_istaxfree">
                <option value="-1">Please choose one...</option>
                <option value="1" >Yes</option>
                <option value="0" >No</option>        
            </select>    
        </p>
        
        <p>
        <input type="button" id="dragonecommerce_disabledproduct_search" name="dragonecommerce_disabledproduct_search" class="" value="Search" onclick="dragonecommercereservezyx987_getDisabledproductsList();" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <input type="button" id="dragonecommerce_disabledproduct_searchreset" name="dragonecommerce_disabledproduct_searchreset" class="" value="Reset" onclick="dragonecommercereservezyx987_resetDisabledProductsSearchParameters();" style="background-color:grey;"/>
        </p>    
        
        <p>Items per Page: 
            <select id="dragonecommerce_disabledproduct_itemsperpage" name="dragonecommerce_disabledproduct_itemsperpage" onchange="dragonecommercereservezyx987_getDisabledproductsList();" class="">
                <option value="-1">Please choose one...</option>
                <option value="10" >10</option>
                <option value="20" >20</option>    
                <option value="40" >40</option>    
                <option value="60" >60</option>    
                <option value="80" >80</option>    
                <option value="100" >100</option>                    
            </select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            
            Sort By:
            <select id="dragonecommerce_disabledproduct_sortby" name="dragonecommerce_disabledproduct_sortby" onchange="dragonecommercereservezyx987_getDisabledproductsList();" class="">
                <option value="-1">Please choose one...</option>
                <option value="id|asc" >ID low-high</option>
                <option value="id|desc" >ID high-low</option>    
                <option value="name|asc" >Name a-z</option>
                <option value="name|desc" >Name z-a</option>    
                <option value="price|asc" >Price low-high</option>    
                <option value="price|desc" >Price high-low</option>
                <option value="createtimeutc|asc" >Created Date old-new</option>    
                <option value="createtimeutc|desc" >Created Date new-old</option>                    
            </select>    
        </p>
        
        Total disabled products: <span id="totaldisabledproductquantity"></span><img src="<?php echo plugin_dir_url( __FILE__ );  ?>images/loading.gif" id="admin_disabledproductlist_loader" alt="loading" style="display:none;" />
        
        <div class="row master_pwrapper">
            <div class="col-xs-12 master_mypagination master_mypagination_admin_disabledproduct" style="display: inline-block;"></div>
        </div>
        
        <table class="table table-bordered table-striped table-hover">
            <thead>
              <tr>
                <th></th>
                <th>ID</th>
                <th>name</th>
                <th>description</th>
                <th>department</th>
                <th>weight(lb)</th>
                <th>price</th>
                <th>sale price</th>
                <th>on sale</th>
                <th>tax free</th>
                <th>quantity</th>
                <th>original quantity</th>
                <th>barcode</th>
                <th>created(UTC)</th>
              </tr>
            </thead>
            <tbody id="dragonecommerce_disabledproduct">
            </tbody>
        </table>

        <div class="row master_pwrapper">
            <div class="col-xs-12 master_mypagination master_mypagination_admin_disabledproduct" style="display: inline-block;"></div>
        </div>        
    </div><hr/>

    <?php echo "<h3>" . __( '5. User:', 'dragonecommerce_trdom' ) . "</h3>"; ?>
    <?php echo "<h3>" .  __( '5.1 Create a new user', 'dragonecommerce_trdom' ) . "</h3>" ?>
    <p>Please log out and go to the ecommerce home page to register a new user.</p>
    <form name="dragonecommerce_form5_1" method="post" action="<?php echo str_replace( '%7E', '~', esc_html($_SERVER['REQUEST_URI'])); ?>" enctype="multipart/form-data">
        <input type="hidden" name="dragonecommercereservezyx987_hidden" value="Y">
        <input type="hidden" name="dragonecommercereservezyx987_hidden_security" value="<?php echo wp_create_nonce("dragonecommercereservezyx987_getUsers"); ?>">
    </form>
        
    <?php echo "<h3>" .  __( '5.2 User list', 'dragonecommerce_trdom' ) . "</h3>" ?>
    <div id="dragonecommerce_user_container">
        <p>Search Username: <input type="text" id="dragonecommerce_user_username" name="dragonecommerce_user_username" class="" value="" size="50" /></p>
        <p>Search Email: <input type="text" id="dragonecommerce_user_email" name="dragonecommerce_user_email" class="" value="" size="50" /></p>
        <p>Search Created From Date (UTC Time): <input type="text" id="dragonecommerce_user_fromdate" name="dragonecommerce_user_fromdate" class="dragonecommercereservezyx987_datetimepicker" value="" size="50" /></p>    
        <p>Search Created To Date (UTC Time): <input type="text" id="dragonecommerce_user_todate" name="dragonecommerce_user_todate" class="dragonecommercereservezyx987_datetimepicker" value="" size="50" /></p>
        <p>Search User Status: 
            <select id="dragonecommerce_user_status" name="dragonecommerce_user_status">
                <option value="-1">Please choose one...</option>
                <option value="0" >Not active</option>
                   <option value="1" >Active</option>            
            </select>    
        </p>        
        <p>
        <input type="button" id="dragonecommerce_user_search" name="dragonecommerce_user_search" class="" value="Search" onclick="dragonecommercereservezyx987_getUsersList();" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <input type="button" id="dragonecommerce_user_searchreset" name="dragonecommerce_user_searchreset" class="" value="Reset" onclick="dragonecommercereservezyx987_resetUsersSearchParameters();" style="background-color:grey;"/>
        </p>    
        
        <p>Items per Page: 
            <select id="dragonecommerce_user_itemsperpage" name="dragonecommerce_user_itemsperpage" onchange="dragonecommercereservezyx987_getUsersList();" class="">
                <option value="-1">Please choose one...</option>
                <option value="10" >10</option>
                <option value="20" >20</option>    
                <option value="40" >40</option>    
                <option value="60" >60</option>    
                <option value="80" >80</option>    
                <option value="100" >100</option>                    
            </select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            
            Sort By:
            <select id="dragonecommerce_user_sortby" name="dragonecommerce_user_sortby" onchange="dragonecommercereservezyx987_getUsersList();" class="">
                <option value="-1">Please choose one...</option>
                <option value="id|asc" >ID low-high</option>
                <option value="id|desc" >ID high-low</option>    
                <option value="username|asc" >Username a-z</option>
                <option value="username|desc" >Username z-a</option>    
                <option value="email|asc" >Email low-high</option>    
                <option value="email|desc" >Email high-low</option>
                <option value="createtimeutc|asc" >Created Date old-new</option>    
                <option value="createtimeutc|desc" >Created Date new-old</option>                    
            </select>    
        </p>    
        
        Total users: <span id="totaluserquantity"></span><img src="<?php echo plugin_dir_url( __FILE__ );  ?>images/loading.gif" id="admin_userlist_loader" alt="loading" style="display:none;" />
        
        <div class="row master_pwrapper">
            <div class="col-xs-12 master_mypagination master_mypagination_admin_user" style="display: inline-block;"></div>
        </div>
        
        <table class="table table-bordered table-striped table-hover">
            <thead>
              <tr>
                <th></th>
                <th>User ID</th>
                <th>Username</th>
                <th>Email</th>
                <th>Status</th>
                <th>Admin Approved</th>
                <th>Registered Date</th>
              </tr>
            </thead>
            <tbody id="dragonecommerce_user">
            </tbody>
        </table>

        <div class="row master_pwrapper">
            <div class="col-xs-12 master_mypagination master_mypagination_admin_user" style="display: inline-block;"></div>
        </div>        
    </div><hr/>
    
    <?php echo "<h3>" . __( '6. Country:', 'dragonecommerce_trdom' ) . "</h3>"; ?>
    <?php echo "<h3>" .  __( '6.1 Create a new country', 'dragonecommerce_trdom' ) . "</h3>" ?>
    <form name="dragonecommerce_form6_1" method="post" action="<?php echo str_replace( '%7E', '~', esc_html($_SERVER['REQUEST_URI'])); ?>" enctype="multipart/form-data">
        <input type="hidden" name="dragonecommercereservezyx987_hidden" value="Y">
        <input type="hidden" name="dragonecommercereservezyx987_hidden_security" value="<?php echo wp_create_nonce("dragonecommercereservezyx987_addCountry"); ?>">        
        <p><?php _e("Country Name *: " ); ?><input type="text" name="dragonecommercereservezyx987_addcountryname" value="" size="100"></p>
        <p><?php _e("Country Abbreviation *: " ); ?><input type="text" name="dragonecommercereservezyx987_addcountryabbreviation" value="" size="100"></p>

        <p><?php _e("Description: " ); ?><br/><textarea name="dragonecommercereservezyx987_addcountrydescription" rows="4" cols="100"></textarea><br/></p>             
        <p class="submit">
            <input type="submit" name="Submit" onclick="return dragonecommercereservezyx987_validateInput();" value="<?php _e('Create Country', 'dragonecommerce_trdom' ) ?>" />
        </p>
    </form><hr />
        
    <?php echo "<h3>" .  __( '6.2 Country list', 'dragonecommerce_trdom' ) . "</h3>" ?>        
    <div id="dragonecommerce_country_container">
        <p>Search Name: <input type="text" id="dragonecommerce_country_name" name="dragonecommerce_country_name" class="" value="" size="50" /></p>
        <p>Search Country Status: 
            <select id="dragonecommerce_country_status" name="dragonecommerce_country_status">
                <option value="-1">Please choose one...</option>
                <option value="0" >Not active</option>
                   <option value="1" >Active</option>            
            </select>    
        </p>
        
        <p>
        <input type="button" id="dragonecommerce_country_search" name="dragonecommerce_country_search" class="" value="Search" onclick="dragonecommercereservezyx987_getCountriesList();" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <input type="button" id="dragonecommerce_country_searchreset" name="dragonecommerce_country_searchreset" class="" value="Reset" onclick="dragonecommercereservezyx987_resetCountriesSearchParameters();" style="background-color:grey;"/>
        </p>    
        
        <p>Items per Page: 
            <select id="dragonecommerce_country_itemsperpage" name="dragonecommerce_country_itemsperpage" onchange="dragonecommercereservezyx987_getCountriesList();" class="">
                <option value="-1">Please choose one...</option>
                <option value="10" >10</option>
                <option value="20" >20</option>    
                <option value="40" >40</option>    
                <option value="60" >60</option>    
                <option value="80" >80</option>    
                <option value="100" >100</option>                    
            </select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            
            Sort By:
            <select id="dragonecommerce_country_sortby" name="dragonecommerce_country_sortby" onchange="dragonecommercereservezyx987_getCountriesList();" class="">
                <option value="-1">Please choose one...</option>
                <option value="id|asc" >ID low-high</option>
                <option value="id|desc" >ID high-low</option>
                <option value="name|asc" >Name a-z</option>
                <option value="name|desc" >Name z-a</option>
                <option value="abbreviation|asc" >Abbreviation a-z</option>
                <option value="abbreviation|desc" >Abbreviation z-a</option>
                <option value="createtimeutc|asc" >Created Date old-new</option>
                <option value="createtimeutc|desc" >Created Date new-old</option>                
            </select>    
        </p>    
        
        Total countries: <span id="totalcountryquantity"></span><img src="<?php echo plugin_dir_url( __FILE__ );  ?>images/loading.gif" id="admin_countrylist_loader" alt="loading" style="display:none;" />
        
        <div class="row master_pwrapper">
            <div class="col-xs-12 master_mypagination master_mypagination_admin_country" style="display: inline-block;"></div>
        </div>
        <table class="table table-bordered table-striped table-hover">
            <thead>
              <tr>
                <th></th>
                <th>ID</th>
                <th>Name</th>
                <th>Abbreviation</th>
                <th>Description</th>
                <th>Created Date(UTC)</th>
                <th>Status</th>
              </tr>
            </thead>
            <tbody id="dragonecommerce_country">
            </tbody>
        </table>

        <div class="row master_pwrapper">
            <div class="col-xs-12 master_mypagination master_mypagination_admin_country" style="display: inline-block;"></div>
        </div>        
    </div><hr/>

    <?php echo "<h3>" . __( '7. Province/State:', 'dragonecommerce_trdom' ) . "</h3>"; ?>
    <?php echo "<h3>" .  __( '7.1 Create a new province/state', 'dragonecommerce_trdom' ) . "</h3>" ?>
    <form name="dragonecommerce_form7_1" method="post" action="<?php echo str_replace( '%7E', '~', esc_html($_SERVER['REQUEST_URI'])); ?>" enctype="multipart/form-data">
        <input type="hidden" name="dragonecommercereservezyx987_hidden" value="Y">
        <input type="hidden" name="dragonecommercereservezyx987_hidden_security" value="<?php echo wp_create_nonce("dragonecommercereservezyx987_addProvince"); ?>">        
        <p><?php _e("Country *: "); ?>
        <select id="dragonecommercereservezyx987_addprovincecountry"  name="dragonecommercereservezyx987_addprovincecountry" class="presetto_1">
           <option value="-1">Please choose one...</option>
           <?php foreach ($activecountries as $country) { ?>
           <option value="<?php echo intval($country->id); ?>" ><?php echo esc_html($country->name); ?></option>
           <?php } ?>
         </select></p>
        
        <p><?php _e("Province/State Name *: " ); ?><input type="text" name="dragonecommercereservezyx987_addprovincename" value="" size="100"></p>
        <p><?php _e("Description: " ); ?><br/><textarea name="dragonecommercereservezyx987_addprovincedescription" rows="4" cols="100"></textarea><br/></p>
               
        <p class="submit">
            <input type="submit" name="Submit" onclick="return dragonecommercereservezyx987_validateInput();" value="<?php _e('Create Province or State', 'dragonecommerce_trdom' ) ?>" />
        </p>
    </form><hr />
        
    <?php echo "<h3>" .  __( '7.2 Province/State list', 'dragonecommerce_trdom' ) . "</h3>" ?>    
    <div id="dragonecommerce_province_container">
        <p>Search Province/State Name: <input type="text" id="dragonecommerce_province_name" name="dragonecommerce_province_name" class="" value="" size="50" /></p>
        <p>Search Country: 
        <select id="dragonecommerce_province_countryid" name="dragonecommerce_province_countryid" class="presetto_1">
           <option value="-1">Please choose one...</option>
           <?php foreach ($allcountries as $country) { ?>
           <option value="<?php echo intval($country->id); ?>" style="<?php echo $country->status === '1' ? '' : 'color:grey;'; ?>"><?php echo esc_html($country->name); ?></option>
           <?php } ?>
         </select></p>
        <p>Search Province/State Status: 
            <select id="dragonecommerce_province_status" name="dragonecommerce_province_status">
                <option value="-1">Please choose one...</option>
                <option value="0" >Not active</option>
                   <option value="1" >Active</option>            
            </select>    
        </p>
        
        <p>
        <input type="button" id="dragonecommerce_province_search" name="dragonecommerce_province_search" class="" value="Search" onclick="dragonecommercereservezyx987_getProvincesList();" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <input type="button" id="dragonecommerce_province_searchreset" name="dragonecommerce_province_searchreset" class="" value="Reset" onclick="dragonecommercereservezyx987_resetProvincesSearchParameters();" style="background-color:grey;"/>
        </p>    
        
        <p>Items per Page: 
            <select id="dragonecommerce_province_itemsperpage" name="dragonecommerce_province_itemsperpage" onchange="dragonecommercereservezyx987_getProvincesList();" class="">
                <option value="-1">Please choose one...</option>
                <option value="10" >10</option>
                <option value="20" >20</option>    
                <option value="40" >40</option>    
                <option value="60" >60</option>    
                <option value="80" >80</option>    
                <option value="100" >100</option>                    
            </select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            
            Sort By:
            <select id="dragonecommerce_province_sortby" name="dragonecommerce_province_sortby" onchange="dragonecommercereservezyx987_getProvincesList();" class="">
                <option value="-1">Please choose one...</option>
                <option value="id|asc" >ID low-high</option>
                <option value="id|desc" >ID high-low</option>
                <option value="name|asc" >Name a-z</option>
                <option value="name|desc" >Name z-a</option>
                <option value="countryname|asc" >Country a-z</option>
                <option value="countryname|desc" >Country z-a</option>
                <option value="createtimeutc|asc" >Created Date old-new</option>
                <option value="createtimeutc|desc" >Created Date new-old</option>                
            </select>    
        </p>    
        
        Total provinces/states: <span id="totalprovincequantity"></span><img src="<?php echo plugin_dir_url( __FILE__ );  ?>images/loading.gif" id="admin_provincelist_loader" alt="loading" style="display:none;" />
        
        <div class="row master_pwrapper">
            <div class="col-xs-12 master_mypagination master_mypagination_admin_province" style="display: inline-block;"></div>
        </div>

        <table class="table table-bordered table-striped table-hover">
            <thead>
              <tr>
                <th></th>
                <th>ID</th>
                <th>Name</th>
                <th>Description</th>
                <th>Country</th>
                <th>Created Date(UTC)</th>
                <th>Status</th>
              </tr>
            </thead>
            <tbody id="dragonecommerce_province">
            </tbody>
        </table>

        <div class="row master_pwrapper">
            <div class="col-xs-12 master_mypagination master_mypagination_admin_province" style="display: inline-block;"></div>
        </div>        
    </div><hr/>

    <?php echo "<h3>" . __( '8. City:', 'dragonecommerce_trdom' ) . "</h3>"; ?>
    <?php echo "<h3>" .  __( '8.1 Create a new city', 'dragonecommerce_trdom' ) . "</h3>" ?>
    <form name="dragonecommerce_form8_1" method="post" action="<?php echo str_replace( '%7E', '~', esc_html($_SERVER['REQUEST_URI'])); ?>" enctype="multipart/form-data">
        <input type="hidden" name="dragonecommercereservezyx987_hidden" value="Y">
        <input type="hidden" name="dragonecommercereservezyx987_hidden_security" value="<?php echo wp_create_nonce("dragonecommercereservezyx987_addCity"); ?>">        
        <p><?php _e("Country *: "); ?>
        <select id="dragonecommercereservezyx987_addcitycountry"  name="dragonecommercereservezyx987_addcitycountry" class="countrydropdownlist presetto_1" onchange="dragonecommercereservezyx987_updateProvincesDropdownList(this);">
           <option value="-1">Please choose one...</option>
           <?php foreach ($allcountries as $country) { ?>
           <option value="<?php echo intval($country->id); ?>" ><?php echo esc_html($country->name); ?></option>
           <?php } ?>
         </select></p>        
        <p><?php _e("Province/State *: "); ?>
        <select id="dragonecommercereservezyx987_addcityprovince" name="dragonecommercereservezyx987_addcityprovince" class="presetto_1">
           <option value="-1">Please choose one...</option>
           <?php foreach ($allprovinces as $province) { ?>
           <option class="<?php echo intval($province->countryid); ?>" value="<?php echo intval($province->id); ?>" style="display:none;<?php echo $province->status === '1' ? '' : 'color:grey;'; ?>"><?php echo esc_html($province->name); ?></option>
           <?php } ?>
         </select></p>        
        <p><?php _e("City Name *: " ); ?><input type="text" name="dragonecommercereservezyx987_addcityname" value="" size="100"></p>
        <p><?php _e("Description: " ); ?><br/><textarea name="dragonecommercereservezyx987_addcitydescription" rows="4" cols="100"></textarea><br/></p>
               
        <p class="submit">
            <input type="submit" name="Submit" onclick="return dragonecommercereservezyx987_validateInput();" value="<?php _e('Create City', 'dragonecommerce_trdom' ) ?>" />
        </p>
    </form><hr />
        
    <?php echo "<h3>" .  __( '8.2 City list', 'dragonecommerce_trdom' ) . "</h3>" ?>    
    <div id="dragonecommerce_city_container">
        <p>Search City Name: <input type="text" id="dragonecommerce_city_name" name="dragonecommerce_city_name" class="" value="" size="50" /></p>
        <p>Search Country: 
        <select id="dragonecommerce_city_countryid" name="dragonecommerce_city_countryid" class="presetto_1" onchange="dragonecommercereservezyx987_updateProvincesDropdownList(this);">
           <option value="-1">Please choose one...</option>
           <?php foreach ($allcountries as $country) { ?>
           <option value="<?php echo intval($country->id); ?>" style="<?php echo $country->status === '1' ? '' : 'color:grey;'; ?>"><?php echo esc_html($country->name); ?></option>
           <?php } ?>
         </select></p>
        <p>Search Province/State: 
        <select id="dragonecommerce_city_provinceid" name="dragonecommerce_city_provinceid" class="presetto_1">
           <option value="-1">Please choose one...</option>
           <?php foreach ($allprovinces as $province) { ?>
           <option class="<?php echo intval($province->countryid); ?>" value="<?php echo intval($province->id); ?>" style="<?php echo $province->status === '1' ? '' : 'color:grey;'; ?>"><?php echo esc_html($province->name); ?></option>
           <?php } ?>
         </select></p>                
        <p>Search City Status: 
            <select id="dragonecommerce_city_status" name="dragonecommerce_city_status">
                <option value="-1">Please choose one...</option>
                <option value="0" >Not active</option>
                   <option value="1" >Active</option>            
            </select>    
        </p>
        
        <p>
        <input type="button" id="dragonecommerce_city_search" name="dragonecommerce_city_search" class="" value="Search" onclick="dragonecommercereservezyx987_getCitiesList();" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <input type="button" id="dragonecommerce_city_searchreset" name="dragonecommerce_city_searchreset" class="" value="Reset" onclick="dragonecommercereservezyx987_resetCitiesSearchParameters();" style="background-color:grey;"/>
        </p>    
        
        <p>Items per Page: 
            <select id="dragonecommerce_city_itemsperpage" name="dragonecommerce_city_itemsperpage" onchange="dragonecommercereservezyx987_getCitiesList();" class="">
                <option value="-1">Please choose one...</option>
                <option value="10" >10</option>
                <option value="20" >20</option>    
                <option value="40" >40</option>    
                <option value="60" >60</option>    
                <option value="80" >80</option>    
                <option value="100" >100</option>                    
            </select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            
            Sort By:
            <select id="dragonecommerce_city_sortby" name="dragonecommerce_city_sortby" onchange="dragonecommercereservezyx987_getCitiesList();" class="">
                <option value="-1">Please choose one...</option>
                <option value="id|asc" >ID low-high</option>
                <option value="id|desc" >ID high-low</option>
                <option value="name|asc" >Name a-z</option>
                <option value="name|desc" >Name z-a</option>
                <option value="countryname|asc" >Country a-z</option>
                <option value="countryname|desc" >Country z-a</option>
                <option value="createtimeutc|asc" >Created Date old-new</option>
                <option value="createtimeutc|desc" >Created Date new-old</option>                
            </select>    
        </p>    
        
        Total cities: <span id="totalcityquantity"></span><img src="<?php echo plugin_dir_url( __FILE__ );  ?>images/loading.gif" id="admin_citylist_loader" alt="loading" style="display:none;" />
        
        <div class="row master_pwrapper">
            <div class="col-xs-12 master_mypagination master_mypagination_admin_city" style="display: inline-block;"></div>
        </div>

        <table class="table table-bordered table-striped table-hover">
            <thead>
              <tr>
                <th></th>
                <th>ID</th>
                <th>Name</th>
                <th>Description</th>
                <th>Country</th>
                <th>Province/State</th>
                <th>Created Date(UTC)</th>
                <th>Status</th>
              </tr>
            </thead>
            <tbody id="dragonecommerce_city">
            </tbody>
        </table>

        <div class="row master_pwrapper">
            <div class="col-xs-12 master_mypagination master_mypagination_admin_city" style="display: inline-block;"></div>
        </div>        
    </div><hr/>
    
    <?php echo "<h3>" . __( '9. Currency:', 'dragonecommerce_trdom' ) . "</h3>"; ?>
    
    <?php echo "<h3>" .  __( '9.1 Create a new currency', 'dragonecommerce_trdom' ) . "</h3>" ?>
    <form name="dragonecommerce_form9_1" method="post" action="<?php echo str_replace( '%7E', '~', esc_html($_SERVER['REQUEST_URI'])); ?>" enctype="multipart/form-data">
        <input type="hidden" name="dragonecommercereservezyx987_hidden" value="Y">
        <input type="hidden" name="dragonecommercereservezyx987_hidden_security" value="<?php echo wp_create_nonce("dragonecommercereservezyx987_addCurrency"); ?>">        
        <p><?php _e("Currency Name *: " ); ?><input type="text" name="dragonecommercereservezyx987_addcurrencyname" value="" size="100"><?php _e(" e.g. USD" ); ?></p>
        <p><?php _e("Currency Sign *: " ); ?><input type="text" name="dragonecommercereservezyx987_addcurrencysign" value="" size="100"><?php _e(" e.g. $" ); ?></p>
        <p><?php _e("ISO Currency Code *: " ); ?><input type="text" name="dragonecommercereservezyx987_addcurrencyisocurrencycode" value="" size="100" maxlength="3"><?php _e(" e.g. USD" ); ?></p>
        <p><?php _e("Description: " ); ?><br/><textarea name="dragonecommercereservezyx987_addcurrencydescription" rows="4" cols="100"></textarea><br/></p>
               
        <p class="submit">
            <input type="submit" name="Submit" onclick="return dragonecommercereservezyx987_validateInput();" value="<?php _e('Create Currency', 'dragonecommerce_trdom' ) ?>" />
        </p>
    </form><hr />
    <?php echo "<h3>" .  __( '9.2 Currency list', 'dragonecommerce_trdom' ) . "</h3>" ?>    
    <div id="dragonecommerce_currency_container">
        <p>Search Name: <input type="text" id="dragonecommerce_currency_name" name="dragonecommerce_currency_name" class="" value="" size="50" /></p>
        <p>Search Currency Status: 
            <select id="dragonecommerce_currency_status" name="dragonecommerce_currency_status">
                <option value="-1">Please choose one...</option>
                <option value="0" >Not active</option>
                   <option value="1" >Active</option>            
            </select>    
        </p>    
        <p>
        <input type="button" id="dragonecommerce_currency_search" name="dragonecommerce_currency_search" class="" value="Search" onclick="dragonecommercereservezyx987_getCurrenciesList();" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <input type="button" id="dragonecommerce_currency_searchreset" name="dragonecommerce_currency_searchreset" class="" value="Reset" onclick="dragonecommercereservezyx987_resetCurrenciesSearchParameters();" style="background-color:grey;"/>
        </p>        
        <p>Items per Page: 
            <select id="dragonecommerce_currency_itemsperpage" name="dragonecommerce_currency_itemsperpage" onchange="dragonecommercereservezyx987_getCurrenciesList();" class="">
                <option value="-1">Please choose one...</option>
                <option value="10" >10</option>
                <option value="20" >20</option>    
                <option value="40" >40</option>    
                <option value="60" >60</option>    
                <option value="80" >80</option>    
                <option value="100" >100</option>                    
            </select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            
            Sort By:
            <select id="dragonecommerce_currency_sortby" name="dragonecommerce_currency_sortby" onchange="dragonecommercereservezyx987_getCurrenciesList();" class="">
                <option value="-1">Please choose one...</option>
                <option value="id|asc" >ID low-high</option>
                <option value="id|desc" >ID high-low</option>
                <option value="name|asc" >Name a-z</option>
                <option value="name|desc" >Name z-a</option>
                <option value="createtimeutc|asc" >Created Date old-new</option>
                <option value="createtimeutc|desc" >Created Date new-old</option>                
            </select>    
        </p>    
        
        Total currencies: <span id="totalcurrencyquantity"></span><img src="<?php echo plugin_dir_url( __FILE__ );  ?>images/loading.gif" id="admin_currencylist_loader" alt="loading" style="display:none;" />
        
        <div class="row master_pwrapper">
            <div class="col-xs-12 master_mypagination master_mypagination_admin_currency" style="display: inline-block;"></div>
        </div>

        <table class="table table-bordered table-striped table-hover">
            <thead>
              <tr>
                <th></th>
                <th>ID</th>
                <th>Name</th>
                <th>Sign</th>
                <th>ISO Currency Code</th>
                <th>Description</th>
                <th>Created Date(UTC)</th>
                <th>Status</th>
              </tr>
            </thead>
            <tbody id="dragonecommerce_currency">
            </tbody>
        </table>

        <div class="row master_pwrapper">
            <div class="col-xs-12 master_mypagination master_mypagination_admin_currency" style="display: inline-block;"></div>
        </div>        
    </div><hr/>
    
    <?php echo "<h3>" . __( '10. Department:', 'dragonecommerce_trdom' ) . "</h3>"; ?>
    <?php echo "<h3>" .  __( '10.1 Create a new department', 'dragonecommerce_trdom' ) . "</h3>" ?>
    <form name="dragonecommerce_form10_1" method="post" action="<?php echo str_replace( '%7E', '~', esc_html($_SERVER['REQUEST_URI'])); ?>" enctype="multipart/form-data">
        <input type="hidden" name="dragonecommercereservezyx987_hidden" value="Y">
        <input type="hidden" name="dragonecommercereservezyx987_hidden_security" value="<?php echo wp_create_nonce("dragonecommercereservezyx987_addDepartment"); ?>">        
        <p><?php _e("Department Name *: " ); ?><input type="text" name="dragonecommercereservezyx987_adddepartmentname" value="" size="100"></p>
        <p><?php _e("Description: " ); ?><br/><textarea name="dragonecommercereservezyx987_adddepartmentdescription" rows="4" cols="100"></textarea><br/></p>              
        <p class="submit">
            <input type="submit" name="Submit" onclick="return dragonecommercereservezyx987_validateInput();" value="<?php _e('Create Department', 'dragonecommerce_trdom' ) ?>" />
        </p>
    </form><hr />
    <?php echo "<h3>" .  __( '10.2 Department list', 'dragonecommerce_trdom' ) . "</h3>" ?>    
    <div id="dragonecommerce_department_container">
        <p>Search Name: <input type="text" id="dragonecommerce_department_name" name="dragonecommerce_department_name" class="" value="" size="50" /></p>
        <p>Search Department Status: 
            <select id="dragonecommerce_department_status" name="dragonecommerce_department_status">
                <option value="-1">Please choose one...</option>
                <option value="0" >Not active</option>
                   <option value="1" >Active</option>            
            </select>    
        </p>        
        <p>
        <input type="button" id="dragonecommerce_department_search" name="dragonecommerce_department_search" class="" value="Search" onclick="dragonecommercereservezyx987_getDepartmentsList();" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <input type="button" id="dragonecommerce_department_searchreset" name="dragonecommerce_department_searchreset" class="" value="Reset" onclick="dragonecommercereservezyx987_resetDepartmentsSearchParameters();" style="background-color:grey;"/>
        </p>        
        <p>Items per Page: 
            <select id="dragonecommerce_department_itemsperpage" name="dragonecommerce_department_itemsperpage" onchange="dragonecommercereservezyx987_getDepartmentsList();" class="">
                <option value="-1">Please choose one...</option>
                <option value="10" >10</option>
                <option value="20" >20</option>    
                <option value="40" >40</option>    
                <option value="60" >60</option>    
                <option value="80" >80</option>    
                <option value="100" >100</option>                    
            </select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            
            Sort By:
            <select id="dragonecommerce_department_sortby" name="dragonecommerce_department_sortby" onchange="dragonecommercereservezyx987_getDepartmentsList();" class="">
                <option value="-1">Please choose one...</option>
                <option value="id|asc" >ID low-high</option>
                <option value="id|desc" >ID high-low</option>
                <option value="name|asc" >Name a-z</option>
                <option value="name|desc" >Name z-a</option>
                <option value="createtimeutc|asc" >Created Date old-new</option>
                <option value="createtimeutc|desc" >Created Date new-old</option>                
            </select>    
        </p>    
        
        Total departments: <span id="totaldepartmentquantity"></span><img src="<?php echo plugin_dir_url( __FILE__ );  ?>images/loading.gif" id="admin_departmentlist_loader" alt="loading" style="display:none;" />
        
        <div class="row master_pwrapper">
            <div class="col-xs-12 master_mypagination master_mypagination_admin_department" style="display: inline-block;"></div>
        </div>

        <table class="table table-bordered table-striped table-hover">
            <thead>
              <tr>
                <th></th>
                <th>ID</th>
                <th>Name</th>
                <th>Description</th>
                <th>Created Date(UTC)</th>
                <th>Status</th>
              </tr>
            </thead>
            <tbody id="dragonecommerce_department">
            </tbody>
        </table>

        <div class="row master_pwrapper">
            <div class="col-xs-12 master_mypagination master_mypagination_admin_department" style="display: inline-block;"></div>
        </div>        
    </div><hr/>

    <?php echo "<h3>" . __( '11. Group category:', 'dragonecommerce_trdom' ) . "</h3>"; ?>
    
    <?php echo "<h3>" .  __( '11.1 Create a new group category', 'dragonecommerce_trdom' ) . "</h3>" ?>
    <form name="dragonecommerce_form11_1" method="post" action="<?php echo str_replace( '%7E', '~', esc_html($_SERVER['REQUEST_URI'])); ?>" enctype="multipart/form-data">
        <input type="hidden" name="dragonecommercereservezyx987_hidden" value="Y">
        <input type="hidden" name="dragonecommercereservezyx987_hidden_security" value="<?php echo wp_create_nonce("dragonecommercereservezyx987_addGroupcategory"); ?>">
        
        <p><?php _e("Group Category Name *: " ); ?><input type="text" name="dragonecommercereservezyx987_addgroupcategoryname" value="" size="100"><?php _e(" e.g. onsale" ); ?></p>
        <p><?php _e("Description: " ); ?><br/><textarea name="dragonecommercereservezyx987_addgroupcategorydescription" rows="4" cols="100"></textarea><br/></p>

        <p><?php _e("Priority (0 or integer bigger than 0): " ); ?><input type="text" name="dragonecommercereservezyx987_addgroupcategorypriority" value="" size="100"><?php _e(" e.g. 12" ); ?></p>
                
        <p class="submit">
            <input type="submit" name="Submit" onclick="return dragonecommercereservezyx987_validateInput();" value="<?php _e('Create Group Category', 'dragonecommerce_trdom' ) ?>" />
        </p>
    </form><hr />
        
    <?php echo "<h3>" .  __( '11.2 Group category list', 'dragonecommerce_trdom' ) . "</h3>" ?>    
    <div id="dragonecommerce_groupcategory_container">
        <p>Search Name: <input type="text" id="dragonecommerce_groupcategory_name" name="dragonecommerce_groupcategory_name" class="" value="" size="50" /></p>
        <p>Search Group Category Status: 
            <select id="dragonecommerce_groupcategory_status" name="dragonecommerce_groupcategory_status">
                <option value="-1">Please choose one...</option>
                <option value="0" >Not active</option>
                   <option value="1" >Active</option>            
            </select>    
        </p>        
        <p>
        <input type="button" id="dragonecommerce_groupcategory_search" name="dragonecommerce_groupcategory_search" class="" value="Search" onclick="dragonecommercereservezyx987_getGroupcategoriesList();" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <input type="button" id="dragonecommerce_groupcategory_searchreset" name="dragonecommerce_groupcategory_searchreset" class="" value="Reset" onclick="dragonecommercereservezyx987_resetGroupcategoriesSearchParameters();" style="background-color:grey;"/>
        </p>    
        
        <p>Items per Page: 
            <select id="dragonecommerce_groupcategory_itemsperpage" name="dragonecommerce_groupcategory_itemsperpage" onchange="dragonecommercereservezyx987_getGroupcategoriesList();" class="">
                <option value="-1">Please choose one...</option>
                <option value="10" >10</option>
                <option value="20" >20</option>    
                <option value="40" >40</option>    
                <option value="60" >60</option>    
                <option value="80" >80</option>    
                <option value="100" >100</option>                    
            </select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            
            Sort By:
            <select id="dragonecommerce_groupcategory_sortby" name="dragonecommerce_groupcategory_sortby" onchange="dragonecommercereservezyx987_getGroupcategoriesList();" class="">
                <option value="-1">Please choose one...</option>
                <option value="id|asc" >ID low-high</option>
                <option value="id|desc" >ID high-low</option>
                <option value="name|asc" >Name a-z</option>
                <option value="name|desc" >Name z-a</option>
                <option value="createtimeutc|asc" >Created Date old-new</option>
                <option value="createtimeutc|desc" >Created Date new-old</option>                
            </select>    
        </p>    
        
        Total group categories: <span id="totalgroupcategoryquantity"></span><img src="<?php echo plugin_dir_url( __FILE__ );  ?>images/loading.gif" id="admin_groupcategorylist_loader" alt="loading" style="display:none;" />
        
        <div class="row master_pwrapper">
            <div class="col-xs-12 master_mypagination master_mypagination_admin_groupcategory" style="display: inline-block;"></div>
        </div>

        <table class="table table-bordered table-striped table-hover">
            <thead>
              <tr>
                <th></th>
                <th>ID</th>
                <th>Name</th>
                <th>Description</th>
                <th>Priority</th>
                <th>Created Date(UTC)</th>
                <th>Mandatory</th>                
                <th>Status</th>
              </tr>
            </thead>
            <tbody id="dragonecommerce_groupcategory">
            </tbody>
        </table>

        <div class="row master_pwrapper">
            <div class="col-xs-12 master_mypagination master_mypagination_admin_groupcategory" style="display: inline-block;"></div>
        </div>        
    </div><hr/>

    <?php echo "<h3>" . __( '12. Group:', 'dragonecommerce_trdom' ) . "</h3>"; ?>
    <?php echo "<h3>" .  __( '12.1 Create a new group', 'dragonecommerce_trdom' ) . "</h3>" ?>
    <form name="dragonecommerce_form12_1" method="post" action="<?php echo str_replace( '%7E', '~', esc_html($_SERVER['REQUEST_URI'])); ?>" enctype="multipart/form-data">
        <input type="hidden" name="dragonecommercereservezyx987_hidden" value="Y">
        <input type="hidden" name="dragonecommercereservezyx987_hidden_security" value="<?php echo wp_create_nonce("dragonecommercereservezyx987_addGroup"); ?>">        
        <p><?php _e("Group Category *: "); ?>
        <select id="dragonecommercereservezyx987_addgroupgroupcategory" name="dragonecommercereservezyx987_addgroupgroupcategory" class="presetto_1">
            <option value="-1">Please choose one...</option>
            <?php foreach ($activegroupcategories as $groupcategory) { ?>
            <option value="<?php echo intval($groupcategory->id); ?>" ><?php echo esc_html($groupcategory->name) . '(' . intval($groupcategory->id) . ')'; ?></option>
            <?php } ?>
         </select></p>
        <p><?php _e("Group Name *: " ); ?><input type="text" name="dragonecommercereservezyx987_addgroupname" value="" size="100"><?php _e(" e.g. March On Sale Items" ); ?></p>
        <p><?php _e("Description: " ); ?><br/><textarea name="dragonecommercereservezyx987_addgroupdescription" rows="4" cols="100"></textarea><br/></p> 
        <p><?php _e("Priority (0 or integer bigger than 0): " ); ?><input type="text" name="dragonecommercereservezyx987_addgrouppriority" value="" size="100"><?php _e(" e.g. 12" ); ?></p>
        <p style="color:brown;">Tax is charged by location(province/state). There should be only one tax rule in this group table. If there is no tax rule or more than one tax rule, there will be error.</p>
        <p class="submit">
            <input type="submit" name="Submit" onclick="return dragonecommercereservezyx987_validateInput();" value="<?php _e('Create Group', 'dragonecommerce_trdom' ) ?>" />
        </p>
    </form><hr />
        
    <?php echo "<h3>" .  __( '12.2 Group list', 'dragonecommerce_trdom' ) . "</h3>" ?>    
    <div id="dragonecommerce_group_container">
        <p>Search Group Name: <input type="text" id="dragonecommerce_group_name" name="dragonecommerce_group_name" class="" value="" size="50" /></p>
        <p>Search Group Category Name: <input type="text" id="dragonecommerce_group_groupcategoryname" name="dragonecommerce_group_groupcategoryname" class="" value="" size="50" /></p>
        <p>Search Group Status: 
            <select id="dragonecommerce_group_status" name="dragonecommerce_group_status">
                <option value="-1">Please choose one...</option>
                <option value="0" >Not active</option>
                   <option value="1" >Active</option>            
            </select>    
        </p>        
        <p>
        <input type="button" id="dragonecommerce_group_search" name="dragonecommerce_group_search" class="" value="Search" onclick="dragonecommercereservezyx987_getGroupsList();" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <input type="button" id="dragonecommerce_group_searchreset" name="dragonecommerce_group_searchreset" class="" value="Reset" onclick="dragonecommercereservezyx987_resetGroupsSearchParameters();" style="background-color:grey;"/>
        </p>        
        <p>Items per Page: 
            <select id="dragonecommerce_group_itemsperpage" name="dragonecommerce_group_itemsperpage" onchange="dragonecommercereservezyx987_getGroupsList();" class="">
                <option value="-1">Please choose one...</option>
                <option value="10" >10</option>
                <option value="20" >20</option>    
                <option value="40" >40</option>    
                <option value="60" >60</option>    
                <option value="80" >80</option>    
                <option value="100" >100</option>                    
            </select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

            Sort By:
            <select id="dragonecommerce_group_sortby" name="dragonecommerce_group_sortby" onchange="dragonecommercereservezyx987_getGroupsList();" class="">
                <option value="-1">Please choose one...</option>
                <option value="id|asc" >ID low-high</option>
                <option value="id|desc" >ID high-low</option>
                <option value="name|asc" >Name a-z</option>
                <option value="name|desc" >Name z-a</option>
                <option value="groupcategoryname|asc" >Group Category a-z</option>
                <option value="groupcategoryname|desc" >Group Category z-a</option>
                <option value="createtimeutc|asc" >Created Date old-new</option>
                <option value="createtimeutc|desc" >Created Date new-old</option>
            </select>
        </p>
        <p style="color:brown;">Tax is charged by location(province/state). There should be only one tax rule in this group table. If there is no tax rule or more than one tax rule, there will be error.</p>
        Total groups: <span id="totalgroupquantity"></span><img src="<?php echo plugin_dir_url( __FILE__ );  ?>images/loading.gif" id="admin_grouplist_loader" alt="loading" style="display:none;" />
        
        <div class="row master_pwrapper">
            <div class="col-xs-12 master_mypagination master_mypagination_admin_group" style="display: inline-block;"></div>
        </div>

        <table class="table table-bordered table-striped table-hover">
            <thead>
              <tr>
                <th></th>
                <th>ID</th>
                <th>Name</th>
                <th>Description</th>
                <th>Group Category(ID)</th>
                <th>Priority</th>
                <th>Searchable</th>
                <th>For All Product</th>                
                <th>Created Date(UTC)</th>
                <th>Status</th>
              </tr>
            </thead>
            <tbody id="dragonecommerce_group">
            </tbody>
        </table>

        <div class="row master_pwrapper">
            <div class="col-xs-12 master_mypagination master_mypagination_admin_group" style="display: inline-block;"></div>
        </div>    
    </div><hr/>

    <?php echo "<h3>" . __( '13. Charge type:', 'dragonecommerce_trdom' ) . "</h3>"; ?>
    <?php echo "<h3>" .  __( '13.1 Create a new charge type', 'dragonecommerce_trdom' ) . "</h3>" ?>
    <form name="dragonecommerce_form13_1" method="post" action="<?php echo str_replace( '%7E', '~', esc_html($_SERVER['REQUEST_URI'])); ?>" enctype="multipart/form-data">
        <input type="hidden" name="dragonecommercereservezyx987_hidden" value="Y">
        <input type="hidden" name="dragonecommercereservezyx987_hidden_security" value="<?php echo wp_create_nonce("dragonecommercereservezyx987_addChargetype"); ?>">        
        <p><?php _e("Charge type Name *: " ); ?><input type="text" name="dragonecommercereservezyx987_addchargetypename" value="" size="100"><?php _e(" e.g. location" ); ?></p>
        <p><?php _e("Description: " ); ?><br/><textarea name="dragonecommercereservezyx987_addchargetypedescription" rows="4" cols="100"></textarea><br/></p>
        <p><?php _e("Priority (integer bigger than 0): " ); ?><input type="text" name="dragonecommercereservezyx987_addchargetypepriority" value="" size="100"><?php _e(" e.g. 12" ); ?></p>        
        <p class="submit">
            <input type="submit" name="Submit" onclick="return dragonecommercereservezyx987_validateInput();" value="<?php _e('Create Charge Type', 'dragonecommerce_trdom' ) ?>" />
        </p>
    </form><hr />        
        
    <?php echo "<h3>" .  __( '13.2 Charge type list', 'dragonecommerce_trdom' ) . "</h3>" ?>
    <div id="dragonecommerce_chargetype_container">
        <p>Search Name: <input type="text" id="dragonecommerce_chargetype_name" name="dragonecommerce_chargetype_name" class="" value="" size="50" /></p>
        <p>Search Charge Type Status: 
            <select id="dragonecommerce_chargetype_status" name="dragonecommerce_chargetype_status">
                <option value="-1">Please choose one...</option>
                <option value="0" >Not active</option>
                   <option value="1" >Active</option>            
            </select>    
        </p>
        
        <p>
        <input type="button" id="dragonecommerce_chargetype_search" name="dragonecommerce_chargetype_search" class="" value="Search" onclick="dragonecommercereservezyx987_getChargetypesList();" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <input type="button" id="dragonecommerce_chargetype_searchreset" name="dragonecommerce_chargetype_searchreset" class="" value="Reset" onclick="dragonecommercereservezyx987_resetChargetypesSearchParameters();" style="background-color:grey;"/>
        </p>    
        
        <p>Items per Page: 
            <select id="dragonecommerce_chargetype_itemsperpage" name="dragonecommerce_chargetype_itemsperpage" onchange="dragonecommercereservezyx987_getChargetypesList();" class="">
                <option value="-1">Please choose one...</option>
                <option value="10" >10</option>
                <option value="20" >20</option>    
                <option value="40" >40</option>    
                <option value="60" >60</option>    
                <option value="80" >80</option>    
                <option value="100" >100</option>                    
            </select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            
            Sort By:
            <select id="dragonecommerce_chargetype_sortby" name="dragonecommerce_chargetype_sortby" onchange="dragonecommercereservezyx987_getChargetypesList();" class="">
                <option value="-1">Please choose one...</option>
                <option value="id|asc" >ID low-high</option>
                <option value="id|desc" >ID high-low</option>
                <option value="name|asc" >Name a-z</option>
                <option value="name|desc" >Name z-a</option>
                <option value="createtimeutc|asc" >Created Date old-new</option>
                <option value="createtimeutc|desc" >Created Date new-old</option>                
            </select>    
        </p>    
        
        Total charge types: <span id="totalchargetypequantity"></span><img src="<?php echo plugin_dir_url( __FILE__ );  ?>images/loading.gif" id="admin_chargetypelist_loader" alt="loading" style="display:none;" />
        
        <div class="row master_pwrapper">
            <div class="col-xs-12 master_mypagination master_mypagination_admin_chargetype" style="display: inline-block;"></div>
        </div>

        <table class="table table-bordered table-striped table-hover">
            <thead>
              <tr>
                <th></th>
                <th>ID</th>
                <th>Name</th>
                <th>Description</th>
                <th>Priority</th>
                <th>Created Date(UTC)</th>
                <th>Status</th>
              </tr>
            </thead>
            <tbody id="dragonecommerce_chargetype">
            </tbody>
        </table>

        <div class="row master_pwrapper">
            <div class="col-xs-12 master_mypagination master_mypagination_admin_chargetype" style="display: inline-block;"></div>
        </div>        
    </div><hr/>
    
    <?php echo "<h3>" . __( '14. Property:', 'dragonecommerce_trdom' ) . "</h3>"; ?>
    <?php echo "<h3>" .  __( '14.1 Create a new property', 'dragonecommerce_trdom' ) . "</h3>" ?>
    <form name="dragonecommerce_form14_1" method="post" action="<?php echo str_replace( '%7E', '~', esc_html($_SERVER['REQUEST_URI'])); ?>" enctype="multipart/form-data">
        <input type="hidden" name="dragonecommercereservezyx987_hidden" value="Y">
        <input type="hidden" name="dragonecommercereservezyx987_hidden_security" value="<?php echo wp_create_nonce("dragonecommercereservezyx987_addProperty"); ?>">
        
        <p><?php _e("Property Name *: " ); ?><input type="text" name="dragonecommercereservezyx987_addpropertyname" value="" size="100"></p>
        <p><?php _e("Property Shown Name(For customer to see on the shopping page)(Do not use , ; :) *: " ); ?><input type="text" name="dragonecommercereservezyx987_addpropertyshownname" value="" size="100"></p>

        <p><?php _e("Description: " ); ?><br/><textarea name="dragonecommercereservezyx987_addpropertydescription" rows="4" cols="100"></textarea><br/></p>
        <p><?php _e("Priority (integer bigger than 0): " ); ?><input type="text" name="dragonecommercereservezyx987_addpropertypriority" value="" size="100"><?php _e(" e.g. 12" ); ?></p>

         <p>For All Product?: 
            <select id="dragonecommerce_addpropertyforallproduct" name="dragonecommerce_addpropertyforallproduct">
                <option value="-1">Please choose one...</option>
                <option value="1" >YES</option>    
                <option value="0" >NO</option>        
            </select>    
        </p>

        <p>Is Mandatory?: 
            <select id="dragonecommerce_addpropertymandatory" name="dragonecommerce_addpropertymandatory">
                <option value="-1">Please choose one...</option>
                <option value="1" >YES</option>    
                <option value="0" >NO</option>            
            </select>    
        </p>
        
        <p class="submit">
            <input type="submit" name="Submit" onclick="return dragonecommercereservezyx987_validateInput();" value="<?php _e('Create Property', 'dragonecommerce_trdom' ) ?>" />
        </p>
    </form><hr />
    <?php echo "<h3>" .  __( '14.2 Property list', 'dragonecommerce_trdom' ) . "</h3>" ?>    
    <div id="dragonecommerce_property_container">
        <p>Search Property Name: <input type="text" id="dragonecommerce_property_name" name="dragonecommerce_property_name" class="" value="" size="50" /></p>
        <p>Search Charge Type: 
        <select id="dragonecommerce_property_chargetypeid" name="dragonecommerce_property_chargetypeid" class="presetto_1">
           <option value="-1">Please choose one...</option>
           <?php foreach ($allchargetypes as $chargetype) { ?>
           <option value="<?php echo intval($chargetype->id); ?>" style="<?php echo $chargetype->status === '1' ? '' : 'color:grey;'; ?>"><?php echo esc_html($chargetype->name); ?></option>
           <?php } ?>
         </select></p>
        <p>Search Property Status:
            <select id="dragonecommerce_property_status" name="dragonecommerce_property_status">
                <option value="-1">Please choose one...</option>
                <option value="0" >Not active</option>
                   <option value="1" >Active</option>            
            </select>    
        </p>        
        <p>
        <input type="button" id="dragonecommerce_property_search" name="dragonecommerce_property_search" class="" value="Search" onclick="dragonecommercereservezyx987_getPropertiesList();" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <input type="button" id="dragonecommerce_property_searchreset" name="dragonecommerce_property_searchreset" class="" value="Reset" onclick="dragonecommercereservezyx987_resetPropertiesSearchParameters();" style="background-color:grey;"/>
        </p>    
        
        <p>Items per Page: 
            <select id="dragonecommerce_property_itemsperpage" name="dragonecommerce_property_itemsperpage" onchange="dragonecommercereservezyx987_getPropertiesList();" class="">
                <option value="-1">Please choose one...</option>
                <option value="10" >10</option>
                <option value="20" >20</option>    
                <option value="40" >40</option>    
                <option value="60" >60</option>    
                <option value="80" >80</option>    
                <option value="100" >100</option>                    
            </select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            
            Sort By:
            <select id="dragonecommerce_property_sortby" name="dragonecommerce_property_sortby" onchange="dragonecommercereservezyx987_getPropertiesList();" class="">
                <option value="-1">Please choose one...</option>
                <option value="id|asc" >ID low-high</option>
                <option value="id|desc" >ID high-low</option>
                <option value="name|asc" >Name a-z</option>
                <option value="name|desc" >Name z-a</option>
                <option value="chargetypename|asc" >Charge Type a-z</option>
                <option value="chargetypename|desc" >Charge Type z-a</option>
                <option value="createtimeutc|asc" >Created Date old-new</option>
                <option value="createtimeutc|desc" >Created Date new-old</option>                
            </select>    
        </p>    
        
        Total properties: <span id="totalpropertyquantity"></span><img src="<?php echo plugin_dir_url( __FILE__ );  ?>images/loading.gif" id="admin_propertylist_loader" alt="loading" style="display:none;" />
        
        <div class="row master_pwrapper">
            <div class="col-xs-12 master_mypagination master_mypagination_admin_property" style="display: inline-block;"></div>
        </div>

        <table class="table table-bordered table-striped table-hover">
            <thead>
              <tr>
                <th></th>
                <th>ID</th>
                <th>Name</th>
                <th>Shown Name</th>
                <th>Description</th>
                <th>Charge Type Name</th>
                <th>Priority</th>
                <th>For All Product?</th>
                <th>Mandatory?</th>                
                <th>Created Date(UTC)</th>
                <th>Status</th>
              </tr>
            </thead>
            <tbody id="dragonecommerce_property">
            </tbody>
        </table>

        <div class="row master_pwrapper">
            <div class="col-xs-12 master_mypagination master_mypagination_admin_property" style="display: inline-block;"></div>
        </div>    
    </div>
    <?php echo "<h3>" .  __( '14.3 Group Property mapping table list', 'dragonecommerce_trdom' ) . "</h3>" ?>    
    <div id="dragonecommerce_groupproperty_container">
        <p>Search Group ID: 
            <select id="dragonecommerce_groupproperty_groupid" class="presetto_1" name="dragonecommerce_groupproperty_groupid" >
               <option value="-1">Please select one...</option>
               <?php foreach ($allgroups as $group) { ?>
               <option value="<?php echo intval($group->id); ?>" style="<?php echo $group->status === '1' ? '' : 'color:grey;'; ?>"><?php echo esc_html($group->name) . " (" . intval($group->id) . ")"; ?></option>
               <?php } ?>
            </select>
        </p>
        <p>Search Property ID: 
            <select id="dragonecommerce_groupproperty_propertyid" name="dragonecommerce_groupproperty_propertyid" class="presetto_1" >
                <option value="-1">Please choose one...</option>
                <?php foreach ($allproperties as $property) { ?>
                <option value="<?php echo intval($property->id); ?>" style="<?php echo $property->status === '1' ? '' : 'color:grey;'; ?>"><?php echo esc_html($property->name) . " (" . intval($property->id) . ")"; ?></option>
                <?php } ?>        
            </select>        
        </p>
        <p>Search Group Property Status: 
            <select id="dragonecommerce_groupproperty_status" name="dragonecommerce_groupproperty_status">
                <option value="-1">Please choose one...</option>
                <option value="0" >Not active</option>
                   <option value="1" >Active</option>            
            </select>    
        </p>        
        <p>
        <input type="button" id="dragonecommerce_groupproperty_search" name="dragonecommerce_groupproperty_search" class="" value="Search" onclick="dragonecommercereservezyx987_getGroupPropertiesList();" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <input type="button" id="dragonecommerce_groupproperty_searchreset" name="dragonecommerce_groupproperty_searchreset" class="" value="Reset" onclick="dragonecommercereservezyx987_resetGroupPropertiesSearchParameters();" style="background-color:grey;"/>
        </p>    
        
        <p>Items per Page: 
            <select id="dragonecommerce_groupproperty_itemsperpage" name="dragonecommerce_groupproperty_itemsperpage" onchange="dragonecommercereservezyx987_getGroupPropertiesList();" class="">
                <option value="-1">Please choose one...</option>
                <option value="10" >10</option>
                <option value="20" >20</option>    
                <option value="40" >40</option>    
                <option value="60" >60</option>    
                <option value="80" >80</option>    
                <option value="100" >100</option>                    
            </select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            
            Sort By:
            <select id="dragonecommerce_groupproperty_sortby" name="dragonecommerce_groupproperty_sortby" onchange="dragonecommercereservezyx987_getGroupPropertiesList();" class="">
                <option value="-1">Please choose one...</option>
                <option value="id|asc" >ID low-high</option>
                <option value="id|desc" >ID high-low</option>
                <option value="groupid|asc" >Group ID low-high</option>
                <option value="groupid|desc" >Group ID high-low</option>
                <option value="propertyid|asc" >Property ID low-high</option>
                <option value="propertyid|desc" >Property ID high-low</option>                
            </select>    
        </p>
        <p style="color:brown;">Please make sure this table is not empty. If it's empty, go to tab Actions to click "Drop group table and related tables" to re-create these tables. Remember to backup these tables first before you drop them: table wp_dragonecommercereservezyx987_group, wp_dragonecommercereservezyx987_group_property, wp_dragonecommercereservezyx987_order_group, and wp_dragonecommercereservezyx987_product_group.</p>        
        
        Total group property mappings: <span id="totalgrouppropertyquantity"></span><img src="<?php echo plugin_dir_url( __FILE__ );  ?>images/loading.gif" id="admin_grouppropertylist_loader" alt="loading" style="display:none;" />
        
        <div class="row master_pwrapper">
            <div class="col-xs-12 master_mypagination master_mypagination_admin_groupproperty" style="display: inline-block;"></div>
        </div>

        <table class="table table-bordered table-striped table-hover">
            <thead>
              <tr>
                <th>ID</th>
                <th>Group ID</th>
                <th>Property ID</th>            
                <th>Created Date(UTC)</th>
                <th>Status</th>
              </tr>
            </thead>
            <tbody id="dragonecommerce_groupproperty">
            </tbody>
        </table>

        <div class="row master_pwrapper">
            <div class="col-xs-12 master_mypagination master_mypagination_admin_groupproperty" style="display: inline-block;"></div>
        </div>    
    </div>        
</div>
<div id="dragonecommerce_tabs_3">
    <?php echo "<h3>" . __( '15. Shipping:', 'dragonecommerce_trdom' ) . "</h3>"; ?>
    <div id="dragonecommerce_shipping_container">
        <p>Search Name: <input type="text" id="dragonecommerce_shipping_name" name="dragonecommerce_shipping_name" class="" value="" size="50" /></p>
        <p>Search Shown Name: <input type="text" id="dragonecommerce_shipping_shownname" name="dragonecommerce_shipping_shownname" class="" value="" size="50" /></p>
        <p>Search Description: <input type="text" id="dragonecommerce_shipping_description" name="dragonecommerce_shipping_description" class="" value="" size="50" /></p>
        <p>Search Created From Date (UTC Time): <input type="text" id="dragonecommerce_shipping_fromdate" name="dragonecommerce_shipping_fromdate" class="dragonecommercereservezyx987_datetimepicker" value="" size="50" /></p>    
        <p>Search Created To Date (UTC Time): <input type="text" id="dragonecommerce_shipping_todate" name="dragonecommerce_shipping_todate" class="dragonecommercereservezyx987_datetimepicker" value="" size="50" /></p>    

        <p>Search Shipping Status: 
            <select id="dragonecommerce_shipping_status" name="dragonecommerce_shipping_status">
                <option value="-1">Please choose one...</option>
                <option value="0" >Not active</option>
                   <option value="1" >Active</option>            
            </select>    
        </p>        
        <p>
        <input type="button" id="dragonecommerce_shipping_search" name="dragonecommerce_shipping_search" class="" value="Search" onclick="dragonecommercereservezyx987_getShippingsList();" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <input type="button" id="dragonecommerce_shipping_searchreset" name="dragonecommerce_shipping_searchreset" class="" value="Reset" onclick="dragonecommercereservezyx987_resetShippingsSearchParameters();" style="background-color:grey;"/>
        </p>

        <p style="color:red;font-weight:bold;">If a province/state/region's shipping fee is charged by location, please double check if the shipping fee/rate is correct.</p>
        
        <p>Items per Page: 
            <select id="dragonecommerce_shipping_itemsperpage" name="dragonecommerce_shipping_itemsperpage" onchange="dragonecommercereservezyx987_getShippingsList();" class="">
                <option value="-1">Please choose one...</option>
                <option value="10" >10</option>
                <option value="20" >20</option>    
                <option value="40" >40</option>    
                <option value="60" >60</option>    
                <option value="80" >80</option>    
                <option value="100" >100</option>                    
            </select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            
            Sort By:
            <select id="dragonecommerce_shipping_sortby" name="dragonecommerce_shipping_sortby" onchange="dragonecommercereservezyx987_getShippingsList();" class="">
                <option value="-1">Please choose one...</option>
                <option value="id|asc" >ID low-high</option>
                <option value="id|desc" >ID high-low</option>
                <option value="name|asc" >Name a-z</option>
                <option value="name|desc" >Name z-a</option>                
                <option value="shownname|asc" >Shown Name a-z</option>
                <option value="shownname|desc" >Shown Name z-a</option>
                <option value="createtimeutc|asc" >Created Date old-new</option>
                <option value="createtimeutc|desc" >Created Date new-old</option>                
            </select>    
        </p>    
        
        Total shippings: <span id="totalshippingquantity"></span><img src="<?php echo plugin_dir_url( __FILE__ );  ?>images/loading.gif" id="admin_shippinglist_loader" alt="loading" style="display:none;" />
        
        <div class="row master_pwrapper">
            <div class="col-xs-12 master_mypagination master_mypagination_admin_shipping" style="display: inline-block;"></div>
        </div>

        <table class="table table-bordered table-striped table-hover">
            <thead>
              <tr>
                <th></th>
                <th>ID</th>
                <th>Name</th>
                <th>Shown Name</th>
                <th>Description</th>
                <th>Use Rate</th>
                <th>Rate</th>
                <th>Use Fee</th>
                <th>Fee</th>
                <th>Min Reserve</th>                
                <th>Start Date(UTC)</th>
                <th>End Date(UTC)</th>
                <th>From Country</th>
                <th>From State/Province</th>
                <th>To Country</th>
                <th>To State/Province</th>    
                <th>priority</th>
                <th>Created Date(UTC)</th>
                <th>Status</th>
              </tr>
            </thead>
            <tbody id="dragonecommerce_shipping">
            </tbody>
        </table>

        <div class="row master_pwrapper">
            <div class="col-xs-12 master_mypagination master_mypagination_admin_shipping" style="display: inline-block;"></div>
        </div>    
    </div><hr/>
    
    <?php echo "<h3>" . __( '16. Handling:', 'dragonecommerce_trdom' ) . "</h3>"; ?>
    <div id="dragonecommerce_handling_container">
        <p>Search Name: <input type="text" id="dragonecommerce_handling_name" name="dragonecommerce_handling_name" class="" value="" size="50" /></p>
        <p>Search Shown Name: <input type="text" id="dragonecommerce_handling_shownname" name="dragonecommerce_handling_shownname" class="" value="" size="50" /></p>
        <p>Search Description: <input type="text" id="dragonecommerce_handling_description" name="dragonecommerce_handling_description" class="" value="" size="50" /></p>
        <p>Search Created From Date (UTC Time): <input type="text" id="dragonecommerce_handling_fromdate" name="dragonecommerce_handling_fromdate" class="dragonecommercereservezyx987_datetimepicker" value="" size="50" /></p>    
        <p>Search Created To Date (UTC Time): <input type="text" id="dragonecommerce_handling_todate" name="dragonecommerce_handling_todate" class="dragonecommercereservezyx987_datetimepicker" value="" size="50" /></p>    

        <p>Search Handling Status: 
            <select id="dragonecommerce_handling_status" name="dragonecommerce_handling_status">
                <option value="-1">Please choose one...</option>
                <option value="0" >Not active</option>
                   <option value="1" >Active</option>            
            </select>    
        </p>
        
        <p>
        <input type="button" id="dragonecommerce_handling_search" name="dragonecommerce_handling_search" class="" value="Search" onclick="dragonecommercereservezyx987_getHandlingsList();" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <input type="button" id="dragonecommerce_handling_searchreset" name="dragonecommerce_handling_searchreset" class="" value="Reset" onclick="dragonecommercereservezyx987_resetHandlingsSearchParameters();" style="background-color:grey;"/>
        </p>        
        
        <p style="color:red;font-weight:bold;">If a province/state/region's handling fee is charged by location, please double check if the handling fee/rate is correct.</p>        
        
        <p>Items per Page: 
            <select id="dragonecommerce_handling_itemsperpage" name="dragonecommerce_handling_itemsperpage" onchange="dragonecommercereservezyx987_getHandlingsList();" class="">
                <option value="-1">Please choose one...</option>
                <option value="10" >10</option>
                <option value="20" >20</option>    
                <option value="40" >40</option>    
                <option value="60" >60</option>    
                <option value="80" >80</option>    
                <option value="100" >100</option>                    
            </select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            
            Sort By:
            <select id="dragonecommerce_handling_sortby" name="dragonecommerce_handling_sortby" onchange="dragonecommercereservezyx987_getHandlingsList();" class="">
                <option value="-1">Please choose one...</option>
                <option value="id|asc" >ID low-high</option>
                <option value="id|desc" >ID high-low</option>
                <option value="name|asc" >Name a-z</option>
                <option value="name|desc" >Name z-a</option>                
                <option value="shownname|asc" >Shown Name a-z</option>
                <option value="shownname|desc" >Shown Name z-a</option>
                <option value="createtimeutc|asc" >Created Date old-new</option>
                <option value="createtimeutc|desc" >Created Date new-old</option>                
            </select>    
        </p>    
        
        Total handlings: <span id="totalhandlingquantity"></span><img src="<?php echo plugin_dir_url( __FILE__ );  ?>images/loading.gif" id="admin_handlinglist_loader" alt="loading" style="display:none;" />
        
        <div class="row master_pwrapper">
            <div class="col-xs-12 master_mypagination master_mypagination_admin_handling" style="display: inline-block;"></div>
        </div>

        <table class="table table-bordered table-striped table-hover">
            <thead>
              <tr>
                <th></th>
                <th>ID</th>
                <th>Name</th>
                <th>Shown Name</th>
                <th>Description</th>
                <th>Use Rate</th>
                <th>Rate</th>
                <th>Use Fee</th>
                <th>Fee</th>
                <th>Min Reserve</th>                
                <th>Start Date(UTC)</th>
                <th>End Date(UTC)</th>
                <th>From Country</th>
                <th>From State/Province</th>
                <th>To Country</th>
                <th>To State/Province</th>                
                <th>priority</th>
                <th>Created Date(UTC)</th>
                <th>Status</th>
              </tr>
            </thead>
            <tbody id="dragonecommerce_handling">
            </tbody>
        </table>

        <div class="row master_pwrapper">
            <div class="col-xs-12 master_mypagination master_mypagination_admin_handling" style="display: inline-block;"></div>
        </div>    
    </div><hr/>

    <?php echo "<h3>" . __( '17. Tax:', 'dragonecommerce_trdom' ) . "</h3>"; ?>        
    <div id="dragonecommerce_tax_container">
        <p>Search Name: <input type="text" id="dragonecommerce_tax_name" name="dragonecommerce_tax_name" class="" value="" size="50" /></p>
        <p>Search Shown Name: <input type="text" id="dragonecommerce_tax_shownname" name="dragonecommerce_tax_shownname" class="" value="" size="50" /></p>
        <p>Search Description: <input type="text" id="dragonecommerce_tax_description" name="dragonecommerce_tax_description" class="" value="" size="50" /></p>
        <p>Search Created From Date (UTC Time): <input type="text" id="dragonecommerce_tax_fromdate" name="dragonecommerce_tax_fromdate" class="dragonecommercereservezyx987_datetimepicker" value="" size="50" /></p>    
        <p>Search Created To Date (UTC Time): <input type="text" id="dragonecommerce_tax_todate" name="dragonecommerce_tax_todate" class="dragonecommercereservezyx987_datetimepicker" value="" size="50" /></p>
        <p>Search Tax Status: 
            <select id="dragonecommerce_tax_status" name="dragonecommerce_tax_status">
                <option value="-1">Please choose one...</option>
                <option value="0" >Not active</option>
                   <option value="1" >Active</option>            
            </select>    
        </p>        
        <p>
        <input type="button" id="dragonecommerce_tax_search" name="dragonecommerce_tax_search" class="" value="Search" onclick="dragonecommercereservezyx987_getTaxesList();" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <input type="button" id="dragonecommerce_tax_searchreset" name="dragonecommerce_tax_searchreset" class="" value="Reset" onclick="dragonecommercereservezyx987_resetTaxesSearchParameters();" style="background-color:grey;"/>
        </p>

        <p style="color:red;font-weight:bold;">Please double check if every province/state/region's tax rate/fee is correct.</p>
        
        <p>Items per Page: 
            <select id="dragonecommerce_tax_itemsperpage" name="dragonecommerce_tax_itemsperpage" onchange="dragonecommercereservezyx987_getTaxesList();" class="">
                <option value="-1">Please choose one...</option>
                <option value="10" >10</option>
                <option value="20" >20</option>    
                <option value="40" >40</option>    
                <option value="60" >60</option>    
                <option value="80" >80</option>    
                <option value="100" >100</option>                    
            </select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            
            Sort By:
            <select id="dragonecommerce_tax_sortby" name="dragonecommerce_tax_sortby" onchange="dragonecommercereservezyx987_getTaxesList();" class="">
                <option value="-1">Please choose one...</option>
                <option value="id|asc" >ID low-high</option>
                <option value="id|desc" >ID high-low</option>
                <option value="name|asc" >Name a-z</option>
                <option value="name|desc" >Name z-a</option>                
                <option value="shownname|asc" >Shown Name a-z</option>
                <option value="shownname|desc" >Shown Name z-a</option>
                <option value="createtimeutc|asc" >Created Date old-new</option>
                <option value="createtimeutc|desc" >Created Date new-old</option>                
            </select>    
        </p>    
        
        Total taxes: <span id="totaltaxquantity"></span><img src="<?php echo plugin_dir_url( __FILE__ );  ?>images/loading.gif" id="admin_taxlist_loader" alt="loading" style="display:none;" />
        
        <div class="row master_pwrapper">
            <div class="col-xs-12 master_mypagination master_mypagination_admin_tax" style="display: inline-block;"></div>
        </div>

        <table class="table table-bordered table-striped table-hover">
            <thead>
              <tr>
                <th></th>
                <th>ID</th>
                <th>Name</th>
                <th>Shown Name</th>
                <th>Description</th>
                <th>Use Rate</th>
                <th>Rate</th>
                <th>Use Fee</th>
                <th>Fee</th>
                <th>Min Reserve</th>                
                <th>Start Date(UTC)</th>
                <th>End Date(UTC)</th>
                <th>From Country</th>
                <th>From State/Province</th>
                <th>To Country</th>
                <th>To State/Province</th>
                <th>Tax Include Shipping</th>
                <th>Tax Include Handling</th>                
                <th>priority</th>
                <th>Created Date(UTC)</th>
                <th>Status</th>
              </tr>
            </thead>
            <tbody id="dragonecommerce_tax">
            </tbody>
        </table>

        <div class="row master_pwrapper">
            <div class="col-xs-12 master_mypagination master_mypagination_admin_tax" style="display: inline-block;"></div>
        </div>    
    </div><hr/>
    
    <?php echo "<h3>" . __( '18. Discount:', 'dragonecommerce_trdom' ) . "</h3>"; ?>
    <div id="dragonecommerce_discount_container">
        <p>Search Name: <input type="text" id="dragonecommerce_discount_name" name="dragonecommerce_discount_name" class="" value="" size="50" /></p>
        <p>Search Shown Name: <input type="text" id="dragonecommerce_discount_shownname" name="dragonecommerce_discount_shownname" class="" value="" size="50" /></p>
        <p>Search Description: <input type="text" id="dragonecommerce_discount_description" name="dragonecommerce_discount_description" class="" value="" size="50" /></p>
        <p>Search Created From Date (UTC Time): <input type="text" id="dragonecommerce_discount_fromdate" name="dragonecommerce_discount_fromdate" class="dragonecommercereservezyx987_datetimepicker" value="" size="50" /></p>    
        <p>Search Created To Date (UTC Time): <input type="text" id="dragonecommerce_discount_todate" name="dragonecommerce_discount_todate" class="dragonecommercereservezyx987_datetimepicker" value="" size="50" /></p>    

        <p>Search Discount Status: 
            <select id="dragonecommerce_discount_status" name="dragonecommerce_discount_status">
                <option value="-1">Please choose one...</option>
                <option value="0" >Not active</option>
                   <option value="1" >Active</option>            
            </select>    
        </p>        
        <p>
        <input type="button" id="dragonecommerce_discount_search" name="dragonecommerce_discount_search" class="" value="Search" onclick="dragonecommercereservezyx987_getDiscountsList();" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <input type="button" id="dragonecommerce_discount_searchreset" name="dragonecommerce_discount_searchreset" class="" value="Reset" onclick="dragonecommercereservezyx987_resetDiscountsSearchParameters();" style="background-color:grey;"/>
        </p>        
        <p>Items per Page: 
            <select id="dragonecommerce_discount_itemsperpage" name="dragonecommerce_discount_itemsperpage" onchange="dragonecommercereservezyx987_getDiscountsList();" class="">
                <option value="-1">Please choose one...</option>
                <option value="10" >10</option>
                <option value="20" >20</option>    
                <option value="40" >40</option>    
                <option value="60" >60</option>    
                <option value="80" >80</option>    
                <option value="100" >100</option>                    
            </select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            
            Sort By:
            <select id="dragonecommerce_discount_sortby" name="dragonecommerce_discount_sortby" onchange="dragonecommercereservezyx987_getDiscountsList();" class="">
                <option value="-1">Please choose one...</option>
                <option value="id|asc" >ID low-high</option>
                <option value="id|desc" >ID high-low</option>
                <option value="name|asc" >Name a-z</option>
                <option value="name|desc" >Name z-a</option>                
                <option value="shownname|asc" >Shown Name a-z</option>
                <option value="shownname|desc" >Shown Name z-a</option>
                <option value="createtimeutc|asc" >Created Date old-new</option>
                <option value="createtimeutc|desc" >Created Date new-old</option>                
            </select>    
        </p>    
        
        Total discounts: <span id="totaldiscountquantity"></span><img src="<?php echo plugin_dir_url( __FILE__ );  ?>images/loading.gif" id="admin_discountlist_loader" alt="loading" style="display:none;" />
        
        <div class="row master_pwrapper">
            <div class="col-xs-12 master_mypagination master_mypagination_admin_discount" style="display: inline-block;"></div>
        </div>

        <table class="table table-bordered table-striped table-hover">
            <thead>
              <tr>
                <th></th>
                <th>ID</th>
                <th>Name</th>
                <th>Shown Name</th>
                <th>Description</th>
                <th>Use Rate</th>
                <th>Rate</th>
                <th>Use Fee</th>
                <th>Fee</th>
                <th>Min Reserve</th>                
                <th>Start Date(UTC)</th>
                <th>End Date(UTC)</th>
                <th>From Country</th>
                <th>From State/Province</th>
                <th>To Country</th>
                <th>To State/Province</th>    
                <th>priority</th>
                <th>Created Date(UTC)</th>
                <th>Status</th>
              </tr>
            </thead>
            <tbody id="dragonecommerce_discount">
            </tbody>
        </table>

        <div class="row master_pwrapper">
            <div class="col-xs-12 master_mypagination master_mypagination_admin_discount" style="display: inline-block;"></div>
        </div>        
    </div><hr/>
    
    <?php echo "<h3>" . __( '19. Coupon:', 'dragonecommerce_trdom' ) . "</h3>"; ?>
    <div id="dragonecommerce_coupon_container">
        <p>Search Name: <input type="text" id="dragonecommerce_coupon_name" name="dragonecommerce_coupon_name" class="" value="" size="50" /></p>
        <p>Search Shown Name: <input type="text" id="dragonecommerce_coupon_shownname" name="dragonecommerce_coupon_shownname" class="" value="" size="50" /></p>
        <p>Search Description: <input type="text" id="dragonecommerce_coupon_description" name="dragonecommerce_coupon_description" class="" value="" size="50" /></p>
        <p>Search Created From Date (UTC Time): <input type="text" id="dragonecommerce_coupon_fromdate" name="dragonecommerce_coupon_fromdate" class="dragonecommercereservezyx987_datetimepicker" value="" size="50" /></p>    
        <p>Search Created To Date (UTC Time): <input type="text" id="dragonecommerce_coupon_todate" name="dragonecommerce_coupon_todate" class="dragonecommercereservezyx987_datetimepicker" value="" size="50" /></p>    

        <p>Search Coupon Status: 
            <select id="dragonecommerce_coupon_status" name="dragonecommerce_coupon_status">
                <option value="-1">Please choose one...</option>
                <option value="0" >Not active</option>
                   <option value="1" >Active</option>            
            </select>    
        </p>
        
        <p>
        <input type="button" id="dragonecommerce_coupon_search" name="dragonecommerce_coupon_search" class="" value="Search" onclick="dragonecommercereservezyx987_getCouponsList();" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <input type="button" id="dragonecommerce_coupon_searchreset" name="dragonecommerce_coupon_searchreset" class="" value="Reset" onclick="dragonecommercereservezyx987_resetCouponsSearchParameters();" style="background-color:grey;"/>
        </p>    
        
        <p>Items per Page: 
            <select id="dragonecommerce_coupon_itemsperpage" name="dragonecommerce_coupon_itemsperpage" onchange="dragonecommercereservezyx987_getCouponsList();" class="">
                <option value="-1">Please choose one...</option>
                <option value="10" >10</option>
                <option value="20" >20</option>    
                <option value="40" >40</option>    
                <option value="60" >60</option>    
                <option value="80" >80</option>    
                <option value="100" >100</option>                    
            </select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            
            Sort By:
            <select id="dragonecommerce_coupon_sortby" name="dragonecommerce_coupon_sortby" onchange="dragonecommercereservezyx987_getCouponsList();" class="">
                <option value="-1">Please choose one...</option>
                <option value="id|asc" >ID low-high</option>
                <option value="id|desc" >ID high-low</option>
                <option value="name|asc" >Name a-z</option>
                <option value="name|desc" >Name z-a</option>                
                <option value="shownname|asc" >Shown Name a-z</option>
                <option value="shownname|desc" >Shown Name z-a</option>
                <option value="createtimeutc|asc" >Created Date old-new</option>
                <option value="createtimeutc|desc" >Created Date new-old</option>                
            </select>    
        </p>    
        
        Total coupons: <span id="totalcouponquantity"></span><img src="<?php echo plugin_dir_url( __FILE__ );  ?>images/loading.gif" id="admin_couponlist_loader" alt="loading" style="display:none;" />
        
        <div class="row master_pwrapper">
            <div class="col-xs-12 master_mypagination master_mypagination_admin_coupon" style="display: inline-block;"></div>
        </div>

        <table class="table table-bordered table-striped table-hover">
            <thead>
              <tr>
                <th></th>
                <th>ID</th>
                <th>Name</th>
                <th>Shown Name</th>
                <th>Description</th>
                <th>Code</th>
                <th>Use Rate</th>
                <th>Rate</th>
                <th>Use Fee</th>
                <th>Fee</th>
                <th>Min Reserve</th>                
                <th>Start Date(UTC)</th>
                <th>End Date(UTC)</th>
                <th>From Country</th>
                <th>From State/Province</th>
                <th>To Country</th>
                <th>To State/Province</th>    
                <th>priority</th>
                <th>Created Date(UTC)</th>
                <th>Status</th>
              </tr>
            </thead>
            <tbody id="dragonecommerce_coupon">
            </tbody>
        </table>

        <div class="row master_pwrapper">
            <div class="col-xs-12 master_mypagination master_mypagination_admin_coupon" style="display: inline-block;"></div>
        </div>        
    </div><hr/>

    <?php echo "<h3>" . __( '20. Property value:', 'dragonecommerce_trdom' ) . "</h3>"; ?>
    <?php echo "<h4>" .  __( 'Shipping, handling, tax, discount and coupon all belong to property value.', 'dragonecommerce_trdom' ) . "</h4>" ?>
    <?php echo "<h3>" .  __( '20.1 Create a new property value', 'dragonecommerce_trdom' ) . "</h3>" ?>
    <form name="dragonecommerce_form20_1" method="post" action="<?php echo str_replace( '%7E', '~', esc_html($_SERVER['REQUEST_URI'])); ?>" enctype="multipart/form-data">
        <input type="hidden" name="dragonecommercereservezyx987_hidden" value="Y">
        <input type="hidden" name="dragonecommercereservezyx987_hidden_security" value="<?php echo wp_create_nonce("dragonecommercereservezyx987_addPropertyvalue"); ?>">        
        <p><?php _e("Property *: "); ?>
        <select id="dragonecommercereservezyx987_addpropertyvalueproperty"  name="dragonecommercereservezyx987_addpropertyvalueproperty" class="presetto_1">
           <option value="-1">Please choose one...</option>
           <?php foreach ($activeproperties as $property) { ?>
           <option value="<?php echo intval($property->id); ?>" ><?php echo esc_html($property->name) . '(' . intval($property->id) . ')'; ?></option>
           <?php } ?>
         </select></p>
        
        <p><?php _e("Property Value Name *: " ); ?><input type="text" name="dragonecommercereservezyx987_addpropertyvaluepropertyvaluename" value="" size="100"></p>
        <p><?php _e("Property Value Shown Name(Do not use , ; :) *: " ); ?><input type="text" name="dragonecommercereservezyx987_addpropertyvaluepropertyvalueshownname" value="" size="100"></p>

        <p><?php _e("Description: " ); ?><br/><textarea name="dragonecommercereservezyx987_addpropertyvaluepropertyvaluedescription" rows="4" cols="100"></textarea><br/></p>
               
        <p class="submit">
            <input type="submit" name="Submit" onclick="return dragonecommercereservezyx987_validateInput();" value="<?php _e('Create Property Value', 'dragonecommerce_trdom' ) ?>" />
        </p>
    </form><hr />
        
    <?php echo "<h3>" .  __( '20.2 Property value list', 'dragonecommerce_trdom' ) . "</h3>" ?>        
    <div id="dragonecommerce_propertyvalue_container">
        <p>Search Name: <input type="text" id="dragonecommerce_propertyvalue_name" name="dragonecommerce_propertyvalue_name" class="" value="" size="50" /></p>
        <p>Search Shown Name: <input type="text" id="dragonecommerce_propertyvalue_shownname" name="dragonecommerce_propertyvalue_shownname" class="" value="" size="50" /></p>
        <p>Search Description: <input type="text" id="dragonecommerce_propertyvalue_description" name="dragonecommerce_propertyvalue_description" class="" value="" size="50" /></p>
        <p>Search Created From Date (UTC Time): <input type="text" id="dragonecommerce_propertyvalue_fromdate" name="dragonecommerce_propertyvalue_fromdate" class="dragonecommercereservezyx987_datetimepicker" value="" size="50" /></p>    
        <p>Search Created To Date (UTC Time): <input type="text" id="dragonecommerce_propertyvalue_todate" name="dragonecommerce_propertyvalue_todate" class="dragonecommercereservezyx987_datetimepicker" value="" size="50" /></p>    

        <p>Search Property: 
            <select id="dragonecommerce_propertyvalue_property" name="dragonecommerce_propertyvalue_property" class="presetto_1" >
                <option value="-1">Please choose one...</option>
                <?php foreach ($allproperties as $property) { ?>
                <option value="<?php echo intval($property->id); ?>" style="<?php echo $property->status === '1' ? '' : 'color:grey;'; ?>"><?php echo esc_html($property->name); ?></option>
                <?php } ?>        
            </select>    
        </p>

        <p>Search Property Value Status: 
            <select id="dragonecommerce_propertyvalue_status" name="dragonecommerce_propertyvalue_status">
                <option value="-1">Please choose one...</option>
                <option value="0" >Not active</option>
                   <option value="1" >Active</option>            
            </select>
        </p>
        
        <p>
        <input type="button" id="dragonecommerce_propertyvalue_search" name="dragonecommerce_propertyvalue_search" class="" value="Search" onclick="dragonecommercereservezyx987_getPropertyvaluesList();" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <input type="button" id="dragonecommerce_propertyvalue_searchreset" name="dragonecommerce_propertyvalue_searchreset" class="" value="Reset" onclick="dragonecommercereservezyx987_resetPropertyvaluesSearchParameters();" style="background-color:grey;"/>
        </p>    
        
        <p>Items per Page: 
            <select id="dragonecommerce_propertyvalue_itemsperpage" name="dragonecommerce_propertyvalue_itemsperpage" onchange="dragonecommercereservezyx987_getPropertyvaluesList();" class="">
                <option value="-1">Please choose one...</option>
                <option value="10" >10</option>
                <option value="20" >20</option>    
                <option value="40" >40</option>    
                <option value="60" >60</option>    
                <option value="80" >80</option>    
                <option value="100" >100</option>                    
            </select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            
            Sort By:
            <select id="dragonecommerce_propertyvalue_sortby" name="dragonecommerce_propertyvalue_sortby" onchange="dragonecommercereservezyx987_getPropertyvaluesList();" class="">
                <option value="-1">Please choose one...</option>
                <option value="id|asc" >ID low-high</option>
                <option value="id|desc" >ID high-low</option>
                <option value="name|asc" >Name a-z</option>
                <option value="name|desc" >Name z-a</option>                
                <option value="shownname|asc" >Shown Name a-z</option>
                <option value="shownname|desc" >Shown Name z-a</option>
                <option value="createtimeutc|asc" >Created Date old-new</option>
                <option value="createtimeutc|desc" >Created Date new-old</option>                
            </select>    
        </p>    
        
        Total property values: <span id="totalpropertyvaluequantity"></span><img src="<?php echo plugin_dir_url( __FILE__ );  ?>images/loading.gif" id="admin_propertyvaluelist_loader" alt="loading" style="display:none;" />
        
        <div class="row master_pwrapper">
            <div class="col-xs-12 master_mypagination master_mypagination_admin_propertyvalue" style="display: inline-block;"></div>
        </div>

        <table class="table table-bordered table-striped table-hover">
            <thead>
              <tr>
                <th></th>
                <th>ID</th>
                <th>Name</th>
                <th>Shown Name</th>
                <th>Description</th>
                <th>Use Rate</th>
                <th>Rate</th>
                <th>Use Fee</th>
                <th>Fee</th>
                <th>Min Reserve</th>                
                <th>Start Date(UTC)</th>
                <th>End Date(UTC)</th>
                <th>From Country</th>
                <th>From State/Province</th>
                <th>To Country</th>
                <th>To State/Province</th>    
                <th>priority</th>
                <th>Property Name</th>
                <th>Created Date(UTC)</th>
                <th>Status</th>
              </tr>
            </thead>
            <tbody id="dragonecommerce_propertyvalue">
            </tbody>
        </table>

        <div class="row master_pwrapper">
            <div class="col-xs-12 master_mypagination master_mypagination_admin_propertyvalue" style="display: inline-block;"></div>
        </div>        
    </div><hr/>

    <?php echo "<h3>" . __( '21. Distance:', 'dragonecommerce_trdom' ) . "</h3>"; ?>
    <div id="dragonecommerce_distance_container">        
        <p>Items per Page: 
            <select id="dragonecommerce_distance_itemsperpage" name="dragonecommerce_distance_itemsperpage" onchange="dragonecommercereservezyx987_getDistancesList();" class="">
                <option value="-1">Please choose one...</option>
                <option value="10" >10</option>
                <option value="20" >20</option>    
                <option value="40" >40</option>    
                <option value="60" >60</option>    
                <option value="80" >80</option>    
                <option value="100" >100</option>                    
            </select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            
            Sort By:
            <select id="dragonecommerce_distance_sortby" name="dragonecommerce_distance_sortby" onchange="dragonecommercereservezyx987_getDistancesList();" class="">
                <option value="-1">Please choose one...</option>
                <option value="id|asc" >ID low-high</option>
                <option value="id|desc" >ID high-low</option>
                <option value="name|asc" >Name a-z</option>
                <option value="name|desc" >Name z-a</option>
                <option value="createtimeutc|asc" >Created Date old-new</option>
                <option value="createtimeutc|desc" >Created Date new-old</option>                
            </select>    
        </p>    
        
        Total distances: <span id="totaldistancequantity"></span><img src="<?php echo plugin_dir_url( __FILE__ );  ?>images/loading.gif" id="admin_distancelist_loader" alt="loading" style="display:none;" />
        
        <div class="row master_pwrapper">
            <div class="col-xs-12 master_mypagination master_mypagination_admin_distance" style="display: inline-block;"></div>
        </div>

        <table class="table table-bordered table-striped table-hover">
            <thead>
              <tr>
                <th>ID</th>
                <th>Name</th>
                <th>Sign</th>
                <th>Description</th>
                <th>Created Date(UTC)</th>
                <th>Status</th>
              </tr>
            </thead>
            <tbody id="dragonecommerce_distance">
            </tbody>
        </table>

        <div class="row master_pwrapper">
            <div class="col-xs-12 master_mypagination master_mypagination_admin_distance" style="display: inline-block;"></div>
        </div>        
    </div><hr />

    <?php echo "<h3>" . __( '22. Weight:', 'dragonecommerce_trdom' ) . "</h3>"; ?>
    <div id="dragonecommerce_weight_container">        
        <p>Items per Page: 
            <select id="dragonecommerce_weight_itemsperpage" name="dragonecommerce_weight_itemsperpage" onchange="dragonecommercereservezyx987_getWeightsList();" class="">
                <option value="-1">Please choose one...</option>
                <option value="10" >10</option>
                <option value="20" >20</option>    
                <option value="40" >40</option>    
                <option value="60" >60</option>    
                <option value="80" >80</option>    
                <option value="100" >100</option>                    
            </select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            
            Sort By:
            <select id="dragonecommerce_weight_sortby" name="dragonecommerce_weight_sortby" onchange="dragonecommercereservezyx987_getWeightsList();" class="">
                <option value="-1">Please choose one...</option>
                <option value="id|asc" >ID low-high</option>
                <option value="id|desc" >ID high-low</option>
                <option value="name|asc" >Name a-z</option>
                <option value="name|desc" >Name z-a</option>
                <option value="createtimeutc|asc" >Created Date old-new</option>
                <option value="createtimeutc|desc" >Created Date new-old</option>                
            </select>    
        </p>    
        
        Total weights: <span id="totalweightquantity"></span><img src="<?php echo plugin_dir_url( __FILE__ );  ?>images/loading.gif" id="admin_weightlist_loader" alt="loading" style="display:none;" />
        
        <div class="row master_pwrapper">
            <div class="col-xs-12 master_mypagination master_mypagination_admin_weight" style="display: inline-block;"></div>
        </div>

        <table class="table table-bordered table-striped table-hover">
            <thead>
              <tr>
                <th>ID</th>
                <th>Name</th>
                <th>Sign</th>
                <th>Description</th>
                <th>Created Date(UTC)</th>
                <th>Status</th>
              </tr>
            </thead>
            <tbody id="dragonecommerce_weight">
            </tbody>
        </table>

        <div class="row master_pwrapper">
            <div class="col-xs-12 master_mypagination master_mypagination_admin_weight" style="display: inline-block;"></div>
        </div>        
    </div><hr />
    
    <?php echo "<h3>" . __( '23. Email Method:', 'dragonecommerce_trdom' ) . "</h3>"; ?>
    <div id="dragonecommerce_emailmethod_container">        
        <p>Items per Page: 
            <select id="dragonecommerce_emailmethod_itemsperpage" name="dragonecommerce_emailmethod_itemsperpage" onchange="dragonecommercereservezyx987_getEmailmethodsList();" class="">
                <option value="-1">Please choose one...</option>
                <option value="10" >10</option>
                <option value="20" >20</option>    
                <option value="40" >40</option>    
                <option value="60" >60</option>    
                <option value="80" >80</option>    
                <option value="100" >100</option>                    
            </select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            
            Sort By:
            <select id="dragonecommerce_emailmethod_sortby" name="dragonecommerce_emailmethod_sortby" onchange="dragonecommercereservezyx987_getEmailmethodsList();" class="">
                <option value="-1">Please choose one...</option>
                <option value="id|asc" >ID low-high</option>
                <option value="id|desc" >ID high-low</option>
                <option value="name|asc" >Name a-z</option>
                <option value="name|desc" >Name z-a</option>
                <option value="createtimeutc|asc" >Created Date old-new</option>
                <option value="createtimeutc|desc" >Created Date new-old</option>                
            </select>    
        </p>    
        
        Total email methods: <span id="totalemailmethodquantity"></span><img src="<?php echo plugin_dir_url( __FILE__ );  ?>images/loading.gif" id="admin_emailmethodlist_loader" alt="loading" style="display:none;" />
        
        <div class="row master_pwrapper">
            <div class="col-xs-12 master_mypagination master_mypagination_admin_emailmethod" style="display: inline-block;"></div>
        </div>

        <table class="table table-bordered table-striped table-hover">
            <thead>
              <tr>
                <th>ID</th>
                <th>Name</th>
                <th>Description</th>
                <th>Created Date(UTC)</th>
                <th>Status</th>
              </tr>
            </thead>
            <tbody id="dragonecommerce_emailmethod">
            </tbody>
        </table>

        <div class="row master_pwrapper">
            <div class="col-xs-12 master_mypagination master_mypagination_admin_emailmethod" style="display: inline-block;"></div>
        </div>        
    </div><hr />
</div>
<div id="dragonecommerce_tabs_4">    
    <?php echo "<h3>" . __( '24. Setting:', 'dragonecommerce_trdom' ) . "</h3>"; ?>
    <p>EMAIL_METHOD: If one email method does not work, try other options. Mailgun is easy to use. You can try it first.</p>
    <p>For this plugin to get your company's current local date, you must set the timezone value correctly. You can edit the timezone at Dashboard -> Settings -> General -> Timezone -> check if the value has been set correctly. You also need to manually set COMPANY_TIMEZONE_HOURS for the daylight savings time.</p>
    <div id="dragonecommerce_setting_container">
        Total settings: <span id="totalsettingquantity"></span><img src="<?php echo plugin_dir_url( __FILE__ );  ?>images/loading.gif" id="admin_settinglist_loader" alt="loading" style="display:none;" />    
        <table class="table table-bordered table-striped table-hover">
            <thead>
              <tr>
                <th></th>
                <th>Setting ID</th>
                <th>Name</th>
                <th>Value</th>
                <th>Created Date(UTC)</th>
                <th>Status</th>
              </tr>
            </thead>
            <tbody id="dragonecommerce_setting">
            </tbody>
        </table>    
    </div><hr/>

    <?php echo "<h3>" . __( '25. Slideshow:', 'dragonecommerce_trdom' ) . "</h3>"; ?>
    <?php echo "<h3>" .  __( '25.1 Create a new slideshow slide', 'dragonecommerce_trdom' ) . "</h3>" ?>
    <form name="dragonecommerce_form26_1" method="post" action="<?php echo str_replace( '%7E', '~', esc_html($_SERVER['REQUEST_URI'])); ?>" enctype="multipart/form-data">
        <input type="hidden" name="dragonecommercereservezyx987_hidden" value="Y">
        <input type="hidden" name="dragonecommercereservezyx987_hidden_security" value="<?php echo wp_create_nonce("dragonecommercereservezyx987_addSlideshow"); ?>">        
        <p><?php _e("Slide Name: " ); ?><input type="text" name="dragonecommercereservezyx987_addslidename" value="" size="100"><?php _e(" e.g. This month's discount" ); ?></p>
        <p><?php _e("Upload Image File (.jpeg, .jpg, .png) (For best result, image width and height ratio should be about 4:1) *: "); ?>
        <input type="file" name="dragonecommercereservezyx987_addslideuploadslidefile" id="dragonecommercereservezyx987_addslideuploadslidefile" accept=".jpeg,.jpg,.png"></p>                
        <p><?php _e("Description: " ); ?><br/><textarea name="dragonecommercereservezyx987_addslidedescription" rows="4" cols="100"></textarea><br/></p>
               
        <p class="submit">
            <input type="submit" name="Submit" onclick="return dragonecommercereservezyx987_validateInput();" value="<?php _e('Create Slide', 'dragonecommerce_trdom' ) ?>" />
        </p>
    </form><hr />
        
    <?php echo "<h3>" .  __( '25.2 Slideshow list', 'dragonecommerce_trdom' ) . "</h3>" ?>    
    <div id="dragonecommerce_slideshow_container">
        <p>Search Name: <input type="text" id="dragonecommerce_slideshow_name" name="dragonecommerce_slideshow_name" class="" value="" size="50" /></p>
        <p>Search Description: <input type="text" id="dragonecommerce_slideshow_description" name="dragonecommerce_slideshow_description" class="" value="" size="50" /></p>
        <p>Search Slideshow Status: 
            <select id="dragonecommerce_slideshow_status" name="dragonecommerce_slideshow_status">
                <option value="-1">Please choose one...</option>
                <option value="0" >Not active</option>
                   <option value="1" >Active</option>            
            </select>    
        </p>        
        <p>
        <input type="button" id="dragonecommerce_slideshow_search" name="dragonecommerce_slideshow_search" class="" value="Search" onclick="dragonecommercereservezyx987_getSlideshowsList();" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <input type="button" id="dragonecommerce_slideshow_searchreset" name="dragonecommerce_slideshow_searchreset" class="" value="Reset" onclick="dragonecommercereservezyx987_resetSlideshowsSearchParameters();" style="background-color:grey;"/>
        </p>        
        <p>Items per Page: 
            <select id="dragonecommerce_slideshow_itemsperpage" name="dragonecommerce_slideshow_itemsperpage" onchange="dragonecommercereservezyx987_getSlideshowsList();" class="">
                <option value="-1">Please choose one...</option>
                <option value="10" >10</option>
                <option value="20" >20</option>    
                <option value="40" >40</option>    
                <option value="60" >60</option>    
                <option value="80" >80</option>    
                <option value="100" >100</option>                    
            </select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            
            Sort By:
            <select id="dragonecommerce_slideshow_sortby" name="dragonecommerce_slideshow_sortby" onchange="dragonecommercereservezyx987_getSlideshowsList();" class="">
                <option value="-1">Please choose one...</option>
                <option value="id|asc" >ID low-high</option>
                <option value="id|desc" >ID high-low</option>
                <option value="name|asc" >Name a-z</option>
                <option value="name|desc" >Name z-a</option>
                <option value="createtimeutc|asc" >Created Date old-new</option>
                <option value="createtimeutc|desc" >Created Date new-old</option>                
            </select>    
        </p>    
        
        Total slideshows: <span id="totalslideshowquantity"></span><img src="<?php echo plugin_dir_url( __FILE__ );  ?>images/loading.gif" id="admin_slideshowlist_loader" alt="loading" style="display:none;" />
        
        <div class="row master_pwrapper">
            <div class="col-xs-12 master_mypagination master_mypagination_admin_slideshow" style="display: inline-block;"></div>
        </div>

        <table class="table table-bordered table-striped table-hover">
            <thead>
              <tr>
                <th></th>
                <th>ID</th>
                <th>Name</th>
                <th>Description</th>
                <th>File Name</th>
                <th>Sequence Number</th>
                <th>Show Name</th>
                <th>Show Description</th>                
                <th>Created Date(UTC)</th>
                <th>Status</th>
              </tr>
            </thead>
            <tbody id="dragonecommerce_slideshow">
            </tbody>
        </table>

        <div class="row master_pwrapper">
            <div class="col-xs-12 master_mypagination master_mypagination_admin_slideshow" style="display: inline-block;"></div>
        </div>        
    </div><hr/>

    <?php echo "<h3>" . __( '26. Log:', 'dragonecommerce_trdom' ) . "</h3>"; ?>
    <div id="dragonecommerce_log_container">        
        <p>Search Type: 
        <select id="dragonecommerce_log_type" name="dragonecommerce_log_type" class="presetto_1">
           <option value="-1">Please choose one...</option>
           <?php foreach ($log_types as $log_type) { ?>
           <option value="<?php echo esc_html($log_type->type); ?>" ><?php echo esc_html($log_type->type); ?></option>
           <?php } ?>
         </select></p>
        
        <p>Search Process Name: 
        <select id="dragonecommerce_log_processname" name="dragonecommerce_log_processname" class="presetto_1">
           <option value="-1">Please choose one...</option>
           <?php foreach ($log_processnames as $log_processname) { ?>
           <option value="<?php echo esc_html($log_processname->processname); ?>" ><?php echo esc_html($log_processname->processname); ?></option>
           <?php } ?>
         </select></p>

        <p>Search User ID: 
        <select id="dragonecommerce_log_userid" name="dragonecommerce_log_userid" class="presetto_1">
           <option value="-1">Please choose one...</option>
           <?php foreach ($log_userids as $log_userid) { ?>
           <option value="<?php echo ($log_userid === null || empty($log_userid->userid)) ? 0 : intval($log_userid->userid); ?>" ><?php echo ($log_userid === null || empty($log_userid->userid)) ? 0 : intval($log_userid->userid); ?></option>
           <?php } ?>
         </select></p>
        
        <p>Search Description: <input type="text" id="dragonecommerce_log_description" name="dragonecommerce_log_description" class="" value="" size="50" /></p>
        <p>Search Status: 
            <select id="dragonecommerce_log_status" name="dragonecommerce_log_status">
                <option value="-1">Please choose one...</option>
                <option value="0" >Not active</option>
                   <option value="1" >Active</option>            
            </select>    
        </p>        
        <p>
        <input type="button" id="dragonecommerce_log_search" name="dragonecommerce_log_search" class="" value="Search" onclick="dragonecommercereservezyx987_getLogsList();" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <input type="button" id="dragonecommerce_log_searchreset" name="dragonecommerce_log_searchreset" class="" value="Reset" onclick="dragonecommercereservezyx987_resetLogsSearchParameters();" style="background-color:grey;"/>
        </p>        
        <p>Items per Page: 
            <select id="dragonecommerce_log_itemsperpage" name="dragonecommerce_log_itemsperpage" onchange="dragonecommercereservezyx987_getLogsList();" class="">
                <option value="-1">Please choose one...</option>
                <option value="10" >10</option>
                <option value="20" >20</option>    
                <option value="40" >40</option>    
                <option value="60" >60</option>    
                <option value="80" >80</option>    
                <option value="100" >100</option>                    
            </select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            
            Sort By:
            <select id="dragonecommerce_log_sortby" name="dragonecommerce_log_sortby" onchange="dragonecommercereservezyx987_getLogsList();" class="">
                <option value="-1">Please choose one...</option>
                <option value="id|asc" >ID low-high</option>
                <option value="id|desc" >ID high-low</option>
                <option value="type|asc" >Type a-z</option>
                <option value="type|desc" >Type z-a</option>
                <option value="createtimeutc|asc" >Created Date old-new</option>
                <option value="createtimeutc|desc" >Created Date new-old</option>                
            </select>    
        </p>    
        
        Total logs: <span id="totallogquantity"></span><img src="<?php echo plugin_dir_url( __FILE__ );  ?>images/loading.gif" id="admin_loglist_loader" alt="loading" style="display:none;" />
        
        <div class="row master_pwrapper">
            <div class="col-xs-12 master_mypagination master_mypagination_admin_log" style="display: inline-block;"></div>
        </div>

        <table class="table table-bordered table-striped table-hover">
            <thead>
              <tr>
                <th>ID</th>
                <th>Type</th>
                <th>Process Name</th>
                <th>User ID</th>
                <th>Description</th>
                <th>Created Date(UTC)</th>
                <th>Status</th>
              </tr>
            </thead>
            <tbody id="dragonecommerce_log">
            </tbody>
        </table>

        <div class="row master_pwrapper">
            <div class="col-xs-12 master_mypagination master_mypagination_admin_log" style="display: inline-block;"></div>
        </div>        
    </div><br/>
    <form name="dragonecommerce_form27_2" method="post" action="<?php echo str_replace( '%7E', '~', esc_html($_SERVER['REQUEST_URI'])); ?>" enctype="multipart/form-data">
        <input type="hidden" name="dragonecommercereservezyx987_hidden" value="Y">
        <input type="hidden" name="dragonecommercereservezyx987_hidden_security" value="<?php echo wp_create_nonce("dragonecommercereservezyx987_dropLogCreateNewLogTable"); ?>">    

        <p class="submit">
            <input type="submit" name="Submit" class="delete-danger" onclick="return dragonecommercereservezyx987_confirmDrop('log', false);" value="<?php _e('Drop log table and create a new log table', 'dragonecommerce_trdom' ) ?>" />
        </p>
    </form>
</div>
<div id="dragonecommerce_tabs_5">
        <?php echo "<h3>" .  __( "1. Edit a department's products", 'dragonecommerce_trdom' ) . "</h3>" ?>
    <form name="dragonecommerce_form_3_4" method="post" action="<?php echo str_replace( '%7E', '~', esc_html($_SERVER['REQUEST_URI'])); ?>" enctype="multipart/form-data">
        <input type="hidden" name="dragonecommercereservezyx987_hidden" value="Y">
        <input type="hidden" name="dragonecommercereservezyx987_hidden_security" value="<?php echo wp_create_nonce("dragonecommercereservezyx987_updateDepartmentProducts"); ?>">        
        <p><?php _e("Department *: "); ?>
        <select id="dragonecommercereservezyx987_updatedepartmentproductsdepartment" class="presetto_1" name="dragonecommercereservezyx987_updatedepartmentproductsdepartment" onchange="dragonecommercereservezyx987_updatedepartmentproducts_getProductsForDepartment();">
           <option value="-1">Please choose one...</option>
           <?php foreach ($activedepartments as $department) { ?>
           <option value="<?php echo intval($department->id); ?>" style="<?php echo $department->status === '1' ? '' : 'color:grey;'; ?>"><?php echo esc_html($department->name) . " (" . intval($department->id) . ")"; ?></option>
           <?php } ?>
         </select></p>
        <?php _e("Products * (One product can only belong to one department. This update will replace your last time's update to each product's related department.): "); ?>
        <p id="dragonecommercereservezyx987_updatedepartmentproductscheckboxes" style="overflow:auto;max-height:600px;display:none;"></p>        

        <p class="submit">
            <input type="submit" name="Submit" id="dragonecommercereservezyx987_updatedepartmentproductssubmit" onclick="return dragonecommercereservezyx987_validateInput();" value="<?php _e("Update a Department Products", 'dragonecommerce_trdom' ) ?>" />
        </p>
    </form>        
        <hr />    

</div>
<div id="dragonecommerce_tabs_6">
    <p>Attention: the old table(s) will be dropped and all the data in the table(s) will be removed. Then new table(s) will be created.</p>
    <form name="dragonecommerce_form_3_7_1" method="post" action="<?php echo str_replace( '%7E', '~', esc_html($_SERVER['REQUEST_URI'])); ?>" enctype="multipart/form-data">
        <input type="hidden" name="dragonecommercereservezyx987_hidden" value="Y">
        <input type="hidden" name="dragonecommercereservezyx987_hidden_security" value="<?php echo wp_create_nonce("dragonecommercereservezyx987_dropAddressTable"); ?>">    
        <p class="submit">
            <input type="submit" name="Submit" class="delete-danger" onclick="return dragonecommercereservezyx987_confirmDrop('address', false);" value="<?php _e('Drop address table', 'dragonecommerce_trdom' ) ?>" />
        </p>
    </form>
    <form name="dragonecommerce_form_3_7_2" method="post" action="<?php echo str_replace( '%7E', '~', esc_html($_SERVER['REQUEST_URI'])); ?>" enctype="multipart/form-data">
        <input type="hidden" name="dragonecommercereservezyx987_hidden" value="Y">
        <input type="hidden" name="dragonecommercereservezyx987_hidden_security" value="<?php echo wp_create_nonce("dragonecommercereservezyx987_dropChargetypeTable"); ?>">    
        <p class="submit">
            <input type="submit" name="Submit" class="delete-danger" onclick="return dragonecommercereservezyx987_confirmDrop('chargetype', false);" value="<?php _e('Drop chargetype table', 'dragonecommerce_trdom' ) ?>" />
        </p>
    </form>
    <form name="dragonecommerce_form_3_7_3" method="post" action="<?php echo str_replace( '%7E', '~', esc_html($_SERVER['REQUEST_URI'])); ?>" enctype="multipart/form-data">
        <input type="hidden" name="dragonecommercereservezyx987_hidden" value="Y">
        <input type="hidden" name="dragonecommercereservezyx987_hidden_security" value="<?php echo wp_create_nonce("dragonecommercereservezyx987_dropCityAndRelatedTable"); ?>">    
        <p class="submit">
            <input type="submit" name="Submit" class="delete-danger" onclick="return dragonecommercereservezyx987_confirmDrop('city');" value="<?php _e('Drop city and country/province/city/distance table', 'dragonecommerce_trdom' ) ?>" />
        </p>
    </form>
    <form name="dragonecommerce_form_3_7_4" method="post" action="<?php echo str_replace( '%7E', '~', esc_html($_SERVER['REQUEST_URI'])); ?>" enctype="multipart/form-data">
        <input type="hidden" name="dragonecommercereservezyx987_hidden" value="Y">
        <input type="hidden" name="dragonecommercereservezyx987_hidden_security" value="<?php echo wp_create_nonce("dragonecommercereservezyx987_dropCountryTable"); ?>">    
        <p class="submit">
            <input type="submit" name="Submit" class="delete-danger" onclick="return dragonecommercereservezyx987_confirmDrop('country', false);" value="<?php _e('Drop country table', 'dragonecommerce_trdom' ) ?>" />
        </p>
    </form>
    <form name="dragonecommerce_form_3_7_5" method="post" action="<?php echo str_replace( '%7E', '~', esc_html($_SERVER['REQUEST_URI'])); ?>" enctype="multipart/form-data">
        <input type="hidden" name="dragonecommercereservezyx987_hidden" value="Y">
        <input type="hidden" name="dragonecommercereservezyx987_hidden_security" value="<?php echo wp_create_nonce("dragonecommercereservezyx987_dropCurrencyTable"); ?>">    
        <p class="submit">
            <input type="submit" name="Submit" class="delete-danger" onclick="return dragonecommercereservezyx987_confirmDrop('currency', false);" value="<?php _e('Drop currency table', 'dragonecommerce_trdom' ) ?>" />
        </p>
    </form>
    <form name="dragonecommerce_form_3_7_6" method="post" action="<?php echo str_replace( '%7E', '~', esc_html($_SERVER['REQUEST_URI'])); ?>" enctype="multipart/form-data">
        <input type="hidden" name="dragonecommercereservezyx987_hidden" value="Y">
        <input type="hidden" name="dragonecommercereservezyx987_hidden_security" value="<?php echo wp_create_nonce("dragonecommercereservezyx987_dropCurrencyexchangerateTable"); ?>">    
        <p class="submit">
            <input type="submit" name="Submit" class="delete-danger" onclick="return dragonecommercereservezyx987_confirmDrop('currencyexchangerate', false);" value="<?php _e('Drop currencyexchangerate table', 'dragonecommerce_trdom' ) ?>" />
        </p>
    </form>
    <form name="dragonecommerce_form_3_7_7" method="post" action="<?php echo str_replace( '%7E', '~', esc_html($_SERVER['REQUEST_URI'])); ?>" enctype="multipart/form-data">
        <input type="hidden" name="dragonecommercereservezyx987_hidden" value="Y">
        <input type="hidden" name="dragonecommercereservezyx987_hidden_security" value="<?php echo wp_create_nonce("dragonecommercereservezyx987_dropDepartmentTable"); ?>">    
        <p class="submit">
            <input type="submit" name="Submit" class="delete-danger" onclick="return dragonecommercereservezyx987_confirmDrop('department', false);" value="<?php _e('Drop department table', 'dragonecommerce_trdom' ) ?>" />
        </p>
    </form>
    <form name="dragonecommerce_form_3_7_8" method="post" action="<?php echo str_replace( '%7E', '~', esc_html($_SERVER['REQUEST_URI'])); ?>" enctype="multipart/form-data">
        <input type="hidden" name="dragonecommercereservezyx987_hidden" value="Y">
        <input type="hidden" name="dragonecommercereservezyx987_hidden_security" value="<?php echo wp_create_nonce("dragonecommercereservezyx987_dropGroupTable"); ?>">    
        <p class="submit">
            <input type="submit" name="Submit" class="delete-danger" onclick="return dragonecommercereservezyx987_confirmDrop('group');" value="<?php _e('Drop group table and related tables (group/property, order/group, product/group bridge table)', 'dragonecommerce_trdom' ) ?>" />
        </p>
    </form>
    <form name="dragonecommerce_form_3_7_9" method="post" action="<?php echo str_replace( '%7E', '~', esc_html($_SERVER['REQUEST_URI'])); ?>" enctype="multipart/form-data">
        <input type="hidden" name="dragonecommercereservezyx987_hidden" value="Y">
        <input type="hidden" name="dragonecommercereservezyx987_hidden_security" value="<?php echo wp_create_nonce("dragonecommercereservezyx987_dropGroupcategoryTable"); ?>">    
        <p class="submit">
            <input type="submit" name="Submit" class="delete-danger" onclick="return dragonecommercereservezyx987_confirmDrop('groupcategory', false);" value="<?php _e('Drop groupcategory table', 'dragonecommerce_trdom' ) ?>" />
        </p>
    </form>    
    <form name="dragonecommerce_form_3_7_10" method="post" action="<?php echo str_replace( '%7E', '~', esc_html($_SERVER['REQUEST_URI'])); ?>" enctype="multipart/form-data">
        <input type="hidden" name="dragonecommercereservezyx987_hidden" value="Y">
        <input type="hidden" name="dragonecommercereservezyx987_hidden_security" value="<?php echo wp_create_nonce("dragonecommercereservezyx987_dropLogTable"); ?>">    
        <p class="submit">
            <input type="submit" name="Submit" class="delete-danger" onclick="return dragonecommercereservezyx987_confirmDrop('log', false);" value="<?php _e('Drop log table', 'dragonecommerce_trdom' ) ?>" />
        </p>
    </form>
    <form name="dragonecommerce_form_3_7_11" method="post" action="<?php echo str_replace( '%7E', '~', esc_html($_SERVER['REQUEST_URI'])); ?>" enctype="multipart/form-data">
        <input type="hidden" name="dragonecommercereservezyx987_hidden" value="Y">
        <input type="hidden" name="dragonecommercereservezyx987_hidden_security" value="<?php echo wp_create_nonce("dragonecommercereservezyx987_dropOrderTable"); ?>">    
        <p class="submit">
            <input type="submit" name="Submit" class="delete-danger" onclick="return dragonecommercereservezyx987_confirmDrop('order');" value="<?php _e('Drop order table and related tables (order/group, order/propertyvalue, product/order bridge table)', 'dragonecommerce_trdom' ) ?>" />
        </p>
    </form>
    <form name="dragonecommerce_form_3_7_12" method="post" action="<?php echo str_replace( '%7E', '~', esc_html($_SERVER['REQUEST_URI'])); ?>" enctype="multipart/form-data">
        <input type="hidden" name="dragonecommercereservezyx987_hidden" value="Y">
        <input type="hidden" name="dragonecommercereservezyx987_hidden_security" value="<?php echo wp_create_nonce("dragonecommercereservezyx987_dropProcessstatusTable"); ?>">
        <p class="submit">
            <input type="submit" name="Submit" class="delete-danger" onclick="return dragonecommercereservezyx987_confirmDrop('processstatus', false);" value="<?php _e('Drop processstatus table', 'dragonecommerce_trdom' ) ?>" />
        </p>
    </form>
    <form name="dragonecommerce_form_3_7_13" method="post" action="<?php echo str_replace( '%7E', '~', esc_html($_SERVER['REQUEST_URI'])); ?>" enctype="multipart/form-data">
        <input type="hidden" name="dragonecommercereservezyx987_hidden" value="Y">
        <input type="hidden" name="dragonecommercereservezyx987_hidden_security" value="<?php echo wp_create_nonce("dragonecommercereservezyx987_dropProductTable"); ?>">    
        <p class="submit">
            <input type="submit" name="Submit" class="delete-danger" onclick="return dragonecommercereservezyx987_confirmDrop('product');" value="<?php _e('Drop product table and related tables (product/group, product/order, product/propertyvalue, product/propertyvalue/store, product/quantity alert, product/store bridge table)', 'dragonecommerce_trdom' ) ?>" />
        </p>
    </form>    
    <form name="dragonecommerce_form_3_7_14" method="post" action="<?php echo str_replace( '%7E', '~', esc_html($_SERVER['REQUEST_URI'])); ?>" enctype="multipart/form-data">
        <input type="hidden" name="dragonecommercereservezyx987_hidden" value="Y">
        <input type="hidden" name="dragonecommercereservezyx987_hidden_security" value="<?php echo wp_create_nonce("dragonecommercereservezyx987_dropPropertyTable"); ?>">    
        <p class="submit">
            <input type="submit" name="Submit" class="delete-danger" onclick="return dragonecommercereservezyx987_confirmDrop('property', false);" value="<?php _e('Drop property table', 'dragonecommerce_trdom' ) ?>" />
        </p>
    </form>
    <form name="dragonecommerce_form_3_7_15" method="post" action="<?php echo str_replace( '%7E', '~', esc_html($_SERVER['REQUEST_URI'])); ?>" enctype="multipart/form-data">
        <input type="hidden" name="dragonecommercereservezyx987_hidden" value="Y">
        <input type="hidden" name="dragonecommercereservezyx987_hidden_security" value="<?php echo wp_create_nonce("dragonecommercereservezyx987_dropPropertyvalueTable"); ?>">    
        <p class="submit">
            <input type="submit" name="Submit" class="delete-danger" onclick="return dragonecommercereservezyx987_confirmDrop('propertyvalue', false);" value="<?php _e('Drop property value table', 'dragonecommerce_trdom' ) ?>" />
        </p>        
    </form>
    <form name="dragonecommerce_form_3_7_16" method="post" action="<?php echo str_replace( '%7E', '~', esc_html($_SERVER['REQUEST_URI'])); ?>" enctype="multipart/form-data">
        <input type="hidden" name="dragonecommercereservezyx987_hidden" value="Y">
        <input type="hidden" name="dragonecommercereservezyx987_hidden_security" value="<?php echo wp_create_nonce("dragonecommercereservezyx987_dropProvinceTable"); ?>">    
        <p class="submit">
            <input type="submit" name="Submit" class="delete-danger" onclick="return dragonecommercereservezyx987_confirmDrop('province');" value="<?php _e('Drop province table and related tables (country/province/city/distance bridge table)', 'dragonecommerce_trdom' ) ?>" />
        </p>
    </form>
    <form name="dragonecommerce_form_3_7_17" method="post" action="<?php echo str_replace( '%7E', '~', esc_html($_SERVER['REQUEST_URI'])); ?>" enctype="multipart/form-data">
        <input type="hidden" name="dragonecommercereservezyx987_hidden" value="Y">
        <input type="hidden" name="dragonecommercereservezyx987_hidden_security" value="<?php echo wp_create_nonce("dragonecommercereservezyx987_dropSettingTable"); ?>">    
        <p class="submit">
            <input type="submit" name="Submit" class="delete-danger" onclick="return dragonecommercereservezyx987_confirmDrop('setting', false);" value="<?php _e('Drop setting table', 'dragonecommerce_trdom' ) ?>" />
        </p>
    </form>
    <form name="dragonecommerce_form_3_7_18" method="post" action="<?php echo str_replace( '%7E', '~', esc_html($_SERVER['REQUEST_URI'])); ?>" enctype="multipart/form-data">
        <input type="hidden" name="dragonecommercereservezyx987_hidden" value="Y">
        <input type="hidden" name="dragonecommercereservezyx987_hidden_security" value="<?php echo wp_create_nonce("dragonecommercereservezyx987_dropSlideshowTable"); ?>">        
        <p class="submit">
            <input type="submit" name="Submit" class="delete-danger" onclick="return dragonecommercereservezyx987_confirmDrop('slideshow', false);" value="<?php _e('Drop slideshow table', 'dragonecommerce_trdom' ) ?>" />
        </p>
    </form>
    <form name="dragonecommerce_form_3_7_19" method="post" action="<?php echo str_replace( '%7E', '~', esc_html($_SERVER['REQUEST_URI'])); ?>" enctype="multipart/form-data">
        <input type="hidden" name="dragonecommercereservezyx987_hidden" value="Y">
        <input type="hidden" name="dragonecommercereservezyx987_hidden_security" value="<?php echo wp_create_nonce("dragonecommercereservezyx987_dropStoreTable"); ?>">        
        <p class="submit">
            <input type="submit" name="Submit" class="delete-danger" onclick="return dragonecommercereservezyx987_confirmDrop('store', false);" value="<?php _e('Drop store table', 'dragonecommerce_trdom' ) ?>" />
        </p>
    </form>
    <form name="dragonecommerce_form_3_7_20" method="post" action="<?php echo str_replace( '%7E', '~', esc_html($_SERVER['REQUEST_URI'])); ?>" enctype="multipart/form-data">
        <input type="hidden" name="dragonecommercereservezyx987_hidden" value="Y">
        <input type="hidden" name="dragonecommercereservezyx987_hidden_security" value="<?php echo wp_create_nonce("dragonecommercereservezyx987_dropUserStatusAndUserTokenTable"); ?>">    
        <p class="submit">
            <input type="submit" name="Submit" class="delete-danger" onclick="return dragonecommercereservezyx987_confirmDrop('user status and user token', false);" value="<?php _e('Drop user status and user token tables', 'dragonecommerce_trdom' ) ?>" />
        </p>
    </form>
    <form name="dragonecommerce_form_3_7_21" method="post" action="<?php echo str_replace( '%7E', '~', esc_html($_SERVER['REQUEST_URI'])); ?>" enctype="multipart/form-data">
        <input type="hidden" name="dragonecommercereservezyx987_hidden" value="Y">
        <input type="hidden" name="dragonecommercereservezyx987_hidden_security" value="<?php echo wp_create_nonce("dragonecommercereservezyx987_dropAllTables"); ?>">        
        <p class="submit">
            <input type="submit" name="Submit" class="delete-danger" onclick="return dragonecommercereservezyx987_confirmDrop('all', false);" value="<?php _e('Drop all the ecommerce tables', 'dragonecommerce_trdom' ) ?>" />
        </p>
    </form>
</div>
<div id="dragonecommerce_tabs_7">
<h3>Here is the manual for this plugin:</h3><br/>
<a style="color:blue;" href="<?php echo plugins_url('documentation_dragonecommercereservefree.pdf', __FILE__ ); ?>" target="_blank">Manual</a><br/><br/>

<h3>Below are the documents for your ecommerce website's users:</h3><br/>
<a style="color:blue;" href="<?php echo plugins_url('files/cookiepolicy.pdf', __FILE__ ); ?>" target="_blank">Cookie Policy</a><br/><br/>
<a style="color:blue;" href="<?php echo plugins_url('files/privacy.pdf', __FILE__ ); ?>" target="_blank">Privacy Policy</a><br/><br/>
<a style="color:blue;" href="<?php echo plugins_url('files/terms.pdf', __FILE__ ); ?>" target="_blank">Terms and Conditions</a><br/>

</div>
</div>
    
</div>