Plugin Directory

Changeset 3452297


Ignore:
Timestamp:
02/02/2026 05:40:48 PM (2 months ago)
Author:
steadfastit
Message:

Fix css loading issue.

Location:
steadfast-api
Files:
24 added
4 edited

Legend:

Unmodified
Added
Removed
  • steadfast-api/trunk/assets/admin/js/scripts.js

    r3445113 r3452297  
    289289            }, type: 'post',
    290290
    291             success: function (response) {
    292                 console.log(response)
    293                 if (response.success) {
    294                     let success_ratio = response.data.success_ratio;
    295                     let errorMessage = response.data.error;
    296                     let current = response.data.current;
    297                     let limit = response.data.limit;
    298 
    299                     if (errorMessage) {
    300                         content = `
    301                         <h2>Sorry!</h2>
    302                         <p>${errorMessage}</p>
    303                         <p><strong>Already Checked:</strong> ${current}</p>
    304                         <p><strong>Your Limit :</strong> ${limit}</p>
    305                     `;
    306                     } else {
    307                         var content = `
    308                         <h2>📊 SteadFast Success Rate</h2>
    309                         <p><strong>📦Total Orders :</strong> ${response.data.total_parcels || 0}</p>
    310                         <p><strong>✅Total Delivered :</strong> ${response.data.total_delivered || 0}</p>
    311                         <p><strong>❌Total Cancelled:</strong> ${response.data.total_cancelled || 0}</p>
    312                     `;
    313                     }
    314 
    315                     $('#stdf-customer-info-content').html(content);
    316 
    317                     thisButton.find('span').text(success_ratio);
    318                     thisButton.addClass("stdf-success-ratio");
    319                     $modal.show();
    320                     $overlay.show();
    321                 } else {
    322                     alert('Error: ' + response.data);
    323                 }
    324             },
     291            success: function(response) {
     292
     293           
     294            let content = '';
     295            let success_ratio = response.data.success_ratio || '0.00%';
     296           
     297            if (response.data.message && response.data.message.trim().length > 0) {
     298                content = `
     299                    <h2>${response.data.message}</h2>
     300                    <p><strong>Attempts Left:</strong> ${response.data.attempts_left || 0}</p>
     301                `;
     302            }
     303            else if (response.data.error) {
     304                content = `
     305                    <h2>Sorry!</h2>
     306                    <p>${response.data.error}</p>
     307                    <p><strong>Already Checked:</strong> ${response.data.current || 0}</p>
     308                    <p><strong>Your Limit:</strong> ${response.data.limit || 0}</p>
     309                `;
     310            }
     311            else {
     312                content = `
     313                    <h2>📊 SteadFast Success Rate</h2>
     314                    <p><strong>📦 Total Orders:</strong> ${response.data.total_parcels || 0}</p>
     315                    <p><strong>✅ Total Delivered:</strong> ${response.data.total_delivered || 0}</p>
     316                    <p><strong>❌ Total Cancelled:</strong> ${response.data.total_cancelled || 0}</p>
     317                    <p><strong>📈 Success Ratio:</strong> ${success_ratio}</p>
     318                `;
     319            }
     320           
     321            $('#stdf-customer-info-content').html(content);
     322            thisButton.find('span').text(success_ratio);
     323            thisButton.addClass("stdf-success-ratio");
     324           
     325            $modal.show();
     326            $overlay.show();
     327        },
    325328            error: function () {
    326329                thisButton.html('Failed');
  • steadfast-api/trunk/includes/functions.php

    r3407125 r3452297  
    450450        $body = wp_remote_retrieve_body($response);
    451451        $order_info = json_decode($body, true);
    452         $success_ratio = stdf_calculate_success_rate($order_info['total_parcels'],$order_info['total_delivered']);
    453         update_post_meta( $order_id, 'stdf_success_ratio', $success_ratio );
     452
     453
     454        if (isset($order_info['status']) && (string) $order_info['status'] === '401') {
     455
     456            $order_info['authorization'] = $order_info['status'];
     457            return $order_info;
     458        }
     459
     460
     461        $total_parcels   = isset($order_info['total_parcels']) ? (int) $order_info['total_parcels'] : 0;
     462        $total_delivered = isset($order_info['total_delivered']) ? (int) $order_info['total_delivered'] : 0;
     463
     464        $success_ratio = stdf_calculate_success_rate($total_parcels, $total_delivered);
     465
     466        update_post_meta($order_id, 'stdf_success_ratio', $success_ratio);
    454467
    455468        $order_info['success_ratio'] = $success_ratio;
    456 
    457469
    458470        return $order_info;
  • steadfast-api/trunk/readme.txt

    r3445113 r3452297  
    33Donate link: https://steadfast.com.bd/
    44Plugin URI: https://wordpress.org/plugins/steadfast-api/
    5 Tags: steadfast, steadfast courier, send to steadfast, steadfast api
     5Tags: steadfast, steadfast courier, packly, steadfast api
    66Requires at least: 6.5.5
    77Tested up to: 6.9
    88Requires PHP: 8.0
    9 Stable tag: 1.0.4
     9Stable tag: 1.0.5
    1010Tested up to WooCommerce: 10.3.5
    1111Text Domain: steadfast-api
     
    9494== Changelog ==
    9595
     96= 1.0.5 = 
     97* Fix css loading issue.
     98
    9699= 1.0.4 = 
    97100* Show Courier Score Check Limit Message.
  • steadfast-api/trunk/steadfast-api.php

    r3445113 r3452297  
    1414
    1515defined( 'ABSPATH' ) || exit;
    16 defined( 'STDF_PLUGIN_URL' ) || define( 'STDF_PLUGIN_URL', WP_PLUGIN_URL . '/' . plugin_basename( dirname( __FILE__ ) ) . '/' );
     16defined( 'STDF_PLUGIN_URL' ) || define( 'STDF_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
    1717defined( 'STDF_PLUGIN_DIR' ) || define( 'STDF_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
    1818defined( 'STDF_PLUGIN_FILE' ) || define( 'STDF_PLUGIN_FILE', plugin_basename( __FILE__ ) );
    19 defined( 'STDF_PLUGIN_VERSION' ) || define( 'STDF_PLUGIN_VERSION', '1.0.0' );
     19defined( 'STDF_PLUGIN_VERSION' ) || define( 'STDF_PLUGIN_VERSION', '1.0.4' );
     20
    2021
    2122
Note: See TracChangeset for help on using the changeset viewer.